@powerhousedao/reactor-browser 3.3.0-staging.0 → 4.0.0-staging.0
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/dist/package.json +2 -2
- package/dist/src/hooks/document-state.d.ts.map +1 -1
- package/dist/src/hooks/document-state.js +5 -1
- package/dist/src/hooks/document-state.js.map +1 -1
- package/dist/src/hooks/useDocumentDrives.d.ts.map +1 -1
- package/dist/src/hooks/useDocumentDrives.js +4 -0
- package/dist/src/hooks/useDocumentDrives.js.map +1 -1
- package/dist/src/index.d.ts +1 -1
- package/dist/src/index.d.ts.map +1 -1
- package/dist/src/index.js +1 -1
- package/dist/src/index.js.map +1 -1
- package/dist/src/relational/hooks/index.d.ts +3 -0
- package/dist/src/relational/hooks/index.d.ts.map +1 -0
- package/dist/src/relational/hooks/index.js +3 -0
- package/dist/src/relational/hooks/index.js.map +1 -0
- package/dist/src/relational/hooks/useRelationalDb.d.ts +12 -0
- package/dist/src/relational/hooks/useRelationalDb.d.ts.map +1 -0
- package/dist/src/{operational/hooks/useOperationalStore.js → relational/hooks/useRelationalDb.js} +12 -9
- package/dist/src/relational/hooks/useRelationalDb.js.map +1 -0
- package/dist/src/relational/hooks/useRelationalQuery.d.ts +16 -0
- package/dist/src/relational/hooks/useRelationalQuery.d.ts.map +1 -0
- package/dist/src/relational/hooks/useRelationalQuery.js +38 -0
- package/dist/src/relational/hooks/useRelationalQuery.js.map +1 -0
- package/dist/src/relational/index.d.ts.map +1 -0
- package/dist/src/relational/index.js.map +1 -0
- package/dist/src/relational/utils/createProcessorQuery.d.ts +17 -0
- package/dist/src/relational/utils/createProcessorQuery.d.ts.map +1 -0
- package/dist/src/{operational/utils/createTypedQuery.js → relational/utils/createProcessorQuery.js} +5 -5
- package/dist/src/relational/utils/createProcessorQuery.js.map +1 -0
- package/dist/src/relational/utils/index.d.ts +2 -0
- package/dist/src/relational/utils/index.d.ts.map +1 -0
- package/dist/src/relational/utils/index.js +2 -0
- package/dist/src/relational/utils/index.js.map +1 -0
- package/dist/tsconfig.lib.tsbuildinfo +1 -1
- package/package.json +4 -4
- package/dist/src/operational/hooks/index.d.ts +0 -3
- package/dist/src/operational/hooks/index.d.ts.map +0 -1
- package/dist/src/operational/hooks/index.js +0 -3
- package/dist/src/operational/hooks/index.js.map +0 -1
- package/dist/src/operational/hooks/useOperationalQuery.d.ts +0 -12
- package/dist/src/operational/hooks/useOperationalQuery.d.ts.map +0 -1
- package/dist/src/operational/hooks/useOperationalQuery.js +0 -27
- package/dist/src/operational/hooks/useOperationalQuery.js.map +0 -1
- package/dist/src/operational/hooks/useOperationalStore.d.ts +0 -12
- package/dist/src/operational/hooks/useOperationalStore.d.ts.map +0 -1
- package/dist/src/operational/hooks/useOperationalStore.js.map +0 -1
- package/dist/src/operational/index.d.ts.map +0 -1
- package/dist/src/operational/index.js.map +0 -1
- package/dist/src/operational/utils/createTypedQuery.d.ts +0 -16
- package/dist/src/operational/utils/createTypedQuery.d.ts.map +0 -1
- package/dist/src/operational/utils/createTypedQuery.js.map +0 -1
- package/dist/src/operational/utils/index.d.ts +0 -2
- package/dist/src/operational/utils/index.d.ts.map +0 -1
- package/dist/src/operational/utils/index.js +0 -2
- package/dist/src/operational/utils/index.js.map +0 -1
- /package/dist/src/{operational → relational}/index.d.ts +0 -0
- /package/dist/src/{operational → relational}/index.js +0 -0
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@powerhousedao/reactor-browser",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "4.0.0-staging.0",
|
|
4
4
|
"license": "AGPL-3.0-only",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"repository": {
|
|
@@ -19,7 +19,7 @@
|
|
|
19
19
|
".": "./dist/src/index.js",
|
|
20
20
|
"./analytics": "./dist/src/analytics/analytics.js",
|
|
21
21
|
"./pglite": "./dist/src/pglite/index.js",
|
|
22
|
-
"./
|
|
22
|
+
"./relational": "./dist/src/relational/index.js",
|
|
23
23
|
"./*": "./dist/src/*.js"
|
|
24
24
|
},
|
|
25
25
|
"devDependencies": {
|
|
@@ -56,8 +56,8 @@
|
|
|
56
56
|
"lodash.isequal": "^4.5.0",
|
|
57
57
|
"luxon": "^3.6.1",
|
|
58
58
|
"lz-string": "^1.5.0",
|
|
59
|
-
"document-drive": "
|
|
60
|
-
"document-model": "
|
|
59
|
+
"document-drive": "4.0.0-staging.0",
|
|
60
|
+
"document-model": "4.0.0-staging.0"
|
|
61
61
|
},
|
|
62
62
|
"scripts": {
|
|
63
63
|
"build:tsc": "tsc --build",
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/operational/hooks/index.ts"],"names":[],"mappings":"AAAA,cAAc,0BAA0B,CAAC;AACzC,cAAc,0BAA0B,CAAC"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/operational/hooks/index.ts"],"names":[],"mappings":"AAAA,cAAc,0BAA0B,CAAC;AACzC,cAAc,0BAA0B,CAAC"}
|
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
import { type LiveQueryResults } from "@electric-sql/pglite/live";
|
|
2
|
-
import { type Kysely } from "kysely";
|
|
3
|
-
export type QueryCallbackReturnType = {
|
|
4
|
-
sql: string;
|
|
5
|
-
parameters?: readonly unknown[];
|
|
6
|
-
};
|
|
7
|
-
export declare function useOperationalQuery<Schema, T = unknown, TParams = undefined>(queryCallback: (db: Kysely<Schema>, parameters?: TParams) => QueryCallbackReturnType, parameters?: TParams): {
|
|
8
|
-
readonly isLoading: boolean;
|
|
9
|
-
readonly error: Error | null;
|
|
10
|
-
readonly result: LiveQueryResults<T> | null;
|
|
11
|
-
};
|
|
12
|
-
//# sourceMappingURL=useOperationalQuery.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"useOperationalQuery.d.ts","sourceRoot":"","sources":["../../../../src/operational/hooks/useOperationalQuery.ts"],"names":[],"mappings":"AAAA,OAAO,EAEL,KAAK,gBAAgB,EACtB,MAAM,2BAA2B,CAAC;AACnC,OAAO,EAAE,KAAK,MAAM,EAAE,MAAM,QAAQ,CAAC;AAIrC,MAAM,MAAM,uBAAuB,GAAG;IACpC,GAAG,EAAE,MAAM,CAAC;IACZ,UAAU,CAAC,EAAE,SAAS,OAAO,EAAE,CAAC;CACjC,CAAC;AAEF,wBAAgB,mBAAmB,CAAC,MAAM,EAAE,CAAC,GAAG,OAAO,EAAE,OAAO,GAAG,SAAS,EAC1E,aAAa,EAAE,CACb,EAAE,EAAE,MAAM,CAAC,MAAM,CAAC,EAClB,UAAU,CAAC,EAAE,OAAO,KACjB,uBAAuB,EAC5B,UAAU,CAAC,EAAE,OAAO;;;;EAkCrB"}
|
|
@@ -1,27 +0,0 @@
|
|
|
1
|
-
import { useEffect, useState } from "react";
|
|
2
|
-
import { useOperationalStore } from "./useOperationalStore.js";
|
|
3
|
-
export function useOperationalQuery(queryCallback, parameters) {
|
|
4
|
-
const [result, setResult] = useState(null);
|
|
5
|
-
const [queryLoading, setQueryLoading] = useState(true);
|
|
6
|
-
const operationalStore = useOperationalStore();
|
|
7
|
-
useEffect(() => {
|
|
8
|
-
let live = Promise.resolve(null);
|
|
9
|
-
if (operationalStore.db) {
|
|
10
|
-
const compiledQuery = queryCallback(operationalStore.db, parameters);
|
|
11
|
-
const { sql, parameters: queryParameters } = compiledQuery;
|
|
12
|
-
live = operationalStore.db.live.query(sql, queryParameters ? [...queryParameters] : [], (result) => {
|
|
13
|
-
setResult(result);
|
|
14
|
-
setQueryLoading(false);
|
|
15
|
-
});
|
|
16
|
-
}
|
|
17
|
-
return () => {
|
|
18
|
-
void live.then((l) => l?.unsubscribe());
|
|
19
|
-
};
|
|
20
|
-
}, [operationalStore.db, queryCallback, parameters]);
|
|
21
|
-
return {
|
|
22
|
-
isLoading: operationalStore.isLoading || queryLoading,
|
|
23
|
-
error: operationalStore.error,
|
|
24
|
-
result,
|
|
25
|
-
};
|
|
26
|
-
}
|
|
27
|
-
//# sourceMappingURL=useOperationalQuery.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"useOperationalQuery.js","sourceRoot":"","sources":["../../../../src/operational/hooks/useOperationalQuery.ts"],"names":[],"mappings":"AAKA,OAAO,EAAE,SAAS,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAC;AAC5C,OAAO,EAAE,mBAAmB,EAAE,MAAM,0BAA0B,CAAC;AAO/D,MAAM,UAAU,mBAAmB,CACjC,aAG4B,EAC5B,UAAoB;IAEpB,MAAM,CAAC,MAAM,EAAE,SAAS,CAAC,GAAG,QAAQ,CAA6B,IAAI,CAAC,CAAC;IACvE,MAAM,CAAC,YAAY,EAAE,eAAe,CAAC,GAAG,QAAQ,CAAC,IAAI,CAAC,CAAC;IAEvD,MAAM,gBAAgB,GAAG,mBAAmB,EAAU,CAAC;IAEvD,SAAS,CAAC,GAAG,EAAE;QACb,IAAI,IAAI,GAAiC,OAAO,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC;QAE/D,IAAI,gBAAgB,CAAC,EAAE,EAAE,CAAC;YACxB,MAAM,aAAa,GAAG,aAAa,CAAC,gBAAgB,CAAC,EAAE,EAAE,UAAU,CAAC,CAAC;YACrE,MAAM,EAAE,GAAG,EAAE,UAAU,EAAE,eAAe,EAAE,GAAG,aAAa,CAAC;YAE3D,IAAI,GAAG,gBAAgB,CAAC,EAAE,CAAC,IAAI,CAAC,KAAK,CACnC,GAAG,EACH,eAAe,CAAC,CAAC,CAAC,CAAC,GAAG,eAAe,CAAC,CAAC,CAAC,CAAC,EAAE,EAC3C,CAAC,MAAM,EAAE,EAAE;gBACT,SAAS,CAAC,MAAM,CAAC,CAAC;gBAClB,eAAe,CAAC,KAAK,CAAC,CAAC;YACzB,CAAC,CACF,CAAC;QACJ,CAAC;QAED,OAAO,GAAG,EAAE;YACV,KAAK,IAAI,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,EAAE,WAAW,EAAE,CAAC,CAAC;QAC1C,CAAC,CAAC;IACJ,CAAC,EAAE,CAAC,gBAAgB,CAAC,EAAE,EAAE,aAAa,EAAE,UAAU,CAAC,CAAC,CAAC;IAErD,OAAO;QACL,SAAS,EAAE,gBAAgB,CAAC,SAAS,IAAI,YAAY;QACrD,KAAK,EAAE,gBAAgB,CAAC,KAAK;QAC7B,MAAM;KACE,CAAC;AACb,CAAC"}
|
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
import { type LiveNamespace } from "@electric-sql/pglite/live";
|
|
2
|
-
import { Kysely } from "kysely";
|
|
3
|
-
export type EnhancedKysely<Schema> = Kysely<Schema> & {
|
|
4
|
-
live: LiveNamespace;
|
|
5
|
-
};
|
|
6
|
-
export interface IOperationalStore<Schema> {
|
|
7
|
-
db: EnhancedKysely<Schema> | null;
|
|
8
|
-
isLoading: boolean;
|
|
9
|
-
error: Error | null;
|
|
10
|
-
}
|
|
11
|
-
export declare const useOperationalStore: <Schema>() => IOperationalStore<Schema>;
|
|
12
|
-
//# sourceMappingURL=useOperationalStore.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"useOperationalStore.d.ts","sourceRoot":"","sources":["../../../../src/operational/hooks/useOperationalStore.ts"],"names":[],"mappings":"AACA,OAAO,EACL,KAAK,aAAa,EAEnB,MAAM,2BAA2B,CAAC;AACnC,OAAO,EAAE,MAAM,EAAE,MAAM,QAAQ,CAAC;AAMhC,MAAM,MAAM,cAAc,CAAC,MAAM,IAAI,MAAM,CAAC,MAAM,CAAC,GAAG;IAAE,IAAI,EAAE,aAAa,CAAA;CAAE,CAAC;AAE9E,MAAM,WAAW,iBAAiB,CAAC,MAAM;IACvC,EAAE,EAAE,cAAc,CAAC,MAAM,CAAC,GAAG,IAAI,CAAC;IAClC,SAAS,EAAE,OAAO,CAAC;IACnB,KAAK,EAAE,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,CAAC,CAAC,CAAC;IAEb,OAAO,aAAa,CAAC;AACvB,CAAC,CAAC"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/operational/index.ts"],"names":[],"mappings":"AAAA,cAAc,kBAAkB,CAAC;AACjC,cAAc,kBAAkB,CAAC"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/operational/index.ts"],"names":[],"mappings":"AAAA,cAAc,kBAAkB,CAAC;AACjC,cAAc,kBAAkB,CAAC"}
|
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
import { type LiveQueryResults } from "@electric-sql/pglite/live";
|
|
2
|
-
import { type CompiledQuery, type Kysely } from "kysely";
|
|
3
|
-
import { type QueryCallbackReturnType } from "../hooks/useOperationalQuery.js";
|
|
4
|
-
export declare function createTypedQuery<Schema>(): {
|
|
5
|
-
<TQueryBuilder extends (db: Kysely<Schema>) => QueryCallbackReturnType>(queryCallback: TQueryBuilder): {
|
|
6
|
-
isLoading: boolean;
|
|
7
|
-
error: Error | null;
|
|
8
|
-
result: LiveQueryResults<ReturnType<TQueryBuilder> extends CompiledQuery<infer R> ? R : any> | null;
|
|
9
|
-
};
|
|
10
|
-
<TParams, TQueryBuilder extends (db: Kysely<Schema>, parameters: TParams) => QueryCallbackReturnType>(queryCallback: TQueryBuilder, parameters: TParams): {
|
|
11
|
-
isLoading: boolean;
|
|
12
|
-
error: Error | null;
|
|
13
|
-
result: LiveQueryResults<ReturnType<TQueryBuilder> extends CompiledQuery<infer R> ? R : any> | null;
|
|
14
|
-
};
|
|
15
|
-
};
|
|
16
|
-
//# sourceMappingURL=createTypedQuery.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"createTypedQuery.d.ts","sourceRoot":"","sources":["../../../../src/operational/utils/createTypedQuery.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,gBAAgB,EAAE,MAAM,2BAA2B,CAAC;AAClE,OAAO,EAAE,KAAK,aAAa,EAAE,KAAK,MAAM,EAAE,MAAM,QAAQ,CAAC;AAIzD,OAAO,EACL,KAAK,uBAAuB,EAE7B,MAAM,iCAAiC,CAAC;AAczC,wBAAgB,gBAAgB,CAAC,MAAM;KAGnC,aAAa,SAAS,CAAC,EAAE,EAAE,MAAM,CAAC,MAAM,CAAC,KAAK,uBAAuB,iBAEtD,aAAa,GAC3B;QACD,SAAS,EAAE,OAAO,CAAC;QACnB,KAAK,EAAE,KAAK,GAAG,IAAI,CAAC;QACpB,MAAM,EAAE,gBAAgB,CACtB,UAAU,CAAC,aAAa,CAAC,SAAS,aAAa,CAAC,MAAM,CAAC,CAAC,GAAG,CAAC,GAAG,GAAG,CACnE,GAAG,IAAI,CAAC;KACV;KAIC,OAAO,EACP,aAAa,SAAS,CACpB,EAAE,EAAE,MAAM,CAAC,MAAM,CAAC,EAClB,UAAU,EAAE,OAAO,KAChB,uBAAuB,iBAEb,aAAa,cAChB,OAAO,GAClB;QACD,SAAS,EAAE,OAAO,CAAC;QACnB,KAAK,EAAE,KAAK,GAAG,IAAI,CAAC;QACpB,MAAM,EAAE,gBAAgB,CACtB,UAAU,CAAC,aAAa,CAAC,SAAS,aAAa,CAAC,MAAM,CAAC,CAAC,GAAG,CAAC,GAAG,GAAG,CACnE,GAAG,IAAI,CAAC;KACV;EAsCF"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"createTypedQuery.js","sourceRoot":"","sources":["../../../../src/operational/utils/createTypedQuery.ts"],"names":[],"mappings":"AAEA,OAAO,SAAS,MAAM,gBAAgB,CAAC;AACvC,OAAO,EAAE,WAAW,EAAE,OAAO,EAAE,MAAM,EAAE,MAAM,OAAO,CAAC;AAErD,OAAO,EAEL,mBAAmB,GACpB,MAAM,iCAAiC,CAAC;AAEzC,wCAAwC;AACxC,SAAS,eAAe,CAAI,MAAS;IACnC,MAAM,aAAa,GAAG,MAAM,EAAK,CAAC;IAElC,OAAO,OAAO,CAAC,GAAG,EAAE;QAClB,IAAI,CAAC,SAAS,CAAC,aAAa,CAAC,OAAO,EAAE,MAAM,CAAC,EAAE,CAAC;YAC9C,aAAa,CAAC,OAAO,GAAG,MAAM,CAAC;QACjC,CAAC;QACD,OAAO,aAAa,CAAC,OAAY,CAAC;IACpC,CAAC,EAAE,CAAC,MAAM,CAAC,CAAC,CAAC;AACf,CAAC;AAED,MAAM,UAAU,gBAAgB;IAgC9B,SAAS,QAAQ,CAOf,aAA4B,EAC5B,UAAoB;QAWpB,yDAAyD;QACzD,MAAM,YAAY,GAAG,eAAe,CAAC,UAAU,CAAC,CAAC;QAEjD,kFAAkF;QAClF,MAAM,gBAAgB,GAAG,WAAW,CAAC,aAAa,EAAE,CAAC,YAAY,CAAC,CAAC,CAAC;QAEpE,OAAO,mBAAmB,CACxB,gBAAgB,EAChB,YAAY,CAKb,CAAC;IACJ,CAAC;IAED,OAAO,QAAQ,CAAC;AAClB,CAAC"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/operational/utils/index.ts"],"names":[],"mappings":"AAAA,cAAc,uBAAuB,CAAC"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/operational/utils/index.ts"],"names":[],"mappings":"AAAA,cAAc,uBAAuB,CAAC"}
|
|
File without changes
|
|
File without changes
|