@graffy/core 0.16.20-alpha.6 → 0.16.20-alpha.7
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/package.json +3 -3
- package/types/index.d.ts +21 -17
package/package.json
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
"name": "@graffy/core",
|
|
3
3
|
"description": "The main module for Graffy, a library for intuitive real-time data APIs.",
|
|
4
4
|
"author": "aravind (https://github.com/aravindet)",
|
|
5
|
-
"version": "0.16.20-alpha.
|
|
5
|
+
"version": "0.16.20-alpha.7",
|
|
6
6
|
"main": "./index.cjs",
|
|
7
7
|
"exports": {
|
|
8
8
|
"import": "./index.mjs",
|
|
@@ -16,8 +16,8 @@
|
|
|
16
16
|
},
|
|
17
17
|
"license": "Apache-2.0",
|
|
18
18
|
"dependencies": {
|
|
19
|
-
"@graffy/common": "0.16.20-alpha.
|
|
20
|
-
"@graffy/stream": "0.16.20-alpha.
|
|
19
|
+
"@graffy/common": "0.16.20-alpha.7",
|
|
20
|
+
"@graffy/stream": "0.16.20-alpha.7",
|
|
21
21
|
"debug": "^4.3.7"
|
|
22
22
|
}
|
|
23
23
|
}
|
package/types/index.d.ts
CHANGED
|
@@ -15,7 +15,7 @@ type AnyValue = any;
|
|
|
15
15
|
type AnyProjection =
|
|
16
16
|
| boolean
|
|
17
17
|
| { $key: Key }
|
|
18
|
-
|
|
|
18
|
+
| { [key: string]: AnyProjection }
|
|
19
19
|
| AnyProjection[];
|
|
20
20
|
|
|
21
21
|
export type GraffyCollection<CollectionSchema extends AnyObject> = {
|
|
@@ -37,11 +37,13 @@ export default class Graffy<S> {
|
|
|
37
37
|
): Promise<ReadResult<S, Q>>;
|
|
38
38
|
|
|
39
39
|
// Generic one, when the path is not known at compile time.
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
40
|
+
// Should we have this?
|
|
41
|
+
//
|
|
42
|
+
// read<Q extends AnyProjection>(
|
|
43
|
+
// path: string | Key[],
|
|
44
|
+
// projection: Q,
|
|
45
|
+
// options?: GraffyReadOptions,
|
|
46
|
+
// ): Promise<BlindReadResult<Q>>;
|
|
45
47
|
|
|
46
48
|
on: AnyFunction;
|
|
47
49
|
call: AnyFunction;
|
|
@@ -83,7 +85,9 @@ export type Project<S> = S extends AnyLeaf
|
|
|
83
85
|
| (Project<S[string]> & { $key: Key }) // Single $key
|
|
84
86
|
| (Project<S[string]> & { $key: Key })[] // Array $key
|
|
85
87
|
: S extends AnyObject
|
|
86
|
-
?
|
|
88
|
+
? 'string' extends keyof S // No named properties?
|
|
89
|
+
? AnyProjection
|
|
90
|
+
: Partial<{ [K in keyof S]: Project<S[K]> }> | boolean
|
|
87
91
|
: never;
|
|
88
92
|
|
|
89
93
|
// biome-ignore lint/suspicious/noExplicitAny: <explanation>
|
|
@@ -103,15 +107,15 @@ type PlainReadResult<S, Q> = Q extends AnyObject
|
|
|
103
107
|
: S;
|
|
104
108
|
|
|
105
109
|
// What can we tell about ReadResult when schema isn’t known?
|
|
106
|
-
type BlindReadResult<Q> = Q extends Array<infer QItem>
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
// Ignore $key in Q
|
|
113
|
-
type BlindPlainReadResult<Q> = Q extends AnyObject
|
|
114
|
-
|
|
115
|
-
|
|
110
|
+
// type BlindReadResult<Q> = Q extends Array<infer QItem>
|
|
111
|
+
// ? ResultArray<BlindPlainReadResult<QItem>>
|
|
112
|
+
// : Q extends { $key: Key }
|
|
113
|
+
// ? ResultArray<BlindPlainReadResult<Q>>
|
|
114
|
+
// : BlindPlainReadResult<Q>;
|
|
115
|
+
|
|
116
|
+
// // Ignore $key in Q
|
|
117
|
+
// type BlindPlainReadResult<Q> = Q extends AnyObject
|
|
118
|
+
// ? { [K in keyof Q]: BlindReadResult<Q[K]> }
|
|
119
|
+
// : AnyValue;
|
|
116
120
|
|
|
117
121
|
type GraffyReadOptions = AnyObject;
|