@supabase/functions-js
Advanced tools
Comparing version 2.1.5 to 2.2.0
@@ -1,9 +0,11 @@ | ||
import { Fetch, FunctionsResponse, FunctionInvokeOptions } from './types'; | ||
import { Fetch, FunctionsResponse, FunctionInvokeOptions, FunctionRegion } from './types'; | ||
export declare class FunctionsClient { | ||
protected url: string; | ||
protected headers: Record<string, string>; | ||
protected region: FunctionRegion; | ||
protected fetch: Fetch; | ||
constructor(url: string, { headers, customFetch, }?: { | ||
constructor(url: string, { headers, customFetch, region, }?: { | ||
headers?: Record<string, string>; | ||
customFetch?: Fetch; | ||
region?: FunctionRegion; | ||
}); | ||
@@ -10,0 +12,0 @@ /** |
@@ -16,5 +16,6 @@ "use strict"; | ||
class FunctionsClient { | ||
constructor(url, { headers = {}, customFetch, } = {}) { | ||
constructor(url, { headers = {}, customFetch, region = types_1.FunctionRegion.Any, } = {}) { | ||
this.url = url; | ||
this.headers = headers; | ||
this.region = region; | ||
this.fetch = (0, helper_1.resolveFetch)(customFetch); | ||
@@ -40,2 +41,9 @@ } | ||
let _headers = {}; | ||
let { region } = options; | ||
if (!region) { | ||
region = this.region; | ||
} | ||
if (region && region !== 'any') { | ||
_headers['x-region'] = region; | ||
} | ||
let body; | ||
@@ -42,0 +50,0 @@ if (functionArgs && |
@@ -28,2 +28,19 @@ export declare type Fetch = typeof fetch; | ||
} | ||
export declare enum FunctionRegion { | ||
Any = "any", | ||
ApNortheast1 = "ap-northeast-1", | ||
ApNortheast2 = "ap-northeast-2", | ||
ApSouth1 = "ap-south-1", | ||
ApSoutheast1 = "ap-southeast-1", | ||
ApSoutheast2 = "ap-southeast-2", | ||
CaCentral1 = "ca-central-1", | ||
EuCentral1 = "eu-central-1", | ||
EuWest1 = "eu-west-1", | ||
EuWest2 = "eu-west-2", | ||
EuWest3 = "eu-west-3", | ||
SaEast1 = "sa-east-1", | ||
UsEast1 = "us-east-1", | ||
UsWest1 = "us-west-1", | ||
UsWest2 = "us-west-2" | ||
} | ||
export declare type FunctionInvokeOptions = { | ||
@@ -41,2 +58,6 @@ /** | ||
/** | ||
* The Region to invoke the function in. | ||
*/ | ||
region?: FunctionRegion; | ||
/** | ||
* The body of the request. | ||
@@ -43,0 +64,0 @@ */ |
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.FunctionsHttpError = exports.FunctionsRelayError = exports.FunctionsFetchError = exports.FunctionsError = void 0; | ||
exports.FunctionRegion = exports.FunctionsHttpError = exports.FunctionsRelayError = exports.FunctionsFetchError = exports.FunctionsError = void 0; | ||
class FunctionsError extends Error { | ||
@@ -30,2 +30,21 @@ constructor(message, name = 'FunctionsError', context) { | ||
exports.FunctionsHttpError = FunctionsHttpError; | ||
// Define the enum for the 'region' property | ||
var FunctionRegion; | ||
(function (FunctionRegion) { | ||
FunctionRegion["Any"] = "any"; | ||
FunctionRegion["ApNortheast1"] = "ap-northeast-1"; | ||
FunctionRegion["ApNortheast2"] = "ap-northeast-2"; | ||
FunctionRegion["ApSouth1"] = "ap-south-1"; | ||
FunctionRegion["ApSoutheast1"] = "ap-southeast-1"; | ||
FunctionRegion["ApSoutheast2"] = "ap-southeast-2"; | ||
FunctionRegion["CaCentral1"] = "ca-central-1"; | ||
FunctionRegion["EuCentral1"] = "eu-central-1"; | ||
FunctionRegion["EuWest1"] = "eu-west-1"; | ||
FunctionRegion["EuWest2"] = "eu-west-2"; | ||
FunctionRegion["EuWest3"] = "eu-west-3"; | ||
FunctionRegion["SaEast1"] = "sa-east-1"; | ||
FunctionRegion["UsEast1"] = "us-east-1"; | ||
FunctionRegion["UsWest1"] = "us-west-1"; | ||
FunctionRegion["UsWest2"] = "us-west-2"; | ||
})(FunctionRegion = exports.FunctionRegion || (exports.FunctionRegion = {})); | ||
//# sourceMappingURL=types.js.map |
@@ -1,2 +0,2 @@ | ||
export declare const version = "2.1.5"; | ||
export declare const version = "2.2.0"; | ||
//# sourceMappingURL=version.d.ts.map |
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.version = void 0; | ||
exports.version = '2.1.5'; | ||
exports.version = '2.2.0'; | ||
//# sourceMappingURL=version.js.map |
@@ -1,9 +0,11 @@ | ||
import { Fetch, FunctionsResponse, FunctionInvokeOptions } from './types'; | ||
import { Fetch, FunctionsResponse, FunctionInvokeOptions, FunctionRegion } from './types'; | ||
export declare class FunctionsClient { | ||
protected url: string; | ||
protected headers: Record<string, string>; | ||
protected region: FunctionRegion; | ||
protected fetch: Fetch; | ||
constructor(url: string, { headers, customFetch, }?: { | ||
constructor(url: string, { headers, customFetch, region, }?: { | ||
headers?: Record<string, string>; | ||
customFetch?: Fetch; | ||
region?: FunctionRegion; | ||
}); | ||
@@ -10,0 +12,0 @@ /** |
@@ -11,7 +11,8 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) { | ||
import { resolveFetch } from './helper'; | ||
import { FunctionsFetchError, FunctionsHttpError, FunctionsRelayError, } from './types'; | ||
import { FunctionsFetchError, FunctionsHttpError, FunctionsRelayError, FunctionRegion, } from './types'; | ||
export class FunctionsClient { | ||
constructor(url, { headers = {}, customFetch, } = {}) { | ||
constructor(url, { headers = {}, customFetch, region = FunctionRegion.Any, } = {}) { | ||
this.url = url; | ||
this.headers = headers; | ||
this.region = region; | ||
this.fetch = resolveFetch(customFetch); | ||
@@ -37,2 +38,9 @@ } | ||
let _headers = {}; | ||
let { region } = options; | ||
if (!region) { | ||
region = this.region; | ||
} | ||
if (region && region !== 'any') { | ||
_headers['x-region'] = region; | ||
} | ||
let body; | ||
@@ -39,0 +47,0 @@ if (functionArgs && |
@@ -28,2 +28,19 @@ export declare type Fetch = typeof fetch; | ||
} | ||
export declare enum FunctionRegion { | ||
Any = "any", | ||
ApNortheast1 = "ap-northeast-1", | ||
ApNortheast2 = "ap-northeast-2", | ||
ApSouth1 = "ap-south-1", | ||
ApSoutheast1 = "ap-southeast-1", | ||
ApSoutheast2 = "ap-southeast-2", | ||
CaCentral1 = "ca-central-1", | ||
EuCentral1 = "eu-central-1", | ||
EuWest1 = "eu-west-1", | ||
EuWest2 = "eu-west-2", | ||
EuWest3 = "eu-west-3", | ||
SaEast1 = "sa-east-1", | ||
UsEast1 = "us-east-1", | ||
UsWest1 = "us-west-1", | ||
UsWest2 = "us-west-2" | ||
} | ||
export declare type FunctionInvokeOptions = { | ||
@@ -41,2 +58,6 @@ /** | ||
/** | ||
* The Region to invoke the function in. | ||
*/ | ||
region?: FunctionRegion; | ||
/** | ||
* The body of the request. | ||
@@ -43,0 +64,0 @@ */ |
@@ -23,2 +23,21 @@ export class FunctionsError extends Error { | ||
} | ||
// Define the enum for the 'region' property | ||
export var FunctionRegion; | ||
(function (FunctionRegion) { | ||
FunctionRegion["Any"] = "any"; | ||
FunctionRegion["ApNortheast1"] = "ap-northeast-1"; | ||
FunctionRegion["ApNortheast2"] = "ap-northeast-2"; | ||
FunctionRegion["ApSouth1"] = "ap-south-1"; | ||
FunctionRegion["ApSoutheast1"] = "ap-southeast-1"; | ||
FunctionRegion["ApSoutheast2"] = "ap-southeast-2"; | ||
FunctionRegion["CaCentral1"] = "ca-central-1"; | ||
FunctionRegion["EuCentral1"] = "eu-central-1"; | ||
FunctionRegion["EuWest1"] = "eu-west-1"; | ||
FunctionRegion["EuWest2"] = "eu-west-2"; | ||
FunctionRegion["EuWest3"] = "eu-west-3"; | ||
FunctionRegion["SaEast1"] = "sa-east-1"; | ||
FunctionRegion["UsEast1"] = "us-east-1"; | ||
FunctionRegion["UsWest1"] = "us-west-1"; | ||
FunctionRegion["UsWest2"] = "us-west-2"; | ||
})(FunctionRegion || (FunctionRegion = {})); | ||
//# sourceMappingURL=types.js.map |
@@ -1,2 +0,2 @@ | ||
export declare const version = "2.1.5"; | ||
export declare const version = "2.2.0"; | ||
//# sourceMappingURL=version.d.ts.map |
@@ -1,2 +0,2 @@ | ||
export const version = '2.1.5'; | ||
export const version = '2.2.0'; | ||
//# sourceMappingURL=version.js.map |
{ | ||
"name": "@supabase/functions-js", | ||
"version": "2.1.5", | ||
"version": "2.2.0", | ||
"description": "JS Client library to interact with Supabase Functions.", | ||
@@ -5,0 +5,0 @@ "main": "dist/main/index.js", |
@@ -9,2 +9,3 @@ import { resolveFetch } from './helper' | ||
FunctionInvokeOptions, | ||
FunctionRegion, | ||
} from './types' | ||
@@ -15,2 +16,3 @@ | ||
protected headers: Record<string, string> | ||
protected region: FunctionRegion | ||
protected fetch: Fetch | ||
@@ -23,5 +25,7 @@ | ||
customFetch, | ||
region = FunctionRegion.Any, | ||
}: { | ||
headers?: Record<string, string> | ||
customFetch?: Fetch | ||
region?: FunctionRegion | ||
} = {} | ||
@@ -31,2 +35,3 @@ ) { | ||
this.headers = headers | ||
this.region = region | ||
this.fetch = resolveFetch(customFetch) | ||
@@ -54,4 +59,10 @@ } | ||
const { headers, method, body: functionArgs } = options | ||
let _headers: Record<string, string> = {} | ||
let { region } = options | ||
if (!region) { | ||
region = this.region | ||
} | ||
if (region && region !== 'any') { | ||
_headers['x-region'] = region | ||
} | ||
let body: any | ||
@@ -58,0 +69,0 @@ if ( |
@@ -43,2 +43,20 @@ export type Fetch = typeof fetch | ||
} | ||
// Define the enum for the 'region' property | ||
export enum FunctionRegion { | ||
Any = 'any', | ||
ApNortheast1 = 'ap-northeast-1', | ||
ApNortheast2 = 'ap-northeast-2', | ||
ApSouth1 = 'ap-south-1', | ||
ApSoutheast1 = 'ap-southeast-1', | ||
ApSoutheast2 = 'ap-southeast-2', | ||
CaCentral1 = 'ca-central-1', | ||
EuCentral1 = 'eu-central-1', | ||
EuWest1 = 'eu-west-1', | ||
EuWest2 = 'eu-west-2', | ||
EuWest3 = 'eu-west-3', | ||
SaEast1 = 'sa-east-1', | ||
UsEast1 = 'us-east-1', | ||
UsWest1 = 'us-west-1', | ||
UsWest2 = 'us-west-2', | ||
} | ||
@@ -55,2 +73,6 @@ export type FunctionInvokeOptions = { | ||
/** | ||
* The Region to invoke the function in. | ||
*/ | ||
region?: FunctionRegion | ||
/** | ||
* The body of the request. | ||
@@ -57,0 +79,0 @@ */ |
@@ -1,1 +0,1 @@ | ||
export const version = '2.1.5' | ||
export const version = '2.2.0' |
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
49402
791