@ng-org/orm 0.1.2-alpha.11 → 0.1.2-alpha.13

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 (33) hide show
  1. package/README.md +96 -39
  2. package/dist/connector/discrete/discreteOrmSubscriptionHandler.d.ts +9 -5
  3. package/dist/connector/discrete/discreteOrmSubscriptionHandler.d.ts.map +1 -1
  4. package/dist/connector/discrete/discreteOrmSubscriptionHandler.js +20 -12
  5. package/dist/connector/getObjects.d.ts +2 -2
  6. package/dist/connector/getObjects.d.ts.map +1 -1
  7. package/dist/connector/getObjects.js +4 -3
  8. package/dist/connector/initNg.d.ts +4 -13
  9. package/dist/connector/initNg.d.ts.map +1 -1
  10. package/dist/connector/initNg.js +1 -1
  11. package/dist/connector/insertObject.d.ts +2 -1
  12. package/dist/connector/insertObject.d.ts.map +1 -1
  13. package/dist/connector/insertObject.js +2 -1
  14. package/dist/connector/ormSubscriptionHandler.d.ts +9 -6
  15. package/dist/connector/ormSubscriptionHandler.d.ts.map +1 -1
  16. package/dist/connector/ormSubscriptionHandler.js +18 -10
  17. package/dist/core.d.ts +10 -0
  18. package/dist/core.d.ts.map +1 -0
  19. package/dist/core.js +17 -0
  20. package/dist/frontendAdapters/react/useShape.d.ts +1 -1
  21. package/dist/frontendAdapters/react/useShape.js +1 -1
  22. package/dist/frontendAdapters/svelte/useShape.svelte.d.ts +1 -1
  23. package/dist/frontendAdapters/svelte/useShape.svelte.js +1 -1
  24. package/dist/frontendAdapters/svelte4/useDiscrete.svelte.d.ts +1 -1
  25. package/dist/frontendAdapters/svelte4/useDiscrete.svelte.js +1 -1
  26. package/dist/frontendAdapters/svelte4/useShape.svelte.d.ts +1 -1
  27. package/dist/frontendAdapters/svelte4/useShape.svelte.js +1 -1
  28. package/dist/index.d.ts +2 -10
  29. package/dist/index.d.ts.map +1 -1
  30. package/dist/index.js +2 -9
  31. package/dist/types.d.ts +1 -1
  32. package/dist/types.d.ts.map +1 -1
  33. package/package.json +30 -29
package/README.md CHANGED
@@ -13,7 +13,7 @@ For a walk-through you can see the the expense-tracker example apps for [discret
13
13
  Different CRDTs have different APIs. We want to make it as easy as possible to use them in the same way:\
14
14
  **You modify a plain old TypeScript object and that updates the CRDT.**\
15
15
  Vice versa, the CRDT is modified and that is reflected in your TS object.\
16
- We offer this for **React, Vue, and Svelte**.
16
+ We offer this for **React, Vue, and Svelte (5 and 4)**.
17
17
 
18
18
  Note that we support discrete (**JSON**) CRDT and graph (**RDF**) CRDT ORMs.
19
19
 
@@ -22,14 +22,19 @@ 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)
25
27
  - [Installation](#installation)
26
28
  - [Start](#start)
27
- - [Graph ORM: Defining Schemas](#graph-orm-defining-schemas)
29
+ - [RDF (graph) ORM: Defining Schemas](#rdf-graph-orm-defining-schemas)
28
30
  - [Frontend Framework Usage](#frontend-framework-usage)
29
31
  - [Working with Data](#working-with-data)
30
- - [Creating a Document](#creating-a-document)
31
- - [Using and Modifying ORM Objects](#using-and-modifying-orm-objects)
32
- - [Graph ORM: Relationships](#graph-orm-relationships)
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)
33
38
 
34
39
  ---
35
40
 
@@ -49,7 +54,22 @@ pnpm add -D @ng-org/shex-orm
49
54
 
50
55
  ## Start
51
56
 
52
- You are strongly advised to look at the example apps for [discrete JSON documents](https://git.nextgraph.org/NextGraph/expense-tracker-discrete) and [typed graph documents](https://git.nextgraph.org/NextGraph/expense-tracker-graph).
57
+ 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
+
59
+ - Discrete CRDTs [all frameworks running in the same window with Astro](https://git.nextgraph.org/NextGraph/expense-tracker-discrete)
60
+ - [Svelte 5](https://git.nextgraph.org/NextGraph/expense-tracker-discrete-svelte)
61
+ - [Svelte 4](https://git.nextgraph.org/NextGraph/expense-tracker-discrete-svelte4) (no support for Svelte 3)
62
+ - [Vue](https://git.nextgraph.org/NextGraph/expense-tracker-discrete-vue)
63
+ - [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)
65
+ - [Svelte 5](https://git.nextgraph.org/NextGraph/expense-tracker-graph-svelte)
66
+ - [Svelte 4](https://git.nextgraph.org/NextGraph/expense-tracker-graph-svelte4) (no support for Svelte 3)
67
+ - [Vue](https://git.nextgraph.org/NextGraph/expense-tracker-graph-vue)
68
+ - [React](https://git.nextgraph.org/NextGraph/expense-tracker-graph-react)
69
+
70
+ The app looks the same in all implementations. You can see that the `useShape()` and `useDiscrete()` frontend hooks that interact with the data, share the same syntax across all frameworks.
71
+
72
+ ---
53
73
 
54
74
  Before using the ORM, initialize NextGraph in your app entry point:
55
75
 
@@ -57,9 +77,14 @@ Before using the ORM, initialize NextGraph in your app entry point:
57
77
  import { ng, init } from "@ng-org/web";
58
78
  import { initNg } from "@ng-org/orm";
59
79
 
80
+ // Call init as early as possible when your app loads.
81
+ // At the first call, it will redirect the user to login with their wallet.
82
+ // In that case, there is no need to render the rest of the app.
83
+ // Then your app will reload, and this time, this call back will be called:
60
84
  await init(
61
85
  async (event) => {
62
- // The ORM needs to have access to ng, the interface to the engine running in WASM.
86
+ // The ORM needs to have access to ng,
87
+ // the interface to the engine running in WASM.
63
88
  initNg(ng, event.session);
64
89
  },
65
90
  true,
@@ -67,19 +92,7 @@ await init(
67
92
  );
68
93
  ```
69
94
 
70
- Then use `useShape()` for graphs, or `useDiscrete()` for discrete documents.
71
-
72
- In some cases, you may want to use advanced features managing subscriptions with the engine.
73
- With an OrmSubscription, you can manage things like transactions manually.
74
- This is useful for example when you want to manage a state across components.
75
- See [`OrmSubscription.getOrCreate(ShapeType, scope)`](#getorcreate-1) for graphs
76
- and [`DiscreteOrmSubscription.getOrCreate(documentId)`](#getorcreate) for discrete documents.
77
-
78
- Internally, the OrmSubscription keeps a signalObject, a proxied, reactive object. When modifications are made, this makes the frontend components rerender and sends the update to the engine to be persisted.
79
-
80
- In all cases, you have to create a document first with `ng.doc_create()`.
81
-
82
- ## Graph ORM: Defining Schemas
95
+ ## RDF (graph) ORM: Defining Schemas
83
96
 
84
97
  Define your data model using [SHEX (Shape Expressions)](https://shex.io/):
85
98
  See [@ng-org/shex-orm](../shex-orm/README.md) for details.
@@ -87,7 +100,7 @@ See [@ng-org/shex-orm](../shex-orm/README.md) for details.
87
100
  **`shapes/shex/dogShape.shex`**:
88
101
 
89
102
  ```shex
90
- PREFIX ex: <http://example.org/>
103
+ PREFIX ex: <did:ng:z:>
91
104
  PREFIX xsd: <http://www.w3.org/2001/XMLSchema#>
92
105
 
93
106
  ex:Dog {
@@ -95,45 +108,52 @@ ex:Dog {
95
108
  ex:name xsd:string ;
96
109
  ex:age xsd:integer ? ;
97
110
  ex:toys xsd:string * ;
111
+ ex:owner IRI ? ;
98
112
  }
99
113
  ```
100
114
 
101
- Generate TypeScript types. Add the following to your `package.json` scripts and run `build:orm`:
115
+ Add the following to your `package.json` scripts and run `build:orm` (assuming you installed `@ng-org/shex-orm` as dev dependency):
102
116
 
103
117
  ```json
104
118
  "build:orm": "rdf-orm build --input ./src/shapes/shex --output ./src/shapes/orm"
105
119
  ```
106
120
 
121
+ This will generate three files: one for TypeScript type definitions, one with generated schemas, and one that exports objects with the schema, type definition and shape name: The so called _shape types_. When you request data from the engine, you will pass a shape type in your request that defines what your object looks like.
122
+
107
123
  ## Frontend Framework Usage
108
124
 
109
125
  The SDK offers hooks for discrete and graph-based CRDTs for Svelte, Vue and React:
110
126
 
111
127
  - discrete CRDTs for
112
128
  - Svelte 5: [useDiscrete](#svelteusediscrete)
113
- - Svelte 3/4: [useDiscrete](#svelte4usediscrete)
129
+ - Svelte 4: [useDiscrete](#svelte4usediscrete)
114
130
  - Vue: [useDiscrete](#vueusediscrete)
115
131
  - React: [useDiscrete](#reactusediscrete)
116
132
  - graph CRDTs for:
117
133
  - Svelte 5: [useShape](#svelteuseshape)
118
- - Svelte 3/4: [useShape](#svelte4useshape)
134
+ - Svelte 4: [useShape](#svelte4useshape)
119
135
  - Vue: [useShape](#vueuseshape)
120
136
  - React: [useShape](#reactuseshape)
121
137
 
122
- All of them have the same logic. They create a 2-way binding to the engine.
138
+ All of them share the same logic. They create a 2-way binding to the engine.
123
139
  You can modify the returned object like any other JSON object. Changes are immediately
124
- reflected in the CRDT and the components rerender.
140
+ reflected in the CRDT and the components refresh.
125
141
  When the component unmounts, the subscription is closed.
126
142
 
127
143
  ```ts
128
144
  // Queries the graphs with NURI did:ng:o:g1 and did:ng:o:g2 and with subject s1 or s2.
129
- const expenses: DeepSignal<Set<Expense>> = useShape(ExpenseShapeType, {
145
+ const expenses = useShape(ExpenseShapeType, {
130
146
  graphs: ["did:ng:o:g1", "did:ng:o:g2"],
131
147
  subjects: ["<s1 IRI>", "<s2 IRI>"],
132
148
  });
149
+ // Note: While the returned `expenses` object has type `DeepSignal<Set<Expense>>`, you can treat and type it as `Set<Expense>` as well, for convenience.
150
+
151
+ // Now you can use expenses in your component
152
+ // and modify them to trigger a refresh and persist them.
133
153
 
134
- // Use expenses in your component
135
- // and modify them to trigger a rerender and persist them.
136
- // ...
154
+ // In analogy:
155
+ const expense: DeepSignal<Expense[]> = useDiscrete(expenseDocumentNuri);
156
+ // Note: While the returned `expenses` object has type `DeepSignal<Expense[]>`, you can treat and type it as `Expense[]` as well, for convenience.
137
157
  ```
138
158
 
139
159
  ---
@@ -143,7 +163,7 @@ const expenses: DeepSignal<Set<Expense>> = useShape(ExpenseShapeType, {
143
163
  The ORM is designed to make working with data as normal as possible.
144
164
  You get an object as you are used to it and when you change properties,
145
165
  they are automatically persisted and synced with other devices. Conversely,
146
- modifications arrive at the ORM objects immediately and your components rerender.
166
+ modifications coming from other devices update the ORM objects too and your components refresh.
147
167
 
148
168
  ### Creating a Document
149
169
 
@@ -168,7 +188,7 @@ await ng.sparql_update(
168
188
  );
169
189
  ```
170
190
 
171
- To find your document, you can make a sparql query as well:
191
+ To find your document NURI, you make a sparql query:
172
192
 
173
193
  ```ts
174
194
  const ret = await ng.sparql_query(
@@ -184,9 +204,31 @@ let documentId = ret?.results.bindings?.[0]?.storeId?.value;
184
204
 
185
205
  There are multiple ways to get and modify data:
186
206
 
187
- - Get and modify the data returned by a `useShape()` or `useDiscrete()` hook inside a component.
188
- - Get and modify the signalObject of the subscription returned by `Orm(Discrete)Subscription.getOrCreate()`.
189
- - For graph ORMs: Call [`insertObject()`](#insertobject) or [`getObjects`](#getobjects) (no 2-way binding).
207
+ - Get and modify the signalObject of the subscription returned by [`Orm(Discrete)Subscription.getOrCreate()`](#the-discreteormsubscription-class).
208
+ - Get and modify the data returned by a `useShape()` or `useDiscrete()` hook inside of a component.
209
+ - For graph ORMs (no 2-way binding):
210
+ - [`getObjects(shapeType, scope)`](#getobjects) Gets all object with the given shape type within the `scope`. The returned objects are _not_ `DeepSignal` objects - modifications to them do not trigger updates and changes from other sources do not update the returned object.
211
+ - [`insertObject(shapeType, object)`](#insertobject): A convenience function to add objects of a given shape to the database. While with `useShape()` and `OrmSubscription`, you can just add objects to the returned set or `subscription.signalObject`, respectively.
212
+ This function spares you of creating an `OrmSubscription` and can be used outside of components, where you can't call `useShape`.
213
+
214
+ ### The (Discrete)OrmSubscription Class
215
+
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
+
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.
220
+
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
+
223
+ ### Transactions
224
+
225
+ To improve performance, you can start transactions with subscriptions using `.beginTransaction()` and `.commitTransaction()`. This will delay the persistence until `.commitTransaction()` is called. Transactions do not affect updates to the frontend and incoming updates from the engine / other devices. When more than one reference to a subscription exists, the transaction affects all of them.
226
+
227
+ Note that even in non-transaction mode, changes are batched and only committed after the current task finished. The changes are sent to the engine in a [microtask](https://developer.mozilla.org/en-US/docs/Web/API/HTML_DOM_API/Microtask_guide). You can end the current task and flush, for example, by awaiting a promise: `await Promise.resolve()`.
228
+
229
+ Note that you can use the signal object of an orm subscription (e.g. `myOrmSubscription.signalObject`) in components too. For that, you need to use `useDeepSignal(signalObject)` from the package `@ng-org/alien-deepsignals/svelte|vue|react`. This can be useful to keep a connection open over the lifetime of a component and to avoid the loading time when creating new subscriptions.
230
+
231
+ Example of using an OrmSubscription:
190
232
 
191
233
  ```typescript
192
234
  const dogSubscription = OrmSubscription.getOrCreate(DogShape, {
@@ -194,7 +236,7 @@ const dogSubscription = OrmSubscription.getOrCreate(DogShape, {
194
236
  });
195
237
  await dogSubscription.readyPromise;
196
238
 
197
- // If we used OrmDiscreteSubscription, the signalObject type would be array or object.
239
+ // If we used OrmDiscreteSubscription, the signalObject type would be an array or object.
198
240
  const dogSet: DeepSignal<Set<Dog>> = dogSubscription.signalObject;
199
241
 
200
242
  dogs.add({
@@ -214,12 +256,26 @@ aDog.toy.add("bone");
214
256
 
215
257
  // Utility to find objects in sets:
216
258
  const sameDog = dogs.getBy(aDog["@graph"], aDog["@id"]);
217
- // sameSog === aDog.
259
+ // sameDog === aDog.
218
260
 
219
261
  dogs.delete(aDog);
220
262
  ```
221
263
 
222
- Note that the graph CRDT supports sets only, the discrete CRDTs arrays only.
264
+ Note that the RDF CRDT supports sets only, the discrete CRDTs arrays only.
265
+
266
+ #### The DeepSignal<> type
267
+
268
+ Data returned by the ORM is of type `DeepSignal<T>`. It behaves like plain objects of type `T` but with some extras. Under the hood, the object is proxied. The proxy tracks modifications and will immediately update the frontend and propagate to the engine.
269
+
270
+ In your code however, you _do not have to to wrap your type definitions in `DeepSignal<>`_. Nevertheless, it can be instructive for TypeScript to show you the additional utilities that DeepSignal objects expose. Also, it might keep you aware that modifications you make to those objects are persisted and that they update the frontend.
271
+ The utilities that DeepSignal objects include are:
272
+
273
+ - For sets (with the RDF ORM):
274
+ - iterator helper methods (e.g. `map()`, `filter()`, `reduce()`, `any()`, ...)
275
+ - `first()` to get one element from the set -- useful if you know that there is only one.
276
+ - `getBy(graphNuri: string, subjectIri: string)`, to find objects by their graph NURI and subject IRI.
277
+ - **NOTE**: When assigning a set to `DeepSignal<Set>`, TypeScript will warn you. You can safely ignore this by writing (`parent.children = new Set() as DeepSignal<Set<any>>`). Internally, the set is automatically converted but this is not expressible in TypeScript.
278
+ - For all objects: `__raw__` which gives you the non-proxied object without tracking value access and without triggering updates upon modifications. Tracking value access is used in the frontend so it knows on what changes to refresh. If you use `__raw__`, that won't work anymore.
223
279
 
224
280
  #### Graph ORM: Relationships
225
281
 
@@ -231,9 +287,10 @@ casey.friends.add(jackNuri);
231
287
  // When the child object is a nested object that you do not have in memory,
232
288
  // you can establish the link by adding an object that contains the `@id` property only.
233
289
  shoppingExpense.category.add({ "@id": "<Subject IRI of expense category>" });
234
- // Link objects by storing the target's `@id` NURI/IRI:
235
290
 
291
+ // Link objects by storing the target's `@id` NURI/IRI:
236
292
  dog.owner = jackNuri;
293
+
237
294
  // Resolve the relationship
238
295
  const jack = people.find((p) => p["@id"] === dog.owner);
239
296
  ```
@@ -25,12 +25,12 @@ export declare class DiscreteOrmSubscription {
25
25
  private refCount;
26
26
  /** When true, modifications from the signalObject are not processed. */
27
27
  private suspendDeepWatcher;
28
- /** @readonly True, if a transaction is running. */
29
- inTransaction: boolean;
30
- /** Aggregation of patches to be sent when in transaction. */
31
- pendingPatches: Patch[] | undefined;
28
+ /** True, if a transaction is running. */
29
+ private inTransaction_;
30
+ /** Aggregation of patches to be sent when in transaction. @ignore */
31
+ private pendingPatches;
32
32
  /** **Await to ensure that the subscription is established and the data arrived.** */
33
- readyPromise: Promise<void>;
33
+ private readyPromise_;
34
34
  private closeOrmSubscription;
35
35
  /** Function to call once initial data has been applied. */
36
36
  private resolveReady;
@@ -124,6 +124,10 @@ export declare class DiscreteOrmSubscription {
124
124
  * ```
125
125
  */
126
126
  static getOrCreate: <T extends BaseType>(documentId: string) => DiscreteOrmSubscription;
127
+ /** True, if a transaction is running. */
128
+ get inTransaction(): boolean;
129
+ /** **Await to ensure that the subscription is established and the data arrived.** */
130
+ get readyPromise(): Promise<void>;
127
131
  /**
128
132
  * Stop the subscription.
129
133
  *
@@ -1 +1 @@
1
- {"version":3,"file":"discreteOrmSubscriptionHandler.d.ts","sourceRoot":"","sources":["../../../src/connector/discrete/discreteOrmSubscriptionHandler.ts"],"names":[],"mappings":"AAUA,OAAO,EAAE,aAAa,EAAE,cAAc,EAAE,MAAM,gBAAgB,CAAC;AAC/D,OAAO,EAA4B,KAAK,EAAE,MAAM,oBAAoB,CAAC;AAQrE,OAAO,KAAK,EACR,SAAS,EACT,UAAU,EAEb,MAAM,2BAA2B,CAAC;AACnC,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,kBAAkB,CAAC;AASjD;;;;;;;;;GASG;AACH,qBAAa,uBAAuB;IAChC,kEAAkE;IAClE,OAAO,CAAC,MAAM,CAAC,SAAS,CAA8C;IAEtE,yDAAyD;IACzD,QAAQ,CAAC,UAAU,EAAE,MAAM,CAAC;IAC5B,OAAO,CAAC,aAAa,CAEL;IAChB,OAAO,CAAC,mBAAmB,CAA2B;IACtD,qFAAqF;IACrF,OAAO,CAAC,cAAc,CAAqB;IAC3C,kFAAkF;IAClF,OAAO,CAAC,QAAQ,CAAS;IACzB,wEAAwE;IACxE,OAAO,CAAC,kBAAkB,CAAU;IACpC,mDAAmD;IACnD,aAAa,EAAE,OAAO,CAAS;IAC/B,6DAA6D;IAC7D,cAAc,EAAE,KAAK,EAAE,GAAG,SAAS,CAAC;IACpC,qFAAqF;IACrF,YAAY,EAAE,OAAO,CAAC,IAAI,CAAC,CAAC;IAC5B,OAAO,CAAC,oBAAoB,CAAa;IACzC,2DAA2D;IAC3D,OAAO,CAAC,YAAY,CAAc;IAElC,OAAO;IA+BP;;;;;;;;OAQG;IACH,IAAW,YAAY,2DAEtB;IAED;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;OA6EG;IACH,OAAc,WAAW,GAAI,CAAC,SAAS,QAAQ,EAC3C,YAAY,MAAM,KACnB,uBAAuB,CAcxB;IAEF;;;;;;;;;OASG;IACI,KAAK,aASV;IAEF,wEAAwE;IACxE,OAAO,CAAC,oBAAoB,CAsB1B;IAEF,wEAAwE;IACxE,OAAO,CAAC,gBAAgB,CAStB;IAEF,OAAO,CAAC,qBAAqB,CAiB3B;IAEF,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"}
1
+ {"version":3,"file":"discreteOrmSubscriptionHandler.d.ts","sourceRoot":"","sources":["../../../src/connector/discrete/discreteOrmSubscriptionHandler.ts"],"names":[],"mappings":"AAUA,OAAO,EAAE,aAAa,EAAE,cAAc,EAAE,MAAM,gBAAgB,CAAC;AAC/D,OAAO,EAA4B,KAAK,EAAE,MAAM,oBAA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AAC,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"}
@@ -39,12 +39,12 @@ export class DiscreteOrmSubscription {
39
39
  refCount;
40
40
  /** When true, modifications from the signalObject are not processed. */
41
41
  suspendDeepWatcher;
42
- /** @readonly True, if a transaction is running. */
43
- inTransaction = false;
44
- /** Aggregation of patches to be sent when in transaction. */
42
+ /** True, if a transaction is running. */
43
+ inTransaction_ = false;
44
+ /** Aggregation of patches to be sent when in transaction. @ignore */
45
45
  pendingPatches;
46
46
  /** **Await to ensure that the subscription is established and the data arrived.** */
47
- readyPromise;
47
+ readyPromise_;
48
48
  closeOrmSubscription;
49
49
  /** Function to call once initial data has been applied. */
50
50
  resolveReady;
@@ -60,7 +60,7 @@ export class DiscreteOrmSubscription {
60
60
  this.closeOrmSubscription = () => { };
61
61
  this.suspendDeepWatcher = false;
62
62
  // Initialize per-entry readiness promise that resolves in setUpConnection
63
- this.readyPromise = new Promise((resolve) => {
63
+ this.readyPromise_ = new Promise((resolve) => {
64
64
  this.resolveReady = resolve;
65
65
  });
66
66
  ngSession.then(async ({ ng, session }) => {
@@ -177,6 +177,14 @@ export class DiscreteOrmSubscription {
177
177
  return newConnection;
178
178
  }
179
179
  };
180
+ /** True, if a transaction is running. */
181
+ get inTransaction() {
182
+ return this.inTransaction_;
183
+ }
184
+ /** **Await to ensure that the subscription is established and the data arrived.** */
185
+ get readyPromise() {
186
+ return this.readyPromise_;
187
+ }
180
188
  /**
181
189
  * Stop the subscription.
182
190
  *
@@ -203,13 +211,13 @@ export class DiscreteOrmSubscription {
203
211
  return;
204
212
  const ormPatches = deepPatchesToWasm(patches);
205
213
  // If in transaction, collect patches immediately (no await before).
206
- if (this.inTransaction) {
214
+ if (this.inTransaction_) {
207
215
  this.pendingPatches?.push(...ormPatches);
208
216
  return;
209
217
  }
210
218
  // Wait for session and subscription to be initialized.
211
219
  const { ng, session } = await ngSession;
212
- await this.readyPromise;
220
+ await this.readyPromise_;
213
221
  ng.discrete_orm_update(this.subscriptionId, ormPatches, session.session_id);
214
222
  };
215
223
  /** Handle messages coming from the engine (initial data or patches). */
@@ -255,9 +263,9 @@ export class DiscreteOrmSubscription {
255
263
  * Modifications keep being rendered instantly.
256
264
  */
257
265
  beginTransaction = () => {
258
- this.inTransaction = true;
266
+ this.inTransaction_ = true;
259
267
  this.pendingPatches = [];
260
- this.readyPromise.then(() => {
268
+ this.readyPromise_.then(() => {
261
269
  // Use a listener that immediately triggers on object modifications.
262
270
  // We don't need the deep-signal's batching (through microtasks) here.
263
271
  this.stopSignalListening?.();
@@ -271,12 +279,12 @@ export class DiscreteOrmSubscription {
271
279
  * @throws if no transaction is open.
272
280
  */
273
281
  commitTransaction = async () => {
274
- if (!this.inTransaction) {
282
+ if (!this.inTransaction_) {
275
283
  throw new Error("No transaction is open. Call `beginTransaction` first.");
276
284
  }
277
285
  const { ng, session } = await ngSession;
278
- await this.readyPromise;
279
- this.inTransaction = false;
286
+ await this.readyPromise_;
287
+ this.inTransaction_ = false;
280
288
  if (this.pendingPatches?.length == 0) {
281
289
  // Nothing to send to the backend.
282
290
  }
@@ -4,8 +4,8 @@ import { Scope } from "../types.ts";
4
4
  * Utility for retrieving objects once without establishing a two-way subscription.
5
5
  *
6
6
  * @param shapeType The shape type of the objects to be retrieved.
7
- * @param scope The scope of the objects to be retrieved.
7
+ * @param scope The scope of the objects to be retrieved as Scope object or as graph NURI string.
8
8
  * @returns A set of all objects matching the shape and scope
9
9
  */
10
- export declare function getObjects<T extends BaseType>(shapeType: ShapeType<T>, scope?: Scope): Promise<import("@ng-org/alien-deepsignals").DeepSignalSet<T>>;
10
+ export declare function getObjects<T extends BaseType>(shapeType: ShapeType<T>, scope: Scope | string): Promise<import("@ng-org/alien-deepsignals").DeepSignalSet<T>>;
11
11
  //# sourceMappingURL=getObjects.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"getObjects.d.ts","sourceRoot":"","sources":["../../src/connector/getObjects.ts"],"names":[],"mappings":"AAUA,OAAO,EAAE,QAAQ,EAAE,SAAS,EAAE,MAAM,kBAAkB,CAAC;AAEvD,OAAO,EAAE,KAAK,EAAE,MAAM,aAAa,CAAC;AAGpC;;;;;;GAMG;AACH,wBAAsB,UAAU,CAAC,CAAC,SAAS,QAAQ,EAC/C,SAAS,EAAE,SAAS,CAAC,CAAC,CAAC,EACvB,KAAK,GAAE,KAAU,iEAUpB"}
1
+ {"version":3,"file":"getObjects.d.ts","sourceRoot":"","sources":["../../src/connector/getObjects.ts"],"names":[],"mappings":"AAUA,OAAO,EAAE,QAAQ,EAAE,SAAS,EAAE,MAAM,kBAAkB,CAAC;AAEvD,OAAO,EAAkB,KAAK,EAAE,MAAM,aAAa,CAAC;AAGpD;;;;;;GAMG;AACH,wBAAsB,UAAU,CAAC,CAAC,SAAS,QAAQ,EAC/C,SAAS,EAAE,SAAS,CAAC,CAAC,CAAC,EACvB,KAAK,EAAE,KAAK,GAAG,MAAM,iEAaxB"}
@@ -8,16 +8,17 @@
8
8
  // according to those terms.
9
9
  // SPDX-License-Identifier: Apache-2.0 OR MIT
10
10
  import { OrmSubscription } from "./ormSubscriptionHandler.js";
11
+ import { normalizeScope } from "../types.js";
11
12
  import { deepClone } from "./utils.js";
12
13
  /**
13
14
  * Utility for retrieving objects once without establishing a two-way subscription.
14
15
  *
15
16
  * @param shapeType The shape type of the objects to be retrieved.
16
- * @param scope The scope of the objects to be retrieved.
17
+ * @param scope The scope of the objects to be retrieved as Scope object or as graph NURI string.
17
18
  * @returns A set of all objects matching the shape and scope
18
19
  */
19
- export async function getObjects(shapeType, scope = {}) {
20
- const connection = OrmSubscription.getOrCreate(shapeType, scope);
20
+ export async function getObjects(shapeType, scope) {
21
+ const connection = OrmSubscription.getOrCreate(shapeType, normalizeScope(scope));
21
22
  await connection.readyPromise;
22
23
  setTimeout(() => {
23
24
  connection.close();
@@ -1,22 +1,13 @@
1
- import * as NG from "@ng-org/lib-wasm";
2
- /** A NextGraph session with an engine. */
3
- export type Session = {
4
- session_id: string | number;
5
- protected_store_id: string;
6
- private_store_id: string;
7
- public_store_id: string;
8
- ng: typeof NG;
9
- [key: string]: unknown;
10
- };
1
+ import type { Session, NG } from "@ng-org/web";
11
2
  /** Resolves to the NG session and the ng implementation. */
12
3
  export declare const ngSession: Promise<{
13
- ng: typeof NG;
4
+ ng: NG;
14
5
  session: Session;
15
6
  }>;
16
7
  /**
17
8
  * Initialize the ORM by passing the ng implementation and session.
18
9
  *
19
- * **This is the first thing you need to to before using the ORM.**
10
+ * **This is the first thing you need to do before using the ORM.**
20
11
  *
21
12
  * @param ngImpl The NextGraph API, e.g. exported from `@ng-org/web`.
22
13
  * @param session The established NextGraph session.
@@ -42,5 +33,5 @@ export declare const ngSession: Promise<{
42
33
  * ```
43
34
  *
44
35
  */
45
- export declare function initNgSignals(ngImpl: typeof NG, session: Session): void;
36
+ export declare function initNgSignals(ngImpl: NG, session: Session): void;
46
37
  //# sourceMappingURL=initNg.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"initNg.d.ts","sourceRoot":"","sources":["../../src/connector/initNg.ts"],"names":[],"mappings":"AAUA,OAAO,KAAK,EAAE,MAAM,kBAAkB,CAAC;AAEvC,0CAA0C;AAC1C,MAAM,MAAM,OAAO,GAAG;IAClB,UAAU,EAAE,MAAM,GAAG,MAAM,CAAC;IAC5B,kBAAkB,EAAE,MAAM,CAAC;IAC3B,gBAAgB,EAAE,MAAM,CAAC;IACzB,eAAe,EAAE,MAAM,CAAC;IACxB,EAAE,EAAE,OAAO,EAAE,CAAC;IACd,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAAC;CAC1B,CAAC;AAIF,4DAA4D;AAC5D,eAAO,MAAM,SAAS;QAAqB,OAAO,EAAE;aAAW,OAAO;EAIrE,CAAC;AAEF;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA4BG;AACH,wBAAgB,aAAa,CAAC,MAAM,EAAE,OAAO,EAAE,EAAE,OAAO,EAAE,OAAO,QAEhE"}
1
+ {"version":3,"file":"initNg.d.ts","sourceRoot":"","sources":["../../src/connector/initNg.ts"],"names":[],"mappings":"AAUA,OAAO,KAAK,EAAE,OAAO,EAAE,EAAE,EAAE,MAAM,aAAa,CAAC;AAI/C,4DAA4D;AAC5D,eAAO,MAAM,SAAS;QAAqB,EAAE;aAAW,OAAO;EAI9D,CAAC;AAEF;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA4BG;AACH,wBAAgB,aAAa,CAAC,MAAM,EAAE,EAAE,EAAE,OAAO,EAAE,OAAO,QAEzD"}
@@ -15,7 +15,7 @@ export const ngSession = new Promise((resolve) => {
15
15
  /**
16
16
  * Initialize the ORM by passing the ng implementation and session.
17
17
  *
18
- * **This is the first thing you need to to before using the ORM.**
18
+ * **This is the first thing you need to do before using the ORM.**
19
19
  *
20
20
  * @param ngImpl The NextGraph API, e.g. exported from `@ng-org/web`.
21
21
  * @param session The established NextGraph session.
@@ -1,6 +1,7 @@
1
1
  import { BaseType, ShapeType } from "@ng-org/shex-orm";
2
2
  /**
3
- * Utility for adding ORM-typed objects to the database without the need for subscribing to documents.
3
+ * Utility for adding ORM-typed objects to the database without
4
+ * the need for subscribing to documents using an {@link OrmSubscription}.
4
5
  *
5
6
  * @param shapeType The shape type of the objects to be inserted.
6
7
  * @param object The object to be inserted.
@@ -1 +1 @@
1
- {"version":3,"file":"insertObject.d.ts","sourceRoot":"","sources":["../../src/connector/insertObject.ts"],"names":[],"mappings":"AAUA,OAAO,EAAE,QAAQ,EAAE,SAAS,EAAE,MAAM,kBAAkB,CAAC;AAGvD;;;;;GAKG;AACH,wBAAsB,YAAY,CAAC,CAAC,SAAS,QAAQ,EACjD,SAAS,EAAE,SAAS,CAAC,CAAC,CAAC,EACvB,MAAM,EAAE,CAAC,iBASZ"}
1
+ {"version":3,"file":"insertObject.d.ts","sourceRoot":"","sources":["../../src/connector/insertObject.ts"],"names":[],"mappings":"AAUA,OAAO,EAAE,QAAQ,EAAE,SAAS,EAAE,MAAM,kBAAkB,CAAC;AAGvD;;;;;;GAMG;AACH,wBAAsB,YAAY,CAAC,CAAC,SAAS,QAAQ,EACjD,SAAS,EAAE,SAAS,CAAC,CAAC,CAAC,EACvB,MAAM,EAAE,CAAC,iBASZ"}
@@ -9,7 +9,8 @@
9
9
  // SPDX-License-Identifier: Apache-2.0 OR MIT
10
10
  import { OrmSubscription } from "./ormSubscriptionHandler.js";
11
11
  /**
12
- * Utility for adding ORM-typed objects to the database without the need for subscribing to documents.
12
+ * Utility for adding ORM-typed objects to the database without
13
+ * the need for subscribing to documents using an {@link OrmSubscription}.
13
14
  *
14
15
  * @param shapeType The shape type of the objects to be inserted.
15
16
  * @param object The object to be inserted.
@@ -1,5 +1,4 @@
1
1
  import { type Scope } from "../types.ts";
2
- import { Patch } from "./applyPatches.ts";
3
2
  import type { DeepSignalSet } from "@ng-org/alien-deepsignals";
4
3
  import type { ShapeType, BaseType } from "@ng-org/shex-orm";
5
4
  /**
@@ -41,13 +40,13 @@ export declare class OrmSubscription<T extends BaseType> {
41
40
  /** Identifier as a combination of shape type and scope. Prevents duplications. */
42
41
  private identifier;
43
42
  /** When true, modifications from the signalObject are not processed. */
44
- suspendDeepWatcher: boolean;
43
+ private suspendDeepWatcher;
45
44
  /** True, if a transaction is running. */
46
- inTransaction: boolean;
47
- /** Aggregation of patches to be sent when in transaction. */
48
- pendingPatches: Patch[] | undefined;
45
+ private inTransaction_;
46
+ /** Aggregation of patches to be sent when in transaction. @ignore */
47
+ private pendingPatches;
49
48
  /** **Await to ensure that the subscription is established and the data arrived.** */
50
- readyPromise: Promise<void>;
49
+ private readyPromise_;
51
50
  private closeOrmSubscription;
52
51
  /** Function to call once initial data has been applied. */
53
52
  private resolveReady;
@@ -130,6 +129,10 @@ export declare class OrmSubscription<T extends BaseType> {
130
129
  * ```
131
130
  */
132
131
  static getOrCreate: <T_1 extends BaseType>(shapeType: ShapeType<T_1>, scope: Scope) => OrmSubscription<T_1>;
132
+ /** True, if a transaction is running. */
133
+ get inTransaction(): boolean;
134
+ /** **Await to ensure that the subscription is established and the data arrived.** */
135
+ get readyPromise(): Promise<void>;
133
136
  /**
134
137
  * Stop the subscription.
135
138
  *
@@ -1 +1 @@
1
- {"version":3,"file":"ormSubscriptionHandler.d.ts","sourceRoot":"","sources":["../../src/connector/ormSubscriptionHandler.ts"],"names":[],"mappings":"AAUA,OAAO,EAAkB,KAAK,KAAK,EAAE,MAAM,aAAa,CAAC;AACzD,OAAO,EAA4B,KAAK,EAAE,MAAM,mBAAmB,CAAC;AASpE,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,CAAC,KAAK,EAAE,KAAK,CAAC;IACtB;;;;;;;;;;;;OAYG;IACH,QAAQ,CAAC,YAAY,EAAE,aAAa,CAAC,CAAC,CAAC,CAAC;IACxC,OAAO,CAAC,mBAAmB,CAAa;IACxC,qFAAqF;IACrF,OAAO,CAAC,cAAc,CAAqB;IAC3C,kFAAkF;IAClF,OAAO,CAAC,QAAQ,CAAS;IACzB,kFAAkF;IAClF,OAAO,CAAC,UAAU,CAAS;IAC3B,wEAAwE;IACxE,kBAAkB,EAAE,OAAO,CAAC;IAC5B,yCAAyC;IACzC,aAAa,EAAE,OAAO,CAAS;IAC/B,6DAA6D;IAC7D,cAAc,EAAE,KAAK,EA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AgF;IAChF,OAAO,CAAC,yBAAyB,CAgD/B;IAEF;;;;;;OAMG;IACI,gBAAgB,aAarB;IAEF;;;OAGG;IACI,iBAAiB,sBAkCtB;CACL"}
@@ -59,11 +59,11 @@ export class OrmSubscription {
59
59
  /** When true, modifications from the signalObject are not processed. */
60
60
  suspendDeepWatcher;
61
61
  /** True, if a transaction is running. */
62
- inTransaction = false;
63
- /** Aggregation of patches to be sent when in transaction. */
62
+ inTransaction_ = false;
63
+ /** Aggregation of patches to be sent when in transaction. @ignore */
64
64
  pendingPatches;
65
65
  /** **Await to ensure that the subscription is established and the data arrived.** */
66
- readyPromise;
66
+ readyPromise_;
67
67
  closeOrmSubscription;
68
68
  /** Function to call once initial data has been applied. */
69
69
  resolveReady;
@@ -102,7 +102,7 @@ export class OrmSubscription {
102
102
  const { stopListening } = watchDeepSignal(this.signalObject, this.onSignalObjectUpdate);
103
103
  this.stopSignalListening = stopListening;
104
104
  // Set promise to be resolved when data arrived from engine.
105
- this.readyPromise = new Promise((resolve) => {
105
+ this.readyPromise_ = new Promise((resolve) => {
106
106
  this.resolveReady = resolve;
107
107
  });
108
108
  ngSession.then(async ({ ng, session }) => {
@@ -208,6 +208,14 @@ export class OrmSubscription {
208
208
  return newConnection;
209
209
  }
210
210
  };
211
+ /** True, if a transaction is running. */
212
+ get inTransaction() {
213
+ return this.inTransaction_;
214
+ }
215
+ /** **Await to ensure that the subscription is established and the data arrived.** */
216
+ get readyPromise() {
217
+ return this.readyPromise_;
218
+ }
211
219
  /**
212
220
  * Stop the subscription.
213
221
  *
@@ -235,13 +243,13 @@ export class OrmSubscription {
235
243
  return;
236
244
  const ormPatches = deepPatchesToWasm(patches);
237
245
  // If in transaction, collect patches immediately (no await before).
238
- if (this.inTransaction) {
246
+ if (this.inTransaction_) {
239
247
  this.pendingPatches?.push(...ormPatches);
240
248
  return;
241
249
  }
242
250
  // Wait for session and subscription to be initialized.
243
251
  const { ng, session } = await ngSession;
244
- await this.readyPromise;
252
+ await this.readyPromise_;
245
253
  ng.graph_orm_update(this.subscriptionId, ormPatches, session.session_id);
246
254
  };
247
255
  /** Handle messages coming from the engine (initial data or patches). */
@@ -335,7 +343,7 @@ export class OrmSubscription {
335
343
  * Modifications keep being rendered.
336
344
  */
337
345
  beginTransaction = () => {
338
- this.inTransaction = true;
346
+ this.inTransaction_ = true;
339
347
  this.pendingPatches = [];
340
348
  // Use a listener that immediately triggers on object modifications.
341
349
  // We don't need the deep-signal's batching (through microtasks) here.
@@ -348,12 +356,12 @@ export class OrmSubscription {
348
356
  * (started with `beginTransaction`) to the database.
349
357
  */
350
358
  commitTransaction = async () => {
351
- if (!this.inTransaction) {
359
+ if (!this.inTransaction_) {
352
360
  throw new Error("No transaction is open. Call `beginTransaction` first.");
353
361
  }
354
362
  const { ng, session } = await ngSession;
355
- await this.readyPromise;
356
- this.inTransaction = false;
363
+ await this.readyPromise_;
364
+ this.inTransaction_ = false;
357
365
  if (this.pendingPatches?.length == 0) {
358
366
  // Nothing to send to the engine.
359
367
  }
package/dist/core.d.ts ADDED
@@ -0,0 +1,10 @@
1
+ import { OrmSubscription } from "./connector/ormSubscriptionHandler.ts";
2
+ import { DiscreteOrmSubscription } from "./connector/discrete/discreteOrmSubscriptionHandler.ts";
3
+ import { initNgSignals, ngSession } from "./connector/initNg.ts";
4
+ import { insertObject } from "./connector/insertObject.ts";
5
+ import { getObjects } from "./connector/getObjects.ts";
6
+ export * from "./types.ts";
7
+ export type { DeepSignal, DeepSignalObject, DeepSignalSet, } from "@ng-org/alien-deepsignals";
8
+ export { getRaw, watch, effect } from "@ng-org/alien-deepsignals";
9
+ export { initNgSignals as initNg, ngSession, OrmSubscription, DiscreteOrmSubscription, insertObject, getObjects, };
10
+ //# sourceMappingURL=core.d.ts.map
@@ -0,0 +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"}
package/dist/core.js ADDED
@@ -0,0 +1,17 @@
1
+ // Copyright (c) 2026 Laurin Weger, Par le Peuple, NextGraph.org developers
2
+ // All rights reserved.
3
+ // Licensed under the Apache License, Version 2.0
4
+ // <LICENSE-APACHE2 or http://www.apache.org/licenses/LICENSE-2.0>
5
+ // or the MIT license <LICENSE-MIT or http://opensource.org/licenses/MIT>,
6
+ // at your option. All files in the project carrying such
7
+ // notice may not be copied, modified, or distributed except
8
+ // according to those terms.
9
+ // SPDX-License-Identifier: Apache-2.0 OR MIT
10
+ import { OrmSubscription } from "./connector/ormSubscriptionHandler.js";
11
+ import { DiscreteOrmSubscription } from "./connector/discrete/discreteOrmSubscriptionHandler.js";
12
+ import { initNgSignals, ngSession } from "./connector/initNg.js";
13
+ import { insertObject } from "./connector/insertObject.js";
14
+ import { getObjects } from "./connector/getObjects.js";
15
+ export * from "./types.js";
16
+ export { getRaw, watch, effect } from "@ng-org/alien-deepsignals";
17
+ export { initNgSignals as initNg, ngSession, OrmSubscription, DiscreteOrmSubscription, insertObject, getObjects, };
@@ -24,7 +24,7 @@ import { DeepSignalSet } from "@ng-org/alien-deepsignals";
24
24
  * () => {
25
25
  * expenses.add({
26
26
  * "@graph": `<graph NURI>`,
27
- * "@type": "http://example.org/Expense",
27
+ * "@type": "did:ng:z:Expense",
28
28
  * "@id": "", // Assigns ID automatically, if set to "".
29
29
  * title: "New expense",
30
30
  * dateOfPurchase: obj.dateOfPurchase ?? new Date().toISOString(),
@@ -34,7 +34,7 @@ import { readOnlySet } from "../utils.js";
34
34
  * () => {
35
35
  * expenses.add({
36
36
  * "@graph": `<graph NURI>`,
37
- * "@type": "http://example.org/Expense",
37
+ * "@type": "did:ng:z:Expense",
38
38
  * "@id": "", // Assigns ID automatically, if set to "".
39
39
  * title: "New expense",
40
40
  * dateOfPurchase: obj.dateOfPurchase ?? new Date().toISOString(),
@@ -29,7 +29,7 @@ import { DeepSignalSet } from "@ng-org/alien-deepsignals";
29
29
  * const createExpense = () => {
30
30
  * expenses.add({
31
31
  * "@graph": `<graph NURI>`,
32
- * "@type": "http://example.org/Expense",
32
+ * "@type": "did:ng:z:Expense",
33
33
  * "@id": "", // Assigns ID automatically, if set to "".
34
34
  * title: "New expense",
35
35
  * dateOfPurchase: obj.dateOfPurchase ?? new Date().toISOString(),
@@ -40,7 +40,7 @@ import { readOnlySet } from "../utils.js";
40
40
  * const createExpense = () => {
41
41
  * expenses.add({
42
42
  * "@graph": `<graph NURI>`,
43
- * "@type": "http://example.org/Expense",
43
+ * "@type": "did:ng:z:Expense",
44
44
  * "@id": "", // Assigns ID automatically, if set to "".
45
45
  * title: "New expense",
46
46
  * dateOfPurchase: obj.dateOfPurchase ?? new Date().toISOString(),
@@ -1,7 +1,7 @@
1
1
  import { UseDeepSignalResult } from "@ng-org/alien-deepsignals/svelte4";
2
2
  import { DiscreteRoot } from "../../types.ts";
3
3
  /**
4
- * Svelte 3/4 hook to subscribe to discrete (JSON) CRDT documents.
4
+ * Svelte 4 hook to subscribe to discrete (JSON) CRDT documents.
5
5
  * You can modify the returned object like any other JSON object. Changes are immediately
6
6
  * reflected in the CRDT.
7
7
  *
@@ -11,7 +11,7 @@ import { onDestroy } from "svelte";
11
11
  import { useDeepSignal, } from "@ng-org/alien-deepsignals/svelte4";
12
12
  import { DiscreteOrmSubscription } from "../../connector/discrete/discreteOrmSubscriptionHandler.js";
13
13
  /**
14
- * Svelte 3/4 hook to subscribe to discrete (JSON) CRDT documents.
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
16
16
  * reflected in the CRDT.
17
17
  *
@@ -6,7 +6,7 @@ export interface UseShapeStoreResult<T = object> extends UseDeepSignalResult<T>
6
6
  root: any;
7
7
  }
8
8
  /**
9
- * Svelte 3/4 hook to subscribe to RDF data in the graph database using a shape, see {@link ShapeType}.
9
+ * Svelte 4 hook to subscribe to RDF data in the graph database using a shape, see {@link ShapeType}.
10
10
  *
11
11
  * Returns a {@link DeepSignalSet} store containing the objects matching the shape and that are within the scope.
12
12
  * Establishes a 2-way binding: Modifications to the object are immediately committed,
@@ -13,7 +13,7 @@ import { useDeepSignal, } from "@ng-org/alien-deepsignals/svelte4";
13
13
  import { OrmSubscription } from "../../connector/ormSubscriptionHandler.js";
14
14
  import { readOnlySet } from "../utils.js";
15
15
  /**
16
- * Svelte 3/4 hook to subscribe to RDF data in the graph database using a shape, see {@link ShapeType}.
16
+ * Svelte 4 hook to subscribe to RDF data in the graph database using a shape, see {@link ShapeType}.
17
17
  *
18
18
  * Returns a {@link DeepSignalSet} store containing the objects matching the shape and that are within the scope.
19
19
  * Establishes a 2-way binding: Modifications to the object are immediately committed,
package/dist/index.d.ts CHANGED
@@ -1,15 +1,7 @@
1
- import { OrmSubscription } from "./connector/ormSubscriptionHandler.ts";
2
- import { DiscreteOrmSubscription } from "./connector/discrete/discreteOrmSubscriptionHandler.ts";
3
1
  import { useShape as svelteUseShape, useDiscrete as svelteUseDiscrete } from "./frontendAdapters/svelte/index.ts";
4
2
  import { useShape as svelte4UseShape, useDiscrete as svelte4UseDiscrete, type UseShapeStoreResult as Svelte4UseShapeStoreResult } from "./frontendAdapters/svelte4/index.ts";
5
3
  import { useShape as reactUseShape, useDiscrete as reactUseDiscrete } from "./frontendAdapters/react/index.ts";
6
4
  import { useShape as vueUseShape, useDiscrete as vueUseDiscrete } from "./frontendAdapters/vue/index.ts";
7
- import { initNgSignals, ngSession, type Session } from "./connector/initNg.ts";
8
- import { insertObject } from "./connector/insertObject.ts";
9
- import { getObjects } from "./connector/getObjects.ts";
10
- export * from "./connector/applyPatches.ts";
11
- export * from "./types.ts";
12
- export type { DeepSignal, DeepSignalObject, DeepSignalSet, } from "@ng-org/alien-deepsignals";
13
- export { getRaw, watch, effect } from "@ng-org/alien-deepsignals";
14
- export { initNgSignals as initNg, ngSession, type Session, OrmSubscription as OrmSubscription, DiscreteOrmSubscription, svelteUseShape, svelteUseDiscrete, svelte4UseShape, svelte4UseDiscrete, Svelte4UseShapeStoreResult, reactUseShape, reactUseDiscrete, vueUseShape, vueUseDiscrete, insertObject, getObjects, };
5
+ export * from "./core.ts";
6
+ export { svelteUseShape, svelteUseDiscrete, svelte4UseShape, svelte4UseDiscrete, Svelte4UseShapeStoreResult, reactUseShape, reactUseDiscrete, vueUseShape, vueUseDiscrete, };
15
7
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAUA,OAAO,EAAE,eAAe,EAAE,MAAM,uCAAuC,CAAC;AACxE,OAAO,EAAE,uBAAuB,EAAE,MAAM,wDAAwD,CAAC;AACjG,OAAO,EACH,QAAQ,IAAI,cAAc,EAC1B,WAAW,IAAI,iBAAiB,EACnC,MAAM,oCAAoC,CAAC;AAC5C,OAAO,EACH,QAAQ,IAAI,eAAe,EAC3B,WAAW,IAAI,kBAAkB,EACjC,KAAK,mBAAmB,IAAI,0BAA0B,EACzD,MAAM,qCAAqC,CAAC;AAC7C,OAAO,EACH,QAAQ,IAAI,aAAa,EACzB,WAAW,IAAI,gBAAgB,EAClC,MAAM,mCAAmC,CAAC;A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Ac,EACd,iBAAiB,EACjB,eAAe,EACf,kBAAkB,EAClB,0BAA0B,EAC1B,aAAa,EACb,gBAAgB,EAChB,WAAW,EACX,cAAc,GACjB,CAAC"}
package/dist/index.js CHANGED
@@ -7,16 +7,9 @@
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";
12
10
  import { useShape as svelteUseShape, useDiscrete as svelteUseDiscrete, } from "./frontendAdapters/svelte/index.js";
13
11
  import { useShape as svelte4UseShape, useDiscrete as svelte4UseDiscrete, } from "./frontendAdapters/svelte4/index.js";
14
12
  import { useShape as reactUseShape, useDiscrete as reactUseDiscrete, } from "./frontendAdapters/react/index.js";
15
13
  import { useShape as vueUseShape, useDiscrete as vueUseDiscrete, } from "./frontendAdapters/vue/index.js";
16
- import { initNgSignals, ngSession } from "./connector/initNg.js";
17
- import { insertObject } from "./connector/insertObject.js";
18
- import { getObjects } from "./connector/getObjects.js";
19
- export * from "./connector/applyPatches.js";
20
- export * from "./types.js";
21
- export { getRaw, watch, effect } from "@ng-org/alien-deepsignals";
22
- export { initNgSignals as initNg, ngSession, OrmSubscription as OrmSubscription, DiscreteOrmSubscription, svelteUseShape, svelteUseDiscrete, svelte4UseShape, svelte4UseDiscrete, reactUseShape, reactUseDiscrete, vueUseShape, vueUseDiscrete, insertObject, getObjects, };
14
+ export * from "./core.js";
15
+ export { svelteUseShape, svelteUseDiscrete, svelte4UseShape, svelte4UseDiscrete, reactUseShape, reactUseDiscrete, vueUseShape, vueUseDiscrete, };
package/dist/types.d.ts CHANGED
@@ -33,7 +33,7 @@ export declare const normalizeScope: (scope?: Scope | string | undefined) => {
33
33
  graphs: string[];
34
34
  subjects: string[];
35
35
  };
36
- /** An allowed array in the CRDT. */
36
+ /** An allowed array in the CRDT. @ignore */
37
37
  export interface DiscreteArray extends Array<DiscreteType> {
38
38
  }
39
39
  /** An allowed object in the CRDT. */
@@ -1 +1 @@
1
- {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"AAUA;;;;;;;;;;;;;GAaG;AACH,MAAM,MAAM,KAAK,GAAG;IAChB;;;;;OAKG;IACH,MAAM,CAAC,EAAE,MAAM,EAAE,CAAC;IAElB;;OAEG;IACH,QAAQ,CAAC,EAAE,MAAM,EAAE,CAAC;CACvB,CAAC;AAEF;;;GAGG;AACH,eAAO,MAAM,cAAc,GAAI,QAAO,KAAK,GAAG,MAAM,GAAG,SAAc;;;CASpE,CAAC;AAEF,oCAAoC;AACpC,MAAM,WAAW,aAAc,SAAQ,KAAK,CAAC,YAAY,CAAC;CAAG;AAE7D,qCAAqC;AACrC,MAAM,WAAW,cAAc;IAC3B,CAAC,GAAG,EAAE,MAAM,GAAG,YAAY,CAAC;CAC/B;AACD,mCAAmC;AACnC,MAAM,MAAM,YAAY,GAClB,aAAa,GACb,cAAc,GACd,MAAM,GACN,MAAM,GACN,OAAO,CAAC;AAEd;;GAEG;AACH,MAAM,MAAM,iBAAiB,GAAG,CAC1B,aAAa,GACb,MAAM,GACN,MAAM,GACN,OAAO,GACP,CAAC,cAAc,GAAG;IAAE,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAA;CAAE,CAAC,CAClD,EAAE,CAAC;AAEJ;;GAEG;AACH,MAAM,WAAW,kBAAkB;IAC/B,CAAC,GAAG,EAAE,MAAM,GACN,cAAc,GACd,MAAM,GACN,MAAM,GACN,OAAO,GACP,iBAAiB,CAAC;CAC3B;AAED,uEAAuE;AACvE,MAAM,MAAM,YAAY,GAAG,iBAAiB,GAAG,kBAAkB,CAAC;AAElE;;;;GAIG;AACH,MAAM,MAAM,YAAY,GAAG,MAAM,GAAG,QAAQ,GAAG,WAAW,CAAC"}
1
+ {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"AAUA;;;;;;;;;;;;;GAaG;AACH,MAAM,MAAM,KAAK,GAAG;IAChB;;;;;OAKG;IACH,MAAM,CAAC,EAAE,MAAM,EAAE,CAAC;IAElB;;OAEG;IACH,QAAQ,CAAC,EAAE,MAAM,EAAE,CAAC;CACvB,CAAC;AAEF;;;GAGG;AACH,eAAO,MAAM,cAAc,GAAI,QAAO,KAAK,GAAG,MAAM,GAAG,SAAc;;;CASpE,CAAC;AAEF,4CAA4C;AAC5C,MAAM,WAAW,aAAc,SAAQ,KAAK,CAAC,YAAY,CAAC;CAAG;AAE7D,qCAAqC;AACrC,MAAM,WAAW,cAAc;IAC3B,CAAC,GAAG,EAAE,MAAM,GAAG,YAAY,CAAC;CAC/B;AACD,mCAAmC;AACnC,MAAM,MAAM,YAAY,GAClB,aAAa,GACb,cAAc,GACd,MAAM,GACN,MAAM,GACN,OAAO,CAAC;AAEd;;GAEG;AACH,MAAM,MAAM,iBAAiB,GAAG,CAC1B,aAAa,GACb,MAAM,GACN,MAAM,GACN,OAAO,GACP,CAAC,cAAc,GAAG;IAAE,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAA;CAAE,CAAC,CAClD,EAAE,CAAC;AAEJ;;GAEG;AACH,MAAM,WAAW,kBAAkB;IAC/B,CAAC,GAAG,EAAE,MAAM,GACN,cAAc,GACd,MAAM,GACN,MAAM,GACN,OAAO,GACP,iBAAiB,CAAC;CAC3B;AAED,uEAAuE;AACvE,MAAM,MAAM,YAAY,GAAG,iBAAiB,GAAG,kBAAkB,CAAC;AAElE;;;;GAIG;AACH,MAAM,MAAM,YAAY,GAAG,MAAM,GAAG,QAAQ,GAAG,WAAW,CAAC"}
package/package.json CHANGED
@@ -1,15 +1,19 @@
1
1
  {
2
2
  "name": "@ng-org/orm",
3
- "version": "0.1.2-alpha.11",
3
+ "version": "0.1.2-alpha.13",
4
4
  "private": false,
5
5
  "type": "module",
6
6
  "authors": [
7
7
  "Laurin Weger"
8
8
  ],
9
9
  "license": "MIT/Apache-2.0",
10
- "main": "./dist/index.js",
10
+ "main": "./dist/core.js",
11
11
  "exports": {
12
12
  ".": {
13
+ "types": "./dist/core.d.ts",
14
+ "default": "./dist/core.js"
15
+ },
16
+ "./all": {
13
17
  "types": "./dist/index.d.ts",
14
18
  "default": "./dist/index.js"
15
19
  },
@@ -33,47 +37,44 @@
33
37
  "publishConfig": {
34
38
  "access": "public"
35
39
  },
36
- "optionalDependencies": {
40
+ "peerDependencies": {
37
41
  "react": "^19.0.0 || ^18.0.0",
38
- "svelte": "^5.0.0",
42
+ "svelte": "^5.0.0 || ^4.0.0",
39
43
  "vue": "^3.0.0"
40
44
  },
45
+ "peerDependenciesMeta": {
46
+ "react": {
47
+ "optional": true
48
+ },
49
+ "svelte": {
50
+ "optional": true
51
+ },
52
+ "vue": {
53
+ "optional": true
54
+ }
55
+ },
41
56
  "dependencies": {
42
- "@gn8/alien-signals-react": "^0.1.1",
43
- "@gn8/alien-signals-solid": "^0.1.1",
44
- "@gn8/alien-signals-svelte": "^0.1.1",
45
- "@gn8/alien-signals-vue": "^0.1.1",
46
- "@types/react": "19.1.10",
47
- "@types/react-dom": "19.1.7",
48
- "@types/shexj": "^2.1.7",
49
- "alien-signals": "^2.0.7",
50
- "install": "^0.13.0",
51
- "npm": "^11.5.2",
52
- "prettier-eslint": "^16.4.2",
53
- "@ng-org/shex-orm": "0.1.2-alpha.5",
54
- "@ng-org/alien-deepsignals": "0.1.2-alpha.8"
57
+ "@ng-org/alien-deepsignals": "0.1.2-alpha.10"
55
58
  },
56
59
  "devDependencies": {
57
- "@playwright/test": "^1.55.0",
58
- "@types/node": "24.3.0",
59
- "@types/react": "19.1.10",
60
- "@types/react-dom": "19.1.7",
61
- "vite": "7.1.3",
60
+ "@types/react": "^19.1.10",
61
+ "@types/react-dom": "^19.1.7",
62
+ "vite": "7.3.1",
62
63
  "vitest": "^3.2.4",
63
64
  "typescript": "^5.3.0",
64
- "react": "19.1.1",
65
- "react-dom": "19.1.1",
66
- "svelte": "5.39.12",
67
- "vue": "3.5.19",
68
- "@ng-org/lib-wasm": "0.1.2-alpha.2"
65
+ "react": "^19.1.1",
66
+ "react-dom": "^19.1.1",
67
+ "svelte": "^5.39.12",
68
+ "vue": "^3.5.19",
69
+ "@ng-org/shex-orm": "0.1.2-alpha.7",
70
+ "@ng-org/web": "0.1.2-alpha.10"
69
71
  },
70
72
  "files": [
71
73
  "dist"
72
74
  ],
73
75
  "scripts": {
74
76
  "test": "vitest",
75
- "test:e2e": "playwright test",
76
77
  "build:ts": "rm -rf dist && tsc"
77
78
  },
78
- "types": "./dist/index.d.ts"
79
+ "types": "./dist/core.d.ts"
79
80
  }