@ng-org/orm 0.1.2-alpha.7 → 0.1.2-alpha.9
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 +74 -92
- package/dist/connector/applyPatches.d.ts +13 -4
- package/dist/connector/applyPatches.d.ts.map +1 -1
- package/dist/connector/applyPatches.js +9 -5
- package/dist/connector/discrete/discreteOrmSubscriptionHandler.d.ts +156 -0
- package/dist/connector/discrete/discreteOrmSubscriptionHandler.d.ts.map +1 -0
- package/dist/connector/discrete/{discreteOrmConnectionHandler.js → discreteOrmSubscriptionHandler.js} +130 -19
- package/dist/connector/getObjects.js +2 -2
- package/dist/connector/initNg.d.ts +35 -0
- package/dist/connector/initNg.d.ts.map +1 -1
- package/dist/connector/initNg.js +35 -0
- package/dist/connector/insertObject.js +2 -2
- package/dist/connector/ormSubscriptionHandler.d.ts +166 -0
- package/dist/connector/ormSubscriptionHandler.d.ts.map +1 -0
- package/dist/connector/{ormConnectionHandler.js → ormSubscriptionHandler.js} +157 -32
- package/dist/frontendAdapters/react/useDiscrete.d.ts +89 -69
- package/dist/frontendAdapters/react/useDiscrete.d.ts.map +1 -1
- package/dist/frontendAdapters/react/useDiscrete.js +103 -81
- package/dist/frontendAdapters/react/useShape.d.ts +55 -55
- package/dist/frontendAdapters/react/useShape.d.ts.map +1 -1
- package/dist/frontendAdapters/react/useShape.js +71 -73
- package/dist/frontendAdapters/svelte/useDiscrete.svelte.d.ts +80 -71
- package/dist/frontendAdapters/svelte/useDiscrete.svelte.d.ts.map +1 -1
- package/dist/frontendAdapters/svelte/useDiscrete.svelte.js +102 -91
- package/dist/frontendAdapters/svelte/useShape.svelte.d.ts +70 -64
- package/dist/frontendAdapters/svelte/useShape.svelte.d.ts.map +1 -1
- package/dist/frontendAdapters/svelte/useShape.svelte.js +73 -62
- package/dist/frontendAdapters/svelte4/index.d.ts +5 -0
- package/dist/frontendAdapters/svelte4/index.d.ts.map +1 -0
- package/dist/frontendAdapters/svelte4/index.js +12 -0
- package/dist/frontendAdapters/svelte4/useDiscrete.svelte.d.ts +85 -0
- package/dist/frontendAdapters/svelte4/useDiscrete.svelte.d.ts.map +1 -0
- package/dist/frontendAdapters/svelte4/useDiscrete.svelte.js +124 -0
- package/dist/frontendAdapters/svelte4/useShape.svelte.d.ts +76 -0
- package/dist/frontendAdapters/svelte4/useShape.svelte.d.ts.map +1 -0
- package/dist/frontendAdapters/svelte4/useShape.svelte.js +84 -0
- package/dist/frontendAdapters/vue/useDiscrete.d.ts +87 -80
- package/dist/frontendAdapters/vue/useDiscrete.d.ts.map +1 -1
- package/dist/frontendAdapters/vue/useDiscrete.js +96 -84
- package/dist/frontendAdapters/vue/useShape.d.ts +57 -63
- package/dist/frontendAdapters/vue/useShape.d.ts.map +1 -1
- package/dist/frontendAdapters/vue/useShape.js +59 -64
- package/dist/index.d.ts +6 -3
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +14 -3
- package/dist/types.d.ts +17 -7
- package/dist/types.d.ts.map +1 -1
- package/dist/types.js +11 -2
- package/package.json +7 -3
- package/dist/connector/discrete/discreteOrmConnectionHandler.d.ts +0 -45
- package/dist/connector/discrete/discreteOrmConnectionHandler.d.ts.map +0 -1
- package/dist/connector/ormConnectionHandler.d.ts +0 -48
- package/dist/connector/ormConnectionHandler.d.ts.map +0 -1
|
@@ -7,9 +7,10 @@
|
|
|
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 { normalizeScope } from "../../types.js";
|
|
10
11
|
import { useDeepSignal } from "@ng-org/alien-deepsignals/vue";
|
|
11
12
|
import { onBeforeUnmount } from "vue";
|
|
12
|
-
import {
|
|
13
|
+
import { OrmSubscription } from "../../connector/ormSubscriptionHandler.js";
|
|
13
14
|
/**
|
|
14
15
|
* Hook to subscribe to RDF data in the graph database using a shape, see {@link ShapeType}.
|
|
15
16
|
* The returned objects are as easy to use as other TypeScript objects.
|
|
@@ -19,73 +20,67 @@ import { OrmConnection } from "../../connector/ormConnectionHandler.js";
|
|
|
19
20
|
* changes coming from the backend (or other components) cause an immediate rerender.
|
|
20
21
|
*
|
|
21
22
|
* @param shape The {@link ShapeType} the objects should have (generated by the shex-orm tool).
|
|
22
|
-
* @param scope The scope in which the objects should be.
|
|
23
|
+
* @param scope The scope in which the objects should be. Leaving it `undefined` makes no subscription.
|
|
23
24
|
* @returns A {@link DeepSignalSet} containing the objects matching the shape type and scope.
|
|
24
25
|
*
|
|
25
26
|
* @example
|
|
26
|
-
```html
|
|
27
|
-
<script lang="ts">
|
|
28
|
-
// Contains all expense objects with `@id` <s1 IRI> or <s2 IRI> and `@graph` <g1 IRI> or <g2 IRI>
|
|
29
|
-
const expenses: DeepSignalSet<Expense> = useShape(
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
const expensesSorted = computed(() => [...expenses].sort((a, b) =>
|
|
35
|
-
|
|
36
|
-
));
|
|
37
|
-
|
|
38
|
-
//
|
|
39
|
-
// Leave `@id` an empty string to auto-generate a subject IRI (adjust your scope accordingly).
|
|
40
|
-
|
|
41
|
-
//
|
|
42
|
-
// If it is not, use the combination of `@graph` and `@id`.
|
|
43
|
-
</script>
|
|
44
|
-
|
|
45
|
-
<template>
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
</template>
|
|
59
|
-
```
|
|
60
|
-
|
|
61
|
-
In the `ExpenseCard` component:
|
|
62
|
-
```html
|
|
63
|
-
<script lang="ts">
|
|
64
|
-
const
|
|
65
|
-
|
|
66
|
-
}>();
|
|
67
|
-
|
|
68
|
-
//
|
|
69
|
-
//
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
<input
|
|
81
|
-
v-model="expense.title"
|
|
82
|
-
placeholder="Expense title"
|
|
83
|
-
/>
|
|
84
|
-
</template>
|
|
85
|
-
```
|
|
27
|
+
* ```html
|
|
28
|
+
* <script lang="ts">
|
|
29
|
+
* // Contains all expense objects with `@id` <s1 IRI> or <s2 IRI> and `@graph` <g1 IRI> or <g2 IRI>
|
|
30
|
+
* const expenses: DeepSignalSet<Expense> = useShape(ExpenseShapeType,
|
|
31
|
+
* {graphs: ["<g1 IRI>", "<g2 IRI>"],
|
|
32
|
+
* subjects: ["<s1 IRI>", "<s2 IRI>"]});
|
|
33
|
+
*
|
|
34
|
+
*
|
|
35
|
+
* const expensesSorted = computed(() => [...expenses].sort((a, b) =>
|
|
36
|
+
* a.dateOfPurchase.localeCompare(b.dateOfPurchase)
|
|
37
|
+
* ));
|
|
38
|
+
*
|
|
39
|
+
* // Simply call expenses.add({"@graph": "<g1 or g2 IRI>", "@id": "", title: "Example title"}), to add new elements.
|
|
40
|
+
* // Leave `@id` an empty string to auto-generate a subject IRI (adjust your scope accordingly).
|
|
41
|
+
*
|
|
42
|
+
* // Note that if you use `@id` (the subject IRI) as key, you need to ensure that it is unique within your scope.
|
|
43
|
+
* // If it is not, use the combination of `@graph` and `@id`.
|
|
44
|
+
* </script>
|
|
45
|
+
*
|
|
46
|
+
* <template>
|
|
47
|
+
* <div>
|
|
48
|
+
* <p v-if="expensesSorted.length === 0">
|
|
49
|
+
* No expenses yet.
|
|
50
|
+
* </p>
|
|
51
|
+
* <template v-else>
|
|
52
|
+
* <ExpenseCard
|
|
53
|
+
* v-for="expense in expensesSorted"
|
|
54
|
+
* :key="expense['@id'])"
|
|
55
|
+
* :expense="expense"
|
|
56
|
+
* />
|
|
57
|
+
* </template>
|
|
58
|
+
* </div>
|
|
59
|
+
* </template>
|
|
60
|
+
* ```
|
|
61
|
+
*
|
|
62
|
+
* In the `ExpenseCard` component:
|
|
63
|
+
* ```html
|
|
64
|
+
* <script lang="ts">
|
|
65
|
+
* const { expense } = defineProps<{
|
|
66
|
+
* expense: DeepSignal<Expense>;
|
|
67
|
+
* }>();
|
|
68
|
+
*
|
|
69
|
+
* // If you modify expense in the component,
|
|
70
|
+
* // the changes are immediately propagated to the other components
|
|
71
|
+
* // And persisted in the database.
|
|
72
|
+
* </script>
|
|
73
|
+
*
|
|
74
|
+
* <template>
|
|
75
|
+
* <input
|
|
76
|
+
* v-model="expense.title"
|
|
77
|
+
* placeholder="Expense title"
|
|
78
|
+
* />
|
|
79
|
+
* </template>
|
|
80
|
+
* ```
|
|
86
81
|
*/
|
|
87
|
-
export function useShape(shape, scope
|
|
88
|
-
const connection =
|
|
82
|
+
export function useShape(shape, scope) {
|
|
83
|
+
const connection = OrmSubscription.getOrCreate(shape, normalizeScope(scope));
|
|
89
84
|
// Cleanup
|
|
90
85
|
onBeforeUnmount(() => {
|
|
91
86
|
connection.close();
|
package/dist/index.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
1
|
+
import { OrmSubscription } from "./connector/ormSubscriptionHandler.ts";
|
|
2
|
+
import { DiscreteOrmSubscription } from "./connector/discrete/discreteOrmSubscriptionHandler.ts";
|
|
3
3
|
import { useShape as svelteUseShape, useDiscrete as svelteUseDiscrete } from "./frontendAdapters/svelte/index.ts";
|
|
4
4
|
import { useShape as reactUseShape, useDiscrete as reactUseDiscrete } from "./frontendAdapters/react/index.ts";
|
|
5
5
|
import { useShape as vueUseShape, useDiscrete as vueUseDiscrete } from "./frontendAdapters/vue/index.ts";
|
|
@@ -7,5 +7,8 @@ import { initNgSignals, ngSession } from "./connector/initNg.ts";
|
|
|
7
7
|
import { insertObject } from "./connector/insertObject.ts";
|
|
8
8
|
import { getObjects } from "./connector/getObjects.ts";
|
|
9
9
|
export * from "./connector/applyPatches.ts";
|
|
10
|
-
export
|
|
10
|
+
export * from "./types.ts";
|
|
11
|
+
export type { DeepSignal, DeepSignalObject } from "@ng-org/alien-deepsignals";
|
|
12
|
+
export { getRaw, watch, effect } from "@ng-org/alien-deepsignals";
|
|
13
|
+
export { initNgSignals as initNg, ngSession, OrmSubscription as OrmSubscription, DiscreteOrmSubscription, svelteUseShape, svelteUseDiscrete, reactUseShape, reactUseDiscrete, vueUseShape, vueUseDiscrete, insertObject, getObjects, };
|
|
11
14
|
//# 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":"
|
|
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,aAAa,EACzB,WAAW,IAAI,gBAAgB,EAClC,MAAM,mCAAmC,CAAC;AAC3C,OAAO,EACH,QAAQ,IAAI,WAAW,EACvB,WAAW,IAAI,cAAc,EAChC,MAAM,iCAAiC,CAAC;AACzC,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;AACvD,cAAc,6BAA6B,CAAC;AAC5C,cAAc,YAAY,CAAC;AAE3B,YAAY,EAAE,UAAU,EAAE,gBAAgB,EAAE,MAAM,2BAA2B,CAAC;AAE9E,OAAO,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,EAAE,MAAM,2BAA2B,CAAC;AAElE,OAAO,EACH,aAAa,IAAI,MAAM,EACvB,SAAS,EACT,eAAe,IAAI,eAAe,EAClC,uBAAuB,EACvB,cAAc,EACd,iBAAiB,EACjB,aAAa,EACb,gBAAgB,EAChB,WAAW,EACX,cAAc,EACd,YAAY,EACZ,UAAU,GACb,CAAC"}
|
package/dist/index.js
CHANGED
|
@@ -1,5 +1,14 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
1
|
+
// Copyright (c) 2025 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";
|
|
3
12
|
import { useShape as svelteUseShape, useDiscrete as svelteUseDiscrete, } from "./frontendAdapters/svelte/index.js";
|
|
4
13
|
import { useShape as reactUseShape, useDiscrete as reactUseDiscrete, } from "./frontendAdapters/react/index.js";
|
|
5
14
|
import { useShape as vueUseShape, useDiscrete as vueUseDiscrete, } from "./frontendAdapters/vue/index.js";
|
|
@@ -7,4 +16,6 @@ import { initNgSignals, ngSession } from "./connector/initNg.js";
|
|
|
7
16
|
import { insertObject } from "./connector/insertObject.js";
|
|
8
17
|
import { getObjects } from "./connector/getObjects.js";
|
|
9
18
|
export * from "./connector/applyPatches.js";
|
|
10
|
-
export
|
|
19
|
+
export * from "./types.js";
|
|
20
|
+
export { getRaw, watch, effect } from "@ng-org/alien-deepsignals";
|
|
21
|
+
export { initNgSignals as initNg, ngSession, OrmSubscription as OrmSubscription, DiscreteOrmSubscription, svelteUseShape, svelteUseDiscrete, reactUseShape, reactUseDiscrete, vueUseShape, vueUseDiscrete, insertObject, getObjects, };
|
package/dist/types.d.ts
CHANGED
|
@@ -1,25 +1,35 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* When dealing with shapes (RDF graph ORMs):
|
|
2
|
+
* When dealing with shapes (RDF-based graph database ORMs):
|
|
3
3
|
* The scope of a shape request.
|
|
4
4
|
* In most cases, it is recommended to use a narrow scope for performance.
|
|
5
5
|
* You can filter results by `subjects` and `graphs`. Only objects in that scope will be returned.
|
|
6
6
|
*
|
|
7
|
-
* @param subjects array of subject IRIs to filter by. For no filtering, set to `undefined` set to `[]`.
|
|
8
|
-
* @param graphs array of graph IRIs to filter by. For no filtering, set to `undefined`.
|
|
9
|
-
* If you set to `[]`, *no objects are returned*. This is useful only for inserting objects in the database only
|
|
10
|
-
*
|
|
11
7
|
* @example
|
|
12
8
|
* ```typescript
|
|
13
9
|
* // Contains all expense objects with `@id` <s1 IRI> or <s2 IRI> and `@graph` <g1 IRI> or <g2 IRI>
|
|
14
10
|
* const expenses: DeepSignalSet<Expense = useShape(ExpenseShape,
|
|
15
|
-
* {graphs: ["<
|
|
16
|
-
* subjects: ["<
|
|
11
|
+
* {graphs: ["<graph1 IRI>", "<graph2 IRI>"],
|
|
12
|
+
* subjects: ["<subject1 IRI>", "<subject2 IRI>"]});
|
|
17
13
|
* ```
|
|
18
14
|
*/
|
|
19
15
|
export type Scope = {
|
|
16
|
+
/**
|
|
17
|
+
* The graphs to filter for. If more than one IRI is provided, the union of all graphs is considered.
|
|
18
|
+
*
|
|
19
|
+
* - Set value to `["did:ng:i"]` or `[""]` for whole dataset.
|
|
20
|
+
* - Setting value to `[]` or leaving it `undefined`, no objects are returned.
|
|
21
|
+
*/
|
|
20
22
|
graphs?: string[];
|
|
23
|
+
/**
|
|
24
|
+
* Subjects to filter for. Set to `[]` or leaving it `undefined` for no filtering.
|
|
25
|
+
*/
|
|
21
26
|
subjects?: string[];
|
|
22
27
|
};
|
|
28
|
+
/** Convert undefined to [] and for graphs "" to "did:ng:i". If scope is string, that means {graphs: [\<scope string>], subjects: []}. */
|
|
29
|
+
export declare const normalizeScope: (scope?: Scope | string | undefined) => {
|
|
30
|
+
graphs: string[];
|
|
31
|
+
subjects: string[];
|
|
32
|
+
};
|
|
23
33
|
/** An allowed array in the CRDT. */
|
|
24
34
|
export interface DiscreteArray extends Array<DiscreteType> {
|
|
25
35
|
}
|
package/dist/types.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"AAUA
|
|
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,yIAAyI;AACzI,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;;;;GAIG;AACH,MAAM,MAAM,YAAY,GAAG,MAAM,GAAG,QAAQ,GAAG,WAAW,CAAC"}
|
package/dist/types.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
// Copyright (c)
|
|
1
|
+
// Copyright (c) 2025 Laurin Weger, Par le Peuple, NextGraph.org developers
|
|
2
2
|
// All rights reserved.
|
|
3
3
|
// Licensed under the Apache License, Version 2.0
|
|
4
4
|
// <LICENSE-APACHE2 or http://www.apache.org/licenses/LICENSE-2.0>
|
|
@@ -7,4 +7,13 @@
|
|
|
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
|
-
|
|
10
|
+
/** Convert undefined to [] and for graphs "" to "did:ng:i". If scope is string, that means {graphs: [\<scope string>], subjects: []}. */
|
|
11
|
+
export const normalizeScope = (scope = {}) => {
|
|
12
|
+
if (typeof scope === "string") {
|
|
13
|
+
return { graphs: [scope], subjects: [] };
|
|
14
|
+
}
|
|
15
|
+
// Convert "" to did:ng:i
|
|
16
|
+
const graphs = (scope.graphs ?? []).map((g) => (g === "" ? "did:ng:i" : g));
|
|
17
|
+
const subjects = scope.subjects ?? [];
|
|
18
|
+
return { graphs, subjects };
|
|
19
|
+
};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@ng-org/orm",
|
|
3
|
-
"version": "0.1.2-alpha.
|
|
3
|
+
"version": "0.1.2-alpha.9",
|
|
4
4
|
"private": false,
|
|
5
5
|
"type": "module",
|
|
6
6
|
"authors": [
|
|
@@ -21,6 +21,10 @@
|
|
|
21
21
|
"types": "./dist/frontendAdapters/svelte/index.d.ts",
|
|
22
22
|
"default": "./dist/frontendAdapters/svelte/index.js"
|
|
23
23
|
},
|
|
24
|
+
"./svelte4": {
|
|
25
|
+
"types": "./dist/frontendAdapters/svelte4/index.d.ts",
|
|
26
|
+
"default": "./dist/frontendAdapters/svelte4/index.js"
|
|
27
|
+
},
|
|
24
28
|
"./vue": {
|
|
25
29
|
"types": "./dist/frontendAdapters/vue/index.d.ts",
|
|
26
30
|
"default": "./dist/frontendAdapters/vue/index.js"
|
|
@@ -46,8 +50,8 @@
|
|
|
46
50
|
"install": "^0.13.0",
|
|
47
51
|
"npm": "^11.5.2",
|
|
48
52
|
"prettier-eslint": "^16.4.2",
|
|
49
|
-
"@ng-org/shex-orm": "0.1.2-alpha.
|
|
50
|
-
"@ng-org/alien-deepsignals": "0.1.2-alpha.
|
|
53
|
+
"@ng-org/shex-orm": "0.1.2-alpha.4",
|
|
54
|
+
"@ng-org/alien-deepsignals": "0.1.2-alpha.6"
|
|
51
55
|
},
|
|
52
56
|
"devDependencies": {
|
|
53
57
|
"@playwright/test": "^1.55.0",
|
|
@@ -1,45 +0,0 @@
|
|
|
1
|
-
import { DiscreteArray, DiscreteObject } from "../../types.ts";
|
|
2
|
-
import { Patch } from "../applyPatches.ts";
|
|
3
|
-
import type { DeepPatch, DeepSignal } from "@ng-org/alien-deepsignals";
|
|
4
|
-
import type { BaseType } from "@ng-org/shex-orm";
|
|
5
|
-
export declare class DiscreteOrmConnection {
|
|
6
|
-
private static idToEntry;
|
|
7
|
-
readonly documentId: string;
|
|
8
|
-
private _signalObject;
|
|
9
|
-
private stopSignalListening;
|
|
10
|
-
private subscriptionId;
|
|
11
|
-
private refCount;
|
|
12
|
-
suspendDeepWatcher: boolean;
|
|
13
|
-
inTransaction: boolean;
|
|
14
|
-
/** Aggregation of patches to be sent when in transaction. */
|
|
15
|
-
pendingPatches: Patch[] | undefined;
|
|
16
|
-
/** Resolves once the data arrives */
|
|
17
|
-
readyPromise: Promise<void>;
|
|
18
|
-
private closeOrmConnection;
|
|
19
|
-
/** Called to resolve the readyPromise. */
|
|
20
|
-
private resolveReady;
|
|
21
|
-
private constructor();
|
|
22
|
-
get signalObject(): DeepSignal<DiscreteArray | DiscreteObject> | undefined;
|
|
23
|
-
/**
|
|
24
|
-
* Get or create a connection which contains the ORM and lifecycle methods.
|
|
25
|
-
* @param shapeType
|
|
26
|
-
* @param scope
|
|
27
|
-
* @param ng
|
|
28
|
-
* @returns
|
|
29
|
-
*/
|
|
30
|
-
static getOrCreate: <T extends BaseType>(documentId: string) => DiscreteOrmConnection;
|
|
31
|
-
close: () => void;
|
|
32
|
-
private onSignalObjectUpdate;
|
|
33
|
-
private onBackendMessage;
|
|
34
|
-
private handleInitialResponse;
|
|
35
|
-
private onBackendUpdate;
|
|
36
|
-
beginTransaction: () => void;
|
|
37
|
-
commitTransaction: () => Promise<void>;
|
|
38
|
-
}
|
|
39
|
-
/**
|
|
40
|
-
* Converts DeepSignal patches to ORM Wasm-compatible patches
|
|
41
|
-
* @param patches DeepSignal patches
|
|
42
|
-
* @returns Patches with stringified path
|
|
43
|
-
*/
|
|
44
|
-
export declare function deepPatchesToWasm(patches: DeepPatch[]): Patch[];
|
|
45
|
-
//# sourceMappingURL=discreteOrmConnectionHandler.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"discreteOrmConnectionHandler.d.ts","sourceRoot":"","sources":["../../../src/connector/discrete/discreteOrmConnectionHandler.ts"],"names":[],"mappings":"AAUA,OAAO,EAAE,aAAa,EAAE,cAAc,EAAE,MAAM,gBAAgB,CAAC;AAC/D,OAAO,EAA4B,KAAK,EAAE,MAAM,oBAAoB,CAAC;AASrE,OAAO,KAAK,EACR,SAAS,EACT,UAAU,EAGb,MAAM,2BAA2B,CAAC;AACnC,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,kBAAkB,CAAC;AASjD,qBAAa,qBAAqB;IAC9B,OAAO,CAAC,MAAM,CAAC,SAAS,CAA4C;IAEpE,QAAQ,CAAC,UAAU,EAAE,MAAM,CAAC;IAC5B,OAAO,CAAC,aAAa,CAEL;IAChB,OAAO,CAAC,mBAAmB,CAA2B;IACtD,OAAO,CAAC,cAAc,CAAqB;IAC3C,OAAO,CAAC,QAAQ,CAAS;IACzB,kBAAkB,EAAE,OAAO,CAAC;IAC5B,aAAa,EAAE,OAAO,CAAS;IAC/B,6DAA6D;IAC7D,cAAc,EAAE,KAAK,EAAE,GAAG,SAAS,CAAC;IACpC,qCAAqC;IACrC,YAAY,EAAE,OAAO,CAAC,IAAI,CAAC,CAAC;IAC5B,OAAO,CAAC,kBAAkB,CAAa;IACvC,0CAA0C;IAC1C,OAAO,CAAC,YAAY,CAAc;IAElC,OAAO;IA+BP,IAAW,YAAY,2DAEtB;IAED;;;;;;OAMG;IACH,OAAc,WAAW,GAAI,CAAC,SAAS,QAAQ,EAC3C,YAAY,MAAM,KACnB,qBAAqB,CActB;IAEK,KAAK,aASV;IAEF,OAAO,CAAC,oBAAoB,CAsB1B;IAEF,OAAO,CAAC,gBAAgB,CAStB;IAEF,OAAO,CAAC,qBAAqB,CAiB3B;IAEF,OAAO,CAAC,eAAe,CAUrB;IAEK,gBAAgB,aAerB;IAEK,iBAAiB,sBAiCtB;CACL;AAED;;;;GAIG;AAEH,wBAAgB,iBAAiB,CAAC,OAAO,EAAE,SAAS,EAAE,GAAG,KAAK,EAAE,CAO/D"}
|
|
@@ -1,48 +0,0 @@
|
|
|
1
|
-
import type { Scope } from "../types.ts";
|
|
2
|
-
import { Patch } from "./applyPatches.ts";
|
|
3
|
-
import type { DeepSignalSet } from "@ng-org/alien-deepsignals";
|
|
4
|
-
import type { ShapeType, BaseType } from "@ng-org/shex-orm";
|
|
5
|
-
export declare class OrmConnection<T extends BaseType> {
|
|
6
|
-
private static idToEntry;
|
|
7
|
-
/**
|
|
8
|
-
* Delay in ms to wait before closing connection.\
|
|
9
|
-
* Useful when a hook unsubscribes and resubscribes in a short time interval
|
|
10
|
-
* so that no new connections need to be set up.
|
|
11
|
-
*/
|
|
12
|
-
readonly shapeType: ShapeType<T>;
|
|
13
|
-
readonly scope: Scope;
|
|
14
|
-
readonly signalObject: DeepSignalSet<T>;
|
|
15
|
-
private stopSignalListening;
|
|
16
|
-
private subscriptionId;
|
|
17
|
-
private refCount;
|
|
18
|
-
/** Identifier as a combination of shape type and scope. Prevents duplications. */
|
|
19
|
-
private identifier;
|
|
20
|
-
suspendDeepWatcher: boolean;
|
|
21
|
-
inTransaction: boolean;
|
|
22
|
-
/** Aggregation of patches to be sent when in transaction. */
|
|
23
|
-
pendingPatches: Patch[] | undefined;
|
|
24
|
-
readyPromise: Promise<void>;
|
|
25
|
-
private closeOrmConnection;
|
|
26
|
-
/** Promise that resolves once initial data has been applied. */
|
|
27
|
-
resolveReady: () => void;
|
|
28
|
-
private static cleanupSignalRegistry;
|
|
29
|
-
private constructor();
|
|
30
|
-
/**
|
|
31
|
-
* Get or create a connection which contains the ORM and lifecycle methods.
|
|
32
|
-
* @param shapeType
|
|
33
|
-
* @param scope
|
|
34
|
-
* @param ng
|
|
35
|
-
* @returns
|
|
36
|
-
*/
|
|
37
|
-
static getOrCreate: <T_1 extends BaseType>(shapeType: ShapeType<T_1>, scope: Scope) => OrmConnection<T_1>;
|
|
38
|
-
close: () => void;
|
|
39
|
-
private onSignalObjectUpdate;
|
|
40
|
-
private onBackendMessage;
|
|
41
|
-
private handleInitialResponse;
|
|
42
|
-
private onBackendUpdate;
|
|
43
|
-
/** Function to create random subject IRIs for newly created nested objects. */
|
|
44
|
-
private signalObjectPropGenerator;
|
|
45
|
-
beginTransaction: () => void;
|
|
46
|
-
commitTransaction: () => Promise<void>;
|
|
47
|
-
}
|
|
48
|
-
//# sourceMappingURL=ormConnectionHandler.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"ormConnectionHandler.d.ts","sourceRoot":"","sources":["../../src/connector/ormConnectionHandler.ts"],"names":[],"mappings":"AAUA,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,aAAa,CAAC;AACzC,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;AAK5D,qBAAa,aAAa,CAAC,CAAC,SAAS,QAAQ;IACzC,OAAO,CAAC,MAAM,CAAC,SAAS,CAAyC;IACjE;;;;OAIG;IAEH,QAAQ,CAAC,SAAS,EAAE,SAAS,CAAC,CAAC,CAAC,CAAC;IACjC,QAAQ,CAAC,KAAK,EAAE,KAAK,CAAC;IACtB,QAAQ,CAAC,YAAY,EAAE,aAAa,CAAC,CAAC,CAAC,CAAC;IACxC,OAAO,CAAC,mBAAmB,CAAa;IACxC,OAAO,CAAC,cAAc,CAAqB;IAC3C,OAAO,CAAC,QAAQ,CAAS;IACzB,kFAAkF;IAClF,OAAO,CAAC,UAAU,CAAS;IAC3B,kBAAkB,EAAE,OAAO,CAAC;IAC5B,aAAa,EAAE,OAAO,CAAS;IAC/B,6DAA6D;IAC7D,cAAc,EAAE,KAAK,EAAE,GAAG,SAAS,CAAC;IACpC,YAAY,EAAE,OAAO,CAAC,IAAI,CAAC,CAAC;IAC5B,OAAO,CAAC,kBAAkB,CAAa;IACvC,gEAAgE;IAChE,YAAY,EAAG,MAAM,IAAI,CAAC;IAG1B,OAAO,CAAC,MAAM,CAAC,qBAAqB,CAUrB;IAEf,OAAO;IAoDP;;;;;;OAMG;IACH,OAAc,WAAW,GAAI,GAAC,SAAS,QAAQ,EAC3C,WAAW,SAAS,CAAC,GAAC,CAAC,EACvB,OAAO,KAAK,KACb,aAAa,CAAC,GAAC,CAAC,CAkBjB;IAEK,KAAK,aAYV;IAEF,OAAO,CAAC,oBAAoB,CAoB1B;IAEF,OAAO,CAAC,gBAAgB,CAStB;IAEF,OAAO,CAAC,qBAAqB,CAuB3B;IACF,OAAO,CAAC,eAAe,CAOrB;IAEF,+EAA+E;IAC/E,OAAO,CAAC,yBAAyB,CAgD/B;IAEK,gBAAgB,aAarB;IAEK,iBAAiB,sBAkCtB;CACL"}
|