@supabase/postgrest-js
Advanced tools
Comparing version 0.22.0 to 0.23.0
import { PostgrestBuilder } from './types'; | ||
import PostgrestFilterBuilder from './PostgrestFilterBuilder'; | ||
/** | ||
* CRUD | ||
*/ | ||
export default class PostgrestQueryBuilder<T> extends PostgrestBuilder<T> { | ||
@@ -14,3 +11,3 @@ constructor(url: string, { headers, schema }?: { | ||
/** | ||
* Performs horizontal filtering with SELECT. | ||
* Performs vertical filtering with SELECT. | ||
* | ||
@@ -17,0 +14,0 @@ * @param columns The columns to retrieve, separated by commas. |
@@ -8,5 +8,3 @@ "use strict"; | ||
const PostgrestFilterBuilder_1 = __importDefault(require("./PostgrestFilterBuilder")); | ||
/** | ||
* CRUD | ||
*/ | ||
const PostgrestTransformBuilder_1 = __importDefault(require("./PostgrestTransformBuilder")); | ||
class PostgrestQueryBuilder extends types_1.PostgrestBuilder { | ||
@@ -20,3 +18,3 @@ constructor(url, { headers = {}, schema } = {}) { | ||
/** | ||
* Performs horizontal filtering with SELECT. | ||
* Performs vertical filtering with SELECT. | ||
* | ||
@@ -90,3 +88,3 @@ * @param columns The columns to retrieve, separated by commas. | ||
this.body = params; | ||
return this; | ||
return new PostgrestTransformBuilder_1.default(this); | ||
} | ||
@@ -93,0 +91,0 @@ } |
@@ -7,2 +7,8 @@ import { PostgrestBuilder, PostgrestSingleResponse } from './types'; | ||
/** | ||
* Performs vertical filtering with SELECT. | ||
* | ||
* @param columns The columns to retrieve, separated by commas. | ||
*/ | ||
select(columns?: string): this; | ||
/** | ||
* Orders the result with the specified `column`. | ||
@@ -19,3 +25,3 @@ * | ||
foreignTable?: string; | ||
}): PostgrestTransformBuilder<T>; | ||
}): this; | ||
/** | ||
@@ -29,3 +35,3 @@ * Limits the result with the specified `count`. | ||
foreignTable?: string; | ||
}): PostgrestTransformBuilder<T>; | ||
}): this; | ||
/** | ||
@@ -40,3 +46,3 @@ * Limits the result to rows within the specified range, inclusive. | ||
foreignTable?: string; | ||
}): PostgrestTransformBuilder<T>; | ||
}): this; | ||
/** | ||
@@ -43,0 +49,0 @@ * Retrieves only one row from the result. Result must be one row (e.g. using |
@@ -9,2 +9,25 @@ "use strict"; | ||
/** | ||
* Performs vertical filtering with SELECT. | ||
* | ||
* @param columns The columns to retrieve, separated by commas. | ||
*/ | ||
select(columns = '*') { | ||
// Remove whitespaces except when quoted | ||
let quoted = false; | ||
const cleanedColumns = columns | ||
.split('') | ||
.map((c) => { | ||
if (/\s/.test(c) && !quoted) { | ||
return ''; | ||
} | ||
if (c === '"') { | ||
quoted = !quoted; | ||
} | ||
return c; | ||
}) | ||
.join(''); | ||
this.url.searchParams.set('select', cleanedColumns); | ||
return this; | ||
} | ||
/** | ||
* Orders the result with the specified `column`. | ||
@@ -11,0 +34,0 @@ * |
import PostgrestQueryBuilder from './lib/PostgrestQueryBuilder'; | ||
import { PostgrestBuilder } from './lib/types'; | ||
import PostgrestTransformBuilder from './lib/PostgrestTransformBuilder'; | ||
export default class PostgrestClient { | ||
@@ -40,4 +40,4 @@ url: string; | ||
*/ | ||
rpc<T = any>(fn: string, params?: object): PostgrestBuilder<T>; | ||
rpc<T = any>(fn: string, params?: object): PostgrestTransformBuilder<T>; | ||
} | ||
//# sourceMappingURL=PostgrestClient.d.ts.map |
import { PostgrestBuilder } from './types'; | ||
import PostgrestFilterBuilder from './PostgrestFilterBuilder'; | ||
/** | ||
* CRUD | ||
*/ | ||
export default class PostgrestQueryBuilder<T> extends PostgrestBuilder<T> { | ||
@@ -14,3 +11,3 @@ constructor(url: string, { headers, schema }?: { | ||
/** | ||
* Performs horizontal filtering with SELECT. | ||
* Performs vertical filtering with SELECT. | ||
* | ||
@@ -17,0 +14,0 @@ * @param columns The columns to retrieve, separated by commas. |
import { PostgrestBuilder } from './types'; | ||
import PostgrestFilterBuilder from './PostgrestFilterBuilder'; | ||
/** | ||
* CRUD | ||
*/ | ||
import PostgrestTransformBuilder from './PostgrestTransformBuilder'; | ||
export default class PostgrestQueryBuilder extends PostgrestBuilder { | ||
@@ -14,3 +12,3 @@ constructor(url, { headers = {}, schema } = {}) { | ||
/** | ||
* Performs horizontal filtering with SELECT. | ||
* Performs vertical filtering with SELECT. | ||
* | ||
@@ -84,5 +82,5 @@ * @param columns The columns to retrieve, separated by commas. | ||
this.body = params; | ||
return this; | ||
return new PostgrestTransformBuilder(this); | ||
} | ||
} | ||
//# sourceMappingURL=PostgrestQueryBuilder.js.map |
@@ -7,2 +7,8 @@ import { PostgrestBuilder, PostgrestSingleResponse } from './types'; | ||
/** | ||
* Performs vertical filtering with SELECT. | ||
* | ||
* @param columns The columns to retrieve, separated by commas. | ||
*/ | ||
select(columns?: string): this; | ||
/** | ||
* Orders the result with the specified `column`. | ||
@@ -19,3 +25,3 @@ * | ||
foreignTable?: string; | ||
}): PostgrestTransformBuilder<T>; | ||
}): this; | ||
/** | ||
@@ -29,3 +35,3 @@ * Limits the result with the specified `count`. | ||
foreignTable?: string; | ||
}): PostgrestTransformBuilder<T>; | ||
}): this; | ||
/** | ||
@@ -40,3 +46,3 @@ * Limits the result to rows within the specified range, inclusive. | ||
foreignTable?: string; | ||
}): PostgrestTransformBuilder<T>; | ||
}): this; | ||
/** | ||
@@ -43,0 +49,0 @@ * Retrieves only one row from the result. Result must be one row (e.g. using |
@@ -7,2 +7,25 @@ import { PostgrestBuilder } from './types'; | ||
/** | ||
* Performs vertical filtering with SELECT. | ||
* | ||
* @param columns The columns to retrieve, separated by commas. | ||
*/ | ||
select(columns = '*') { | ||
// Remove whitespaces except when quoted | ||
let quoted = false; | ||
const cleanedColumns = columns | ||
.split('') | ||
.map((c) => { | ||
if (/\s/.test(c) && !quoted) { | ||
return ''; | ||
} | ||
if (c === '"') { | ||
quoted = !quoted; | ||
} | ||
return c; | ||
}) | ||
.join(''); | ||
this.url.searchParams.set('select', cleanedColumns); | ||
return this; | ||
} | ||
/** | ||
* Orders the result with the specified `column`. | ||
@@ -9,0 +32,0 @@ * |
import PostgrestQueryBuilder from './lib/PostgrestQueryBuilder'; | ||
import { PostgrestBuilder } from './lib/types'; | ||
import PostgrestTransformBuilder from './lib/PostgrestTransformBuilder'; | ||
export default class PostgrestClient { | ||
@@ -40,4 +40,4 @@ url: string; | ||
*/ | ||
rpc<T = any>(fn: string, params?: object): PostgrestBuilder<T>; | ||
rpc<T = any>(fn: string, params?: object): PostgrestTransformBuilder<T>; | ||
} | ||
//# sourceMappingURL=PostgrestClient.d.ts.map |
{ | ||
"name": "@supabase/postgrest-js", | ||
"version": "0.22.0", | ||
"version": "0.23.0", | ||
"description": "Isomorphic PostgREST client", | ||
@@ -5,0 +5,0 @@ "keywords": [ |
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
121632
2051