@supabase/postgrest-js
Advanced tools
Comparing version 0.36.2 to 0.37.0
import { Fetch, PostgrestBuilder } from './types'; | ||
import PostgrestFilterBuilder from './PostgrestFilterBuilder'; | ||
export default class PostgrestQueryBuilder<T> extends PostgrestBuilder<T> { | ||
constructor(url: string, { headers, schema, fetch, }?: { | ||
constructor(url: string, { headers, schema, fetch, shouldThrowOnError, }?: { | ||
headers?: { | ||
@@ -10,2 +10,3 @@ [key: string]: string; | ||
fetch?: Fetch; | ||
shouldThrowOnError?: boolean; | ||
}); | ||
@@ -12,0 +13,0 @@ /** |
@@ -9,4 +9,4 @@ "use strict"; | ||
class PostgrestQueryBuilder extends types_1.PostgrestBuilder { | ||
constructor(url, { headers = {}, schema, fetch, } = {}) { | ||
super({ fetch }); | ||
constructor(url, { headers = {}, schema, fetch, shouldThrowOnError, } = {}) { | ||
super({ fetch, shouldThrowOnError }); | ||
this.url = new URL(url); | ||
@@ -13,0 +13,0 @@ this.headers = Object.assign({}, headers); |
import { Fetch, PostgrestBuilder } from './types'; | ||
import PostgrestFilterBuilder from './PostgrestFilterBuilder'; | ||
export default class PostgrestRpcBuilder<T> extends PostgrestBuilder<T> { | ||
constructor(url: string, { headers, schema, fetch, }?: { | ||
constructor(url: string, { headers, schema, fetch, shouldThrowOnError, }?: { | ||
headers?: { | ||
@@ -10,2 +10,3 @@ [key: string]: string; | ||
fetch?: Fetch; | ||
shouldThrowOnError?: boolean; | ||
}); | ||
@@ -12,0 +13,0 @@ /** |
@@ -9,4 +9,4 @@ "use strict"; | ||
class PostgrestRpcBuilder extends types_1.PostgrestBuilder { | ||
constructor(url, { headers = {}, schema, fetch, } = {}) { | ||
super({ fetch }); | ||
constructor(url, { headers = {}, schema, fetch, shouldThrowOnError, } = {}) { | ||
super({ fetch, shouldThrowOnError }); | ||
this.url = new URL(url); | ||
@@ -13,0 +13,0 @@ this.headers = Object.assign({}, headers); |
@@ -60,3 +60,3 @@ export declare type Fetch = typeof fetch; | ||
*/ | ||
throwOnError(): PostgrestBuilder<T>; | ||
throwOnError(throwOnError?: boolean): PostgrestBuilder<T>; | ||
then<TResult1 = PostgrestResponse<T>, TResult2 = never>(onfulfilled?: ((value: PostgrestResponse<T>) => TResult1 | PromiseLike<TResult1>) | undefined | null, onrejected?: ((reason: any) => TResult2 | PromiseLike<TResult2>) | undefined | null): PromiseLike<TResult1 | TResult2>; | ||
@@ -63,0 +63,0 @@ } |
@@ -19,3 +19,2 @@ "use strict"; | ||
constructor(builder) { | ||
this.shouldThrowOnError = false; | ||
Object.assign(this, builder); | ||
@@ -33,2 +32,3 @@ let _fetch; | ||
this.fetch = (...args) => _fetch(...args); | ||
this.shouldThrowOnError = builder.shouldThrowOnError || false; | ||
} | ||
@@ -41,4 +41,7 @@ /** | ||
*/ | ||
throwOnError() { | ||
this.shouldThrowOnError = true; | ||
throwOnError(throwOnError) { | ||
if (throwOnError === null || throwOnError === undefined) { | ||
throwOnError = true; | ||
} | ||
this.shouldThrowOnError = throwOnError; | ||
return this; | ||
@@ -45,0 +48,0 @@ } |
@@ -1,2 +0,2 @@ | ||
export declare const version = "0.36.2"; | ||
export declare const version = "0.37.0"; | ||
//# sourceMappingURL=version.d.ts.map |
@@ -5,3 +5,3 @@ "use strict"; | ||
// generated by genversion | ||
exports.version = '0.36.2'; | ||
exports.version = '0.37.0'; | ||
//# sourceMappingURL=version.js.map |
@@ -11,2 +11,3 @@ import PostgrestQueryBuilder from './lib/PostgrestQueryBuilder'; | ||
fetch?: Fetch; | ||
shouldThrowOnError?: boolean; | ||
/** | ||
@@ -19,3 +20,3 @@ * Creates a PostgREST client. | ||
*/ | ||
constructor(url: string, { headers, schema, fetch, }?: { | ||
constructor(url: string, { headers, schema, fetch, throwOnError, }?: { | ||
headers?: { | ||
@@ -26,2 +27,3 @@ [key: string]: string; | ||
fetch?: Fetch; | ||
throwOnError?: boolean; | ||
}); | ||
@@ -28,0 +30,0 @@ /** |
@@ -17,3 +17,3 @@ "use strict"; | ||
*/ | ||
constructor(url, { headers = {}, schema, fetch, } = {}) { | ||
constructor(url, { headers = {}, schema, fetch, throwOnError, } = {}) { | ||
this.url = url; | ||
@@ -23,2 +23,3 @@ this.headers = Object.assign(Object.assign({}, constants_1.DEFAULT_HEADERS), headers); | ||
this.fetch = fetch; | ||
this.shouldThrowOnError = throwOnError; | ||
} | ||
@@ -45,2 +46,3 @@ /** | ||
fetch: this.fetch, | ||
shouldThrowOnError: this.shouldThrowOnError, | ||
}); | ||
@@ -62,2 +64,3 @@ } | ||
fetch: this.fetch, | ||
shouldThrowOnError: this.shouldThrowOnError, | ||
}).rpc(params, { head, count }); | ||
@@ -64,0 +67,0 @@ } |
import { Fetch, PostgrestBuilder } from './types'; | ||
import PostgrestFilterBuilder from './PostgrestFilterBuilder'; | ||
export default class PostgrestQueryBuilder<T> extends PostgrestBuilder<T> { | ||
constructor(url: string, { headers, schema, fetch, }?: { | ||
constructor(url: string, { headers, schema, fetch, shouldThrowOnError, }?: { | ||
headers?: { | ||
@@ -10,2 +10,3 @@ [key: string]: string; | ||
fetch?: Fetch; | ||
shouldThrowOnError?: boolean; | ||
}); | ||
@@ -12,0 +13,0 @@ /** |
import { PostgrestBuilder } from './types'; | ||
import PostgrestFilterBuilder from './PostgrestFilterBuilder'; | ||
export default class PostgrestQueryBuilder extends PostgrestBuilder { | ||
constructor(url, { headers = {}, schema, fetch, } = {}) { | ||
super({ fetch }); | ||
constructor(url, { headers = {}, schema, fetch, shouldThrowOnError, } = {}) { | ||
super({ fetch, shouldThrowOnError }); | ||
this.url = new URL(url); | ||
@@ -7,0 +7,0 @@ this.headers = Object.assign({}, headers); |
import { Fetch, PostgrestBuilder } from './types'; | ||
import PostgrestFilterBuilder from './PostgrestFilterBuilder'; | ||
export default class PostgrestRpcBuilder<T> extends PostgrestBuilder<T> { | ||
constructor(url: string, { headers, schema, fetch, }?: { | ||
constructor(url: string, { headers, schema, fetch, shouldThrowOnError, }?: { | ||
headers?: { | ||
@@ -10,2 +10,3 @@ [key: string]: string; | ||
fetch?: Fetch; | ||
shouldThrowOnError?: boolean; | ||
}); | ||
@@ -12,0 +13,0 @@ /** |
import { PostgrestBuilder } from './types'; | ||
import PostgrestFilterBuilder from './PostgrestFilterBuilder'; | ||
export default class PostgrestRpcBuilder extends PostgrestBuilder { | ||
constructor(url, { headers = {}, schema, fetch, } = {}) { | ||
super({ fetch }); | ||
constructor(url, { headers = {}, schema, fetch, shouldThrowOnError, } = {}) { | ||
super({ fetch, shouldThrowOnError }); | ||
this.url = new URL(url); | ||
@@ -7,0 +7,0 @@ this.headers = Object.assign({}, headers); |
@@ -60,3 +60,3 @@ export declare type Fetch = typeof fetch; | ||
*/ | ||
throwOnError(): PostgrestBuilder<T>; | ||
throwOnError(throwOnError?: boolean): PostgrestBuilder<T>; | ||
then<TResult1 = PostgrestResponse<T>, TResult2 = never>(onfulfilled?: ((value: PostgrestResponse<T>) => TResult1 | PromiseLike<TResult1>) | undefined | null, onrejected?: ((reason: any) => TResult2 | PromiseLike<TResult2>) | undefined | null): PromiseLike<TResult1 | TResult2>; | ||
@@ -63,0 +63,0 @@ } |
@@ -13,3 +13,2 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) { | ||
constructor(builder) { | ||
this.shouldThrowOnError = false; | ||
Object.assign(this, builder); | ||
@@ -27,2 +26,3 @@ let _fetch; | ||
this.fetch = (...args) => _fetch(...args); | ||
this.shouldThrowOnError = builder.shouldThrowOnError || false; | ||
} | ||
@@ -35,4 +35,7 @@ /** | ||
*/ | ||
throwOnError() { | ||
this.shouldThrowOnError = true; | ||
throwOnError(throwOnError) { | ||
if (throwOnError === null || throwOnError === undefined) { | ||
throwOnError = true; | ||
} | ||
this.shouldThrowOnError = throwOnError; | ||
return this; | ||
@@ -39,0 +42,0 @@ } |
@@ -1,2 +0,2 @@ | ||
export declare const version = "0.36.2"; | ||
export declare const version = "0.37.0"; | ||
//# sourceMappingURL=version.d.ts.map |
// generated by genversion | ||
export const version = '0.36.2'; | ||
export const version = '0.37.0'; | ||
//# sourceMappingURL=version.js.map |
@@ -11,2 +11,3 @@ import PostgrestQueryBuilder from './lib/PostgrestQueryBuilder'; | ||
fetch?: Fetch; | ||
shouldThrowOnError?: boolean; | ||
/** | ||
@@ -19,3 +20,3 @@ * Creates a PostgREST client. | ||
*/ | ||
constructor(url: string, { headers, schema, fetch, }?: { | ||
constructor(url: string, { headers, schema, fetch, throwOnError, }?: { | ||
headers?: { | ||
@@ -26,2 +27,3 @@ [key: string]: string; | ||
fetch?: Fetch; | ||
throwOnError?: boolean; | ||
}); | ||
@@ -28,0 +30,0 @@ /** |
@@ -12,3 +12,3 @@ import PostgrestQueryBuilder from './lib/PostgrestQueryBuilder'; | ||
*/ | ||
constructor(url, { headers = {}, schema, fetch, } = {}) { | ||
constructor(url, { headers = {}, schema, fetch, throwOnError, } = {}) { | ||
this.url = url; | ||
@@ -18,2 +18,3 @@ this.headers = Object.assign(Object.assign({}, DEFAULT_HEADERS), headers); | ||
this.fetch = fetch; | ||
this.shouldThrowOnError = throwOnError; | ||
} | ||
@@ -40,2 +41,3 @@ /** | ||
fetch: this.fetch, | ||
shouldThrowOnError: this.shouldThrowOnError, | ||
}); | ||
@@ -57,2 +59,3 @@ } | ||
fetch: this.fetch, | ||
shouldThrowOnError: this.shouldThrowOnError, | ||
}).rpc(params, { head, count }); | ||
@@ -59,0 +62,0 @@ } |
{ | ||
"name": "@supabase/postgrest-js", | ||
"version": "0.36.2", | ||
"version": "0.37.0", | ||
"description": "Isomorphic PostgREST client", | ||
@@ -5,0 +5,0 @@ "keywords": [ |
@@ -11,5 +11,11 @@ import { Fetch, PostgrestBuilder } from './types' | ||
fetch, | ||
}: { headers?: { [key: string]: string }; schema?: string; fetch?: Fetch } = {} | ||
shouldThrowOnError, | ||
}: { | ||
headers?: { [key: string]: string } | ||
schema?: string | ||
fetch?: Fetch | ||
shouldThrowOnError?: boolean | ||
} = {} | ||
) { | ||
super(({ fetch } as unknown) as PostgrestBuilder<T>) | ||
super(({ fetch, shouldThrowOnError } as unknown) as PostgrestBuilder<T>) | ||
this.url = new URL(url) | ||
@@ -16,0 +22,0 @@ this.headers = { ...headers } |
@@ -11,5 +11,11 @@ import { Fetch, PostgrestBuilder } from './types' | ||
fetch, | ||
}: { headers?: { [key: string]: string }; schema?: string; fetch?: Fetch } = {} | ||
shouldThrowOnError, | ||
}: { | ||
headers?: { [key: string]: string } | ||
schema?: string | ||
fetch?: Fetch | ||
shouldThrowOnError?: boolean | ||
} = {} | ||
) { | ||
super(({ fetch } as unknown) as PostgrestBuilder<T>) | ||
super(({ fetch, shouldThrowOnError } as unknown) as PostgrestBuilder<T>) | ||
this.url = new URL(url) | ||
@@ -16,0 +22,0 @@ this.headers = { ...headers } |
@@ -59,3 +59,3 @@ import crossFetch from 'cross-fetch' | ||
protected body?: Partial<T> | Partial<T>[] | ||
protected shouldThrowOnError = false | ||
protected shouldThrowOnError: boolean | ||
protected signal?: AbortSignal | ||
@@ -75,2 +75,3 @@ protected fetch: Fetch | ||
this.fetch = (...args) => _fetch(...args) | ||
this.shouldThrowOnError = builder.shouldThrowOnError || false | ||
} | ||
@@ -84,4 +85,7 @@ | ||
*/ | ||
throwOnError(): PostgrestBuilder<T> { | ||
this.shouldThrowOnError = true | ||
throwOnError(throwOnError?: boolean): PostgrestBuilder<T> { | ||
if (throwOnError === null || throwOnError === undefined) { | ||
throwOnError = true | ||
} | ||
this.shouldThrowOnError = throwOnError | ||
return this | ||
@@ -88,0 +92,0 @@ } |
// generated by genversion | ||
export const version = '0.36.2' | ||
export const version = '0.37.0' |
@@ -12,2 +12,3 @@ import PostgrestQueryBuilder from './lib/PostgrestQueryBuilder' | ||
fetch?: Fetch | ||
shouldThrowOnError?: boolean | ||
@@ -27,3 +28,9 @@ /** | ||
fetch, | ||
}: { headers?: { [key: string]: string }; schema?: string; fetch?: Fetch } = {} | ||
throwOnError, | ||
}: { | ||
headers?: { [key: string]: string } | ||
schema?: string | ||
fetch?: Fetch | ||
throwOnError?: boolean | ||
} = {} | ||
) { | ||
@@ -34,2 +41,3 @@ this.url = url | ||
this.fetch = fetch | ||
this.shouldThrowOnError = throwOnError | ||
} | ||
@@ -58,2 +66,3 @@ | ||
fetch: this.fetch, | ||
shouldThrowOnError: this.shouldThrowOnError, | ||
}) | ||
@@ -86,4 +95,5 @@ } | ||
fetch: this.fetch, | ||
shouldThrowOnError: this.shouldThrowOnError, | ||
}).rpc(params, { head, count }) | ||
} | ||
} |
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
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
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
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
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
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
215688
3981