From 406430263829b5495407905e3f3a0d7a8abac29c Mon Sep 17 00:00:00 2001 From: Jackson Morgan Date: Sun, 4 May 2025 21:51:28 -0400 Subject: [PATCH] Added link query and set up link query tests --- packages/solid-react/src/defaultIntance.ts | 1 + .../test/.ldo/solidProfile.context.ts | 459 +++++++++++ .../test/.ldo/solidProfile.schema.ts | 749 ++++++++++++++++++ .../test/.ldo/solidProfile.shapeTypes.ts | 71 ++ .../test/.ldo/solidProfile.typings.ts | 293 +++++++ .../template/link-query/main-profile.ttl | 7 + .../template/link-query/other-profile.ttl | 7 + .../template/link-query/third-profile.ttl | 7 + 8 files changed, 1594 insertions(+) create mode 100644 packages/solid-react/test/.ldo/solidProfile.context.ts create mode 100644 packages/solid-react/test/.ldo/solidProfile.schema.ts create mode 100644 packages/solid-react/test/.ldo/solidProfile.shapeTypes.ts create mode 100644 packages/solid-react/test/.ldo/solidProfile.typings.ts create mode 100644 packages/solid-react/test/test-server/configs/template/link-query/main-profile.ttl create mode 100644 packages/solid-react/test/test-server/configs/template/link-query/other-profile.ttl create mode 100644 packages/solid-react/test/test-server/configs/template/link-query/third-profile.ttl diff --git a/packages/solid-react/src/defaultIntance.ts b/packages/solid-react/src/defaultIntance.ts index 10f80fa..b72c746 100644 --- a/packages/solid-react/src/defaultIntance.ts +++ b/packages/solid-react/src/defaultIntance.ts @@ -13,6 +13,7 @@ export const { useResource, useSubject, useSubscribeToResource, + useLinkQuery, } = createLdoReactMethods([solidConnectedPlugin]); export const { BrowserSolidLdoProvider, useSolidAuth, useRootContainerFor } = diff --git a/packages/solid-react/test/.ldo/solidProfile.context.ts b/packages/solid-react/test/.ldo/solidProfile.context.ts new file mode 100644 index 0000000..9fdffc3 --- /dev/null +++ b/packages/solid-react/test/.ldo/solidProfile.context.ts @@ -0,0 +1,459 @@ +import { LdoJsonldContext } from "@ldo/ldo"; + +/** + * ============================================================================= + * solidProfileContext: JSONLD Context for solidProfile + * ============================================================================= + */ +export const solidProfileContext: LdoJsonldContext = { + type: { + "@id": "@type", + }, + Person: { + "@id": "http://schema.org/Person", + "@context": { + type: { + "@id": "@type", + }, + fn: { + "@id": "http://www.w3.org/2006/vcard/ns#fn", + "@type": "http://www.w3.org/2001/XMLSchema#string", + }, + name: { + "@id": "http://xmlns.com/foaf/0.1/name", + "@type": "http://www.w3.org/2001/XMLSchema#string", + }, + hasAddress: { + "@id": "http://www.w3.org/2006/vcard/ns#hasAddress", + "@type": "@id", + "@isCollection": true, + }, + hasEmail: { + "@id": "http://www.w3.org/2006/vcard/ns#hasEmail", + "@type": "@id", + "@isCollection": true, + }, + hasPhoto: { + "@id": "http://www.w3.org/2006/vcard/ns#hasPhoto", + "@type": "@id", + }, + img: { + "@id": "http://xmlns.com/foaf/0.1/img", + "@type": "http://www.w3.org/2001/XMLSchema#string", + }, + hasTelephone: { + "@id": "http://www.w3.org/2006/vcard/ns#hasTelephone", + "@type": "@id", + "@isCollection": true, + }, + phone: { + "@id": "http://www.w3.org/2006/vcard/ns#phone", + "@type": "http://www.w3.org/2001/XMLSchema#string", + }, + organizationName: { + "@id": "http://www.w3.org/2006/vcard/ns#organization-name", + "@type": "http://www.w3.org/2001/XMLSchema#string", + }, + role: { + "@id": "http://www.w3.org/2006/vcard/ns#role", + "@type": "http://www.w3.org/2001/XMLSchema#string", + }, + trustedApp: { + "@id": "http://www.w3.org/ns/auth/acl#trustedApp", + "@type": "@id", + "@isCollection": true, + }, + key: { + "@id": "http://www.w3.org/ns/auth/cert#key", + "@type": "@id", + "@isCollection": true, + }, + inbox: { + "@id": "http://www.w3.org/ns/ldp#inbox", + "@type": "@id", + }, + preferencesFile: { + "@id": "http://www.w3.org/ns/pim/space#preferencesFile", + "@type": "@id", + }, + storage: { + "@id": "http://www.w3.org/ns/pim/space#storage", + "@type": "@id", + "@isCollection": true, + }, + account: { + "@id": "http://www.w3.org/ns/solid/terms#account", + "@type": "@id", + }, + privateTypeIndex: { + "@id": "http://www.w3.org/ns/solid/terms#privateTypeIndex", + "@type": "@id", + "@isCollection": true, + }, + publicTypeIndex: { + "@id": "http://www.w3.org/ns/solid/terms#publicTypeIndex", + "@type": "@id", + "@isCollection": true, + }, + knows: { + "@id": "http://xmlns.com/foaf/0.1/knows", + "@type": "@id", + "@isCollection": true, + }, + }, + }, + Person2: { + "@id": "http://xmlns.com/foaf/0.1/Person", + "@context": { + type: { + "@id": "@type", + }, + fn: { + "@id": "http://www.w3.org/2006/vcard/ns#fn", + "@type": "http://www.w3.org/2001/XMLSchema#string", + }, + name: { + "@id": "http://xmlns.com/foaf/0.1/name", + "@type": "http://www.w3.org/2001/XMLSchema#string", + }, + hasAddress: { + "@id": "http://www.w3.org/2006/vcard/ns#hasAddress", + "@type": "@id", + "@isCollection": true, + }, + hasEmail: { + "@id": "http://www.w3.org/2006/vcard/ns#hasEmail", + "@type": "@id", + "@isCollection": true, + }, + hasPhoto: { + "@id": "http://www.w3.org/2006/vcard/ns#hasPhoto", + "@type": "@id", + }, + img: { + "@id": "http://xmlns.com/foaf/0.1/img", + "@type": "http://www.w3.org/2001/XMLSchema#string", + }, + hasTelephone: { + "@id": "http://www.w3.org/2006/vcard/ns#hasTelephone", + "@type": "@id", + "@isCollection": true, + }, + phone: { + "@id": "http://www.w3.org/2006/vcard/ns#phone", + "@type": "http://www.w3.org/2001/XMLSchema#string", + }, + organizationName: { + "@id": "http://www.w3.org/2006/vcard/ns#organization-name", + "@type": "http://www.w3.org/2001/XMLSchema#string", + }, + role: { + "@id": "http://www.w3.org/2006/vcard/ns#role", + "@type": "http://www.w3.org/2001/XMLSchema#string", + }, + trustedApp: { + "@id": "http://www.w3.org/ns/auth/acl#trustedApp", + "@type": "@id", + "@isCollection": true, + }, + key: { + "@id": "http://www.w3.org/ns/auth/cert#key", + "@type": "@id", + "@isCollection": true, + }, + inbox: { + "@id": "http://www.w3.org/ns/ldp#inbox", + "@type": "@id", + }, + preferencesFile: { + "@id": "http://www.w3.org/ns/pim/space#preferencesFile", + "@type": "@id", + }, + storage: { + "@id": "http://www.w3.org/ns/pim/space#storage", + "@type": "@id", + "@isCollection": true, + }, + account: { + "@id": "http://www.w3.org/ns/solid/terms#account", + "@type": "@id", + }, + privateTypeIndex: { + "@id": "http://www.w3.org/ns/solid/terms#privateTypeIndex", + "@type": "@id", + "@isCollection": true, + }, + publicTypeIndex: { + "@id": "http://www.w3.org/ns/solid/terms#publicTypeIndex", + "@type": "@id", + "@isCollection": true, + }, + knows: { + "@id": "http://xmlns.com/foaf/0.1/knows", + "@type": "@id", + "@isCollection": true, + }, + }, + }, + fn: { + "@id": "http://www.w3.org/2006/vcard/ns#fn", + "@type": "http://www.w3.org/2001/XMLSchema#string", + }, + name: { + "@id": "http://xmlns.com/foaf/0.1/name", + "@type": "http://www.w3.org/2001/XMLSchema#string", + }, + hasAddress: { + "@id": "http://www.w3.org/2006/vcard/ns#hasAddress", + "@type": "@id", + "@isCollection": true, + }, + countryName: { + "@id": "http://www.w3.org/2006/vcard/ns#country-name", + "@type": "http://www.w3.org/2001/XMLSchema#string", + }, + locality: { + "@id": "http://www.w3.org/2006/vcard/ns#locality", + "@type": "http://www.w3.org/2001/XMLSchema#string", + }, + postalCode: { + "@id": "http://www.w3.org/2006/vcard/ns#postal-code", + "@type": "http://www.w3.org/2001/XMLSchema#string", + }, + region: { + "@id": "http://www.w3.org/2006/vcard/ns#region", + "@type": "http://www.w3.org/2001/XMLSchema#string", + }, + streetAddress: { + "@id": "http://www.w3.org/2006/vcard/ns#street-address", + "@type": "http://www.w3.org/2001/XMLSchema#string", + }, + hasEmail: { + "@id": "http://www.w3.org/2006/vcard/ns#hasEmail", + "@type": "@id", + "@isCollection": true, + }, + Dom: { + "@id": "http://www.w3.org/2006/vcard/ns#Dom", + "@context": { + type: { + "@id": "@type", + }, + value: { + "@id": "http://www.w3.org/2006/vcard/ns#value", + "@type": "@id", + }, + }, + }, + Home: { + "@id": "http://www.w3.org/2006/vcard/ns#Home", + "@context": { + type: { + "@id": "@type", + }, + value: { + "@id": "http://www.w3.org/2006/vcard/ns#value", + "@type": "@id", + }, + }, + }, + ISDN: { + "@id": "http://www.w3.org/2006/vcard/ns#ISDN", + "@context": { + type: { + "@id": "@type", + }, + value: { + "@id": "http://www.w3.org/2006/vcard/ns#value", + "@type": "@id", + }, + }, + }, + Internet: { + "@id": "http://www.w3.org/2006/vcard/ns#Internet", + "@context": { + type: { + "@id": "@type", + }, + value: { + "@id": "http://www.w3.org/2006/vcard/ns#value", + "@type": "@id", + }, + }, + }, + Intl: { + "@id": "http://www.w3.org/2006/vcard/ns#Intl", + "@context": { + type: { + "@id": "@type", + }, + value: { + "@id": "http://www.w3.org/2006/vcard/ns#value", + "@type": "@id", + }, + }, + }, + Label: { + "@id": "http://www.w3.org/2006/vcard/ns#Label", + "@context": { + type: { + "@id": "@type", + }, + value: { + "@id": "http://www.w3.org/2006/vcard/ns#value", + "@type": "@id", + }, + }, + }, + Parcel: { + "@id": "http://www.w3.org/2006/vcard/ns#Parcel", + "@context": { + type: { + "@id": "@type", + }, + value: { + "@id": "http://www.w3.org/2006/vcard/ns#value", + "@type": "@id", + }, + }, + }, + Postal: { + "@id": "http://www.w3.org/2006/vcard/ns#Postal", + "@context": { + type: { + "@id": "@type", + }, + value: { + "@id": "http://www.w3.org/2006/vcard/ns#value", + "@type": "@id", + }, + }, + }, + Pref: { + "@id": "http://www.w3.org/2006/vcard/ns#Pref", + "@context": { + type: { + "@id": "@type", + }, + value: { + "@id": "http://www.w3.org/2006/vcard/ns#value", + "@type": "@id", + }, + }, + }, + Work: { + "@id": "http://www.w3.org/2006/vcard/ns#Work", + "@context": { + type: { + "@id": "@type", + }, + value: { + "@id": "http://www.w3.org/2006/vcard/ns#value", + "@type": "@id", + }, + }, + }, + X400: { + "@id": "http://www.w3.org/2006/vcard/ns#X400", + "@context": { + type: { + "@id": "@type", + }, + value: { + "@id": "http://www.w3.org/2006/vcard/ns#value", + "@type": "@id", + }, + }, + }, + value: { + "@id": "http://www.w3.org/2006/vcard/ns#value", + "@type": "@id", + }, + hasPhoto: { + "@id": "http://www.w3.org/2006/vcard/ns#hasPhoto", + "@type": "@id", + }, + img: { + "@id": "http://xmlns.com/foaf/0.1/img", + "@type": "http://www.w3.org/2001/XMLSchema#string", + }, + hasTelephone: { + "@id": "http://www.w3.org/2006/vcard/ns#hasTelephone", + "@type": "@id", + "@isCollection": true, + }, + phone: { + "@id": "http://www.w3.org/2006/vcard/ns#phone", + "@type": "http://www.w3.org/2001/XMLSchema#string", + }, + organizationName: { + "@id": "http://www.w3.org/2006/vcard/ns#organization-name", + "@type": "http://www.w3.org/2001/XMLSchema#string", + }, + role: { + "@id": "http://www.w3.org/2006/vcard/ns#role", + "@type": "http://www.w3.org/2001/XMLSchema#string", + }, + trustedApp: { + "@id": "http://www.w3.org/ns/auth/acl#trustedApp", + "@type": "@id", + "@isCollection": true, + }, + mode: { + "@id": "http://www.w3.org/ns/auth/acl#mode", + "@isCollection": true, + }, + Append: "http://www.w3.org/ns/auth/acl#Append", + Control: "http://www.w3.org/ns/auth/acl#Control", + Read: "http://www.w3.org/ns/auth/acl#Read", + Write: "http://www.w3.org/ns/auth/acl#Write", + origin: { + "@id": "http://www.w3.org/ns/auth/acl#origin", + "@type": "@id", + }, + key: { + "@id": "http://www.w3.org/ns/auth/cert#key", + "@type": "@id", + "@isCollection": true, + }, + modulus: { + "@id": "http://www.w3.org/ns/auth/cert#modulus", + "@type": "http://www.w3.org/2001/XMLSchema#string", + }, + exponent: { + "@id": "http://www.w3.org/ns/auth/cert#exponent", + "@type": "http://www.w3.org/2001/XMLSchema#integer", + }, + inbox: { + "@id": "http://www.w3.org/ns/ldp#inbox", + "@type": "@id", + }, + preferencesFile: { + "@id": "http://www.w3.org/ns/pim/space#preferencesFile", + "@type": "@id", + }, + storage: { + "@id": "http://www.w3.org/ns/pim/space#storage", + "@type": "@id", + "@isCollection": true, + }, + account: { + "@id": "http://www.w3.org/ns/solid/terms#account", + "@type": "@id", + }, + privateTypeIndex: { + "@id": "http://www.w3.org/ns/solid/terms#privateTypeIndex", + "@type": "@id", + "@isCollection": true, + }, + publicTypeIndex: { + "@id": "http://www.w3.org/ns/solid/terms#publicTypeIndex", + "@type": "@id", + "@isCollection": true, + }, + knows: { + "@id": "http://xmlns.com/foaf/0.1/knows", + "@type": "@id", + "@isCollection": true, + }, +}; diff --git a/packages/solid-react/test/.ldo/solidProfile.schema.ts b/packages/solid-react/test/.ldo/solidProfile.schema.ts new file mode 100644 index 0000000..69466fc --- /dev/null +++ b/packages/solid-react/test/.ldo/solidProfile.schema.ts @@ -0,0 +1,749 @@ +import { Schema } from "shexj"; + +/** + * ============================================================================= + * solidProfileSchema: ShexJ Schema for solidProfile + * ============================================================================= + */ +export const solidProfileSchema: Schema = { + type: "Schema", + shapes: [ + { + id: "https://shaperepo.com/schemas/solidProfile#SolidProfileShape", + type: "ShapeDecl", + shapeExpr: { + type: "Shape", + expression: { + type: "EachOf", + expressions: [ + { + type: "TripleConstraint", + predicate: "http://www.w3.org/1999/02/22-rdf-syntax-ns#type", + valueExpr: { + type: "NodeConstraint", + values: ["http://schema.org/Person"], + }, + annotations: [ + { + type: "Annotation", + predicate: "http://www.w3.org/2000/01/rdf-schema#comment", + object: { + value: "Defines the node as a Person (from Schema.org)", + }, + }, + ], + }, + { + type: "TripleConstraint", + predicate: "http://www.w3.org/1999/02/22-rdf-syntax-ns#type", + valueExpr: { + type: "NodeConstraint", + values: ["http://xmlns.com/foaf/0.1/Person"], + }, + annotations: [ + { + type: "Annotation", + predicate: "http://www.w3.org/2000/01/rdf-schema#comment", + object: { + value: "Defines the node as a Person (from foaf)", + }, + }, + ], + }, + { + type: "TripleConstraint", + predicate: "http://www.w3.org/2006/vcard/ns#fn", + 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: + "The formatted name of a person. Example: John Smith", + }, + }, + ], + }, + { + type: "TripleConstraint", + predicate: "http://xmlns.com/foaf/0.1/name", + 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: "An alternate way to define a person's name.", + }, + }, + ], + }, + { + type: "TripleConstraint", + predicate: "http://www.w3.org/2006/vcard/ns#hasAddress", + valueExpr: + "https://shaperepo.com/schemas/solidProfile#AddressShape", + min: 0, + max: -1, + annotations: [ + { + type: "Annotation", + predicate: "http://www.w3.org/2000/01/rdf-schema#comment", + object: { + value: "The person's street address.", + }, + }, + ], + }, + { + type: "TripleConstraint", + predicate: "http://www.w3.org/2006/vcard/ns#hasEmail", + valueExpr: + "https://shaperepo.com/schemas/solidProfile#EmailShape", + min: 0, + max: -1, + annotations: [ + { + type: "Annotation", + predicate: "http://www.w3.org/2000/01/rdf-schema#comment", + object: { + value: "The person's email.", + }, + }, + ], + }, + { + type: "TripleConstraint", + predicate: "http://www.w3.org/2006/vcard/ns#hasPhoto", + valueExpr: { + type: "NodeConstraint", + nodeKind: "iri", + }, + min: 0, + max: 1, + annotations: [ + { + type: "Annotation", + predicate: "http://www.w3.org/2000/01/rdf-schema#comment", + object: { + value: "A link to the person's photo", + }, + }, + ], + }, + { + type: "TripleConstraint", + predicate: "http://xmlns.com/foaf/0.1/img", + 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: "Photo link but in string form", + }, + }, + ], + }, + { + type: "TripleConstraint", + predicate: "http://www.w3.org/2006/vcard/ns#hasTelephone", + valueExpr: + "https://shaperepo.com/schemas/solidProfile#PhoneNumberShape", + min: 0, + max: -1, + annotations: [ + { + type: "Annotation", + predicate: "http://www.w3.org/2000/01/rdf-schema#comment", + object: { + value: "Person's telephone number", + }, + }, + ], + }, + { + type: "TripleConstraint", + predicate: "http://www.w3.org/2006/vcard/ns#phone", + 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: + "An alternative way to define a person's telephone number using a string", + }, + }, + ], + }, + { + type: "TripleConstraint", + predicate: "http://www.w3.org/2006/vcard/ns#organization-name", + 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: + "The name of the organization with which the person is affiliated", + }, + }, + ], + }, + { + type: "TripleConstraint", + predicate: "http://www.w3.org/2006/vcard/ns#role", + 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: + "The name of the person's role in their organization", + }, + }, + ], + }, + { + type: "TripleConstraint", + predicate: "http://www.w3.org/ns/auth/acl#trustedApp", + valueExpr: + "https://shaperepo.com/schemas/solidProfile#TrustedAppShape", + min: 0, + max: -1, + annotations: [ + { + type: "Annotation", + predicate: "http://www.w3.org/2000/01/rdf-schema#comment", + object: { + value: + "A list of app origins that are trusted by this user", + }, + }, + ], + }, + { + type: "TripleConstraint", + predicate: "http://www.w3.org/ns/auth/cert#key", + valueExpr: + "https://shaperepo.com/schemas/solidProfile#RSAPublicKeyShape", + min: 0, + max: -1, + annotations: [ + { + type: "Annotation", + predicate: "http://www.w3.org/2000/01/rdf-schema#comment", + object: { + value: + "A list of RSA public keys that are associated with private keys the user holds.", + }, + }, + ], + }, + { + type: "TripleConstraint", + predicate: "http://www.w3.org/ns/ldp#inbox", + valueExpr: { + type: "NodeConstraint", + nodeKind: "iri", + }, + annotations: [ + { + type: "Annotation", + predicate: "http://www.w3.org/2000/01/rdf-schema#comment", + object: { + value: + "The user's LDP inbox to which apps can post notifications", + }, + }, + ], + }, + { + type: "TripleConstraint", + predicate: "http://www.w3.org/ns/pim/space#preferencesFile", + 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 user's preferences", + }, + }, + ], + }, + { + type: "TripleConstraint", + predicate: "http://www.w3.org/ns/pim/space#storage", + 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 location of a Solid storage server related to this WebId", + }, + }, + ], + }, + { + type: "TripleConstraint", + predicate: "http://www.w3.org/ns/solid/terms#account", + 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 user's account", + }, + }, + ], + }, + { + type: "TripleConstraint", + predicate: "http://www.w3.org/ns/solid/terms#privateTypeIndex", + valueExpr: { + type: "NodeConstraint", + nodeKind: "iri", + }, + min: 0, + max: -1, + annotations: [ + { + type: "Annotation", + predicate: "http://www.w3.org/2000/01/rdf-schema#comment", + object: { + value: + "A registry of all types used on the user's Pod (for private access only)", + }, + }, + ], + }, + { + type: "TripleConstraint", + predicate: "http://www.w3.org/ns/solid/terms#publicTypeIndex", + valueExpr: { + type: "NodeConstraint", + nodeKind: "iri", + }, + min: 0, + max: -1, + annotations: [ + { + type: "Annotation", + predicate: "http://www.w3.org/2000/01/rdf-schema#comment", + object: { + value: + "A registry of all types used on the user's Pod (for public access)", + }, + }, + ], + }, + { + type: "TripleConstraint", + predicate: "http://xmlns.com/foaf/0.1/knows", + valueExpr: + "https://shaperepo.com/schemas/solidProfile#SolidProfileShape", + min: 0, + max: -1, + annotations: [ + { + type: "Annotation", + predicate: "http://www.w3.org/2000/01/rdf-schema#comment", + object: { + value: + "A list of WebIds for all the people this user knows.", + }, + }, + ], + }, + ], + }, + extra: ["http://www.w3.org/1999/02/22-rdf-syntax-ns#type"], + }, + }, + { + id: "https://shaperepo.com/schemas/solidProfile#AddressShape", + type: "ShapeDecl", + shapeExpr: { + type: "Shape", + expression: { + type: "EachOf", + expressions: [ + { + type: "TripleConstraint", + predicate: "http://www.w3.org/2006/vcard/ns#country-name", + 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: "The name of the user's country of residence", + }, + }, + ], + }, + { + type: "TripleConstraint", + predicate: "http://www.w3.org/2006/vcard/ns#locality", + 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: + "The name of the user's locality (City, Town etc.) of residence", + }, + }, + ], + }, + { + type: "TripleConstraint", + predicate: "http://www.w3.org/2006/vcard/ns#postal-code", + 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: "The user's postal code", + }, + }, + ], + }, + { + type: "TripleConstraint", + predicate: "http://www.w3.org/2006/vcard/ns#region", + 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: + "The name of the user's region (State, Province etc.) of residence", + }, + }, + ], + }, + { + type: "TripleConstraint", + predicate: "http://www.w3.org/2006/vcard/ns#street-address", + 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: "The user's street address", + }, + }, + ], + }, + ], + }, + }, + }, + { + id: "https://shaperepo.com/schemas/solidProfile#EmailShape", + type: "ShapeDecl", + shapeExpr: { + type: "Shape", + expression: { + 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/2006/vcard/ns#Dom", + "http://www.w3.org/2006/vcard/ns#Home", + "http://www.w3.org/2006/vcard/ns#ISDN", + "http://www.w3.org/2006/vcard/ns#Internet", + "http://www.w3.org/2006/vcard/ns#Intl", + "http://www.w3.org/2006/vcard/ns#Label", + "http://www.w3.org/2006/vcard/ns#Parcel", + "http://www.w3.org/2006/vcard/ns#Postal", + "http://www.w3.org/2006/vcard/ns#Pref", + "http://www.w3.org/2006/vcard/ns#Work", + "http://www.w3.org/2006/vcard/ns#X400", + ], + }, + min: 0, + max: 1, + annotations: [ + { + type: "Annotation", + predicate: "http://www.w3.org/2000/01/rdf-schema#comment", + object: { + value: "The type of email.", + }, + }, + ], + }, + { + type: "TripleConstraint", + predicate: "http://www.w3.org/2006/vcard/ns#value", + valueExpr: { + type: "NodeConstraint", + nodeKind: "iri", + }, + annotations: [ + { + type: "Annotation", + predicate: "http://www.w3.org/2000/01/rdf-schema#comment", + object: { + value: + "The value of an email as a mailto link (Example )", + }, + }, + ], + }, + ], + }, + extra: ["http://www.w3.org/1999/02/22-rdf-syntax-ns#type"], + }, + }, + { + id: "https://shaperepo.com/schemas/solidProfile#PhoneNumberShape", + type: "ShapeDecl", + shapeExpr: { + type: "Shape", + expression: { + 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/2006/vcard/ns#Dom", + "http://www.w3.org/2006/vcard/ns#Home", + "http://www.w3.org/2006/vcard/ns#ISDN", + "http://www.w3.org/2006/vcard/ns#Internet", + "http://www.w3.org/2006/vcard/ns#Intl", + "http://www.w3.org/2006/vcard/ns#Label", + "http://www.w3.org/2006/vcard/ns#Parcel", + "http://www.w3.org/2006/vcard/ns#Postal", + "http://www.w3.org/2006/vcard/ns#Pref", + "http://www.w3.org/2006/vcard/ns#Work", + "http://www.w3.org/2006/vcard/ns#X400", + ], + }, + min: 0, + max: 1, + annotations: [ + { + type: "Annotation", + predicate: "http://www.w3.org/2000/01/rdf-schema#comment", + object: { + value: "They type of Phone Number", + }, + }, + ], + }, + { + type: "TripleConstraint", + predicate: "http://www.w3.org/2006/vcard/ns#value", + valueExpr: { + type: "NodeConstraint", + nodeKind: "iri", + }, + annotations: [ + { + type: "Annotation", + predicate: "http://www.w3.org/2000/01/rdf-schema#comment", + object: { + value: + "The value of a phone number as a tel link (Example )", + }, + }, + ], + }, + ], + }, + extra: ["http://www.w3.org/1999/02/22-rdf-syntax-ns#type"], + }, + }, + { + id: "https://shaperepo.com/schemas/solidProfile#TrustedAppShape", + type: "ShapeDecl", + shapeExpr: { + type: "Shape", + expression: { + type: "EachOf", + expressions: [ + { + type: "TripleConstraint", + predicate: "http://www.w3.org/ns/auth/acl#mode", + valueExpr: { + type: "NodeConstraint", + values: [ + "http://www.w3.org/ns/auth/acl#Append", + "http://www.w3.org/ns/auth/acl#Control", + "http://www.w3.org/ns/auth/acl#Read", + "http://www.w3.org/ns/auth/acl#Write", + ], + }, + min: 1, + max: -1, + annotations: [ + { + type: "Annotation", + predicate: "http://www.w3.org/2000/01/rdf-schema#comment", + object: { + value: "The level of access provided to this origin", + }, + }, + ], + }, + { + type: "TripleConstraint", + predicate: "http://www.w3.org/ns/auth/acl#origin", + valueExpr: { + type: "NodeConstraint", + nodeKind: "iri", + }, + annotations: [ + { + type: "Annotation", + predicate: "http://www.w3.org/2000/01/rdf-schema#comment", + object: { + value: "The app origin the user trusts", + }, + }, + ], + }, + ], + }, + }, + }, + { + id: "https://shaperepo.com/schemas/solidProfile#RSAPublicKeyShape", + type: "ShapeDecl", + shapeExpr: { + type: "Shape", + expression: { + type: "EachOf", + expressions: [ + { + type: "TripleConstraint", + predicate: "http://www.w3.org/ns/auth/cert#modulus", + valueExpr: { + type: "NodeConstraint", + datatype: "http://www.w3.org/2001/XMLSchema#string", + }, + annotations: [ + { + type: "Annotation", + predicate: "http://www.w3.org/2000/01/rdf-schema#comment", + object: { + value: "RSA Modulus", + }, + }, + ], + }, + { + type: "TripleConstraint", + predicate: "http://www.w3.org/ns/auth/cert#exponent", + valueExpr: { + type: "NodeConstraint", + datatype: "http://www.w3.org/2001/XMLSchema#integer", + }, + annotations: [ + { + type: "Annotation", + predicate: "http://www.w3.org/2000/01/rdf-schema#comment", + object: { + value: "RSA Exponent", + }, + }, + ], + }, + ], + }, + }, + }, + ], +}; diff --git a/packages/solid-react/test/.ldo/solidProfile.shapeTypes.ts b/packages/solid-react/test/.ldo/solidProfile.shapeTypes.ts new file mode 100644 index 0000000..71426e4 --- /dev/null +++ b/packages/solid-react/test/.ldo/solidProfile.shapeTypes.ts @@ -0,0 +1,71 @@ +import { ShapeType } from "@ldo/ldo"; +import { solidProfileSchema } from "./solidProfile.schema"; +import { solidProfileContext } from "./solidProfile.context"; +import { + SolidProfileShape, + AddressShape, + EmailShape, + PhoneNumberShape, + TrustedAppShape, + RSAPublicKeyShape, +} from "./solidProfile.typings"; + +/** + * ============================================================================= + * LDO ShapeTypes solidProfile + * ============================================================================= + */ + +/** + * SolidProfileShape ShapeType + */ +export const SolidProfileShapeShapeType: ShapeType = { + schema: solidProfileSchema, + shape: "https://shaperepo.com/schemas/solidProfile#SolidProfileShape", + context: solidProfileContext, +}; + +/** + * AddressShape ShapeType + */ +export const AddressShapeShapeType: ShapeType = { + schema: solidProfileSchema, + shape: "https://shaperepo.com/schemas/solidProfile#AddressShape", + context: solidProfileContext, +}; + +/** + * EmailShape ShapeType + */ +export const EmailShapeShapeType: ShapeType = { + schema: solidProfileSchema, + shape: "https://shaperepo.com/schemas/solidProfile#EmailShape", + context: solidProfileContext, +}; + +/** + * PhoneNumberShape ShapeType + */ +export const PhoneNumberShapeShapeType: ShapeType = { + schema: solidProfileSchema, + shape: "https://shaperepo.com/schemas/solidProfile#PhoneNumberShape", + context: solidProfileContext, +}; + +/** + * TrustedAppShape ShapeType + */ +export const TrustedAppShapeShapeType: ShapeType = { + schema: solidProfileSchema, + shape: "https://shaperepo.com/schemas/solidProfile#TrustedAppShape", + context: solidProfileContext, +}; + +/** + * RSAPublicKeyShape ShapeType + */ +export const RSAPublicKeyShapeShapeType: ShapeType = { + schema: solidProfileSchema, + shape: "https://shaperepo.com/schemas/solidProfile#RSAPublicKeyShape", + context: solidProfileContext, +}; diff --git a/packages/solid-react/test/.ldo/solidProfile.typings.ts b/packages/solid-react/test/.ldo/solidProfile.typings.ts new file mode 100644 index 0000000..95dbaef --- /dev/null +++ b/packages/solid-react/test/.ldo/solidProfile.typings.ts @@ -0,0 +1,293 @@ +import { LdoJsonldContext, LdSet } from "@ldo/ldo"; + +/** + * ============================================================================= + * Typescript Typings for solidProfile + * ============================================================================= + */ + +/** + * SolidProfileShape Type + */ +export interface SolidProfileShape { + "@id"?: string; + "@context"?: LdoJsonldContext; + /** + * Defines the node as a Person (from Schema.org) | Defines the node as a Person (from foaf) + */ + type: LdSet< + | { + "@id": "Person"; + } + | { + "@id": "Person2"; + } + >; + /** + * The formatted name of a person. Example: John Smith + */ + fn?: string; + /** + * An alternate way to define a person's name. + */ + name?: string; + /** + * The person's street address. + */ + hasAddress?: LdSet; + /** + * The person's email. + */ + hasEmail?: LdSet; + /** + * A link to the person's photo + */ + hasPhoto?: { + "@id": string; + }; + /** + * Photo link but in string form + */ + img?: string; + /** + * Person's telephone number + */ + hasTelephone?: LdSet; + /** + * An alternative way to define a person's telephone number using a string + */ + phone?: string; + /** + * The name of the organization with which the person is affiliated + */ + organizationName?: string; + /** + * The name of the person's role in their organization + */ + role?: string; + /** + * A list of app origins that are trusted by this user + */ + trustedApp?: LdSet; + /** + * A list of RSA public keys that are associated with private keys the user holds. + */ + key?: LdSet; + /** + * The user's LDP inbox to which apps can post notifications + */ + inbox: { + "@id": string; + }; + /** + * The user's preferences + */ + preferencesFile?: { + "@id": string; + }; + /** + * The location of a Solid storage server related to this WebId + */ + storage?: LdSet<{ + "@id": string; + }>; + /** + * The user's account + */ + account?: { + "@id": string; + }; + /** + * A registry of all types used on the user's Pod (for private access only) + */ + privateTypeIndex?: LdSet<{ + "@id": string; + }>; + /** + * A registry of all types used on the user's Pod (for public access) + */ + publicTypeIndex?: LdSet<{ + "@id": string; + }>; + /** + * A list of WebIds for all the people this user knows. + */ + knows?: LdSet; +} + +/** + * AddressShape Type + */ +export interface AddressShape { + "@id"?: string; + "@context"?: LdoJsonldContext; + /** + * The name of the user's country of residence + */ + countryName?: string; + /** + * The name of the user's locality (City, Town etc.) of residence + */ + locality?: string; + /** + * The user's postal code + */ + postalCode?: string; + /** + * The name of the user's region (State, Province etc.) of residence + */ + region?: string; + /** + * The user's street address + */ + streetAddress?: string; +} + +/** + * EmailShape Type + */ +export interface EmailShape { + "@id"?: string; + "@context"?: LdoJsonldContext; + /** + * The type of email. + */ + type?: + | { + "@id": "Dom"; + } + | { + "@id": "Home"; + } + | { + "@id": "ISDN"; + } + | { + "@id": "Internet"; + } + | { + "@id": "Intl"; + } + | { + "@id": "Label"; + } + | { + "@id": "Parcel"; + } + | { + "@id": "Postal"; + } + | { + "@id": "Pref"; + } + | { + "@id": "Work"; + } + | { + "@id": "X400"; + }; + /** + * The value of an email as a mailto link (Example ) + */ + value: { + "@id": string; + }; +} + +/** + * PhoneNumberShape Type + */ +export interface PhoneNumberShape { + "@id"?: string; + "@context"?: LdoJsonldContext; + /** + * They type of Phone Number + */ + type?: + | { + "@id": "Dom"; + } + | { + "@id": "Home"; + } + | { + "@id": "ISDN"; + } + | { + "@id": "Internet"; + } + | { + "@id": "Intl"; + } + | { + "@id": "Label"; + } + | { + "@id": "Parcel"; + } + | { + "@id": "Postal"; + } + | { + "@id": "Pref"; + } + | { + "@id": "Work"; + } + | { + "@id": "X400"; + }; + /** + * The value of a phone number as a tel link (Example ) + */ + value: { + "@id": string; + }; +} + +/** + * TrustedAppShape Type + */ +export interface TrustedAppShape { + "@id"?: string; + "@context"?: LdoJsonldContext; + /** + * The level of access provided to this origin + */ + mode: LdSet< + | { + "@id": "Append"; + } + | { + "@id": "Control"; + } + | { + "@id": "Read"; + } + | { + "@id": "Write"; + } + >; + /** + * The app origin the user trusts + */ + origin: { + "@id": string; + }; +} + +/** + * RSAPublicKeyShape Type + */ +export interface RSAPublicKeyShape { + "@id"?: string; + "@context"?: LdoJsonldContext; + /** + * RSA Modulus + */ + modulus: string; + /** + * RSA Exponent + */ + exponent: number; +} diff --git a/packages/solid-react/test/test-server/configs/template/link-query/main-profile.ttl b/packages/solid-react/test/test-server/configs/template/link-query/main-profile.ttl new file mode 100644 index 0000000..562e9fd --- /dev/null +++ b/packages/solid-react/test/test-server/configs/template/link-query/main-profile.ttl @@ -0,0 +1,7 @@ +@prefix foaf: . +@prefix : <#> . + +:me a foaf:Person ; + foaf:name "Main User" ; + foaf:mbox ; + foaf:knows . \ No newline at end of file diff --git a/packages/solid-react/test/test-server/configs/template/link-query/other-profile.ttl b/packages/solid-react/test/test-server/configs/template/link-query/other-profile.ttl new file mode 100644 index 0000000..f1eb291 --- /dev/null +++ b/packages/solid-react/test/test-server/configs/template/link-query/other-profile.ttl @@ -0,0 +1,7 @@ +@prefix foaf: . +@prefix : <#> . + +:me a foaf:Person ; + foaf:name "Other User" ; + foaf:mbox ; + foaf:knows . \ No newline at end of file diff --git a/packages/solid-react/test/test-server/configs/template/link-query/third-profile.ttl b/packages/solid-react/test/test-server/configs/template/link-query/third-profile.ttl new file mode 100644 index 0000000..81e8017 --- /dev/null +++ b/packages/solid-react/test/test-server/configs/template/link-query/third-profile.ttl @@ -0,0 +1,7 @@ +@prefix foaf: . +@prefix : <#> . + +:me a foaf:Person ; + foaf:name "Third User" ; + foaf:mbox ; + foaf:knows . \ No newline at end of file