@ldo/solid-type-index 1.0.0-alpha.32 → 1.0.0-alpha.34
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/profile.context.cjs +22 -0
- package/dist/.ldo/profile.context.js +22 -0
- package/dist/.ldo/profile.context.js.map +1 -0
- package/dist/.ldo/profile.schema.cjs +52 -0
- package/dist/.ldo/profile.schema.js +52 -0
- package/dist/.ldo/profile.schema.js.map +1 -0
- package/dist/.ldo/profile.shapeTypes.cjs +20 -0
- package/dist/.ldo/profile.shapeTypes.js +21 -0
- package/dist/.ldo/profile.shapeTypes.js.map +1 -0
- package/dist/.ldo/profile.typings.d.cts +32 -0
- package/dist/.ldo/profile.typings.d.cts.map +1 -0
- package/dist/.ldo/profile.typings.d.ts +32 -0
- package/dist/.ldo/profile.typings.d.ts.map +1 -0
- package/dist/.ldo/typeIndex.context.cjs +55 -0
- package/dist/.ldo/typeIndex.context.js +55 -0
- package/dist/.ldo/typeIndex.context.js.map +1 -0
- package/dist/.ldo/typeIndex.schema.cjs +117 -0
- package/dist/.ldo/typeIndex.schema.js +117 -0
- package/dist/.ldo/typeIndex.schema.js.map +1 -0
- package/dist/.ldo/typeIndex.shapeTypes.cjs +29 -0
- package/dist/.ldo/typeIndex.shapeTypes.js +29 -0
- package/dist/.ldo/typeIndex.shapeTypes.js.map +1 -0
- package/dist/.ldo/typeIndex.typings.d.cts +39 -0
- package/dist/.ldo/typeIndex.typings.d.cts.map +1 -0
- package/dist/.ldo/typeIndex.typings.d.ts +39 -0
- package/dist/.ldo/typeIndex.typings.d.ts.map +1 -0
- package/dist/_virtual/rolldown_runtime.cjs +30 -0
- package/dist/constants.cjs +10 -0
- package/dist/constants.js +8 -0
- package/dist/constants.js.map +1 -0
- package/dist/getTypeIndex.cjs +57 -0
- package/dist/getTypeIndex.d.cts +16 -0
- package/dist/getTypeIndex.d.cts.map +1 -0
- package/dist/getTypeIndex.d.ts +16 -0
- package/dist/getTypeIndex.d.ts.map +1 -0
- package/dist/getTypeIndex.js +55 -0
- package/dist/getTypeIndex.js.map +1 -0
- package/dist/index.cjs +16 -0
- package/dist/index.d.cts +5 -0
- package/dist/index.d.ts +5 -0
- package/dist/index.js +6 -0
- package/dist/react/useInstanceUris.cjs +31 -0
- package/dist/react/useInstanceUris.d.cts +15 -0
- package/dist/react/useInstanceUris.d.cts.map +1 -0
- package/dist/react/useInstanceUris.d.ts +15 -0
- package/dist/react/useInstanceUris.d.ts.map +1 -0
- package/dist/react/useInstanceUris.js +31 -0
- package/dist/react/useInstanceUris.js.map +1 -0
- package/dist/react/useTypeIndexProfile.cjs +14 -0
- package/dist/react/useTypeIndexProfile.d.cts +9 -0
- package/dist/react/useTypeIndexProfile.d.cts.map +1 -0
- package/dist/react/useTypeIndexProfile.d.ts +9 -0
- package/dist/react/useTypeIndexProfile.d.ts.map +1 -0
- package/dist/react/useTypeIndexProfile.js +14 -0
- package/dist/react/useTypeIndexProfile.js.map +1 -0
- package/dist/react/util/useSubscribeToUris.cjs +28 -0
- package/dist/react/util/useSubscribeToUris.js +28 -0
- package/dist/react/util/useSubscribeToUris.js.map +1 -0
- package/dist/setTypeIndex.cjs +129 -0
- package/dist/{types/setTypeIndex.d.ts → setTypeIndex.d.cts} +17 -13
- package/dist/setTypeIndex.d.cts.map +1 -0
- package/dist/setTypeIndex.d.ts +57 -0
- package/dist/setTypeIndex.d.ts.map +1 -0
- package/dist/setTypeIndex.js +125 -0
- package/dist/setTypeIndex.js.map +1 -0
- package/dist/util/Options.cjs +16 -0
- package/dist/util/Options.d.cts +11 -0
- package/dist/util/Options.d.cts.map +1 -0
- package/dist/util/Options.d.ts +11 -0
- package/dist/util/Options.d.ts.map +1 -0
- package/dist/util/Options.js +16 -0
- package/dist/util/Options.js.map +1 -0
- package/package.json +22 -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 +5 -5
- package/src/react/useTypeIndexProfile.ts +2 -2
- package/src/setTypeIndex.ts +6 -6
- package/dist/cjs/.ldo/profile.context.cjs +0 -21
- package/dist/cjs/.ldo/profile.context.js.map +0 -1
- package/dist/cjs/.ldo/profile.schema.cjs +0 -64
- package/dist/cjs/.ldo/profile.schema.js.map +0 -1
- package/dist/cjs/.ldo/profile.shapeTypes.cjs +0 -19
- package/dist/cjs/.ldo/profile.shapeTypes.js.map +0 -1
- package/dist/cjs/.ldo/profile.typings.cjs +0 -3
- package/dist/cjs/.ldo/profile.typings.js.map +0 -1
- package/dist/cjs/.ldo/typeIndex.context.cjs +0 -66
- package/dist/cjs/.ldo/typeIndex.context.js.map +0 -1
- package/dist/cjs/.ldo/typeIndex.schema.cjs +0 -146
- package/dist/cjs/.ldo/typeIndex.schema.js.map +0 -1
- package/dist/cjs/.ldo/typeIndex.shapeTypes.cjs +0 -27
- package/dist/cjs/.ldo/typeIndex.shapeTypes.js.map +0 -1
- package/dist/cjs/.ldo/typeIndex.typings.cjs +0 -3
- package/dist/cjs/.ldo/typeIndex.typings.js.map +0 -1
- package/dist/cjs/constants.cjs +0 -9
- package/dist/cjs/constants.js.map +0 -1
- package/dist/cjs/getTypeIndex.cjs +0 -67
- package/dist/cjs/getTypeIndex.js.map +0 -1
- package/dist/cjs/index.cjs +0 -21
- package/dist/cjs/index.js.map +0 -1
- package/dist/cjs/react/useInstanceUris.cjs +0 -33
- package/dist/cjs/react/useInstanceUris.js.map +0 -1
- package/dist/cjs/react/useTypeIndexProfile.cjs +0 -12
- package/dist/cjs/react/useTypeIndexProfile.js.map +0 -1
- package/dist/cjs/react/util/useSubscribeToUris.cjs +0 -33
- package/dist/cjs/react/util/useSubscribeToUris.js.map +0 -1
- package/dist/cjs/setTypeIndex.cjs +0 -163
- package/dist/cjs/setTypeIndex.js.map +0 -1
- package/dist/cjs/util/Options.cjs +0 -12
- package/dist/cjs/util/Options.js.map +0 -1
- package/dist/esm/.ldo/profile.context.js +0 -18
- package/dist/esm/.ldo/profile.context.js.map +0 -1
- package/dist/esm/.ldo/profile.schema.js +0 -61
- package/dist/esm/.ldo/profile.schema.js.map +0 -1
- package/dist/esm/.ldo/profile.shapeTypes.js +0 -16
- package/dist/esm/.ldo/profile.shapeTypes.js.map +0 -1
- package/dist/esm/.ldo/profile.typings.js +0 -2
- package/dist/esm/.ldo/profile.typings.js.map +0 -1
- package/dist/esm/.ldo/typeIndex.context.js +0 -63
- package/dist/esm/.ldo/typeIndex.context.js.map +0 -1
- package/dist/esm/.ldo/typeIndex.schema.js +0 -143
- package/dist/esm/.ldo/typeIndex.schema.js.map +0 -1
- package/dist/esm/.ldo/typeIndex.shapeTypes.js +0 -24
- package/dist/esm/.ldo/typeIndex.shapeTypes.js.map +0 -1
- package/dist/esm/.ldo/typeIndex.typings.js +0 -2
- package/dist/esm/.ldo/typeIndex.typings.js.map +0 -1
- package/dist/esm/constants.js +0 -6
- package/dist/esm/constants.js.map +0 -1
- package/dist/esm/getTypeIndex.js +0 -61
- package/dist/esm/getTypeIndex.js.map +0 -1
- package/dist/esm/index.js +0 -5
- package/dist/esm/index.js.map +0 -1
- package/dist/esm/react/useInstanceUris.js +0 -30
- package/dist/esm/react/useInstanceUris.js.map +0 -1
- package/dist/esm/react/useTypeIndexProfile.js +0 -9
- package/dist/esm/react/useTypeIndexProfile.js.map +0 -1
- package/dist/esm/react/util/useSubscribeToUris.js +0 -30
- package/dist/esm/react/util/useSubscribeToUris.js.map +0 -1
- package/dist/esm/setTypeIndex.js +0 -156
- package/dist/esm/setTypeIndex.js.map +0 -1
- package/dist/esm/util/Options.js +0 -9
- package/dist/esm/util/Options.js.map +0 -1
- package/dist/types/.ldo/profile.context.d.ts +0 -8
- package/dist/types/.ldo/profile.context.d.ts.map +0 -1
- package/dist/types/.ldo/profile.schema.d.ts +0 -8
- package/dist/types/.ldo/profile.schema.d.ts.map +0 -1
- package/dist/types/.ldo/profile.shapeTypes.d.ts +0 -12
- package/dist/types/.ldo/profile.shapeTypes.d.ts.map +0 -1
- package/dist/types/.ldo/profile.typings.d.ts +0 -26
- package/dist/types/.ldo/profile.typings.d.ts.map +0 -1
- package/dist/types/.ldo/typeIndex.context.d.ts +0 -8
- package/dist/types/.ldo/typeIndex.context.d.ts.map +0 -1
- package/dist/types/.ldo/typeIndex.schema.d.ts +0 -8
- package/dist/types/.ldo/typeIndex.schema.d.ts.map +0 -1
- package/dist/types/.ldo/typeIndex.shapeTypes.d.ts +0 -16
- package/dist/types/.ldo/typeIndex.shapeTypes.d.ts.map +0 -1
- package/dist/types/.ldo/typeIndex.typings.d.ts +0 -53
- package/dist/types/.ldo/typeIndex.typings.d.ts.map +0 -1
- package/dist/types/constants.d.ts +0 -6
- package/dist/types/constants.d.ts.map +0 -1
- package/dist/types/getTypeIndex.d.ts +0 -10
- package/dist/types/getTypeIndex.d.ts.map +0 -1
- package/dist/types/index.d.ts +0 -5
- package/dist/types/index.d.ts.map +0 -1
- package/dist/types/react/useInstanceUris.d.ts +0 -9
- package/dist/types/react/useInstanceUris.d.ts.map +0 -1
- package/dist/types/react/useTypeIndexProfile.d.ts +0 -3
- package/dist/types/react/useTypeIndexProfile.d.ts.map +0 -1
- package/dist/types/react/util/useSubscribeToUris.d.ts +0 -2
- package/dist/types/react/util/useSubscribeToUris.d.ts.map +0 -1
- package/dist/types/setTypeIndex.d.ts.map +0 -1
- package/dist/types/util/Options.d.ts +0 -11
- package/dist/types/util/Options.d.ts.map +0 -1
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
const require__Users_jacksonmorgan_O_ldo_packages_solid_type_index_src__ldo_typeIndex_schema = require('./typeIndex.schema.cjs');
|
|
2
|
+
const require__Users_jacksonmorgan_O_ldo_packages_solid_type_index_src__ldo_typeIndex_context = require('./typeIndex.context.cjs');
|
|
3
|
+
|
|
4
|
+
//#region src/.ldo/typeIndex.shapeTypes.ts
|
|
5
|
+
/**
|
|
6
|
+
* =============================================================================
|
|
7
|
+
* LDO ShapeTypes typeIndex
|
|
8
|
+
* =============================================================================
|
|
9
|
+
*/
|
|
10
|
+
/**
|
|
11
|
+
* TypeIndexDocument ShapeType
|
|
12
|
+
*/
|
|
13
|
+
const TypeIndexDocumentShapeType = {
|
|
14
|
+
schema: require__Users_jacksonmorgan_O_ldo_packages_solid_type_index_src__ldo_typeIndex_schema.typeIndexSchema,
|
|
15
|
+
shape: "https://shaperepo.com/schemas/solidProfile#TypeIndexDocument",
|
|
16
|
+
context: require__Users_jacksonmorgan_O_ldo_packages_solid_type_index_src__ldo_typeIndex_context.typeIndexContext
|
|
17
|
+
};
|
|
18
|
+
/**
|
|
19
|
+
* TypeRegistration ShapeType
|
|
20
|
+
*/
|
|
21
|
+
const TypeRegistrationShapeType = {
|
|
22
|
+
schema: require__Users_jacksonmorgan_O_ldo_packages_solid_type_index_src__ldo_typeIndex_schema.typeIndexSchema,
|
|
23
|
+
shape: "https://shaperepo.com/schemas/solidProfile#TypeRegistration",
|
|
24
|
+
context: require__Users_jacksonmorgan_O_ldo_packages_solid_type_index_src__ldo_typeIndex_context.typeIndexContext
|
|
25
|
+
};
|
|
26
|
+
|
|
27
|
+
//#endregion
|
|
28
|
+
exports.TypeIndexDocumentShapeType = TypeIndexDocumentShapeType;
|
|
29
|
+
exports.TypeRegistrationShapeType = TypeRegistrationShapeType;
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import { typeIndexSchema } from "./typeIndex.schema.js";
|
|
2
|
+
import { typeIndexContext } from "./typeIndex.context.js";
|
|
3
|
+
|
|
4
|
+
//#region src/.ldo/typeIndex.shapeTypes.ts
|
|
5
|
+
/**
|
|
6
|
+
* =============================================================================
|
|
7
|
+
* LDO ShapeTypes typeIndex
|
|
8
|
+
* =============================================================================
|
|
9
|
+
*/
|
|
10
|
+
/**
|
|
11
|
+
* TypeIndexDocument ShapeType
|
|
12
|
+
*/
|
|
13
|
+
const TypeIndexDocumentShapeType = {
|
|
14
|
+
schema: typeIndexSchema,
|
|
15
|
+
shape: "https://shaperepo.com/schemas/solidProfile#TypeIndexDocument",
|
|
16
|
+
context: typeIndexContext
|
|
17
|
+
};
|
|
18
|
+
/**
|
|
19
|
+
* TypeRegistration ShapeType
|
|
20
|
+
*/
|
|
21
|
+
const TypeRegistrationShapeType = {
|
|
22
|
+
schema: typeIndexSchema,
|
|
23
|
+
shape: "https://shaperepo.com/schemas/solidProfile#TypeRegistration",
|
|
24
|
+
context: typeIndexContext
|
|
25
|
+
};
|
|
26
|
+
|
|
27
|
+
//#endregion
|
|
28
|
+
export { TypeIndexDocumentShapeType, TypeRegistrationShapeType };
|
|
29
|
+
//# sourceMappingURL=typeIndex.shapeTypes.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"typeIndex.shapeTypes.js","names":["TypeIndexDocumentShapeType: ShapeType<TypeIndexDocument>","TypeRegistrationShapeType: ShapeType<TypeRegistration>"],"sources":["../../src/.ldo/typeIndex.shapeTypes.ts"],"sourcesContent":["import { ShapeType } from \"@ldo/ldo\";\nimport { typeIndexSchema } from \"./typeIndex.schema\";\nimport { typeIndexContext } from \"./typeIndex.context\";\nimport { 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,MAAaA,6BAA2D;CACtE,QAAQ;CACR,OAAO;CACP,SAAS;AACV;;;;AAKD,MAAaC,4BAAyD;CACpE,QAAQ;CACR,OAAO;CACP,SAAS;AACV"}
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
import { LdSet, LdoJsonldContext } from "@ldo/ldo";
|
|
2
|
+
|
|
3
|
+
//#region src/.ldo/typeIndex.typings.d.ts
|
|
4
|
+
|
|
5
|
+
/**
|
|
6
|
+
* TypeRegistration Type
|
|
7
|
+
*/
|
|
8
|
+
interface TypeRegistration {
|
|
9
|
+
"@id"?: string;
|
|
10
|
+
"@context"?: LdoJsonldContext;
|
|
11
|
+
/**
|
|
12
|
+
* Defines this node as a Type Registration
|
|
13
|
+
*/
|
|
14
|
+
type: {
|
|
15
|
+
"@id": "TypeRegistration";
|
|
16
|
+
};
|
|
17
|
+
/**
|
|
18
|
+
* The class of object at this type.
|
|
19
|
+
*/
|
|
20
|
+
forClass: {
|
|
21
|
+
"@id": string;
|
|
22
|
+
};
|
|
23
|
+
/**
|
|
24
|
+
* A specific resource that contains the class.
|
|
25
|
+
*/
|
|
26
|
+
instance?: LdSet<{
|
|
27
|
+
"@id": string;
|
|
28
|
+
}>;
|
|
29
|
+
/**
|
|
30
|
+
* Containers that contain resources with the class.
|
|
31
|
+
*/
|
|
32
|
+
instanceContainer?: LdSet<{
|
|
33
|
+
"@id": string;
|
|
34
|
+
}>;
|
|
35
|
+
}
|
|
36
|
+
//# sourceMappingURL=typeIndex.typings.d.ts.map
|
|
37
|
+
//#endregion
|
|
38
|
+
export { TypeRegistration };
|
|
39
|
+
//# sourceMappingURL=typeIndex.typings.d.cts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"typeIndex.typings.d.cts","names":[],"sources":["../../../src/.ldo/typeIndex.typings.ts"],"sourcesContent":[],"mappings":";;;;;;;UA8BiB,gBAAA;;eAEF;;;;;;;;;;;;;;;;aAgBF;;;;;;sBAMS"}
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
import { LdSet, LdoJsonldContext } from "@ldo/ldo";
|
|
2
|
+
|
|
3
|
+
//#region src/.ldo/typeIndex.typings.d.ts
|
|
4
|
+
|
|
5
|
+
/**
|
|
6
|
+
* TypeRegistration Type
|
|
7
|
+
*/
|
|
8
|
+
interface TypeRegistration {
|
|
9
|
+
"@id"?: string;
|
|
10
|
+
"@context"?: LdoJsonldContext;
|
|
11
|
+
/**
|
|
12
|
+
* Defines this node as a Type Registration
|
|
13
|
+
*/
|
|
14
|
+
type: {
|
|
15
|
+
"@id": "TypeRegistration";
|
|
16
|
+
};
|
|
17
|
+
/**
|
|
18
|
+
* The class of object at this type.
|
|
19
|
+
*/
|
|
20
|
+
forClass: {
|
|
21
|
+
"@id": string;
|
|
22
|
+
};
|
|
23
|
+
/**
|
|
24
|
+
* A specific resource that contains the class.
|
|
25
|
+
*/
|
|
26
|
+
instance?: LdSet<{
|
|
27
|
+
"@id": string;
|
|
28
|
+
}>;
|
|
29
|
+
/**
|
|
30
|
+
* Containers that contain resources with the class.
|
|
31
|
+
*/
|
|
32
|
+
instanceContainer?: LdSet<{
|
|
33
|
+
"@id": string;
|
|
34
|
+
}>;
|
|
35
|
+
}
|
|
36
|
+
//# sourceMappingURL=typeIndex.typings.d.ts.map
|
|
37
|
+
//#endregion
|
|
38
|
+
export { TypeRegistration };
|
|
39
|
+
//# sourceMappingURL=typeIndex.typings.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"typeIndex.typings.d.ts","names":[],"sources":["../../../src/.ldo/typeIndex.typings.ts"],"sourcesContent":[],"mappings":";;;;;;;UA8BiB,gBAAA;;eAEF;;;;;;;;;;;;;;;;aAgBF;;;;;;sBAMS"}
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
//#region rolldown:runtime
|
|
2
|
+
var __create = Object.create;
|
|
3
|
+
var __defProp = Object.defineProperty;
|
|
4
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
5
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
6
|
+
var __getProtoOf = Object.getPrototypeOf;
|
|
7
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
8
|
+
var __copyProps = (to, from, except, desc) => {
|
|
9
|
+
if (from && typeof from === "object" || typeof from === "function") for (var keys = __getOwnPropNames(from), i = 0, n = keys.length, key; i < n; i++) {
|
|
10
|
+
key = keys[i];
|
|
11
|
+
if (!__hasOwnProp.call(to, key) && key !== except) __defProp(to, key, {
|
|
12
|
+
get: ((k) => from[k]).bind(null, key),
|
|
13
|
+
enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable
|
|
14
|
+
});
|
|
15
|
+
}
|
|
16
|
+
return to;
|
|
17
|
+
};
|
|
18
|
+
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", {
|
|
19
|
+
value: mod,
|
|
20
|
+
enumerable: true
|
|
21
|
+
}) : target, mod));
|
|
22
|
+
|
|
23
|
+
//#endregion
|
|
24
|
+
|
|
25
|
+
Object.defineProperty(exports, '__toESM', {
|
|
26
|
+
enumerable: true,
|
|
27
|
+
get: function () {
|
|
28
|
+
return __toESM;
|
|
29
|
+
}
|
|
30
|
+
});
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
|
|
2
|
+
//#region src/constants.ts
|
|
3
|
+
const RDF_TYPE = "http://www.w3.org/1999/02/22-rdf-syntax-ns#type";
|
|
4
|
+
const TYPE_REGISTRATION = "http://www.w3.org/ns/solid/terms#TypeRegistration";
|
|
5
|
+
const FOR_CLASS = "http://www.w3.org/ns/solid/terms#forClass";
|
|
6
|
+
|
|
7
|
+
//#endregion
|
|
8
|
+
exports.FOR_CLASS = FOR_CLASS;
|
|
9
|
+
exports.RDF_TYPE = RDF_TYPE;
|
|
10
|
+
exports.TYPE_REGISTRATION = TYPE_REGISTRATION;
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
//#region src/constants.ts
|
|
2
|
+
const RDF_TYPE = "http://www.w3.org/1999/02/22-rdf-syntax-ns#type";
|
|
3
|
+
const TYPE_REGISTRATION = "http://www.w3.org/ns/solid/terms#TypeRegistration";
|
|
4
|
+
const FOR_CLASS = "http://www.w3.org/ns/solid/terms#forClass";
|
|
5
|
+
|
|
6
|
+
//#endregion
|
|
7
|
+
export { FOR_CLASS, RDF_TYPE, TYPE_REGISTRATION };
|
|
8
|
+
//# sourceMappingURL=constants.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"constants.js","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"}
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
const require__Users_jacksonmorgan_O_ldo_packages_solid_type_index_src__ldo_profile_shapeTypes = require('.ldo/profile.shapeTypes.cjs');
|
|
2
|
+
const require__Users_jacksonmorgan_O_ldo_packages_solid_type_index_src__ldo_typeIndex_shapeTypes = require('.ldo/typeIndex.shapeTypes.cjs');
|
|
3
|
+
const require__Users_jacksonmorgan_O_ldo_packages_solid_type_index_src_constants = require('./constants.cjs');
|
|
4
|
+
const require__Users_jacksonmorgan_O_ldo_packages_solid_type_index_src_util_Options = require('./util/Options.cjs');
|
|
5
|
+
|
|
6
|
+
//#region src/getTypeIndex.ts
|
|
7
|
+
async function getTypeRegistrations(webId, options) {
|
|
8
|
+
const { dataset } = require__Users_jacksonmorgan_O_ldo_packages_solid_type_index_src_util_Options.guaranteeOptions(options);
|
|
9
|
+
const profile = await getProfile(webId, options);
|
|
10
|
+
const typeIndexUris = getTypeIndexesUrisFromProfile(profile);
|
|
11
|
+
await Promise.all(typeIndexUris.map(async (typeIndexUri) => {
|
|
12
|
+
const typeIndexResource = dataset.getResource(typeIndexUri);
|
|
13
|
+
const readResult = await typeIndexResource.readIfUnfetched();
|
|
14
|
+
if (readResult.isError) throw readResult;
|
|
15
|
+
}));
|
|
16
|
+
return dataset.usingType(require__Users_jacksonmorgan_O_ldo_packages_solid_type_index_src__ldo_typeIndex_shapeTypes.TypeRegistrationShapeType).matchSubject(require__Users_jacksonmorgan_O_ldo_packages_solid_type_index_src_constants.RDF_TYPE, require__Users_jacksonmorgan_O_ldo_packages_solid_type_index_src_constants.TYPE_REGISTRATION);
|
|
17
|
+
}
|
|
18
|
+
async function getProfile(webId, options) {
|
|
19
|
+
const { dataset } = require__Users_jacksonmorgan_O_ldo_packages_solid_type_index_src_util_Options.guaranteeOptions(options);
|
|
20
|
+
const profileResource = dataset.getResource(webId);
|
|
21
|
+
const readResult = await profileResource.readIfUnfetched();
|
|
22
|
+
if (readResult.isError) throw readResult;
|
|
23
|
+
return dataset.usingType(require__Users_jacksonmorgan_O_ldo_packages_solid_type_index_src__ldo_profile_shapeTypes.TypeIndexProfileShapeType).fromSubject(webId);
|
|
24
|
+
}
|
|
25
|
+
function getTypeIndexesUrisFromProfile(profile) {
|
|
26
|
+
const uris = [];
|
|
27
|
+
profile.privateTypeIndex?.forEach((indexNode) => {
|
|
28
|
+
uris.push(indexNode["@id"]);
|
|
29
|
+
});
|
|
30
|
+
profile.publicTypeIndex?.forEach((indexNode) => {
|
|
31
|
+
uris.push(indexNode["@id"]);
|
|
32
|
+
});
|
|
33
|
+
return uris;
|
|
34
|
+
}
|
|
35
|
+
async function getInstanceUris(classUri, typeRegistrations, options) {
|
|
36
|
+
const { dataset } = require__Users_jacksonmorgan_O_ldo_packages_solid_type_index_src_util_Options.guaranteeOptions(options);
|
|
37
|
+
const leafUris = new Set();
|
|
38
|
+
await Promise.all(typeRegistrations.map(async (registration) => {
|
|
39
|
+
if (registration.forClass["@id"] === classUri) {
|
|
40
|
+
registration.instance?.forEach((instance) => leafUris.add(instance["@id"]));
|
|
41
|
+
await Promise.all(registration.instanceContainer?.map(async (instanceContainer) => {
|
|
42
|
+
const containerResource = dataset.getResource(instanceContainer["@id"]);
|
|
43
|
+
await containerResource.readIfUnfetched();
|
|
44
|
+
containerResource.children().forEach((child) => {
|
|
45
|
+
if (child.type === "SolidLeaf") leafUris.add(child.uri);
|
|
46
|
+
});
|
|
47
|
+
}) ?? []);
|
|
48
|
+
}
|
|
49
|
+
}));
|
|
50
|
+
return Array.from(leafUris);
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
//#endregion
|
|
54
|
+
exports.getInstanceUris = getInstanceUris;
|
|
55
|
+
exports.getProfile = getProfile;
|
|
56
|
+
exports.getTypeIndexesUrisFromProfile = getTypeIndexesUrisFromProfile;
|
|
57
|
+
exports.getTypeRegistrations = getTypeRegistrations;
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { TypeRegistration } from ".ldo/typeIndex.typings.cjs";
|
|
2
|
+
import { TypeIndexProfile } from ".ldo/profile.typings.cjs";
|
|
3
|
+
import { Options } from "./util/Options.cjs";
|
|
4
|
+
import { LdSet } from "@ldo/ldo";
|
|
5
|
+
import { SolidLeafUri } from "@ldo/connected-solid";
|
|
6
|
+
|
|
7
|
+
//#region src/getTypeIndex.d.ts
|
|
8
|
+
declare function getTypeRegistrations(webId: string, options?: Options): Promise<LdSet<TypeRegistration>>;
|
|
9
|
+
declare function getProfile(webId: string, options?: Options): Promise<TypeIndexProfile>;
|
|
10
|
+
declare function getTypeIndexesUrisFromProfile(profile: TypeIndexProfile): SolidLeafUri[];
|
|
11
|
+
declare function getInstanceUris(classUri: string, typeRegistrations: TypeRegistration[], options?: Options): Promise<SolidLeafUri[]>;
|
|
12
|
+
//# sourceMappingURL=getTypeIndex.d.ts.map
|
|
13
|
+
|
|
14
|
+
//#endregion
|
|
15
|
+
export { getInstanceUris, getProfile, getTypeIndexesUrisFromProfile, getTypeRegistrations };
|
|
16
|
+
//# sourceMappingURL=getTypeIndex.d.cts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"getTypeIndex.d.cts","names":[],"sources":["../../src/getTypeIndex.ts"],"sourcesContent":[],"mappings":";;;;;;;iBAUsB,oBAAA,0BAEV,UACT,QAAQ,MAAM;iBAwBK,UAAA,0BAEV,UACT,QAAQ;AA9BW,iBAsCN,6BAAA,CAtC0B,OAAA,EAuC/B,gBAvC+B,CAAA,EAwCvC,YAxCuC,EAAA;AAAA,iBAmDpB,eAAA,CAnDoB,QAAA,EAAA,MAAA,EAAA,iBAAA,EAqDrB,gBArDqB,EAAA,EAAA,OAAA,CAAA,EAsD9B,OAtD8B,CAAA,EAuDvC,OAvDuC,CAuD/B,YAvD+B,EAAA,CAAA"}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { TypeRegistration } from ".ldo/typeIndex.typings.js";
|
|
2
|
+
import { TypeIndexProfile } from ".ldo/profile.typings.js";
|
|
3
|
+
import { Options } from "./util/Options.js";
|
|
4
|
+
import { SolidLeafUri } from "@ldo/connected-solid";
|
|
5
|
+
import { LdSet } from "@ldo/ldo";
|
|
6
|
+
|
|
7
|
+
//#region src/getTypeIndex.d.ts
|
|
8
|
+
declare function getTypeRegistrations(webId: string, options?: Options): Promise<LdSet<TypeRegistration>>;
|
|
9
|
+
declare function getProfile(webId: string, options?: Options): Promise<TypeIndexProfile>;
|
|
10
|
+
declare function getTypeIndexesUrisFromProfile(profile: TypeIndexProfile): SolidLeafUri[];
|
|
11
|
+
declare function getInstanceUris(classUri: string, typeRegistrations: TypeRegistration[], options?: Options): Promise<SolidLeafUri[]>;
|
|
12
|
+
//# sourceMappingURL=getTypeIndex.d.ts.map
|
|
13
|
+
|
|
14
|
+
//#endregion
|
|
15
|
+
export { getInstanceUris as getInstanceUris$1, getProfile as getProfile$1, getTypeIndexesUrisFromProfile as getTypeIndexesUrisFromProfile$1, getTypeRegistrations as getTypeRegistrations$1 };
|
|
16
|
+
//# sourceMappingURL=getTypeIndex.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"getTypeIndex.d.ts","names":[],"sources":["../../src/getTypeIndex.ts"],"sourcesContent":[],"mappings":";;;;;;;iBAUsB,oBAAA,0BAEV,UACT,QAAQ,MAAM;iBAwBK,UAAA,0BAEV,UACT,QAAQ;AA9BW,iBAsCN,6BAAA,CAtC0B,OAAA,EAuC/B,gBAvC+B,CAAA,EAwCvC,YAxCuC,EAAA;AAAA,iBAmDpB,eAAA,CAnDoB,QAAA,EAAA,MAAA,EAAA,iBAAA,EAqDrB,gBArDqB,EAAA,EAAA,OAAA,CAAA,EAsD9B,OAtD8B,CAAA,EAuDvC,OAvDuC,CAuD/B,YAvD+B,EAAA,CAAA"}
|
|
@@ -0,0 +1,55 @@
|
|
|
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
|
+
|
|
6
|
+
//#region src/getTypeIndex.ts
|
|
7
|
+
async function getTypeRegistrations(webId, options) {
|
|
8
|
+
const { dataset } = guaranteeOptions(options);
|
|
9
|
+
const profile = await getProfile(webId, options);
|
|
10
|
+
const typeIndexUris = getTypeIndexesUrisFromProfile(profile);
|
|
11
|
+
await Promise.all(typeIndexUris.map(async (typeIndexUri) => {
|
|
12
|
+
const typeIndexResource = dataset.getResource(typeIndexUri);
|
|
13
|
+
const readResult = await typeIndexResource.readIfUnfetched();
|
|
14
|
+
if (readResult.isError) throw readResult;
|
|
15
|
+
}));
|
|
16
|
+
return dataset.usingType(TypeRegistrationShapeType).matchSubject(RDF_TYPE, TYPE_REGISTRATION);
|
|
17
|
+
}
|
|
18
|
+
async function getProfile(webId, options) {
|
|
19
|
+
const { dataset } = guaranteeOptions(options);
|
|
20
|
+
const profileResource = dataset.getResource(webId);
|
|
21
|
+
const readResult = await profileResource.readIfUnfetched();
|
|
22
|
+
if (readResult.isError) throw readResult;
|
|
23
|
+
return dataset.usingType(TypeIndexProfileShapeType).fromSubject(webId);
|
|
24
|
+
}
|
|
25
|
+
function getTypeIndexesUrisFromProfile(profile) {
|
|
26
|
+
const uris = [];
|
|
27
|
+
profile.privateTypeIndex?.forEach((indexNode) => {
|
|
28
|
+
uris.push(indexNode["@id"]);
|
|
29
|
+
});
|
|
30
|
+
profile.publicTypeIndex?.forEach((indexNode) => {
|
|
31
|
+
uris.push(indexNode["@id"]);
|
|
32
|
+
});
|
|
33
|
+
return uris;
|
|
34
|
+
}
|
|
35
|
+
async function getInstanceUris(classUri, typeRegistrations, options) {
|
|
36
|
+
const { dataset } = guaranteeOptions(options);
|
|
37
|
+
const leafUris = new Set();
|
|
38
|
+
await Promise.all(typeRegistrations.map(async (registration) => {
|
|
39
|
+
if (registration.forClass["@id"] === classUri) {
|
|
40
|
+
registration.instance?.forEach((instance) => leafUris.add(instance["@id"]));
|
|
41
|
+
await Promise.all(registration.instanceContainer?.map(async (instanceContainer) => {
|
|
42
|
+
const containerResource = dataset.getResource(instanceContainer["@id"]);
|
|
43
|
+
await containerResource.readIfUnfetched();
|
|
44
|
+
containerResource.children().forEach((child) => {
|
|
45
|
+
if (child.type === "SolidLeaf") leafUris.add(child.uri);
|
|
46
|
+
});
|
|
47
|
+
}) ?? []);
|
|
48
|
+
}
|
|
49
|
+
}));
|
|
50
|
+
return Array.from(leafUris);
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
//#endregion
|
|
54
|
+
export { getInstanceUris, getProfile, getTypeIndexesUrisFromProfile, getTypeRegistrations };
|
|
55
|
+
//# sourceMappingURL=getTypeIndex.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"getTypeIndex.js","names":["webId: string","options?: Options","profile: TypeIndexProfile","uris: SolidLeafUri[]","classUri: string","typeRegistrations: TypeRegistration[]"],"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,qBACpBA,OACAC,SACkC;CAClC,MAAM,EAAE,SAAS,GAAG,iBAAiB,QAAQ;CAG7C,MAAM,UAAU,MAAM,WAAW,OAAO,QAAQ;CAGhD,MAAM,gBAAgB,8BAA8B,QAAQ;AAG5D,OAAM,QAAQ,IACZ,cAAc,IAAI,OAAO,iBAAiB;EACxC,MAAM,oBAAoB,QAAQ,YAAY,aAAa;EAC3D,MAAM,aAAa,MAAM,kBAAkB,iBAAiB;AAC5D,MAAI,WAAW,QAAS,OAAM;CAC/B,EAAC,CACH;AAGD,QAAO,QACJ,UAAU,0BAA0B,CACpC,aAAa,UAAU,kBAAkB;AAC7C;AAED,eAAsB,WACpBD,OACAC,SAC2B;CAC3B,MAAM,EAAE,SAAS,GAAG,iBAAiB,QAAQ;CAC7C,MAAM,kBAAkB,QAAQ,YAAY,MAAM;CAClD,MAAM,aAAa,MAAM,gBAAgB,iBAAiB;AAC1D,KAAI,WAAW,QAAS,OAAM;AAC9B,QAAO,QAAQ,UAAU,0BAA0B,CAAC,YAAY,MAAM;AACvE;AAED,SAAgB,8BACdC,SACgB;CAChB,MAAMC,OAAuB,CAAE;AAC/B,SAAQ,kBAAkB,QAAQ,CAAC,cAAc;AAC/C,OAAK,KAAK,UAAU,OAAuB;CAC5C,EAAC;AACF,SAAQ,iBAAiB,QAAQ,CAAC,cAAc;AAC9C,OAAK,KAAK,UAAU,OAAuB;CAC5C,EAAC;AACF,QAAO;AACR;AAED,eAAsB,gBACpBC,UACAC,mBACAJ,SACyB;CACzB,MAAM,EAAE,SAAS,GAAG,iBAAiB,QAAQ;CAE7C,MAAM,WAAW,IAAI;AACrB,OAAM,QAAQ,IACZ,kBAAkB,IAAI,OAAO,iBAAiB;AAC5C,MAAI,aAAa,SAAS,WAAW,UAAU;AAE7C,gBAAa,UAAU,QAAQ,CAAC,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,QAAQ,CAAC,UAAU;AAC9C,SAAI,MAAM,SAAS,YAAa,UAAS,IAAI,MAAM,IAAI;IACxD,EAAC;GACH,EAAC,IAAI,CAAE,EACT;EACF;CACF,EAAC,CACH;AACD,QAAO,MAAM,KAAK,SAAS;AAC5B"}
|
package/dist/index.cjs
ADDED
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
const require__Users_jacksonmorgan_O_ldo_packages_solid_type_index_src_getTypeIndex = require('./getTypeIndex.cjs');
|
|
2
|
+
const require__Users_jacksonmorgan_O_ldo_packages_solid_type_index_src_setTypeIndex = require('./setTypeIndex.cjs');
|
|
3
|
+
const require__Users_jacksonmorgan_O_ldo_packages_solid_type_index_src_react_useTypeIndexProfile = require('./react/useTypeIndexProfile.cjs');
|
|
4
|
+
const require__Users_jacksonmorgan_O_ldo_packages_solid_type_index_src_react_useInstanceUris = require('./react/useInstanceUris.cjs');
|
|
5
|
+
|
|
6
|
+
exports.addRegistration = require__Users_jacksonmorgan_O_ldo_packages_solid_type_index_src_setTypeIndex.addRegistration;
|
|
7
|
+
exports.createIndex = require__Users_jacksonmorgan_O_ldo_packages_solid_type_index_src_setTypeIndex.createIndex;
|
|
8
|
+
exports.findAppropriateTypeRegistration = require__Users_jacksonmorgan_O_ldo_packages_solid_type_index_src_setTypeIndex.findAppropriateTypeRegistration;
|
|
9
|
+
exports.getInstanceUris = require__Users_jacksonmorgan_O_ldo_packages_solid_type_index_src_getTypeIndex.getInstanceUris;
|
|
10
|
+
exports.getProfile = require__Users_jacksonmorgan_O_ldo_packages_solid_type_index_src_getTypeIndex.getProfile;
|
|
11
|
+
exports.getTypeIndexesUrisFromProfile = require__Users_jacksonmorgan_O_ldo_packages_solid_type_index_src_getTypeIndex.getTypeIndexesUrisFromProfile;
|
|
12
|
+
exports.getTypeRegistrations = require__Users_jacksonmorgan_O_ldo_packages_solid_type_index_src_getTypeIndex.getTypeRegistrations;
|
|
13
|
+
exports.initTypeIndex = require__Users_jacksonmorgan_O_ldo_packages_solid_type_index_src_setTypeIndex.initTypeIndex;
|
|
14
|
+
exports.removeRegistration = require__Users_jacksonmorgan_O_ldo_packages_solid_type_index_src_setTypeIndex.removeRegistration;
|
|
15
|
+
exports.useInstanceUris = require__Users_jacksonmorgan_O_ldo_packages_solid_type_index_src_react_useInstanceUris.useInstanceUris;
|
|
16
|
+
exports.useTypeIndexProfile = require__Users_jacksonmorgan_O_ldo_packages_solid_type_index_src_react_useTypeIndexProfile.useTypeIndexProfile;
|
package/dist/index.d.cts
ADDED
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import { getInstanceUris, getProfile, getTypeIndexesUrisFromProfile, getTypeRegistrations } from "./getTypeIndex.cjs";
|
|
2
|
+
import { addRegistration, createIndex, findAppropriateTypeRegistration, initTypeIndex, removeRegistration } from "./setTypeIndex.cjs";
|
|
3
|
+
import { useInstanceUris } from "./react/useInstanceUris.cjs";
|
|
4
|
+
import { useTypeIndexProfile } from "./react/useTypeIndexProfile.cjs";
|
|
5
|
+
export { addRegistration, createIndex, findAppropriateTypeRegistration, getInstanceUris, getProfile, getTypeIndexesUrisFromProfile, getTypeRegistrations, initTypeIndex, removeRegistration, useInstanceUris, useTypeIndexProfile };
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import { getInstanceUris$1 as getInstanceUris, getProfile$1 as getProfile, getTypeIndexesUrisFromProfile$1 as getTypeIndexesUrisFromProfile, getTypeRegistrations$1 as getTypeRegistrations } from "./getTypeIndex.js";
|
|
2
|
+
import { addRegistration$1 as addRegistration, createIndex$1 as createIndex, findAppropriateTypeRegistration$1 as findAppropriateTypeRegistration, initTypeIndex$1 as initTypeIndex, removeRegistration$1 as removeRegistration } from "./setTypeIndex.js";
|
|
3
|
+
import { useInstanceUris$1 as useInstanceUris } from "./react/useInstanceUris.js";
|
|
4
|
+
import { useTypeIndexProfile$1 as useTypeIndexProfile } from "./react/useTypeIndexProfile.js";
|
|
5
|
+
export { addRegistration, createIndex, findAppropriateTypeRegistration, getInstanceUris, getProfile, getTypeIndexesUrisFromProfile, getTypeRegistrations, initTypeIndex, removeRegistration, useInstanceUris, useTypeIndexProfile };
|
package/dist/index.js
ADDED
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import { getInstanceUris, getProfile, getTypeIndexesUrisFromProfile, getTypeRegistrations } from "./getTypeIndex.js";
|
|
2
|
+
import { addRegistration, createIndex, findAppropriateTypeRegistration, initTypeIndex, removeRegistration } from "./setTypeIndex.js";
|
|
3
|
+
import { useTypeIndexProfile } from "./react/useTypeIndexProfile.js";
|
|
4
|
+
import { useInstanceUris } from "./react/useInstanceUris.js";
|
|
5
|
+
|
|
6
|
+
export { addRegistration, createIndex, findAppropriateTypeRegistration, getInstanceUris, getProfile, getTypeIndexesUrisFromProfile, getTypeRegistrations, initTypeIndex, removeRegistration, useInstanceUris, useTypeIndexProfile };
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
const require_rolldown_runtime = require('../_virtual/rolldown_runtime.cjs');
|
|
2
|
+
const require__Users_jacksonmorgan_O_ldo_packages_solid_type_index_src__ldo_typeIndex_shapeTypes = require('../.ldo/typeIndex.shapeTypes.cjs');
|
|
3
|
+
const require__Users_jacksonmorgan_O_ldo_packages_solid_type_index_src_constants = require('../constants.cjs');
|
|
4
|
+
const require__Users_jacksonmorgan_O_ldo_packages_solid_type_index_src_getTypeIndex = require('../getTypeIndex.cjs');
|
|
5
|
+
const require__Users_jacksonmorgan_O_ldo_packages_solid_type_index_src_react_useTypeIndexProfile = require('./useTypeIndexProfile.cjs');
|
|
6
|
+
const require__Users_jacksonmorgan_O_ldo_packages_solid_type_index_src_react_util_useSubscribeToUris = require('./util/useSubscribeToUris.cjs');
|
|
7
|
+
const __ldo_solid_react = require_rolldown_runtime.__toESM(require("@ldo/solid-react"));
|
|
8
|
+
const react = require_rolldown_runtime.__toESM(require("react"));
|
|
9
|
+
|
|
10
|
+
//#region src/react/useInstanceUris.ts
|
|
11
|
+
/**
|
|
12
|
+
* Provides the LeafUris of everything in a type node for a specific class uri
|
|
13
|
+
*
|
|
14
|
+
* @param classUri - the class uri
|
|
15
|
+
* @returns - URIs of all resources registered with this node
|
|
16
|
+
*/
|
|
17
|
+
function useInstanceUris(classUri) {
|
|
18
|
+
const { dataset } = (0, __ldo_solid_react.useLdo)();
|
|
19
|
+
const profile = require__Users_jacksonmorgan_O_ldo_packages_solid_type_index_src_react_useTypeIndexProfile.useTypeIndexProfile();
|
|
20
|
+
const typeIndexUris = (0, react.useMemo)(() => profile ? require__Users_jacksonmorgan_O_ldo_packages_solid_type_index_src_getTypeIndex.getTypeIndexesUrisFromProfile(profile) : [], [profile]);
|
|
21
|
+
require__Users_jacksonmorgan_O_ldo_packages_solid_type_index_src_react_util_useSubscribeToUris.useSubscribeToUris(typeIndexUris);
|
|
22
|
+
const [leafUris, setLeafUris] = (0, react.useState)([]);
|
|
23
|
+
const typeRegistrations = (0, __ldo_solid_react.useMatchSubject)(require__Users_jacksonmorgan_O_ldo_packages_solid_type_index_src__ldo_typeIndex_shapeTypes.TypeRegistrationShapeType, require__Users_jacksonmorgan_O_ldo_packages_solid_type_index_src_constants.RDF_TYPE, require__Users_jacksonmorgan_O_ldo_packages_solid_type_index_src_constants.TYPE_REGISTRATION);
|
|
24
|
+
(0, react.useEffect)(() => {
|
|
25
|
+
require__Users_jacksonmorgan_O_ldo_packages_solid_type_index_src_getTypeIndex.getInstanceUris(classUri, typeRegistrations.toArray(), { solidLdoDataset: dataset }).then(setLeafUris);
|
|
26
|
+
}, [typeRegistrations]);
|
|
27
|
+
return leafUris;
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
//#endregion
|
|
31
|
+
exports.useInstanceUris = useInstanceUris;
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { SolidLeafUri } from "@ldo/connected-solid";
|
|
2
|
+
|
|
3
|
+
//#region src/react/useInstanceUris.d.ts
|
|
4
|
+
|
|
5
|
+
/**
|
|
6
|
+
* Provides the LeafUris of everything in a type node for a specific class uri
|
|
7
|
+
*
|
|
8
|
+
* @param classUri - the class uri
|
|
9
|
+
* @returns - URIs of all resources registered with this node
|
|
10
|
+
*/
|
|
11
|
+
declare function useInstanceUris(classUri: string): SolidLeafUri[];
|
|
12
|
+
//# sourceMappingURL=useInstanceUris.d.ts.map
|
|
13
|
+
//#endregion
|
|
14
|
+
export { useInstanceUris };
|
|
15
|
+
//# sourceMappingURL=useInstanceUris.d.cts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useInstanceUris.d.cts","names":[],"sources":["../../../src/react/useInstanceUris.ts"],"sourcesContent":[],"mappings":";;;;;;AAkBA;;;;iBAAgB,eAAA,oBAAmC"}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { SolidLeafUri } from "@ldo/connected-solid";
|
|
2
|
+
|
|
3
|
+
//#region src/react/useInstanceUris.d.ts
|
|
4
|
+
|
|
5
|
+
/**
|
|
6
|
+
* Provides the LeafUris of everything in a type node for a specific class uri
|
|
7
|
+
*
|
|
8
|
+
* @param classUri - the class uri
|
|
9
|
+
* @returns - URIs of all resources registered with this node
|
|
10
|
+
*/
|
|
11
|
+
declare function useInstanceUris(classUri: string): SolidLeafUri[];
|
|
12
|
+
//# sourceMappingURL=useInstanceUris.d.ts.map
|
|
13
|
+
//#endregion
|
|
14
|
+
export { useInstanceUris as useInstanceUris$1 };
|
|
15
|
+
//# sourceMappingURL=useInstanceUris.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useInstanceUris.d.ts","names":[],"sources":["../../../src/react/useInstanceUris.ts"],"sourcesContent":[],"mappings":";;;;;;AAkBA;;;;iBAAgB,eAAA,oBAAmC"}
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import { TypeRegistrationShapeType } from "../.ldo/typeIndex.shapeTypes.js";
|
|
2
|
+
import { RDF_TYPE, TYPE_REGISTRATION } from "../constants.js";
|
|
3
|
+
import { getInstanceUris, getTypeIndexesUrisFromProfile } from "../getTypeIndex.js";
|
|
4
|
+
import { useTypeIndexProfile } from "./useTypeIndexProfile.js";
|
|
5
|
+
import { useSubscribeToUris } from "./util/useSubscribeToUris.js";
|
|
6
|
+
import { useLdo, useMatchSubject } from "@ldo/solid-react";
|
|
7
|
+
import { useEffect, useMemo, useState } from "react";
|
|
8
|
+
|
|
9
|
+
//#region src/react/useInstanceUris.ts
|
|
10
|
+
/**
|
|
11
|
+
* Provides the LeafUris of everything in a type node for a specific class uri
|
|
12
|
+
*
|
|
13
|
+
* @param classUri - the class uri
|
|
14
|
+
* @returns - URIs of all resources registered with this node
|
|
15
|
+
*/
|
|
16
|
+
function useInstanceUris(classUri) {
|
|
17
|
+
const { dataset } = useLdo();
|
|
18
|
+
const profile = useTypeIndexProfile();
|
|
19
|
+
const typeIndexUris = useMemo(() => profile ? getTypeIndexesUrisFromProfile(profile) : [], [profile]);
|
|
20
|
+
useSubscribeToUris(typeIndexUris);
|
|
21
|
+
const [leafUris, setLeafUris] = useState([]);
|
|
22
|
+
const typeRegistrations = useMatchSubject(TypeRegistrationShapeType, RDF_TYPE, TYPE_REGISTRATION);
|
|
23
|
+
useEffect(() => {
|
|
24
|
+
getInstanceUris(classUri, typeRegistrations.toArray(), { solidLdoDataset: dataset }).then(setLeafUris);
|
|
25
|
+
}, [typeRegistrations]);
|
|
26
|
+
return leafUris;
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
//#endregion
|
|
30
|
+
export { useInstanceUris };
|
|
31
|
+
//# sourceMappingURL=useInstanceUris.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useInstanceUris.js","names":["classUri: string","typeIndexUris: string[]"],"sources":["../../src/react/useInstanceUris.ts"],"sourcesContent":["import { useTypeIndexProfile } from \"./useTypeIndexProfile\";\nimport { useEffect, useMemo, useState } from \"react\";\nimport { useSubscribeToUris } from \"./util/useSubscribeToUris\";\nimport { useLdo, useMatchSubject } from \"@ldo/solid-react\";\nimport { TypeRegistrationShapeType } from \"../.ldo/typeIndex.shapeTypes\";\nimport { RDF_TYPE, TYPE_REGISTRATION } from \"../constants\";\nimport {\n getInstanceUris,\n getTypeIndexesUrisFromProfile,\n} from \"../getTypeIndex\";\nimport type { SolidLeafUri } from \"@ldo/connected-solid\";\n\n/**\n * Provides the LeafUris of everything in a type node for a specific class uri\n *\n * @param classUri - the class uri\n * @returns - URIs of all resources registered with this node\n */\nexport function useInstanceUris(classUri: string): SolidLeafUri[] {\n const { dataset } = useLdo();\n const profile = useTypeIndexProfile();\n\n const typeIndexUris: string[] = useMemo(\n () => (profile ? getTypeIndexesUrisFromProfile(profile) : []),\n [profile],\n );\n\n useSubscribeToUris(typeIndexUris);\n\n const [leafUris, setLeafUris] = useState<SolidLeafUri[]>([]);\n\n const typeRegistrations = useMatchSubject(\n TypeRegistrationShapeType,\n RDF_TYPE,\n TYPE_REGISTRATION,\n );\n\n useEffect(() => {\n getInstanceUris(classUri, typeRegistrations.toArray(), {\n // eslint-disable-next-line @typescript-eslint/ban-ts-comment\n // @ts-ignore TODO: come back and see if we can fix this\n solidLdoDataset: dataset,\n }).then(setLeafUris);\n }, [typeRegistrations]);\n\n return leafUris;\n}\n"],"mappings":";;;;;;;;;;;;;;;AAkBA,SAAgB,gBAAgBA,UAAkC;CAChE,MAAM,EAAE,SAAS,GAAG,QAAQ;CAC5B,MAAM,UAAU,qBAAqB;CAErC,MAAMC,gBAA0B,QAC9B,MAAO,UAAU,8BAA8B,QAAQ,GAAG,CAAE,GAC5D,CAAC,OAAQ,EACV;AAED,oBAAmB,cAAc;CAEjC,MAAM,CAAC,UAAU,YAAY,GAAG,SAAyB,CAAE,EAAC;CAE5D,MAAM,oBAAoB,gBACxB,2BACA,UACA,kBACD;AAED,WAAU,MAAM;AACd,kBAAgB,UAAU,kBAAkB,SAAS,EAAE,EAGrD,iBAAiB,QAClB,EAAC,CAAC,KAAK,YAAY;CACrB,GAAE,CAAC,iBAAkB,EAAC;AAEvB,QAAO;AACR"}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
const require_rolldown_runtime = require('../_virtual/rolldown_runtime.cjs');
|
|
2
|
+
const require__Users_jacksonmorgan_O_ldo_packages_solid_type_index_src__ldo_profile_shapeTypes = require('../.ldo/profile.shapeTypes.cjs');
|
|
3
|
+
const __ldo_solid_react = require_rolldown_runtime.__toESM(require("@ldo/solid-react"));
|
|
4
|
+
|
|
5
|
+
//#region src/react/useTypeIndexProfile.ts
|
|
6
|
+
function useTypeIndexProfile() {
|
|
7
|
+
const { session } = (0, __ldo_solid_react.useSolidAuth)();
|
|
8
|
+
(0, __ldo_solid_react.useResource)(session.webId, { subscribe: true });
|
|
9
|
+
const profile = (0, __ldo_solid_react.useSubject)(require__Users_jacksonmorgan_O_ldo_packages_solid_type_index_src__ldo_profile_shapeTypes.TypeIndexProfileShapeType, session.webId);
|
|
10
|
+
return profile;
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
//#endregion
|
|
14
|
+
exports.useTypeIndexProfile = useTypeIndexProfile;
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { TypeIndexProfile } from "../.ldo/profile.typings.cjs";
|
|
2
|
+
|
|
3
|
+
//#region src/react/useTypeIndexProfile.d.ts
|
|
4
|
+
declare function useTypeIndexProfile(): TypeIndexProfile | undefined;
|
|
5
|
+
//# sourceMappingURL=useTypeIndexProfile.d.ts.map
|
|
6
|
+
|
|
7
|
+
//#endregion
|
|
8
|
+
export { useTypeIndexProfile };
|
|
9
|
+
//# sourceMappingURL=useTypeIndexProfile.d.cts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useTypeIndexProfile.d.cts","names":[],"sources":["../../../src/react/useTypeIndexProfile.ts"],"sourcesContent":[],"mappings":";;;iBAIgB,mBAAA,CAAA,GAAuB"}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { TypeIndexProfile } from "../.ldo/profile.typings.js";
|
|
2
|
+
|
|
3
|
+
//#region src/react/useTypeIndexProfile.d.ts
|
|
4
|
+
declare function useTypeIndexProfile(): TypeIndexProfile | undefined;
|
|
5
|
+
//# sourceMappingURL=useTypeIndexProfile.d.ts.map
|
|
6
|
+
|
|
7
|
+
//#endregion
|
|
8
|
+
export { useTypeIndexProfile as useTypeIndexProfile$1 };
|
|
9
|
+
//# sourceMappingURL=useTypeIndexProfile.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useTypeIndexProfile.d.ts","names":[],"sources":["../../../src/react/useTypeIndexProfile.ts"],"sourcesContent":[],"mappings":";;;iBAIgB,mBAAA,CAAA,GAAuB"}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { TypeIndexProfileShapeType } from "../.ldo/profile.shapeTypes.js";
|
|
2
|
+
import { useResource, useSolidAuth, useSubject } from "@ldo/solid-react";
|
|
3
|
+
|
|
4
|
+
//#region src/react/useTypeIndexProfile.ts
|
|
5
|
+
function useTypeIndexProfile() {
|
|
6
|
+
const { session } = useSolidAuth();
|
|
7
|
+
useResource(session.webId, { subscribe: true });
|
|
8
|
+
const profile = useSubject(TypeIndexProfileShapeType, session.webId);
|
|
9
|
+
return profile;
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
//#endregion
|
|
13
|
+
export { useTypeIndexProfile };
|
|
14
|
+
//# sourceMappingURL=useTypeIndexProfile.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useTypeIndexProfile.js","names":[],"sources":["../../src/react/useTypeIndexProfile.ts"],"sourcesContent":["import { useResource, useSolidAuth, useSubject } from \"@ldo/solid-react\";\nimport type { TypeIndexProfile } from \"../.ldo/profile.typings\";\nimport { TypeIndexProfileShapeType } from \"../.ldo/profile.shapeTypes\";\n\nexport function useTypeIndexProfile(): TypeIndexProfile | undefined {\n const { session } = useSolidAuth();\n useResource(session.webId, { subscribe: true });\n const profile = useSubject(TypeIndexProfileShapeType, session.webId);\n return profile;\n}\n"],"mappings":";;;;AAIA,SAAgB,sBAAoD;CAClE,MAAM,EAAE,SAAS,GAAG,cAAc;AAClC,aAAY,QAAQ,OAAO,EAAE,WAAW,KAAM,EAAC;CAC/C,MAAM,UAAU,WAAW,2BAA2B,QAAQ,MAAM;AACpE,QAAO;AACR"}
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
const require_rolldown_runtime = require('../../_virtual/rolldown_runtime.cjs');
|
|
2
|
+
const __ldo_solid_react = require_rolldown_runtime.__toESM(require("@ldo/solid-react"));
|
|
3
|
+
const react = require_rolldown_runtime.__toESM(require("react"));
|
|
4
|
+
|
|
5
|
+
//#region src/react/util/useSubscribeToUris.ts
|
|
6
|
+
function useSubscribeToUris(uris) {
|
|
7
|
+
const { dataset } = (0, __ldo_solid_react.useLdo)();
|
|
8
|
+
const currentlySubscribed = (0, react.useRef)({});
|
|
9
|
+
(0, react.useEffect)(() => {
|
|
10
|
+
const resources = uris.map((uri) => dataset.getResource(uri));
|
|
11
|
+
const previousSubscriptions = { ...currentlySubscribed.current };
|
|
12
|
+
Promise.all(resources.map(async (resource) => {
|
|
13
|
+
if (!previousSubscriptions[resource.uri]) {
|
|
14
|
+
await resource.readIfUnfetched();
|
|
15
|
+
currentlySubscribed.current[resource.uri] = await resource.subscribeToNotifications();
|
|
16
|
+
} else delete previousSubscriptions[resource.uri];
|
|
17
|
+
})).then(async () => {
|
|
18
|
+
await Promise.all(Object.entries(previousSubscriptions).map(async ([resourceUri, subscriptionId]) => {
|
|
19
|
+
delete currentlySubscribed.current[resourceUri];
|
|
20
|
+
const resource = dataset.getResource(resourceUri);
|
|
21
|
+
await resource.unsubscribeFromNotifications(subscriptionId);
|
|
22
|
+
}));
|
|
23
|
+
});
|
|
24
|
+
}, [uris]);
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
//#endregion
|
|
28
|
+
exports.useSubscribeToUris = useSubscribeToUris;
|