@ldo/solid-type-index 1.0.0-alpha.38 → 1.0.0-alpha.43
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/README.md +5 -5
- package/dist/_ldo/profile.context.cjs +1 -3
- package/dist/_ldo/{profile.context.js → profile.context.mjs} +2 -2
- package/dist/_ldo/profile.context.mjs.map +1 -0
- package/dist/_ldo/profile.schema.cjs +1 -3
- package/dist/_ldo/{profile.schema.js → profile.schema.mjs} +2 -2
- package/dist/_ldo/profile.schema.mjs.map +1 -0
- package/dist/_ldo/profile.shapeTypes.cjs +5 -7
- package/dist/_ldo/{profile.shapeTypes.js → profile.shapeTypes.mjs} +4 -5
- package/dist/_ldo/profile.shapeTypes.mjs.map +1 -0
- package/dist/_ldo/profile.typings.d.cts +0 -2
- package/dist/_ldo/profile.typings.d.cts.map +1 -1
- package/dist/_ldo/{profile.typings.d.ts → profile.typings.d.mts} +1 -3
- package/dist/_ldo/profile.typings.d.mts.map +1 -0
- package/dist/_ldo/typeIndex.context.cjs +1 -3
- package/dist/_ldo/{typeIndex.context.js → typeIndex.context.mjs} +2 -2
- package/dist/_ldo/typeIndex.context.mjs.map +1 -0
- package/dist/_ldo/typeIndex.schema.cjs +1 -3
- package/dist/_ldo/{typeIndex.schema.js → typeIndex.schema.mjs} +2 -2
- package/dist/_ldo/typeIndex.schema.mjs.map +1 -0
- package/dist/_ldo/typeIndex.shapeTypes.cjs +7 -9
- package/dist/_ldo/{typeIndex.shapeTypes.js → typeIndex.shapeTypes.mjs} +4 -5
- package/dist/_ldo/typeIndex.shapeTypes.mjs.map +1 -0
- package/dist/_ldo/typeIndex.typings.d.cts +0 -2
- package/dist/_ldo/typeIndex.typings.d.cts.map +1 -1
- package/dist/_ldo/{typeIndex.typings.d.ts → typeIndex.typings.d.mts} +1 -3
- package/dist/_ldo/typeIndex.typings.d.mts.map +1 -0
- package/dist/constants.cjs +1 -3
- package/dist/{constants.js → constants.mjs} +2 -2
- package/dist/constants.mjs.map +1 -0
- package/dist/getTypeIndex.cjs +14 -19
- package/dist/getTypeIndex.d.cts +0 -2
- package/dist/getTypeIndex.d.cts.map +1 -1
- package/dist/{getTypeIndex.d.ts → getTypeIndex.d.mts} +5 -7
- package/dist/getTypeIndex.d.mts.map +1 -0
- package/dist/{getTypeIndex.js → getTypeIndex.mjs} +10 -14
- package/dist/getTypeIndex.mjs.map +1 -0
- package/dist/index.cjs +16 -16
- package/dist/{index.js → index.d.mts} +4 -5
- package/dist/index.mjs +5 -0
- package/dist/react/useInstanceUris.cjs +13 -17
- package/dist/react/useInstanceUris.d.cts +0 -2
- package/dist/react/useInstanceUris.d.cts.map +1 -1
- package/dist/react/{useInstanceUris.d.ts → useInstanceUris.d.mts} +2 -4
- package/dist/react/useInstanceUris.d.mts.map +1 -0
- package/dist/react/{useInstanceUris.js → useInstanceUris.mjs} +8 -10
- package/dist/react/useInstanceUris.mjs.map +1 -0
- package/dist/react/useTypeIndexProfile.cjs +6 -10
- package/dist/react/useTypeIndexProfile.d.cts +0 -2
- package/dist/react/useTypeIndexProfile.d.cts.map +1 -1
- package/dist/react/useTypeIndexProfile.d.mts +7 -0
- package/dist/react/useTypeIndexProfile.d.mts.map +1 -0
- package/dist/react/{useTypeIndexProfile.js → useTypeIndexProfile.mjs} +4 -6
- package/dist/react/useTypeIndexProfile.mjs.map +1 -0
- package/dist/react/util/useSubscribeToUris.cjs +5 -9
- package/dist/react/util/{useSubscribeToUris.js → useSubscribeToUris.mjs} +3 -5
- package/dist/react/util/useSubscribeToUris.mjs.map +1 -0
- package/dist/setTypeIndex.cjs +19 -23
- package/dist/setTypeIndex.d.cts +0 -1
- package/dist/setTypeIndex.d.cts.map +1 -1
- package/dist/{setTypeIndex.d.ts → setTypeIndex.d.mts} +4 -5
- package/dist/setTypeIndex.d.mts.map +1 -0
- package/dist/{setTypeIndex.js → setTypeIndex.mjs} +8 -10
- package/dist/setTypeIndex.mjs.map +1 -0
- package/dist/util/Options.cjs +4 -7
- package/dist/util/Options.d.cts.map +1 -1
- package/dist/util/{Options.d.ts → Options.d.mts} +1 -1
- package/dist/util/Options.d.mts.map +1 -0
- package/dist/util/{Options.js → Options.mjs} +2 -3
- package/dist/util/Options.mjs.map +1 -0
- package/package.json +14 -13
- package/src/_ldo/profile.context.ts +1 -1
- package/src/_ldo/profile.schema.ts +1 -1
- package/src/_ldo/profile.shapeTypes.ts +2 -2
- package/src/_ldo/profile.typings.ts +1 -1
- package/src/_ldo/typeIndex.context.ts +1 -1
- package/src/_ldo/typeIndex.schema.ts +1 -1
- package/src/_ldo/typeIndex.shapeTypes.ts +2 -2
- package/src/_ldo/typeIndex.typings.ts +1 -1
- package/dist/_ldo/profile.context.js.map +0 -1
- package/dist/_ldo/profile.schema.js.map +0 -1
- package/dist/_ldo/profile.shapeTypes.js.map +0 -1
- package/dist/_ldo/profile.typings.d.ts.map +0 -1
- package/dist/_ldo/typeIndex.context.js.map +0 -1
- package/dist/_ldo/typeIndex.schema.js.map +0 -1
- package/dist/_ldo/typeIndex.shapeTypes.js.map +0 -1
- package/dist/_ldo/typeIndex.typings.d.ts.map +0 -1
- package/dist/_virtual/rolldown_runtime.cjs +0 -30
- package/dist/constants.js.map +0 -1
- package/dist/getTypeIndex.d.ts.map +0 -1
- package/dist/getTypeIndex.js.map +0 -1
- package/dist/index.d.ts +0 -5
- package/dist/react/useInstanceUris.d.ts.map +0 -1
- package/dist/react/useInstanceUris.js.map +0 -1
- package/dist/react/useTypeIndexProfile.d.ts +0 -9
- package/dist/react/useTypeIndexProfile.d.ts.map +0 -1
- package/dist/react/useTypeIndexProfile.js.map +0 -1
- package/dist/react/util/useSubscribeToUris.js.map +0 -1
- package/dist/setTypeIndex.d.ts.map +0 -1
- package/dist/setTypeIndex.js.map +0 -1
- package/dist/util/Options.d.ts.map +0 -1
- package/dist/util/Options.js.map +0 -1
package/README.md
CHANGED
|
@@ -10,10 +10,9 @@ npm i @ldo/solid-type-index @ldo/solid
|
|
|
10
10
|
|
|
11
11
|
## Usage
|
|
12
12
|
|
|
13
|
-
|
|
14
13
|
```typescript
|
|
15
14
|
import { initTypeIndex } from "@ldo/solid-type-index";
|
|
16
|
-
import { createSolidLdoDataset } from "@ldo/solid";
|
|
15
|
+
import { createSolidLdoDataset } from "@ldo/solid";
|
|
17
16
|
|
|
18
17
|
async function main() {
|
|
19
18
|
const myWebId = "https://example.com/profile/card#me";
|
|
@@ -23,7 +22,7 @@ async function main() {
|
|
|
23
22
|
await initTypeIndex(myWebId, { solidLdoDataset });
|
|
24
23
|
|
|
25
24
|
// Get Type Registrations
|
|
26
|
-
const typeRegistrations = await getTypeRegistrations(WEB_ID, {
|
|
25
|
+
const typeRegistrations = await getTypeRegistrations(WEB_ID, {
|
|
27
26
|
solidLdoDataset,
|
|
28
27
|
});
|
|
29
28
|
|
|
@@ -32,18 +31,19 @@ async function main() {
|
|
|
32
31
|
const bookmarkUris: string[] = await getInstanceUris(
|
|
33
32
|
"http://www.w3.org/2002/01/bookmark#Bookmark",
|
|
34
33
|
typeRegistrations,
|
|
35
|
-
{ solidLdoDataset }
|
|
34
|
+
{ solidLdoDataset },
|
|
36
35
|
);
|
|
37
|
-
|
|
38
36
|
}
|
|
39
37
|
main();
|
|
40
38
|
```
|
|
41
39
|
|
|
42
40
|
## Sponsorship
|
|
41
|
+
|
|
43
42
|
This project was made possible by a grant from NGI Zero Entrust via nlnet. Learn more on the [NLnet project page](https://nlnet.nl/project/SolidUsableApps/).
|
|
44
43
|
|
|
45
44
|
[<img src="https://nlnet.nl/logo/banner.png" alt="nlnet foundation logo" width="300" />](https://nlnet.nl/)
|
|
46
45
|
[<img src="https://nlnet.nl/image/logos/NGI0Entrust_tag.svg" alt="NGI Zero Entrust Logo" width="300" />](https://nlnet.nl/)
|
|
47
46
|
|
|
48
47
|
## Liscense
|
|
48
|
+
|
|
49
49
|
MIT
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
|
|
2
1
|
//#region src/_ldo/profile.context.ts
|
|
3
2
|
/**
|
|
4
3
|
* =============================================================================
|
|
@@ -17,6 +16,5 @@ const profileContext = {
|
|
|
17
16
|
"@isCollection": true
|
|
18
17
|
}
|
|
19
18
|
};
|
|
20
|
-
|
|
21
19
|
//#endregion
|
|
22
|
-
exports.profileContext = profileContext;
|
|
20
|
+
exports.profileContext = profileContext;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"profile.context.mjs","names":[],"sources":["../../src/_ldo/profile.context.ts"],"sourcesContent":["import type { LdoJsonldContext } from \"@ldo/ldo\";\n\n/**\n * =============================================================================\n * profileContext: JSONLD Context for profile\n * =============================================================================\n */\nexport const profileContext: LdoJsonldContext = {\n privateTypeIndex: {\n \"@id\": \"http://www.w3.org/ns/solid/terms#privateTypeIndex\",\n \"@type\": \"@id\",\n \"@isCollection\": true,\n },\n publicTypeIndex: {\n \"@id\": \"http://www.w3.org/ns/solid/terms#publicTypeIndex\",\n \"@type\": \"@id\",\n \"@isCollection\": true,\n },\n};\n"],"mappings":";;;;;;AAOA,MAAa,iBAAmC;CAC9C,kBAAkB;EAChB,OAAO;EACP,SAAS;EACT,iBAAiB;EAClB;CACD,iBAAiB;EACf,OAAO;EACP,SAAS;EACT,iBAAiB;EAClB;CACF"}
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
|
|
2
1
|
//#region src/_ldo/profile.schema.ts
|
|
3
2
|
/**
|
|
4
3
|
* =============================================================================
|
|
@@ -47,6 +46,5 @@ const profileSchema = {
|
|
|
47
46
|
}
|
|
48
47
|
}]
|
|
49
48
|
};
|
|
50
|
-
|
|
51
49
|
//#endregion
|
|
52
|
-
exports.profileSchema = profileSchema;
|
|
50
|
+
exports.profileSchema = profileSchema;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"profile.schema.mjs","names":[],"sources":["../../src/_ldo/profile.schema.ts"],"sourcesContent":["import type { Schema } from \"shexj\";\n\n/**\n * =============================================================================\n * profileSchema: ShexJ Schema for profile\n * =============================================================================\n */\nexport const profileSchema: Schema = {\n type: \"Schema\",\n shapes: [\n {\n id: \"https://shaperepo.com/schemas/solidProfile#TypeIndexProfile\",\n type: \"ShapeDecl\",\n shapeExpr: {\n type: \"Shape\",\n expression: {\n type: \"EachOf\",\n expressions: [\n {\n type: \"TripleConstraint\",\n predicate: \"http://www.w3.org/ns/solid/terms#privateTypeIndex\",\n valueExpr: {\n type: \"NodeConstraint\",\n nodeKind: \"iri\",\n },\n min: 0,\n max: -1,\n annotations: [\n {\n type: \"Annotation\",\n predicate: \"http://www.w3.org/2000/01/rdf-schema#comment\",\n object: {\n value:\n \"A registry of all types used on the user's Pod (for private access only)\",\n },\n },\n ],\n },\n {\n type: \"TripleConstraint\",\n predicate: \"http://www.w3.org/ns/solid/terms#publicTypeIndex\",\n valueExpr: {\n type: \"NodeConstraint\",\n nodeKind: \"iri\",\n },\n min: 0,\n max: -1,\n annotations: [\n {\n type: \"Annotation\",\n predicate: \"http://www.w3.org/2000/01/rdf-schema#comment\",\n object: {\n value:\n \"A registry of all types used on the user's Pod (for public access)\",\n },\n },\n ],\n },\n ],\n },\n },\n },\n ],\n};\n"],"mappings":";;;;;;AAOA,MAAa,gBAAwB;CACnC,MAAM;CACN,QAAQ,CACN;EACE,IAAI;EACJ,MAAM;EACN,WAAW;GACT,MAAM;GACN,YAAY;IACV,MAAM;IACN,aAAa,CACX;KACE,MAAM;KACN,WAAW;KACX,WAAW;MACT,MAAM;MACN,UAAU;MACX;KACD,KAAK;KACL,KAAK;KACL,aAAa,CACX;MACE,MAAM;MACN,WAAW;MACX,QAAQ,EACN,OACE,4EACH;MACF,CACF;KACF,EACD;KACE,MAAM;KACN,WAAW;KACX,WAAW;MACT,MAAM;MACN,UAAU;MACX;KACD,KAAK;KACL,KAAK;KACL,aAAa,CACX;MACE,MAAM;MACN,WAAW;MACX,QAAQ,EACN,OACE,sEACH;MACF,CACF;KACF,CACF;IACF;GACF;EACF,CACF;CACF"}
|
|
@@ -1,6 +1,5 @@
|
|
|
1
|
-
const
|
|
2
|
-
const
|
|
3
|
-
|
|
1
|
+
const require_profile_schema = require("./profile.schema.cjs");
|
|
2
|
+
const require_profile_context = require("./profile.context.cjs");
|
|
4
3
|
//#region src/_ldo/profile.shapeTypes.ts
|
|
5
4
|
/**
|
|
6
5
|
* =============================================================================
|
|
@@ -11,10 +10,9 @@ const require__Users_jacksonmorgan_O_ldo_packages_solid_type_index_src__ldo_prof
|
|
|
11
10
|
* TypeIndexProfile ShapeType
|
|
12
11
|
*/
|
|
13
12
|
const TypeIndexProfileShapeType = {
|
|
14
|
-
schema:
|
|
13
|
+
schema: require_profile_schema.profileSchema,
|
|
15
14
|
shape: "https://shaperepo.com/schemas/solidProfile#TypeIndexProfile",
|
|
16
|
-
context:
|
|
15
|
+
context: require_profile_context.profileContext
|
|
17
16
|
};
|
|
18
|
-
|
|
19
17
|
//#endregion
|
|
20
|
-
exports.TypeIndexProfileShapeType = TypeIndexProfileShapeType;
|
|
18
|
+
exports.TypeIndexProfileShapeType = TypeIndexProfileShapeType;
|
|
@@ -1,6 +1,5 @@
|
|
|
1
|
-
import { profileSchema } from "./profile.schema.
|
|
2
|
-
import { profileContext } from "./profile.context.
|
|
3
|
-
|
|
1
|
+
import { profileSchema } from "./profile.schema.mjs";
|
|
2
|
+
import { profileContext } from "./profile.context.mjs";
|
|
4
3
|
//#region src/_ldo/profile.shapeTypes.ts
|
|
5
4
|
/**
|
|
6
5
|
* =============================================================================
|
|
@@ -15,7 +14,7 @@ const TypeIndexProfileShapeType = {
|
|
|
15
14
|
shape: "https://shaperepo.com/schemas/solidProfile#TypeIndexProfile",
|
|
16
15
|
context: profileContext
|
|
17
16
|
};
|
|
18
|
-
|
|
19
17
|
//#endregion
|
|
20
18
|
export { TypeIndexProfileShapeType };
|
|
21
|
-
|
|
19
|
+
|
|
20
|
+
//# sourceMappingURL=profile.shapeTypes.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"profile.shapeTypes.mjs","names":[],"sources":["../../src/_ldo/profile.shapeTypes.ts"],"sourcesContent":["import type { ShapeType } from \"@ldo/ldo\";\nimport { profileSchema } from \"./profile.schema\";\nimport { profileContext } from \"./profile.context\";\nimport type { TypeIndexProfile } from \"./profile.typings\";\n\n/**\n * =============================================================================\n * LDO ShapeTypes profile\n * =============================================================================\n */\n\n/**\n * TypeIndexProfile ShapeType\n */\nexport const TypeIndexProfileShapeType: ShapeType<TypeIndexProfile> = {\n schema: profileSchema,\n shape: \"https://shaperepo.com/schemas/solidProfile#TypeIndexProfile\",\n context: profileContext,\n};\n"],"mappings":";;;;;;;;;;;AAcA,MAAa,4BAAyD;CACpE,QAAQ;CACR,OAAO;CACP,SAAS;CACV"}
|
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
import { LdSet, LdoJsonldContext } from "@ldo/ldo";
|
|
2
2
|
|
|
3
3
|
//#region src/_ldo/profile.typings.d.ts
|
|
4
|
-
|
|
5
4
|
/**
|
|
6
5
|
* =============================================================================
|
|
7
6
|
* Typescript Typings for profile
|
|
@@ -26,7 +25,6 @@ interface TypeIndexProfile {
|
|
|
26
25
|
"@id": string;
|
|
27
26
|
}>;
|
|
28
27
|
}
|
|
29
|
-
//# sourceMappingURL=profile.typings.d.ts.map
|
|
30
28
|
//#endregion
|
|
31
29
|
export { TypeIndexProfile };
|
|
32
30
|
//# sourceMappingURL=profile.typings.d.cts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"profile.typings.d.cts","names":[],"sources":["
|
|
1
|
+
{"version":3,"file":"profile.typings.d.cts","names":[],"sources":["../../src/_ldo/profile.typings.ts"],"mappings":";;;;;AAWA;;;;;;UAAiB,gBAAA;EACf,KAAA;EACA,UAAA,GAAa,gBAAA;EAAb;;;EAIA,gBAAA,GAAmB,KAAA;IACjB,KAAA;EAAA;EAKgB;;;EAAlB,eAAA,GAAkB,KAAA;IAChB,KAAA;EAAA;AAAA"}
|
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
import { LdSet, LdoJsonldContext } from "@ldo/ldo";
|
|
2
2
|
|
|
3
3
|
//#region src/_ldo/profile.typings.d.ts
|
|
4
|
-
|
|
5
4
|
/**
|
|
6
5
|
* =============================================================================
|
|
7
6
|
* Typescript Typings for profile
|
|
@@ -26,7 +25,6 @@ interface TypeIndexProfile {
|
|
|
26
25
|
"@id": string;
|
|
27
26
|
}>;
|
|
28
27
|
}
|
|
29
|
-
//# sourceMappingURL=profile.typings.d.ts.map
|
|
30
28
|
//#endregion
|
|
31
29
|
export { TypeIndexProfile };
|
|
32
|
-
//# sourceMappingURL=profile.typings.d.
|
|
30
|
+
//# sourceMappingURL=profile.typings.d.mts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"profile.typings.d.mts","names":[],"sources":["../../src/_ldo/profile.typings.ts"],"mappings":";;;;;AAWA;;;;;;UAAiB,gBAAA;EACf,KAAA;EACA,UAAA,GAAa,gBAAA;EAAb;;;EAIA,gBAAA,GAAmB,KAAA;IACjB,KAAA;EAAA;EAKgB;;;EAAlB,eAAA,GAAkB,KAAA;IAChB,KAAA;EAAA;AAAA"}
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
|
|
2
1
|
//#region src/_ldo/typeIndex.context.ts
|
|
3
2
|
/**
|
|
4
3
|
* =============================================================================
|
|
@@ -50,6 +49,5 @@ const typeIndexContext = {
|
|
|
50
49
|
"@isCollection": true
|
|
51
50
|
}
|
|
52
51
|
};
|
|
53
|
-
|
|
54
52
|
//#endregion
|
|
55
|
-
exports.typeIndexContext = typeIndexContext;
|
|
53
|
+
exports.typeIndexContext = typeIndexContext;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"typeIndex.context.mjs","names":[],"sources":["../../src/_ldo/typeIndex.context.ts"],"sourcesContent":["import type { LdoJsonldContext } from \"@ldo/ldo\";\n\n/**\n * =============================================================================\n * typeIndexContext: JSONLD Context for typeIndex\n * =============================================================================\n */\nexport const typeIndexContext: LdoJsonldContext = {\n type: {\n \"@id\": \"@type\",\n },\n TypeIndex: {\n \"@id\": \"http://www.w3.org/ns/solid/terms#TypeIndex\",\n \"@context\": {\n type: {\n \"@id\": \"@type\",\n },\n },\n },\n ListedDocument: {\n \"@id\": \"http://www.w3.org/ns/solid/terms#ListedDocument\",\n \"@context\": {\n type: {\n \"@id\": \"@type\",\n },\n },\n },\n TypeRegistration: {\n \"@id\": \"http://www.w3.org/ns/solid/terms#TypeRegistration\",\n \"@context\": {\n type: {\n \"@id\": \"@type\",\n },\n forClass: {\n \"@id\": \"http://www.w3.org/ns/solid/terms#forClass\",\n \"@type\": \"@id\",\n },\n instance: {\n \"@id\": \"http://www.w3.org/ns/solid/terms#instance\",\n \"@type\": \"@id\",\n \"@isCollection\": true,\n },\n instanceContainer: {\n \"@id\": \"http://www.w3.org/ns/solid/terms#instanceContainer\",\n \"@type\": \"@id\",\n \"@isCollection\": true,\n },\n },\n },\n forClass: {\n \"@id\": \"http://www.w3.org/ns/solid/terms#forClass\",\n \"@type\": \"@id\",\n },\n instance: {\n \"@id\": \"http://www.w3.org/ns/solid/terms#instance\",\n \"@type\": \"@id\",\n \"@isCollection\": true,\n },\n instanceContainer: {\n \"@id\": \"http://www.w3.org/ns/solid/terms#instanceContainer\",\n \"@type\": \"@id\",\n \"@isCollection\": true,\n },\n};\n"],"mappings":";;;;;;AAOA,MAAa,mBAAqC;CAChD,MAAM,EACJ,OAAO,SACR;CACD,WAAW;EACT,OAAO;EACP,YAAY,EACV,MAAM,EACJ,OAAO,SACR,EACF;EACF;CACD,gBAAgB;EACd,OAAO;EACP,YAAY,EACV,MAAM,EACJ,OAAO,SACR,EACF;EACF;CACD,kBAAkB;EAChB,OAAO;EACP,YAAY;GACV,MAAM,EACJ,OAAO,SACR;GACD,UAAU;IACR,OAAO;IACP,SAAS;IACV;GACD,UAAU;IACR,OAAO;IACP,SAAS;IACT,iBAAiB;IAClB;GACD,mBAAmB;IACjB,OAAO;IACP,SAAS;IACT,iBAAiB;IAClB;GACF;EACF;CACD,UAAU;EACR,OAAO;EACP,SAAS;EACV;CACD,UAAU;EACR,OAAO;EACP,SAAS;EACT,iBAAiB;EAClB;CACD,mBAAmB;EACjB,OAAO;EACP,SAAS;EACT,iBAAiB;EAClB;CACF"}
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
|
|
2
1
|
//#region src/_ldo/typeIndex.schema.ts
|
|
3
2
|
/**
|
|
4
3
|
* =============================================================================
|
|
@@ -112,6 +111,5 @@ const typeIndexSchema = {
|
|
|
112
111
|
}
|
|
113
112
|
}]
|
|
114
113
|
};
|
|
115
|
-
|
|
116
114
|
//#endregion
|
|
117
|
-
exports.typeIndexSchema = typeIndexSchema;
|
|
115
|
+
exports.typeIndexSchema = typeIndexSchema;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"typeIndex.schema.mjs","names":[],"sources":["../../src/_ldo/typeIndex.schema.ts"],"sourcesContent":["import type { Schema } from \"shexj\";\n\n/**\n * =============================================================================\n * typeIndexSchema: ShexJ Schema for typeIndex\n * =============================================================================\n */\nexport const typeIndexSchema: Schema = {\n type: \"Schema\",\n shapes: [\n {\n id: \"https://shaperepo.com/schemas/solidProfile#TypeIndexDocument\",\n type: \"ShapeDecl\",\n shapeExpr: {\n type: \"Shape\",\n expression: {\n type: \"EachOf\",\n expressions: [\n {\n type: \"TripleConstraint\",\n predicate: \"http://www.w3.org/1999/02/22-rdf-syntax-ns#type\",\n valueExpr: {\n type: \"NodeConstraint\",\n values: [\"http://www.w3.org/ns/solid/terms#TypeIndex\"],\n },\n annotations: [\n {\n type: \"Annotation\",\n predicate: \"http://www.w3.org/2000/01/rdf-schema#comment\",\n object: {\n value: \"Defines the node as a TypeIndex\",\n },\n },\n ],\n },\n {\n type: \"TripleConstraint\",\n predicate: \"http://www.w3.org/1999/02/22-rdf-syntax-ns#type\",\n valueExpr: {\n type: \"NodeConstraint\",\n values: [\"http://www.w3.org/ns/solid/terms#ListedDocument\"],\n },\n annotations: [\n {\n type: \"Annotation\",\n predicate: \"http://www.w3.org/2000/01/rdf-schema#comment\",\n object: {\n value: \"Defines the node as a Listed Document\",\n },\n },\n ],\n },\n ],\n },\n extra: [\"http://www.w3.org/1999/02/22-rdf-syntax-ns#type\"],\n },\n },\n {\n id: \"https://shaperepo.com/schemas/solidProfile#TypeRegistration\",\n type: \"ShapeDecl\",\n shapeExpr: {\n type: \"Shape\",\n expression: {\n type: \"EachOf\",\n expressions: [\n {\n type: \"TripleConstraint\",\n predicate: \"http://www.w3.org/1999/02/22-rdf-syntax-ns#type\",\n valueExpr: {\n type: \"NodeConstraint\",\n values: [\"http://www.w3.org/ns/solid/terms#TypeRegistration\"],\n },\n annotations: [\n {\n type: \"Annotation\",\n predicate: \"http://www.w3.org/2000/01/rdf-schema#comment\",\n object: {\n value: \"Defines this node as a Type Registration\",\n },\n },\n ],\n },\n {\n type: \"TripleConstraint\",\n predicate: \"http://www.w3.org/ns/solid/terms#forClass\",\n valueExpr: {\n type: \"NodeConstraint\",\n nodeKind: \"iri\",\n },\n annotations: [\n {\n type: \"Annotation\",\n predicate: \"http://www.w3.org/2000/01/rdf-schema#comment\",\n object: {\n value: \"The class of object at this type.\",\n },\n },\n ],\n },\n {\n type: \"TripleConstraint\",\n predicate: \"http://www.w3.org/ns/solid/terms#instance\",\n valueExpr: {\n type: \"NodeConstraint\",\n nodeKind: \"iri\",\n },\n min: 0,\n max: -1,\n annotations: [\n {\n type: \"Annotation\",\n predicate: \"http://www.w3.org/2000/01/rdf-schema#comment\",\n object: {\n value: \"A specific resource that contains the class.\",\n },\n },\n ],\n },\n {\n type: \"TripleConstraint\",\n predicate: \"http://www.w3.org/ns/solid/terms#instanceContainer\",\n valueExpr: {\n type: \"NodeConstraint\",\n nodeKind: \"iri\",\n },\n min: 0,\n max: -1,\n annotations: [\n {\n type: \"Annotation\",\n predicate: \"http://www.w3.org/2000/01/rdf-schema#comment\",\n object: {\n value: \"Containers that contain resources with the class.\",\n },\n },\n ],\n },\n ],\n },\n extra: [\"http://www.w3.org/1999/02/22-rdf-syntax-ns#type\"],\n },\n },\n ],\n};\n"],"mappings":";;;;;;AAOA,MAAa,kBAA0B;CACrC,MAAM;CACN,QAAQ,CACN;EACE,IAAI;EACJ,MAAM;EACN,WAAW;GACT,MAAM;GACN,YAAY;IACV,MAAM;IACN,aAAa,CACX;KACE,MAAM;KACN,WAAW;KACX,WAAW;MACT,MAAM;MACN,QAAQ,CAAC,6CAA6C;MACvD;KACD,aAAa,CACX;MACE,MAAM;MACN,WAAW;MACX,QAAQ,EACN,OAAO,mCACR;MACF,CACF;KACF,EACD;KACE,MAAM;KACN,WAAW;KACX,WAAW;MACT,MAAM;MACN,QAAQ,CAAC,kDAAkD;MAC5D;KACD,aAAa,CACX;MACE,MAAM;MACN,WAAW;MACX,QAAQ,EACN,OAAO,yCACR;MACF,CACF;KACF,CACF;IACF;GACD,OAAO,CAAC,kDAAkD;GAC3D;EACF,EACD;EACE,IAAI;EACJ,MAAM;EACN,WAAW;GACT,MAAM;GACN,YAAY;IACV,MAAM;IACN,aAAa;KACX;MACE,MAAM;MACN,WAAW;MACX,WAAW;OACT,MAAM;OACN,QAAQ,CAAC,oDAAoD;OAC9D;MACD,aAAa,CACX;OACE,MAAM;OACN,WAAW;OACX,QAAQ,EACN,OAAO,4CACR;OACF,CACF;MACF;KACD;MACE,MAAM;MACN,WAAW;MACX,WAAW;OACT,MAAM;OACN,UAAU;OACX;MACD,aAAa,CACX;OACE,MAAM;OACN,WAAW;OACX,QAAQ,EACN,OAAO,qCACR;OACF,CACF;MACF;KACD;MACE,MAAM;MACN,WAAW;MACX,WAAW;OACT,MAAM;OACN,UAAU;OACX;MACD,KAAK;MACL,KAAK;MACL,aAAa,CACX;OACE,MAAM;OACN,WAAW;OACX,QAAQ,EACN,OAAO,gDACR;OACF,CACF;MACF;KACD;MACE,MAAM;MACN,WAAW;MACX,WAAW;OACT,MAAM;OACN,UAAU;OACX;MACD,KAAK;MACL,KAAK;MACL,aAAa,CACX;OACE,MAAM;OACN,WAAW;OACX,QAAQ,EACN,OAAO,qDACR;OACF,CACF;MACF;KACF;IACF;GACD,OAAO,CAAC,kDAAkD;GAC3D;EACF,CACF;CACF"}
|
|
@@ -1,6 +1,5 @@
|
|
|
1
|
-
const
|
|
2
|
-
const
|
|
3
|
-
|
|
1
|
+
const require_typeIndex_schema = require("./typeIndex.schema.cjs");
|
|
2
|
+
const require_typeIndex_context = require("./typeIndex.context.cjs");
|
|
4
3
|
//#region src/_ldo/typeIndex.shapeTypes.ts
|
|
5
4
|
/**
|
|
6
5
|
* =============================================================================
|
|
@@ -11,19 +10,18 @@ const require__Users_jacksonmorgan_O_ldo_packages_solid_type_index_src__ldo_type
|
|
|
11
10
|
* TypeIndexDocument ShapeType
|
|
12
11
|
*/
|
|
13
12
|
const TypeIndexDocumentShapeType = {
|
|
14
|
-
schema:
|
|
13
|
+
schema: require_typeIndex_schema.typeIndexSchema,
|
|
15
14
|
shape: "https://shaperepo.com/schemas/solidProfile#TypeIndexDocument",
|
|
16
|
-
context:
|
|
15
|
+
context: require_typeIndex_context.typeIndexContext
|
|
17
16
|
};
|
|
18
17
|
/**
|
|
19
18
|
* TypeRegistration ShapeType
|
|
20
19
|
*/
|
|
21
20
|
const TypeRegistrationShapeType = {
|
|
22
|
-
schema:
|
|
21
|
+
schema: require_typeIndex_schema.typeIndexSchema,
|
|
23
22
|
shape: "https://shaperepo.com/schemas/solidProfile#TypeRegistration",
|
|
24
|
-
context:
|
|
23
|
+
context: require_typeIndex_context.typeIndexContext
|
|
25
24
|
};
|
|
26
|
-
|
|
27
25
|
//#endregion
|
|
28
26
|
exports.TypeIndexDocumentShapeType = TypeIndexDocumentShapeType;
|
|
29
|
-
exports.TypeRegistrationShapeType = TypeRegistrationShapeType;
|
|
27
|
+
exports.TypeRegistrationShapeType = TypeRegistrationShapeType;
|
|
@@ -1,6 +1,5 @@
|
|
|
1
|
-
import { typeIndexSchema } from "./typeIndex.schema.
|
|
2
|
-
import { typeIndexContext } from "./typeIndex.context.
|
|
3
|
-
|
|
1
|
+
import { typeIndexSchema } from "./typeIndex.schema.mjs";
|
|
2
|
+
import { typeIndexContext } from "./typeIndex.context.mjs";
|
|
4
3
|
//#region src/_ldo/typeIndex.shapeTypes.ts
|
|
5
4
|
/**
|
|
6
5
|
* =============================================================================
|
|
@@ -23,7 +22,7 @@ const TypeRegistrationShapeType = {
|
|
|
23
22
|
shape: "https://shaperepo.com/schemas/solidProfile#TypeRegistration",
|
|
24
23
|
context: typeIndexContext
|
|
25
24
|
};
|
|
26
|
-
|
|
27
25
|
//#endregion
|
|
28
26
|
export { TypeIndexDocumentShapeType, TypeRegistrationShapeType };
|
|
29
|
-
|
|
27
|
+
|
|
28
|
+
//# sourceMappingURL=typeIndex.shapeTypes.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"typeIndex.shapeTypes.mjs","names":[],"sources":["../../src/_ldo/typeIndex.shapeTypes.ts"],"sourcesContent":["import type { ShapeType } from \"@ldo/ldo\";\nimport { typeIndexSchema } from \"./typeIndex.schema\";\nimport { typeIndexContext } from \"./typeIndex.context\";\nimport type { TypeIndexDocument, TypeRegistration } from \"./typeIndex.typings\";\n\n/**\n * =============================================================================\n * LDO ShapeTypes typeIndex\n * =============================================================================\n */\n\n/**\n * TypeIndexDocument ShapeType\n */\nexport const TypeIndexDocumentShapeType: ShapeType<TypeIndexDocument> = {\n schema: typeIndexSchema,\n shape: \"https://shaperepo.com/schemas/solidProfile#TypeIndexDocument\",\n context: typeIndexContext,\n};\n\n/**\n * TypeRegistration ShapeType\n */\nexport const TypeRegistrationShapeType: ShapeType<TypeRegistration> = {\n schema: typeIndexSchema,\n shape: \"https://shaperepo.com/schemas/solidProfile#TypeRegistration\",\n context: typeIndexContext,\n};\n"],"mappings":";;;;;;;;;;;AAcA,MAAa,6BAA2D;CACtE,QAAQ;CACR,OAAO;CACP,SAAS;CACV;;;;AAKD,MAAa,4BAAyD;CACpE,QAAQ;CACR,OAAO;CACP,SAAS;CACV"}
|
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
import { LdSet, LdoJsonldContext } from "@ldo/ldo";
|
|
2
2
|
|
|
3
3
|
//#region src/_ldo/typeIndex.typings.d.ts
|
|
4
|
-
|
|
5
4
|
/**
|
|
6
5
|
* TypeRegistration Type
|
|
7
6
|
*/
|
|
@@ -33,7 +32,6 @@ interface TypeRegistration {
|
|
|
33
32
|
"@id": string;
|
|
34
33
|
}>;
|
|
35
34
|
}
|
|
36
|
-
//# sourceMappingURL=typeIndex.typings.d.ts.map
|
|
37
35
|
//#endregion
|
|
38
36
|
export { TypeRegistration };
|
|
39
37
|
//# sourceMappingURL=typeIndex.typings.d.cts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"typeIndex.typings.d.cts","names":[],"sources":["
|
|
1
|
+
{"version":3,"file":"typeIndex.typings.d.cts","names":[],"sources":["../../src/_ldo/typeIndex.typings.ts"],"mappings":";;;;;;UA8BiB,gBAAA;EACf,KAAA;EACA,UAAA,GAAa,gBAAA;;;;EAIb,IAAA;IACE,KAAA;EAAA;;;;EAKF,QAAA;IACE,KAAA;EAAA;;;;EAKF,QAAA,GAAW,KAAA;IACT,KAAA;EAAA;;;;EAKF,iBAAA,GAAoB,KAAA;IAClB,KAAA;EAAA;AAAA"}
|
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
import { LdSet, LdoJsonldContext } from "@ldo/ldo";
|
|
2
2
|
|
|
3
3
|
//#region src/_ldo/typeIndex.typings.d.ts
|
|
4
|
-
|
|
5
4
|
/**
|
|
6
5
|
* TypeRegistration Type
|
|
7
6
|
*/
|
|
@@ -33,7 +32,6 @@ interface TypeRegistration {
|
|
|
33
32
|
"@id": string;
|
|
34
33
|
}>;
|
|
35
34
|
}
|
|
36
|
-
//# sourceMappingURL=typeIndex.typings.d.ts.map
|
|
37
35
|
//#endregion
|
|
38
36
|
export { TypeRegistration };
|
|
39
|
-
//# sourceMappingURL=typeIndex.typings.d.
|
|
37
|
+
//# sourceMappingURL=typeIndex.typings.d.mts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"typeIndex.typings.d.mts","names":[],"sources":["../../src/_ldo/typeIndex.typings.ts"],"mappings":";;;;;;UA8BiB,gBAAA;EACf,KAAA;EACA,UAAA,GAAa,gBAAA;;;;EAIb,IAAA;IACE,KAAA;EAAA;;;;EAKF,QAAA;IACE,KAAA;EAAA;;;;EAKF,QAAA,GAAW,KAAA;IACT,KAAA;EAAA;;;;EAKF,iBAAA,GAAoB,KAAA;IAClB,KAAA;EAAA;AAAA"}
|
package/dist/constants.cjs
CHANGED
|
@@ -1,10 +1,8 @@
|
|
|
1
|
-
|
|
2
1
|
//#region src/constants.ts
|
|
3
2
|
const RDF_TYPE = "http://www.w3.org/1999/02/22-rdf-syntax-ns#type";
|
|
4
3
|
const TYPE_REGISTRATION = "http://www.w3.org/ns/solid/terms#TypeRegistration";
|
|
5
4
|
const FOR_CLASS = "http://www.w3.org/ns/solid/terms#forClass";
|
|
6
|
-
|
|
7
5
|
//#endregion
|
|
8
6
|
exports.FOR_CLASS = FOR_CLASS;
|
|
9
7
|
exports.RDF_TYPE = RDF_TYPE;
|
|
10
|
-
exports.TYPE_REGISTRATION = TYPE_REGISTRATION;
|
|
8
|
+
exports.TYPE_REGISTRATION = TYPE_REGISTRATION;
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
const RDF_TYPE = "http://www.w3.org/1999/02/22-rdf-syntax-ns#type";
|
|
3
3
|
const TYPE_REGISTRATION = "http://www.w3.org/ns/solid/terms#TypeRegistration";
|
|
4
4
|
const FOR_CLASS = "http://www.w3.org/ns/solid/terms#forClass";
|
|
5
|
-
|
|
6
5
|
//#endregion
|
|
7
6
|
export { FOR_CLASS, RDF_TYPE, TYPE_REGISTRATION };
|
|
8
|
-
|
|
7
|
+
|
|
8
|
+
//# sourceMappingURL=constants.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"constants.mjs","names":[],"sources":["../src/constants.ts"],"sourcesContent":["export const RDF_TYPE = \"http://www.w3.org/1999/02/22-rdf-syntax-ns#type\";\nexport const TYPE_REGISTRATION =\n \"http://www.w3.org/ns/solid/terms#TypeRegistration\";\nexport const FOR_CLASS = \"http://www.w3.org/ns/solid/terms#forClass\";\nexport const INSTANCE = \"http://www.w3.org/ns/solid/terms#instance\";\nexport const INSTANCE_CONTAINER =\n \"http://www.w3.org/ns/solid/terms#instanceContainer\";\n"],"mappings":";AAAA,MAAa,WAAW;AACxB,MAAa,oBACX;AACF,MAAa,YAAY"}
|
package/dist/getTypeIndex.cjs
CHANGED
|
@@ -1,26 +1,22 @@
|
|
|
1
|
-
const
|
|
2
|
-
const
|
|
3
|
-
const
|
|
4
|
-
const
|
|
5
|
-
|
|
1
|
+
const require_profile_shapeTypes = require("./_ldo/profile.shapeTypes.cjs");
|
|
2
|
+
const require_typeIndex_shapeTypes = require("./_ldo/typeIndex.shapeTypes.cjs");
|
|
3
|
+
const require_constants = require("./constants.cjs");
|
|
4
|
+
const require_Options = require("./util/Options.cjs");
|
|
6
5
|
//#region src/getTypeIndex.ts
|
|
7
6
|
async function getTypeRegistrations(webId, options) {
|
|
8
|
-
const { dataset } =
|
|
9
|
-
const
|
|
10
|
-
const typeIndexUris = getTypeIndexesUrisFromProfile(profile);
|
|
7
|
+
const { dataset } = require_Options.guaranteeOptions(options);
|
|
8
|
+
const typeIndexUris = getTypeIndexesUrisFromProfile(await getProfile(webId, options));
|
|
11
9
|
await Promise.all(typeIndexUris.map(async (typeIndexUri) => {
|
|
12
|
-
const
|
|
13
|
-
const readResult = await typeIndexResource.readIfUnfetched();
|
|
10
|
+
const readResult = await dataset.getResource(typeIndexUri).readIfUnfetched();
|
|
14
11
|
if (readResult.isError) throw readResult;
|
|
15
12
|
}));
|
|
16
|
-
return dataset.usingType(
|
|
13
|
+
return dataset.usingType(require_typeIndex_shapeTypes.TypeRegistrationShapeType).matchSubject(require_constants.RDF_TYPE, require_constants.TYPE_REGISTRATION);
|
|
17
14
|
}
|
|
18
15
|
async function getProfile(webId, options) {
|
|
19
|
-
const { dataset } =
|
|
20
|
-
const
|
|
21
|
-
const readResult = await profileResource.readIfUnfetched();
|
|
16
|
+
const { dataset } = require_Options.guaranteeOptions(options);
|
|
17
|
+
const readResult = await dataset.getResource(webId).readIfUnfetched();
|
|
22
18
|
if (readResult.isError) throw readResult;
|
|
23
|
-
return dataset.usingType(
|
|
19
|
+
return dataset.usingType(require_profile_shapeTypes.TypeIndexProfileShapeType).fromSubject(webId);
|
|
24
20
|
}
|
|
25
21
|
function getTypeIndexesUrisFromProfile(profile) {
|
|
26
22
|
const uris = [];
|
|
@@ -33,8 +29,8 @@ function getTypeIndexesUrisFromProfile(profile) {
|
|
|
33
29
|
return uris;
|
|
34
30
|
}
|
|
35
31
|
async function getInstanceUris(classUri, typeRegistrations, options) {
|
|
36
|
-
const { dataset } =
|
|
37
|
-
const leafUris = new Set();
|
|
32
|
+
const { dataset } = require_Options.guaranteeOptions(options);
|
|
33
|
+
const leafUris = /* @__PURE__ */ new Set();
|
|
38
34
|
await Promise.all(typeRegistrations.map(async (registration) => {
|
|
39
35
|
if (registration.forClass["@id"] === classUri) {
|
|
40
36
|
registration.instance?.forEach((instance) => leafUris.add(instance["@id"]));
|
|
@@ -49,9 +45,8 @@ async function getInstanceUris(classUri, typeRegistrations, options) {
|
|
|
49
45
|
}));
|
|
50
46
|
return Array.from(leafUris);
|
|
51
47
|
}
|
|
52
|
-
|
|
53
48
|
//#endregion
|
|
54
49
|
exports.getInstanceUris = getInstanceUris;
|
|
55
50
|
exports.getProfile = getProfile;
|
|
56
51
|
exports.getTypeIndexesUrisFromProfile = getTypeIndexesUrisFromProfile;
|
|
57
|
-
exports.getTypeRegistrations = getTypeRegistrations;
|
|
52
|
+
exports.getTypeRegistrations = getTypeRegistrations;
|
package/dist/getTypeIndex.d.cts
CHANGED
|
@@ -9,8 +9,6 @@ declare function getTypeRegistrations(webId: string, options?: Options): Promise
|
|
|
9
9
|
declare function getProfile(webId: string, options?: Options): Promise<TypeIndexProfile>;
|
|
10
10
|
declare function getTypeIndexesUrisFromProfile(profile: TypeIndexProfile): SolidLeafUri[];
|
|
11
11
|
declare function getInstanceUris(classUri: string, typeRegistrations: TypeRegistration[], options?: Options): Promise<SolidLeafUri[]>;
|
|
12
|
-
//# sourceMappingURL=getTypeIndex.d.ts.map
|
|
13
|
-
|
|
14
12
|
//#endregion
|
|
15
13
|
export { getInstanceUris, getProfile, getTypeIndexesUrisFromProfile, getTypeRegistrations };
|
|
16
14
|
//# sourceMappingURL=getTypeIndex.d.cts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"getTypeIndex.d.cts","names":[],"sources":["
|
|
1
|
+
{"version":3,"file":"getTypeIndex.d.cts","names":[],"sources":["../src/getTypeIndex.ts"],"mappings":";;;;;;;iBAUsB,oBAAA,CACpB,KAAA,UACA,OAAA,GAAU,OAAA,GACT,OAAA,CAAQ,KAAA,CAAM,gBAAA;AAAA,iBAwBK,UAAA,CACpB,KAAA,UACA,OAAA,GAAU,OAAA,GACT,OAAA,CAAQ,gBAAA;AAAA,iBAQK,6BAAA,CACd,OAAA,EAAS,gBAAA,GACR,YAAA;AAAA,iBAWmB,eAAA,CACpB,QAAA,UACA,iBAAA,EAAmB,gBAAA,IACnB,OAAA,GAAU,OAAA,GACT,OAAA,CAAQ,YAAA"}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { TypeRegistration } from "./_ldo/typeIndex.typings.
|
|
2
|
-
import { TypeIndexProfile } from "./_ldo/profile.typings.
|
|
3
|
-
import { Options } from "./util/Options.
|
|
1
|
+
import { TypeRegistration } from "./_ldo/typeIndex.typings.mjs";
|
|
2
|
+
import { TypeIndexProfile } from "./_ldo/profile.typings.mjs";
|
|
3
|
+
import { Options } from "./util/Options.mjs";
|
|
4
4
|
import { SolidLeafUri } from "@ldo/connected-solid";
|
|
5
5
|
import { LdSet } from "@ldo/ldo";
|
|
6
6
|
|
|
@@ -9,8 +9,6 @@ declare function getTypeRegistrations(webId: string, options?: Options): Promise
|
|
|
9
9
|
declare function getProfile(webId: string, options?: Options): Promise<TypeIndexProfile>;
|
|
10
10
|
declare function getTypeIndexesUrisFromProfile(profile: TypeIndexProfile): SolidLeafUri[];
|
|
11
11
|
declare function getInstanceUris(classUri: string, typeRegistrations: TypeRegistration[], options?: Options): Promise<SolidLeafUri[]>;
|
|
12
|
-
//# sourceMappingURL=getTypeIndex.d.ts.map
|
|
13
|
-
|
|
14
12
|
//#endregion
|
|
15
|
-
export { getInstanceUris
|
|
16
|
-
//# sourceMappingURL=getTypeIndex.d.
|
|
13
|
+
export { getInstanceUris, getProfile, getTypeIndexesUrisFromProfile, getTypeRegistrations };
|
|
14
|
+
//# sourceMappingURL=getTypeIndex.d.mts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"getTypeIndex.d.mts","names":[],"sources":["../src/getTypeIndex.ts"],"mappings":";;;;;;;iBAUsB,oBAAA,CACpB,KAAA,UACA,OAAA,GAAU,OAAA,GACT,OAAA,CAAQ,KAAA,CAAM,gBAAA;AAAA,iBAwBK,UAAA,CACpB,KAAA,UACA,OAAA,GAAU,OAAA,GACT,OAAA,CAAQ,gBAAA;AAAA,iBAQK,6BAAA,CACd,OAAA,EAAS,gBAAA,GACR,YAAA;AAAA,iBAWmB,eAAA,CACpB,QAAA,UACA,iBAAA,EAAmB,gBAAA,IACnB,OAAA,GAAU,OAAA,GACT,OAAA,CAAQ,YAAA"}
|
|
@@ -1,24 +1,20 @@
|
|
|
1
|
-
import { TypeIndexProfileShapeType } from "./_ldo/profile.shapeTypes.
|
|
2
|
-
import { TypeRegistrationShapeType } from "./_ldo/typeIndex.shapeTypes.
|
|
3
|
-
import { RDF_TYPE, TYPE_REGISTRATION } from "./constants.
|
|
4
|
-
import { guaranteeOptions } from "./util/Options.
|
|
5
|
-
|
|
1
|
+
import { TypeIndexProfileShapeType } from "./_ldo/profile.shapeTypes.mjs";
|
|
2
|
+
import { TypeRegistrationShapeType } from "./_ldo/typeIndex.shapeTypes.mjs";
|
|
3
|
+
import { RDF_TYPE, TYPE_REGISTRATION } from "./constants.mjs";
|
|
4
|
+
import { guaranteeOptions } from "./util/Options.mjs";
|
|
6
5
|
//#region src/getTypeIndex.ts
|
|
7
6
|
async function getTypeRegistrations(webId, options) {
|
|
8
7
|
const { dataset } = guaranteeOptions(options);
|
|
9
|
-
const
|
|
10
|
-
const typeIndexUris = getTypeIndexesUrisFromProfile(profile);
|
|
8
|
+
const typeIndexUris = getTypeIndexesUrisFromProfile(await getProfile(webId, options));
|
|
11
9
|
await Promise.all(typeIndexUris.map(async (typeIndexUri) => {
|
|
12
|
-
const
|
|
13
|
-
const readResult = await typeIndexResource.readIfUnfetched();
|
|
10
|
+
const readResult = await dataset.getResource(typeIndexUri).readIfUnfetched();
|
|
14
11
|
if (readResult.isError) throw readResult;
|
|
15
12
|
}));
|
|
16
13
|
return dataset.usingType(TypeRegistrationShapeType).matchSubject(RDF_TYPE, TYPE_REGISTRATION);
|
|
17
14
|
}
|
|
18
15
|
async function getProfile(webId, options) {
|
|
19
16
|
const { dataset } = guaranteeOptions(options);
|
|
20
|
-
const
|
|
21
|
-
const readResult = await profileResource.readIfUnfetched();
|
|
17
|
+
const readResult = await dataset.getResource(webId).readIfUnfetched();
|
|
22
18
|
if (readResult.isError) throw readResult;
|
|
23
19
|
return dataset.usingType(TypeIndexProfileShapeType).fromSubject(webId);
|
|
24
20
|
}
|
|
@@ -34,7 +30,7 @@ function getTypeIndexesUrisFromProfile(profile) {
|
|
|
34
30
|
}
|
|
35
31
|
async function getInstanceUris(classUri, typeRegistrations, options) {
|
|
36
32
|
const { dataset } = guaranteeOptions(options);
|
|
37
|
-
const leafUris = new Set();
|
|
33
|
+
const leafUris = /* @__PURE__ */ new Set();
|
|
38
34
|
await Promise.all(typeRegistrations.map(async (registration) => {
|
|
39
35
|
if (registration.forClass["@id"] === classUri) {
|
|
40
36
|
registration.instance?.forEach((instance) => leafUris.add(instance["@id"]));
|
|
@@ -49,7 +45,7 @@ async function getInstanceUris(classUri, typeRegistrations, options) {
|
|
|
49
45
|
}));
|
|
50
46
|
return Array.from(leafUris);
|
|
51
47
|
}
|
|
52
|
-
|
|
53
48
|
//#endregion
|
|
54
49
|
export { getInstanceUris, getProfile, getTypeIndexesUrisFromProfile, getTypeRegistrations };
|
|
55
|
-
|
|
50
|
+
|
|
51
|
+
//# sourceMappingURL=getTypeIndex.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"getTypeIndex.mjs","names":[],"sources":["../src/getTypeIndex.ts"],"sourcesContent":["import type { TypeRegistration } from \"./_ldo/typeIndex.typings\";\nimport type { TypeIndexProfile } from \"./_ldo/profile.typings\";\nimport { TypeIndexProfileShapeType } from \"./_ldo/profile.shapeTypes\";\nimport { TypeRegistrationShapeType } from \"./_ldo/typeIndex.shapeTypes\";\nimport { RDF_TYPE, TYPE_REGISTRATION } from \"./constants\";\nimport type { Options } from \"./util/Options\";\nimport { guaranteeOptions } from \"./util/Options\";\nimport type { LdSet } from \"@ldo/ldo\";\nimport type { SolidContainerUri, SolidLeafUri } from \"@ldo/connected-solid\";\n\nexport async function getTypeRegistrations(\n webId: string,\n options?: Options,\n): Promise<LdSet<TypeRegistration>> {\n const { dataset } = guaranteeOptions(options);\n\n // Get Profile\n const profile = await getProfile(webId, options);\n\n // Get Type Indexes\n const typeIndexUris = getTypeIndexesUrisFromProfile(profile);\n\n // Fetch the type Indexes\n await Promise.all(\n typeIndexUris.map(async (typeIndexUri) => {\n const typeIndexResource = dataset.getResource(typeIndexUri);\n const readResult = await typeIndexResource.readIfUnfetched();\n if (readResult.isError) throw readResult;\n }),\n );\n\n // Get Type Registrations\n return dataset\n .usingType(TypeRegistrationShapeType)\n .matchSubject(RDF_TYPE, TYPE_REGISTRATION);\n}\n\nexport async function getProfile(\n webId: string,\n options?: Options,\n): Promise<TypeIndexProfile> {\n const { dataset } = guaranteeOptions(options);\n const profileResource = dataset.getResource(webId);\n const readResult = await profileResource.readIfUnfetched();\n if (readResult.isError) throw readResult;\n return dataset.usingType(TypeIndexProfileShapeType).fromSubject(webId);\n}\n\nexport function getTypeIndexesUrisFromProfile(\n profile: TypeIndexProfile,\n): SolidLeafUri[] {\n const uris: SolidLeafUri[] = [];\n profile.privateTypeIndex?.forEach((indexNode) => {\n uris.push(indexNode[\"@id\"] as SolidLeafUri);\n });\n profile.publicTypeIndex?.forEach((indexNode) => {\n uris.push(indexNode[\"@id\"] as SolidLeafUri);\n });\n return uris;\n}\n\nexport async function getInstanceUris(\n classUri: string,\n typeRegistrations: TypeRegistration[],\n options?: Options,\n): Promise<SolidLeafUri[]> {\n const { dataset } = guaranteeOptions(options);\n\n const leafUris = new Set<SolidLeafUri>();\n await Promise.all(\n typeRegistrations.map(async (registration) => {\n if (registration.forClass[\"@id\"] === classUri) {\n // Individual registrations\n registration.instance?.forEach((instance) =>\n leafUris.add(instance[\"@id\"] as SolidLeafUri),\n );\n // Container registrations\n await Promise.all(\n registration.instanceContainer?.map(async (instanceContainer) => {\n const containerResource = dataset.getResource(\n instanceContainer[\"@id\"] as SolidContainerUri,\n );\n await containerResource.readIfUnfetched();\n containerResource.children().forEach((child) => {\n if (child.type === \"SolidLeaf\") leafUris.add(child.uri);\n });\n }) ?? [],\n );\n }\n }),\n );\n return Array.from(leafUris);\n}\n"],"mappings":";;;;;AAUA,eAAsB,qBACpB,OACA,SACkC;CAClC,MAAM,EAAE,YAAY,iBAAiB,QAAQ;CAM7C,MAAM,gBAAgB,8BAHN,MAAM,WAAW,OAAO,QAAQ,CAGY;AAG5D,OAAM,QAAQ,IACZ,cAAc,IAAI,OAAO,iBAAiB;EAExC,MAAM,aAAa,MADO,QAAQ,YAAY,aAAa,CAChB,iBAAiB;AAC5D,MAAI,WAAW,QAAS,OAAM;GAC9B,CACH;AAGD,QAAO,QACJ,UAAU,0BAA0B,CACpC,aAAa,UAAU,kBAAkB;;AAG9C,eAAsB,WACpB,OACA,SAC2B;CAC3B,MAAM,EAAE,YAAY,iBAAiB,QAAQ;CAE7C,MAAM,aAAa,MADK,QAAQ,YAAY,MAAM,CACT,iBAAiB;AAC1D,KAAI,WAAW,QAAS,OAAM;AAC9B,QAAO,QAAQ,UAAU,0BAA0B,CAAC,YAAY,MAAM;;AAGxE,SAAgB,8BACd,SACgB;CAChB,MAAM,OAAuB,EAAE;AAC/B,SAAQ,kBAAkB,SAAS,cAAc;AAC/C,OAAK,KAAK,UAAU,OAAuB;GAC3C;AACF,SAAQ,iBAAiB,SAAS,cAAc;AAC9C,OAAK,KAAK,UAAU,OAAuB;GAC3C;AACF,QAAO;;AAGT,eAAsB,gBACpB,UACA,mBACA,SACyB;CACzB,MAAM,EAAE,YAAY,iBAAiB,QAAQ;CAE7C,MAAM,2BAAW,IAAI,KAAmB;AACxC,OAAM,QAAQ,IACZ,kBAAkB,IAAI,OAAO,iBAAiB;AAC5C,MAAI,aAAa,SAAS,WAAW,UAAU;AAE7C,gBAAa,UAAU,SAAS,aAC9B,SAAS,IAAI,SAAS,OAAuB,CAC9C;AAED,SAAM,QAAQ,IACZ,aAAa,mBAAmB,IAAI,OAAO,sBAAsB;IAC/D,MAAM,oBAAoB,QAAQ,YAChC,kBAAkB,OACnB;AACD,UAAM,kBAAkB,iBAAiB;AACzC,sBAAkB,UAAU,CAAC,SAAS,UAAU;AAC9C,SAAI,MAAM,SAAS,YAAa,UAAS,IAAI,MAAM,IAAI;MACvD;KACF,IAAI,EAAE,CACT;;GAEH,CACH;AACD,QAAO,MAAM,KAAK,SAAS"}
|
package/dist/index.cjs
CHANGED
|
@@ -1,16 +1,16 @@
|
|
|
1
|
-
|
|
2
|
-
const
|
|
3
|
-
const
|
|
4
|
-
const
|
|
5
|
-
|
|
6
|
-
exports.addRegistration =
|
|
7
|
-
exports.createIndex =
|
|
8
|
-
exports.findAppropriateTypeRegistration =
|
|
9
|
-
exports.getInstanceUris =
|
|
10
|
-
exports.getProfile =
|
|
11
|
-
exports.getTypeIndexesUrisFromProfile =
|
|
12
|
-
exports.getTypeRegistrations =
|
|
13
|
-
exports.initTypeIndex =
|
|
14
|
-
exports.removeRegistration =
|
|
15
|
-
exports.useInstanceUris =
|
|
16
|
-
exports.useTypeIndexProfile =
|
|
1
|
+
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
2
|
+
const require_getTypeIndex = require("./getTypeIndex.cjs");
|
|
3
|
+
const require_setTypeIndex = require("./setTypeIndex.cjs");
|
|
4
|
+
const require_useTypeIndexProfile = require("./react/useTypeIndexProfile.cjs");
|
|
5
|
+
const require_useInstanceUris = require("./react/useInstanceUris.cjs");
|
|
6
|
+
exports.addRegistration = require_setTypeIndex.addRegistration;
|
|
7
|
+
exports.createIndex = require_setTypeIndex.createIndex;
|
|
8
|
+
exports.findAppropriateTypeRegistration = require_setTypeIndex.findAppropriateTypeRegistration;
|
|
9
|
+
exports.getInstanceUris = require_getTypeIndex.getInstanceUris;
|
|
10
|
+
exports.getProfile = require_getTypeIndex.getProfile;
|
|
11
|
+
exports.getTypeIndexesUrisFromProfile = require_getTypeIndex.getTypeIndexesUrisFromProfile;
|
|
12
|
+
exports.getTypeRegistrations = require_getTypeIndex.getTypeRegistrations;
|
|
13
|
+
exports.initTypeIndex = require_setTypeIndex.initTypeIndex;
|
|
14
|
+
exports.removeRegistration = require_setTypeIndex.removeRegistration;
|
|
15
|
+
exports.useInstanceUris = require_useInstanceUris.useInstanceUris;
|
|
16
|
+
exports.useTypeIndexProfile = require_useTypeIndexProfile.useTypeIndexProfile;
|