@ng-org/orm 0.1.2-alpha.10 → 0.1.2-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.
- package/README.md +87 -31
- package/dist/connector/discrete/discreteOrmSubscriptionHandler.d.ts +9 -5
- package/dist/connector/discrete/discreteOrmSubscriptionHandler.d.ts.map +1 -1
- package/dist/connector/discrete/discreteOrmSubscriptionHandler.js +20 -12
- package/dist/connector/getObjects.d.ts +2 -2
- package/dist/connector/getObjects.d.ts.map +1 -1
- package/dist/connector/getObjects.js +4 -3
- package/dist/connector/initNg.d.ts +4 -12
- package/dist/connector/initNg.d.ts.map +1 -1
- package/dist/connector/initNg.js +1 -1
- package/dist/connector/insertObject.d.ts +2 -1
- package/dist/connector/insertObject.d.ts.map +1 -1
- package/dist/connector/insertObject.js +2 -1
- package/dist/connector/ormSubscriptionHandler.d.ts +9 -6
- package/dist/connector/ormSubscriptionHandler.d.ts.map +1 -1
- package/dist/connector/ormSubscriptionHandler.js +18 -10
- package/dist/core.d.ts +10 -0
- package/dist/core.d.ts.map +1 -0
- package/dist/core.js +17 -0
- package/dist/frontendAdapters/react/useDiscrete.d.ts +1 -1
- package/dist/frontendAdapters/react/useDiscrete.d.ts.map +1 -1
- package/dist/frontendAdapters/svelte/useDiscrete.svelte.d.ts +1 -1
- package/dist/frontendAdapters/svelte/useDiscrete.svelte.d.ts.map +1 -1
- package/dist/frontendAdapters/svelte4/index.d.ts +2 -2
- package/dist/frontendAdapters/svelte4/index.d.ts.map +1 -1
- package/dist/frontendAdapters/svelte4/useDiscrete.svelte.d.ts +3 -1
- package/dist/frontendAdapters/svelte4/useDiscrete.svelte.d.ts.map +1 -1
- package/dist/frontendAdapters/svelte4/useDiscrete.svelte.js +1 -1
- package/dist/frontendAdapters/svelte4/useShape.svelte.d.ts +3 -4
- package/dist/frontendAdapters/svelte4/useShape.svelte.d.ts.map +1 -1
- package/dist/frontendAdapters/vue/useDiscrete.d.ts +1 -1
- package/dist/frontendAdapters/vue/useDiscrete.d.ts.map +1 -1
- package/dist/index.d.ts +3 -11
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +2 -9
- package/dist/types.d.ts +1 -1
- package/dist/types.d.ts.map +1 -1
- package/package.json +30 -29
package/README.md
CHANGED
|
@@ -29,6 +29,8 @@ Note that we support discrete (**JSON**) CRDT and graph (**RDF**) CRDT ORMs.
|
|
|
29
29
|
- [Working with Data](#working-with-data)
|
|
30
30
|
- [Creating a Document](#creating-a-document)
|
|
31
31
|
- [Using and Modifying ORM Objects](#using-and-modifying-orm-objects)
|
|
32
|
+
- [The (Discrete)OrmSubscription Class](#the-discreteormsubscription-class)
|
|
33
|
+
- [The DeepSignal\<\> type](#the-deepsignal-type)
|
|
32
34
|
- [Graph ORM: Relationships](#graph-orm-relationships)
|
|
33
35
|
|
|
34
36
|
---
|
|
@@ -49,7 +51,24 @@ pnpm add -D @ng-org/shex-orm
|
|
|
49
51
|
|
|
50
52
|
## Start
|
|
51
53
|
|
|
52
|
-
|
|
54
|
+
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.
|
|
55
|
+
|
|
56
|
+
- Discrete CRDTs
|
|
57
|
+
- [all frameworks running in the same window with Astro](https://git.nextgraph.org/NextGraph/expense-tracker-discrete)
|
|
58
|
+
- [Svelte 5 Runes](https://git.nextgraph.org/NextGraph/expense-tracker-discrete-svelte)
|
|
59
|
+
- [Svelte 3/4](https://git.nextgraph.org/NextGraph/expense-tracker-discrete-svelte4)
|
|
60
|
+
- [Vue](https://git.nextgraph.org/NextGraph/expense-tracker-discrete-vue)
|
|
61
|
+
- [React](https://git.nextgraph.org/NextGraph/expense-tracker-discrete-react)
|
|
62
|
+
- RDF/Graph CRDT
|
|
63
|
+
- [all frameworks running in the same window with Astro](https://git.nextgraph.org/NextGraph/expense-tracker-graph)
|
|
64
|
+
- [Svelte 5 Runes](https://git.nextgraph.org/NextGraph/expense-tracker-graph-svelte)
|
|
65
|
+
- [Svelte 3/4](https://git.nextgraph.org/NextGraph/expense-tracker-graph-svelte4)
|
|
66
|
+
- [Vue](https://git.nextgraph.org/NextGraph/expense-tracker-graph-vue)
|
|
67
|
+
- [React](https://git.nextgraph.org/NextGraph/expense-tracker-graph-react)
|
|
68
|
+
|
|
69
|
+
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.
|
|
70
|
+
|
|
71
|
+
---
|
|
53
72
|
|
|
54
73
|
Before using the ORM, initialize NextGraph in your app entry point:
|
|
55
74
|
|
|
@@ -57,9 +76,14 @@ Before using the ORM, initialize NextGraph in your app entry point:
|
|
|
57
76
|
import { ng, init } from "@ng-org/web";
|
|
58
77
|
import { initNg } from "@ng-org/orm";
|
|
59
78
|
|
|
79
|
+
// Call init as early as possible when your app loads.
|
|
80
|
+
// At the first call, it will redirect the user to login with their wallet.
|
|
81
|
+
// In that case, there is no need to render the rest of the app.
|
|
82
|
+
// Then your app will reload, and this time, this call back will be called:
|
|
60
83
|
await init(
|
|
61
84
|
async (event) => {
|
|
62
|
-
// The ORM needs to have access to ng,
|
|
85
|
+
// The ORM needs to have access to ng,
|
|
86
|
+
// the interface to the engine running in WASM.
|
|
63
87
|
initNg(ng, event.session);
|
|
64
88
|
},
|
|
65
89
|
true,
|
|
@@ -67,19 +91,7 @@ await init(
|
|
|
67
91
|
);
|
|
68
92
|
```
|
|
69
93
|
|
|
70
|
-
|
|
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
|
|
94
|
+
## RDF (graph) ORM: Defining Schemas
|
|
83
95
|
|
|
84
96
|
Define your data model using [SHEX (Shape Expressions)](https://shex.io/):
|
|
85
97
|
See [@ng-org/shex-orm](../shex-orm/README.md) for details.
|
|
@@ -95,15 +107,18 @@ ex:Dog {
|
|
|
95
107
|
ex:name xsd:string ;
|
|
96
108
|
ex:age xsd:integer ? ;
|
|
97
109
|
ex:toys xsd:string * ;
|
|
110
|
+
ex:owner IRI ? ;
|
|
98
111
|
}
|
|
99
112
|
```
|
|
100
113
|
|
|
101
|
-
|
|
114
|
+
Add the following to your `package.json` scripts and run `build:orm` (assuming you installed `@ng-org/shex-orm` as dev dependency):
|
|
102
115
|
|
|
103
116
|
```json
|
|
104
117
|
"build:orm": "rdf-orm build --input ./src/shapes/shex --output ./src/shapes/orm"
|
|
105
118
|
```
|
|
106
119
|
|
|
120
|
+
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.
|
|
121
|
+
|
|
107
122
|
## Frontend Framework Usage
|
|
108
123
|
|
|
109
124
|
The SDK offers hooks for discrete and graph-based CRDTs for Svelte, Vue and React:
|
|
@@ -119,21 +134,25 @@ The SDK offers hooks for discrete and graph-based CRDTs for Svelte, Vue and Reac
|
|
|
119
134
|
- Vue: [useShape](#vueuseshape)
|
|
120
135
|
- React: [useShape](#reactuseshape)
|
|
121
136
|
|
|
122
|
-
All of them
|
|
137
|
+
All of them share the same logic. They create a 2-way binding to the engine.
|
|
123
138
|
You can modify the returned object like any other JSON object. Changes are immediately
|
|
124
|
-
reflected in the CRDT and the components
|
|
139
|
+
reflected in the CRDT and the components refresh.
|
|
125
140
|
When the component unmounts, the subscription is closed.
|
|
126
141
|
|
|
127
142
|
```ts
|
|
128
143
|
// Queries the graphs with NURI did:ng:o:g1 and did:ng:o:g2 and with subject s1 or s2.
|
|
129
|
-
const expenses
|
|
144
|
+
const expenses = useShape(ExpenseShapeType, {
|
|
130
145
|
graphs: ["did:ng:o:g1", "did:ng:o:g2"],
|
|
131
146
|
subjects: ["<s1 IRI>", "<s2 IRI>"],
|
|
132
147
|
});
|
|
148
|
+
// Note: While the returned `expenses` object has type `DeepSignal<Set<Expense>>`, you can treat and type it as `Set<Expense>` as well, for convenience.
|
|
149
|
+
|
|
150
|
+
// Now you can use expenses in your component
|
|
151
|
+
// and modify them to trigger a refresh and persist them.
|
|
133
152
|
|
|
134
|
-
//
|
|
135
|
-
|
|
136
|
-
//
|
|
153
|
+
// In analogy:
|
|
154
|
+
const expense: DeepSignal<Expense[]> = useDiscrete(expenseDocumentNuri);
|
|
155
|
+
// Note: While the returned `expenses` object has type `DeepSignal<Expense[]>`, you can treat and type it as `Expense[]` as well, for convenience.
|
|
137
156
|
```
|
|
138
157
|
|
|
139
158
|
---
|
|
@@ -143,7 +162,7 @@ const expenses: DeepSignal<Set<Expense>> = useShape(ExpenseShapeType, {
|
|
|
143
162
|
The ORM is designed to make working with data as normal as possible.
|
|
144
163
|
You get an object as you are used to it and when you change properties,
|
|
145
164
|
they are automatically persisted and synced with other devices. Conversely,
|
|
146
|
-
modifications
|
|
165
|
+
modifications coming from other devices update the ORM objects too and your components refresh.
|
|
147
166
|
|
|
148
167
|
### Creating a Document
|
|
149
168
|
|
|
@@ -168,7 +187,7 @@ await ng.sparql_update(
|
|
|
168
187
|
);
|
|
169
188
|
```
|
|
170
189
|
|
|
171
|
-
To find your document, you
|
|
190
|
+
To find your document NURI, you make a sparql query:
|
|
172
191
|
|
|
173
192
|
```ts
|
|
174
193
|
const ret = await ng.sparql_query(
|
|
@@ -184,9 +203,31 @@ let documentId = ret?.results.bindings?.[0]?.storeId?.value;
|
|
|
184
203
|
|
|
185
204
|
There are multiple ways to get and modify data:
|
|
186
205
|
|
|
187
|
-
- Get and modify the
|
|
188
|
-
- Get and modify the
|
|
189
|
-
- For graph ORMs
|
|
206
|
+
- Get and modify the signalObject of the subscription returned by [`Orm(Discrete)Subscription.getOrCreate()`](#the-discreteormsubscription-class).
|
|
207
|
+
- Get and modify the data returned by a `useShape()` or `useDiscrete()` hook inside of a component.
|
|
208
|
+
- For graph ORMs (no 2-way binding):
|
|
209
|
+
- [`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.
|
|
210
|
+
- [`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.
|
|
211
|
+
This function spares you of creating an `OrmSubscription` and can be used outside of components, where you can't call `useShape`.
|
|
212
|
+
|
|
213
|
+
### The (Discrete)OrmSubscription Class
|
|
214
|
+
|
|
215
|
+
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.
|
|
216
|
+
|
|
217
|
+
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.
|
|
218
|
+
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
|
+
|
|
220
|
+
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.
|
|
221
|
+
|
|
222
|
+
### Transactions
|
|
223
|
+
|
|
224
|
+
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.
|
|
225
|
+
|
|
226
|
+
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()`.
|
|
227
|
+
|
|
228
|
+
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.
|
|
229
|
+
|
|
230
|
+
Example of using an OrmSubscription:
|
|
190
231
|
|
|
191
232
|
```typescript
|
|
192
233
|
const dogSubscription = OrmSubscription.getOrCreate(DogShape, {
|
|
@@ -194,7 +235,7 @@ const dogSubscription = OrmSubscription.getOrCreate(DogShape, {
|
|
|
194
235
|
});
|
|
195
236
|
await dogSubscription.readyPromise;
|
|
196
237
|
|
|
197
|
-
// If we used OrmDiscreteSubscription, the signalObject type would be array or object.
|
|
238
|
+
// If we used OrmDiscreteSubscription, the signalObject type would be an array or object.
|
|
198
239
|
const dogSet: DeepSignal<Set<Dog>> = dogSubscription.signalObject;
|
|
199
240
|
|
|
200
241
|
dogs.add({
|
|
@@ -214,12 +255,26 @@ aDog.toy.add("bone");
|
|
|
214
255
|
|
|
215
256
|
// Utility to find objects in sets:
|
|
216
257
|
const sameDog = dogs.getBy(aDog["@graph"], aDog["@id"]);
|
|
217
|
-
//
|
|
258
|
+
// sameDog === aDog.
|
|
218
259
|
|
|
219
260
|
dogs.delete(aDog);
|
|
220
261
|
```
|
|
221
262
|
|
|
222
|
-
Note that the
|
|
263
|
+
Note that the RDF CRDT supports sets only, the discrete CRDTs arrays only.
|
|
264
|
+
|
|
265
|
+
#### The DeepSignal<> type
|
|
266
|
+
|
|
267
|
+
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.
|
|
268
|
+
|
|
269
|
+
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.
|
|
270
|
+
The utilities that DeepSignal objects include are:
|
|
271
|
+
|
|
272
|
+
- For sets (with the RDF ORM):
|
|
273
|
+
- iterator helper methods (e.g. `map()`, `filter()`, `reduce()`, `any()`, ...)
|
|
274
|
+
- `first()` to get one element from the set -- useful if you know that there is only one.
|
|
275
|
+
- `getBy(graphNuri: string, subjectIri: string)`, to find objects by their graph NURI and subject IRI.
|
|
276
|
+
- **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.
|
|
277
|
+
- 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
278
|
|
|
224
279
|
#### Graph ORM: Relationships
|
|
225
280
|
|
|
@@ -231,9 +286,10 @@ casey.friends.add(jackNuri);
|
|
|
231
286
|
// When the child object is a nested object that you do not have in memory,
|
|
232
287
|
// you can establish the link by adding an object that contains the `@id` property only.
|
|
233
288
|
shoppingExpense.category.add({ "@id": "<Subject IRI of expense category>" });
|
|
234
|
-
// Link objects by storing the target's `@id` NURI/IRI:
|
|
235
289
|
|
|
290
|
+
// Link objects by storing the target's `@id` NURI/IRI:
|
|
236
291
|
dog.owner = jackNuri;
|
|
292
|
+
|
|
237
293
|
// Resolve the relationship
|
|
238
294
|
const jack = people.find((p) => p["@id"] === dog.owner);
|
|
239
295
|
```
|
|
@@ -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
|
-
/**
|
|
29
|
-
|
|
30
|
-
/** Aggregation of patches to be sent when in transaction. */
|
|
31
|
-
pendingPatches
|
|
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
|
-
|
|
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,
|
|
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,yCAAyC;IACzC,OAAO,CAAC,cAAc,CAAkB;IACxC,qEAAqE;IACrE,OAAO,CAAC,cAAc,CAAsB;IAC5C,qFAAqF;IACrF,OAAO,CAAC,aAAa,CAAgB;IACrC,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,yCAAyC;IACzC,IAAI,aAAa,YAEhB;IACD,qFAAqF;IACrF,IAAI,YAAY,kBAEf;IAED;;;;;;;;;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"}
|
|
@@ -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
|
-
/**
|
|
43
|
-
|
|
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
|
-
|
|
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.
|
|
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.
|
|
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.
|
|
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.
|
|
266
|
+
this.inTransaction_ = true;
|
|
259
267
|
this.pendingPatches = [];
|
|
260
|
-
this.
|
|
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.
|
|
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.
|
|
279
|
-
this.
|
|
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
|
|
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,
|
|
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,21 +1,13 @@
|
|
|
1
|
-
import
|
|
2
|
-
export type Session = {
|
|
3
|
-
session_id: string | number;
|
|
4
|
-
protected_store_id: string;
|
|
5
|
-
private_store_id: string;
|
|
6
|
-
public_store_id: string;
|
|
7
|
-
ng: typeof NG;
|
|
8
|
-
[key: string]: unknown;
|
|
9
|
-
};
|
|
1
|
+
import type { Session, NG } from "@ng-org/web";
|
|
10
2
|
/** Resolves to the NG session and the ng implementation. */
|
|
11
3
|
export declare const ngSession: Promise<{
|
|
12
|
-
ng:
|
|
4
|
+
ng: NG;
|
|
13
5
|
session: Session;
|
|
14
6
|
}>;
|
|
15
7
|
/**
|
|
16
8
|
* Initialize the ORM by passing the ng implementation and session.
|
|
17
9
|
*
|
|
18
|
-
* **This is the first thing you need to
|
|
10
|
+
* **This is the first thing you need to do before using the ORM.**
|
|
19
11
|
*
|
|
20
12
|
* @param ngImpl The NextGraph API, e.g. exported from `@ng-org/web`.
|
|
21
13
|
* @param session The established NextGraph session.
|
|
@@ -41,5 +33,5 @@ export declare const ngSession: Promise<{
|
|
|
41
33
|
* ```
|
|
42
34
|
*
|
|
43
35
|
*/
|
|
44
|
-
export declare function initNgSignals(ngImpl:
|
|
36
|
+
export declare function initNgSignals(ngImpl: NG, session: Session): void;
|
|
45
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,
|
|
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"}
|
package/dist/connector/initNg.js
CHANGED
|
@@ -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
|
|
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
|
|
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
|
|
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
|
|
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
|
|
43
|
+
private suspendDeepWatcher;
|
|
45
44
|
/** True, if a transaction is running. */
|
|
46
|
-
|
|
47
|
-
/** Aggregation of patches to be sent when in transaction. */
|
|
48
|
-
pendingPatches
|
|
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
|
-
|
|
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;
|
|
1
|
+
{"version":3,"file":"ormSubscriptionHandler.d.ts","sourceRoot":"","sources":["../../src/connector/ormSubscriptionHandler.ts"],"names":[],"mappings":"AAUA,OAAO,EAAkB,KAAK,KAAK,EAAE,MAAM,aAAa,CAAC;AAUzD,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,OAAO,CAAC,kBAAkB,CAAU;IACpC,yCAAyC;IACzC,OAAO,CAAC,cAAc,CAAkB;IACxC,qEAAqE;IACrE,OAAO,CAAC,cAAc,CAAsB;IAC5C,qFAAqF;IACrF,OAAO,CAAC,aAAa,CAAgB;IACrC,OAAO,CAAC,oBAAoB,CAAa;IACzC,2DAA2D;IAC3D,OAAO,CAAC,YAAY,CAAc;IAGlC,OAAO,CAAC,MAAM,CAAC,qBAAqB,CAUrB;IAEf,OAAO;IAqDP;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;OA2EG;IACH,OAAc,WAAW,GAAI,GAAC,SAAS,QAAQ,EAC3C,WAAW,SAAS,CAAC,GAAC,CAAC,EACvB,OAAO,KAAK,KACb,eAAe,CAAC,GAAC,CAAC,CAkBnB;IAEF,yCAAyC;IACzC,IAAI,aAAa,YAEhB;IACD,qFAAqF;IACrF,IAAI,YAAY,kBAEf;IAED;;;;;;;;;OASG;IACI,KAAK,aAYV;IAEF,wEAAwE;IACxE,OAAO,CAAC,oBAAoB,CAoB1B;IAEF,wEAAwE;IACxE,OAAO,CAAC,gBAAgB,CAStB;IAEF,OAAO,CAAC,qBAAqB,CAuB3B;IAEF,8CAA8C;IAC9C,OAAO,CAAC,eAAe,CAOrB;IAEF,gFAAgF;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
|
-
|
|
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
|
-
|
|
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.
|
|
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.
|
|
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.
|
|
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.
|
|
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.
|
|
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.
|
|
356
|
-
this.
|
|
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, };
|
|
@@ -98,7 +98,7 @@ import { DiscreteRoot } from "../../types.ts";
|
|
|
98
98
|
* }
|
|
99
99
|
* ```
|
|
100
100
|
*/
|
|
101
|
-
export declare function useDiscrete<T
|
|
101
|
+
export declare function useDiscrete<T = DiscreteRoot>(documentId: string | undefined): {
|
|
102
102
|
doc: DeepSignal<T> | undefined;
|
|
103
103
|
};
|
|
104
104
|
//# sourceMappingURL=useDiscrete.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useDiscrete.d.ts","sourceRoot":"","sources":["../../../src/frontendAdapters/react/useDiscrete.ts"],"names":[],"mappings":"AAaA,OAAO,EAAE,UAAU,EAAE,MAAM,2BAA2B,CAAC;AACvD,OAAO,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAC;AAI9C;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAiGG;AAEH,wBAAgB,WAAW,CAAC,CAAC,
|
|
1
|
+
{"version":3,"file":"useDiscrete.d.ts","sourceRoot":"","sources":["../../../src/frontendAdapters/react/useDiscrete.ts"],"names":[],"mappings":"AAaA,OAAO,EAAE,UAAU,EAAE,MAAM,2BAA2B,CAAC;AACvD,OAAO,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAC;AAI9C;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAiGG;AAEH,wBAAgB,WAAW,CAAC,CAAC,GAAG,YAAY,EAAE,UAAU,EAAE,MAAM,GAAG,SAAS;;EAqD3E"}
|
|
@@ -88,7 +88,7 @@ import { DeepSignal } from "@ng-org/alien-deepsignals";
|
|
|
88
88
|
* </div>
|
|
89
89
|
* ```
|
|
90
90
|
*/
|
|
91
|
-
export declare function useDiscrete<T
|
|
91
|
+
export declare function useDiscrete<T = DiscreteRoot>(documentIdOrPromise: string | Promise<string> | undefined): {
|
|
92
92
|
doc: DeepSignal<T | undefined>;
|
|
93
93
|
};
|
|
94
94
|
//# sourceMappingURL=useDiscrete.svelte.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useDiscrete.svelte.d.ts","sourceRoot":"","sources":["../../../src/frontendAdapters/svelte/useDiscrete.svelte.ts"],"names":[],"mappings":"AAaA,OAAO,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAC;AAC9C,OAAO,EAAE,UAAU,EAAE,MAAM,2BAA2B,CAAC;AAEvD;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAuFG;AACH,wBAAgB,WAAW,CAAC,CAAC,
|
|
1
|
+
{"version":3,"file":"useDiscrete.svelte.d.ts","sourceRoot":"","sources":["../../../src/frontendAdapters/svelte/useDiscrete.svelte.ts"],"names":[],"mappings":"AAaA,OAAO,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAC;AAC9C,OAAO,EAAE,UAAU,EAAE,MAAM,2BAA2B,CAAC;AAEvD;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAuFG;AACH,wBAAgB,WAAW,CAAC,CAAC,GAAG,YAAY,EACxC,mBAAmB,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC,GAAG,SAAS,GAC1D;IACC,GAAG,EAAE,UAAU,CAAC,CAAC,GAAG,SAAS,CAAC,CAAC;CAClC,CAqCA"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import useShape from "./useShape.svelte.ts";
|
|
2
2
|
import { useDiscrete } from "./useDiscrete.svelte.ts";
|
|
3
|
-
import {
|
|
4
|
-
export { useShape, useDiscrete, type
|
|
3
|
+
import type { UseShapeStoreResult } from "./useShape.svelte.ts";
|
|
4
|
+
export { useShape, useDiscrete, type UseShapeStoreResult };
|
|
5
5
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/frontendAdapters/svelte4/index.ts"],"names":[],"mappings":"AAUA,OAAO,QAAQ,MAAM,sBAAsB,CAAC;AAC5C,OAAO,EAAE,WAAW,EAAE,MAAM,yBAAyB,CAAC;AACtD,OAAO,EAAE,mBAAmB,EAAE,MAAM,sBAAsB,CAAC;
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/frontendAdapters/svelte4/index.ts"],"names":[],"mappings":"AAUA,OAAO,QAAQ,MAAM,sBAAsB,CAAC;AAC5C,OAAO,EAAE,WAAW,EAAE,MAAM,yBAAyB,CAAC;AACtD,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,sBAAsB,CAAC;AAChE,OAAO,EAAE,QAAQ,EAAE,WAAW,EAAE,KAAK,mBAAmB,EAAE,CAAC"}
|
|
@@ -80,5 +80,7 @@ import { DiscreteRoot } from "../../types.ts";
|
|
|
80
80
|
* ```
|
|
81
81
|
*
|
|
82
82
|
*/
|
|
83
|
-
export declare function useDiscrete<T
|
|
83
|
+
export declare function useDiscrete<T = DiscreteRoot>(documentIdOrPromise: string | Promise<string> | undefined): {
|
|
84
|
+
doc: UseDeepSignalResult<T | undefined>;
|
|
85
|
+
};
|
|
84
86
|
//# sourceMappingURL=useDiscrete.svelte.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useDiscrete.svelte.d.ts","sourceRoot":"","sources":["../../../src/frontendAdapters/svelte4/useDiscrete.svelte.ts"],"names":[],"mappings":"AAWA,OAAO,EAEH,mBAAmB,EACtB,MAAM,mCAAmC,CAAC;AAE3C,OAAO,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAC;
|
|
1
|
+
{"version":3,"file":"useDiscrete.svelte.d.ts","sourceRoot":"","sources":["../../../src/frontendAdapters/svelte4/useDiscrete.svelte.ts"],"names":[],"mappings":"AAWA,OAAO,EAEH,mBAAmB,EACtB,MAAM,mCAAmC,CAAC;AAE3C,OAAO,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAC;AAG9C;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA+EG;AACH,wBAAgB,WAAW,CAAC,CAAC,GAAG,YAAY,EACxC,mBAAmB,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC,GAAG,SAAS,GAC1D;IAAE,GAAG,EAAE,mBAAmB,CAAC,CAAC,GAAG,SAAS,CAAC,CAAA;CAAE,CAkC7C"}
|
|
@@ -1,9 +1,8 @@
|
|
|
1
1
|
import { type Scope } from "../../types.ts";
|
|
2
2
|
import type { BaseType, ShapeType } from "@ng-org/shex-orm";
|
|
3
3
|
import { type UseDeepSignalResult } from "@ng-org/alien-deepsignals/svelte4";
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
export interface UseShapeRuneResult<T extends object> extends UseDeepSignalResult<T> {
|
|
4
|
+
/** Extended result including the originating root signal wrapper from shape logic. @ignore*/
|
|
5
|
+
export interface UseShapeStoreResult<T = object> extends UseDeepSignalResult<T> {
|
|
7
6
|
root: any;
|
|
8
7
|
}
|
|
9
8
|
/**
|
|
@@ -72,6 +71,6 @@ export interface UseShapeRuneResult<T extends object> extends UseDeepSignalResul
|
|
|
72
71
|
* </div>
|
|
73
72
|
* ```
|
|
74
73
|
*/
|
|
75
|
-
export declare function useShape<T extends BaseType>(shape: ShapeType<T>, scope: Scope | string | undefined):
|
|
74
|
+
export declare function useShape<T extends BaseType>(shape: ShapeType<T>, scope: Scope | string | undefined): UseShapeStoreResult<Set<T>>;
|
|
76
75
|
export default useShape;
|
|
77
76
|
//# sourceMappingURL=useShape.svelte.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useShape.svelte.d.ts","sourceRoot":"","sources":["../../../src/frontendAdapters/svelte4/useShape.svelte.ts"],"names":[],"mappings":"AAUA,OAAO,EAAkB,KAAK,KAAK,EAAE,MAAM,gBAAgB,CAAC;AAE5D,OAAO,KAAK,EAAE,QAAQ,EAAE,SAAS,EAAE,MAAM,kBAAkB,CAAC;AAC5D,OAAO,EAEH,KAAK,mBAAmB,EAC3B,MAAM,mCAAmC,CAAC;AAK3C,
|
|
1
|
+
{"version":3,"file":"useShape.svelte.d.ts","sourceRoot":"","sources":["../../../src/frontendAdapters/svelte4/useShape.svelte.ts"],"names":[],"mappings":"AAUA,OAAO,EAAkB,KAAK,KAAK,EAAE,MAAM,gBAAgB,CAAC;AAE5D,OAAO,KAAK,EAAE,QAAQ,EAAE,SAAS,EAAE,MAAM,kBAAkB,CAAC;AAC5D,OAAO,EAEH,KAAK,mBAAmB,EAC3B,MAAM,mCAAmC,CAAC;AAK3C,6FAA6F;AAC7F,MAAM,WAAW,mBAAmB,CAAC,CAAC,GAAG,MAAM,CAC3C,SAAQ,mBAAmB,CAAC,CAAC,CAAC;IAC9B,IAAI,EAAE,GAAG,CAAC;CACb;AAED;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAiEG;AACH,wBAAgB,QAAQ,CAAC,CAAC,SAAS,QAAQ,EACvC,KAAK,EAAE,SAAS,CAAC,CAAC,CAAC,EACnB,KAAK,EAAE,KAAK,GAAG,MAAM,GAAG,SAAS,GAClC,mBAAmB,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,CAe7B;AAED,eAAe,QAAQ,CAAC"}
|
|
@@ -93,7 +93,7 @@ import { DiscreteRoot } from "../../types.ts";
|
|
|
93
93
|
* </template>
|
|
94
94
|
* ```
|
|
95
95
|
*/
|
|
96
|
-
export declare function useDiscrete<T
|
|
96
|
+
export declare function useDiscrete<T = DiscreteRoot>(documentId: MaybeRefOrGetter<string | undefined>): ToRefs<{
|
|
97
97
|
doc: T;
|
|
98
98
|
}>;
|
|
99
99
|
//# sourceMappingURL=useDiscrete.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useDiscrete.d.ts","sourceRoot":"","sources":["../../../src/frontendAdapters/vue/useDiscrete.ts"],"names":[],"mappings":"AAUA,OAAO,EAEH,gBAAgB,EAGhB,MAAM,EAIT,MAAM,KAAK,CAAC;AAGb,OAAO,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAC;AAE9C;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA4FG;AACH,wBAAgB,WAAW,CAAC,CAAC,
|
|
1
|
+
{"version":3,"file":"useDiscrete.d.ts","sourceRoot":"","sources":["../../../src/frontendAdapters/vue/useDiscrete.ts"],"names":[],"mappings":"AAUA,OAAO,EAEH,gBAAgB,EAGhB,MAAM,EAIT,MAAM,KAAK,CAAC;AAGb,OAAO,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAC;AAE9C;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA4FG;AACH,wBAAgB,WAAW,CAAC,CAAC,GAAG,YAAY,EACxC,UAAU,EAAE,gBAAgB,CAAC,MAAM,GAAG,SAAS,CAAC,GAoB1B,MAAM,CAAC;IAAE,GAAG,EAAE,CAAC,CAAA;CAAE,CAAC,CAC3C"}
|
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
|
-
import { useShape as svelte4UseShape, useDiscrete as svelte4UseDiscrete } from "./frontendAdapters/svelte4/index.ts";
|
|
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
|
-
|
|
8
|
-
|
|
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, OrmSubscription as OrmSubscription, DiscreteOrmSubscription, svelteUseShape, svelteUseDiscrete, svelte4UseShape, svelte4UseDiscrete, 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
|
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAUA,OAAO,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAUA,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;AAC3C,OAAO,EACH,QAAQ,IAAI,WAAW,EACvB,WAAW,IAAI,cAAc,EAChC,MAAM,iCAAiC,CAAC;AAEzC,cAAc,WAAW,CAAC;AAE1B,OAAO,EACH,cAAc,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
|
-
|
|
17
|
-
|
|
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. */
|
package/dist/types.d.ts.map
CHANGED
|
@@ -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,
|
|
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.
|
|
3
|
+
"version": "0.1.2-alpha.12",
|
|
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/
|
|
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
|
-
"
|
|
40
|
+
"peerDependencies": {
|
|
37
41
|
"react": "^19.0.0 || ^18.0.0",
|
|
38
|
-
"svelte": "^5.0.0",
|
|
42
|
+
"svelte": "^5.0.0 || ^4.0.0 || ^3.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
|
-
"@
|
|
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.7"
|
|
57
|
+
"@ng-org/alien-deepsignals": "0.1.2-alpha.9"
|
|
55
58
|
},
|
|
56
59
|
"devDependencies": {
|
|
57
|
-
"@
|
|
58
|
-
"@types/
|
|
59
|
-
"
|
|
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/
|
|
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.6",
|
|
70
|
+
"@ng-org/web": "0.1.2-alpha.9"
|
|
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/
|
|
79
|
+
"types": "./dist/core.d.ts"
|
|
79
80
|
}
|