@supabase/functions-js 1.3.0 → 1.3.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/main/index.d.ts +11 -9
- package/dist/main/index.d.ts.map +1 -1
- package/dist/main/index.js +2 -2
- package/dist/main/index.js.map +1 -1
- package/dist/main/types.d.ts +1 -2
- package/dist/main/types.d.ts.map +1 -1
- package/dist/main/types.js.map +1 -1
- package/dist/main/version.d.ts +1 -1
- package/dist/main/version.d.ts.map +1 -1
- package/dist/main/version.js +1 -2
- package/dist/main/version.js.map +1 -1
- package/dist/module/index.d.ts +11 -9
- package/dist/module/index.d.ts.map +1 -1
- package/dist/module/index.js +2 -2
- package/dist/module/index.js.map +1 -1
- package/dist/module/types.d.ts +1 -2
- package/dist/module/types.d.ts.map +1 -1
- package/dist/module/types.js.map +1 -1
- package/dist/module/version.d.ts +1 -1
- package/dist/module/version.d.ts.map +1 -1
- package/dist/module/version.js +1 -2
- package/dist/module/version.js.map +1 -1
- package/package.json +2 -8
- package/src/index.ts +14 -6
- package/src/types.ts +1 -3
- package/src/version.ts +1 -2
package/dist/main/index.d.ts
CHANGED
|
@@ -1,13 +1,12 @@
|
|
|
1
1
|
import { Fetch, FunctionInvokeOptions } from './types';
|
|
2
2
|
export declare class FunctionsClient {
|
|
3
3
|
protected url: string;
|
|
4
|
-
protected headers:
|
|
5
|
-
[key: string]: string;
|
|
6
|
-
};
|
|
4
|
+
protected headers: Record<string, string>;
|
|
7
5
|
protected fetch: Fetch;
|
|
8
|
-
constructor(url: string, headers
|
|
9
|
-
|
|
10
|
-
|
|
6
|
+
constructor(url: string, { headers, customFetch, }: {
|
|
7
|
+
headers?: Record<string, string>;
|
|
8
|
+
customFetch?: Fetch;
|
|
9
|
+
});
|
|
11
10
|
/**
|
|
12
11
|
* Updates the authorization header
|
|
13
12
|
* @params token - the new jwt token sent in the authorisation header
|
|
@@ -21,9 +20,12 @@ export declare class FunctionsClient {
|
|
|
21
20
|
* `body`: the body of the request
|
|
22
21
|
* `responseType`: how the response should be parsed. The default is `json`
|
|
23
22
|
*/
|
|
24
|
-
invoke<T =
|
|
25
|
-
data: T
|
|
26
|
-
error:
|
|
23
|
+
invoke<T = any>(functionName: string, invokeOptions?: FunctionInvokeOptions): Promise<{
|
|
24
|
+
data: T;
|
|
25
|
+
error: null;
|
|
26
|
+
} | {
|
|
27
|
+
data: null;
|
|
28
|
+
error: Error;
|
|
27
29
|
}>;
|
|
28
30
|
}
|
|
29
31
|
//# sourceMappingURL=index.d.ts.map
|
package/dist/main/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,KAAK,EAAE,qBAAqB,EAAE,MAAM,SAAS,CAAA;AAEtD,qBAAa,eAAe;IAC1B,SAAS,CAAC,GAAG,EAAE,MAAM,CAAA;IACrB,SAAS,CAAC,OAAO,EAAE
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,KAAK,EAAE,qBAAqB,EAAE,MAAM,SAAS,CAAA;AAEtD,qBAAa,eAAe;IAC1B,SAAS,CAAC,GAAG,EAAE,MAAM,CAAA;IACrB,SAAS,CAAC,OAAO,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAA;IACzC,SAAS,CAAC,KAAK,EAAE,KAAK,CAAA;gBAGpB,GAAG,EAAE,MAAM,EACX,EACE,OAAY,EACZ,WAAW,GACZ,EAAE;QACD,OAAO,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAA;QAChC,WAAW,CAAC,EAAE,KAAK,CAAA;KACpB;IAOH;;;OAGG;IACH,OAAO,CAAC,KAAK,EAAE,MAAM;IAIrB;;;;;;;OAOG;IACG,MAAM,CAAC,CAAC,GAAG,GAAG,EAClB,YAAY,EAAE,MAAM,EACpB,aAAa,CAAC,EAAE,qBAAqB,GACpC,OAAO,CAAC;QAAE,IAAI,EAAE,CAAC,CAAC;QAAC,KAAK,EAAE,IAAI,CAAA;KAAE,GAAG;QAAE,IAAI,EAAE,IAAI,CAAC;QAAC,KAAK,EAAE,KAAK,CAAA;KAAE,CAAC;CA+BpE"}
|
package/dist/main/index.js
CHANGED
|
@@ -12,9 +12,9 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
12
12
|
exports.FunctionsClient = void 0;
|
|
13
13
|
const helper_1 = require("./helper");
|
|
14
14
|
class FunctionsClient {
|
|
15
|
-
constructor(url, headers, customFetch) {
|
|
15
|
+
constructor(url, { headers = {}, customFetch, }) {
|
|
16
16
|
this.url = url;
|
|
17
|
-
this.headers = headers
|
|
17
|
+
this.headers = headers;
|
|
18
18
|
this.fetch = (0, helper_1.resolveFetch)(customFetch);
|
|
19
19
|
}
|
|
20
20
|
/**
|
package/dist/main/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,qCAAuC;AAGvC,MAAa,eAAe;IAK1B,
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,qCAAuC;AAGvC,MAAa,eAAe;IAK1B,YACE,GAAW,EACX,EACE,OAAO,GAAG,EAAE,EACZ,WAAW,GAIZ;QAED,IAAI,CAAC,GAAG,GAAG,GAAG,CAAA;QACd,IAAI,CAAC,OAAO,GAAG,OAAO,CAAA;QACtB,IAAI,CAAC,KAAK,GAAG,IAAA,qBAAY,EAAC,WAAW,CAAC,CAAA;IACxC,CAAC;IAED;;;OAGG;IACH,OAAO,CAAC,KAAa;QACnB,IAAI,CAAC,OAAO,CAAC,aAAa,GAAG,UAAU,KAAK,EAAE,CAAA;IAChD,CAAC;IAED;;;;;;;OAOG;IACG,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AAC,OAAO,KAAU,EAAE;gBACnB,OAAO,EAAE,IAAI,EAAE,IAAI,EAAE,KAAK,EAAE,CAAA;aAC7B;QACH,CAAC;KAAA;CACF;AAtED,0CAsEC"}
|
package/dist/main/types.d.ts
CHANGED
package/dist/main/types.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../src/types.ts"],"names":[],"mappings":"AAAA,
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../src/types.ts"],"names":[],"mappings":"AAAA,oBAAY,KAAK,GAAG,OAAO,KAAK,CAAA;AAEhC,oBAAY,YAAY;IACtB,IAAI,IAAA;IACJ,IAAI,IAAA;IACJ,WAAW,IAAA;IACX,IAAI,IAAA;CACL;AAED,oBAAY,qBAAqB,GAAG;IAClC,OAAO,CAAC,EAAE;QAAE,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,CAAA;KAAE,CAAA;IACnC,IAAI,CAAC,EAAE,IAAI,GAAG,YAAY,GAAG,QAAQ,GAAG,eAAe,GAAG,cAAc,CAAC,UAAU,CAAC,GAAG,MAAM,CAAA;IAC7F,YAAY,CAAC,EAAE,MAAM,OAAO,YAAY,CAAA;CACzC,CAAA"}
|
package/dist/main/types.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.js","sourceRoot":"","sources":["../../src/types.ts"],"names":[],"mappings":";;;
|
|
1
|
+
{"version":3,"file":"types.js","sourceRoot":"","sources":["../../src/types.ts"],"names":[],"mappings":";;;AAEA,IAAY,YAKX;AALD,WAAY,YAAY;IACtB,+CAAI,CAAA;IACJ,+CAAI,CAAA;IACJ,6DAAW,CAAA;IACX,+CAAI,CAAA;AACN,CAAC,EALW,YAAY,GAAZ,oBAAY,KAAZ,oBAAY,QAKvB"}
|
package/dist/main/version.d.ts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export declare const version = "
|
|
1
|
+
export declare const version = "1.3.1";
|
|
2
2
|
//# sourceMappingURL=version.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"version.d.ts","sourceRoot":"","sources":["../../src/version.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"version.d.ts","sourceRoot":"","sources":["../../src/version.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,OAAO,oBAAoB,CAAA"}
|
package/dist/main/version.js
CHANGED
package/dist/main/version.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"version.js","sourceRoot":"","sources":["../../src/version.ts"],"names":[],"mappings":";;;
|
|
1
|
+
{"version":3,"file":"version.js","sourceRoot":"","sources":["../../src/version.ts"],"names":[],"mappings":";;;AAAa,QAAA,OAAO,GAAG,iBAAiB,CAAA"}
|
package/dist/module/index.d.ts
CHANGED
|
@@ -1,13 +1,12 @@
|
|
|
1
1
|
import { Fetch, FunctionInvokeOptions } from './types';
|
|
2
2
|
export declare class FunctionsClient {
|
|
3
3
|
protected url: string;
|
|
4
|
-
protected headers:
|
|
5
|
-
[key: string]: string;
|
|
6
|
-
};
|
|
4
|
+
protected headers: Record<string, string>;
|
|
7
5
|
protected fetch: Fetch;
|
|
8
|
-
constructor(url: string, headers
|
|
9
|
-
|
|
10
|
-
|
|
6
|
+
constructor(url: string, { headers, customFetch, }: {
|
|
7
|
+
headers?: Record<string, string>;
|
|
8
|
+
customFetch?: Fetch;
|
|
9
|
+
});
|
|
11
10
|
/**
|
|
12
11
|
* Updates the authorization header
|
|
13
12
|
* @params token - the new jwt token sent in the authorisation header
|
|
@@ -21,9 +20,12 @@ export declare class FunctionsClient {
|
|
|
21
20
|
* `body`: the body of the request
|
|
22
21
|
* `responseType`: how the response should be parsed. The default is `json`
|
|
23
22
|
*/
|
|
24
|
-
invoke<T =
|
|
25
|
-
data: T
|
|
26
|
-
error:
|
|
23
|
+
invoke<T = any>(functionName: string, invokeOptions?: FunctionInvokeOptions): Promise<{
|
|
24
|
+
data: T;
|
|
25
|
+
error: null;
|
|
26
|
+
} | {
|
|
27
|
+
data: null;
|
|
28
|
+
error: Error;
|
|
27
29
|
}>;
|
|
28
30
|
}
|
|
29
31
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,KAAK,EAAE,qBAAqB,EAAE,MAAM,SAAS,CAAA;AAEtD,qBAAa,eAAe;IAC1B,SAAS,CAAC,GAAG,EAAE,MAAM,CAAA;IACrB,SAAS,CAAC,OAAO,EAAE
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,KAAK,EAAE,qBAAqB,EAAE,MAAM,SAAS,CAAA;AAEtD,qBAAa,eAAe;IAC1B,SAAS,CAAC,GAAG,EAAE,MAAM,CAAA;IACrB,SAAS,CAAC,OAAO,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAA;IACzC,SAAS,CAAC,KAAK,EAAE,KAAK,CAAA;gBAGpB,GAAG,EAAE,MAAM,EACX,EACE,OAAY,EACZ,WAAW,GACZ,EAAE;QACD,OAAO,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAA;QAChC,WAAW,CAAC,EAAE,KAAK,CAAA;KACpB;IAOH;;;OAGG;IACH,OAAO,CAAC,KAAK,EAAE,MAAM;IAIrB;;;;;;;OAOG;IACG,MAAM,CAAC,CAAC,GAAG,GAAG,EAClB,YAAY,EAAE,MAAM,EACpB,aAAa,CAAC,EAAE,qBAAqB,GACpC,OAAO,CAAC;QAAE,IAAI,EAAE,CAAC,CAAC;QAAC,KAAK,EAAE,IAAI,CAAA;KAAE,GAAG;QAAE,IAAI,EAAE,IAAI,CAAC;QAAC,KAAK,EAAE,KAAK,CAAA;KAAE,CAAC;CA+BpE"}
|
package/dist/module/index.js
CHANGED
|
@@ -9,9 +9,9 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|
|
9
9
|
};
|
|
10
10
|
import { resolveFetch } from './helper';
|
|
11
11
|
export class FunctionsClient {
|
|
12
|
-
constructor(url, headers, customFetch) {
|
|
12
|
+
constructor(url, { headers = {}, customFetch, }) {
|
|
13
13
|
this.url = url;
|
|
14
|
-
this.headers = headers
|
|
14
|
+
this.headers = headers;
|
|
15
15
|
this.fetch = resolveFetch(customFetch);
|
|
16
16
|
}
|
|
17
17
|
/**
|
package/dist/module/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":";;;;;;;;;AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,UAAU,CAAA;AAGvC,MAAM,OAAO,eAAe;IAK1B,
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":";;;;;;;;;AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,UAAU,CAAA;AAGvC,MAAM,OAAO,eAAe;IAK1B,YACE,GAAW,EACX,EACE,OAAO,GAAG,EAAE,EACZ,WAAW,GAIZ;QAED,IAAI,CAAC,GAAG,GAAG,GAAG,CAAA;QACd,IAAI,CAAC,OAAO,GAAG,OAAO,CAAA;QACtB,IAAI,CAAC,KAAK,GAAG,YAAY,CAAC,WAAW,CAAC,CAAA;IACxC,CAAC;IAED;;;OAGG;IACH,OAAO,CAAC,KAAa;QACnB,IAAI,CAAC,OAAO,CAAC,aAAa,GAAG,UAAU,KAAK,EAAE,CAAA;IAChD,CAAC;IAED;;;;;;;OAOG;IACG,MAAM,CACV,YAAoB,EACpB,aAAqC;;YAErC,IAAI;gBACF,MAAM,EAAE,OAAO,EAAE,IAAI,EAAE,GAAG,aAAa,aAAb,aAAa,cAAb,aAAa,GAAI,EAAE,CAAA;gBAC7C,MAAM,QAA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|
|
|
1
|
-
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../src/types.ts"],"names":[],"mappings":"AAAA,
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../src/types.ts"],"names":[],"mappings":"AAAA,oBAAY,KAAK,GAAG,OAAO,KAAK,CAAA;AAEhC,oBAAY,YAAY;IACtB,IAAI,IAAA;IACJ,IAAI,IAAA;IACJ,WAAW,IAAA;IACX,IAAI,IAAA;CACL;AAED,oBAAY,qBAAqB,GAAG;IAClC,OAAO,CAAC,EAAE;QAAE,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,CAAA;KAAE,CAAA;IACnC,IAAI,CAAC,EAAE,IAAI,GAAG,YAAY,GAAG,QAAQ,GAAG,eAAe,GAAG,cAAc,CAAC,UAAU,CAAC,GAAG,MAAM,CAAA;IAC7F,YAAY,CAAC,EAAE,MAAM,OAAO,YAAY,CAAA;CACzC,CAAA"}
|
package/dist/module/types.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.js","sourceRoot":"","sources":["../../src/types.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"types.js","sourceRoot":"","sources":["../../src/types.ts"],"names":[],"mappings":"AAEA,MAAM,CAAN,IAAY,YAKX;AALD,WAAY,YAAY;IACtB,+CAAI,CAAA;IACJ,+CAAI,CAAA;IACJ,6DAAW,CAAA;IACX,+CAAI,CAAA;AACN,CAAC,EALW,YAAY,KAAZ,YAAY,QAKvB"}
|
package/dist/module/version.d.ts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export declare const version = "
|
|
1
|
+
export declare const version = "1.3.1";
|
|
2
2
|
//# sourceMappingURL=version.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"version.d.ts","sourceRoot":"","sources":["../../src/version.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"version.d.ts","sourceRoot":"","sources":["../../src/version.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,OAAO,oBAAoB,CAAA"}
|
package/dist/module/version.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"version.js","sourceRoot":"","sources":["../../src/version.ts"],"names":[],"mappings":"AAAA,
|
|
1
|
+
{"version":3,"file":"version.js","sourceRoot":"","sources":["../../src/version.ts"],"names":[],"mappings":"AAAA,MAAM,CAAC,MAAM,OAAO,GAAG,iBAAiB,CAAA"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@supabase/functions-js",
|
|
3
|
-
"version": "1.3.
|
|
3
|
+
"version": "1.3.1",
|
|
4
4
|
"description": "JS Client library to interact with Supabase Functions.",
|
|
5
5
|
"main": "dist/main/index.js",
|
|
6
6
|
"module": "dist/module/index.js",
|
|
@@ -9,7 +9,7 @@
|
|
|
9
9
|
"scripts": {
|
|
10
10
|
"clean": "rimraf dist docs",
|
|
11
11
|
"format": "prettier --write \"{src,test}/**/*.ts\"",
|
|
12
|
-
"build": "
|
|
12
|
+
"build": "run-s clean format build:*",
|
|
13
13
|
"build:main": "tsc -p tsconfig.json",
|
|
14
14
|
"build:module": "tsc -p tsconfig.module.json",
|
|
15
15
|
"docs": "typedoc src/index.ts",
|
|
@@ -37,13 +37,7 @@
|
|
|
37
37
|
"dependencies": {
|
|
38
38
|
"cross-fetch": "^3.1.5"
|
|
39
39
|
},
|
|
40
|
-
"release": {
|
|
41
|
-
"branches": [
|
|
42
|
-
"main"
|
|
43
|
-
]
|
|
44
|
-
},
|
|
45
40
|
"devDependencies": {
|
|
46
|
-
"genversion": "^3.0.2",
|
|
47
41
|
"npm-run-all": "^4.1.5",
|
|
48
42
|
"prettier": "^2.6.0",
|
|
49
43
|
"rimraf": "^3.0.2",
|
package/src/index.ts
CHANGED
|
@@ -3,13 +3,21 @@ import { Fetch, FunctionInvokeOptions } from './types'
|
|
|
3
3
|
|
|
4
4
|
export class FunctionsClient {
|
|
5
5
|
protected url: string
|
|
6
|
-
protected headers:
|
|
6
|
+
protected headers: Record<string, string>
|
|
7
7
|
protected fetch: Fetch
|
|
8
8
|
|
|
9
|
-
constructor(
|
|
9
|
+
constructor(
|
|
10
|
+
url: string,
|
|
11
|
+
{
|
|
12
|
+
headers = {},
|
|
13
|
+
customFetch,
|
|
14
|
+
}: {
|
|
15
|
+
headers?: Record<string, string>
|
|
16
|
+
customFetch?: Fetch
|
|
17
|
+
}
|
|
18
|
+
) {
|
|
10
19
|
this.url = url
|
|
11
|
-
this.headers = headers
|
|
12
|
-
|
|
20
|
+
this.headers = headers
|
|
13
21
|
this.fetch = resolveFetch(customFetch)
|
|
14
22
|
}
|
|
15
23
|
|
|
@@ -29,10 +37,10 @@ export class FunctionsClient {
|
|
|
29
37
|
* `body`: the body of the request
|
|
30
38
|
* `responseType`: how the response should be parsed. The default is `json`
|
|
31
39
|
*/
|
|
32
|
-
async invoke<T =
|
|
40
|
+
async invoke<T = any>(
|
|
33
41
|
functionName: string,
|
|
34
42
|
invokeOptions?: FunctionInvokeOptions
|
|
35
|
-
): Promise<{ data: T | null; error: Error
|
|
43
|
+
): Promise<{ data: T; error: null } | { data: null; error: Error }> {
|
|
36
44
|
try {
|
|
37
45
|
const { headers, body } = invokeOptions ?? {}
|
|
38
46
|
const response = await this.fetch(`${this.url}/${functionName}`, {
|
package/src/types.ts
CHANGED
package/src/version.ts
CHANGED
|
@@ -1,2 +1 @@
|
|
|
1
|
-
|
|
2
|
-
export const version = '0.0.0'
|
|
1
|
+
export const version = '1.3.1'
|