@ng-org/orm 0.1.2-alpha.14 → 0.1.2-alpha.16

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 (38) hide show
  1. package/README.md +13 -13
  2. package/dist/connector/{discrete/discreteOrmSubscriptionHandler.d.ts → DiscreteOrmSubscription.d.ts} +3 -3
  3. package/dist/connector/DiscreteOrmSubscription.d.ts.map +1 -0
  4. package/dist/connector/{discrete/discreteOrmSubscriptionHandler.js → DiscreteOrmSubscription.js} +2 -2
  5. package/dist/connector/{ormSubscriptionHandler.d.ts → GraphOrmSubscription.d.ts} +1 -1
  6. package/dist/connector/GraphOrmSubscription.d.ts.map +1 -0
  7. package/dist/connector/{ormSubscriptionHandler.js → GraphOrmSubscription.js} +6 -6
  8. package/dist/connector/getObjects.js +1 -1
  9. package/dist/connector/insertObject.js +1 -1
  10. package/dist/core.d.ts +2 -2
  11. package/dist/core.d.ts.map +1 -1
  12. package/dist/core.js +2 -2
  13. package/dist/frontendAdapters/react/useDiscrete.js +1 -1
  14. package/dist/frontendAdapters/react/useShape.js +1 -1
  15. package/dist/frontendAdapters/svelte/useDiscrete.svelte.js +1 -1
  16. package/dist/frontendAdapters/svelte/useShape.svelte.js +1 -1
  17. package/dist/frontendAdapters/svelte4/useDiscrete.svelte.js +1 -1
  18. package/dist/frontendAdapters/svelte4/useShape.svelte.js +1 -1
  19. package/dist/frontendAdapters/vue/useDiscrete.js +1 -1
  20. package/dist/frontendAdapters/vue/useShape.js +1 -1
  21. package/dist/tests/shapes/orm/testShape.schema.d.ts +211 -0
  22. package/dist/tests/shapes/orm/testShape.schema.d.ts.map +1 -0
  23. package/dist/tests/shapes/orm/testShape.schema.js +279 -0
  24. package/dist/tests/shapes/orm/testShape.shapeTypes.d.ts +1041 -0
  25. package/dist/tests/shapes/orm/testShape.shapeTypes.d.ts.map +1 -0
  26. package/dist/tests/shapes/orm/testShape.shapeTypes.js +22 -0
  27. package/dist/tests/shapes/orm/testShape.typings.d.ts +190 -0
  28. package/dist/tests/shapes/orm/testShape.typings.d.ts.map +1 -0
  29. package/dist/tests/shapes/orm/testShape.typings.js +1 -0
  30. package/dist/types.d.ts +4 -3
  31. package/dist/types.d.ts.map +1 -1
  32. package/dist/types.js +3 -1
  33. package/dist/utilTypes.d.ts +2 -0
  34. package/dist/utilTypes.d.ts.map +1 -0
  35. package/dist/utilTypes.js +39 -0
  36. package/package.json +6 -5
  37. package/dist/connector/discrete/discreteOrmSubscriptionHandler.d.ts.map +0 -1
  38. package/dist/connector/ormSubscriptionHandler.d.ts.map +0 -1
package/README.md CHANGED
@@ -22,19 +22,17 @@ Note that we support discrete (**JSON**) CRDT and graph (**RDF**) CRDT ORMs.
22
22
 
23
23
  ## Table of Contents
24
24
 
25
- - [Reference documentation](#reference-documentation)
26
- - [Why?](#why)
27
25
  - [Installation](#installation)
28
26
  - [Start](#start)
29
27
  - [RDF (graph) ORM: Defining Schemas](#rdf-graph-orm-defining-schemas)
30
28
  - [Frontend Framework Usage](#frontend-framework-usage)
31
29
  - [Working with Data](#working-with-data)
32
- - [Creating a Document](#creating-a-document)
33
- - [Using and Modifying ORM Objects](#using-and-modifying-orm-objects)
34
- - [The (Discrete)OrmSubscription Class](#the-discreteormsubscription-class)
35
- - [Transactions](#transactions)
36
- - [The DeepSignal\<\> type](#the-deepsignal-type)
37
- - [Graph ORM: Relationships](#graph-orm-relationships)
30
+ - [Creating a Document](#creating-a-document)
31
+ - [Using and Modifying ORM Objects](#using-and-modifying-orm-objects)
32
+ - [The (Discrete)OrmSubscription Class](#the-discreteormsubscription-class)
33
+ - [Transactions](#transactions)
34
+ - [The DeepSignal\<\> type](#the-deepsignal-type)
35
+ - [Graph ORM: Relationships](#graph-orm-relationships)
38
36
 
39
37
  ---
40
38
 
@@ -56,12 +54,14 @@ pnpm add -D @ng-org/shex-orm
56
54
 
57
55
  Before writing your own app, you are strongly advised to look at the example apps below, where you can find framework and crdt-specific walkthroughs.
58
56
 
59
- - Discrete CRDTs [all frameworks running in the same window with Astro](https://git.nextgraph.org/NextGraph/expense-tracker-discrete)
57
+ - Discrete CRDTs
58
+ - [all frameworks running in the same window with Astro](https://git.nextgraph.org/NextGraph/expense-tracker-discrete)
60
59
  - [Svelte 5](https://git.nextgraph.org/NextGraph/expense-tracker-discrete-svelte)
61
60
  - [Svelte 4](https://git.nextgraph.org/NextGraph/expense-tracker-discrete-svelte4) (no support for Svelte 3)
62
61
  - [Vue](https://git.nextgraph.org/NextGraph/expense-tracker-discrete-vue)
63
62
  - [React](https://git.nextgraph.org/NextGraph/expense-tracker-discrete-react)
64
- - RDF CRDTs for [all frameworks running in the same window with Astro](https://git.nextgraph.org/NextGraph/expense-tracker-graph)
63
+ - RDF CRDT
64
+ - [all frameworks running in the same window with Astro](https://git.nextgraph.org/NextGraph/expense-tracker-graph)
65
65
  - [Svelte 5](https://git.nextgraph.org/NextGraph/expense-tracker-graph-svelte)
66
66
  - [Svelte 4](https://git.nextgraph.org/NextGraph/expense-tracker-graph-svelte4) (no support for Svelte 3)
67
67
  - [Vue](https://git.nextgraph.org/NextGraph/expense-tracker-graph-vue)
@@ -129,7 +129,7 @@ The SDK offers hooks for discrete and graph-based CRDTs for Svelte, Vue and Reac
129
129
  - Svelte 4: [useDiscrete](#svelte4usediscrete)
130
130
  - Vue: [useDiscrete](#vueusediscrete)
131
131
  - React: [useDiscrete](#reactusediscrete)
132
- - graph CRDTs for:
132
+ - graph CRDT for:
133
133
  - Svelte 5: [useShape](#svelteuseshape)
134
134
  - Svelte 4: [useShape](#svelte4useshape)
135
135
  - Vue: [useShape](#vueuseshape)
@@ -216,7 +216,7 @@ There are multiple ways to get and modify data:
216
216
  You can establish subscriptions outside of frontend components using the (Discrete)OrmSubscription class. DiscreteOrmSubscriptions are scoped to one document, (RDF-based) OrmSubscriptions can have a `Scope` of more than one document and require a shape type. Once a subscription is established, its `.readyPromise` resolves and the `.signalObject` contains the 2-way bound data.
217
217
 
218
218
  You can create a new subscription using `(Discrete)OrmSubscription.getOrCreate()`. If a subscription with the same document or scope exists already, a reference to that object is returned. Otherwise, a new one is created.
219
- The pooling is especially useful when more than one frontend component subscribes to the same data and scope by calling `useShape()` or `useDiscrete()`. This reduces load and the data is available instantly.
219
+ This pooling is especially useful when more than one frontend component subscribes to the same data and scope by calling `useShape()` or `useDiscrete()`. This reduces load and the data is available instantly.
220
220
 
221
221
  Subscriptions are open until `.close()` is called on all references of this object. The `useShape` and `useDiscrete` hooks call `.close()` on their reference when their component unmounts.
222
222
 
@@ -242,7 +242,7 @@ const dogSet: DeepSignal<Set<Dog>> = dogSubscription.signalObject;
242
242
  dogs.add({
243
243
  // Required: The document NURI. May be set to `""` for nested objects (will be inherited from parent object then).
244
244
  "@graph": docNuri,
245
- "@type": "did:ng:x:Dog", // Required: RDF type
245
+ "@type": "did:ng:z:Dog", // Required: RDF type
246
246
  "@id": "", // Empty string = auto-generate subject IRI
247
247
  name: "Mr Puppy",
248
248
  age: 2,
@@ -1,5 +1,5 @@
1
- import { DiscreteArray, DiscreteObject } from "../../types.ts";
2
- import { Patch } from "../applyPatches.ts";
1
+ import { DiscreteArray, DiscreteObject } from "../types.ts";
2
+ import { Patch } from "./applyPatches.ts";
3
3
  import type { DeepPatch, DeepSignal } from "@ng-org/alien-deepsignals";
4
4
  import type { BaseType } from "@ng-org/shex-orm";
5
5
  /**
@@ -169,4 +169,4 @@ export declare class DiscreteOrmSubscription {
169
169
  * @ignore
170
170
  */
171
171
  export declare function deepPatchesToWasm(patches: DeepPatch[]): Patch[];
172
- //# sourceMappingURL=discreteOrmSubscriptionHandler.d.ts.map
172
+ //# sourceMappingURL=DiscreteOrmSubscription.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"DiscreteOrmSubscription.d.ts","sourceRoot":"","sources":["../../src/connector/DiscreteOrmSubscription.ts"],"names":[],"mappings":"AAUA,OAAO,EAAE,aAAa,EAAE,cAAc,EAAE,MAAM,aAAa,CAAC;AAC5D,OAAO,EAA4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F,8CAA8C;IAC9C,OAAO,CAAC,eAAe,CAUrB;IAEF;;;;;;OAMG;IACI,gBAAgB,aAerB;IAEF;;;;OAIG;IACI,iBAAiB,sBAiCtB;CACL;AAED;;;;;;GAMG;AAEH,wBAAgB,iBAAiB,CAAC,OAAO,EAAE,SAAS,EAAE,GAAG,KAAK,EAAE,CAO/D"}
@@ -7,8 +7,8 @@
7
7
  // notice may not be copied, modified, or distributed except
8
8
  // according to those terms.
9
9
  // SPDX-License-Identifier: Apache-2.0 OR MIT
10
- import { applyPatchesToDeepSignal } from "../applyPatches.js";
11
- import { ngSession } from "../initNg.js";
10
+ import { applyPatchesToDeepSignal } from "./applyPatches.js";
11
+ import { ngSession } from "./initNg.js";
12
12
  import { deepSignal, watch as watchDeepSignal, } from "@ng-org/alien-deepsignals";
13
13
  /**
14
14
  * Delay in ms to wait before closing connection.\
@@ -167,4 +167,4 @@ export declare class OrmSubscription<T extends BaseType> {
167
167
  */
168
168
  commitTransaction: () => Promise<void>;
169
169
  }
170
- //# sourceMappingURL=ormSubscriptionHandler.d.ts.map
170
+ //# sourceMappingURL=GraphOrmSubscription.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"GraphOrmSubscription.d.ts","sourceRoot":"","sources":["../../src/connector/GraphOrmSubscription.ts"],"names":[],"mappings":"AAUA,OAAO,EAAmC,KAAK,KAAK,EAAE,MAAM,aAAa,CAAC;AAU1E,OAAO,KAAK,EAER,aAAa,EAEhB,MAAM,2BAA2B,CAAC;AACnC,OAAO,KAAK,EAAE,SAAS,EAAE,QAAQ,EAAE,MAAM,kBAAkB,CAAC;AAU5D;;;;;;;;;GASG;AACH,qBAAa,eAAe,CAAC,CAAC,SAAS,QAAQ;IAC3C,kEAAkE;IAClE,OAAO,CAAC,MAAM,CAAC,SAAS,CAA2C;IAEnE,4CAA4C;IAC5C,QAAQ,CAAC,SAAS,EAAE,SAAS,CAAC,CAAC,CAAC,CAAC;IACjC,6CAA6C;IAC7C,QAAQ,CAA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AGG;IACI,iBAAiB,sBAkCtB;CACL"}
@@ -85,12 +85,11 @@ export class OrmSubscription {
85
85
  // @ts-expect-error
86
86
  window.OrmSubscription = OrmSubscription;
87
87
  this.shapeType = shapeType;
88
- const normalizedScope = normalizeScope(scope);
89
- this.scope = normalizedScope;
88
+ this.scope = scope;
90
89
  this.refCount = 1;
91
90
  this.closeOrmSubscription = () => { };
92
91
  this.suspendDeepWatcher = false;
93
- this.identifier = `${shapeType.shape}|${canonicalScope(normalizedScope)}`;
92
+ this.identifier = `${shapeType.shape}|${canonicalScope(scope)}`;
94
93
  this.signalObject = deepSignal(new Set(), {
95
94
  propGenerator: this.signalObjectPropGenerator,
96
95
  // Don't set syntheticIdPropertyName - let propGenerator handle all ID logic
@@ -107,7 +106,7 @@ export class OrmSubscription {
107
106
  });
108
107
  ngSession.then(async ({ ng, session }) => {
109
108
  try {
110
- this.closeOrmSubscription = await ng.orm_start_graph(normalizedScope.graphs, normalizedScope.subjects, shapeType, session.session_id, this.onBackendMessage);
109
+ this.closeOrmSubscription = await ng.orm_start_graph(scope.graphs, scope.subjects, shapeType, session.session_id, this.onBackendMessage);
111
110
  }
112
111
  catch (e) {
113
112
  console.error(e);
@@ -191,7 +190,8 @@ export class OrmSubscription {
191
190
  * ```
192
191
  */
193
192
  static getOrCreate = (shapeType, scope) => {
194
- const scopeKey = canonicalScope(scope);
193
+ const normalizedScope = normalizeScope(scope);
194
+ const scopeKey = canonicalScope(normalizedScope);
195
195
  // Unique identifier for a given shape type and scope.
196
196
  const identifier = `${shapeType.shape}|${scopeKey}`;
197
197
  // If we already have an object for this shape+scope,
@@ -203,7 +203,7 @@ export class OrmSubscription {
203
203
  return existingConnection;
204
204
  }
205
205
  else {
206
- const newConnection = new OrmSubscription(shapeType, scope);
206
+ const newConnection = new OrmSubscription(shapeType, normalizedScope);
207
207
  OrmSubscription.idToEntry.set(identifier, newConnection);
208
208
  return newConnection;
209
209
  }
@@ -7,7 +7,7 @@
7
7
  // notice may not be copied, modified, or distributed except
8
8
  // according to those terms.
9
9
  // SPDX-License-Identifier: Apache-2.0 OR MIT
10
- import { OrmSubscription } from "./ormSubscriptionHandler.js";
10
+ import { OrmSubscription } from "./GraphOrmSubscription.js";
11
11
  import { normalizeScope } from "../types.js";
12
12
  import { deepClone } from "./utils.js";
13
13
  /**
@@ -7,7 +7,7 @@
7
7
  // notice may not be copied, modified, or distributed except
8
8
  // according to those terms.
9
9
  // SPDX-License-Identifier: Apache-2.0 OR MIT
10
- import { OrmSubscription } from "./ormSubscriptionHandler.js";
10
+ import { OrmSubscription } from "./GraphOrmSubscription.js";
11
11
  /**
12
12
  * Utility for adding ORM-typed objects to the database without
13
13
  * the need for subscribing to documents using an {@link OrmSubscription}.
package/dist/core.d.ts CHANGED
@@ -1,5 +1,5 @@
1
- import { OrmSubscription } from "./connector/ormSubscriptionHandler.ts";
2
- import { DiscreteOrmSubscription } from "./connector/discrete/discreteOrmSubscriptionHandler.ts";
1
+ import { OrmSubscription } from "./connector/GraphOrmSubscription.ts";
2
+ import { DiscreteOrmSubscription } from "./connector/DiscreteOrmSubscription.ts";
3
3
  import { initNgSignals, ngSession } from "./connector/initNg.ts";
4
4
  import { insertObject } from "./connector/insertObject.ts";
5
5
  import { getObjects } from "./connector/getObjects.ts";
@@ -1 +1 @@
1
- {"version":3,"file":"core.d.ts","sourceRoot":"","sources":["../src/core.ts"],"names":[],"mappings":"AAUA,OAAO,EAAE,eAAe,EAAE,MAAM,uCAAuC,CAAC;AACxE,OAAO,EAAE,uBAAuB,EAAE,MAAM,wDAAwD,CAAC;AACjG,OAAO,EAAE,aAAa,EAAE,SAAS,EAAE,MAAM,uBAAuB,CAAC;AACjE,OAAO,EAAE,YAAY,EAAE,MAAM,6BAA6B,CAAC;AAC3D,OAAO,EAAE,UAAU,EAAE,MAAM,2BAA2B,CAAC;AAEvD,cAAc,YAAY,CAAC;AAE3B,YAAY,EACR,UAAU,EACV,gBAAgB,EAChB,aAAa,GAChB,MAAM,2BAA2B,CAAC;AAEnC,OAAO,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,EAAE,MAAM,2BAA2B,CAAC;AAElE,OAAO,EACH,aAAa,IAAI,MAAM,EACvB,SAAS,EACT,eAAe,EACf,uBAAuB,EACvB,YAAY,EACZ,UAAU,GACb,CAAC"}
1
+ {"version":3,"file":"core.d.ts","sourceRoot":"","sources":["../src/core.ts"],"names":[],"mappings":"AAUA,OAAO,EAAE,eAAe,EAAE,MAAM,qCAAqC,CAAC;AACtE,OAAO,EAAE,uBAAuB,EAAE,MAAM,wCAAwC,CAAC;AACjF,OAAO,EAAE,aAAa,EAAE,SAAS,EAAE,MAAM,uBAAuB,CAAC;AACjE,OAAO,EAAE,YAAY,EAAE,MAAM,6BAA6B,CAAC;AAC3D,OAAO,EAAE,UAAU,EAAE,MAAM,2BAA2B,CAAC;AAEvD,cAAc,YAAY,CAAC;AAE3B,YAAY,EACR,UAAU,EACV,gBAAgB,EAChB,aAAa,GAChB,MAAM,2BAA2B,CAAC;AAEnC,OAAO,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,EAAE,MAAM,2BAA2B,CAAC;AAElE,OAAO,EACH,aAAa,IAAI,MAAM,EACvB,SAAS,EACT,eAAe,EACf,uBAAuB,EACvB,YAAY,EACZ,UAAU,GACb,CAAC"}
package/dist/core.js CHANGED
@@ -7,8 +7,8 @@
7
7
  // notice may not be copied, modified, or distributed except
8
8
  // according to those terms.
9
9
  // SPDX-License-Identifier: Apache-2.0 OR MIT
10
- import { OrmSubscription } from "./connector/ormSubscriptionHandler.js";
11
- import { DiscreteOrmSubscription } from "./connector/discrete/discreteOrmSubscriptionHandler.js";
10
+ import { OrmSubscription } from "./connector/GraphOrmSubscription.js";
11
+ import { DiscreteOrmSubscription } from "./connector/DiscreteOrmSubscription.js";
12
12
  import { initNgSignals, ngSession } from "./connector/initNg.js";
13
13
  import { insertObject } from "./connector/insertObject.js";
14
14
  import { getObjects } from "./connector/getObjects.js";
@@ -8,7 +8,7 @@
8
8
  // according to those terms.
9
9
  // SPDX-License-Identifier: Apache-2.0 OR MIT
10
10
  import { useEffect, useMemo, useRef } from "react";
11
- import { DiscreteOrmSubscription } from "../../connector/discrete/discreteOrmSubscriptionHandler.js";
11
+ import { DiscreteOrmSubscription } from "../../connector/DiscreteOrmSubscription.js";
12
12
  import { useDeepSignal } from "@ng-org/alien-deepsignals/react";
13
13
  const EMPTY_OBJECT = {};
14
14
  /**
@@ -10,7 +10,7 @@
10
10
  import { useDeepSignal } from "@ng-org/alien-deepsignals/react";
11
11
  import { useEffect, useMemo, useRef } from "react";
12
12
  import { normalizeScope } from "../../types.js";
13
- import { OrmSubscription } from "../../connector/ormSubscriptionHandler.js";
13
+ import { OrmSubscription } from "../../connector/GraphOrmSubscription.js";
14
14
  import { readOnlySet } from "../utils.js";
15
15
  /**
16
16
  * Hook to subscribe to RDF data in the graph database using a shape, see {@link ShapeType}.
@@ -9,7 +9,7 @@
9
9
  // SPDX-License-Identifier: Apache-2.0 OR MIT
10
10
  import { onDestroy } from "svelte";
11
11
  import { useDeepSignal } from "@ng-org/alien-deepsignals/svelte";
12
- import { DiscreteOrmSubscription } from "../../connector/discrete/discreteOrmSubscriptionHandler.js";
12
+ import { DiscreteOrmSubscription } from "../../connector/DiscreteOrmSubscription.js";
13
13
  /**
14
14
  * Svelte 5 hook to subscribe to existing discrete (JSON) CRDT documents.
15
15
  * You can modify the returned object like any other JSON object. Changes are immediately
@@ -10,7 +10,7 @@
10
10
  import { normalizeScope } from "../../types.js";
11
11
  import { onDestroy } from "svelte";
12
12
  import { useDeepSignal } from "@ng-org/alien-deepsignals/svelte";
13
- import { OrmSubscription } from "../../connector/ormSubscriptionHandler.js";
13
+ import { OrmSubscription } from "../../connector/GraphOrmSubscription.js";
14
14
  import { readOnlySet } from "../utils.js";
15
15
  /**
16
16
  * Svelte 5 hook to subscribe to RDF data in the graph database using a shape, see {@link ShapeType}.
@@ -9,7 +9,7 @@
9
9
  // SPDX-License-Identifier: Apache-2.0 OR MIT
10
10
  import { onDestroy } from "svelte";
11
11
  import { useDeepSignal, } from "@ng-org/alien-deepsignals/svelte4";
12
- import { DiscreteOrmSubscription } from "../../connector/discrete/discreteOrmSubscriptionHandler.js";
12
+ import { DiscreteOrmSubscription } from "../../connector/DiscreteOrmSubscription.js";
13
13
  /**
14
14
  * Svelte 4 hook to subscribe to discrete (JSON) CRDT documents.
15
15
  * You can modify the returned object like any other JSON object. Changes are immediately
@@ -10,7 +10,7 @@
10
10
  import { normalizeScope } from "../../types.js";
11
11
  import { onDestroy } from "svelte";
12
12
  import { useDeepSignal, } from "@ng-org/alien-deepsignals/svelte4";
13
- import { OrmSubscription } from "../../connector/ormSubscriptionHandler.js";
13
+ import { OrmSubscription } from "../../connector/GraphOrmSubscription.js";
14
14
  import { readOnlySet } from "../utils.js";
15
15
  /**
16
16
  * Svelte 4 hook to subscribe to RDF data in the graph database using a shape, see {@link ShapeType}.
@@ -9,7 +9,7 @@
9
9
  // SPDX-License-Identifier: Apache-2.0 OR MIT
10
10
  import { computed, onBeforeUnmount, shallowReactive, toRefs, toValue, watchEffect, } from "vue";
11
11
  import { useDeepSignal } from "@ng-org/alien-deepsignals/vue";
12
- import { DiscreteOrmSubscription } from "../../connector/discrete/discreteOrmSubscriptionHandler.js";
12
+ import { DiscreteOrmSubscription } from "../../connector/DiscreteOrmSubscription.js";
13
13
  /**
14
14
  * Hook to subscribe to an existing discrete (JSON) CRDT document.
15
15
  * You can modify the returned object like any other JSON object. Changes are immediately
@@ -10,7 +10,7 @@
10
10
  import { normalizeScope } from "../../types.js";
11
11
  import { useDeepSignal } from "@ng-org/alien-deepsignals/vue";
12
12
  import { onBeforeUnmount } from "vue";
13
- import { OrmSubscription } from "../../connector/ormSubscriptionHandler.js";
13
+ import { OrmSubscription } from "../../connector/GraphOrmSubscription.js";
14
14
  import { readOnlySet } from "../utils.js";
15
15
  /**
16
16
  * Hook to subscribe to RDF data in the graph database using a shape, see {@link ShapeType}.
@@ -0,0 +1,211 @@
1
+ /**
2
+ * =============================================================================
3
+ * testShapeSchema: Schema for testShape
4
+ * =============================================================================
5
+ */
6
+ export declare const testShapeSchema: {
7
+ readonly "did:ng:z:RootShape": {
8
+ readonly iri: "did:ng:z:RootShape";
9
+ readonly predicates: [{
10
+ readonly dataTypes: [{
11
+ readonly valType: "iri";
12
+ readonly literals: ["did:ng:z:Root"];
13
+ }];
14
+ readonly maxCardinality: 1;
15
+ readonly minCardinality: 1;
16
+ readonly iri: "http://www.w3.org/1999/02/22-rdf-syntax-ns#type";
17
+ readonly readablePredicate: "@type";
18
+ }, {
19
+ readonly dataTypes: [{
20
+ readonly valType: "string";
21
+ }];
22
+ readonly maxCardinality: 1;
23
+ readonly minCardinality: 1;
24
+ readonly iri: "did:ng:z:aString";
25
+ readonly readablePredicate: "aString";
26
+ }, {
27
+ readonly dataTypes: [{
28
+ readonly valType: "number";
29
+ }];
30
+ readonly maxCardinality: 1;
31
+ readonly minCardinality: 1;
32
+ readonly iri: "did:ng:z:anInteger";
33
+ readonly readablePredicate: "anInteger";
34
+ }, {
35
+ readonly dataTypes: [{
36
+ readonly valType: "string";
37
+ }];
38
+ readonly maxCardinality: 1;
39
+ readonly minCardinality: 1;
40
+ readonly iri: "did:ng:z:aDate";
41
+ readonly readablePredicate: "aDate";
42
+ }, {
43
+ readonly dataTypes: [{
44
+ readonly valType: "boolean";
45
+ }];
46
+ readonly maxCardinality: 1;
47
+ readonly minCardinality: 1;
48
+ readonly iri: "did:ng:z:aBoolean";
49
+ readonly readablePredicate: "aBoolean";
50
+ }, {
51
+ readonly dataTypes: [{
52
+ readonly valType: "boolean";
53
+ }, {
54
+ readonly valType: "string";
55
+ }];
56
+ readonly maxCardinality: 1;
57
+ readonly minCardinality: 1;
58
+ readonly iri: "did:ng:z:aStringOrBoolean";
59
+ readonly readablePredicate: "aStringOrBoolean";
60
+ }, {
61
+ readonly dataTypes: [{
62
+ readonly valType: "shape";
63
+ readonly shape: "did:ng:z:ChildShape1";
64
+ }, {
65
+ readonly valType: "shape";
66
+ readonly shape: "did:ng:z:ChildShape2";
67
+ }];
68
+ readonly maxCardinality: -1;
69
+ readonly minCardinality: 0;
70
+ readonly iri: "did:ng:z:children1Or2";
71
+ readonly readablePredicate: "children1Or2";
72
+ }, {
73
+ readonly dataTypes: [{
74
+ readonly valType: "shape";
75
+ readonly shape: "did:ng:z:ChildShape3";
76
+ }];
77
+ readonly maxCardinality: 1;
78
+ readonly minCardinality: 1;
79
+ readonly iri: "did:ng:z:child3";
80
+ readonly readablePredicate: "child3";
81
+ }];
82
+ };
83
+ readonly "did:ng:z:ChildShape1": {
84
+ readonly iri: "did:ng:z:ChildShape1";
85
+ readonly predicates: [{
86
+ readonly dataTypes: [{
87
+ readonly valType: "iri";
88
+ readonly literals: ["did:ng:z:MiruVideoEffectAsset"];
89
+ }];
90
+ readonly maxCardinality: 1;
91
+ readonly minCardinality: 1;
92
+ readonly iri: "http://www.w3.org/1999/02/22-rdf-syntax-ns#type";
93
+ readonly readablePredicate: "@type";
94
+ readonly extra: true;
95
+ }, {
96
+ readonly dataTypes: [{
97
+ readonly valType: "string";
98
+ }];
99
+ readonly maxCardinality: 1;
100
+ readonly minCardinality: 1;
101
+ readonly iri: "did:ng:z:childString";
102
+ readonly readablePredicate: "childString";
103
+ }, {
104
+ readonly dataTypes: [{
105
+ readonly valType: "boolean";
106
+ }];
107
+ readonly maxCardinality: 1;
108
+ readonly minCardinality: 1;
109
+ readonly iri: "did:ng:z:childBoolean";
110
+ readonly readablePredicate: "childBoolean";
111
+ }];
112
+ };
113
+ readonly "did:ng:z:ChildShape2": {
114
+ readonly iri: "did:ng:z:ChildShape2";
115
+ readonly predicates: [{
116
+ readonly dataTypes: [{
117
+ readonly valType: "iri";
118
+ readonly literals: ["did:ng:z:Child"];
119
+ }, {
120
+ readonly valType: "iri";
121
+ readonly literals: ["did:ng:z:Child2"];
122
+ }];
123
+ readonly maxCardinality: 1;
124
+ readonly minCardinality: 1;
125
+ readonly iri: "http://www.w3.org/1999/02/22-rdf-syntax-ns#type";
126
+ readonly readablePredicate: "@type";
127
+ readonly extra: true;
128
+ }, {
129
+ readonly dataTypes: [{
130
+ readonly valType: "string";
131
+ }];
132
+ readonly maxCardinality: 1;
133
+ readonly minCardinality: 1;
134
+ readonly iri: "did:ng:z:childString";
135
+ readonly readablePredicate: "childString";
136
+ }, {
137
+ readonly dataTypes: [{
138
+ readonly valType: "number";
139
+ }];
140
+ readonly maxCardinality: 1;
141
+ readonly minCardinality: 1;
142
+ readonly iri: "did:ng:z:childNumber:";
143
+ readonly readablePredicate: "childNumber";
144
+ }, {
145
+ readonly dataTypes: [{
146
+ readonly valType: "shape";
147
+ readonly shape: "did:ng:z:ChildChildShape";
148
+ }];
149
+ readonly maxCardinality: 1;
150
+ readonly minCardinality: 1;
151
+ readonly iri: "did:ng:z:childChild";
152
+ readonly readablePredicate: "childChild";
153
+ }];
154
+ };
155
+ readonly "did:ng:z:ChildShape3": {
156
+ readonly iri: "did:ng:z:ChildShape3";
157
+ readonly predicates: [{
158
+ readonly dataTypes: [{
159
+ readonly valType: "iri";
160
+ readonly literals: ["did:ng:z:Child2"];
161
+ }, {
162
+ readonly valType: "iri";
163
+ readonly literals: ["did:ng:z:Child"];
164
+ }];
165
+ readonly maxCardinality: 1;
166
+ readonly minCardinality: 1;
167
+ readonly iri: "http://www.w3.org/1999/02/22-rdf-syntax-ns#type";
168
+ readonly readablePredicate: "@type";
169
+ }, {
170
+ readonly dataTypes: [{
171
+ readonly valType: "boolean";
172
+ }];
173
+ readonly maxCardinality: 1;
174
+ readonly minCardinality: 1;
175
+ readonly iri: "did:ng:z:childBoolean:";
176
+ readonly readablePredicate: "childBoolean";
177
+ }, {
178
+ readonly dataTypes: [{
179
+ readonly valType: "shape";
180
+ readonly shape: "did:ng:z:ChildChildShape";
181
+ }];
182
+ readonly maxCardinality: 1;
183
+ readonly minCardinality: 1;
184
+ readonly iri: "did:ng:z:childChild";
185
+ readonly readablePredicate: "childChild";
186
+ }];
187
+ };
188
+ readonly "did:ng:z:ChildChildShape": {
189
+ readonly iri: "did:ng:z:ChildChildShape";
190
+ readonly predicates: [{
191
+ readonly dataTypes: [{
192
+ readonly valType: "iri";
193
+ readonly literals: ["did:ng:z:ChildChild"];
194
+ }];
195
+ readonly maxCardinality: 1;
196
+ readonly minCardinality: 1;
197
+ readonly iri: "http://www.w3.org/1999/02/22-rdf-syntax-ns#type";
198
+ readonly readablePredicate: "@type";
199
+ readonly extra: true;
200
+ }, {
201
+ readonly dataTypes: [{
202
+ readonly valType: "number";
203
+ }];
204
+ readonly maxCardinality: 1;
205
+ readonly minCardinality: 1;
206
+ readonly iri: "did:ng:z:childChildNum";
207
+ readonly readablePredicate: "childChildNum";
208
+ }];
209
+ };
210
+ };
211
+ //# sourceMappingURL=testShape.schema.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"testShape.schema.d.ts","sourceRoot":"","sources":["../../../../src/tests/shapes/orm/testShape.schema.ts"],"names":[],"mappings":"AAEA;;;;GAIG;AACH,eAAO,MAAM,eAAe;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAiRD,CAAC"}