@supabase/postgrest-js
Advanced tools
Comparing version 1.1.1 to 1.2.0
@@ -7,2 +7,5 @@ import { GenericSchema } from './types'; | ||
declare type Letter = Alphabet | Digit | '_'; | ||
declare type Json = string | number | boolean | null | { | ||
[key: string]: Json; | ||
} | Json[]; | ||
/** | ||
@@ -39,2 +42,7 @@ * Parser errors. | ||
[K in Field['name']]: Row[Field['original']]; | ||
} : Field extends { | ||
name: string; | ||
type: infer T; | ||
} ? { | ||
[K in Field['name']]: T; | ||
} : Record<string, unknown>; | ||
@@ -64,2 +72,3 @@ /** | ||
* - `field` | ||
* - `field->json...` | ||
* - `field(nodes)` | ||
@@ -70,2 +79,3 @@ * - `field!hint(nodes)` | ||
* - `renamed_field:field` | ||
* - `renamed_field:field->json...` | ||
* - `renamed_field:field(nodes)` | ||
@@ -76,3 +86,3 @@ * - `renamed_field:field!hint(nodes)` | ||
* | ||
* TODO: casting operators `::text`, JSON operators `->`, `->>`. | ||
* TODO: casting operators `::text`, more support for JSON operators `->`, `->>`. | ||
*/ | ||
@@ -148,2 +158,12 @@ declare type ParseNode<Input extends string> = Input extends '' ? ParserError<'Empty string'> : Input extends `*${infer Remainder}` ? [{ | ||
EatWhitespace<Remainder> | ||
] : ParseJsonAccessor<EatWhitespace<Remainder>> extends [ | ||
infer _PropertyName, | ||
infer PropertyType, | ||
`${infer Remainder}` | ||
] ? [ | ||
{ | ||
name: Name; | ||
type: PropertyType; | ||
}, | ||
EatWhitespace<Remainder> | ||
] : ParseEmbeddedResource<EatWhitespace<Remainder>> extends ParserError<string> ? ParseEmbeddedResource<EatWhitespace<Remainder>> : [ | ||
@@ -162,2 +182,12 @@ { | ||
EatWhitespace<Remainder> | ||
] : ParseJsonAccessor<EatWhitespace<Remainder>> extends [ | ||
infer PropertyName, | ||
infer PropertyType, | ||
`${infer Remainder}` | ||
] ? [ | ||
{ | ||
name: PropertyName; | ||
type: PropertyType; | ||
}, | ||
EatWhitespace<Remainder> | ||
] : ParseEmbeddedResource<EatWhitespace<Remainder>> extends ParserError<string> ? ParseEmbeddedResource<EatWhitespace<Remainder>> : [ | ||
@@ -171,2 +201,14 @@ { | ||
/** | ||
* Parses a JSON property accessor of the shape `->a->b->c`. The last accessor in | ||
* the series may convert to text by using the ->> operator instead of ->. | ||
* | ||
* Returns a tuple of ["Last property name", "Last property type", "Remainder of text"] | ||
* or the original string input indicating that no opening `->` was found. | ||
*/ | ||
declare type ParseJsonAccessor<Input extends string> = Input extends `->${infer Remainder}` ? Remainder extends `>${infer Remainder}` ? ParseIdentifier<Remainder> extends [infer Name, `${infer Remainder}`] ? [Name, string, EatWhitespace<Remainder>] : ParserError<'Expected property name after `->>`'> : ParseIdentifier<Remainder> extends [infer Name, `${infer Remainder}`] ? ParseJsonAccessor<Remainder> extends [ | ||
infer PropertyName, | ||
infer PropertyType, | ||
`${infer Remainder}` | ||
] ? [PropertyName, PropertyType, EatWhitespace<Remainder>] : [Name, Json, EatWhitespace<Remainder>] : ParserError<'Expected property name after `->`'> : Input; | ||
/** | ||
* Parses an embedded resource, which is an opening `(`, followed by a sequence of | ||
@@ -173,0 +215,0 @@ * nodes, separated by `,`, then a closing `)`. |
@@ -1,2 +0,2 @@ | ||
export declare const version = "1.1.1"; | ||
export declare const version = "1.2.0"; | ||
//# sourceMappingURL=version.d.ts.map |
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.version = void 0; | ||
exports.version = '1.1.1'; | ||
exports.version = '1.2.0'; | ||
//# sourceMappingURL=version.js.map |
@@ -7,2 +7,5 @@ import { GenericSchema } from './types'; | ||
declare type Letter = Alphabet | Digit | '_'; | ||
declare type Json = string | number | boolean | null | { | ||
[key: string]: Json; | ||
} | Json[]; | ||
/** | ||
@@ -39,2 +42,7 @@ * Parser errors. | ||
[K in Field['name']]: Row[Field['original']]; | ||
} : Field extends { | ||
name: string; | ||
type: infer T; | ||
} ? { | ||
[K in Field['name']]: T; | ||
} : Record<string, unknown>; | ||
@@ -64,2 +72,3 @@ /** | ||
* - `field` | ||
* - `field->json...` | ||
* - `field(nodes)` | ||
@@ -70,2 +79,3 @@ * - `field!hint(nodes)` | ||
* - `renamed_field:field` | ||
* - `renamed_field:field->json...` | ||
* - `renamed_field:field(nodes)` | ||
@@ -76,3 +86,3 @@ * - `renamed_field:field!hint(nodes)` | ||
* | ||
* TODO: casting operators `::text`, JSON operators `->`, `->>`. | ||
* TODO: casting operators `::text`, more support for JSON operators `->`, `->>`. | ||
*/ | ||
@@ -148,2 +158,12 @@ declare type ParseNode<Input extends string> = Input extends '' ? ParserError<'Empty string'> : Input extends `*${infer Remainder}` ? [{ | ||
EatWhitespace<Remainder> | ||
] : ParseJsonAccessor<EatWhitespace<Remainder>> extends [ | ||
infer _PropertyName, | ||
infer PropertyType, | ||
`${infer Remainder}` | ||
] ? [ | ||
{ | ||
name: Name; | ||
type: PropertyType; | ||
}, | ||
EatWhitespace<Remainder> | ||
] : ParseEmbeddedResource<EatWhitespace<Remainder>> extends ParserError<string> ? ParseEmbeddedResource<EatWhitespace<Remainder>> : [ | ||
@@ -162,2 +182,12 @@ { | ||
EatWhitespace<Remainder> | ||
] : ParseJsonAccessor<EatWhitespace<Remainder>> extends [ | ||
infer PropertyName, | ||
infer PropertyType, | ||
`${infer Remainder}` | ||
] ? [ | ||
{ | ||
name: PropertyName; | ||
type: PropertyType; | ||
}, | ||
EatWhitespace<Remainder> | ||
] : ParseEmbeddedResource<EatWhitespace<Remainder>> extends ParserError<string> ? ParseEmbeddedResource<EatWhitespace<Remainder>> : [ | ||
@@ -171,2 +201,14 @@ { | ||
/** | ||
* Parses a JSON property accessor of the shape `->a->b->c`. The last accessor in | ||
* the series may convert to text by using the ->> operator instead of ->. | ||
* | ||
* Returns a tuple of ["Last property name", "Last property type", "Remainder of text"] | ||
* or the original string input indicating that no opening `->` was found. | ||
*/ | ||
declare type ParseJsonAccessor<Input extends string> = Input extends `->${infer Remainder}` ? Remainder extends `>${infer Remainder}` ? ParseIdentifier<Remainder> extends [infer Name, `${infer Remainder}`] ? [Name, string, EatWhitespace<Remainder>] : ParserError<'Expected property name after `->>`'> : ParseIdentifier<Remainder> extends [infer Name, `${infer Remainder}`] ? ParseJsonAccessor<Remainder> extends [ | ||
infer PropertyName, | ||
infer PropertyType, | ||
`${infer Remainder}` | ||
] ? [PropertyName, PropertyType, EatWhitespace<Remainder>] : [Name, Json, EatWhitespace<Remainder>] : ParserError<'Expected property name after `->`'> : Input; | ||
/** | ||
* Parses an embedded resource, which is an opening `(`, followed by a sequence of | ||
@@ -173,0 +215,0 @@ * nodes, separated by `,`, then a closing `)`. |
@@ -1,2 +0,2 @@ | ||
export declare const version = "1.1.1"; | ||
export declare const version = "1.2.0"; | ||
//# sourceMappingURL=version.d.ts.map |
@@ -1,2 +0,2 @@ | ||
export const version = '1.1.1'; | ||
export const version = '1.2.0'; | ||
//# sourceMappingURL=version.js.map |
{ | ||
"name": "@supabase/postgrest-js", | ||
"version": "1.1.1", | ||
"version": "1.2.0", | ||
"description": "Isomorphic PostgREST client", | ||
@@ -5,0 +5,0 @@ "keywords": [ |
@@ -41,2 +41,4 @@ // Credits to @bnjmnt4n (https://www.npmjs.com/package/postgrest-query) | ||
type Json = string | number | boolean | null | { [key: string]: Json } | Json[] | ||
// /** | ||
@@ -49,3 +51,4 @@ // * Parsed node types. | ||
// | { name: string; original: string } | ||
// | { name: string; foreignTable: true }; | ||
// | { name: string; foreignTable: true } | ||
// | { name: string; type: T }; | ||
@@ -95,2 +98,4 @@ /** | ||
? { [K in Field['name']]: Row[Field['original']] } | ||
: Field extends { name: string; type: infer T } | ||
? { [K in Field['name']]: T } | ||
: Record<string, unknown> | ||
@@ -137,2 +142,3 @@ | ||
* - `field` | ||
* - `field->json...` | ||
* - `field(nodes)` | ||
@@ -143,2 +149,3 @@ * - `field!hint(nodes)` | ||
* - `renamed_field:field` | ||
* - `renamed_field:field->json...` | ||
* - `renamed_field:field(nodes)` | ||
@@ -149,3 +156,3 @@ * - `renamed_field:field!hint(nodes)` | ||
* | ||
* TODO: casting operators `::text`, JSON operators `->`, `->>`. | ||
* TODO: casting operators `::text`, more support for JSON operators `->`, `->>`. | ||
*/ | ||
@@ -234,2 +241,9 @@ type ParseNode<Input extends string> = Input extends '' | ||
[{ name: Name; original: OriginalName; children: Fields }, EatWhitespace<Remainder>] | ||
: ParseJsonAccessor<EatWhitespace<Remainder>> extends [ | ||
infer _PropertyName, | ||
infer PropertyType, | ||
`${infer Remainder}` | ||
] | ||
? // `renamed_field:field->json...` | ||
[{ name: Name; type: PropertyType }, EatWhitespace<Remainder>] | ||
: ParseEmbeddedResource<EatWhitespace<Remainder>> extends ParserError<string> | ||
@@ -243,2 +257,9 @@ ? ParseEmbeddedResource<EatWhitespace<Remainder>> | ||
[{ name: Name; original: Name; children: Fields }, EatWhitespace<Remainder>] | ||
: ParseJsonAccessor<EatWhitespace<Remainder>> extends [ | ||
infer PropertyName, | ||
infer PropertyType, | ||
`${infer Remainder}` | ||
] | ||
? // `field->json...` | ||
[{ name: PropertyName; type: PropertyType }, EatWhitespace<Remainder>] | ||
: ParseEmbeddedResource<EatWhitespace<Remainder>> extends ParserError<string> | ||
@@ -251,2 +272,25 @@ ? ParseEmbeddedResource<EatWhitespace<Remainder>> | ||
/** | ||
* Parses a JSON property accessor of the shape `->a->b->c`. The last accessor in | ||
* the series may convert to text by using the ->> operator instead of ->. | ||
* | ||
* Returns a tuple of ["Last property name", "Last property type", "Remainder of text"] | ||
* or the original string input indicating that no opening `->` was found. | ||
*/ | ||
type ParseJsonAccessor<Input extends string> = Input extends `->${infer Remainder}` | ||
? Remainder extends `>${infer Remainder}` | ||
? ParseIdentifier<Remainder> extends [infer Name, `${infer Remainder}`] | ||
? [Name, string, EatWhitespace<Remainder>] | ||
: ParserError<'Expected property name after `->>`'> | ||
: ParseIdentifier<Remainder> extends [infer Name, `${infer Remainder}`] | ||
? ParseJsonAccessor<Remainder> extends [ | ||
infer PropertyName, | ||
infer PropertyType, | ||
`${infer Remainder}` | ||
] | ||
? [PropertyName, PropertyType, EatWhitespace<Remainder>] | ||
: [Name, Json, EatWhitespace<Remainder>] | ||
: ParserError<'Expected property name after `->`'> | ||
: Input | ||
/** | ||
* Parses an embedded resource, which is an opening `(`, followed by a sequence of | ||
@@ -253,0 +297,0 @@ * nodes, separated by `,`, then a closing `)`. |
@@ -1,1 +0,1 @@ | ||
export const version = '1.1.1' | ||
export const version = '1.2.0' |
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
301543
5276