@ldo/svelte 1.0.0-alpha.11 → 1.0.0-alpha.12

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 (83) hide show
  1. package/Readme.md +74 -0
  2. package/dist/cjs/createLdoSvelteMethods.js +74 -0
  3. package/dist/cjs/createLdoSvelteMethods.js.map +1 -0
  4. package/dist/cjs/index.js +25 -0
  5. package/dist/cjs/index.js.map +1 -0
  6. package/dist/cjs/methods/useLdo.js +59 -0
  7. package/dist/cjs/methods/useLdo.js.map +1 -0
  8. package/dist/cjs/methods/useLinkQuery.js +18 -0
  9. package/dist/cjs/methods/useLinkQuery.js.map +1 -0
  10. package/dist/cjs/methods/useMatchObject.js +22 -0
  11. package/dist/cjs/methods/useMatchObject.js.map +1 -0
  12. package/dist/cjs/methods/useMatchSubject.js +22 -0
  13. package/dist/cjs/methods/useMatchSubject.js.map +1 -0
  14. package/dist/cjs/methods/useResource.js +51 -0
  15. package/dist/cjs/methods/useResource.js.map +1 -0
  16. package/dist/cjs/methods/useSubject.js +24 -0
  17. package/dist/cjs/methods/useSubject.js.map +1 -0
  18. package/dist/cjs/methods/useSubscribeToResource.js +17 -0
  19. package/dist/cjs/methods/useSubscribeToResource.js.map +1 -0
  20. package/dist/cjs/util/useTrackingProxy.js +33 -0
  21. package/dist/cjs/util/useTrackingProxy.js.map +1 -0
  22. package/dist/esm/createLdoSvelteMethods.js +71 -0
  23. package/dist/esm/createLdoSvelteMethods.js.map +1 -0
  24. package/dist/esm/index.js +9 -0
  25. package/dist/esm/index.js.map +1 -0
  26. package/dist/esm/methods/useLdo.js +56 -0
  27. package/dist/esm/methods/useLdo.js.map +1 -0
  28. package/dist/esm/methods/useLinkQuery.js +15 -0
  29. package/dist/esm/methods/useLinkQuery.js.map +1 -0
  30. package/dist/esm/methods/useMatchObject.js +19 -0
  31. package/dist/esm/methods/useMatchObject.js.map +1 -0
  32. package/dist/esm/methods/useMatchSubject.js +19 -0
  33. package/dist/esm/methods/useMatchSubject.js.map +1 -0
  34. package/dist/esm/methods/useResource.js +48 -0
  35. package/dist/esm/methods/useResource.js.map +1 -0
  36. package/dist/esm/methods/useSubject.js +21 -0
  37. package/dist/esm/methods/useSubject.js.map +1 -0
  38. package/dist/esm/methods/useSubscribeToResource.js +14 -0
  39. package/dist/esm/methods/useSubscribeToResource.js.map +1 -0
  40. package/dist/esm/util/useTrackingProxy.js +30 -0
  41. package/dist/esm/util/useTrackingProxy.js.map +1 -0
  42. package/dist/types/createLdoSvelteMethods.d.ts +59 -0
  43. package/dist/types/createLdoSvelteMethods.d.ts.map +1 -0
  44. package/dist/types/index.d.ts +9 -0
  45. package/dist/{src → types}/methods/useLdo.d.ts +4 -5
  46. package/dist/{src → types}/methods/useLdo.d.ts.map +1 -1
  47. package/dist/{src → types}/methods/useLinkQuery.d.ts +3 -4
  48. package/dist/{src → types}/methods/useMatchObject.d.ts +5 -5
  49. package/dist/types/methods/useMatchObject.d.ts.map +1 -0
  50. package/dist/{src → types}/methods/useMatchSubject.d.ts +5 -5
  51. package/dist/types/methods/useMatchSubject.d.ts.map +1 -0
  52. package/dist/{src → types}/methods/useResource.d.ts +2 -3
  53. package/dist/{src → types}/methods/useSubject.d.ts +5 -5
  54. package/dist/{src → types}/methods/useSubscribeToResource.d.ts +1 -2
  55. package/dist/{src → types}/util/useTrackingProxy.d.ts +3 -3
  56. package/package.json +22 -13
  57. package/src/methods/useLdo.ts +66 -66
  58. package/src/methods/useLinkQuery.ts +1 -1
  59. package/src/methods/useMatchObject.ts +9 -3
  60. package/src/methods/useMatchSubject.ts +9 -3
  61. package/src/methods/useSubscribeToResource.ts +1 -1
  62. package/dist/example/src/ldoSvelteMethods.d.ts +0 -2
  63. package/dist/example/src/ldoSvelteMethods.d.ts.map +0 -1
  64. package/dist/example/src/main.d.ts +0 -5
  65. package/dist/example/src/main.d.ts.map +0 -1
  66. package/dist/index.cjs +0 -2
  67. package/dist/index.cjs.map +0 -1
  68. package/dist/index.d.ts +0 -1
  69. package/dist/index.mjs +0 -88
  70. package/dist/index.mjs.map +0 -1
  71. package/dist/src/index.d.ts +0 -9
  72. package/dist/src/methods/useMatchObject.d.ts.map +0 -1
  73. package/dist/src/methods/useMatchSubject.d.ts.map +0 -1
  74. package/dist/vite.config.d.ts +0 -3
  75. package/dist/vite.config.d.ts.map +0 -1
  76. package/dist/vite.config.example.d.ts +0 -3
  77. package/dist/vite.config.example.d.ts.map +0 -1
  78. /package/dist/{src → types}/index.d.ts.map +0 -0
  79. /package/dist/{src → types}/methods/useLinkQuery.d.ts.map +0 -0
  80. /package/dist/{src → types}/methods/useResource.d.ts.map +0 -0
  81. /package/dist/{src → types}/methods/useSubject.d.ts.map +0 -0
  82. /package/dist/{src → types}/methods/useSubscribeToResource.d.ts.map +0 -0
  83. /package/dist/{src → types}/util/useTrackingProxy.d.ts.map +0 -0
@@ -0,0 +1,19 @@
1
+ import { useTrackingProxy } from "../util/useTrackingProxy.js";
2
+ /**
3
+ * @internal
4
+ *
5
+ * Creates a useMatchObject function
6
+ */
7
+ export function createUseMatchObject(dataset) {
8
+ /**
9
+ * Returns an array of matching items and triggers a rerender when that data
10
+ * is updated.
11
+ */
12
+ return function useMatchObject(shapeType, subject, predicate, graph) {
13
+ const matchObject = (builder) => {
14
+ return builder.matchObject(subject, predicate, graph);
15
+ };
16
+ return useTrackingProxy(shapeType, matchObject, dataset);
17
+ };
18
+ }
19
+ //# sourceMappingURL=useMatchObject.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"useMatchObject.js","sourceRoot":"","sources":["../../../src/methods/useMatchObject.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,gBAAgB,EAAE,MAAM,6BAA6B,CAAC;AAE/D;;;;GAIG;AACH,MAAM,UAAU,oBAAoB,CAClC,OAAqC;IAErC;;;OAGG;IACH,OAAO,SAAS,cAAc,CAC5B,SAA0B,EAC1B,OAA+B,EAC/B,SAAiC,EACjC,KAA6B;QAE7B,MAAM,WAAW,GAAG,CAAC,OAAyB,EAAE,EAAE;YAChD,OAAO,OAAO,CAAC,WAAW,CAAC,OAAO,EAAE,SAAS,EAAE,KAAK,CAAC,CAAC;QACxD,CAAC,CAAC;QAEF,OAAO,gBAAgB,CAAC,SAAS,EAAE,WAAW,EAAE,OAAO,CAAC,CAAC;IAC3D,CAAC,CAAC;AACJ,CAAC"}
@@ -0,0 +1,19 @@
1
+ import { useTrackingProxy } from "../util/useTrackingProxy.js";
2
+ /**
3
+ * @internal
4
+ *
5
+ * Creates a useMatchSubject function.
6
+ */
7
+ export function createUseMatchSubject(dataset) {
8
+ /**
9
+ * Returns an array of matching linked data objects. Triggers a rerender if
10
+ * the data is updated.
11
+ */
12
+ return function useMatchSubject(shapeType, predicate, object, graph) {
13
+ const matchSubject = (builder) => {
14
+ return builder.matchSubject(predicate, object, graph);
15
+ };
16
+ return useTrackingProxy(shapeType, matchSubject, dataset);
17
+ };
18
+ }
19
+ //# sourceMappingURL=useMatchSubject.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"useMatchSubject.js","sourceRoot":"","sources":["../../../src/methods/useMatchSubject.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,gBAAgB,EAAE,MAAM,6BAA6B,CAAC;AAG/D;;;;GAIG;AACH,MAAM,UAAU,qBAAqB,CACnC,OAAqC;IAErC;;;OAGG;IACH,OAAO,SAAS,eAAe,CAC7B,SAA0B,EAC1B,SAAiC,EACjC,MAA8B,EAC9B,KAA6B;QAE7B,MAAM,YAAY,GAAG,CAAC,OAAyB,EAAE,EAAE;YACjD,OAAO,OAAO,CAAC,YAAY,CAAC,SAAS,EAAE,MAAM,EAAE,KAAK,CAAC,CAAC;QACxD,CAAC,CAAC;QAEF,OAAO,gBAAgB,CAAC,SAAS,EAAE,YAAY,EAAE,OAAO,CAAC,CAAC;IAC5D,CAAC,CAAC;AACJ,CAAC"}
@@ -0,0 +1,48 @@
1
+ import { writable } from "svelte/store";
2
+ /**
3
+ * @internal
4
+ *
5
+ * Creates a useResource function.
6
+ */
7
+ export function createUseResource(dataset) {
8
+ /**
9
+ * Returns a resource and triggers a rerender if that resource is updated.
10
+ */
11
+ return function useResource(uri, options) {
12
+ let resource;
13
+ // Get the resource based on incoming data
14
+ if (uri) {
15
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
16
+ resource = dataset.getResource(uri);
17
+ // Run read operations if necissary
18
+ if (!options?.suppressInitialRead) {
19
+ if (options?.reloadOnMount) {
20
+ resource.read();
21
+ }
22
+ else {
23
+ resource.readIfUnfetched();
24
+ }
25
+ }
26
+ }
27
+ else {
28
+ resource = undefined;
29
+ }
30
+ // The Svelte store
31
+ const store = writable(resource, (set) => {
32
+ const onResourceUpdate = () => {
33
+ set(resource);
34
+ };
35
+ if (resource) {
36
+ resource.on("update", onResourceUpdate);
37
+ // TODO: handle subscriptions
38
+ return () => {
39
+ resource.off("update", onResourceUpdate);
40
+ };
41
+ }
42
+ });
43
+ return {
44
+ subscribe: store.subscribe,
45
+ };
46
+ };
47
+ }
48
+ //# sourceMappingURL=useResource.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"useResource.js","sourceRoot":"","sources":["../../../src/methods/useResource.ts"],"names":[],"mappings":"AAKA,OAAO,EAAE,QAAQ,EAAiB,MAAM,cAAc,CAAC;AA4BvD;;;;GAIG;AACH,MAAM,UAAU,iBAAiB,CAC/B,OAAqC;IAErC;;OAEG;IACH,OAAO,SAAS,WAAW,CAKzB,GAAa,EACb,OAAkC;QAElC,IAAI,QAA4D,CAAC;QACjE,0CAA0C;QAC1C,IAAI,GAAG,EAAE,CAAC;YACR,8DAA8D;YAC9D,QAAQ,GAAG,OAAO,CAAC,WAAW,CAAC,GAAG,CAAQ,CAAC;YAC3C,mCAAmC;YACnC,IAAI,CAAC,OAAO,EAAE,mBAAmB,EAAE,CAAC;gBAClC,IAAI,OAAO,EAAE,aAAa,EAAE,CAAC;oBAC3B,QAAS,CAAC,IAAI,EAAE,CAAC;gBACnB,CAAC;qBAAM,CAAC;oBACN,QAAS,CAAC,eAAe,EAAE,CAAC;gBAC9B,CAAC;YACH,CAAC;QACH,CAAC;aAAM,CAAC;YACN,QAAQ,GAAG,SAAS,CAAC;QACvB,CAAC;QAED,mBAAmB;QACnB,MAAM,KAAK,GAAG,QAAQ,CACpB,QAAQ,EACR,CAAC,GAAG,EAAE,EAAE;YACN,MAAM,gBAAgB,GAAG,GAAG,EAAE;gBAC5B,GAAG,CAAC,QAAQ,CAAC,CAAC;YAChB,CAAC,CAAC;YAEF,IAAI,QAAQ,EAAE,CAAC;gBACb,QAAQ,CAAC,EAAE,CAAC,QAAQ,EAAE,gBAAgB,CAAC,CAAC;gBAExC,6BAA6B;gBAE7B,OAAO,GAAG,EAAE;oBACV,QAAQ,CAAC,GAAG,CAAC,QAAQ,EAAE,gBAAgB,CAAC,CAAC;gBAC3C,CAAC,CAAC;YACJ,CAAC;QACH,CAAC,CACF,CAAC;QAEF,OAAO;YACL,SAAS,EAAE,KAAK,CAAC,SAAS;SAC3B,CAAC;IACJ,CAAC,CAAC;AACJ,CAAC"}
@@ -0,0 +1,21 @@
1
+ import { useTrackingProxy } from "../util/useTrackingProxy.js";
2
+ /**
3
+ * @internal
4
+ *
5
+ * Creates a useSubject function.
6
+ */
7
+ export function createUseSubject(dataset) {
8
+ /**
9
+ * Returns a Linked Data Object based on the provided subject. Triggers a
10
+ * rerender if the data is udpated.
11
+ */
12
+ return function useSubject(shapeType, subject) {
13
+ const fromSubject = (builder) => {
14
+ if (!subject)
15
+ return;
16
+ return builder.fromSubject(subject);
17
+ };
18
+ return useTrackingProxy(shapeType, fromSubject, dataset);
19
+ };
20
+ }
21
+ //# sourceMappingURL=useSubject.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"useSubject.js","sourceRoot":"","sources":["../../../src/methods/useSubject.ts"],"names":[],"mappings":"AAKA,OAAO,EAAE,gBAAgB,EAAE,MAAM,6BAA6B,CAAC;AAmB/D;;;;GAIG;AACH,MAAM,UAAU,gBAAgB,CAC9B,OAAqC;IAErC;;;OAGG;IACH,OAAO,SAAS,UAAU,CACxB,SAA0B,EAC1B,OAA8B;QAE9B,MAAM,WAAW,GAAG,CAAC,OAAyB,EAAE,EAAE;YAChD,IAAI,CAAC,OAAO;gBAAE,OAAO;YACrB,OAAO,OAAO,CAAC,WAAW,CAAC,OAAO,CAAC,CAAC;QACtC,CAAC,CAAC;QAEF,OAAO,gBAAgB,CAAC,SAAS,EAAE,WAAW,EAAE,OAAO,CAAC,CAAC;IAC3D,CAAC,CAAC;AACJ,CAAC"}
@@ -0,0 +1,14 @@
1
+ /**
2
+ * @internal
3
+ *
4
+ * Creates a useSubscribeToResource function.
5
+ */
6
+ export function createUseSubscribeToResource(dataset) {
7
+ /**
8
+ * Starts a subscription to a resource.
9
+ */
10
+ return function useSubscribeToResource(...uris) {
11
+ throw new Error("Subscribe to Resource is Not Implemented for Svelte");
12
+ };
13
+ }
14
+ //# sourceMappingURL=useSubscribeToResource.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"useSubscribeToResource.js","sourceRoot":"","sources":["../../../src/methods/useSubscribeToResource.ts"],"names":[],"mappings":"AAEA;;;;GAIG;AACH,MAAM,UAAU,4BAA4B,CAC1C,OAAqC;IAErC;;OAEG;IACH,OAAO,SAAS,sBAAsB,CAAC,GAAG,IAAc;QACtD,MAAM,IAAI,KAAK,CAAC,qDAAqD,CAAC,CAAC;IACzE,CAAC,CAAC;AACJ,CAAC"}
@@ -0,0 +1,30 @@
1
+ import { createTrackingProxyBuilder } from "@ldo/connected";
2
+ import { writable } from "svelte/store";
3
+ /**
4
+ * @internal
5
+ *
6
+ * A hook for tracking proxies
7
+ */
8
+ export function useTrackingProxy(shapeType, createLdo, dataset) {
9
+ const forceUpdateInfo = {};
10
+ const forceUpdate = () => {
11
+ dataset.removeListenerFromAllEvents(forceUpdate);
12
+ const builder = createTrackingProxyBuilder(dataset, shapeType, forceUpdate);
13
+ const linkedDataObject = createLdo(builder);
14
+ forceUpdateInfo.ldo = linkedDataObject;
15
+ if (forceUpdateInfo.set && forceUpdateInfo.ldo)
16
+ forceUpdateInfo.set(forceUpdateInfo.ldo);
17
+ };
18
+ forceUpdate({}, "", [undefined, undefined, undefined, undefined]);
19
+ // The Svelte store
20
+ const store = writable(forceUpdateInfo.ldo, (set) => {
21
+ forceUpdateInfo.set = set;
22
+ return () => {
23
+ dataset.removeListenerFromAllEvents(forceUpdate);
24
+ };
25
+ });
26
+ return {
27
+ subscribe: store.subscribe,
28
+ };
29
+ }
30
+ //# sourceMappingURL=useTrackingProxy.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"useTrackingProxy.js","sourceRoot":"","sources":["../../../src/util/useTrackingProxy.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,0BAA0B,EAAE,MAAM,gBAAgB,CAAC;AAC5D,OAAO,EAAE,QAAQ,EAAiB,MAAM,cAAc,CAAC;AAGvD;;;;GAIG;AACH,MAAM,UAAU,gBAAgB,CAC9B,SAA0B,EAC1B,SAAoD,EACpD,OAAmB;IAEnB,MAAM,eAAe,GAGjB,EAAE,CAAC;IAEP,MAAM,WAAW,GAAsB,GAAG,EAAE;QAC1C,OAAO,CAAC,2BAA2B,CAAC,WAAW,CAAC,CAAC;QACjD,MAAM,OAAO,GAAG,0BAA0B,CAAC,OAAO,EAAE,SAAS,EAAE,WAAW,CAAC,CAAC;QAC5E,MAAM,gBAAgB,GAAG,SAAS,CAAC,OAAO,CAAC,CAAC;QAC5C,eAAe,CAAC,GAAG,GAAG,gBAAgB,CAAC;QACvC,IAAI,eAAe,CAAC,GAAG,IAAI,eAAe,CAAC,GAAG;YAC5C,eAAe,CAAC,GAAG,CAAC,eAAe,CAAC,GAAG,CAAC,CAAC;IAC7C,CAAC,CAAC;IACF,WAAW,CAAC,EAAE,EAAE,EAAE,EAAE,CAAC,SAAS,EAAE,SAAS,EAAE,SAAS,EAAE,SAAS,CAAC,CAAC,CAAC;IAElE,mBAAmB;IACnB,MAAM,KAAK,GAAG,QAAQ,CAAa,eAAe,CAAC,GAAG,EAAE,CAAC,GAAG,EAAE,EAAE;QAC9D,eAAe,CAAC,GAAG,GAAG,GAAG,CAAC;QAE1B,OAAO,GAAG,EAAE;YACV,OAAO,CAAC,2BAA2B,CAAC,WAAW,CAAC,CAAC;QACnD,CAAC,CAAC;IACJ,CAAC,CAAC,CAAC;IAEH,OAAO;QACL,SAAS,EAAE,KAAK,CAAC,SAAS;KAC3B,CAAC;AACJ,CAAC"}
@@ -0,0 +1,59 @@
1
+ import { type ConnectedPlugin } from "@ldo/connected";
2
+ /**
3
+ * A function that creates all common react functions given specific plugin.
4
+ *
5
+ * @example
6
+ * `methods.ts`
7
+ * ```tyepscript
8
+ * import { solidConnectedPlugin } from "@ldo/connected-solid";
9
+ * import { nextGraphConnectedPlugin } from "@ldo/connected-nextgraph";
10
+ * import { createLdoReactMethods } from "@ldo/react";
11
+ *
12
+ * // Export the results to be used in the reset of the application
13
+ * export const {
14
+ * dataset,
15
+ * useLdo,
16
+ * useMatchObject,
17
+ * useMatchSubject,
18
+ * useResource,
19
+ * useSubject,
20
+ * useSubscribeToResource,
21
+ * useLinkQuery,
22
+ * } = createLdoReactMethods([
23
+ * solidConnectedPlugin,
24
+ * nextGraphConnectedPlugin
25
+ * ]);
26
+ * ```
27
+ *
28
+ * `App.tsx`
29
+ * ```typescript
30
+ * import react, { FunctionComponent } from "react";
31
+ * import { PostShShapeType } from "./.ldo/posts.shapeType.ts";
32
+ * import { useResource, useSubject } from "./methods.ts";
33
+ *
34
+ * const UseSubjectTest: FunctionComponent = () => {
35
+ * const resource = useResource(SAMPLE_DATA_URI);
36
+ * const post = useSubject(PostShShapeType, `${SAMPLE_DATA_URI}#Post1`);
37
+ * if (resource.isLoading() || !post) return <p>loading</p>;
38
+ *
39
+ * return (
40
+ * <ul>
41
+ * {post.publisher.map((publisher) => {
42
+ * return <li key={publisher["@id"]}>{publisher["@id"]}</li>;
43
+ * })}
44
+ * </ul>
45
+ * );
46
+ * };
47
+ * ```
48
+ */
49
+ export declare function createLdoSvelteMethods<Plugins extends ConnectedPlugin<any, any, any, any>[]>(plugins: Plugins): {
50
+ dataset: import("@ldo/connected").ConnectedLdoDataset<Plugins>;
51
+ useLdo: () => import("./methods/useLdo.js").UseLdoMethods<Plugins>;
52
+ useMatchObject: <Type extends import("@ldo/ldo").LdoBase>(shapeType: import("@ldo/ldo").ShapeType<Type>, subject?: import("@ldo/rdf-utils").QuadMatch[0] | string, predicate?: import("@ldo/rdf-utils").QuadMatch[1] | string, graph?: import("@ldo/rdf-utils").QuadMatch[3] | string) => import("svelte/store").Readable<import("@ldo/jsonld-dataset-proxy").LdSet<Type>>;
53
+ useMatchSubject: <Type extends import("@ldo/ldo").LdoBase>(shapeType: import("@ldo/ldo").ShapeType<Type>, predicate?: import("@ldo/rdf-utils").QuadMatch[1] | string, object?: import("@ldo/rdf-utils").QuadMatch[2] | string, graph?: import("@ldo/rdf-utils").QuadMatch[3] | string) => import("svelte/store").Readable<import("@ldo/jsonld-dataset-proxy").LdSet<Type>>;
54
+ useResource: import("./methods/useResource.js").useResourceType<Plugins>;
55
+ useSubject: import("./methods/useSubject.js").useSubjectType;
56
+ useSubscribeToResource: (...uris: string[]) => void;
57
+ useLinkQuery: <Type extends import("@ldo/ldo").LdoBase, QueryInput extends Partial<{ [key in Exclude<keyof Type, "@context">]: import("@ldo/connected").LQInputFlattenSet<Type[key]>; }>>(shapeType: import("@ldo/ldo").ShapeType<Type>, startingResource: string, startingSubject: import("@ldo/rdf-utils").SubjectNode | string, linkQuery: QueryInput) => import("@ldo/connected").ExpandDeep<import("@ldo/connected").LQReturn<Type, QueryInput>> | undefined;
58
+ };
59
+ //# sourceMappingURL=createLdoSvelteMethods.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"createLdoSvelteMethods.d.ts","sourceRoot":"","sources":["../../src/createLdoSvelteMethods.tsx"],"names":[],"mappings":"AAEA,OAAO,EAEL,KAAK,eAAe,EACrB,MAAM,gBAAgB,CAAC;AAQxB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA8CG;AACH,wBAAgB,sBAAsB,CACpC,OAAO,SAAS,eAAe,CAAC,GAAG,EAAE,GAAG,EAAE,GAAG,EAAE,GAAG,CAAC,EAAE,EACrD,OAAO,EAAE,OAAO;;;;;;;;;EAcjB"}
@@ -0,0 +1,9 @@
1
+ export * from "./createLdoSvelteMethods.js";
2
+ export * from "./methods/useLdo.js";
3
+ export * from "./methods/useMatchObject.js";
4
+ export * from "./methods/useMatchSubject.js";
5
+ export * from "./methods/useResource.js";
6
+ export * from "./methods/useSubject.js";
7
+ export * from "./methods/useSubscribeToResource.js";
8
+ export * from "./methods/useLinkQuery.js";
9
+ //# sourceMappingURL=index.d.ts.map
@@ -1,7 +1,6 @@
1
- import { ConnectedLdoDataset, ConnectedLdoTransactionDataset, ConnectedPlugin } from '@ldo/connected';
2
- import { LdoBase, ShapeType } from '@ldo/ldo';
3
- import { SubjectNode } from '@ldo/rdf-utils';
4
-
1
+ import { type ConnectedLdoDataset, type ConnectedLdoTransactionDataset, type ConnectedPlugin } from "@ldo/connected";
2
+ import { type LdoBase, type ShapeType } from "@ldo/ldo";
3
+ import type { SubjectNode } from "@ldo/rdf-utils";
5
4
  /**
6
5
  * The methods returned by useLdo
7
6
  */
@@ -56,5 +55,5 @@ export interface UseLdoMethods<Plugins extends ConnectedPlugin[]> {
56
55
  * @internal
57
56
  * Creates the useLdoHook
58
57
  */
59
- export declare function createUseLdo<Plugins extends ConnectedPlugin[]>(dataset: ConnectedLdoDataset<Plugins>): void;
58
+ export declare function createUseLdo<Plugins extends ConnectedPlugin[]>(dataset: ConnectedLdoDataset<Plugins>): () => UseLdoMethods<Plugins>;
60
59
  //# sourceMappingURL=useLdo.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"useLdo.d.ts","sourceRoot":"","sources":["../../../src/methods/useLdo.ts"],"names":[],"mappings":"AAAA,OAAO,EAEL,KAAK,mBAAmB,EACxB,KAAK,8BAA8B,EACnC,KAAK,eAAe,EACrB,MAAM,gBAAgB,CAAC;AACxB,OAAO,EAAE,KAAK,OAAO,EAAE,KAAK,SAAS,EAAE,MAAM,UAAU,CAAC;AACxD,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,gBAAgB,CAAC;AAElD;;GAEG;AACH,MAAM,WAAW,aAAa,CAAC,OAAO,SAAS,eAAe,EAAE;IAC9D;;OAEG;IACH,OAAO,EAAE,mBAAmB,CAAC,OAAO,CAAC,CAAC;IACtC;;;;;;;;;;OAUG;IACH,WAAW,EAAE,mBAAmB,CAAC,OAAO,CAAC,CAAC,aAAa,CAAC,CAAC;IACzD;;;;;OAKG;IACH,UAAU,EAAE,mBAAmB,CAAC,OAAO,CAAC,CAAC,YAAY,CAAC,CAAC;IACvD;;OAEG;IACH,UAAU,CAAC,IAAI,SAAS,OAAO,EAC7B,SAAS,EAAE,SAAS,CAAC,IAAI,CAAC,EAC1B,OAAO,EAAE,MAAM,GAAG,WAAW,GAC5B,IAAI,CAAC;IACR;;;;;;;;OAQG;IACH,UAAU,CAAC,IAAI,SAAS,OAAO,EAC7B,SAAS,EAAE,SAAS,CAAC,IAAI,CAAC,EAC1B,OAAO,EAAE,MAAM,GAAG,WAAW,EAC7B,QAAQ,EAAE,OAAO,CAAC,MAAM,CAAC,CAAC,OAAO,CAAC,CAAC,UAAU,CAAC,EAC9C,GAAG,mBAAmB,EAAE,OAAO,CAAC,MAAM,CAAC,CAAC,OAAO,CAAC,CAAC,UAAU,CAAC,EAAE,GAC7D,IAAI,CAAC;IACR;;OAEG;IACH,UAAU,CAAC,IAAI,SAAS,OAAO,EAC7B,KAAK,EAAE,IAAI,EACX,QAAQ,EAAE,OAAO,CAAC,MAAM,CAAC,CAAC,OAAO,CAAC,CAAC,UAAU,CAAC,EAC9C,GAAG,mBAAmB,EAAE,OAAO,CAAC,MAAM,CAAC,CAAC,OAAO,CAAC,CAAC,UAAU,CAAC,EAAE,GAC7D,IAAI,CAAC;IACR;;OAEG;IACH,UAAU,CACR,KAAK,EAAE,OAAO,GACb,UAAU,CAAC,8BAA8B,CAAC,OAAO,CAAC,CAAC,gBAAgB,CAAC,CAAC,CAAC;CAC1E;AAED;;;GAGG;AACH,wBAAgB,YAAY,CAAC,OAAO,SAAS,eAAe,EAAE,EAC5D,OAAO,EAAE,mBAAmB,CAAC,OAAO,CAAC,QAmEtC"}
1
+ {"version":3,"file":"useLdo.d.ts","sourceRoot":"","sources":["../../../src/methods/useLdo.ts"],"names":[],"mappings":"AAAA,OAAO,EAGL,KAAK,mBAAmB,EACxB,KAAK,8BAA8B,EACnC,KAAK,eAAe,EACrB,MAAM,gBAAgB,CAAC;AACxB,OAAO,EAAc,KAAK,OAAO,EAAE,KAAK,SAAS,EAAE,MAAM,UAAU,CAAC;AACpE,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,gBAAgB,CAAC;AAElD;;GAEG;AACH,MAAM,WAAW,aAAa,CAAC,OAAO,SAAS,eAAe,EAAE;IAC9D;;OAEG;IACH,OAAO,EAAE,mBAAmB,CAAC,OAAO,CAAC,CAAC;IACtC;;;;;;;;;;OAUG;IACH,WAAW,EAAE,mBAAmB,CAAC,OAAO,CAAC,CAAC,aAAa,CAAC,CAAC;IACzD;;;;;OAKG;IACH,UAAU,EAAE,mBAAmB,CAAC,OAAO,CAAC,CAAC,YAAY,CAAC,CAAC;IACvD;;OAEG;IACH,UAAU,CAAC,IAAI,SAAS,OAAO,EAC7B,SAAS,EAAE,SAAS,CAAC,IAAI,CAAC,EAC1B,OAAO,EAAE,MAAM,GAAG,WAAW,GAC5B,IAAI,CAAC;IACR;;;;;;;;OAQG;IACH,UAAU,CAAC,IAAI,SAAS,OAAO,EAC7B,SAAS,EAAE,SAAS,CAAC,IAAI,CAAC,EAC1B,OAAO,EAAE,MAAM,GAAG,WAAW,EAC7B,QAAQ,EAAE,OAAO,CAAC,MAAM,CAAC,CAAC,OAAO,CAAC,CAAC,UAAU,CAAC,EAC9C,GAAG,mBAAmB,EAAE,OAAO,CAAC,MAAM,CAAC,CAAC,OAAO,CAAC,CAAC,UAAU,CAAC,EAAE,GAC7D,IAAI,CAAC;IACR;;OAEG;IACH,UAAU,CAAC,IAAI,SAAS,OAAO,EAC7B,KAAK,EAAE,IAAI,EACX,QAAQ,EAAE,OAAO,CAAC,MAAM,CAAC,CAAC,OAAO,CAAC,CAAC,UAAU,CAAC,EAC9C,GAAG,mBAAmB,EAAE,OAAO,CAAC,MAAM,CAAC,CAAC,OAAO,CAAC,CAAC,UAAU,CAAC,EAAE,GAC7D,IAAI,CAAC;IACR;;OAEG;IACH,UAAU,CACR,KAAK,EAAE,OAAO,GACb,UAAU,CAAC,8BAA8B,CAAC,OAAO,CAAC,CAAC,gBAAgB,CAAC,CAAC,CAAC;CAC1E;AAED;;;GAGG;AACH,wBAAgB,YAAY,CAAC,OAAO,SAAS,eAAe,EAAE,EAC5D,OAAO,EAAE,mBAAmB,CAAC,OAAO,CAAC,SA+DX,aAAa,CAAC,OAAO,CAAC,CAGjD"}
@@ -1,7 +1,6 @@
1
- import { ConnectedLdoDataset, ConnectedPlugin, ExpandDeep, LQInput, LQReturn } from '@ldo/connected';
2
- import { LdoBase, ShapeType } from '@ldo/ldo';
3
- import { SubjectNode } from '@ldo/rdf-utils';
4
-
1
+ import type { ConnectedLdoDataset, ConnectedPlugin, ExpandDeep, LQInput, LQReturn } from "@ldo/connected";
2
+ import type { LdoBase, ShapeType } from "@ldo/ldo";
3
+ import type { SubjectNode } from "@ldo/rdf-utils";
5
4
  /**
6
5
  * @internal
7
6
  *
@@ -1,11 +1,11 @@
1
- import { LdoBase, LdSet, ShapeType } from '@ldo/ldo';
2
- import { QuadMatch } from '@ldo/rdf-utils';
3
- import { ConnectedLdoDataset, ConnectedPlugin } from '@ldo/connected';
4
-
1
+ import type { LdoBase, LdSet, ShapeType } from "@ldo/ldo";
2
+ import type { QuadMatch } from "@ldo/rdf-utils";
3
+ import type { ConnectedLdoDataset, ConnectedPlugin } from "@ldo/connected";
4
+ import type { Readable } from "svelte/store";
5
5
  /**
6
6
  * @internal
7
7
  *
8
8
  * Creates a useMatchObject function
9
9
  */
10
- export declare function createUseMatchObject<Plugins extends ConnectedPlugin[]>(dataset: ConnectedLdoDataset<Plugins>): <Type extends LdoBase>(shapeType: ShapeType<Type>, subject?: QuadMatch[0] | string, predicate?: QuadMatch[1] | string, graph?: QuadMatch[3] | string) => LdSet<Type>;
10
+ export declare function createUseMatchObject<Plugins extends ConnectedPlugin[]>(dataset: ConnectedLdoDataset<Plugins>): <Type extends LdoBase>(shapeType: ShapeType<Type>, subject?: QuadMatch[0] | string, predicate?: QuadMatch[1] | string, graph?: QuadMatch[3] | string) => Readable<LdSet<Type>>;
11
11
  //# sourceMappingURL=useMatchObject.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"useMatchObject.d.ts","sourceRoot":"","sources":["../../../src/methods/useMatchObject.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,OAAO,EAAc,KAAK,EAAE,SAAS,EAAE,MAAM,UAAU,CAAC;AACtE,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,gBAAgB,CAAC;AAChD,OAAO,KAAK,EAAE,mBAAmB,EAAE,eAAe,EAAE,MAAM,gBAAgB,CAAC;AAC3E,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,cAAc,CAAC;AAG7C;;;;GAIG;AACH,wBAAgB,oBAAoB,CAAC,OAAO,SAAS,eAAe,EAAE,EACpE,OAAO,EAAE,mBAAmB,CAAC,OAAO,CAAC,IAMN,IAAI,SAAS,OAAO,EACjD,WAAW,SAAS,CAAC,IAAI,CAAC,EAC1B,UAAU,SAAS,CAAC,CAAC,CAAC,GAAG,MAAM,EAC/B,YAAY,SAAS,CAAC,CAAC,CAAC,GAAG,MAAM,EACjC,QAAQ,SAAS,CAAC,CAAC,CAAC,GAAG,MAAM,KAC5B,QAAQ,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC,CAOzB"}
@@ -1,11 +1,11 @@
1
- import { LdoBase, LdSet, ShapeType } from '@ldo/ldo';
2
- import { QuadMatch } from '@ldo/rdf-utils';
3
- import { ConnectedLdoDataset, ConnectedPlugin } from '@ldo/connected';
4
-
1
+ import type { LdoBase, LdSet, ShapeType } from "@ldo/ldo";
2
+ import type { QuadMatch } from "@ldo/rdf-utils";
3
+ import type { ConnectedLdoDataset, ConnectedPlugin } from "@ldo/connected";
4
+ import type { Readable } from "svelte/store";
5
5
  /**
6
6
  * @internal
7
7
  *
8
8
  * Creates a useMatchSubject function.
9
9
  */
10
- export declare function createUseMatchSubject<Plugins extends ConnectedPlugin[]>(dataset: ConnectedLdoDataset<Plugins>): <Type extends LdoBase>(shapeType: ShapeType<Type>, predicate?: QuadMatch[1] | string, object?: QuadMatch[2] | string, graph?: QuadMatch[3] | string) => LdSet<Type>;
10
+ export declare function createUseMatchSubject<Plugins extends ConnectedPlugin[]>(dataset: ConnectedLdoDataset<Plugins>): <Type extends LdoBase>(shapeType: ShapeType<Type>, predicate?: QuadMatch[1] | string, object?: QuadMatch[2] | string, graph?: QuadMatch[3] | string) => Readable<LdSet<Type>>;
11
11
  //# sourceMappingURL=useMatchSubject.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"useMatchSubject.d.ts","sourceRoot":"","sources":["../../../src/methods/useMatchSubject.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,OAAO,EAAc,KAAK,EAAE,SAAS,EAAE,MAAM,UAAU,CAAC;AACtE,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,gBAAgB,CAAC;AAChD,OAAO,KAAK,EAAE,mBAAmB,EAAE,eAAe,EAAE,MAAM,gBAAgB,CAAC;AAE3E,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,cAAc,CAAC;AAE7C;;;;GAIG;AACH,wBAAgB,qBAAqB,CAAC,OAAO,SAAS,eAAe,EAAE,EACrE,OAAO,EAAE,mBAAmB,CAAC,OAAO,CAAC,IAML,IAAI,SAAS,OAAO,EAClD,WAAW,SAAS,CAAC,IAAI,CAAC,EAC1B,YAAY,SAAS,CAAC,CAAC,CAAC,GAAG,MAAM,EACjC,SAAS,SAAS,CAAC,CAAC,CAAC,GAAG,MAAM,EAC9B,QAAQ,SAAS,CAAC,CAAC,CAAC,GAAG,MAAM,KAC5B,QAAQ,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC,CAOzB"}
@@ -1,6 +1,5 @@
1
- import { ConnectedLdoDataset, ConnectedPlugin, GetResourceReturnType } from '@ldo/connected';
2
- import { Readable } from 'svelte/store';
3
-
1
+ import type { ConnectedLdoDataset, ConnectedPlugin, GetResourceReturnType } from "@ldo/connected";
2
+ import { type Readable } from "svelte/store";
4
3
  export interface UseResourceOptions<Name> {
5
4
  pluginName?: Name;
6
5
  suppressInitialRead?: boolean;
@@ -1,8 +1,8 @@
1
- import { SubjectNode } from '@ldo/rdf-utils';
2
- import { ShapeType, LdoBase } from '@ldo/ldo';
3
- import { ConnectedLdoDataset, ConnectedPlugin } from '@ldo/connected';
4
- import { Readable } from 'svelte/store';
5
-
1
+ import type { SubjectNode } from "@ldo/rdf-utils";
2
+ import type { ShapeType } from "@ldo/ldo";
3
+ import type { LdoBase } from "@ldo/ldo";
4
+ import type { ConnectedLdoDataset, ConnectedPlugin } from "@ldo/connected";
5
+ import type { Readable } from "svelte/store";
6
6
  export type useSubjectType = {
7
7
  <Type extends LdoBase>(shapeType: ShapeType<Type>, subject: string | SubjectNode): Readable<Type>;
8
8
  <Type extends LdoBase>(shapeType: ShapeType<Type>, subject?: string | SubjectNode): Readable<Type | undefined>;
@@ -1,5 +1,4 @@
1
- import { ConnectedLdoDataset, ConnectedPlugin } from '@ldo/connected';
2
-
1
+ import type { ConnectedLdoDataset, ConnectedPlugin } from "@ldo/connected";
3
2
  /**
4
3
  * @internal
5
4
  *
@@ -1,6 +1,6 @@
1
- import { LdoBuilder, LdoBase, LdoDataset, ShapeType } from '@ldo/ldo';
2
- import { Readable } from 'svelte/store';
3
-
1
+ import type { LdoBuilder } from "@ldo/ldo";
2
+ import type { LdoBase, LdoDataset, ShapeType } from "@ldo/ldo";
3
+ import { type Readable } from "svelte/store";
4
4
  /**
5
5
  * @internal
6
6
  *
package/package.json CHANGED
@@ -1,20 +1,28 @@
1
1
  {
2
2
  "name": "@ldo/svelte",
3
- "version": "1.0.0-alpha.11",
3
+ "version": "1.0.0-alpha.12",
4
4
  "description": "A Svelte library for LDO.",
5
- "main": "dist/index.js",
6
- "module": "dist/index.mjs",
7
- "svelte": "src/index.ts",
8
- "types": "dist/index.d.ts",
9
5
  "type": "module",
6
+ "main": "./dist/cjs/index.js",
7
+ "module": "./dist/esm/index.js",
8
+ "svelte": "src/index.ts",
9
+ "types": "./dist/types/index.d.ts",
10
+ "exports": {
11
+ ".": {
12
+ "types": "./dist/types/index.d.ts",
13
+ "import": "./dist/esm/index.js",
14
+ "require": "./dist/cjs/index.js"
15
+ },
16
+ "./package.json": "./package.json"
17
+ },
10
18
  "scripts": {
11
19
  "dev": "concurrently \"npm run dev:pod\" \"npm run dev:app\"",
12
- "dev:pod": "tsx ./example/test-server/runServer.ts",
20
+ "dev:pod": "vite-node ./example/test-server/runServer.ts",
13
21
  "dev:app": "vite --config vite.config.example.ts",
14
- "build": "rimraf dist && vite build",
15
- "build:example": "vite build --config vite.config.example.ts example",
16
- "test": "jest",
17
- "test:watch": "jest --watch",
22
+ "build": "rimraf dist && npm run build:cjs && npm run build:esm",
23
+ "build:cjs": "tsc --project tsconfig.cjs.json",
24
+ "build:esm": "tsc --project tsconfig.esm.json",
25
+ "test": "jest --coverage",
18
26
  "lint": "eslint . --ext .js,.ts,.svelte --fix --no-error-on-unmatched-pattern",
19
27
  "format": "prettier --write .",
20
28
  "prepublishOnly": "npm run build"
@@ -30,7 +38,7 @@
30
38
  },
31
39
  "homepage": "https://github.com/o-development/ldo/tree/main/packages/svelte#readme",
32
40
  "devDependencies": {
33
- "@ldo/test-solid-server": "^1.0.0-alpha.11",
41
+ "@ldo/test-solid-server": "^1.0.0-alpha.12",
34
42
  "@sveltejs/vite-plugin-svelte": "^2.5.3",
35
43
  "@testing-library/jest-dom": "^6.6.3",
36
44
  "@testing-library/svelte": "^5.2.7",
@@ -49,13 +57,14 @@
49
57
  "tslib": "^2.8.1",
50
58
  "typescript": "^5.8.3",
51
59
  "vite": "^4.5.0",
60
+ "vite-node": "^3.1.4",
52
61
  "vite-plugin-dts": "^3.8.1"
53
62
  },
54
63
  "peerDependencies": {
55
64
  "svelte": "^3.50.0"
56
65
  },
57
66
  "dependencies": {
58
- "@ldo/connected": "^1.0.0-alpha.11",
67
+ "@ldo/connected": "^1.0.0-alpha.12",
59
68
  "@ldo/jsonld-dataset-proxy": "^1.0.0-alpha.11",
60
69
  "@ldo/ldo": "^1.0.0-alpha.11",
61
70
  "@ldo/rdf-utils": "^1.0.0-alpha.11",
@@ -70,5 +79,5 @@
70
79
  "publishConfig": {
71
80
  "access": "public"
72
81
  },
73
- "gitHead": "84bd3d7cf0a1b28c5e20b019a6451973d69d0198"
82
+ "gitHead": "f8ad3ba5f617c781254094923248c386348225b3"
74
83
  }
@@ -1,10 +1,11 @@
1
1
  import {
2
+ changeData,
2
3
  // changeData,
3
4
  type ConnectedLdoDataset,
4
5
  type ConnectedLdoTransactionDataset,
5
6
  type ConnectedPlugin,
6
7
  } from "@ldo/connected";
7
- import { type LdoBase, type ShapeType } from "@ldo/ldo";
8
+ import { getDataset, type LdoBase, type ShapeType } from "@ldo/ldo";
8
9
  import type { SubjectNode } from "@ldo/rdf-utils";
9
10
 
10
11
  /**
@@ -79,69 +80,68 @@ export interface UseLdoMethods<Plugins extends ConnectedPlugin[]> {
79
80
  export function createUseLdo<Plugins extends ConnectedPlugin[]>(
80
81
  dataset: ConnectedLdoDataset<Plugins>,
81
82
  ) {
82
- throw new Error("Not Implemented");
83
- // const toReturn = {
84
- // dataset,
85
- // /**
86
- // * Gets a resource
87
- // */
88
- // getResource: dataset.getResource.bind(dataset),
89
- // /**
90
- // * Set the context
91
- // */
92
- // setContext: dataset.setContext.bind(dataset),
93
- // /**
94
- // * Returns a Linked Data Object for a subject
95
- // * @param shapeType The shape type for the data
96
- // * @param subject Subject Node
97
- // * @returns A Linked Data Object
98
- // */
99
- // getSubject<Type extends LdoBase>(
100
- // shapeType: ShapeType<Type>,
101
- // subject: string | SubjectNode,
102
- // ): Type {
103
- // return dataset.usingType(shapeType).fromSubject(subject);
104
- // },
105
- // /**
106
- // * Begins tracking changes to eventually commit for a new subject
107
- // * @param shapeType The shape type that defines the created data
108
- // * @param subject The RDF subject for a Linked Data Object
109
- // * @param resources Any number of resources to which this data should be written
110
- // * @returns A Linked Data Object to modify and commit
111
- // */
112
- // createData<Type extends LdoBase>(
113
- // shapeType: ShapeType<Type>,
114
- // subject: string | SubjectNode,
115
- // resource: Plugins[number]["types"]["resource"],
116
- // ...additionalResources: Plugins[number]["types"]["resource"][]
117
- // ): Type {
118
- // return dataset.createData(
119
- // shapeType,
120
- // subject,
121
- // resource,
122
- // ...additionalResources,
123
- // );
124
- // },
125
- // /**
126
- // * Begins tracking changes to eventually commit
127
- // * @param input A linked data object to track changes on
128
- // * @param resources
129
- // */
130
- // changeData: changeData,
131
- // /**
132
- // * Commits the transaction to the global dataset, syncing all subscribing
133
- // * components and Solid Pods
134
- // */
135
- // commitData(
136
- // input: LdoBase,
137
- // ): ReturnType<ConnectedLdoTransactionDataset<Plugins>["commitToRemote"]> {
138
- // const inputDataset = getDataset(
139
- // input,
140
- // ) as ConnectedLdoTransactionDataset<Plugins>;
141
- // return inputDataset.commitToRemote();
142
- // },
143
- // };
144
- // return function useLdo(): UseLdoMethods<Plugins> {
145
- // throw new Error("Not Implemented");
146
- // };
83
+ const toReturn = {
84
+ dataset,
85
+ /**
86
+ * Gets a resource
87
+ */
88
+ getResource: dataset.getResource.bind(dataset),
89
+ /**
90
+ * Set the context
91
+ */
92
+ setContext: dataset.setContext.bind(dataset),
93
+ /**
94
+ * Returns a Linked Data Object for a subject
95
+ * @param shapeType The shape type for the data
96
+ * @param subject Subject Node
97
+ * @returns A Linked Data Object
98
+ */
99
+ getSubject<Type extends LdoBase>(
100
+ shapeType: ShapeType<Type>,
101
+ subject: string | SubjectNode,
102
+ ): Type {
103
+ return dataset.usingType(shapeType).fromSubject(subject);
104
+ },
105
+ /**
106
+ * Begins tracking changes to eventually commit for a new subject
107
+ * @param shapeType The shape type that defines the created data
108
+ * @param subject The RDF subject for a Linked Data Object
109
+ * @param resources Any number of resources to which this data should be written
110
+ * @returns A Linked Data Object to modify and commit
111
+ */
112
+ createData<Type extends LdoBase>(
113
+ shapeType: ShapeType<Type>,
114
+ subject: string | SubjectNode,
115
+ resource: Plugins[number]["types"]["resource"],
116
+ ...additionalResources: Plugins[number]["types"]["resource"][]
117
+ ): Type {
118
+ return dataset.createData(
119
+ shapeType,
120
+ subject,
121
+ resource,
122
+ ...additionalResources,
123
+ );
124
+ },
125
+ /**
126
+ * Begins tracking changes to eventually commit
127
+ * @param input A linked data object to track changes on
128
+ * @param resources
129
+ */
130
+ changeData: changeData,
131
+ /**
132
+ * Commits the transaction to the global dataset, syncing all subscribing
133
+ * components and Solid Pods
134
+ */
135
+ commitData(
136
+ input: LdoBase,
137
+ ): ReturnType<ConnectedLdoTransactionDataset<Plugins>["commitToRemote"]> {
138
+ const inputDataset = getDataset(
139
+ input,
140
+ ) as ConnectedLdoTransactionDataset<Plugins>;
141
+ return inputDataset.commitToRemote();
142
+ },
143
+ };
144
+ return function useLdo(): UseLdoMethods<Plugins> {
145
+ return toReturn;
146
+ };
147
147
  }
@@ -29,6 +29,6 @@ export function createUseLinkQuery<Plugins extends ConnectedPlugin[]>(
29
29
  startingSubject: SubjectNode | string,
30
30
  linkQuery: QueryInput,
31
31
  ): ExpandDeep<LQReturn<Type, QueryInput>> | undefined {
32
- throw new Error("Not Implemented");
32
+ throw new Error("Link Query is Not Implemented for Svelte");
33
33
  };
34
34
  }