@supabase/functions-js
Advanced tools
Comparing version 1.1.2 to 1.1.3
@@ -24,3 +24,3 @@ import { Fetch, FunctionInvokeOptions } from './types'; | ||
*/ | ||
invoke(functionName: string, invokeOptions: FunctionInvokeOptions): Promise<{ | ||
invoke(functionName: string, invokeOptions?: FunctionInvokeOptions): Promise<{ | ||
data: string | null; | ||
@@ -27,0 +27,0 @@ error: Error | null; |
@@ -49,3 +49,3 @@ "use strict"; | ||
try { | ||
const { headers, body } = invokeOptions; | ||
const { headers, body } = invokeOptions !== null && invokeOptions !== void 0 ? invokeOptions : {}; | ||
const response = yield this.fetch(`${this.url}/${functionName}`, { | ||
@@ -57,3 +57,3 @@ method: 'POST', | ||
let data; | ||
const { responseType } = invokeOptions; | ||
const { responseType } = invokeOptions !== null && invokeOptions !== void 0 ? invokeOptions : {}; | ||
if (!responseType || responseType === 'json') { | ||
@@ -60,0 +60,0 @@ data = yield response.json(); |
@@ -24,3 +24,3 @@ import { Fetch, FunctionInvokeOptions } from './types'; | ||
*/ | ||
invoke(functionName: string, invokeOptions: FunctionInvokeOptions): Promise<{ | ||
invoke(functionName: string, invokeOptions?: FunctionInvokeOptions): Promise<{ | ||
data: string | null; | ||
@@ -27,0 +27,0 @@ error: Error | null; |
@@ -43,3 +43,3 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) { | ||
try { | ||
const { headers, body } = invokeOptions; | ||
const { headers, body } = invokeOptions !== null && invokeOptions !== void 0 ? invokeOptions : {}; | ||
const response = yield this.fetch(`${this.url}/${functionName}`, { | ||
@@ -51,3 +51,3 @@ method: 'POST', | ||
let data; | ||
const { responseType } = invokeOptions; | ||
const { responseType } = invokeOptions !== null && invokeOptions !== void 0 ? invokeOptions : {}; | ||
if (!responseType || responseType === 'json') { | ||
@@ -54,0 +54,0 @@ data = yield response.json(); |
{ | ||
"name": "@supabase/functions-js", | ||
"version": "1.1.2", | ||
"description": "JS Client library to interact with Supabase Functions", | ||
"version": "1.1.3", | ||
"description": "JS Client library to interact with Supabase Functions.", | ||
"main": "dist/main/index.js", | ||
@@ -6,0 +6,0 @@ "module": "dist/module/index.js", |
@@ -40,6 +40,6 @@ import crossFetch from 'cross-fetch' | ||
functionName: string, | ||
invokeOptions: FunctionInvokeOptions | ||
invokeOptions?: FunctionInvokeOptions | ||
): Promise<{ data: string | null; error: Error | null }> { | ||
try { | ||
const { headers, body } = invokeOptions | ||
const { headers, body } = invokeOptions ?? {} | ||
const response = await this.fetch(`${this.url}/${functionName}`, { | ||
@@ -52,3 +52,3 @@ method: 'POST', | ||
let data | ||
const { responseType } = invokeOptions | ||
const { responseType } = invokeOptions ?? {} | ||
if (!responseType || responseType === 'json') { | ||
@@ -55,0 +55,0 @@ data = await response.json() |
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
32167