Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@graffy/core

Package Overview
Dependencies
Maintainers
0
Versions
230
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@graffy/core - npm Package Compare versions

Comparing version 0.16.20-alpha.5 to 0.16.20-alpha.6

6

package.json

@@ -5,3 +5,3 @@ {

"author": "aravind (https://github.com/aravindet)",
"version": "0.16.20-alpha.5",
"version": "0.16.20-alpha.6",
"main": "./index.cjs",

@@ -20,6 +20,6 @@ "exports": {

"dependencies": {
"@graffy/common": "0.16.20-alpha.5",
"@graffy/stream": "0.16.20-alpha.5",
"@graffy/common": "0.16.20-alpha.6",
"@graffy/stream": "0.16.20-alpha.6",
"debug": "^4.3.7"
}
}

@@ -12,2 +12,11 @@ export type AnyLeaf = string | number | boolean | null;

// biome-ignore lint/suspicious/noExplicitAny: Any value is for results.
type AnyValue = any;
type AnyProjection =
| boolean
| { $key: Key }
| Record<string, AnyProjection>
| AnyProjection[];
export type GraffyCollection<CollectionSchema extends AnyObject> = {

@@ -31,2 +40,9 @@ [name: string]: CollectionSchema;

// Generic one, when the path is not known at compile time.
read<Q extends AnyProjection>(
path: string | Key[],
projection: Q,
options?: GraffyReadOptions,
): Promise<BlindReadResult<Q>>;
on: AnyFunction;

@@ -68,4 +84,5 @@ call: AnyFunction;

?
| (Project<S[string]> & { $key: Key })
| (Project<S[string]> & { $key: Key })[]
| { [key: string]: Project<S[string]> } // Object form
| (Project<S[string]> & { $key: Key }) // Single $key
| (Project<S[string]> & { $key: Key })[] // Array $key
: S extends AnyObject

@@ -79,9 +96,26 @@ ? Partial<{ [K in keyof S]: Project<S[K]> }> | boolean

type ReadResult<S, Q> = S extends GraffyCollection<AnyObject>
? Q extends Array<AnyObject> | { $key: Key }
? ResultArray<S[string] & { $key: Key }>
: S[string] & { $key: Key }
: Q extends AnyObject
? { [K in keyof S & keyof Q]: ReadResult<S[K], Q[K]> }
: S;
? Q extends Array<infer QItem>
? ResultArray<PlainReadResult<S[string], QItem> & { $key: Key }> // Array $key
: Q extends { $key: Key }
? ResultArray<PlainReadResult<S[string], Q> & { $key: Key }> // Single $key
: { [K in keyof Q]: PlainReadResult<S[string], Q[K]> } // Object form
: PlainReadResult<S, Q>;
// Ignore $key in Q
type PlainReadResult<S, Q> = Q extends AnyObject
? { [K in keyof S & keyof Q]: ReadResult<S[K], Q[K]> }
: S;
// What can we tell about ReadResult when schema isn’t known?
type BlindReadResult<Q> = Q extends Array<infer QItem>
? ResultArray<BlindPlainReadResult<QItem>>
: Q extends { $key: Key }
? ResultArray<BlindPlainReadResult<Q>>
: BlindPlainReadResult<Q>;
// Ignore $key in Q
type BlindPlainReadResult<Q> = Q extends AnyObject
? { [K in keyof Q]: BlindReadResult<Q[K]> }
: AnyValue;
type GraffyReadOptions = AnyObject;
SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc