@ersbeth/picoflow 1.1.1 → 1.1.2
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/picoflow.js
CHANGED
|
@@ -1627,7 +1627,10 @@ function fromNode(node) {
|
|
|
1627
1627
|
let fx;
|
|
1628
1628
|
onMount(() => {
|
|
1629
1629
|
fx = new FlowEffect(async (t) => {
|
|
1630
|
-
node.watch(t);
|
|
1630
|
+
const watched = node.watch(t);
|
|
1631
|
+
if (watched instanceof Promise) {
|
|
1632
|
+
await watched;
|
|
1633
|
+
}
|
|
1631
1634
|
solidResource.refetch();
|
|
1632
1635
|
});
|
|
1633
1636
|
});
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { FlowReadonly, FlowReadonlyAsync } from '../flow';
|
|
2
2
|
import { FlowTracker } from '../flow/base/flowTracker';
|
|
3
3
|
import { SolidResource } from './primitives';
|
|
4
|
+
import { NotPromise } from '../flow/base';
|
|
4
5
|
/**
|
|
5
6
|
* Utility type that excludes Promise types from T.
|
|
6
7
|
* Used to ensure type safety for synchronous derivations/resources.
|
|
@@ -49,5 +50,8 @@ import { SolidResource } from './primitives';
|
|
|
49
50
|
*
|
|
50
51
|
* @public
|
|
51
52
|
*/
|
|
52
|
-
export declare function from<T>(flow: FlowReadonlyAsync<T>
|
|
53
|
+
export declare function from<T>(flow: FlowReadonlyAsync<T>): SolidResource<T>;
|
|
54
|
+
export declare function from<T>(flow: FlowReadonly<T>): SolidResource<T>;
|
|
55
|
+
export declare function from<T>(flow: (t: FlowTracker) => Promise<T>): SolidResource<T>;
|
|
56
|
+
export declare function from<T>(flow: (t: FlowTracker) => NotPromise<T>): SolidResource<T>;
|
|
53
57
|
//# sourceMappingURL=converters.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"converters.d.ts","sourceRoot":"","sources":["../../../src/solid/converters.ts"],"names":[],"mappings":"AACA,OAAO,EAAY,KAAK,YAAY,EAAE,KAAK,iBAAiB,EAAE,MAAM,SAAS,CAAC;AAE9E,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,0BAA0B,CAAC;AAE5D,OAAO,EAAE,aAAa,EAAE,MAAM,cAAc,CAAC;
|
|
1
|
+
{"version":3,"file":"converters.d.ts","sourceRoot":"","sources":["../../../src/solid/converters.ts"],"names":[],"mappings":"AACA,OAAO,EAAY,KAAK,YAAY,EAAE,KAAK,iBAAiB,EAAE,MAAM,SAAS,CAAC;AAE9E,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,0BAA0B,CAAC;AAE5D,OAAO,EAAE,aAAa,EAAE,MAAM,cAAc,CAAC;AAC7C,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;AAqE/C;;;;;GAKG;AAGH;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAyCG;AACH,wBAAgB,IAAI,CAAC,CAAC,EAAE,IAAI,EAAE,iBAAiB,CAAC,CAAC,CAAC,GAAG,aAAa,CAAC,CAAC,CAAC,CAAC;AACtE,wBAAgB,IAAI,CAAC,CAAC,EAAE,IAAI,EAAE,YAAY,CAAC,CAAC,CAAC,GAAG,aAAa,CAAC,CAAC,CAAC,CAAC;AACjE,wBAAgB,IAAI,CAAC,CAAC,EAAE,IAAI,EAAE,CAAC,CAAC,EAAE,WAAW,KAAK,OAAO,CAAC,CAAC,CAAC,GAAG,aAAa,CAAC,CAAC,CAAC,CAAC;AAChF,wBAAgB,IAAI,CAAC,CAAC,EACrB,IAAI,EAAE,CAAC,CAAC,EAAE,WAAW,KAAK,UAAU,CAAC,CAAC,CAAC,GACrC,aAAa,CAAC,CAAC,CAAC,CAAC"}
|
package/package.json
CHANGED
package/src/solid/converters.ts
CHANGED
|
@@ -4,7 +4,7 @@ import { FlowEffect } from "../flow/base";
|
|
|
4
4
|
import type { FlowTracker } from "../flow/base/flowTracker";
|
|
5
5
|
import { FlowNodeAsync } from "../flow/nodes/async/flowNodeAsync";
|
|
6
6
|
import { SolidResource } from "./primitives";
|
|
7
|
-
|
|
7
|
+
import type { NotPromise } from "../flow/base";
|
|
8
8
|
/**
|
|
9
9
|
* Converts an asynchronous FlowNodeAsync (Promise-based) into a SolidJS resource.
|
|
10
10
|
*
|
|
@@ -36,7 +36,10 @@ function fromNode<T>(node: FlowNodeAsync<T> | FlowNode<T>): SolidResource<T> {
|
|
|
36
36
|
|
|
37
37
|
onMount(() => {
|
|
38
38
|
fx = new FlowEffect(async (t) => {
|
|
39
|
-
node.watch(t);
|
|
39
|
+
const watched = node.watch(t);
|
|
40
|
+
if (watched instanceof Promise) {
|
|
41
|
+
await watched;
|
|
42
|
+
}
|
|
40
43
|
solidResource.refetch();
|
|
41
44
|
});
|
|
42
45
|
});
|
|
@@ -120,11 +123,17 @@ function fromGetter<T>(
|
|
|
120
123
|
*
|
|
121
124
|
* @public
|
|
122
125
|
*/
|
|
126
|
+
export function from<T>(flow: FlowReadonlyAsync<T>): SolidResource<T>;
|
|
127
|
+
export function from<T>(flow: FlowReadonly<T>): SolidResource<T>;
|
|
128
|
+
export function from<T>(flow: (t: FlowTracker) => Promise<T>): SolidResource<T>;
|
|
129
|
+
export function from<T>(
|
|
130
|
+
flow: (t: FlowTracker) => NotPromise<T>,
|
|
131
|
+
): SolidResource<T>;
|
|
123
132
|
export function from<T>(
|
|
124
133
|
flow:
|
|
125
134
|
| FlowReadonlyAsync<T>
|
|
126
135
|
| FlowReadonly<T>
|
|
127
|
-
| ((t: FlowTracker) => T)
|
|
136
|
+
| ((t: FlowTracker) => NotPromise<T>)
|
|
128
137
|
| ((t: FlowTracker) => Promise<T>),
|
|
129
138
|
): SolidResource<T> {
|
|
130
139
|
if (flow instanceof FlowNodeAsync || flow instanceof FlowNode) {
|