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

@supabase/postgrest-js

Package Overview
Dependencies
Maintainers
11
Versions
135
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@supabase/postgrest-js - npm Package Compare versions

Comparing version 1.17.0-rc.3 to 1.17.0-rc.4

4

dist/cjs/select-query-parser/result.d.ts

@@ -5,3 +5,3 @@ import { GenericTable } from '../types';

import { AggregateFunctions, ExtractFirstProperty, GenericSchema, IsNonEmptyArray, Prettify, TablesAndViews, TypeScriptTypes } from './types';
import { CheckDuplicateEmbededReference, GetFieldNodeResultName, IsRelationNullable, ResolveRelationship, SelectQueryError, UnwrapErrorMessages } from './utils';
import { CheckDuplicateEmbededReference, GetFieldNodeResultName, IsRelationNullable, ResolveRelationship, SelectQueryError } from './utils';
/**

@@ -16,3 +16,3 @@ * Main entry point for constructing the result type of a PostgREST query.

*/
export declare type GetResult<Schema extends GenericSchema, Row extends Record<string, unknown>, RelationName, Relationships, Query extends string> = Relationships extends null ? ParseQuery<Query> extends infer ParsedQuery extends Ast.Node[] ? UnwrapErrorMessages<RPCCallNodes<ParsedQuery, RelationName extends string ? RelationName : 'rpc_call', Row>> : Row : ParseQuery<Query> extends infer ParsedQuery ? ParsedQuery extends Ast.Node[] ? RelationName extends string ? Relationships extends GenericRelationship[] ? UnwrapErrorMessages<ProcessNodes<Schema, Row, RelationName, Relationships, ParsedQuery>> : UnwrapErrorMessages<SelectQueryError<'Invalid Relationships cannot infer result type'>> : UnwrapErrorMessages<SelectQueryError<'Invalid RelationName cannot infer result type'>> : UnwrapErrorMessages<ParsedQuery> : never;
export declare type GetResult<Schema extends GenericSchema, Row extends Record<string, unknown>, RelationName, Relationships, Query extends string> = Relationships extends null ? ParseQuery<Query> extends infer ParsedQuery extends Ast.Node[] ? RPCCallNodes<ParsedQuery, RelationName extends string ? RelationName : 'rpc_call', Row> : Row : ParseQuery<Query> extends infer ParsedQuery ? ParsedQuery extends Ast.Node[] ? RelationName extends string ? Relationships extends GenericRelationship[] ? ProcessNodes<Schema, Row, RelationName, Relationships, ParsedQuery> : SelectQueryError<'Invalid Relationships cannot infer result type'> : SelectQueryError<'Invalid RelationName cannot infer result type'> : ParsedQuery : never;
/**

@@ -19,0 +19,0 @@ * Processes a single Node from a select chained after a rpc call

@@ -6,6 +6,2 @@ import { Ast } from './parser';

} & Message;
declare type RequireHintingSelectQueryError<DistantName extends string, RelationName extends string> = SelectQueryError<`Could not embed because more than one relationship was found for '${DistantName}' and '${RelationName}' you need to hint the column with ${DistantName}!<columnName> ?`>;
export declare type UnwrapErrorMessages<T> = T extends SelectQueryError<infer M> ? M : T extends SelectQueryError<infer M>[] ? M[] : T extends (infer U)[] ? UnwrapErrorMessages<U>[] : T extends Record<string, unknown> ? {
[K in keyof T]: UnwrapErrorMessages<T[K]>;
} : T;
export declare type GetFieldNodeResultName<Field extends Ast.FieldNode> = Field['alias'] extends string ? Field['alias'] : Field['aggregateFunction'] extends AggregateFunctions ? Field['aggregateFunction'] : Field['name'];

@@ -72,3 +68,3 @@ declare type FilterRelationNodes<Nodes extends Ast.Node[]> = UnionToArray<{

} ? HasFKeyToFRel<FRelName, Rest> extends true ? true : HasMultipleFKeysToFRel<FRelName, Rest> : HasMultipleFKeysToFRel<FRelName, Rest> : false;
declare type CheckRelationshipError<Schema extends GenericSchema, Relationships extends GenericRelationship[], CurrentTableOrView extends keyof TablesAndViews<Schema>, FoundRelation> = FoundRelation extends SelectQueryError<string> ? FoundRelation : FoundRelation extends {
declare type CheckRelationshipError<Schema extends GenericSchema, Relationships extends GenericRelationship[], CurrentTableOrView extends keyof TablesAndViews<Schema> & string, FoundRelation> = FoundRelation extends SelectQueryError<string> ? FoundRelation : FoundRelation extends {
relation: {

@@ -79,3 +75,3 @@ referencedRelation: infer RelatedRelationName extends string;

direction: 'reverse';
} ? HasMultipleFKeysToFRel<RelatedRelationName, Relationships> extends true ? RequireHintingSelectQueryError<RelatedRelationName, CurrentTableOrView extends string ? CurrentTableOrView : 'unknown'> : FoundRelation : FoundRelation extends {
} ? HasMultipleFKeysToFRel<RelatedRelationName, Relationships> extends true ? SelectQueryError<`Could not embed because more than one relationship was found for '${RelatedRelationName}' and '${CurrentTableOrView}' you need to hint the column with ${RelatedRelationName}!<columnName> ?`> : FoundRelation : FoundRelation extends {
relation: {

@@ -86,4 +82,4 @@ referencedRelation: infer RelatedRelationName extends string;

direction: 'forward';
from: infer From extends keyof TablesAndViews<Schema>;
} ? HasMultipleFKeysToFRel<RelatedRelationName, TablesAndViews<Schema>[From]['Relationships']> extends true ? RequireHintingSelectQueryError<From extends string ? From : 'unknown', RelatedRelationName> : FoundRelation : FoundRelation;
from: infer From extends keyof TablesAndViews<Schema> & string;
} ? HasMultipleFKeysToFRel<RelatedRelationName, TablesAndViews<Schema>[From]['Relationships']> extends true ? SelectQueryError<`Could not embed because more than one relationship was found for '${From}' and '${RelatedRelationName}' you need to hint the column with ${From}!<columnName> ?`> : FoundRelation : FoundRelation;
/**

@@ -96,3 +92,3 @@ * Resolves relationships for embedded resources and retrieves the referenced Table

*/
declare type ResolveReverseRelationship<Schema extends GenericSchema, Relationships extends GenericRelationship[], Field extends Ast.FieldNode, CurrentTableOrView extends keyof TablesAndViews<Schema>> = FindFieldMatchingRelationships<Schema, Relationships, Field> extends infer FoundRelation ? FoundRelation extends never ? false : FoundRelation extends {
declare type ResolveReverseRelationship<Schema extends GenericSchema, Relationships extends GenericRelationship[], Field extends Ast.FieldNode, CurrentTableOrView extends keyof TablesAndViews<Schema> & string> = FindFieldMatchingRelationships<Schema, Relationships, Field> extends infer FoundRelation ? FoundRelation extends never ? false : FoundRelation extends {
referencedRelation: infer RelatedRelationName extends string;

@@ -106,3 +102,3 @@ } ? RelatedRelationName extends keyof TablesAndViews<Schema> ? FoundRelation extends {

from: CurrentTableOrView;
} : HasMultipleFKeysToFRel<RelatedRelationName, Relationships> extends true ? RequireHintingSelectQueryError<RelatedRelationName, CurrentTableOrView extends string ? CurrentTableOrView : 'unknown'> : {
} : HasMultipleFKeysToFRel<RelatedRelationName, Relationships> extends true ? SelectQueryError<`Could not embed because more than one relationship was found for '${RelatedRelationName}' and '${CurrentTableOrView}' you need to hint the column with ${RelatedRelationName}!<columnName> ?`> : {
referencedTable: TablesAndViews<Schema>[RelatedRelationName];

@@ -109,0 +105,0 @@ relation: FoundRelation;

{
"name": "@supabase/postgrest-js",
"version": "1.17.0-rc.3",
"version": "1.17.0-rc.4",
"description": "Isomorphic PostgREST client",

@@ -5,0 +5,0 @@ "keywords": [

@@ -19,3 +19,2 @@ import { GenericTable } from '../types'

SelectQueryError,
UnwrapErrorMessages,
} from './utils'

@@ -40,5 +39,3 @@

? ParseQuery<Query> extends infer ParsedQuery extends Ast.Node[]
? UnwrapErrorMessages<
RPCCallNodes<ParsedQuery, RelationName extends string ? RelationName : 'rpc_call', Row>
>
? RPCCallNodes<ParsedQuery, RelationName extends string ? RelationName : 'rpc_call', Row>
: Row

@@ -49,6 +46,6 @@ : ParseQuery<Query> extends infer ParsedQuery

? Relationships extends GenericRelationship[]
? UnwrapErrorMessages<ProcessNodes<Schema, Row, RelationName, Relationships, ParsedQuery>>
: UnwrapErrorMessages<SelectQueryError<'Invalid Relationships cannot infer result type'>>
: UnwrapErrorMessages<SelectQueryError<'Invalid RelationName cannot infer result type'>>
: UnwrapErrorMessages<ParsedQuery>
? ProcessNodes<Schema, Row, RelationName, Relationships, ParsedQuery>
: SelectQueryError<'Invalid Relationships cannot infer result type'>
: SelectQueryError<'Invalid RelationName cannot infer result type'>
: ParsedQuery
: never

@@ -55,0 +52,0 @@

@@ -15,17 +15,2 @@ import { Ast } from './parser'

type RequireHintingSelectQueryError<
DistantName extends string,
RelationName extends string
> = SelectQueryError<`Could not embed because more than one relationship was found for '${DistantName}' and '${RelationName}' you need to hint the column with ${DistantName}!<columnName> ?`>
export type UnwrapErrorMessages<T> = T extends SelectQueryError<infer M>
? M
: T extends SelectQueryError<infer M>[]
? M[]
: T extends (infer U)[]
? UnwrapErrorMessages<U>[]
: T extends Record<string, unknown>
? { [K in keyof T]: UnwrapErrorMessages<T[K]> }
: T
export type GetFieldNodeResultName<Field extends Ast.FieldNode> = Field['alias'] extends string

@@ -165,3 +150,3 @@ ? Field['alias']

Relationships extends GenericRelationship[],
CurrentTableOrView extends keyof TablesAndViews<Schema>,
CurrentTableOrView extends keyof TablesAndViews<Schema> & string,
FoundRelation

@@ -181,6 +166,3 @@ > = FoundRelation extends SelectQueryError<string>

? // If there is, postgrest will fail at runtime, and require desambiguation via hinting
RequireHintingSelectQueryError<
RelatedRelationName,
CurrentTableOrView extends string ? CurrentTableOrView : 'unknown'
>
SelectQueryError<`Could not embed because more than one relationship was found for '${RelatedRelationName}' and '${CurrentTableOrView}' you need to hint the column with ${RelatedRelationName}!<columnName> ?`>
: FoundRelation

@@ -194,3 +176,3 @@ : // Same check for forward relationships, but we must gather the relationships from the found relation

direction: 'forward'
from: infer From extends keyof TablesAndViews<Schema>
from: infer From extends keyof TablesAndViews<Schema> & string
}

@@ -201,3 +183,3 @@ ? HasMultipleFKeysToFRel<

> extends true
? RequireHintingSelectQueryError<From extends string ? From : 'unknown', RelatedRelationName>
? SelectQueryError<`Could not embed because more than one relationship was found for '${From}' and '${RelatedRelationName}' you need to hint the column with ${From}!<columnName> ?`>
: FoundRelation

@@ -237,3 +219,3 @@ : FoundRelation

Field extends Ast.FieldNode,
CurrentTableOrView extends keyof TablesAndViews<Schema>
CurrentTableOrView extends keyof TablesAndViews<Schema> & string
> = FindFieldMatchingRelationships<Schema, Relationships, Field> extends infer FoundRelation

@@ -254,6 +236,3 @@ ? FoundRelation extends never

HasMultipleFKeysToFRel<RelatedRelationName, Relationships> extends true
? RequireHintingSelectQueryError<
RelatedRelationName,
CurrentTableOrView extends string ? CurrentTableOrView : 'unknown'
>
? SelectQueryError<`Could not embed because more than one relationship was found for '${RelatedRelationName}' and '${CurrentTableOrView}' you need to hint the column with ${RelatedRelationName}!<columnName> ?`>
: {

@@ -260,0 +239,0 @@ referencedTable: TablesAndViews<Schema>[RelatedRelationName]

@@ -1,1 +0,1 @@

export const version = '1.17.0-rc.3'
export const version = '1.17.0-rc.4'

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

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