@supabase/functions-js 2.4.6 → 2.71.2-canary.0

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.
Files changed (44) hide show
  1. package/README.md +0 -3
  2. package/package.json +11 -21
  3. package/src/version.ts +1 -1
  4. package/LICENSE +0 -21
  5. package/dist/main/FunctionsClient.d.ts +0 -24
  6. package/dist/main/FunctionsClient.d.ts.map +0 -1
  7. package/dist/main/FunctionsClient.js +0 -127
  8. package/dist/main/FunctionsClient.js.map +0 -1
  9. package/dist/main/helper.d.ts +0 -3
  10. package/dist/main/helper.d.ts.map +0 -1
  11. package/dist/main/helper.js +0 -41
  12. package/dist/main/helper.js.map +0 -1
  13. package/dist/main/index.d.ts +0 -3
  14. package/dist/main/index.d.ts.map +0 -1
  15. package/dist/main/index.js +0 -12
  16. package/dist/main/index.js.map +0 -1
  17. package/dist/main/types.d.ts +0 -66
  18. package/dist/main/types.d.ts.map +0 -1
  19. package/dist/main/types.js +0 -49
  20. package/dist/main/types.js.map +0 -1
  21. package/dist/main/version.d.ts +0 -2
  22. package/dist/main/version.d.ts.map +0 -1
  23. package/dist/main/version.js +0 -5
  24. package/dist/main/version.js.map +0 -1
  25. package/dist/module/FunctionsClient.d.ts +0 -24
  26. package/dist/module/FunctionsClient.d.ts.map +0 -1
  27. package/dist/module/FunctionsClient.js +0 -123
  28. package/dist/module/FunctionsClient.js.map +0 -1
  29. package/dist/module/helper.d.ts +0 -3
  30. package/dist/module/helper.d.ts.map +0 -1
  31. package/dist/module/helper.js +0 -14
  32. package/dist/module/helper.js.map +0 -1
  33. package/dist/module/index.d.ts +0 -3
  34. package/dist/module/index.d.ts.map +0 -1
  35. package/dist/module/index.js +0 -3
  36. package/dist/module/index.js.map +0 -1
  37. package/dist/module/types.d.ts +0 -66
  38. package/dist/module/types.d.ts.map +0 -1
  39. package/dist/module/types.js +0 -42
  40. package/dist/module/types.js.map +0 -1
  41. package/dist/module/version.d.ts +0 -2
  42. package/dist/module/version.d.ts.map +0 -1
  43. package/dist/module/version.js +0 -2
  44. package/dist/module/version.js.map +0 -1
package/README.md CHANGED
@@ -1,8 +1,5 @@
1
1
  # `functions-js`
2
2
 
3
- [![Coverage Status](https://coveralls.io/repos/github/supabase/functions-js/badge.svg?branch=main)](https://coveralls.io/github/supabase/functions-js?branch=main) [![pkg.pr.new](https://pkg.pr.new/badge/supabase/functions-js)](https://pkg.pr.new/~/supabase/functions-js)
4
-
5
-
6
3
  JS Client library to interact with Supabase Functions.
7
4
 
8
5
  ## Docs
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@supabase/functions-js",
3
- "version": "2.4.6",
3
+ "version": "2.71.2-canary.0",
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,17 +9,19 @@
9
9
  "scripts": {
10
10
  "clean": "rimraf dist docs/v2",
11
11
  "format": "prettier --write \"{src,test}/**/*.ts\"",
12
- "build": "run-s clean format build:*",
12
+ "build": "npm run clean && npm run format && npm run build:main && npm run build:module",
13
13
  "build:main": "tsc -p tsconfig.json",
14
14
  "build:module": "tsc -p tsconfig.module.json",
15
15
  "docs": "typedoc src/index.ts --out docs/v2",
16
16
  "docs:json": "typedoc --json docs/v2/spec.json --excludeExternals src/index.ts",
17
17
  "test": "jest",
18
+ "test:ci": "jest --coverage",
18
19
  "test:coverage": "jest --coverage"
19
20
  },
20
21
  "repository": {
21
22
  "type": "git",
22
- "url": "git+https://github.com/supabase/functions-js.git"
23
+ "url": "https://github.com/supabase/supabase-js-libs.git",
24
+ "directory": "packages/core/functions-js"
23
25
  },
24
26
  "keywords": [
25
27
  "functions",
@@ -32,32 +34,20 @@
32
34
  ],
33
35
  "license": "MIT",
34
36
  "bugs": {
35
- "url": "https://github.com/supabase/functions-js/issues"
37
+ "url": "https://github.com/supabase/supabase-js-libs/issues"
36
38
  },
37
- "homepage": "https://github.com/supabase/functions-js#readme",
39
+ "homepage": "https://github.com/supabase/supabase-js-libs/tree/main/packages/core/functions-js",
38
40
  "dependencies": {
39
- "@supabase/node-fetch": "^2.6.14"
41
+ "@supabase/node-fetch": "2.6.15"
40
42
  },
41
43
  "devDependencies": {
42
44
  "@sebbo2002/semantic-release-jsr": "^1.0.0",
43
- "@types/jest": "^28.1.0",
44
- "@types/jsonwebtoken": "^8.5.8",
45
- "@types/node": "^18.7.0",
46
- "genversion": "^3.0.2",
47
- "jest": "^28.1.0",
48
- "jsonwebtoken": "^9.0.0",
45
+ "bs-logger": "^0.2.6",
46
+ "jest": "^29.7.0",
49
47
  "nanoid": "^3.3.1",
50
- "npm-run-all": "^4.1.5",
51
48
  "openai": "^4.52.5",
52
- "prettier": "^2.6.0",
53
- "rimraf": "^3.0.2",
54
- "semantic-release-plugin-update-version-in-files": "^1.1.0",
55
49
  "testcontainers": "^8.5.1",
56
- "ts-jest": "^28.0.0",
57
- "ts-node": "^10.9.0",
58
- "ts-test-decorators": "^0.0.6",
59
- "typedoc": "^0.23.28",
60
- "typescript": "^4.6.2"
50
+ "ts-jest": "^29.4.2"
61
51
  },
62
52
  "publishConfig": {
63
53
  "access": "public"
package/src/version.ts CHANGED
@@ -1 +1 @@
1
- export const version = '2.4.6'
1
+ export const version = '0.0.0-automated'
package/LICENSE DELETED
@@ -1,21 +0,0 @@
1
- MIT License
2
-
3
- Copyright (c) 2020 Supabase
4
-
5
- Permission is hereby granted, free of charge, to any person obtaining a copy
6
- of this software and associated documentation files (the "Software"), to deal
7
- in the Software without restriction, including without limitation the rights
8
- to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
- copies of the Software, and to permit persons to whom the Software is
10
- furnished to do so, subject to the following conditions:
11
-
12
- The above copyright notice and this permission notice shall be included in all
13
- copies or substantial portions of the Software.
14
-
15
- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
- IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
- FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
- AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
- LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
- OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
- SOFTWARE.
@@ -1,24 +0,0 @@
1
- import { Fetch, FunctionsResponse, FunctionInvokeOptions, FunctionRegion } from './types';
2
- export declare class FunctionsClient {
3
- protected url: string;
4
- protected headers: Record<string, string>;
5
- protected region: FunctionRegion;
6
- protected fetch: Fetch;
7
- constructor(url: string, { headers, customFetch, region, }?: {
8
- headers?: Record<string, string>;
9
- customFetch?: Fetch;
10
- region?: FunctionRegion;
11
- });
12
- /**
13
- * Updates the authorization header
14
- * @param token - the new jwt token sent in the authorisation header
15
- */
16
- setAuth(token: string): void;
17
- /**
18
- * Invokes a function
19
- * @param functionName - The name of the Function to invoke.
20
- * @param options - Options for invoking the Function.
21
- */
22
- invoke<T = any>(functionName: string, options?: FunctionInvokeOptions): Promise<FunctionsResponse<T>>;
23
- }
24
- //# sourceMappingURL=FunctionsClient.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"FunctionsClient.d.ts","sourceRoot":"","sources":["../../src/FunctionsClient.ts"],"names":[],"mappings":"AACA,OAAO,EACL,KAAK,EAIL,iBAAiB,EACjB,qBAAqB,EACrB,cAAc,EACf,MAAM,SAAS,CAAA;AAEhB,qBAAa,eAAe;IAC1B,SAAS,CAAC,GAAG,EAAE,MAAM,CAAA;IACrB,SAAS,CAAC,OAAO,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAA;IACzC,SAAS,CAAC,MAAM,EAAE,cAAc,CAAA;IAChC,SAAS,CAAC,KAAK,EAAE,KAAK,CAAA;gBAGpB,GAAG,EAAE,MAAM,EACX,EACE,OAAY,EACZ,WAAW,EACX,MAA2B,GAC5B,GAAE;QACD,OAAO,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAA;QAChC,WAAW,CAAC,EAAE,KAAK,CAAA;QACnB,MAAM,CAAC,EAAE,cAAc,CAAA;KACnB;IAQR;;;OAGG;IACH,OAAO,CAAC,KAAK,EAAE,MAAM;IAIrB;;;;OAIG;IACG,MAAM,CAAC,CAAC,GAAG,GAAG,EAClB,YAAY,EAAE,MAAM,EACpB,OAAO,GAAE,qBAA0B,GAClC,OAAO,CAAC,iBAAiB,CAAC,CAAC,CAAC,CAAC;CA0FjC"}
@@ -1,127 +0,0 @@
1
- "use strict";
2
- var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
3
- function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
4
- return new (P || (P = Promise))(function (resolve, reject) {
5
- function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
6
- function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
7
- function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
8
- step((generator = generator.apply(thisArg, _arguments || [])).next());
9
- });
10
- };
11
- Object.defineProperty(exports, "__esModule", { value: true });
12
- exports.FunctionsClient = void 0;
13
- const helper_1 = require("./helper");
14
- const types_1 = require("./types");
15
- class FunctionsClient {
16
- constructor(url, { headers = {}, customFetch, region = types_1.FunctionRegion.Any, } = {}) {
17
- this.url = url;
18
- this.headers = headers;
19
- this.region = region;
20
- this.fetch = (0, helper_1.resolveFetch)(customFetch);
21
- }
22
- /**
23
- * Updates the authorization header
24
- * @param token - the new jwt token sent in the authorisation header
25
- */
26
- setAuth(token) {
27
- this.headers.Authorization = `Bearer ${token}`;
28
- }
29
- /**
30
- * Invokes a function
31
- * @param functionName - The name of the Function to invoke.
32
- * @param options - Options for invoking the Function.
33
- */
34
- invoke(functionName, options = {}) {
35
- var _a;
36
- return __awaiter(this, void 0, void 0, function* () {
37
- try {
38
- const { headers, method, body: functionArgs } = options;
39
- let _headers = {};
40
- let { region } = options;
41
- if (!region) {
42
- region = this.region;
43
- }
44
- // Add region as query parameter using URL API
45
- const url = new URL(`${this.url}/${functionName}`);
46
- if (region && region !== 'any') {
47
- _headers['x-region'] = region;
48
- url.searchParams.set('forceFunctionRegion', region);
49
- }
50
- let body;
51
- if (functionArgs &&
52
- ((headers && !Object.prototype.hasOwnProperty.call(headers, 'Content-Type')) || !headers)) {
53
- if ((typeof Blob !== 'undefined' && functionArgs instanceof Blob) ||
54
- functionArgs instanceof ArrayBuffer) {
55
- // will work for File as File inherits Blob
56
- // also works for ArrayBuffer as it is the same underlying structure as a Blob
57
- _headers['Content-Type'] = 'application/octet-stream';
58
- body = functionArgs;
59
- }
60
- else if (typeof functionArgs === 'string') {
61
- // plain string
62
- _headers['Content-Type'] = 'text/plain';
63
- body = functionArgs;
64
- }
65
- else if (typeof FormData !== 'undefined' && functionArgs instanceof FormData) {
66
- // don't set content-type headers
67
- // Request will automatically add the right boundary value
68
- body = functionArgs;
69
- }
70
- else {
71
- // default, assume this is JSON
72
- _headers['Content-Type'] = 'application/json';
73
- body = JSON.stringify(functionArgs);
74
- }
75
- }
76
- const response = yield this.fetch(url.toString(), {
77
- method: method || 'POST',
78
- // headers priority is (high to low):
79
- // 1. invoke-level headers
80
- // 2. client-level headers
81
- // 3. default Content-Type header
82
- headers: Object.assign(Object.assign(Object.assign({}, _headers), this.headers), headers),
83
- body,
84
- }).catch((fetchError) => {
85
- throw new types_1.FunctionsFetchError(fetchError);
86
- });
87
- const isRelayError = response.headers.get('x-relay-error');
88
- if (isRelayError && isRelayError === 'true') {
89
- throw new types_1.FunctionsRelayError(response);
90
- }
91
- if (!response.ok) {
92
- throw new types_1.FunctionsHttpError(response);
93
- }
94
- let responseType = ((_a = response.headers.get('Content-Type')) !== null && _a !== void 0 ? _a : 'text/plain').split(';')[0].trim();
95
- let data;
96
- if (responseType === 'application/json') {
97
- data = yield response.json();
98
- }
99
- else if (responseType === 'application/octet-stream') {
100
- data = yield response.blob();
101
- }
102
- else if (responseType === 'text/event-stream') {
103
- data = response;
104
- }
105
- else if (responseType === 'multipart/form-data') {
106
- data = yield response.formData();
107
- }
108
- else {
109
- // default to text
110
- data = yield response.text();
111
- }
112
- return { data, error: null, response };
113
- }
114
- catch (error) {
115
- return {
116
- data: null,
117
- error,
118
- response: error instanceof types_1.FunctionsHttpError || error instanceof types_1.FunctionsRelayError
119
- ? error.context
120
- : undefined,
121
- };
122
- }
123
- });
124
- }
125
- }
126
- exports.FunctionsClient = FunctionsClient;
127
- //# sourceMappingURL=FunctionsClient.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"FunctionsClient.js","sourceRoot":"","sources":["../../src/FunctionsClient.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,qCAAuC;AACvC,mCAQgB;AAEhB,MAAa,eAAe;IAM1B,YACE,GAAW,EACX,EACE,OAAO,GAAG,EAAE,EACZ,WAAW,EACX,MAAM,GAAG,sBAAc,CAAC,GAAG,MAKzB,EAAE;QAEN,IAAI,CAAC,GAAG,GAAG,GAAG,CAAA;QACd,IAAI,CAAC,OAAO,GAAG,OAAO,CAAA;QACtB,IAAI,CAAC,MAAM,GAAG,MAAM,CAAA;QACpB,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;;;;OAIG;IACG,MAAM,CACV,YAAoB,EACpB,UAAiC,EAAE;;;YAEnC,IAAI;gBACF,MAAM,EAAE,OAAO,EAAE,MAAM,EAAE,IAAI,EAAE,YAAY,EAAE,GAAG,OAAO,CAAA;gBACvD,IAAI,QAAQ,GAA2B,EAAE,CAAA;gBACzC,IAAI,EAAE,MAAM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YAAY,KAAK,qBAAqB,EAAE;oBACjD,IAAI,GAAG,MAAM,QAAQ,CAAC,QAAQ,EAAE,CAAA;iBACjC;qBAAM;oBACL,kBAAkB;oBAClB,IAAI,GAAG,MAAM,QAAQ,CAAC,IAAI,EAAE,CAAA;iBAC7B;gBAED,OAAO,EAAE,IAAI,EAAE,KAAK,EAAE,IAAI,EAAE,QAAQ,EAAE,CAAA;aACvC;YAAC,OAAO,KAAK,EAAE;gBACd,OAAO;oBACL,IAAI,EAAE,IAAI;oBACV,KAAK;oBACL,QAAQ,EACN,KAAK,YAAY,0BAAkB,IAAI,KAAK,YAAY,2BAAmB;wBACzE,CAAC,CAAC,KAAK,CAAC,OAAO;wBACf,CAAC,CAAC,SAAS;iBAChB,CAAA;aACF;;KACF;CACF;AAlID,0CAkIC"}
@@ -1,3 +0,0 @@
1
- import { Fetch } from './types';
2
- export declare const resolveFetch: (customFetch?: Fetch) => Fetch;
3
- //# sourceMappingURL=helper.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"helper.d.ts","sourceRoot":"","sources":["../../src/helper.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAE,MAAM,SAAS,CAAA;AAE/B,eAAO,MAAM,YAAY,iBAAkB,KAAK,KAAG,KAWlD,CAAA"}
@@ -1,41 +0,0 @@
1
- "use strict";
2
- var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
- if (k2 === undefined) k2 = k;
4
- var desc = Object.getOwnPropertyDescriptor(m, k);
5
- if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
- desc = { enumerable: true, get: function() { return m[k]; } };
7
- }
8
- Object.defineProperty(o, k2, desc);
9
- }) : (function(o, m, k, k2) {
10
- if (k2 === undefined) k2 = k;
11
- o[k2] = m[k];
12
- }));
13
- var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
14
- Object.defineProperty(o, "default", { enumerable: true, value: v });
15
- }) : function(o, v) {
16
- o["default"] = v;
17
- });
18
- var __importStar = (this && this.__importStar) || function (mod) {
19
- if (mod && mod.__esModule) return mod;
20
- var result = {};
21
- if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
22
- __setModuleDefault(result, mod);
23
- return result;
24
- };
25
- Object.defineProperty(exports, "__esModule", { value: true });
26
- exports.resolveFetch = void 0;
27
- const resolveFetch = (customFetch) => {
28
- let _fetch;
29
- if (customFetch) {
30
- _fetch = customFetch;
31
- }
32
- else if (typeof fetch === 'undefined') {
33
- _fetch = (...args) => Promise.resolve().then(() => __importStar(require('@supabase/node-fetch'))).then(({ default: fetch }) => fetch(...args));
34
- }
35
- else {
36
- _fetch = fetch;
37
- }
38
- return (...args) => _fetch(...args);
39
- };
40
- exports.resolveFetch = resolveFetch;
41
- //# sourceMappingURL=helper.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"helper.js","sourceRoot":"","sources":["../../src/helper.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;AAEO,MAAM,YAAY,GAAG,CAAC,WAAmB,EAAS,EAAE;IACzD,IAAI,MAAa,CAAA;IACjB,IAAI,WAAW,EAAE;QACf,MAAM,GAAG,WAAW,CAAA;KACrB;SAAM,IAAI,OAAO,KAAK,KAAK,WAAW,EAAE;QACvC,MAAM,GAAG,CAAC,GAAG,IAAI,EAAE,EAAE,CACnB,kDAAO,sBAA6B,IAAE,IAAI,CAAC,CAAC,EAAE,OAAO,EAAE,KAAK,EAAE,EAAE,EAAE,CAAC,KAAK,CAAC,GAAG,IAAI,CAAC,CAAC,CAAA;KACrF;SAAM;QACL,MAAM,GAAG,KAAK,CAAA;KACf;IACD,OAAO,CAAC,GAAG,IAAI,EAAE,EAAE,CAAC,MAAM,CAAC,GAAG,IAAI,CAAC,CAAA;AACrC,CAAC,CAAA;AAXY,QAAA,YAAY,gBAWxB"}
@@ -1,3 +0,0 @@
1
- export { FunctionsClient } from './FunctionsClient';
2
- export { type FunctionInvokeOptions, FunctionsError, FunctionsFetchError, FunctionsHttpError, FunctionsRelayError, FunctionRegion, type FunctionsResponse, } from './types';
3
- //# sourceMappingURL=index.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAE,MAAM,mBAAmB,CAAA;AACnD,OAAO,EACL,KAAK,qBAAqB,EAC1B,cAAc,EACd,mBAAmB,EACnB,kBAAkB,EAClB,mBAAmB,EACnB,cAAc,EACd,KAAK,iBAAiB,GACvB,MAAM,SAAS,CAAA"}
@@ -1,12 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.FunctionRegion = exports.FunctionsRelayError = exports.FunctionsHttpError = exports.FunctionsFetchError = exports.FunctionsError = exports.FunctionsClient = void 0;
4
- var FunctionsClient_1 = require("./FunctionsClient");
5
- Object.defineProperty(exports, "FunctionsClient", { enumerable: true, get: function () { return FunctionsClient_1.FunctionsClient; } });
6
- var types_1 = require("./types");
7
- Object.defineProperty(exports, "FunctionsError", { enumerable: true, get: function () { return types_1.FunctionsError; } });
8
- Object.defineProperty(exports, "FunctionsFetchError", { enumerable: true, get: function () { return types_1.FunctionsFetchError; } });
9
- Object.defineProperty(exports, "FunctionsHttpError", { enumerable: true, get: function () { return types_1.FunctionsHttpError; } });
10
- Object.defineProperty(exports, "FunctionsRelayError", { enumerable: true, get: function () { return types_1.FunctionsRelayError; } });
11
- Object.defineProperty(exports, "FunctionRegion", { enumerable: true, get: function () { return types_1.FunctionRegion; } });
12
- //# sourceMappingURL=index.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":";;;AAAA,qDAAmD;AAA1C,kHAAA,eAAe,OAAA;AACxB,iCAQgB;AANd,uGAAA,cAAc,OAAA;AACd,4GAAA,mBAAmB,OAAA;AACnB,2GAAA,kBAAkB,OAAA;AAClB,4GAAA,mBAAmB,OAAA;AACnB,uGAAA,cAAc,OAAA"}
@@ -1,66 +0,0 @@
1
- export declare type Fetch = typeof fetch;
2
- /**
3
- * Response format
4
- */
5
- export interface FunctionsResponseSuccess<T> {
6
- data: T;
7
- error: null;
8
- response?: Response;
9
- }
10
- export interface FunctionsResponseFailure {
11
- data: null;
12
- error: any;
13
- response?: Response;
14
- }
15
- export declare type FunctionsResponse<T> = FunctionsResponseSuccess<T> | FunctionsResponseFailure;
16
- export declare class FunctionsError extends Error {
17
- context: any;
18
- constructor(message: string, name?: string, context?: any);
19
- }
20
- export declare class FunctionsFetchError extends FunctionsError {
21
- constructor(context: any);
22
- }
23
- export declare class FunctionsRelayError extends FunctionsError {
24
- constructor(context: any);
25
- }
26
- export declare class FunctionsHttpError extends FunctionsError {
27
- constructor(context: any);
28
- }
29
- export declare enum FunctionRegion {
30
- Any = "any",
31
- ApNortheast1 = "ap-northeast-1",
32
- ApNortheast2 = "ap-northeast-2",
33
- ApSouth1 = "ap-south-1",
34
- ApSoutheast1 = "ap-southeast-1",
35
- ApSoutheast2 = "ap-southeast-2",
36
- CaCentral1 = "ca-central-1",
37
- EuCentral1 = "eu-central-1",
38
- EuWest1 = "eu-west-1",
39
- EuWest2 = "eu-west-2",
40
- EuWest3 = "eu-west-3",
41
- SaEast1 = "sa-east-1",
42
- UsEast1 = "us-east-1",
43
- UsWest1 = "us-west-1",
44
- UsWest2 = "us-west-2"
45
- }
46
- export declare type FunctionInvokeOptions = {
47
- /**
48
- * Object representing the headers to send with the request.
49
- */
50
- headers?: {
51
- [key: string]: string;
52
- };
53
- /**
54
- * The HTTP verb of the request
55
- */
56
- method?: 'POST' | 'GET' | 'PUT' | 'PATCH' | 'DELETE';
57
- /**
58
- * The Region to invoke the function in.
59
- */
60
- region?: FunctionRegion;
61
- /**
62
- * The body of the request.
63
- */
64
- body?: File | Blob | ArrayBuffer | FormData | ReadableStream<Uint8Array> | Record<string, any> | string;
65
- };
66
- //# sourceMappingURL=types.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../src/types.ts"],"names":[],"mappings":"AAAA,oBAAY,KAAK,GAAG,OAAO,KAAK,CAAA;AAEhC;;GAEG;AACH,MAAM,WAAW,wBAAwB,CAAC,CAAC;IACzC,IAAI,EAAE,CAAC,CAAA;IACP,KAAK,EAAE,IAAI,CAAA;IACX,QAAQ,CAAC,EAAE,QAAQ,CAAA;CACpB;AACD,MAAM,WAAW,wBAAwB;IACvC,IAAI,EAAE,IAAI,CAAA;IACV,KAAK,EAAE,GAAG,CAAA;IACV,QAAQ,CAAC,EAAE,QAAQ,CAAA;CACpB;AACD,oBAAY,iBAAiB,CAAC,CAAC,IAAI,wBAAwB,CAAC,CAAC,CAAC,GAAG,wBAAwB,CAAA;AAEzF,qBAAa,cAAe,SAAQ,KAAK;IACvC,OAAO,EAAE,GAAG,CAAA;gBACA,OAAO,EAAE,MAAM,EAAE,IAAI,SAAmB,EAAE,OAAO,CAAC,EAAE,GAAG;CAKpE;AAED,qBAAa,mBAAoB,SAAQ,cAAc;gBACzC,OAAO,EAAE,GAAG;CAGzB;AAED,qBAAa,mBAAoB,SAAQ,cAAc;gBACzC,OAAO,EAAE,GAAG;CAGzB;AAED,qBAAa,kBAAmB,SAAQ,cAAc;gBACxC,OAAO,EAAE,GAAG;CAGzB;AAED,oBAAY,cAAc;IACxB,GAAG,QAAQ;IACX,YAAY,mBAAmB;IAC/B,YAAY,mBAAmB;IAC/B,QAAQ,eAAe;IACvB,YAAY,mBAAmB;IAC/B,YAAY,mBAAmB;IAC/B,UAAU,iBAAiB;IAC3B,UAAU,iBAAiB;IAC3B,OAAO,cAAc;IACrB,OAAO,cAAc;IACrB,OAAO,cAAc;IACrB,OAAO,cAAc;IACrB,OAAO,cAAc;IACrB,OAAO,cAAc;IACrB,OAAO,cAAc;CACtB;AAED,oBAAY,qBAAqB,GAAG;IAClC;;OAEG;IACH,OAAO,CAAC,EAAE;QAAE,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,CAAA;KAAE,CAAA;IACnC;;OAEG;IACH,MAAM,CAAC,EAAE,MAAM,GAAG,KAAK,GAAG,KAAK,GAAG,OAAO,GAAG,QAAQ,CAAA;IACpD;;OAEG;IACH,MAAM,CAAC,EAAE,cAAc,CAAA;IACvB;;OAEG;IACH,IAAI,CAAC,EACD,IAAI,GACJ,IAAI,GACJ,WAAW,GACX,QAAQ,GACR,cAAc,CAAC,UAAU,CAAC,GAC1B,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,GACnB,MAAM,CAAA;CACX,CAAA"}
@@ -1,49 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.FunctionRegion = exports.FunctionsHttpError = exports.FunctionsRelayError = exports.FunctionsFetchError = exports.FunctionsError = void 0;
4
- class FunctionsError extends Error {
5
- constructor(message, name = 'FunctionsError', context) {
6
- super(message);
7
- this.name = name;
8
- this.context = context;
9
- }
10
- }
11
- exports.FunctionsError = FunctionsError;
12
- class FunctionsFetchError extends FunctionsError {
13
- constructor(context) {
14
- super('Failed to send a request to the Edge Function', 'FunctionsFetchError', context);
15
- }
16
- }
17
- exports.FunctionsFetchError = FunctionsFetchError;
18
- class FunctionsRelayError extends FunctionsError {
19
- constructor(context) {
20
- super('Relay Error invoking the Edge Function', 'FunctionsRelayError', context);
21
- }
22
- }
23
- exports.FunctionsRelayError = FunctionsRelayError;
24
- class FunctionsHttpError extends FunctionsError {
25
- constructor(context) {
26
- super('Edge Function returned a non-2xx status code', 'FunctionsHttpError', context);
27
- }
28
- }
29
- exports.FunctionsHttpError = FunctionsHttpError;
30
- // Define the enum for the 'region' property
31
- var FunctionRegion;
32
- (function (FunctionRegion) {
33
- FunctionRegion["Any"] = "any";
34
- FunctionRegion["ApNortheast1"] = "ap-northeast-1";
35
- FunctionRegion["ApNortheast2"] = "ap-northeast-2";
36
- FunctionRegion["ApSouth1"] = "ap-south-1";
37
- FunctionRegion["ApSoutheast1"] = "ap-southeast-1";
38
- FunctionRegion["ApSoutheast2"] = "ap-southeast-2";
39
- FunctionRegion["CaCentral1"] = "ca-central-1";
40
- FunctionRegion["EuCentral1"] = "eu-central-1";
41
- FunctionRegion["EuWest1"] = "eu-west-1";
42
- FunctionRegion["EuWest2"] = "eu-west-2";
43
- FunctionRegion["EuWest3"] = "eu-west-3";
44
- FunctionRegion["SaEast1"] = "sa-east-1";
45
- FunctionRegion["UsEast1"] = "us-east-1";
46
- FunctionRegion["UsWest1"] = "us-west-1";
47
- FunctionRegion["UsWest2"] = "us-west-2";
48
- })(FunctionRegion = exports.FunctionRegion || (exports.FunctionRegion = {}));
49
- //# sourceMappingURL=types.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"types.js","sourceRoot":"","sources":["../../src/types.ts"],"names":[],"mappings":";;;AAiBA,MAAa,cAAe,SAAQ,KAAK;IAEvC,YAAY,OAAe,EAAE,IAAI,GAAG,gBAAgB,EAAE,OAAa;QACjE,KAAK,CAAC,OAAO,CAAC,CAAA;QACd,IAAI,CAAC,IAAI,GAAG,IAAI,CAAA;QAChB,IAAI,CAAC,OAAO,GAAG,OAAO,CAAA;IACxB,CAAC;CACF;AAPD,wCAOC;AAED,MAAa,mBAAoB,SAAQ,cAAc;IACrD,YAAY,OAAY;QACtB,KAAK,CAAC,+CAA+C,EAAE,qBAAqB,EAAE,OAAO,CAAC,CAAA;IACxF,CAAC;CACF;AAJD,kDAIC;AAED,MAAa,mBAAoB,SAAQ,cAAc;IACrD,YAAY,OAAY;QACtB,KAAK,CAAC,wCAAwC,EAAE,qBAAqB,EAAE,OAAO,CAAC,CAAA;IACjF,CAAC;CACF;AAJD,kDAIC;AAED,MAAa,kBAAmB,SAAQ,cAAc;IACpD,YAAY,OAAY;QACtB,KAAK,CAAC,8CAA8C,EAAE,oBAAoB,EAAE,OAAO,CAAC,CAAA;IACtF,CAAC;CACF;AAJD,gDAIC;AACD,4CAA4C;AAC5C,IAAY,cAgBX;AAhBD,WAAY,cAAc;IACxB,6BAAW,CAAA;IACX,iDAA+B,CAAA;IAC/B,iDAA+B,CAAA;IAC/B,yCAAuB,CAAA;IACvB,iDAA+B,CAAA;IAC/B,iDAA+B,CAAA;IAC/B,6CAA2B,CAAA;IAC3B,6CAA2B,CAAA;IAC3B,uCAAqB,CAAA;IACrB,uCAAqB,CAAA;IACrB,uCAAqB,CAAA;IACrB,uCAAqB,CAAA;IACrB,uCAAqB,CAAA;IACrB,uCAAqB,CAAA;IACrB,uCAAqB,CAAA;AACvB,CAAC,EAhBW,cAAc,GAAd,sBAAc,KAAd,sBAAc,QAgBzB"}
@@ -1,2 +0,0 @@
1
- export declare const version = "2.4.6";
2
- //# sourceMappingURL=version.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"version.d.ts","sourceRoot":"","sources":["../../src/version.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,OAAO,oBAAoB,CAAA"}
@@ -1,5 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.version = void 0;
4
- exports.version = '2.4.6';
5
- //# sourceMappingURL=version.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"version.js","sourceRoot":"","sources":["../../src/version.ts"],"names":[],"mappings":";;;AAAa,QAAA,OAAO,GAAG,iBAAiB,CAAA"}
@@ -1,24 +0,0 @@
1
- import { Fetch, FunctionsResponse, FunctionInvokeOptions, FunctionRegion } from './types';
2
- export declare class FunctionsClient {
3
- protected url: string;
4
- protected headers: Record<string, string>;
5
- protected region: FunctionRegion;
6
- protected fetch: Fetch;
7
- constructor(url: string, { headers, customFetch, region, }?: {
8
- headers?: Record<string, string>;
9
- customFetch?: Fetch;
10
- region?: FunctionRegion;
11
- });
12
- /**
13
- * Updates the authorization header
14
- * @param token - the new jwt token sent in the authorisation header
15
- */
16
- setAuth(token: string): void;
17
- /**
18
- * Invokes a function
19
- * @param functionName - The name of the Function to invoke.
20
- * @param options - Options for invoking the Function.
21
- */
22
- invoke<T = any>(functionName: string, options?: FunctionInvokeOptions): Promise<FunctionsResponse<T>>;
23
- }
24
- //# sourceMappingURL=FunctionsClient.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"FunctionsClient.d.ts","sourceRoot":"","sources":["../../src/FunctionsClient.ts"],"names":[],"mappings":"AACA,OAAO,EACL,KAAK,EAIL,iBAAiB,EACjB,qBAAqB,EACrB,cAAc,EACf,MAAM,SAAS,CAAA;AAEhB,qBAAa,eAAe;IAC1B,SAAS,CAAC,GAAG,EAAE,MAAM,CAAA;IACrB,SAAS,CAAC,OAAO,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAA;IACzC,SAAS,CAAC,MAAM,EAAE,cAAc,CAAA;IAChC,SAAS,CAAC,KAAK,EAAE,KAAK,CAAA;gBAGpB,GAAG,EAAE,MAAM,EACX,EACE,OAAY,EACZ,WAAW,EACX,MAA2B,GAC5B,GAAE;QACD,OAAO,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAA;QAChC,WAAW,CAAC,EAAE,KAAK,CAAA;QACnB,MAAM,CAAC,EAAE,cAAc,CAAA;KACnB;IAQR;;;OAGG;IACH,OAAO,CAAC,KAAK,EAAE,MAAM;IAIrB;;;;OAIG;IACG,MAAM,CAAC,CAAC,GAAG,GAAG,EAClB,YAAY,EAAE,MAAM,EACpB,OAAO,GAAE,qBAA0B,GAClC,OAAO,CAAC,iBAAiB,CAAC,CAAC,CAAC,CAAC;CA0FjC"}
@@ -1,123 +0,0 @@
1
- var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
2
- function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
3
- return new (P || (P = Promise))(function (resolve, reject) {
4
- function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
5
- function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
6
- function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
7
- step((generator = generator.apply(thisArg, _arguments || [])).next());
8
- });
9
- };
10
- import { resolveFetch } from './helper';
11
- import { FunctionsFetchError, FunctionsHttpError, FunctionsRelayError, FunctionRegion, } from './types';
12
- export class FunctionsClient {
13
- constructor(url, { headers = {}, customFetch, region = FunctionRegion.Any, } = {}) {
14
- this.url = url;
15
- this.headers = headers;
16
- this.region = region;
17
- this.fetch = resolveFetch(customFetch);
18
- }
19
- /**
20
- * Updates the authorization header
21
- * @param token - the new jwt token sent in the authorisation header
22
- */
23
- setAuth(token) {
24
- this.headers.Authorization = `Bearer ${token}`;
25
- }
26
- /**
27
- * Invokes a function
28
- * @param functionName - The name of the Function to invoke.
29
- * @param options - Options for invoking the Function.
30
- */
31
- invoke(functionName, options = {}) {
32
- var _a;
33
- return __awaiter(this, void 0, void 0, function* () {
34
- try {
35
- const { headers, method, body: functionArgs } = options;
36
- let _headers = {};
37
- let { region } = options;
38
- if (!region) {
39
- region = this.region;
40
- }
41
- // Add region as query parameter using URL API
42
- const url = new URL(`${this.url}/${functionName}`);
43
- if (region && region !== 'any') {
44
- _headers['x-region'] = region;
45
- url.searchParams.set('forceFunctionRegion', region);
46
- }
47
- let body;
48
- if (functionArgs &&
49
- ((headers && !Object.prototype.hasOwnProperty.call(headers, 'Content-Type')) || !headers)) {
50
- if ((typeof Blob !== 'undefined' && functionArgs instanceof Blob) ||
51
- functionArgs instanceof ArrayBuffer) {
52
- // will work for File as File inherits Blob
53
- // also works for ArrayBuffer as it is the same underlying structure as a Blob
54
- _headers['Content-Type'] = 'application/octet-stream';
55
- body = functionArgs;
56
- }
57
- else if (typeof functionArgs === 'string') {
58
- // plain string
59
- _headers['Content-Type'] = 'text/plain';
60
- body = functionArgs;
61
- }
62
- else if (typeof FormData !== 'undefined' && functionArgs instanceof FormData) {
63
- // don't set content-type headers
64
- // Request will automatically add the right boundary value
65
- body = functionArgs;
66
- }
67
- else {
68
- // default, assume this is JSON
69
- _headers['Content-Type'] = 'application/json';
70
- body = JSON.stringify(functionArgs);
71
- }
72
- }
73
- const response = yield this.fetch(url.toString(), {
74
- method: method || 'POST',
75
- // headers priority is (high to low):
76
- // 1. invoke-level headers
77
- // 2. client-level headers
78
- // 3. default Content-Type header
79
- headers: Object.assign(Object.assign(Object.assign({}, _headers), this.headers), headers),
80
- body,
81
- }).catch((fetchError) => {
82
- throw new FunctionsFetchError(fetchError);
83
- });
84
- const isRelayError = response.headers.get('x-relay-error');
85
- if (isRelayError && isRelayError === 'true') {
86
- throw new FunctionsRelayError(response);
87
- }
88
- if (!response.ok) {
89
- throw new FunctionsHttpError(response);
90
- }
91
- let responseType = ((_a = response.headers.get('Content-Type')) !== null && _a !== void 0 ? _a : 'text/plain').split(';')[0].trim();
92
- let data;
93
- if (responseType === 'application/json') {
94
- data = yield response.json();
95
- }
96
- else if (responseType === 'application/octet-stream') {
97
- data = yield response.blob();
98
- }
99
- else if (responseType === 'text/event-stream') {
100
- data = response;
101
- }
102
- else if (responseType === 'multipart/form-data') {
103
- data = yield response.formData();
104
- }
105
- else {
106
- // default to text
107
- data = yield response.text();
108
- }
109
- return { data, error: null, response };
110
- }
111
- catch (error) {
112
- return {
113
- data: null,
114
- error,
115
- response: error instanceof FunctionsHttpError || error instanceof FunctionsRelayError
116
- ? error.context
117
- : undefined,
118
- };
119
- }
120
- });
121
- }
122
- }
123
- //# sourceMappingURL=FunctionsClient.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"FunctionsClient.js","sourceRoot":"","sources":["../../src/FunctionsClient.ts"],"names":[],"mappings":";;;;;;;;;AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,UAAU,CAAA;AACvC,OAAO,EAEL,mBAAmB,EACnB,kBAAkB,EAClB,mBAAmB,EAGnB,cAAc,GACf,MAAM,SAAS,CAAA;AAEhB,MAAM,OAAO,eAAe;IAM1B,YACE,GAAW,EACX,EACE,OAAO,GAAG,EAAE,EACZ,WAAW,EACX,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AE,EAAE;oBAChB,MAAM,IAAI,kBAAkB,CAAC,QAAQ,CAAC,CAAA;iBACvC;gBAED,IAAI,YAAY,GAAG,CAAC,MAAA,QAAQ,CAAC,OAAO,CAAC,GAAG,CAAC,cAAc,CAAC,mCAAI,YAAY,CAAC,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,CAAC,IAAI,EAAE,CAAA;gBAC9F,IAAI,IAAS,CAAA;gBACb,IAAI,YAAY,KAAK,kBAAkB,EAAE;oBACvC,IAAI,GAAG,MAAM,QAAQ,CAAC,IAAI,EAAE,CAAA;iBAC7B;qBAAM,IAAI,YAAY,KAAK,0BAA0B,EAAE;oBACtD,IAAI,GAAG,MAAM,QAAQ,CAAC,IAAI,EAAE,CAAA;iBAC7B;qBAAM,IAAI,YAAY,KAAK,mBAAmB,EAAE;oBAC/C,IAAI,GAAG,QAAQ,CAAA;iBAChB;qBAAM,IAAI,YAAY,KAAK,qBAAqB,EAAE;oBACjD,IAAI,GAAG,MAAM,QAAQ,CAAC,QAAQ,EAAE,CAAA;iBACjC;qBAAM;oBACL,kBAAkB;oBAClB,IAAI,GAAG,MAAM,QAAQ,CAAC,IAAI,EAAE,CAAA;iBAC7B;gBAED,OAAO,EAAE,IAAI,EAAE,KAAK,EAAE,IAAI,EAAE,QAAQ,EAAE,CAAA;aACvC;YAAC,OAAO,KAAK,EAAE;gBACd,OAAO;oBACL,IAAI,EAAE,IAAI;oBACV,KAAK;oBACL,QAAQ,EACN,KAAK,YAAY,kBAAkB,IAAI,KAAK,YAAY,mBAAmB;wBACzE,CAAC,CAAC,KAAK,CAAC,OAAO;wBACf,CAAC,CAAC,SAAS;iBAChB,CAAA;aACF;;KACF;CACF"}
@@ -1,3 +0,0 @@
1
- import { Fetch } from './types';
2
- export declare const resolveFetch: (customFetch?: Fetch) => Fetch;
3
- //# sourceMappingURL=helper.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"helper.d.ts","sourceRoot":"","sources":["../../src/helper.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAE,MAAM,SAAS,CAAA;AAE/B,eAAO,MAAM,YAAY,iBAAkB,KAAK,KAAG,KAWlD,CAAA"}
@@ -1,14 +0,0 @@
1
- export const resolveFetch = (customFetch) => {
2
- let _fetch;
3
- if (customFetch) {
4
- _fetch = customFetch;
5
- }
6
- else if (typeof fetch === 'undefined') {
7
- _fetch = (...args) => import('@supabase/node-fetch').then(({ default: fetch }) => fetch(...args));
8
- }
9
- else {
10
- _fetch = fetch;
11
- }
12
- return (...args) => _fetch(...args);
13
- };
14
- //# sourceMappingURL=helper.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"helper.js","sourceRoot":"","sources":["../../src/helper.ts"],"names":[],"mappings":"AAEA,MAAM,CAAC,MAAM,YAAY,GAAG,CAAC,WAAmB,EAAS,EAAE;IACzD,IAAI,MAAa,CAAA;IACjB,IAAI,WAAW,EAAE;QACf,MAAM,GAAG,WAAW,CAAA;KACrB;SAAM,IAAI,OAAO,KAAK,KAAK,WAAW,EAAE;QACvC,MAAM,GAAG,CAAC,GAAG,IAAI,EAAE,EAAE,CACnB,MAAM,CAAC,sBAA6B,CAAC,CAAC,IAAI,CAAC,CAAC,EAAE,OAAO,EAAE,KAAK,EAAE,EAAE,EAAE,CAAC,KAAK,CAAC,GAAG,IAAI,CAAC,CAAC,CAAA;KACrF;SAAM;QACL,MAAM,GAAG,KAAK,CAAA;KACf;IACD,OAAO,CAAC,GAAG,IAAI,EAAE,EAAE,CAAC,MAAM,CAAC,GAAG,IAAI,CAAC,CAAA;AACrC,CAAC,CAAA"}
@@ -1,3 +0,0 @@
1
- export { FunctionsClient } from './FunctionsClient';
2
- export { type FunctionInvokeOptions, FunctionsError, FunctionsFetchError, FunctionsHttpError, FunctionsRelayError, FunctionRegion, type FunctionsResponse, } from './types';
3
- //# sourceMappingURL=index.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAE,MAAM,mBAAmB,CAAA;AACnD,OAAO,EACL,KAAK,qBAAqB,EAC1B,cAAc,EACd,mBAAmB,EACnB,kBAAkB,EAClB,mBAAmB,EACnB,cAAc,EACd,KAAK,iBAAiB,GACvB,MAAM,SAAS,CAAA"}
@@ -1,3 +0,0 @@
1
- export { FunctionsClient } from './FunctionsClient';
2
- export { FunctionsError, FunctionsFetchError, FunctionsHttpError, FunctionsRelayError, FunctionRegion, } from './types';
3
- //# sourceMappingURL=index.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAE,MAAM,mBAAmB,CAAA;AACnD,OAAO,EAEL,cAAc,EACd,mBAAmB,EACnB,kBAAkB,EAClB,mBAAmB,EACnB,cAAc,GAEf,MAAM,SAAS,CAAA"}
@@ -1,66 +0,0 @@
1
- export declare type Fetch = typeof fetch;
2
- /**
3
- * Response format
4
- */
5
- export interface FunctionsResponseSuccess<T> {
6
- data: T;
7
- error: null;
8
- response?: Response;
9
- }
10
- export interface FunctionsResponseFailure {
11
- data: null;
12
- error: any;
13
- response?: Response;
14
- }
15
- export declare type FunctionsResponse<T> = FunctionsResponseSuccess<T> | FunctionsResponseFailure;
16
- export declare class FunctionsError extends Error {
17
- context: any;
18
- constructor(message: string, name?: string, context?: any);
19
- }
20
- export declare class FunctionsFetchError extends FunctionsError {
21
- constructor(context: any);
22
- }
23
- export declare class FunctionsRelayError extends FunctionsError {
24
- constructor(context: any);
25
- }
26
- export declare class FunctionsHttpError extends FunctionsError {
27
- constructor(context: any);
28
- }
29
- export declare enum FunctionRegion {
30
- Any = "any",
31
- ApNortheast1 = "ap-northeast-1",
32
- ApNortheast2 = "ap-northeast-2",
33
- ApSouth1 = "ap-south-1",
34
- ApSoutheast1 = "ap-southeast-1",
35
- ApSoutheast2 = "ap-southeast-2",
36
- CaCentral1 = "ca-central-1",
37
- EuCentral1 = "eu-central-1",
38
- EuWest1 = "eu-west-1",
39
- EuWest2 = "eu-west-2",
40
- EuWest3 = "eu-west-3",
41
- SaEast1 = "sa-east-1",
42
- UsEast1 = "us-east-1",
43
- UsWest1 = "us-west-1",
44
- UsWest2 = "us-west-2"
45
- }
46
- export declare type FunctionInvokeOptions = {
47
- /**
48
- * Object representing the headers to send with the request.
49
- */
50
- headers?: {
51
- [key: string]: string;
52
- };
53
- /**
54
- * The HTTP verb of the request
55
- */
56
- method?: 'POST' | 'GET' | 'PUT' | 'PATCH' | 'DELETE';
57
- /**
58
- * The Region to invoke the function in.
59
- */
60
- region?: FunctionRegion;
61
- /**
62
- * The body of the request.
63
- */
64
- body?: File | Blob | ArrayBuffer | FormData | ReadableStream<Uint8Array> | Record<string, any> | string;
65
- };
66
- //# sourceMappingURL=types.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../src/types.ts"],"names":[],"mappings":"AAAA,oBAAY,KAAK,GAAG,OAAO,KAAK,CAAA;AAEhC;;GAEG;AACH,MAAM,WAAW,wBAAwB,CAAC,CAAC;IACzC,IAAI,EAAE,CAAC,CAAA;IACP,KAAK,EAAE,IAAI,CAAA;IACX,QAAQ,CAAC,EAAE,QAAQ,CAAA;CACpB;AACD,MAAM,WAAW,wBAAwB;IACvC,IAAI,EAAE,IAAI,CAAA;IACV,KAAK,EAAE,GAAG,CAAA;IACV,QAAQ,CAAC,EAAE,QAAQ,CAAA;CACpB;AACD,oBAAY,iBAAiB,CAAC,CAAC,IAAI,wBAAwB,CAAC,CAAC,CAAC,GAAG,wBAAwB,CAAA;AAEzF,qBAAa,cAAe,SAAQ,KAAK;IACvC,OAAO,EAAE,GAAG,CAAA;gBACA,OAAO,EAAE,MAAM,EAAE,IAAI,SAAmB,EAAE,OAAO,CAAC,EAAE,GAAG;CAKpE;AAED,qBAAa,mBAAoB,SAAQ,cAAc;gBACzC,OAAO,EAAE,GAAG;CAGzB;AAED,qBAAa,mBAAoB,SAAQ,cAAc;gBACzC,OAAO,EAAE,GAAG;CAGzB;AAED,qBAAa,kBAAmB,SAAQ,cAAc;gBACxC,OAAO,EAAE,GAAG;CAGzB;AAED,oBAAY,cAAc;IACxB,GAAG,QAAQ;IACX,YAAY,mBAAmB;IAC/B,YAAY,mBAAmB;IAC/B,QAAQ,eAAe;IACvB,YAAY,mBAAmB;IAC/B,YAAY,mBAAmB;IAC/B,UAAU,iBAAiB;IAC3B,UAAU,iBAAiB;IAC3B,OAAO,cAAc;IACrB,OAAO,cAAc;IACrB,OAAO,cAAc;IACrB,OAAO,cAAc;IACrB,OAAO,cAAc;IACrB,OAAO,cAAc;IACrB,OAAO,cAAc;CACtB;AAED,oBAAY,qBAAqB,GAAG;IAClC;;OAEG;IACH,OAAO,CAAC,EAAE;QAAE,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,CAAA;KAAE,CAAA;IACnC;;OAEG;IACH,MAAM,CAAC,EAAE,MAAM,GAAG,KAAK,GAAG,KAAK,GAAG,OAAO,GAAG,QAAQ,CAAA;IACpD;;OAEG;IACH,MAAM,CAAC,EAAE,cAAc,CAAA;IACvB;;OAEG;IACH,IAAI,CAAC,EACD,IAAI,GACJ,IAAI,GACJ,WAAW,GACX,QAAQ,GACR,cAAc,CAAC,UAAU,CAAC,GAC1B,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,GACnB,MAAM,CAAA;CACX,CAAA"}
@@ -1,42 +0,0 @@
1
- export class FunctionsError extends Error {
2
- constructor(message, name = 'FunctionsError', context) {
3
- super(message);
4
- this.name = name;
5
- this.context = context;
6
- }
7
- }
8
- export class FunctionsFetchError extends FunctionsError {
9
- constructor(context) {
10
- super('Failed to send a request to the Edge Function', 'FunctionsFetchError', context);
11
- }
12
- }
13
- export class FunctionsRelayError extends FunctionsError {
14
- constructor(context) {
15
- super('Relay Error invoking the Edge Function', 'FunctionsRelayError', context);
16
- }
17
- }
18
- export class FunctionsHttpError extends FunctionsError {
19
- constructor(context) {
20
- super('Edge Function returned a non-2xx status code', 'FunctionsHttpError', context);
21
- }
22
- }
23
- // Define the enum for the 'region' property
24
- export var FunctionRegion;
25
- (function (FunctionRegion) {
26
- FunctionRegion["Any"] = "any";
27
- FunctionRegion["ApNortheast1"] = "ap-northeast-1";
28
- FunctionRegion["ApNortheast2"] = "ap-northeast-2";
29
- FunctionRegion["ApSouth1"] = "ap-south-1";
30
- FunctionRegion["ApSoutheast1"] = "ap-southeast-1";
31
- FunctionRegion["ApSoutheast2"] = "ap-southeast-2";
32
- FunctionRegion["CaCentral1"] = "ca-central-1";
33
- FunctionRegion["EuCentral1"] = "eu-central-1";
34
- FunctionRegion["EuWest1"] = "eu-west-1";
35
- FunctionRegion["EuWest2"] = "eu-west-2";
36
- FunctionRegion["EuWest3"] = "eu-west-3";
37
- FunctionRegion["SaEast1"] = "sa-east-1";
38
- FunctionRegion["UsEast1"] = "us-east-1";
39
- FunctionRegion["UsWest1"] = "us-west-1";
40
- FunctionRegion["UsWest2"] = "us-west-2";
41
- })(FunctionRegion || (FunctionRegion = {}));
42
- //# sourceMappingURL=types.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"types.js","sourceRoot":"","sources":["../../src/types.ts"],"names":[],"mappings":"AAiBA,MAAM,OAAO,cAAe,SAAQ,KAAK;IAEvC,YAAY,OAAe,EAAE,IAAI,GAAG,gBAAgB,EAAE,OAAa;QACjE,KAAK,CAAC,OAAO,CAAC,CAAA;QACd,IAAI,CAAC,IAAI,GAAG,IAAI,CAAA;QAChB,IAAI,CAAC,OAAO,GAAG,OAAO,CAAA;IACxB,CAAC;CACF;AAED,MAAM,OAAO,mBAAoB,SAAQ,cAAc;IACrD,YAAY,OAAY;QACtB,KAAK,CAAC,+CAA+C,EAAE,qBAAqB,EAAE,OAAO,CAAC,CAAA;IACxF,CAAC;CACF;AAED,MAAM,OAAO,mBAAoB,SAAQ,cAAc;IACrD,YAAY,OAAY;QACtB,KAAK,CAAC,wCAAwC,EAAE,qBAAqB,EAAE,OAAO,CAAC,CAAA;IACjF,CAAC;CACF;AAED,MAAM,OAAO,kBAAmB,SAAQ,cAAc;IACpD,YAAY,OAAY;QACtB,KAAK,CAAC,8CAA8C,EAAE,oBAAoB,EAAE,OAAO,CAAC,CAAA;IACtF,CAAC;CACF;AACD,4CAA4C;AAC5C,MAAM,CAAN,IAAY,cAgBX;AAhBD,WAAY,cAAc;IACxB,6BAAW,CAAA;IACX,iDAA+B,CAAA;IAC/B,iDAA+B,CAAA;IAC/B,yCAAuB,CAAA;IACvB,iDAA+B,CAAA;IAC/B,iDAA+B,CAAA;IAC/B,6CAA2B,CAAA;IAC3B,6CAA2B,CAAA;IAC3B,uCAAqB,CAAA;IACrB,uCAAqB,CAAA;IACrB,uCAAqB,CAAA;IACrB,uCAAqB,CAAA;IACrB,uCAAqB,CAAA;IACrB,uCAAqB,CAAA;IACrB,uCAAqB,CAAA;AACvB,CAAC,EAhBW,cAAc,KAAd,cAAc,QAgBzB"}
@@ -1,2 +0,0 @@
1
- export declare const version = "2.4.6";
2
- //# sourceMappingURL=version.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"version.d.ts","sourceRoot":"","sources":["../../src/version.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,OAAO,oBAAoB,CAAA"}
@@ -1,2 +0,0 @@
1
- export const version = '2.4.6';
2
- //# sourceMappingURL=version.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"version.js","sourceRoot":"","sources":["../../src/version.ts"],"names":[],"mappings":"AAAA,MAAM,CAAC,MAAM,OAAO,GAAG,iBAAiB,CAAA"}