@ldo/solid-type-index 1.0.0-alpha.2 → 1.0.0-alpha.21
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/{.ldo → cjs/.ldo}/profile.context.js +5 -0
- package/dist/cjs/.ldo/profile.context.js.map +1 -0
- package/dist/{.ldo → cjs/.ldo}/profile.schema.js +5 -0
- package/dist/cjs/.ldo/profile.schema.js.map +1 -0
- package/dist/cjs/.ldo/profile.shapeTypes.js +19 -0
- package/dist/cjs/.ldo/profile.shapeTypes.js.map +1 -0
- package/dist/cjs/.ldo/profile.typings.js.map +1 -0
- package/dist/{.ldo → cjs/.ldo}/typeIndex.context.js +5 -0
- package/dist/cjs/.ldo/typeIndex.context.js.map +1 -0
- package/dist/{.ldo → cjs/.ldo}/typeIndex.schema.js +5 -0
- package/dist/cjs/.ldo/typeIndex.schema.js.map +1 -0
- package/dist/cjs/.ldo/typeIndex.shapeTypes.js +27 -0
- package/dist/cjs/.ldo/typeIndex.shapeTypes.js.map +1 -0
- package/dist/cjs/.ldo/typeIndex.typings.js.map +1 -0
- package/dist/cjs/constants.js.map +1 -0
- package/dist/{getTypeIndex.js → cjs/getTypeIndex.js} +20 -15
- package/dist/cjs/getTypeIndex.js.map +1 -0
- package/dist/{index.js → cjs/index.js} +4 -4
- package/dist/cjs/index.js.map +1 -0
- package/dist/cjs/react/useInstanceUris.js +33 -0
- package/dist/cjs/react/useInstanceUris.js.map +1 -0
- package/dist/{react → cjs/react}/useTypeIndexProfile.js +3 -4
- package/dist/cjs/react/useTypeIndexProfile.js.map +1 -0
- package/dist/{react → cjs/react}/util/useSubscribeToUris.js +4 -2
- package/dist/cjs/react/util/useSubscribeToUris.js.map +1 -0
- package/dist/{setTypeIndex.js → cjs/setTypeIndex.js} +60 -21
- package/dist/cjs/setTypeIndex.js.map +1 -0
- package/dist/{util → cjs/util}/Options.js +1 -2
- package/dist/cjs/util/Options.js.map +1 -0
- package/dist/esm/.ldo/profile.context.js +18 -0
- package/dist/esm/.ldo/profile.context.js.map +1 -0
- package/dist/esm/.ldo/profile.schema.js +61 -0
- package/dist/esm/.ldo/profile.schema.js.map +1 -0
- package/dist/esm/.ldo/profile.shapeTypes.js +16 -0
- package/dist/esm/.ldo/profile.shapeTypes.js.map +1 -0
- package/dist/esm/.ldo/profile.typings.js +2 -0
- package/dist/esm/.ldo/profile.typings.js.map +1 -0
- package/dist/esm/.ldo/typeIndex.context.js +63 -0
- package/dist/esm/.ldo/typeIndex.context.js.map +1 -0
- package/dist/esm/.ldo/typeIndex.schema.js +143 -0
- package/dist/esm/.ldo/typeIndex.schema.js.map +1 -0
- package/dist/esm/.ldo/typeIndex.shapeTypes.js +24 -0
- package/dist/esm/.ldo/typeIndex.shapeTypes.js.map +1 -0
- package/dist/esm/.ldo/typeIndex.typings.js +2 -0
- package/dist/esm/.ldo/typeIndex.typings.js.map +1 -0
- package/dist/esm/constants.js +6 -0
- package/dist/esm/constants.js.map +1 -0
- package/dist/esm/getTypeIndex.js +61 -0
- package/dist/esm/getTypeIndex.js.map +1 -0
- package/dist/esm/index.js +5 -0
- package/dist/esm/index.js.map +1 -0
- package/dist/esm/react/useInstanceUris.js +30 -0
- package/dist/esm/react/useInstanceUris.js.map +1 -0
- package/dist/esm/react/useTypeIndexProfile.js +9 -0
- package/dist/esm/react/useTypeIndexProfile.js.map +1 -0
- package/dist/esm/react/util/useSubscribeToUris.js +30 -0
- package/dist/esm/react/util/useSubscribeToUris.js.map +1 -0
- package/dist/esm/setTypeIndex.js +156 -0
- package/dist/esm/setTypeIndex.js.map +1 -0
- package/dist/esm/util/Options.js +9 -0
- package/dist/esm/util/Options.js.map +1 -0
- package/dist/types/.ldo/profile.context.d.ts +8 -0
- package/dist/types/.ldo/profile.context.d.ts.map +1 -0
- package/dist/types/.ldo/profile.schema.d.ts +8 -0
- package/dist/types/.ldo/profile.schema.d.ts.map +1 -0
- package/dist/types/.ldo/profile.shapeTypes.d.ts +12 -0
- package/dist/types/.ldo/profile.shapeTypes.d.ts.map +1 -0
- package/dist/types/.ldo/profile.typings.d.ts +26 -0
- package/dist/types/.ldo/profile.typings.d.ts.map +1 -0
- package/dist/types/.ldo/typeIndex.context.d.ts +8 -0
- package/dist/types/.ldo/typeIndex.context.d.ts.map +1 -0
- package/dist/types/.ldo/typeIndex.schema.d.ts +8 -0
- package/dist/types/.ldo/typeIndex.schema.d.ts.map +1 -0
- package/dist/types/.ldo/typeIndex.shapeTypes.d.ts +16 -0
- package/dist/types/.ldo/typeIndex.shapeTypes.d.ts.map +1 -0
- package/dist/types/.ldo/typeIndex.typings.d.ts +53 -0
- package/dist/types/.ldo/typeIndex.typings.d.ts.map +1 -0
- package/dist/{constants.d.ts → types/constants.d.ts} +1 -0
- package/dist/types/constants.d.ts.map +1 -0
- package/dist/{getTypeIndex.d.ts → types/getTypeIndex.d.ts} +4 -3
- package/dist/types/getTypeIndex.d.ts.map +1 -0
- package/dist/types/index.d.ts +5 -0
- package/dist/types/index.d.ts.map +1 -0
- package/dist/types/react/useInstanceUris.d.ts +9 -0
- package/dist/types/react/useInstanceUris.d.ts.map +1 -0
- package/dist/types/react/useTypeIndexProfile.d.ts +3 -0
- package/dist/types/react/useTypeIndexProfile.d.ts.map +1 -0
- package/dist/{react → types/react}/util/useSubscribeToUris.d.ts +1 -0
- package/dist/types/react/util/useSubscribeToUris.d.ts.map +1 -0
- package/dist/types/setTypeIndex.d.ts +53 -0
- package/dist/types/setTypeIndex.d.ts.map +1 -0
- package/dist/{util → types/util}/Options.d.ts +1 -0
- package/dist/types/util/Options.d.ts.map +1 -0
- package/package.json +27 -18
- package/src/.ldo/profile.shapeTypes.ts +3 -3
- package/src/.ldo/typeIndex.shapeTypes.ts +3 -3
- package/src/getTypeIndex.ts +7 -7
- package/src/index.ts +4 -4
- package/src/react/useInstanceUris.ts +7 -5
- package/src/react/useTypeIndexProfile.ts +2 -2
- package/src/setTypeIndex.ts +10 -10
- package/src/util/Options.ts +0 -2
- package/dist/.ldo/profile.context.d.ts +0 -2
- package/dist/.ldo/profile.context.js.map +0 -1
- package/dist/.ldo/profile.schema.d.ts +0 -2
- package/dist/.ldo/profile.schema.js.map +0 -1
- package/dist/.ldo/profile.shapeTypes.d.ts +0 -3
- package/dist/.ldo/profile.shapeTypes.js +0 -11
- package/dist/.ldo/profile.shapeTypes.js.map +0 -1
- package/dist/.ldo/profile.typings.d.ts +0 -11
- package/dist/.ldo/profile.typings.js.map +0 -1
- package/dist/.ldo/typeIndex.context.d.ts +0 -2
- package/dist/.ldo/typeIndex.context.js.map +0 -1
- package/dist/.ldo/typeIndex.schema.d.ts +0 -2
- package/dist/.ldo/typeIndex.schema.js.map +0 -1
- package/dist/.ldo/typeIndex.shapeTypes.d.ts +0 -4
- package/dist/.ldo/typeIndex.shapeTypes.js +0 -16
- package/dist/.ldo/typeIndex.shapeTypes.js.map +0 -1
- package/dist/.ldo/typeIndex.typings.d.ts +0 -26
- package/dist/.ldo/typeIndex.typings.js.map +0 -1
- package/dist/constants.js.map +0 -1
- package/dist/getTypeIndex.js.map +0 -1
- package/dist/index.d.ts +0 -4
- package/dist/index.js.map +0 -1
- package/dist/react/useInstanceUris.d.ts +0 -2
- package/dist/react/useInstanceUris.js +0 -26
- package/dist/react/useInstanceUris.js.map +0 -1
- package/dist/react/useTypeIndexProfile.d.ts +0 -2
- package/dist/react/useTypeIndexProfile.js.map +0 -1
- package/dist/react/util/useSubscribeToUris.js.map +0 -1
- package/dist/setTypeIndex.d.ts +0 -14
- package/dist/setTypeIndex.js.map +0 -1
- package/dist/util/Options.js.map +0 -1
- /package/dist/{.ldo → cjs/.ldo}/profile.typings.js +0 -0
- /package/dist/{.ldo → cjs/.ldo}/typeIndex.typings.js +0 -0
- /package/dist/{constants.js → cjs/constants.js} +0 -0
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { profileSchema } from "./profile.schema.js";
|
|
2
|
+
import { profileContext } from "./profile.context.js";
|
|
3
|
+
/**
|
|
4
|
+
* =============================================================================
|
|
5
|
+
* LDO ShapeTypes profile
|
|
6
|
+
* =============================================================================
|
|
7
|
+
*/
|
|
8
|
+
/**
|
|
9
|
+
* TypeIndexProfile ShapeType
|
|
10
|
+
*/
|
|
11
|
+
export const TypeIndexProfileShapeType = {
|
|
12
|
+
schema: profileSchema,
|
|
13
|
+
shape: "https://shaperepo.com/schemas/solidProfile#TypeIndexProfile",
|
|
14
|
+
context: profileContext,
|
|
15
|
+
};
|
|
16
|
+
//# sourceMappingURL=profile.shapeTypes.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"profile.shapeTypes.js","sourceRoot":"","sources":["../../../src/.ldo/profile.shapeTypes.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,aAAa,EAAE,MAAM,qBAAqB,CAAC;AACpD,OAAO,EAAE,cAAc,EAAE,MAAM,sBAAsB,CAAC;AAGtD;;;;GAIG;AAEH;;GAEG;AACH,MAAM,CAAC,MAAM,yBAAyB,GAAgC;IACpE,MAAM,EAAE,aAAa;IACrB,KAAK,EAAE,6DAA6D;IACpE,OAAO,EAAE,cAAc;CACxB,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"profile.typings.js","sourceRoot":"","sources":["../../../src/.ldo/profile.typings.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* =============================================================================
|
|
3
|
+
* typeIndexContext: JSONLD Context for typeIndex
|
|
4
|
+
* =============================================================================
|
|
5
|
+
*/
|
|
6
|
+
export const typeIndexContext = {
|
|
7
|
+
type: {
|
|
8
|
+
"@id": "@type",
|
|
9
|
+
},
|
|
10
|
+
TypeIndex: {
|
|
11
|
+
"@id": "http://www.w3.org/ns/solid/terms#TypeIndex",
|
|
12
|
+
"@context": {
|
|
13
|
+
type: {
|
|
14
|
+
"@id": "@type",
|
|
15
|
+
},
|
|
16
|
+
},
|
|
17
|
+
},
|
|
18
|
+
ListedDocument: {
|
|
19
|
+
"@id": "http://www.w3.org/ns/solid/terms#ListedDocument",
|
|
20
|
+
"@context": {
|
|
21
|
+
type: {
|
|
22
|
+
"@id": "@type",
|
|
23
|
+
},
|
|
24
|
+
},
|
|
25
|
+
},
|
|
26
|
+
TypeRegistration: {
|
|
27
|
+
"@id": "http://www.w3.org/ns/solid/terms#TypeRegistration",
|
|
28
|
+
"@context": {
|
|
29
|
+
type: {
|
|
30
|
+
"@id": "@type",
|
|
31
|
+
},
|
|
32
|
+
forClass: {
|
|
33
|
+
"@id": "http://www.w3.org/ns/solid/terms#forClass",
|
|
34
|
+
"@type": "@id",
|
|
35
|
+
},
|
|
36
|
+
instance: {
|
|
37
|
+
"@id": "http://www.w3.org/ns/solid/terms#instance",
|
|
38
|
+
"@type": "@id",
|
|
39
|
+
"@isCollection": true,
|
|
40
|
+
},
|
|
41
|
+
instanceContainer: {
|
|
42
|
+
"@id": "http://www.w3.org/ns/solid/terms#instanceContainer",
|
|
43
|
+
"@type": "@id",
|
|
44
|
+
"@isCollection": true,
|
|
45
|
+
},
|
|
46
|
+
},
|
|
47
|
+
},
|
|
48
|
+
forClass: {
|
|
49
|
+
"@id": "http://www.w3.org/ns/solid/terms#forClass",
|
|
50
|
+
"@type": "@id",
|
|
51
|
+
},
|
|
52
|
+
instance: {
|
|
53
|
+
"@id": "http://www.w3.org/ns/solid/terms#instance",
|
|
54
|
+
"@type": "@id",
|
|
55
|
+
"@isCollection": true,
|
|
56
|
+
},
|
|
57
|
+
instanceContainer: {
|
|
58
|
+
"@id": "http://www.w3.org/ns/solid/terms#instanceContainer",
|
|
59
|
+
"@type": "@id",
|
|
60
|
+
"@isCollection": true,
|
|
61
|
+
},
|
|
62
|
+
};
|
|
63
|
+
//# sourceMappingURL=typeIndex.context.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"typeIndex.context.js","sourceRoot":"","sources":["../../../src/.ldo/typeIndex.context.ts"],"names":[],"mappings":"AAEA;;;;GAIG;AACH,MAAM,CAAC,MAAM,gBAAgB,GAAqB;IAChD,IAAI,EAAE;QACJ,KAAK,EAAE,OAAO;KACf;IACD,SAAS,EAAE;QACT,KAAK,EAAE,4CAA4C;QACnD,UAAU,EAAE;YACV,IAAI,EAAE;gBACJ,KAAK,EAAE,OAAO;aACf;SACF;KACF;IACD,cAAc,EAAE;QACd,KAAK,EAAE,iDAAiD;QACxD,UAAU,EAAE;YACV,IAAI,EAAE;gBACJ,KAAK,EAAE,OAAO;aACf;SACF;KACF;IACD,gBAAgB,EAAE;QAChB,KAAK,EAAE,mDAAmD;QAC1D,UAAU,EAAE;YACV,IAAI,EAAE;gBACJ,KAAK,EAAE,OAAO;aACf;YACD,QAAQ,EAAE;gBACR,KAAK,EAAE,2CAA2C;gBAClD,OAAO,EAAE,KAAK;aACf;YACD,QAAQ,EAAE;gBACR,KAAK,EAAE,2CAA2C;gBAClD,OAAO,EAAE,KAAK;gBACd,eAAe,EAAE,IAAI;aACtB;YACD,iBAAiB,EAAE;gBACjB,KAAK,EAAE,oDAAoD;gBAC3D,OAAO,EAAE,KAAK;gBACd,eAAe,EAAE,IAAI;aACtB;SACF;KACF;IACD,QAAQ,EAAE;QACR,KAAK,EAAE,2CAA2C;QAClD,OAAO,EAAE,KAAK;KACf;IACD,QAAQ,EAAE;QACR,KAAK,EAAE,2CAA2C;QAClD,OAAO,EAAE,KAAK;QACd,eAAe,EAAE,IAAI;KACtB;IACD,iBAAiB,EAAE;QACjB,KAAK,EAAE,oDAAoD;QAC3D,OAAO,EAAE,KAAK;QACd,eAAe,EAAE,IAAI;KACtB;CACF,CAAC"}
|
|
@@ -0,0 +1,143 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* =============================================================================
|
|
3
|
+
* typeIndexSchema: ShexJ Schema for typeIndex
|
|
4
|
+
* =============================================================================
|
|
5
|
+
*/
|
|
6
|
+
export const typeIndexSchema = {
|
|
7
|
+
type: "Schema",
|
|
8
|
+
shapes: [
|
|
9
|
+
{
|
|
10
|
+
id: "https://shaperepo.com/schemas/solidProfile#TypeIndexDocument",
|
|
11
|
+
type: "ShapeDecl",
|
|
12
|
+
shapeExpr: {
|
|
13
|
+
type: "Shape",
|
|
14
|
+
expression: {
|
|
15
|
+
type: "EachOf",
|
|
16
|
+
expressions: [
|
|
17
|
+
{
|
|
18
|
+
type: "TripleConstraint",
|
|
19
|
+
predicate: "http://www.w3.org/1999/02/22-rdf-syntax-ns#type",
|
|
20
|
+
valueExpr: {
|
|
21
|
+
type: "NodeConstraint",
|
|
22
|
+
values: ["http://www.w3.org/ns/solid/terms#TypeIndex"],
|
|
23
|
+
},
|
|
24
|
+
annotations: [
|
|
25
|
+
{
|
|
26
|
+
type: "Annotation",
|
|
27
|
+
predicate: "http://www.w3.org/2000/01/rdf-schema#comment",
|
|
28
|
+
object: {
|
|
29
|
+
value: "Defines the node as a TypeIndex",
|
|
30
|
+
},
|
|
31
|
+
},
|
|
32
|
+
],
|
|
33
|
+
},
|
|
34
|
+
{
|
|
35
|
+
type: "TripleConstraint",
|
|
36
|
+
predicate: "http://www.w3.org/1999/02/22-rdf-syntax-ns#type",
|
|
37
|
+
valueExpr: {
|
|
38
|
+
type: "NodeConstraint",
|
|
39
|
+
values: ["http://www.w3.org/ns/solid/terms#ListedDocument"],
|
|
40
|
+
},
|
|
41
|
+
annotations: [
|
|
42
|
+
{
|
|
43
|
+
type: "Annotation",
|
|
44
|
+
predicate: "http://www.w3.org/2000/01/rdf-schema#comment",
|
|
45
|
+
object: {
|
|
46
|
+
value: "Defines the node as a Listed Document",
|
|
47
|
+
},
|
|
48
|
+
},
|
|
49
|
+
],
|
|
50
|
+
},
|
|
51
|
+
],
|
|
52
|
+
},
|
|
53
|
+
extra: ["http://www.w3.org/1999/02/22-rdf-syntax-ns#type"],
|
|
54
|
+
},
|
|
55
|
+
},
|
|
56
|
+
{
|
|
57
|
+
id: "https://shaperepo.com/schemas/solidProfile#TypeRegistration",
|
|
58
|
+
type: "ShapeDecl",
|
|
59
|
+
shapeExpr: {
|
|
60
|
+
type: "Shape",
|
|
61
|
+
expression: {
|
|
62
|
+
type: "EachOf",
|
|
63
|
+
expressions: [
|
|
64
|
+
{
|
|
65
|
+
type: "TripleConstraint",
|
|
66
|
+
predicate: "http://www.w3.org/1999/02/22-rdf-syntax-ns#type",
|
|
67
|
+
valueExpr: {
|
|
68
|
+
type: "NodeConstraint",
|
|
69
|
+
values: ["http://www.w3.org/ns/solid/terms#TypeRegistration"],
|
|
70
|
+
},
|
|
71
|
+
annotations: [
|
|
72
|
+
{
|
|
73
|
+
type: "Annotation",
|
|
74
|
+
predicate: "http://www.w3.org/2000/01/rdf-schema#comment",
|
|
75
|
+
object: {
|
|
76
|
+
value: "Defines this node as a Type Registration",
|
|
77
|
+
},
|
|
78
|
+
},
|
|
79
|
+
],
|
|
80
|
+
},
|
|
81
|
+
{
|
|
82
|
+
type: "TripleConstraint",
|
|
83
|
+
predicate: "http://www.w3.org/ns/solid/terms#forClass",
|
|
84
|
+
valueExpr: {
|
|
85
|
+
type: "NodeConstraint",
|
|
86
|
+
nodeKind: "iri",
|
|
87
|
+
},
|
|
88
|
+
annotations: [
|
|
89
|
+
{
|
|
90
|
+
type: "Annotation",
|
|
91
|
+
predicate: "http://www.w3.org/2000/01/rdf-schema#comment",
|
|
92
|
+
object: {
|
|
93
|
+
value: "The class of object at this type.",
|
|
94
|
+
},
|
|
95
|
+
},
|
|
96
|
+
],
|
|
97
|
+
},
|
|
98
|
+
{
|
|
99
|
+
type: "TripleConstraint",
|
|
100
|
+
predicate: "http://www.w3.org/ns/solid/terms#instance",
|
|
101
|
+
valueExpr: {
|
|
102
|
+
type: "NodeConstraint",
|
|
103
|
+
nodeKind: "iri",
|
|
104
|
+
},
|
|
105
|
+
min: 0,
|
|
106
|
+
max: -1,
|
|
107
|
+
annotations: [
|
|
108
|
+
{
|
|
109
|
+
type: "Annotation",
|
|
110
|
+
predicate: "http://www.w3.org/2000/01/rdf-schema#comment",
|
|
111
|
+
object: {
|
|
112
|
+
value: "A specific resource that contains the class.",
|
|
113
|
+
},
|
|
114
|
+
},
|
|
115
|
+
],
|
|
116
|
+
},
|
|
117
|
+
{
|
|
118
|
+
type: "TripleConstraint",
|
|
119
|
+
predicate: "http://www.w3.org/ns/solid/terms#instanceContainer",
|
|
120
|
+
valueExpr: {
|
|
121
|
+
type: "NodeConstraint",
|
|
122
|
+
nodeKind: "iri",
|
|
123
|
+
},
|
|
124
|
+
min: 0,
|
|
125
|
+
max: -1,
|
|
126
|
+
annotations: [
|
|
127
|
+
{
|
|
128
|
+
type: "Annotation",
|
|
129
|
+
predicate: "http://www.w3.org/2000/01/rdf-schema#comment",
|
|
130
|
+
object: {
|
|
131
|
+
value: "Containers that contain resources with the class.",
|
|
132
|
+
},
|
|
133
|
+
},
|
|
134
|
+
],
|
|
135
|
+
},
|
|
136
|
+
],
|
|
137
|
+
},
|
|
138
|
+
extra: ["http://www.w3.org/1999/02/22-rdf-syntax-ns#type"],
|
|
139
|
+
},
|
|
140
|
+
},
|
|
141
|
+
],
|
|
142
|
+
};
|
|
143
|
+
//# sourceMappingURL=typeIndex.schema.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"typeIndex.schema.js","sourceRoot":"","sources":["../../../src/.ldo/typeIndex.schema.ts"],"names":[],"mappings":"AAEA;;;;GAIG;AACH,MAAM,CAAC,MAAM,eAAe,GAAW;IACrC,IAAI,EAAE,QAAQ;IACd,MAAM,EAAE;QACN;YACE,EAAE,EAAE,8DAA8D;YAClE,IAAI,EAAE,WAAW;YACjB,SAAS,EAAE;gBACT,IAAI,EAAE,OAAO;gBACb,UAAU,EAAE;oBACV,IAAI,EAAE,QAAQ;oBACd,WAAW,EAAE;wBACX;4BACE,IAAI,EAAE,kBAAkB;4BACxB,SAAS,EAAE,iDAAiD;4BAC5D,SAAS,EAAE;gCACT,IAAI,EAAE,gBAAgB;gCACtB,MAAM,EAAE,CAAC,4CAA4C,CAAC;6BACvD;4BACD,WA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;iCACF;6BACF;yBACF;wBACD;4BACE,IAAI,EAAE,kBAAkB;4BACxB,SAAS,EAAE,2CAA2C;4BACtD,SAAS,EAAE;gCACT,IAAI,EAAE,gBAAgB;gCACtB,QAAQ,EAAE,KAAK;6BAChB;4BACD,GAAG,EAAE,CAAC;4BACN,GAAG,EAAE,CAAC,CAAC;4BACP,WAAW,EAAE;gCACX;oCACE,IAAI,EAAE,YAAY;oCAClB,SAAS,EAAE,8CAA8C;oCACzD,MAAM,EAAE;wCACN,KAAK,EAAE,8CAA8C;qCACtD;iCACF;6BACF;yBACF;wBACD;4BACE,IAAI,EAAE,kBAAkB;4BACxB,SAAS,EAAE,oDAAoD;4BAC/D,SAAS,EAAE;gCACT,IAAI,EAAE,gBAAgB;gCACtB,QAAQ,EAAE,KAAK;6BAChB;4BACD,GAAG,EAAE,CAAC;4BACN,GAAG,EAAE,CAAC,CAAC;4BACP,WAAW,EAAE;gCACX;oCACE,IAAI,EAAE,YAAY;oCAClB,SAAS,EAAE,8CAA8C;oCACzD,MAAM,EAAE;wCACN,KAAK,EAAE,mDAAmD;qCAC3D;iCACF;6BACF;yBACF;qBACF;iBACF;gBACD,KAAK,EAAE,CAAC,iDAAiD,CAAC;aAC3D;SACF;KACF;CACF,CAAC"}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import { typeIndexSchema } from "./typeIndex.schema.js";
|
|
2
|
+
import { typeIndexContext } from "./typeIndex.context.js";
|
|
3
|
+
/**
|
|
4
|
+
* =============================================================================
|
|
5
|
+
* LDO ShapeTypes typeIndex
|
|
6
|
+
* =============================================================================
|
|
7
|
+
*/
|
|
8
|
+
/**
|
|
9
|
+
* TypeIndexDocument ShapeType
|
|
10
|
+
*/
|
|
11
|
+
export const TypeIndexDocumentShapeType = {
|
|
12
|
+
schema: typeIndexSchema,
|
|
13
|
+
shape: "https://shaperepo.com/schemas/solidProfile#TypeIndexDocument",
|
|
14
|
+
context: typeIndexContext,
|
|
15
|
+
};
|
|
16
|
+
/**
|
|
17
|
+
* TypeRegistration ShapeType
|
|
18
|
+
*/
|
|
19
|
+
export const TypeRegistrationShapeType = {
|
|
20
|
+
schema: typeIndexSchema,
|
|
21
|
+
shape: "https://shaperepo.com/schemas/solidProfile#TypeRegistration",
|
|
22
|
+
context: typeIndexContext,
|
|
23
|
+
};
|
|
24
|
+
//# sourceMappingURL=typeIndex.shapeTypes.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"typeIndex.shapeTypes.js","sourceRoot":"","sources":["../../../src/.ldo/typeIndex.shapeTypes.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,eAAe,EAAE,MAAM,uBAAuB,CAAC;AACxD,OAAO,EAAE,gBAAgB,EAAE,MAAM,wBAAwB,CAAC;AAG1D;;;;GAIG;AAEH;;GAEG;AACH,MAAM,CAAC,MAAM,0BAA0B,GAAiC;IACtE,MAAM,EAAE,eAAe;IACvB,KAAK,EAAE,8DAA8D;IACrE,OAAO,EAAE,gBAAgB;CAC1B,CAAC;AAEF;;GAEG;AACH,MAAM,CAAC,MAAM,yBAAyB,GAAgC;IACpE,MAAM,EAAE,eAAe;IACvB,KAAK,EAAE,6DAA6D;IACpE,OAAO,EAAE,gBAAgB;CAC1B,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"typeIndex.typings.js","sourceRoot":"","sources":["../../../src/.ldo/typeIndex.typings.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
export const RDF_TYPE = "http://www.w3.org/1999/02/22-rdf-syntax-ns#type";
|
|
2
|
+
export const TYPE_REGISTRATION = "http://www.w3.org/ns/solid/terms#TypeRegistration";
|
|
3
|
+
export const FOR_CLASS = "http://www.w3.org/ns/solid/terms#forClass";
|
|
4
|
+
export const INSTANCE = "http://www.w3.org/ns/solid/terms#instance";
|
|
5
|
+
export const INSTANCE_CONTAINER = "http://www.w3.org/ns/solid/terms#instanceContainer";
|
|
6
|
+
//# sourceMappingURL=constants.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"constants.js","sourceRoot":"","sources":["../../src/constants.ts"],"names":[],"mappings":"AAAA,MAAM,CAAC,MAAM,QAAQ,GAAG,iDAAiD,CAAC;AAC1E,MAAM,CAAC,MAAM,iBAAiB,GAC5B,mDAAmD,CAAC;AACtD,MAAM,CAAC,MAAM,SAAS,GAAG,2CAA2C,CAAC;AACrE,MAAM,CAAC,MAAM,QAAQ,GAAG,2CAA2C,CAAC;AACpE,MAAM,CAAC,MAAM,kBAAkB,GAC7B,oDAAoD,CAAC"}
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
import { TypeIndexProfileShapeType } from "./.ldo/profile.shapeTypes.js";
|
|
2
|
+
import { TypeRegistrationShapeType } from "./.ldo/typeIndex.shapeTypes.js";
|
|
3
|
+
import { RDF_TYPE, TYPE_REGISTRATION } from "./constants.js";
|
|
4
|
+
import { guaranteeOptions } from "./util/Options.js";
|
|
5
|
+
export async function getTypeRegistrations(webId, options) {
|
|
6
|
+
const { dataset } = guaranteeOptions(options);
|
|
7
|
+
// Get Profile
|
|
8
|
+
const profile = await getProfile(webId, options);
|
|
9
|
+
// Get Type Indexes
|
|
10
|
+
const typeIndexUris = getTypeIndexesUrisFromProfile(profile);
|
|
11
|
+
// Fetch the type Indexes
|
|
12
|
+
await Promise.all(typeIndexUris.map(async (typeIndexUri) => {
|
|
13
|
+
const typeIndexResource = dataset.getResource(typeIndexUri);
|
|
14
|
+
const readResult = await typeIndexResource.readIfUnfetched();
|
|
15
|
+
if (readResult.isError)
|
|
16
|
+
throw readResult;
|
|
17
|
+
}));
|
|
18
|
+
// Get Type Registrations
|
|
19
|
+
return dataset
|
|
20
|
+
.usingType(TypeRegistrationShapeType)
|
|
21
|
+
.matchSubject(RDF_TYPE, TYPE_REGISTRATION);
|
|
22
|
+
}
|
|
23
|
+
export async function getProfile(webId, options) {
|
|
24
|
+
const { dataset } = guaranteeOptions(options);
|
|
25
|
+
const profileResource = dataset.getResource(webId);
|
|
26
|
+
const readResult = await profileResource.readIfUnfetched();
|
|
27
|
+
if (readResult.isError)
|
|
28
|
+
throw readResult;
|
|
29
|
+
return dataset.usingType(TypeIndexProfileShapeType).fromSubject(webId);
|
|
30
|
+
}
|
|
31
|
+
export function getTypeIndexesUrisFromProfile(profile) {
|
|
32
|
+
const uris = [];
|
|
33
|
+
profile.privateTypeIndex?.forEach((indexNode) => {
|
|
34
|
+
uris.push(indexNode["@id"]);
|
|
35
|
+
});
|
|
36
|
+
profile.publicTypeIndex?.forEach((indexNode) => {
|
|
37
|
+
uris.push(indexNode["@id"]);
|
|
38
|
+
});
|
|
39
|
+
return uris;
|
|
40
|
+
}
|
|
41
|
+
export async function getInstanceUris(classUri, typeRegistrations, options) {
|
|
42
|
+
const { dataset } = guaranteeOptions(options);
|
|
43
|
+
const leafUris = new Set();
|
|
44
|
+
await Promise.all(typeRegistrations.map(async (registration) => {
|
|
45
|
+
if (registration.forClass["@id"] === classUri) {
|
|
46
|
+
// Individual registrations
|
|
47
|
+
registration.instance?.forEach((instance) => leafUris.add(instance["@id"]));
|
|
48
|
+
// Container registrations
|
|
49
|
+
await Promise.all(registration.instanceContainer?.map(async (instanceContainer) => {
|
|
50
|
+
const containerResource = dataset.getResource(instanceContainer["@id"]);
|
|
51
|
+
await containerResource.readIfUnfetched();
|
|
52
|
+
containerResource.children().forEach((child) => {
|
|
53
|
+
if (child.type === "SolidLeaf")
|
|
54
|
+
leafUris.add(child.uri);
|
|
55
|
+
});
|
|
56
|
+
}) ?? []);
|
|
57
|
+
}
|
|
58
|
+
}));
|
|
59
|
+
return Array.from(leafUris);
|
|
60
|
+
}
|
|
61
|
+
//# sourceMappingURL=getTypeIndex.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"getTypeIndex.js","sourceRoot":"","sources":["../../src/getTypeIndex.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,yBAAyB,EAAE,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CAAC,WAAW,CAC3C,iBAAiB,CAAC,KAAK,CAAsB,CAC9C,CAAC;gBACF,MAAM,iBAAiB,CAAC,eAAe,EAAE,CAAC;gBAC1C,iBAAiB,CAAC,QAAQ,EAAE,CAAC,OAAO,CAAC,CAAC,KAAK,EAAE,EAAE;oBAC7C,IAAI,KAAK,CAAC,IAAI,KAAK,WAAW;wBAAE,QAAQ,CAAC,GAAG,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC;gBAC1D,CAAC,CAAC,CAAC;YACL,CAAC,CAAC,IAAI,EAAE,CACT,CAAC;QACJ,CAAC;IACH,CAAC,CAAC,CACH,CAAC;IACF,OAAO,KAAK,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAC;AAC9B,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,mBAAmB,CAAC;AAClC,cAAc,mBAAmB,CAAC;AAClC,cAAc,4BAA4B,CAAC;AAC3C,cAAc,gCAAgC,CAAC"}
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import { useTypeIndexProfile } from "./useTypeIndexProfile.js";
|
|
2
|
+
import { useEffect, useMemo, useState } from "react";
|
|
3
|
+
import { useSubscribeToUris } from "./util/useSubscribeToUris.js";
|
|
4
|
+
import { useLdo, useMatchSubject } from "@ldo/solid-react";
|
|
5
|
+
import { TypeRegistrationShapeType } from "../.ldo/typeIndex.shapeTypes.js";
|
|
6
|
+
import { RDF_TYPE, TYPE_REGISTRATION } from "../constants.js";
|
|
7
|
+
import { getInstanceUris, getTypeIndexesUrisFromProfile, } from "../getTypeIndex.js";
|
|
8
|
+
/**
|
|
9
|
+
* Provides the LeafUris of everything in a type node for a specific class uri
|
|
10
|
+
*
|
|
11
|
+
* @param classUri - the class uri
|
|
12
|
+
* @returns - URIs of all resources registered with this node
|
|
13
|
+
*/
|
|
14
|
+
export function useInstanceUris(classUri) {
|
|
15
|
+
const { dataset } = useLdo();
|
|
16
|
+
const profile = useTypeIndexProfile();
|
|
17
|
+
const typeIndexUris = useMemo(() => (profile ? getTypeIndexesUrisFromProfile(profile) : []), [profile]);
|
|
18
|
+
useSubscribeToUris(typeIndexUris);
|
|
19
|
+
const [leafUris, setLeafUris] = useState([]);
|
|
20
|
+
const typeRegistrations = useMatchSubject(TypeRegistrationShapeType, RDF_TYPE, TYPE_REGISTRATION);
|
|
21
|
+
useEffect(() => {
|
|
22
|
+
getInstanceUris(classUri, typeRegistrations.toArray(), {
|
|
23
|
+
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
|
24
|
+
// @ts-ignore TODO: come back and see if we can fix this
|
|
25
|
+
solidLdoDataset: dataset,
|
|
26
|
+
}).then(setLeafUris);
|
|
27
|
+
}, [typeRegistrations]);
|
|
28
|
+
return leafUris;
|
|
29
|
+
}
|
|
30
|
+
//# sourceMappingURL=useInstanceUris.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useInstanceUris.js","sourceRoot":"","sources":["../../../src/react/useInstanceUris.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,mBAAmB,EAAE,MAAM,0BAA0B,CAAC;AAC/D,OAAO,EAAE,SAAS,EAAE,OAAO,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAC;AACrD,OAAO,EAAE,kBAAkB,EAAE,MAAM,8BAA8B,CAAC;AAClE,OAAO,EAAE,MAAM,EAAE,eAAe,EAAE,MAAM,kBAAkB,CAAC;AAC3D,OAAO,EAAE,yBAAyB,EAAE,MAAM,iCAAiC,CAAC;AAC5E,OAAO,EAAE,QAAQ,EAAE,iBAAiB,EAAE,MAAM,iBAAiB,CAAC;AAC9D,OAAO,EACL,eAAe,EACf,6BAA6B,GAC9B,MAAM,oBAAoB,CAAC;AAG5B;;;;;GAKG;AACH,MAAM,UAAU,eAAe,CAAC,QAAgB;IAC9C,MAAM,EAAE,OAAO,EAAE,GAAG,MAAM,EAAE,CAAC;IAC7B,MAAM,OAAO,GAAG,mBAAmB,EAAE,CAAC;IAEtC,MAAM,aAAa,GAAa,OAAO,CACrC,GAAG,EAAE,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,6BAA6B,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC,EAC7D,CAAC,OAAO,CAAC,CACV,CAAC;IAEF,kBAAkB,CAAC,aAAa,CAAC,CAAC;IAElC,MAAM,CAAC,QAAQ,EAAE,WAAW,CAAC,GAAG,QAAQ,CAAiB,EAAE,CAAC,CAAC;IAE7D,MAAM,iBAAiB,GAAG,eAAe,CACvC,yBAAyB,EACzB,QAAQ,EACR,iBAAiB,CAClB,CAAC;IAEF,SAAS,CAAC,GAAG,EAAE;QACb,eAAe,CAAC,QAAQ,EAAE,iBAAiB,CAAC,OAAO,EAAE,EAAE;YACrD,6DAA6D;YAC7D,wDAAwD;YACxD,eAAe,EAAE,OAAO;SACzB,CAAC,CAAC,IAAI,CAAC,WAAW,CAAC,CAAC;IACvB,CAAC,EAAE,CAAC,iBAAiB,CAAC,CAAC,CAAC;IAExB,OAAO,QAAQ,CAAC;AAClB,CAAC"}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { useResource, useSolidAuth, useSubject } from "@ldo/solid-react";
|
|
2
|
+
import { TypeIndexProfileShapeType } from "../.ldo/profile.shapeTypes.js";
|
|
3
|
+
export function useTypeIndexProfile() {
|
|
4
|
+
const { session } = useSolidAuth();
|
|
5
|
+
useResource(session.webId, { subscribe: true });
|
|
6
|
+
const profile = useSubject(TypeIndexProfileShapeType, session.webId);
|
|
7
|
+
return profile;
|
|
8
|
+
}
|
|
9
|
+
//# sourceMappingURL=useTypeIndexProfile.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useTypeIndexProfile.js","sourceRoot":"","sources":["../../../src/react/useTypeIndexProfile.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,YAAY,EAAE,UAAU,EAAE,MAAM,kBAAkB,CAAC;AAEzE,OAAO,EAAE,yBAAyB,EAAE,MAAM,+BAA+B,CAAC;AAE1E,MAAM,UAAU,mBAAmB;IACjC,MAAM,EAAE,OAAO,EAAE,GAAG,YAAY,EAAE,CAAC;IACnC,WAAW,CAAC,OAAO,CAAC,KAAK,EAAE,EAAE,SAAS,EAAE,IAAI,EAAE,CAAC,CAAC;IAChD,MAAM,OAAO,GAAG,UAAU,CAAC,yBAAyB,EAAE,OAAO,CAAC,KAAK,CAAC,CAAC;IACrE,OAAO,OAAO,CAAC;AACjB,CAAC"}
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import { useLdo } from "@ldo/solid-react";
|
|
2
|
+
import { useEffect, useRef } from "react";
|
|
3
|
+
export function useSubscribeToUris(uris) {
|
|
4
|
+
const { dataset } = useLdo();
|
|
5
|
+
const currentlySubscribed = useRef({});
|
|
6
|
+
useEffect(() => {
|
|
7
|
+
const resources = uris.map((uri) => dataset.getResource(uri));
|
|
8
|
+
const previousSubscriptions = { ...currentlySubscribed.current };
|
|
9
|
+
Promise.all(resources.map(async (resource) => {
|
|
10
|
+
if (!previousSubscriptions[resource.uri]) {
|
|
11
|
+
// Read and subscribe
|
|
12
|
+
await resource.readIfUnfetched();
|
|
13
|
+
currentlySubscribed.current[resource.uri] =
|
|
14
|
+
await resource.subscribeToNotifications();
|
|
15
|
+
}
|
|
16
|
+
else {
|
|
17
|
+
delete previousSubscriptions[resource.uri];
|
|
18
|
+
}
|
|
19
|
+
})).then(async () => {
|
|
20
|
+
// Unsubscribe from all remaining previous subscriptions
|
|
21
|
+
await Promise.all(Object.entries(previousSubscriptions).map(async ([resourceUri, subscriptionId]) => {
|
|
22
|
+
// Unsubscribe
|
|
23
|
+
delete currentlySubscribed.current[resourceUri];
|
|
24
|
+
const resource = dataset.getResource(resourceUri);
|
|
25
|
+
await resource.unsubscribeFromNotifications(subscriptionId);
|
|
26
|
+
}));
|
|
27
|
+
});
|
|
28
|
+
}, [uris]);
|
|
29
|
+
}
|
|
30
|
+
//# sourceMappingURL=useSubscribeToUris.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useSubscribeToUris.js","sourceRoot":"","sources":["../../../../src/react/util/useSubscribeToUris.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,MAAM,kBAAkB,CAAC;AAC1C,OAAO,EAAE,SAAS,EAAE,MAAM,EAAE,MAAM,OAAO,CAAC;AAE1C,MAAM,UAAU,kBAAkB,CAAC,IAAc;IAC/C,MAAM,EAAE,OAAO,EAAE,GAAG,MAAM,EAAE,CAAC;IAC7B,MAAM,mBAAmB,GAAG,MAAM,CAAyB,EAAE,CAAC,CAAC;IAC/D,SAAS,CAAC,GAAG,EAAE;QACb,MAAM,SAAS,GAAG,IAAI,CAAC,GAAG,CAAC,CAAC,GAAG,EAAE,EAAE,CAAC,OAAO,CAAC,WAAW,CAAC,GAAG,CAAC,CAAC,CAAC;QAC9D,MAAM,qBAAqB,GAAG,EAAE,GAAG,mBAAmB,CAAC,OAAO,EAAE,CAAC;QACjE,OAAO,CAAC,GAAG,CACT,SAAS,CAAC,GAAG,CAAC,KAAK,EAAE,QAAQ,EAAE,EAAE;YAC/B,IAAI,CAAC,qBAAqB,CAAC,QAAQ,CAAC,GAAG,CAAC,EAAE,CAAC;gBACzC,qBAAqB;gBACrB,MAAM,QAAQ,CAAC,eAAe,EAAE,CAAC;gBACjC,mBAAmB,CAAC,OAAO,CAAC,QAAQ,CAAC,GAAG,CAAC;oBACvC,MAAM,QAAQ,CAAC,wBAAwB,EAAE,CAAC;YAC9C,CAAC;iBAAM,CAAC;gBACN,OAAO,qBAAqB,CAAC,QAAQ,CAAC,GAAG,CAAC,CAAC;YAC7C,CAAC;QACH,CAAC,CAAC,CACH,CAAC,IAAI,CAAC,KAAK,IAAI,EAAE;YAChB,wDAAwD;YACxD,MAAM,OAAO,CAAC,GAAG,CACf,MAAM,CAAC,OAAO,CAAC,qBAAqB,CAAC,CAAC,GAAG,CACvC,KAAK,EAAE,CAAC,WAAW,EAAE,cAAc,CAAC,EAAE,EAAE;gBACtC,cAAc;gBACd,OAAO,mBAAmB,CAAC,OAAO,CAAC,WAAW,CAAC,CAAC;gBAChD,MAAM,QAAQ,GAAG,OAAO,CAAC,WAAW,CAAC,WAAW,CAAC,CAAC;gBAClD,MAAM,QAAQ,CAAC,4BAA4B,CAAC,cAAc,CAAC,CAAC;YAC9D,CAAC,CACF,CACF,CAAC;QACJ,CAAC,CAAC,CAAC;IACL,CAAC,EAAE,CAAC,IAAI,CAAC,CAAC,CAAC;AACb,CAAC"}
|
|
@@ -0,0 +1,156 @@
|
|
|
1
|
+
/* eslint-disable @typescript-eslint/no-explicit-any */
|
|
2
|
+
import { v4 } from "uuid";
|
|
3
|
+
import { FOR_CLASS, RDF_TYPE, TYPE_REGISTRATION } from "./constants.js";
|
|
4
|
+
import { guaranteeOptions } from "./util/Options.js";
|
|
5
|
+
import { namedNode, quad } from "@ldo/rdf-utils";
|
|
6
|
+
import { getProfile } from "./getTypeIndex.js";
|
|
7
|
+
import { TypeIndexProfileShapeType } from "./.ldo/profile.shapeTypes.js";
|
|
8
|
+
import { set } from "@ldo/ldo";
|
|
9
|
+
import { TypeIndexDocumentShapeType, TypeRegistrationShapeType, } from "./.ldo/typeIndex.shapeTypes.js";
|
|
10
|
+
/**
|
|
11
|
+
* =============================================================================
|
|
12
|
+
* INITIALIZERS
|
|
13
|
+
* =============================================================================
|
|
14
|
+
*/
|
|
15
|
+
export async function initTypeIndex(webId, options) {
|
|
16
|
+
const { dataset } = guaranteeOptions(options);
|
|
17
|
+
const profile = await getProfile(webId, options);
|
|
18
|
+
if (!profile.privateTypeIndex?.size || !profile.publicTypeIndex?.size) {
|
|
19
|
+
const profileFolder = await dataset
|
|
20
|
+
.getResource(webId)
|
|
21
|
+
.getParentContainer();
|
|
22
|
+
if (profileFolder?.isError)
|
|
23
|
+
throw profileFolder;
|
|
24
|
+
if (!profileFolder)
|
|
25
|
+
throw new Error("No folder to save the type indexes to.");
|
|
26
|
+
if (!profile.privateTypeIndex?.size) {
|
|
27
|
+
await createIndex(webId, profileFolder, dataset, true);
|
|
28
|
+
}
|
|
29
|
+
if (!profile.publicTypeIndex?.size) {
|
|
30
|
+
await createIndex(webId, profileFolder, dataset, false);
|
|
31
|
+
}
|
|
32
|
+
}
|
|
33
|
+
}
|
|
34
|
+
/**
|
|
35
|
+
* @internal
|
|
36
|
+
* @param webId
|
|
37
|
+
* @param profileFolder
|
|
38
|
+
* @param dataset
|
|
39
|
+
*/
|
|
40
|
+
export async function createIndex(webId, profileFolder, dataset, isPrivate) {
|
|
41
|
+
// Create a private type index
|
|
42
|
+
const createResult = await profileFolder.createChildAndOverwrite(`${isPrivate ? "private" : "public"}_index_${v4()}`);
|
|
43
|
+
if (createResult.isError)
|
|
44
|
+
throw createResult;
|
|
45
|
+
const indexResource = createResult.resource;
|
|
46
|
+
const wacResult = await indexResource.setWac({
|
|
47
|
+
agent: {
|
|
48
|
+
[webId]: { read: true, write: true, append: true, control: true },
|
|
49
|
+
},
|
|
50
|
+
public: {
|
|
51
|
+
read: isPrivate ? false : true,
|
|
52
|
+
write: true,
|
|
53
|
+
append: true,
|
|
54
|
+
control: true,
|
|
55
|
+
},
|
|
56
|
+
authenticated: {
|
|
57
|
+
read: isPrivate ? false : true,
|
|
58
|
+
write: true,
|
|
59
|
+
append: true,
|
|
60
|
+
control: true,
|
|
61
|
+
},
|
|
62
|
+
});
|
|
63
|
+
if (wacResult.isError)
|
|
64
|
+
throw wacResult;
|
|
65
|
+
const transaction = dataset.startTransaction();
|
|
66
|
+
const cProfile = transaction
|
|
67
|
+
.usingType(TypeIndexProfileShapeType)
|
|
68
|
+
.write(dataset.getResource(webId).uri)
|
|
69
|
+
.fromSubject(webId);
|
|
70
|
+
if (isPrivate) {
|
|
71
|
+
cProfile.privateTypeIndex?.add({ "@id": indexResource.uri });
|
|
72
|
+
}
|
|
73
|
+
else {
|
|
74
|
+
cProfile.publicTypeIndex?.add({ "@id": indexResource.uri });
|
|
75
|
+
}
|
|
76
|
+
const cTypeIndex = transaction
|
|
77
|
+
.usingType(TypeIndexDocumentShapeType)
|
|
78
|
+
.write(indexResource.uri)
|
|
79
|
+
.fromSubject(indexResource.uri);
|
|
80
|
+
cTypeIndex.type = set({ "@id": "ListedDocument" }, { "@id": "TypeIndex" });
|
|
81
|
+
const commitResult = await transaction.commitToRemote();
|
|
82
|
+
if (commitResult.isError)
|
|
83
|
+
throw commitResult;
|
|
84
|
+
}
|
|
85
|
+
/**
|
|
86
|
+
* Adds an instance to a TypeRegistration
|
|
87
|
+
* @param indexUri The URI of the TypeIndex
|
|
88
|
+
* @param classUri The URI for the class the instance should be added to
|
|
89
|
+
* @param instances Objects representing the instances to add
|
|
90
|
+
* @param options Options
|
|
91
|
+
*/
|
|
92
|
+
export function addRegistration(indexUri, classUri, instances, options) {
|
|
93
|
+
// Check to see if its already in the index
|
|
94
|
+
const typeRegistration = findAppropriateTypeRegistration(indexUri, classUri, options);
|
|
95
|
+
// Add instances to type registration
|
|
96
|
+
instances.instance?.forEach((instance) => {
|
|
97
|
+
typeRegistration.instance?.add({ "@id": instance });
|
|
98
|
+
});
|
|
99
|
+
instances.instanceContainer?.forEach((instanceContainer) => {
|
|
100
|
+
typeRegistration.instanceContainer?.add({ "@id": instanceContainer });
|
|
101
|
+
});
|
|
102
|
+
}
|
|
103
|
+
/**
|
|
104
|
+
* Removes instances from a TypeRegistration
|
|
105
|
+
* @param indexUri The URI of the TypeIndex
|
|
106
|
+
* @param classUri The URI for the class the instance should be removed from
|
|
107
|
+
* @param instances Objects representing the instances to remove
|
|
108
|
+
* @param options Options
|
|
109
|
+
*/
|
|
110
|
+
export async function removeRegistration(indexUri, classUri, instances, options) {
|
|
111
|
+
// Check to see if its already in the index
|
|
112
|
+
const typeRegistration = findAppropriateTypeRegistration(indexUri, classUri, options);
|
|
113
|
+
// Add instances to type registration
|
|
114
|
+
instances.instance?.forEach((instanceUri) => {
|
|
115
|
+
typeRegistration.instance?.delete({ "@id": instanceUri });
|
|
116
|
+
});
|
|
117
|
+
instances.instanceContainer?.forEach((instanceContainerUri) => {
|
|
118
|
+
typeRegistration.instanceContainer?.delete({ "@id": instanceContainerUri });
|
|
119
|
+
});
|
|
120
|
+
}
|
|
121
|
+
/**
|
|
122
|
+
* Finds a TypeRegistration inside of a type index. If it doesn't exist, it
|
|
123
|
+
* creates one.
|
|
124
|
+
* @param indexUri The URI of the typeIndex
|
|
125
|
+
* @param classUri The URI of the class in question for the TypeRegistration
|
|
126
|
+
* @param options
|
|
127
|
+
* @returns The Type Index
|
|
128
|
+
*/
|
|
129
|
+
export function findAppropriateTypeRegistration(indexUri, classUri, options) {
|
|
130
|
+
const { dataset } = guaranteeOptions(options);
|
|
131
|
+
// Check to see if its already in the index
|
|
132
|
+
const existingRegistrationsUris = dataset
|
|
133
|
+
.match(null, namedNode(RDF_TYPE), namedNode(TYPE_REGISTRATION), namedNode(indexUri))
|
|
134
|
+
.toArray()
|
|
135
|
+
.map((quad) => quad.subject);
|
|
136
|
+
const existingRegistrationForClassUri = existingRegistrationsUris.find((registrationUri) => {
|
|
137
|
+
return dataset.has(quad(registrationUri, namedNode(FOR_CLASS), namedNode(classUri), namedNode(indexUri)));
|
|
138
|
+
})?.value;
|
|
139
|
+
let typeRegistration;
|
|
140
|
+
if (existingRegistrationForClassUri) {
|
|
141
|
+
typeRegistration = dataset
|
|
142
|
+
.usingType(TypeRegistrationShapeType)
|
|
143
|
+
.write(indexUri)
|
|
144
|
+
.fromSubject(existingRegistrationForClassUri);
|
|
145
|
+
}
|
|
146
|
+
else {
|
|
147
|
+
typeRegistration = dataset
|
|
148
|
+
.usingType(TypeRegistrationShapeType)
|
|
149
|
+
.write(indexUri)
|
|
150
|
+
.fromSubject(`${indexUri}#${v4()}`);
|
|
151
|
+
typeRegistration.type = { "@id": "TypeRegistration" };
|
|
152
|
+
typeRegistration.forClass = { "@id": classUri };
|
|
153
|
+
}
|
|
154
|
+
return typeRegistration;
|
|
155
|
+
}
|
|
156
|
+
//# sourceMappingURL=setTypeIndex.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"setTypeIndex.js","sourceRoot":"","sources":["../../src/setTypeIndex.ts"],"names":[],"mappings":"AAAA,uDAAuD;AACvD,OAAO,EAAE,EAAE,EAAE,MAAM,MAAM,CAAC;AAC1B,OAAO,EAAE,SAAS,EAAE,QAAQ,EAAE,iBAAiB,EAAE,MAAM,gBAAgB,CAAC;AACxE,OAAO,EAAE,gBAAgB,EAAgB,MAAM,mBAAmB,CAAC;AACnE,OAAO,EAAE,SAAS,EAAE,IAAI,EAAE,MAAM,gBAAgB,CAAC;AAEjD,OAAO,EAAE,UAAU,EAAE,MAAM,mBAAmB,CAAC;AAC/C,OAAO,EAAE,yBAAyB,EAAE,MAAM,8BAA8B,CAAC;AAEzE,OAAO,EAAE,GAAG,EAAE,MAAM,UAAU,CAAC;AAQ/B,OAAO,EACL,0BAA0B,EAC1B,yBAAyB,GAC1B,MAAM,gCAAgC,CAAC;AAExC;;;;GAIG;AACH,MAAM,CAAC,KAAK,UAAU,aAAa,CACjC,KAAa,EACb,OAAiB;IAEjB,MAAM,EAAE,OAAO,EAAE,GAAG,gBAAgB,CAAC,OAAO,CAAC,CAAC;IAC9C,MAAM,OAAO,GAAG,MAAM,UAAU,CAAC,KAAK,EAAE,OAAO,CAAC,CAAC;IACjD,IAAI,CAAC,OAAO,CAAC,gBAAgB,EAAE,IAAI,IAAI,CAAC,OAAO,CAAC,eAAe,EAAE,IAAI,EAAE,CAAC;QACtE,MAAM,aAAa,GAAG,MAAM,OAAO;aAChC,WAAW,CAAC,KAAyC,CAAC;aACtD,kBAAkB,EAAE,CAAC;QACxB,IAAI,aAAa,EAAE,OAAO;YAAE,MAAM,aAAa,CAAC;QAChD,IAAI,CAAC,aAAa;YAChB,MAAM,IAAI,KAAK,CAAC,wCAAwC,CAAC,CAAC;QAC5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,CAAC,QAAQ,CAAC,CACpB;SACA,OAAO,EAAE;SACT,GAAG,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,IAAI,CAAC,OAAO,CAAgB,CAAC;IAE9C,MAAM,+BAA+B,GAAG,yBAAyB,CAAC,IAAI,CACpE,CAAC,eAAe,EAAE,EAAE;QAClB,OAAO,OAAO,CAAC,GAAG,CAChB,IAAI,CACF,eAAe,EACf,SAAS,CAAC,SAAS,CAAC,EACpB,SAAS,CAAC,QAAQ,CAAC,EACnB,SAAS,CAAC,QAAQ,CAAC,CACpB,CACF,CAAC;IACJ,CAAC,CACF,EAAE,KAAK,CAAC;IAET,IAAI,gBAAkC,CAAC;IACvC,IAAI,+BAA+B,EAAE,CAAC;QACpC,gBAAgB,GAAG,OAAO;aACvB,SAAS,CAAC,yBAAyB,CAAC;aACpC,KAAK,CAAC,QAAQ,CAAC;aACf,WAAW,CAAC,+BAA+B,CAAC,CAAC;IAClD,CAAC;SAAM,CAAC;QACN,gBAAgB,GAAG,OAAO;aACvB,SAAS,CAAC,yBAAyB,CAAC;aACpC,KAAK,CAAC,QAAQ,CAAC;aACf,WAAW,CAAC,GAAG,QAAQ,IAAI,EAAE,EAAE,EAAE,CAAC,CAAC;QACtC,gBAAgB,CAAC,IAAI,GAAG,EAAE,KAAK,EAAE,kBAAkB,EAAE,CAAC;QACtD,gBAAgB,CAAC,QAAQ,GAAG,EAAE,KAAK,EAAE,QAAQ,EAAE,CAAC;IAClD,CAAC;IACD,OAAO,gBAAgB,CAAC;AAC1B,CAAC"}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { createSolidLdoDataset, guaranteeFetch } from "@ldo/connected-solid";
|
|
2
|
+
export function guaranteeOptions(options) {
|
|
3
|
+
const fetch = guaranteeFetch(options?.fetch);
|
|
4
|
+
const dataset = (options?.solidLdoDataset ??
|
|
5
|
+
createSolidLdoDataset());
|
|
6
|
+
dataset.setContext("solid", { fetch });
|
|
7
|
+
return { fetch, dataset };
|
|
8
|
+
}
|
|
9
|
+
//# sourceMappingURL=Options.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Options.js","sourceRoot":"","sources":["../../../src/util/Options.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,qBAAqB,EAAE,cAAc,EAAE,MAAM,sBAAsB,CAAC;AAO7E,MAAM,UAAU,gBAAgB,CAAC,OAAiB;IAChD,MAAM,KAAK,GAAG,cAAc,CAAC,OAAO,EAAE,KAAK,CAAC,CAAC;IAC7C,MAAM,OAAO,GAAG,CAAC,OAAO,EAAE,eAAe;QACvC,qBAAqB,EAAE,CAAgD,CAAC;IAC1E,OAAO,CAAC,UAAU,CAAC,OAAO,EAAE,EAAE,KAAK,EAAE,CAAC,CAAC;IACvC,OAAO,EAAE,KAAK,EAAE,OAAO,EAAE,CAAC;AAC5B,CAAC"}
|