@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
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { ShapeType } from "@ldo/ldo";
|
|
1
|
+
import type { ShapeType } from "@ldo/ldo";
|
|
2
2
|
import { profileSchema } from "./profile.schema";
|
|
3
3
|
import { profileContext } from "./profile.context";
|
|
4
|
-
import { TypeIndexProfile } from "./profile.typings";
|
|
4
|
+
import type { TypeIndexProfile } from "./profile.typings";
|
|
5
5
|
|
|
6
6
|
/**
|
|
7
7
|
* =============================================================================
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { ShapeType } from "@ldo/ldo";
|
|
1
|
+
import type { ShapeType } from "@ldo/ldo";
|
|
2
2
|
import { typeIndexSchema } from "./typeIndex.schema";
|
|
3
3
|
import { typeIndexContext } from "./typeIndex.context";
|
|
4
|
-
import { TypeIndexDocument, TypeRegistration } from "./typeIndex.typings";
|
|
4
|
+
import type { TypeIndexDocument, TypeRegistration } from "./typeIndex.typings";
|
|
5
5
|
|
|
6
6
|
/**
|
|
7
7
|
* =============================================================================
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"profile.context.js","names":["profileContext: LdoJsonldContext"],"sources":["../../src/_ldo/profile.context.ts"],"sourcesContent":["import { 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,MAAaA,iBAAmC;CAC9C,kBAAkB;EAChB,OAAO;EACP,SAAS;EACT,iBAAiB;CAClB;CACD,iBAAiB;EACf,OAAO;EACP,SAAS;EACT,iBAAiB;CAClB;AACF"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"profile.schema.js","names":["profileSchema: Schema"],"sources":["../../src/_ldo/profile.schema.ts"],"sourcesContent":["import { 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,MAAaA,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;KACX;KACD,KAAK;KACL,KAAK;KACL,aAAa,CACX;MACE,MAAM;MACN,WAAW;MACX,QAAQ,EACN,OACE,2EACH;KACF,CACF;IACF,GACD;KACE,MAAM;KACN,WAAW;KACX,WAAW;MACT,MAAM;MACN,UAAU;KACX;KACD,KAAK;KACL,KAAK;KACL,aAAa,CACX;MACE,MAAM;MACN,WAAW;MACX,QAAQ,EACN,OACE,qEACH;KACF,CACF;IACF,CACF;GACF;EACF;CACF,CACF;AACF"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"profile.shapeTypes.js","names":["TypeIndexProfileShapeType: ShapeType<TypeIndexProfile>"],"sources":["../../src/_ldo/profile.shapeTypes.ts"],"sourcesContent":["import { ShapeType } from \"@ldo/ldo\";\nimport { profileSchema } from \"./profile.schema\";\nimport { profileContext } from \"./profile.context\";\nimport { 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,MAAaA,4BAAyD;CACpE,QAAQ;CACR,OAAO;CACP,SAAS;AACV"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"profile.typings.d.ts","names":[],"sources":["../../../src/_ldo/profile.typings.ts"],"sourcesContent":[],"mappings":";;;;;;AAWA;;;;;AAYyB;UAZR,gBAAA;;eAEF;;;;qBAIM;;;;;;oBAMD"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"typeIndex.context.js","names":["typeIndexContext: LdoJsonldContext"],"sources":["../../src/_ldo/typeIndex.context.ts"],"sourcesContent":["import { 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,MAAaA,mBAAqC;CAChD,MAAM,EACJ,OAAO,QACR;CACD,WAAW;EACT,OAAO;EACP,YAAY,EACV,MAAM,EACJ,OAAO,QACR,EACF;CACF;CACD,gBAAgB;EACd,OAAO;EACP,YAAY,EACV,MAAM,EACJ,OAAO,QACR,EACF;CACF;CACD,kBAAkB;EAChB,OAAO;EACP,YAAY;GACV,MAAM,EACJ,OAAO,QACR;GACD,UAAU;IACR,OAAO;IACP,SAAS;GACV;GACD,UAAU;IACR,OAAO;IACP,SAAS;IACT,iBAAiB;GAClB;GACD,mBAAmB;IACjB,OAAO;IACP,SAAS;IACT,iBAAiB;GAClB;EACF;CACF;CACD,UAAU;EACR,OAAO;EACP,SAAS;CACV;CACD,UAAU;EACR,OAAO;EACP,SAAS;EACT,iBAAiB;CAClB;CACD,mBAAmB;EACjB,OAAO;EACP,SAAS;EACT,iBAAiB;CAClB;AACF"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"typeIndex.schema.js","names":["typeIndexSchema: Schema"],"sources":["../../src/_ldo/typeIndex.schema.ts"],"sourcesContent":["import { 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,MAAaA,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,4CAA6C;KACvD;KACD,aAAa,CACX;MACE,MAAM;MACN,WAAW;MACX,QAAQ,EACN,OAAO,kCACR;KACF,CACF;IACF,GACD;KACE,MAAM;KACN,WAAW;KACX,WAAW;MACT,MAAM;MACN,QAAQ,CAAC,iDAAkD;KAC5D;KACD,aAAa,CACX;MACE,MAAM;MACN,WAAW;MACX,QAAQ,EACN,OAAO,wCACR;KACF,CACF;IACF,CACF;GACF;GACD,OAAO,CAAC,iDAAkD;EAC3D;CACF,GACD;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,mDAAoD;MAC9D;MACD,aAAa,CACX;OACE,MAAM;OACN,WAAW;OACX,QAAQ,EACN,OAAO,2CACR;MACF,CACF;KACF;KACD;MACE,MAAM;MACN,WAAW;MACX,WAAW;OACT,MAAM;OACN,UAAU;MACX;MACD,aAAa,CACX;OACE,MAAM;OACN,WAAW;OACX,QAAQ,EACN,OAAO,oCACR;MACF,CACF;KACF;KACD;MACE,MAAM;MACN,WAAW;MACX,WAAW;OACT,MAAM;OACN,UAAU;MACX;MACD,KAAK;MACL,KAAK;MACL,aAAa,CACX;OACE,MAAM;OACN,WAAW;OACX,QAAQ,EACN,OAAO,+CACR;MACF,CACF;KACF;KACD;MACE,MAAM;MACN,WAAW;MACX,WAAW;OACT,MAAM;OACN,UAAU;MACX;MACD,KAAK;MACL,KAAK;MACL,aAAa,CACX;OACE,MAAM;OACN,WAAW;OACX,QAAQ,EACN,OAAO,oDACR;MACF,CACF;KACF;IACF;GACF;GACD,OAAO,CAAC,iDAAkD;EAC3D;CACF,CACF;AACF"}
|
|
@@ -1 +0,0 @@
|
|
|
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"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"typeIndex.typings.d.ts","names":[],"sources":["../../../src/_ldo/typeIndex.typings.ts"],"sourcesContent":[],"mappings":";;;;;;;UA8BiB,gBAAA;;eAEF;;;;;;;;;;;;;;;;aAgBF;;;;;;sBAMS"}
|
|
@@ -1,30 +0,0 @@
|
|
|
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
|
-
});
|
package/dist/constants.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
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"}
|
|
@@ -1 +0,0 @@
|
|
|
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"}
|
package/dist/getTypeIndex.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
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.d.ts
DELETED
|
@@ -1,5 +0,0 @@
|
|
|
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 };
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"useInstanceUris.d.ts","names":[],"sources":["../../../src/react/useInstanceUris.ts"],"sourcesContent":[],"mappings":";;;;;;AAkBA;;;;iBAAgB,eAAA,oBAAmC"}
|
|
@@ -1 +0,0 @@
|
|
|
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"}
|
|
@@ -1,9 +0,0 @@
|
|
|
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
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"useTypeIndexProfile.d.ts","names":[],"sources":["../../../src/react/useTypeIndexProfile.ts"],"sourcesContent":[],"mappings":";;;iBAIgB,mBAAA,CAAA,GAAuB"}
|
|
@@ -1 +0,0 @@
|
|
|
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"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"useSubscribeToUris.js","names":["uris: string[]"],"sources":["../../../src/react/util/useSubscribeToUris.ts"],"sourcesContent":["import { useLdo } from \"@ldo/solid-react\";\nimport { useEffect, useRef } from \"react\";\n\nexport function useSubscribeToUris(uris: string[]) {\n const { dataset } = useLdo();\n const currentlySubscribed = useRef<Record<string, string>>({});\n useEffect(() => {\n const resources = uris.map((uri) => dataset.getResource(uri));\n const previousSubscriptions = { ...currentlySubscribed.current };\n Promise.all<void>(\n resources.map(async (resource) => {\n if (!previousSubscriptions[resource.uri]) {\n // Read and subscribe\n await resource.readIfUnfetched();\n currentlySubscribed.current[resource.uri] =\n await resource.subscribeToNotifications();\n } else {\n delete previousSubscriptions[resource.uri];\n }\n }),\n ).then(async () => {\n // Unsubscribe from all remaining previous subscriptions\n await Promise.all(\n Object.entries(previousSubscriptions).map(\n async ([resourceUri, subscriptionId]) => {\n // Unsubscribe\n delete currentlySubscribed.current[resourceUri];\n const resource = dataset.getResource(resourceUri);\n await resource.unsubscribeFromNotifications(subscriptionId);\n },\n ),\n );\n });\n }, [uris]);\n}\n"],"mappings":";;;;AAGA,SAAgB,mBAAmBA,MAAgB;CACjD,MAAM,EAAE,SAAS,GAAG,QAAQ;CAC5B,MAAM,sBAAsB,OAA+B,CAAE,EAAC;AAC9D,WAAU,MAAM;EACd,MAAM,YAAY,KAAK,IAAI,CAAC,QAAQ,QAAQ,YAAY,IAAI,CAAC;EAC7D,MAAM,wBAAwB,EAAE,GAAG,oBAAoB,QAAS;AAChE,UAAQ,IACN,UAAU,IAAI,OAAO,aAAa;AAChC,QAAK,sBAAsB,SAAS,MAAM;AAExC,UAAM,SAAS,iBAAiB;AAChC,wBAAoB,QAAQ,SAAS,OACnC,MAAM,SAAS,0BAA0B;GAC5C,MACC,QAAO,sBAAsB,SAAS;EAEzC,EAAC,CACH,CAAC,KAAK,YAAY;AAEjB,SAAM,QAAQ,IACZ,OAAO,QAAQ,sBAAsB,CAAC,IACpC,OAAO,CAAC,aAAa,eAAe,KAAK;AAEvC,WAAO,oBAAoB,QAAQ;IACnC,MAAM,WAAW,QAAQ,YAAY,YAAY;AACjD,UAAM,SAAS,6BAA6B,eAAe;GAC5D,EACF,CACF;EACF,EAAC;CACH,GAAE,CAAC,IAAK,EAAC;AACX"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"setTypeIndex.d.ts","names":[],"sources":["../../src/setTypeIndex.ts"],"sourcesContent":[],"mappings":";;;;;;;;;AA2BA;;;AAGG,iBAHmB,aAAA,CAGnB,KAAA,EAAA,MAAA,EAAA,OAAA,CAAA,EADS,OACT,CAAA,EAAA,OAAA,CAAA,IAAA,CAAA;AAAO;AAyBV;;;;;AAGW,iBAHW,WAAA,CAGX,KAAA,EAAA,GAAA,EAAA,aAAA,EADM,cACN,EAAA,OAAA,EAAA,mBAAA,CAAA,CACN,oBADM,GACiB,eADjB,CAAA,GAAA,EAAA,GAAA,EAAA,GAAA,EAAA,GAAA,CAAA,CAAA,EAAA,CAAA,EAAA,SAAA,EAAA,OAAA,CAAA,EAGS,OAHT,CAAA,IAAA,CAAA;;AAGS;AA4CnB;AAmBD;;UAZU,SAAA,CAeG;EAAS,QACV,CAAA,EAAA,MAAA,EAAA;EAAO,iBAAA,CAAA,EAAA,MAAA,EAAA;AAyBnB;;;;;AAImB;AA0BnB;;AAGY,iBA9DI,eAAA,CA8DJ,QAAA,EAAA,MAAA,EAAA,QAAA,EAAA,MAAA,EAAA,SAAA,EA3DC,SA2DD,EAAA,OAAA,CAAA,EA1DA,OA0DA,CAAA,EAAA,IAAA;;AACO;;;;;;iBAlCG,kBAAA,gDAGT,qBACD,UAAO;;;;;;;;;iBA0BH,+BAAA,+CAGJ,UACT"}
|
package/dist/setTypeIndex.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"setTypeIndex.js","names":["webId: string","options?: Options","profileFolder: SolidContainer","dataset: ConnectedLdoDataset<\n (SolidConnectedPlugin | ConnectedPlugin<any, any, any, any>)[]\n >","isPrivate: boolean","indexUri: string","classUri: string","instances: Instances","existingRegistrationsUris: NamedNode[]","quad","typeRegistration: TypeRegistration"],"sources":["../src/setTypeIndex.ts"],"sourcesContent":["/* eslint-disable @typescript-eslint/no-explicit-any */\nimport { v4 } from \"uuid\";\nimport { FOR_CLASS, RDF_TYPE, TYPE_REGISTRATION } from \"./constants\";\nimport { guaranteeOptions, type Options } from \"./util/Options\";\nimport { namedNode, quad } from \"@ldo/rdf-utils\";\nimport type { TypeRegistration } from \"./_ldo/typeIndex.typings\";\nimport { getProfile } from \"./getTypeIndex\";\nimport { TypeIndexProfileShapeType } from \"./_ldo/profile.shapeTypes\";\nimport type { NamedNode } from \"@rdfjs/types\";\nimport { set } from \"@ldo/ldo\";\nimport type {\n SolidConnectedPlugin,\n SolidContainer,\n SolidContainerUri,\n SolidLeafUri,\n} from \"@ldo/connected-solid\";\nimport type { ConnectedLdoDataset, ConnectedPlugin } from \"@ldo/connected\";\nimport {\n TypeIndexDocumentShapeType,\n TypeRegistrationShapeType,\n} from \"./_ldo/typeIndex.shapeTypes\";\n\n/**\n * =============================================================================\n * INITIALIZERS\n * =============================================================================\n */\nexport async function initTypeIndex(\n webId: string,\n options?: Options,\n): Promise<void> {\n const { dataset } = guaranteeOptions(options);\n const profile = await getProfile(webId, options);\n if (!profile.privateTypeIndex?.size || !profile.publicTypeIndex?.size) {\n const profileFolder = await dataset\n .getResource(webId as SolidLeafUri | SolidContainerUri)\n .getParentContainer();\n if (profileFolder?.isError) throw profileFolder;\n if (!profileFolder)\n throw new Error(\"No folder to save the type indexes to.\");\n if (!profile.privateTypeIndex?.size) {\n await createIndex(webId, profileFolder, dataset, true);\n }\n if (!profile.publicTypeIndex?.size) {\n await createIndex(webId, profileFolder, dataset, false);\n }\n }\n}\n\n/**\n * @internal\n * @param webId\n * @param profileFolder\n * @param dataset\n */\nexport async function createIndex(\n webId,\n profileFolder: SolidContainer,\n dataset: ConnectedLdoDataset<\n (SolidConnectedPlugin | ConnectedPlugin<any, any, any, any>)[]\n >,\n isPrivate: boolean,\n) {\n // Create a private type index\n const createResult = await profileFolder.createChildAndOverwrite(\n `${isPrivate ? \"private\" : \"public\"}_index_${v4()}`,\n );\n if (createResult.isError) throw createResult;\n const indexResource = createResult.resource;\n const wacResult = await indexResource.setWac({\n agent: {\n [webId]: { read: true, write: true, append: true, control: true },\n },\n public: {\n read: isPrivate ? false : true,\n write: true,\n append: true,\n control: true,\n },\n authenticated: {\n read: isPrivate ? false : true,\n write: true,\n append: true,\n control: true,\n },\n });\n if (wacResult.isError) throw wacResult;\n const transaction = dataset.startTransaction();\n const cProfile = transaction\n .usingType(TypeIndexProfileShapeType)\n .write(dataset.getResource(webId).uri)\n .fromSubject(webId);\n if (isPrivate) {\n cProfile.privateTypeIndex?.add({ \"@id\": indexResource.uri });\n } else {\n cProfile.publicTypeIndex?.add({ \"@id\": indexResource.uri });\n }\n const cTypeIndex = transaction\n .usingType(TypeIndexDocumentShapeType)\n .write(indexResource.uri)\n .fromSubject(indexResource.uri);\n\n cTypeIndex.type = set({ \"@id\": \"ListedDocument\" }, { \"@id\": \"TypeIndex\" });\n const commitResult = await transaction.commitToRemote();\n if (commitResult.isError) throw commitResult;\n}\n\n/**\n * =============================================================================\n * DATASET MODIFIERS\n * =============================================================================\n */\ninterface Instances {\n instance?: string[];\n instanceContainer?: string[];\n}\n\n/**\n * Adds an instance to a TypeRegistration\n * @param indexUri The URI of the TypeIndex\n * @param classUri The URI for the class the instance should be added to\n * @param instances Objects representing the instances to add\n * @param options Options\n */\nexport function addRegistration(\n indexUri: string,\n classUri: string,\n instances: Instances,\n options?: Options,\n): void {\n // Check to see if its already in the index\n const typeRegistration = findAppropriateTypeRegistration(\n indexUri,\n classUri,\n options,\n );\n\n // Add instances to type registration\n instances.instance?.forEach((instance) => {\n typeRegistration.instance?.add({ \"@id\": instance });\n });\n instances.instanceContainer?.forEach((instanceContainer) => {\n typeRegistration.instanceContainer?.add({ \"@id\": instanceContainer });\n });\n}\n\n/**\n * Removes instances from a TypeRegistration\n * @param indexUri The URI of the TypeIndex\n * @param classUri The URI for the class the instance should be removed from\n * @param instances Objects representing the instances to remove\n * @param options Options\n */\nexport async function removeRegistration(\n indexUri: string,\n classUri: string,\n instances: Instances,\n options?: Options,\n) {\n // Check to see if its already in the index\n const typeRegistration = findAppropriateTypeRegistration(\n indexUri,\n classUri,\n options,\n );\n\n // Add instances to type registration\n instances.instance?.forEach((instanceUri) => {\n typeRegistration.instance?.delete({ \"@id\": instanceUri });\n });\n instances.instanceContainer?.forEach((instanceContainerUri) => {\n typeRegistration.instanceContainer?.delete({ \"@id\": instanceContainerUri });\n });\n}\n\n/**\n * Finds a TypeRegistration inside of a type index. If it doesn't exist, it\n * creates one.\n * @param indexUri The URI of the typeIndex\n * @param classUri The URI of the class in question for the TypeRegistration\n * @param options\n * @returns The Type Index\n */\nexport function findAppropriateTypeRegistration(\n indexUri: string,\n classUri: string,\n options?: Options,\n): TypeRegistration {\n const { dataset } = guaranteeOptions(options);\n // Check to see if its already in the index\n const existingRegistrationsUris: NamedNode[] = dataset\n .match(\n null,\n namedNode(RDF_TYPE),\n namedNode(TYPE_REGISTRATION),\n namedNode(indexUri),\n )\n .toArray()\n .map((quad) => quad.subject) as NamedNode[];\n\n const existingRegistrationForClassUri = existingRegistrationsUris.find(\n (registrationUri) => {\n return dataset.has(\n quad(\n registrationUri,\n namedNode(FOR_CLASS),\n namedNode(classUri),\n namedNode(indexUri),\n ),\n );\n },\n )?.value;\n\n let typeRegistration: TypeRegistration;\n if (existingRegistrationForClassUri) {\n typeRegistration = dataset\n .usingType(TypeRegistrationShapeType)\n .write(indexUri)\n .fromSubject(existingRegistrationForClassUri);\n } else {\n typeRegistration = dataset\n .usingType(TypeRegistrationShapeType)\n .write(indexUri)\n .fromSubject(`${indexUri}#${v4()}`);\n typeRegistration.type = { \"@id\": \"TypeRegistration\" };\n typeRegistration.forClass = { \"@id\": classUri };\n }\n return typeRegistration;\n}\n"],"mappings":"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"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"Options.d.ts","names":[],"sources":["../../../src/util/Options.ts"],"sourcesContent":[],"mappings":";;;;UAKiB,OAAA;oBACG,qBAAqB;EADxB,KAAA,CAAA,EAAA,OAEA,KAFO"}
|
package/dist/util/Options.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"Options.js","names":["options?: Options"],"sources":["../../src/util/Options.ts"],"sourcesContent":["/* eslint-disable @typescript-eslint/no-explicit-any */\nimport type { ConnectedLdoDataset, IConnectedLdoDataset } from \"@ldo/connected\";\nimport type { SolidConnectedPlugin } from \"@ldo/connected-solid\";\nimport { createSolidLdoDataset, guaranteeFetch } from \"@ldo/connected-solid\";\n\nexport interface Options {\n solidLdoDataset?: IConnectedLdoDataset<SolidConnectedPlugin[]>;\n fetch?: typeof fetch;\n}\n\nexport function guaranteeOptions(options?: Options) {\n const fetch = guaranteeFetch(options?.fetch);\n const dataset = (options?.solidLdoDataset ??\n createSolidLdoDataset()) as ConnectedLdoDataset<SolidConnectedPlugin[]>;\n dataset.setContext(\"solid\", { fetch });\n return { fetch, dataset };\n}\n"],"mappings":";;;AAUA,SAAgB,iBAAiBA,SAAmB;CAClD,MAAM,QAAQ,eAAe,SAAS,MAAM;CAC5C,MAAM,UAAW,SAAS,mBACxB,uBAAuB;AACzB,SAAQ,WAAW,SAAS,EAAE,MAAO,EAAC;AACtC,QAAO;EAAE;EAAO;CAAS;AAC1B"}
|