@ldo/solid-type-index 1.0.0-alpha.2 → 1.0.0-alpha.20

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.
Files changed (136) hide show
  1. package/dist/{.ldo → cjs/.ldo}/profile.context.js +5 -0
  2. package/dist/cjs/.ldo/profile.context.js.map +1 -0
  3. package/dist/{.ldo → cjs/.ldo}/profile.schema.js +5 -0
  4. package/dist/cjs/.ldo/profile.schema.js.map +1 -0
  5. package/dist/cjs/.ldo/profile.shapeTypes.js +19 -0
  6. package/dist/cjs/.ldo/profile.shapeTypes.js.map +1 -0
  7. package/dist/cjs/.ldo/profile.typings.js.map +1 -0
  8. package/dist/{.ldo → cjs/.ldo}/typeIndex.context.js +5 -0
  9. package/dist/cjs/.ldo/typeIndex.context.js.map +1 -0
  10. package/dist/{.ldo → cjs/.ldo}/typeIndex.schema.js +5 -0
  11. package/dist/cjs/.ldo/typeIndex.schema.js.map +1 -0
  12. package/dist/cjs/.ldo/typeIndex.shapeTypes.js +27 -0
  13. package/dist/cjs/.ldo/typeIndex.shapeTypes.js.map +1 -0
  14. package/dist/cjs/.ldo/typeIndex.typings.js.map +1 -0
  15. package/dist/cjs/constants.js.map +1 -0
  16. package/dist/{getTypeIndex.js → cjs/getTypeIndex.js} +20 -15
  17. package/dist/cjs/getTypeIndex.js.map +1 -0
  18. package/dist/{index.js → cjs/index.js} +4 -4
  19. package/dist/cjs/index.js.map +1 -0
  20. package/dist/cjs/react/useInstanceUris.js +33 -0
  21. package/dist/cjs/react/useInstanceUris.js.map +1 -0
  22. package/dist/{react → cjs/react}/useTypeIndexProfile.js +3 -4
  23. package/dist/cjs/react/useTypeIndexProfile.js.map +1 -0
  24. package/dist/{react → cjs/react}/util/useSubscribeToUris.js +4 -2
  25. package/dist/cjs/react/util/useSubscribeToUris.js.map +1 -0
  26. package/dist/cjs/setTypeIndex.js +197 -0
  27. package/dist/cjs/setTypeIndex.js.map +1 -0
  28. package/dist/{util → cjs/util}/Options.js +1 -2
  29. package/dist/cjs/util/Options.js.map +1 -0
  30. package/dist/esm/.ldo/profile.context.js +18 -0
  31. package/dist/esm/.ldo/profile.context.js.map +1 -0
  32. package/dist/esm/.ldo/profile.schema.js +61 -0
  33. package/dist/esm/.ldo/profile.schema.js.map +1 -0
  34. package/dist/esm/.ldo/profile.shapeTypes.js +16 -0
  35. package/dist/esm/.ldo/profile.shapeTypes.js.map +1 -0
  36. package/dist/esm/.ldo/profile.typings.js +2 -0
  37. package/dist/esm/.ldo/profile.typings.js.map +1 -0
  38. package/dist/esm/.ldo/typeIndex.context.js +63 -0
  39. package/dist/esm/.ldo/typeIndex.context.js.map +1 -0
  40. package/dist/esm/.ldo/typeIndex.schema.js +143 -0
  41. package/dist/esm/.ldo/typeIndex.schema.js.map +1 -0
  42. package/dist/esm/.ldo/typeIndex.shapeTypes.js +24 -0
  43. package/dist/esm/.ldo/typeIndex.shapeTypes.js.map +1 -0
  44. package/dist/esm/.ldo/typeIndex.typings.js +2 -0
  45. package/dist/esm/.ldo/typeIndex.typings.js.map +1 -0
  46. package/dist/esm/constants.js +6 -0
  47. package/dist/esm/constants.js.map +1 -0
  48. package/dist/esm/getTypeIndex.js +61 -0
  49. package/dist/esm/getTypeIndex.js.map +1 -0
  50. package/dist/esm/index.js +5 -0
  51. package/dist/esm/index.js.map +1 -0
  52. package/dist/esm/react/useInstanceUris.js +30 -0
  53. package/dist/esm/react/useInstanceUris.js.map +1 -0
  54. package/dist/esm/react/useTypeIndexProfile.js +9 -0
  55. package/dist/esm/react/useTypeIndexProfile.js.map +1 -0
  56. package/dist/esm/react/util/useSubscribeToUris.js +30 -0
  57. package/dist/esm/react/util/useSubscribeToUris.js.map +1 -0
  58. package/dist/{setTypeIndex.js → esm/setTypeIndex.js} +66 -33
  59. package/dist/esm/setTypeIndex.js.map +1 -0
  60. package/dist/esm/util/Options.js +9 -0
  61. package/dist/esm/util/Options.js.map +1 -0
  62. package/dist/types/.ldo/profile.context.d.ts +8 -0
  63. package/dist/types/.ldo/profile.context.d.ts.map +1 -0
  64. package/dist/types/.ldo/profile.schema.d.ts +8 -0
  65. package/dist/types/.ldo/profile.schema.d.ts.map +1 -0
  66. package/dist/types/.ldo/profile.shapeTypes.d.ts +12 -0
  67. package/dist/types/.ldo/profile.shapeTypes.d.ts.map +1 -0
  68. package/dist/types/.ldo/profile.typings.d.ts +26 -0
  69. package/dist/types/.ldo/profile.typings.d.ts.map +1 -0
  70. package/dist/types/.ldo/typeIndex.context.d.ts +8 -0
  71. package/dist/types/.ldo/typeIndex.context.d.ts.map +1 -0
  72. package/dist/types/.ldo/typeIndex.schema.d.ts +8 -0
  73. package/dist/types/.ldo/typeIndex.schema.d.ts.map +1 -0
  74. package/dist/types/.ldo/typeIndex.shapeTypes.d.ts +16 -0
  75. package/dist/types/.ldo/typeIndex.shapeTypes.d.ts.map +1 -0
  76. package/dist/types/.ldo/typeIndex.typings.d.ts +53 -0
  77. package/dist/types/.ldo/typeIndex.typings.d.ts.map +1 -0
  78. package/dist/{constants.d.ts → types/constants.d.ts} +1 -0
  79. package/dist/types/constants.d.ts.map +1 -0
  80. package/dist/{getTypeIndex.d.ts → types/getTypeIndex.d.ts} +4 -3
  81. package/dist/types/getTypeIndex.d.ts.map +1 -0
  82. package/dist/types/index.d.ts +5 -0
  83. package/dist/types/index.d.ts.map +1 -0
  84. package/dist/types/react/useInstanceUris.d.ts +9 -0
  85. package/dist/types/react/useInstanceUris.d.ts.map +1 -0
  86. package/dist/types/react/useTypeIndexProfile.d.ts +3 -0
  87. package/dist/types/react/useTypeIndexProfile.d.ts.map +1 -0
  88. package/dist/{react → types/react}/util/useSubscribeToUris.d.ts +1 -0
  89. package/dist/types/react/util/useSubscribeToUris.d.ts.map +1 -0
  90. package/dist/types/setTypeIndex.d.ts +53 -0
  91. package/dist/types/setTypeIndex.d.ts.map +1 -0
  92. package/dist/{util → types/util}/Options.d.ts +1 -0
  93. package/dist/types/util/Options.d.ts.map +1 -0
  94. package/package.json +27 -18
  95. package/src/.ldo/profile.shapeTypes.ts +3 -3
  96. package/src/.ldo/typeIndex.shapeTypes.ts +3 -3
  97. package/src/getTypeIndex.ts +7 -7
  98. package/src/index.ts +4 -4
  99. package/src/react/useInstanceUris.ts +7 -5
  100. package/src/react/useTypeIndexProfile.ts +2 -2
  101. package/src/setTypeIndex.ts +12 -10
  102. package/src/util/Options.ts +0 -2
  103. package/dist/.ldo/profile.context.d.ts +0 -2
  104. package/dist/.ldo/profile.context.js.map +0 -1
  105. package/dist/.ldo/profile.schema.d.ts +0 -2
  106. package/dist/.ldo/profile.schema.js.map +0 -1
  107. package/dist/.ldo/profile.shapeTypes.d.ts +0 -3
  108. package/dist/.ldo/profile.shapeTypes.js +0 -11
  109. package/dist/.ldo/profile.shapeTypes.js.map +0 -1
  110. package/dist/.ldo/profile.typings.d.ts +0 -11
  111. package/dist/.ldo/profile.typings.js.map +0 -1
  112. package/dist/.ldo/typeIndex.context.d.ts +0 -2
  113. package/dist/.ldo/typeIndex.context.js.map +0 -1
  114. package/dist/.ldo/typeIndex.schema.d.ts +0 -2
  115. package/dist/.ldo/typeIndex.schema.js.map +0 -1
  116. package/dist/.ldo/typeIndex.shapeTypes.d.ts +0 -4
  117. package/dist/.ldo/typeIndex.shapeTypes.js +0 -16
  118. package/dist/.ldo/typeIndex.shapeTypes.js.map +0 -1
  119. package/dist/.ldo/typeIndex.typings.d.ts +0 -26
  120. package/dist/.ldo/typeIndex.typings.js.map +0 -1
  121. package/dist/constants.js.map +0 -1
  122. package/dist/getTypeIndex.js.map +0 -1
  123. package/dist/index.d.ts +0 -4
  124. package/dist/index.js.map +0 -1
  125. package/dist/react/useInstanceUris.d.ts +0 -2
  126. package/dist/react/useInstanceUris.js +0 -26
  127. package/dist/react/useInstanceUris.js.map +0 -1
  128. package/dist/react/useTypeIndexProfile.d.ts +0 -2
  129. package/dist/react/useTypeIndexProfile.js.map +0 -1
  130. package/dist/react/util/useSubscribeToUris.js.map +0 -1
  131. package/dist/setTypeIndex.d.ts +0 -14
  132. package/dist/setTypeIndex.js.map +0 -1
  133. package/dist/util/Options.js.map +0 -1
  134. /package/dist/{.ldo → cjs/.ldo}/profile.typings.js +0 -0
  135. /package/dist/{.ldo → cjs/.ldo}/typeIndex.typings.js +0 -0
  136. /package/dist/{constants.js → cjs/constants.js} +0 -0
@@ -1,6 +1,11 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.profileContext = void 0;
4
+ /**
5
+ * =============================================================================
6
+ * profileContext: JSONLD Context for profile
7
+ * =============================================================================
8
+ */
4
9
  exports.profileContext = {
5
10
  privateTypeIndex: {
6
11
  "@id": "http://www.w3.org/ns/solid/terms#privateTypeIndex",
@@ -0,0 +1 @@
1
+ {"version":3,"file":"profile.context.js","sourceRoot":"","sources":["../../../src/.ldo/profile.context.ts"],"names":[],"mappings":";;;AAEA;;;;GAIG;AACU,QAAA,cAAc,GAAqB;IAC9C,gBAAgB,EAAE;QAChB,KAAK,EAAE,mDAAmD;QAC1D,OAAO,EAAE,KAAK;QACd,eAAe,EAAE,IAAI;KACtB;IACD,eAAe,EAAE;QACf,KAAK,EAAE,kDAAkD;QACzD,OAAO,EAAE,KAAK;QACd,eAAe,EAAE,IAAI;KACtB;CACF,CAAC"}
@@ -1,6 +1,11 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.profileSchema = void 0;
4
+ /**
5
+ * =============================================================================
6
+ * profileSchema: ShexJ Schema for profile
7
+ * =============================================================================
8
+ */
4
9
  exports.profileSchema = {
5
10
  type: "Schema",
6
11
  shapes: [
@@ -0,0 +1 @@
1
+ {"version":3,"file":"profile.schema.js","sourceRoot":"","sources":["../../../src/.ldo/profile.schema.ts"],"names":[],"mappings":";;;AAEA;;;;GAIG;AACU,QAAA,aAAa,GAAW;IACnC,IAAI,EAAE,QAAQ;IACd,MAAM,EAAE;QACN;YACE,EAAE,EAAE,6DAA6D;YACjE,IAAI,EAAE,WAAW;YACjB,SAAS,EAAE;gBACT,IAAI,EAAE,OAAO;gBACb,UAAU,EAAE;oBACV,IAAI,EAAE,QAAQ;oBACd,WAAW,EAAE;wBACX;4BACE,IAAI,EAAE,kBAAkB;4BACxB,SAAS,EAAE,mDAAmD;4BAC9D,SAAS,EAAE;gCACT,IAAI,EAAE,gBAAgB;gCACtB,QAAQ,EAAE,KAAK;6BAChB;4BACD,GAAG,EAAE,CAAC;4BACN,GAAG,EAAE,CAAC,CAAC;4BACP,WAAW,EAAE;gCACX;oCACE,IAAI,EAAE,YAAY;oCAClB,SAAS,EAAE,8CAA8C;oCACzD,MAAM,EAAE;wCACN,KAAK,EACH,0EAA0E;qCAC7E;iCACF;6BACF;yBACF;wBACD;4BACE,IAAI,EAAE,kBAAkB;4BACxB,SAAS,EAAE,kDAAkD;4BAC7D,SAAS,EAAE;gCACT,IAAI,EAAE,gBAAgB;gCACtB,QAAQ,EAAE,KAAK;6BAChB;4BACD,GAAG,EAAE,CAAC;4BACN,GAAG,EAAE,CAAC,CAAC;4BACP,WAAW,EAAE;gCACX;oCACE,IAAI,EAAE,YAAY;oCAClB,SAAS,EAAE,8CAA8C;oCACzD,MAAM,EAAE;wCACN,KAAK,EACH,oEAAoE;qCACvE;iCACF;6BACF;yBACF;qBACF;iBACF;aACF;SACF;KACF;CACF,CAAC"}
@@ -0,0 +1,19 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.TypeIndexProfileShapeType = void 0;
4
+ const profile_schema_js_1 = require("./profile.schema.js");
5
+ const profile_context_js_1 = require("./profile.context.js");
6
+ /**
7
+ * =============================================================================
8
+ * LDO ShapeTypes profile
9
+ * =============================================================================
10
+ */
11
+ /**
12
+ * TypeIndexProfile ShapeType
13
+ */
14
+ exports.TypeIndexProfileShapeType = {
15
+ schema: profile_schema_js_1.profileSchema,
16
+ shape: "https://shaperepo.com/schemas/solidProfile#TypeIndexProfile",
17
+ context: profile_context_js_1.profileContext,
18
+ };
19
+ //# sourceMappingURL=profile.shapeTypes.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"profile.shapeTypes.js","sourceRoot":"","sources":["../../../src/.ldo/profile.shapeTypes.ts"],"names":[],"mappings":";;;AACA,2DAAoD;AACpD,6DAAsD;AAGtD;;;;GAIG;AAEH;;GAEG;AACU,QAAA,yBAAyB,GAAgC;IACpE,MAAM,EAAE,iCAAa;IACrB,KAAK,EAAE,6DAA6D;IACpE,OAAO,EAAE,mCAAc;CACxB,CAAC"}
@@ -0,0 +1 @@
1
+ {"version":3,"file":"profile.typings.js","sourceRoot":"","sources":["../../../src/.ldo/profile.typings.ts"],"names":[],"mappings":""}
@@ -1,6 +1,11 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.typeIndexContext = void 0;
4
+ /**
5
+ * =============================================================================
6
+ * typeIndexContext: JSONLD Context for typeIndex
7
+ * =============================================================================
8
+ */
4
9
  exports.typeIndexContext = {
5
10
  type: {
6
11
  "@id": "@type",
@@ -0,0 +1 @@
1
+ {"version":3,"file":"typeIndex.context.js","sourceRoot":"","sources":["../../../src/.ldo/typeIndex.context.ts"],"names":[],"mappings":";;;AAEA;;;;GAIG;AACU,QAAA,gBAAgB,GAAqB;IAChD,IAAI,EAAE;QACJ,KAAK,EAAE,OAAO;KACf;IACD,SAAS,EAAE;QACT,KAAK,EAAE,4CAA4C;QACnD,UAAU,EAAE;YACV,IAAI,EAAE;gBACJ,KAAK,EAAE,OAAO;aACf;SACF;KACF;IACD,cAAc,EAAE;QACd,KAAK,EAAE,iDAAiD;QACxD,UAAU,EAAE;YACV,IAAI,EAAE;gBACJ,KAAK,EAAE,OAAO;aACf;SACF;KACF;IACD,gBAAgB,EAAE;QAChB,KAAK,EAAE,mDAAmD;QAC1D,UAAU,EAAE;YACV,IAAI,EAAE;gBACJ,KAAK,EAAE,OAAO;aACf;YACD,QAAQ,EAAE;gBACR,KAAK,EAAE,2CAA2C;gBAClD,OAAO,EAAE,KAAK;aACf;YACD,QAAQ,EAAE;gBACR,KAAK,EAAE,2CAA2C;gBAClD,OAAO,EAAE,KAAK;gBACd,eAAe,EAAE,IAAI;aACtB;YACD,iBAAiB,EAAE;gBACjB,KAAK,EAAE,oDAAoD;gBAC3D,OAAO,EAAE,KAAK;gBACd,eAAe,EAAE,IAAI;aACtB;SACF;KACF;IACD,QAAQ,EAAE;QACR,KAAK,EAAE,2CAA2C;QAClD,OAAO,EAAE,KAAK;KACf;IACD,QAAQ,EAAE;QACR,KAAK,EAAE,2CAA2C;QAClD,OAAO,EAAE,KAAK;QACd,eAAe,EAAE,IAAI;KACtB;IACD,iBAAiB,EAAE;QACjB,KAAK,EAAE,oDAAoD;QAC3D,OAAO,EAAE,KAAK;QACd,eAAe,EAAE,IAAI;KACtB;CACF,CAAC"}
@@ -1,6 +1,11 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.typeIndexSchema = void 0;
4
+ /**
5
+ * =============================================================================
6
+ * typeIndexSchema: ShexJ Schema for typeIndex
7
+ * =============================================================================
8
+ */
4
9
  exports.typeIndexSchema = {
5
10
  type: "Schema",
6
11
  shapes: [
@@ -0,0 +1 @@
1
+ {"version":3,"file":"typeIndex.schema.js","sourceRoot":"","sources":["../../../src/.ldo/typeIndex.schema.ts"],"names":[],"mappings":";;;AAEA;;;;GAIG;AACU,QAAA,eAAe,GAAW;IACrC,IAAI,EAAE,QAAQ;IACd,MAAM,EAAE;QACN;YACE,EAAE,EAAE,8DAA8D;YAClE,IAAI,EAAE,WAAW;YACjB,SAAS,EAAE;gBACT,IAAI,EAAE,OAAO;gBACb,UAAU,EAAE;oBACV,IAAI,EAAE,QAAQ;oBACd,WAAW,EAAE;wBACX;4BACE,IAAI,EAAE,kBAAkB;4BACxB,SAAS,EAAE,iDAAiD;4BAC5D,SAAS,EAAE;gCACT,IAAI,EAAE,gBAAgB;gCACtB,MAAM,EAAE,CAAC,4CAA4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K,EAAE,mCAAmC;qCAC3C;iCACF;6BACF;yBACF;wBACD;4BACE,IAAI,EAAE,kBAAkB;4BACxB,SAAS,EAAE,2CAA2C;4BACtD,SAAS,EAAE;gCACT,IAAI,EAAE,gBAAgB;gCACtB,QAAQ,EAAE,KAAK;6BAChB;4BACD,GAAG,EAAE,CAAC;4BACN,GAAG,EAAE,CAAC,CAAC;4BACP,WAAW,EAAE;gCACX;oCACE,IAAI,EAAE,YAAY;oCAClB,SAAS,EAAE,8CAA8C;oCACzD,MAAM,EAAE;wCACN,KAAK,EAAE,8CAA8C;qCACtD;iCACF;6BACF;yBACF;wBACD;4BACE,IAAI,EAAE,kBAAkB;4BACxB,SAAS,EAAE,oDAAoD;4BAC/D,SAAS,EAAE;gCACT,IAAI,EAAE,gBAAgB;gCACtB,QAAQ,EAAE,KAAK;6BAChB;4BACD,GAAG,EAAE,CAAC;4BACN,GAAG,EAAE,CAAC,CAAC;4BACP,WAAW,EAAE;gCACX;oCACE,IAAI,EAAE,YAAY;oCAClB,SAAS,EAAE,8CAA8C;oCACzD,MAAM,EAAE;wCACN,KAAK,EAAE,mDAAmD;qCAC3D;iCACF;6BACF;yBACF;qBACF;iBACF;gBACD,KAAK,EAAE,CAAC,iDAAiD,CAAC;aAC3D;SACF;KACF;CACF,CAAC"}
@@ -0,0 +1,27 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.TypeRegistrationShapeType = exports.TypeIndexDocumentShapeType = void 0;
4
+ const typeIndex_schema_js_1 = require("./typeIndex.schema.js");
5
+ const typeIndex_context_js_1 = require("./typeIndex.context.js");
6
+ /**
7
+ * =============================================================================
8
+ * LDO ShapeTypes typeIndex
9
+ * =============================================================================
10
+ */
11
+ /**
12
+ * TypeIndexDocument ShapeType
13
+ */
14
+ exports.TypeIndexDocumentShapeType = {
15
+ schema: typeIndex_schema_js_1.typeIndexSchema,
16
+ shape: "https://shaperepo.com/schemas/solidProfile#TypeIndexDocument",
17
+ context: typeIndex_context_js_1.typeIndexContext,
18
+ };
19
+ /**
20
+ * TypeRegistration ShapeType
21
+ */
22
+ exports.TypeRegistrationShapeType = {
23
+ schema: typeIndex_schema_js_1.typeIndexSchema,
24
+ shape: "https://shaperepo.com/schemas/solidProfile#TypeRegistration",
25
+ context: typeIndex_context_js_1.typeIndexContext,
26
+ };
27
+ //# sourceMappingURL=typeIndex.shapeTypes.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"typeIndex.shapeTypes.js","sourceRoot":"","sources":["../../../src/.ldo/typeIndex.shapeTypes.ts"],"names":[],"mappings":";;;AACA,+DAAwD;AACxD,iEAA0D;AAG1D;;;;GAIG;AAEH;;GAEG;AACU,QAAA,0BAA0B,GAAiC;IACtE,MAAM,EAAE,qCAAe;IACvB,KAAK,EAAE,8DAA8D;IACrE,OAAO,EAAE,uCAAgB;CAC1B,CAAC;AAEF;;GAEG;AACU,QAAA,yBAAyB,GAAgC;IACpE,MAAM,EAAE,qCAAe;IACvB,KAAK,EAAE,6DAA6D;IACpE,OAAO,EAAE,uCAAgB;CAC1B,CAAC"}
@@ -0,0 +1 @@
1
+ {"version":3,"file":"typeIndex.typings.js","sourceRoot":"","sources":["../../../src/.ldo/typeIndex.typings.ts"],"names":[],"mappings":""}
@@ -0,0 +1 @@
1
+ {"version":3,"file":"constants.js","sourceRoot":"","sources":["../../src/constants.ts"],"names":[],"mappings":";;;AAAa,QAAA,QAAQ,GAAG,iDAAiD,CAAC;AAC7D,QAAA,iBAAiB,GAC5B,mDAAmD,CAAC;AACzC,QAAA,SAAS,GAAG,2CAA2C,CAAC;AACxD,QAAA,QAAQ,GAAG,2CAA2C,CAAC;AACvD,QAAA,kBAAkB,GAC7B,oDAAoD,CAAC"}
@@ -1,34 +1,39 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.getInstanceUris = exports.getTypeIndexesUrisFromProfile = exports.getProfile = exports.getTypeRegistrations = void 0;
4
- const profile_shapeTypes_1 = require("./.ldo/profile.shapeTypes");
5
- const typeIndex_shapeTypes_1 = require("./.ldo/typeIndex.shapeTypes");
6
- const constants_1 = require("./constants");
7
- const Options_1 = require("./util/Options");
3
+ exports.getTypeRegistrations = getTypeRegistrations;
4
+ exports.getProfile = getProfile;
5
+ exports.getTypeIndexesUrisFromProfile = getTypeIndexesUrisFromProfile;
6
+ exports.getInstanceUris = getInstanceUris;
7
+ const profile_shapeTypes_js_1 = require("./.ldo/profile.shapeTypes.js");
8
+ const typeIndex_shapeTypes_js_1 = require("./.ldo/typeIndex.shapeTypes.js");
9
+ const constants_js_1 = require("./constants.js");
10
+ const Options_js_1 = require("./util/Options.js");
8
11
  async function getTypeRegistrations(webId, options) {
9
- const { dataset } = (0, Options_1.guaranteeOptions)(options);
12
+ const { dataset } = (0, Options_js_1.guaranteeOptions)(options);
13
+ // Get Profile
10
14
  const profile = await getProfile(webId, options);
15
+ // Get Type Indexes
11
16
  const typeIndexUris = getTypeIndexesUrisFromProfile(profile);
17
+ // Fetch the type Indexes
12
18
  await Promise.all(typeIndexUris.map(async (typeIndexUri) => {
13
19
  const typeIndexResource = dataset.getResource(typeIndexUri);
14
20
  const readResult = await typeIndexResource.readIfUnfetched();
15
21
  if (readResult.isError)
16
22
  throw readResult;
17
23
  }));
24
+ // Get Type Registrations
18
25
  return dataset
19
- .usingType(typeIndex_shapeTypes_1.TypeRegistrationShapeType)
20
- .matchSubject(constants_1.RDF_TYPE, constants_1.TYPE_REGISTRATION);
26
+ .usingType(typeIndex_shapeTypes_js_1.TypeRegistrationShapeType)
27
+ .matchSubject(constants_js_1.RDF_TYPE, constants_js_1.TYPE_REGISTRATION);
21
28
  }
22
- exports.getTypeRegistrations = getTypeRegistrations;
23
29
  async function getProfile(webId, options) {
24
- const { dataset } = (0, Options_1.guaranteeOptions)(options);
30
+ const { dataset } = (0, Options_js_1.guaranteeOptions)(options);
25
31
  const profileResource = dataset.getResource(webId);
26
32
  const readResult = await profileResource.readIfUnfetched();
27
33
  if (readResult.isError)
28
34
  throw readResult;
29
- return dataset.usingType(profile_shapeTypes_1.TypeIndexProfileShapeType).fromSubject(webId);
35
+ return dataset.usingType(profile_shapeTypes_js_1.TypeIndexProfileShapeType).fromSubject(webId);
30
36
  }
31
- exports.getProfile = getProfile;
32
37
  function getTypeIndexesUrisFromProfile(profile) {
33
38
  const uris = [];
34
39
  profile.privateTypeIndex?.forEach((indexNode) => {
@@ -39,13 +44,14 @@ function getTypeIndexesUrisFromProfile(profile) {
39
44
  });
40
45
  return uris;
41
46
  }
42
- exports.getTypeIndexesUrisFromProfile = getTypeIndexesUrisFromProfile;
43
47
  async function getInstanceUris(classUri, typeRegistrations, options) {
44
- const { dataset } = (0, Options_1.guaranteeOptions)(options);
48
+ const { dataset } = (0, Options_js_1.guaranteeOptions)(options);
45
49
  const leafUris = new Set();
46
50
  await Promise.all(typeRegistrations.map(async (registration) => {
47
51
  if (registration.forClass["@id"] === classUri) {
52
+ // Individual registrations
48
53
  registration.instance?.forEach((instance) => leafUris.add(instance["@id"]));
54
+ // Container registrations
49
55
  await Promise.all(registration.instanceContainer?.map(async (instanceContainer) => {
50
56
  const containerResource = dataset.getResource(instanceContainer["@id"]);
51
57
  await containerResource.readIfUnfetched();
@@ -58,5 +64,4 @@ async function getInstanceUris(classUri, typeRegistrations, options) {
58
64
  }));
59
65
  return Array.from(leafUris);
60
66
  }
61
- exports.getInstanceUris = getInstanceUris;
62
67
  //# sourceMappingURL=getTypeIndex.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"getTypeIndex.js","sourceRoot":"","sources":["../../src/getTypeIndex.ts"],"names":[],"mappings":";;AAUA,oDAyBC;AAED,gCASC;AAED,sEAWC;AAED,0CA+BC;AA1FD,wEAAyE;AACzE,4EAA2E;AAC3E,iDAA6D;AAE7D,kDAAqD;AAI9C,KAAK,UAAU,oBAAoB,CACxC,KAAa,EACb,OAAiB;IAEjB,MAAM,EAAE,OAAO,EAAE,GAAG,IAAA,6BAAgB,EAAC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AAC,CAAC,IAAI,EAAE,CACT,CAAC;QACJ,CAAC;IACH,CAAC,CAAC,CACH,CAAC;IACF,OAAO,KAAK,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAC;AAC9B,CAAC"}
@@ -14,8 +14,8 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
14
14
  for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
15
15
  };
16
16
  Object.defineProperty(exports, "__esModule", { value: true });
17
- __exportStar(require("./getTypeIndex"), exports);
18
- __exportStar(require("./setTypeIndex"), exports);
19
- __exportStar(require("./react/useInstanceUris"), exports);
20
- __exportStar(require("./react/useTypeIndexProfile"), exports);
17
+ __exportStar(require("./getTypeIndex.js"), exports);
18
+ __exportStar(require("./setTypeIndex.js"), exports);
19
+ __exportStar(require("./react/useInstanceUris.js"), exports);
20
+ __exportStar(require("./react/useTypeIndexProfile.js"), exports);
21
21
  //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,oDAAkC;AAClC,oDAAkC;AAClC,6DAA2C;AAC3C,iEAA+C"}
@@ -0,0 +1,33 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.useInstanceUris = useInstanceUris;
4
+ const useTypeIndexProfile_js_1 = require("./useTypeIndexProfile.js");
5
+ const react_1 = require("react");
6
+ const useSubscribeToUris_js_1 = require("./util/useSubscribeToUris.js");
7
+ const solid_react_1 = require("@ldo/solid-react");
8
+ const typeIndex_shapeTypes_js_1 = require("../.ldo/typeIndex.shapeTypes.js");
9
+ const constants_js_1 = require("../constants.js");
10
+ const getTypeIndex_js_1 = require("../getTypeIndex.js");
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, solid_react_1.useLdo)();
19
+ const profile = (0, useTypeIndexProfile_js_1.useTypeIndexProfile)();
20
+ const typeIndexUris = (0, react_1.useMemo)(() => (profile ? (0, getTypeIndex_js_1.getTypeIndexesUrisFromProfile)(profile) : []), [profile]);
21
+ (0, useSubscribeToUris_js_1.useSubscribeToUris)(typeIndexUris);
22
+ const [leafUris, setLeafUris] = (0, react_1.useState)([]);
23
+ const typeRegistrations = (0, solid_react_1.useMatchSubject)(typeIndex_shapeTypes_js_1.TypeRegistrationShapeType, constants_js_1.RDF_TYPE, constants_js_1.TYPE_REGISTRATION);
24
+ (0, react_1.useEffect)(() => {
25
+ (0, getTypeIndex_js_1.getInstanceUris)(classUri, typeRegistrations.toArray(), {
26
+ // eslint-disable-next-line @typescript-eslint/ban-ts-comment
27
+ // @ts-ignore TODO: come back and see if we can fix this
28
+ solidLdoDataset: dataset,
29
+ }).then(setLeafUris);
30
+ }, [typeRegistrations]);
31
+ return leafUris;
32
+ }
33
+ //# sourceMappingURL=useInstanceUris.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"useInstanceUris.js","sourceRoot":"","sources":["../../../src/react/useInstanceUris.ts"],"names":[],"mappings":";;AAkBA,0CA4BC;AA9CD,qEAA+D;AAC/D,iCAAqD;AACrD,wEAAkE;AAClE,kDAA2D;AAC3D,6EAA4E;AAC5E,kDAA8D;AAC9D,wDAG4B;AAG5B;;;;;GAKG;AACH,SAAgB,eAAe,CAAC,QAAgB;IAC9C,MAAM,EAAE,OAAO,EAAE,GAAG,IAAA,oBAAM,GAAE,CAAC;IAC7B,MAAM,OAAO,GAAG,IAAA,4CAAmB,GAAE,CAAC;IAEtC,MAAM,aAAa,GAAa,IAAA,eAAO,EACrC,GAAG,EAAE,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,IAAA,+CAA6B,EAAC,OAAO,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC,EAC7D,CAAC,OAAO,CAAC,CACV,CAAC;IAEF,IAAA,0CAAkB,EAAC,aAAa,CAAC,CAAC;IAElC,MAAM,CAAC,QAAQ,EAAE,WAAW,CAAC,GAAG,IAAA,gBAAQ,EAAiB,EAAE,CAAC,CAAC;IAE7D,MAAM,iBAAiB,GAAG,IAAA,6BAAe,EACvC,mDAAyB,EACzB,uBAAQ,EACR,gCAAiB,CAClB,CAAC;IAEF,IAAA,iBAAS,EAAC,GAAG,EAAE;QACb,IAAA,iCAAe,EAAC,QAAQ,EAAE,iBAAiB,CAAC,OAAO,EAAE,EAAE;YACrD,6DAA6D;YAC7D,wDAAwD;YACxD,eAAe,EAAE,OAAO;SACzB,CAAC,CAAC,IAAI,CAAC,WAAW,CAAC,CAAC;IACvB,CAAC,EAAE,CAAC,iBAAiB,CAAC,CAAC,CAAC;IAExB,OAAO,QAAQ,CAAC;AAClB,CAAC"}
@@ -1,13 +1,12 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.useTypeIndexProfile = void 0;
3
+ exports.useTypeIndexProfile = useTypeIndexProfile;
4
4
  const solid_react_1 = require("@ldo/solid-react");
5
- const profile_shapeTypes_1 = require("../.ldo/profile.shapeTypes");
5
+ const profile_shapeTypes_js_1 = require("../.ldo/profile.shapeTypes.js");
6
6
  function useTypeIndexProfile() {
7
7
  const { session } = (0, solid_react_1.useSolidAuth)();
8
8
  (0, solid_react_1.useResource)(session.webId, { subscribe: true });
9
- const profile = (0, solid_react_1.useSubject)(profile_shapeTypes_1.TypeIndexProfileShapeType, session.webId);
9
+ const profile = (0, solid_react_1.useSubject)(profile_shapeTypes_js_1.TypeIndexProfileShapeType, session.webId);
10
10
  return profile;
11
11
  }
12
- exports.useTypeIndexProfile = useTypeIndexProfile;
13
12
  //# sourceMappingURL=useTypeIndexProfile.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"useTypeIndexProfile.js","sourceRoot":"","sources":["../../../src/react/useTypeIndexProfile.ts"],"names":[],"mappings":";;AAIA,kDAKC;AATD,kDAAyE;AAEzE,yEAA0E;AAE1E,SAAgB,mBAAmB;IACjC,MAAM,EAAE,OAAO,EAAE,GAAG,IAAA,0BAAY,GAAE,CAAC;IACnC,IAAA,yBAAW,EAAC,OAAO,CAAC,KAAK,EAAE,EAAE,SAAS,EAAE,IAAI,EAAE,CAAC,CAAC;IAChD,MAAM,OAAO,GAAG,IAAA,wBAAU,EAAC,iDAAyB,EAAE,OAAO,CAAC,KAAK,CAAC,CAAC;IACrE,OAAO,OAAO,CAAC;AACjB,CAAC"}
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.useSubscribeToUris = void 0;
3
+ exports.useSubscribeToUris = useSubscribeToUris;
4
4
  const solid_react_1 = require("@ldo/solid-react");
5
5
  const react_1 = require("react");
6
6
  function useSubscribeToUris(uris) {
@@ -11,6 +11,7 @@ function useSubscribeToUris(uris) {
11
11
  const previousSubscriptions = { ...currentlySubscribed.current };
12
12
  Promise.all(resources.map(async (resource) => {
13
13
  if (!previousSubscriptions[resource.uri]) {
14
+ // Read and subscribe
14
15
  await resource.readIfUnfetched();
15
16
  currentlySubscribed.current[resource.uri] =
16
17
  await resource.subscribeToNotifications();
@@ -19,7 +20,9 @@ function useSubscribeToUris(uris) {
19
20
  delete previousSubscriptions[resource.uri];
20
21
  }
21
22
  })).then(async () => {
23
+ // Unsubscribe from all remaining previous subscriptions
22
24
  await Promise.all(Object.entries(previousSubscriptions).map(async ([resourceUri, subscriptionId]) => {
25
+ // Unsubscribe
23
26
  delete currentlySubscribed.current[resourceUri];
24
27
  const resource = dataset.getResource(resourceUri);
25
28
  await resource.unsubscribeFromNotifications(subscriptionId);
@@ -27,5 +30,4 @@ function useSubscribeToUris(uris) {
27
30
  });
28
31
  }, [uris]);
29
32
  }
30
- exports.useSubscribeToUris = useSubscribeToUris;
31
33
  //# sourceMappingURL=useSubscribeToUris.js.map
@@ -0,0 +1 @@
1
+ {"version":3,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ChD,MAAM,QAAQ,GAAG,OAAO,CAAC,WAAW,CAAC,WAAW,CAAC,CAAC;gBAClD,MAAM,QAAQ,CAAC,4BAA4B,CAAC,cAAc,CAAC,CAAC;YAC9D,CAAC,CACF,CACF,CAAC;QACJ,CAAC,CAAC,CAAC;IACL,CAAC,EAAE,CAAC,IAAI,CAAC,CAAC,CAAC;AACb,CAAC"}
@@ -0,0 +1,197 @@
1
+ "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
9
+ }) : (function(o, m, k, k2) {
10
+ if (k2 === undefined) k2 = k;
11
+ o[k2] = m[k];
12
+ }));
13
+ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
14
+ Object.defineProperty(o, "default", { enumerable: true, value: v });
15
+ }) : function(o, v) {
16
+ o["default"] = v;
17
+ });
18
+ var __importStar = (this && this.__importStar) || (function () {
19
+ var ownKeys = function(o) {
20
+ ownKeys = Object.getOwnPropertyNames || function (o) {
21
+ var ar = [];
22
+ for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
23
+ return ar;
24
+ };
25
+ return ownKeys(o);
26
+ };
27
+ return function (mod) {
28
+ if (mod && mod.__esModule) return mod;
29
+ var result = {};
30
+ if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
31
+ __setModuleDefault(result, mod);
32
+ return result;
33
+ };
34
+ })();
35
+ Object.defineProperty(exports, "__esModule", { value: true });
36
+ exports.initTypeIndex = initTypeIndex;
37
+ exports.createIndex = createIndex;
38
+ exports.addRegistration = addRegistration;
39
+ exports.removeRegistration = removeRegistration;
40
+ exports.findAppropriateTypeRegistration = findAppropriateTypeRegistration;
41
+ /* eslint-disable @typescript-eslint/no-explicit-any */
42
+ const uuid_1 = require("uuid");
43
+ const constants_js_1 = require("./constants.js");
44
+ const Options_js_1 = require("./util/Options.js");
45
+ const rdfdm = __importStar(require("@rdfjs/data-model"));
46
+ const getTypeIndex_js_1 = require("./getTypeIndex.js");
47
+ const profile_shapeTypes_js_1 = require("./.ldo/profile.shapeTypes.js");
48
+ const ldo_1 = require("@ldo/ldo");
49
+ const typeIndex_shapeTypes_js_1 = require("./.ldo/typeIndex.shapeTypes.js");
50
+ const { namedNode, quad } = rdfdm;
51
+ /**
52
+ * =============================================================================
53
+ * INITIALIZERS
54
+ * =============================================================================
55
+ */
56
+ async function initTypeIndex(webId, options) {
57
+ const { dataset } = (0, Options_js_1.guaranteeOptions)(options);
58
+ const profile = await (0, getTypeIndex_js_1.getProfile)(webId, options);
59
+ if (!profile.privateTypeIndex?.size || !profile.publicTypeIndex?.size) {
60
+ const profileFolder = await dataset
61
+ .getResource(webId)
62
+ .getParentContainer();
63
+ if (profileFolder?.isError)
64
+ throw profileFolder;
65
+ if (!profileFolder)
66
+ throw new Error("No folder to save the type indexes to.");
67
+ if (!profile.privateTypeIndex?.size) {
68
+ await createIndex(webId, profileFolder, dataset, true);
69
+ }
70
+ if (!profile.publicTypeIndex?.size) {
71
+ await createIndex(webId, profileFolder, dataset, false);
72
+ }
73
+ }
74
+ }
75
+ /**
76
+ * @internal
77
+ * @param webId
78
+ * @param profileFolder
79
+ * @param dataset
80
+ */
81
+ async function createIndex(webId, profileFolder, dataset, isPrivate) {
82
+ // Create a private type index
83
+ const createResult = await profileFolder.createChildAndOverwrite(`${isPrivate ? "private" : "public"}_index_${(0, uuid_1.v4)()}`);
84
+ if (createResult.isError)
85
+ throw createResult;
86
+ const indexResource = createResult.resource;
87
+ const wacResult = await indexResource.setWac({
88
+ agent: {
89
+ [webId]: { read: true, write: true, append: true, control: true },
90
+ },
91
+ public: {
92
+ read: isPrivate ? false : true,
93
+ write: true,
94
+ append: true,
95
+ control: true,
96
+ },
97
+ authenticated: {
98
+ read: isPrivate ? false : true,
99
+ write: true,
100
+ append: true,
101
+ control: true,
102
+ },
103
+ });
104
+ if (wacResult.isError)
105
+ throw wacResult;
106
+ const transaction = dataset.startTransaction();
107
+ const cProfile = transaction
108
+ .usingType(profile_shapeTypes_js_1.TypeIndexProfileShapeType)
109
+ .write(dataset.getResource(webId).uri)
110
+ .fromSubject(webId);
111
+ if (isPrivate) {
112
+ cProfile.privateTypeIndex?.add({ "@id": indexResource.uri });
113
+ }
114
+ else {
115
+ cProfile.publicTypeIndex?.add({ "@id": indexResource.uri });
116
+ }
117
+ const cTypeIndex = transaction
118
+ .usingType(typeIndex_shapeTypes_js_1.TypeIndexDocumentShapeType)
119
+ .write(indexResource.uri)
120
+ .fromSubject(indexResource.uri);
121
+ cTypeIndex.type = (0, ldo_1.set)({ "@id": "ListedDocument" }, { "@id": "TypeIndex" });
122
+ const commitResult = await transaction.commitToRemote();
123
+ if (commitResult.isError)
124
+ throw commitResult;
125
+ }
126
+ /**
127
+ * Adds an instance to a TypeRegistration
128
+ * @param indexUri The URI of the TypeIndex
129
+ * @param classUri The URI for the class the instance should be added to
130
+ * @param instances Objects representing the instances to add
131
+ * @param options Options
132
+ */
133
+ function addRegistration(indexUri, classUri, instances, options) {
134
+ // Check to see if its already in the index
135
+ const typeRegistration = findAppropriateTypeRegistration(indexUri, classUri, options);
136
+ // Add instances to type registration
137
+ instances.instance?.forEach((instance) => {
138
+ typeRegistration.instance?.add({ "@id": instance });
139
+ });
140
+ instances.instanceContainer?.forEach((instanceContainer) => {
141
+ typeRegistration.instanceContainer?.add({ "@id": instanceContainer });
142
+ });
143
+ }
144
+ /**
145
+ * Removes instances from a TypeRegistration
146
+ * @param indexUri The URI of the TypeIndex
147
+ * @param classUri The URI for the class the instance should be removed from
148
+ * @param instances Objects representing the instances to remove
149
+ * @param options Options
150
+ */
151
+ async function removeRegistration(indexUri, classUri, instances, options) {
152
+ // Check to see if its already in the index
153
+ const typeRegistration = findAppropriateTypeRegistration(indexUri, classUri, options);
154
+ // Add instances to type registration
155
+ instances.instance?.forEach((instanceUri) => {
156
+ typeRegistration.instance?.delete({ "@id": instanceUri });
157
+ });
158
+ instances.instanceContainer?.forEach((instanceContainerUri) => {
159
+ typeRegistration.instanceContainer?.delete({ "@id": instanceContainerUri });
160
+ });
161
+ }
162
+ /**
163
+ * Finds a TypeRegistration inside of a type index. If it doesn't exist, it
164
+ * creates one.
165
+ * @param indexUri The URI of the typeIndex
166
+ * @param classUri The URI of the class in question for the TypeRegistration
167
+ * @param options
168
+ * @returns The Type Index
169
+ */
170
+ function findAppropriateTypeRegistration(indexUri, classUri, options) {
171
+ const { dataset } = (0, Options_js_1.guaranteeOptions)(options);
172
+ // Check to see if its already in the index
173
+ const existingRegistrationsUris = dataset
174
+ .match(null, namedNode(constants_js_1.RDF_TYPE), namedNode(constants_js_1.TYPE_REGISTRATION), namedNode(indexUri))
175
+ .toArray()
176
+ .map((quad) => quad.subject);
177
+ const existingRegistrationForClassUri = existingRegistrationsUris.find((registrationUri) => {
178
+ return dataset.has(quad(registrationUri, namedNode(constants_js_1.FOR_CLASS), namedNode(classUri), namedNode(indexUri)));
179
+ })?.value;
180
+ let typeRegistration;
181
+ if (existingRegistrationForClassUri) {
182
+ typeRegistration = dataset
183
+ .usingType(typeIndex_shapeTypes_js_1.TypeRegistrationShapeType)
184
+ .write(indexUri)
185
+ .fromSubject(existingRegistrationForClassUri);
186
+ }
187
+ else {
188
+ typeRegistration = dataset
189
+ .usingType(typeIndex_shapeTypes_js_1.TypeRegistrationShapeType)
190
+ .write(indexUri)
191
+ .fromSubject(`${indexUri}#${(0, uuid_1.v4)()}`);
192
+ typeRegistration.type = { "@id": "TypeRegistration" };
193
+ typeRegistration.forClass = { "@id": classUri };
194
+ }
195
+ return typeRegistration;
196
+ }
197
+ //# sourceMappingURL=setTypeIndex.js.map
@@ -0,0 +1 @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AQ,CAAC,EACnB,SAAS,CAAC,QAAQ,CAAC,CACpB,CACF,CAAC;IACJ,CAAC,CACF,EAAE,KAAK,CAAC;IAET,IAAI,gBAAkC,CAAC;IACvC,IAAI,+BAA+B,EAAE,CAAC;QACpC,gBAAgB,GAAG,OAAO;aACvB,SAAS,CAAC,mDAAyB,CAAC;aACpC,KAAK,CAAC,QAAQ,CAAC;aACf,WAAW,CAAC,+BAA+B,CAAC,CAAC;IAClD,CAAC;SAAM,CAAC;QACN,gBAAgB,GAAG,OAAO;aACvB,SAAS,CAAC,mDAAyB,CAAC;aACpC,KAAK,CAAC,QAAQ,CAAC;aACf,WAAW,CAAC,GAAG,QAAQ,IAAI,IAAA,SAAE,GAAE,EAAE,CAAC,CAAC;QACtC,gBAAgB,CAAC,IAAI,GAAG,EAAE,KAAK,EAAE,kBAAkB,EAAE,CAAC;QACtD,gBAAgB,CAAC,QAAQ,GAAG,EAAE,KAAK,EAAE,QAAQ,EAAE,CAAC;IAClD,CAAC;IACD,OAAO,gBAAgB,CAAC;AAC1B,CAAC"}
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.guaranteeOptions = void 0;
3
+ exports.guaranteeOptions = guaranteeOptions;
4
4
  const connected_solid_1 = require("@ldo/connected-solid");
5
5
  function guaranteeOptions(options) {
6
6
  const fetch = (0, connected_solid_1.guaranteeFetch)(options?.fetch);
@@ -9,5 +9,4 @@ function guaranteeOptions(options) {
9
9
  dataset.setContext("solid", { fetch });
10
10
  return { fetch, dataset };
11
11
  }
12
- exports.guaranteeOptions = guaranteeOptions;
13
12
  //# sourceMappingURL=Options.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Options.js","sourceRoot":"","sources":["../../../src/util/Options.ts"],"names":[],"mappings":";;AAUA,4CAMC;AAbD,0DAA6E;AAO7E,SAAgB,gBAAgB,CAAC,OAAiB;IAChD,MAAM,KAAK,GAAG,IAAA,gCAAc,EAAC,OAAO,EAAE,KAAK,CAAC,CAAC;IAC7C,MAAM,OAAO,GAAG,CAAC,OAAO,EAAE,eAAe;QACvC,IAAA,uCAAqB,GAAE,CAAgD,CAAC;IAC1E,OAAO,CAAC,UAAU,CAAC,OAAO,EAAE,EAAE,KAAK,EAAE,CAAC,CAAC;IACvC,OAAO,EAAE,KAAK,EAAE,OAAO,EAAE,CAAC;AAC5B,CAAC"}
@@ -0,0 +1,18 @@
1
+ /**
2
+ * =============================================================================
3
+ * profileContext: JSONLD Context for profile
4
+ * =============================================================================
5
+ */
6
+ export const profileContext = {
7
+ privateTypeIndex: {
8
+ "@id": "http://www.w3.org/ns/solid/terms#privateTypeIndex",
9
+ "@type": "@id",
10
+ "@isCollection": true,
11
+ },
12
+ publicTypeIndex: {
13
+ "@id": "http://www.w3.org/ns/solid/terms#publicTypeIndex",
14
+ "@type": "@id",
15
+ "@isCollection": true,
16
+ },
17
+ };
18
+ //# sourceMappingURL=profile.context.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"profile.context.js","sourceRoot":"","sources":["../../../src/.ldo/profile.context.ts"],"names":[],"mappings":"AAEA;;;;GAIG;AACH,MAAM,CAAC,MAAM,cAAc,GAAqB;IAC9C,gBAAgB,EAAE;QAChB,KAAK,EAAE,mDAAmD;QAC1D,OAAO,EAAE,KAAK;QACd,eAAe,EAAE,IAAI;KACtB;IACD,eAAe,EAAE;QACf,KAAK,EAAE,kDAAkD;QACzD,OAAO,EAAE,KAAK;QACd,eAAe,EAAE,IAAI;KACtB;CACF,CAAC"}