@supabase/postgrest-js
Advanced tools
Comparing version 1.17.0-rc.1 to 1.17.0-rc.2
@@ -58,3 +58,3 @@ import { SimplifyDeep } from '../types'; | ||
*/ | ||
declare type ParseField<Input extends string> = Input extends '' ? ParserError<'Empty string'> : ParseIdentifier<Input> extends [infer Name, `${infer Remainder}`] ? Name extends 'count' ? ParseCountField<Input> : Remainder extends `!inner${infer Remainder}` ? ParseEmbeddedResource<Remainder> extends [ | ||
declare type ParseField<Input extends string> = Input extends '' ? ParserError<'Empty string'> : ParseIdentifier<Input> extends [infer Name, `${infer Remainder}`] ? Name extends 'count' ? ParseCountField<Input> : Remainder extends `!inner${infer Remainder}` ? ParseEmbeddedResource<EatWhitespace<Remainder>> extends [ | ||
infer Children extends Ast.Node[], | ||
@@ -70,3 +70,3 @@ `${infer Remainder}` | ||
Remainder | ||
] : CreateParserErrorIfRequired<ParseEmbeddedResource<Remainder>, `Expected embedded resource after "!inner" at \`${Remainder}\``> : EatWhitespace<Remainder> extends `!left${infer Remainder}` ? ParseEmbeddedResource<EatWhitespace<Remainder>> extends [ | ||
] : CreateParserErrorIfRequired<ParseEmbeddedResource<EatWhitespace<Remainder>>, `Expected embedded resource after "!inner" at \`${Remainder}\``> : EatWhitespace<Remainder> extends `!left${infer Remainder}` ? ParseEmbeddedResource<EatWhitespace<Remainder>> extends [ | ||
infer Children extends Ast.Node[], | ||
@@ -73,0 +73,0 @@ `${infer Remainder}` |
@@ -5,3 +5,3 @@ import { GenericTable } from '../types'; | ||
import { AggregateFunctions, ExtractFirstProperty, GenericSchema, IsNonEmptyArray, Prettify, TablesAndViews, TypeScriptTypes } from './types'; | ||
import { CheckDuplicateEmbededReference, GetFieldNodeResultName, IsRelationNullable, ResolveRelationship, SelectQueryError } from './utils'; | ||
import { CheckDuplicateEmbededReference, GetFieldNodeResultName, IsRelationNullable, ResolveRelationship, SelectQueryError, UnwrapErrorMessages } 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[] ? 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; | ||
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; | ||
/** | ||
@@ -19,0 +19,0 @@ * Processes a single Node from a select chained after a rpc call |
@@ -7,2 +7,5 @@ import { Ast } from './parser'; | ||
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']; | ||
@@ -9,0 +12,0 @@ declare type FilterRelationNodes<Nodes extends Ast.Node[]> = UnionToArray<{ |
{ | ||
"name": "@supabase/postgrest-js", | ||
"version": "1.17.0-rc.1", | ||
"version": "1.17.0-rc.2", | ||
"description": "Isomorphic PostgREST client", | ||
@@ -5,0 +5,0 @@ "keywords": [ |
@@ -101,3 +101,3 @@ // Credits to @bnjmnt4n (https://www.npmjs.com/package/postgrest-query) | ||
: Remainder extends `!inner${infer Remainder}` | ||
? ParseEmbeddedResource<Remainder> extends [ | ||
? ParseEmbeddedResource<EatWhitespace<Remainder>> extends [ | ||
infer Children extends Ast.Node[], | ||
@@ -109,3 +109,3 @@ `${infer Remainder}` | ||
: CreateParserErrorIfRequired< | ||
ParseEmbeddedResource<Remainder>, | ||
ParseEmbeddedResource<EatWhitespace<Remainder>>, | ||
`Expected embedded resource after "!inner" at \`${Remainder}\`` | ||
@@ -112,0 +112,0 @@ > |
@@ -19,2 +19,3 @@ import { GenericTable } from '../types' | ||
SelectQueryError, | ||
UnwrapErrorMessages, | ||
} from './utils' | ||
@@ -39,3 +40,5 @@ | ||
? ParseQuery<Query> extends infer ParsedQuery extends Ast.Node[] | ||
? RPCCallNodes<ParsedQuery, RelationName extends string ? RelationName : 'rpc_call', Row> | ||
? UnwrapErrorMessages< | ||
RPCCallNodes<ParsedQuery, RelationName extends string ? RelationName : 'rpc_call', Row> | ||
> | ||
: Row | ||
@@ -46,6 +49,6 @@ : ParseQuery<Query> extends infer ParsedQuery | ||
? Relationships extends GenericRelationship[] | ||
? ProcessNodes<Schema, Row, RelationName, Relationships, ParsedQuery> | ||
: SelectQueryError<'Invalid Relationships cannot infer result type'> | ||
: SelectQueryError<'Invalid RelationName cannot infer result type'> | ||
: ParsedQuery | ||
? 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 | ||
@@ -52,0 +55,0 @@ |
@@ -20,2 +20,12 @@ import { Ast } from './parser' | ||
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 | ||
@@ -22,0 +32,0 @@ ? Field['alias'] |
@@ -1,1 +0,1 @@ | ||
export const version = '1.17.0-rc.1' | ||
export const version = '1.17.0-rc.2' |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
306094
5408