@supabase/functions-js 2.5.0 → 2.71.2-canary.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.
Files changed (47) hide show
  1. package/README.md +0 -3
  2. package/package.json +11 -21
  3. package/src/FunctionsClient.ts +3 -10
  4. package/src/edge-runtime.d.ts +53 -189
  5. package/src/types.ts +0 -4
  6. package/src/version.ts +1 -1
  7. package/LICENSE +0 -21
  8. package/dist/main/FunctionsClient.d.ts +0 -24
  9. package/dist/main/FunctionsClient.d.ts.map +0 -1
  10. package/dist/main/FunctionsClient.js +0 -134
  11. package/dist/main/FunctionsClient.js.map +0 -1
  12. package/dist/main/helper.d.ts +0 -3
  13. package/dist/main/helper.d.ts.map +0 -1
  14. package/dist/main/helper.js +0 -41
  15. package/dist/main/helper.js.map +0 -1
  16. package/dist/main/index.d.ts +0 -3
  17. package/dist/main/index.d.ts.map +0 -1
  18. package/dist/main/index.js +0 -12
  19. package/dist/main/index.js.map +0 -1
  20. package/dist/main/types.d.ts +0 -70
  21. package/dist/main/types.d.ts.map +0 -1
  22. package/dist/main/types.js +0 -49
  23. package/dist/main/types.js.map +0 -1
  24. package/dist/main/version.d.ts +0 -2
  25. package/dist/main/version.d.ts.map +0 -1
  26. package/dist/main/version.js +0 -5
  27. package/dist/main/version.js.map +0 -1
  28. package/dist/module/FunctionsClient.d.ts +0 -24
  29. package/dist/module/FunctionsClient.d.ts.map +0 -1
  30. package/dist/module/FunctionsClient.js +0 -130
  31. package/dist/module/FunctionsClient.js.map +0 -1
  32. package/dist/module/helper.d.ts +0 -3
  33. package/dist/module/helper.d.ts.map +0 -1
  34. package/dist/module/helper.js +0 -14
  35. package/dist/module/helper.js.map +0 -1
  36. package/dist/module/index.d.ts +0 -3
  37. package/dist/module/index.d.ts.map +0 -1
  38. package/dist/module/index.js +0 -3
  39. package/dist/module/index.js.map +0 -1
  40. package/dist/module/types.d.ts +0 -70
  41. package/dist/module/types.d.ts.map +0 -1
  42. package/dist/module/types.js +0 -42
  43. package/dist/module/types.js.map +0 -1
  44. package/dist/module/version.d.ts +0 -2
  45. package/dist/module/version.d.ts.map +0 -1
  46. package/dist/module/version.js +0 -2
  47. 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.5.0",
3
+ "version": "2.71.2-canary.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,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"
@@ -1,12 +1,12 @@
1
1
  import { resolveFetch } from './helper'
2
2
  import {
3
3
  Fetch,
4
- FunctionInvokeOptions,
5
- FunctionRegion,
6
4
  FunctionsFetchError,
7
5
  FunctionsHttpError,
8
6
  FunctionsRelayError,
9
7
  FunctionsResponse,
8
+ FunctionInvokeOptions,
9
+ FunctionRegion,
10
10
  } from './types'
11
11
 
12
12
  export class FunctionsClient {
@@ -51,7 +51,7 @@ export class FunctionsClient {
51
51
  options: FunctionInvokeOptions = {}
52
52
  ): Promise<FunctionsResponse<T>> {
53
53
  try {
54
- const { headers, method, body: functionArgs, signal } = options
54
+ const { headers, method, body: functionArgs } = options
55
55
  let _headers: Record<string, string> = {}
56
56
  let { region } = options
57
57
  if (!region) {
@@ -99,11 +99,7 @@ export class FunctionsClient {
99
99
  // 3. default Content-Type header
100
100
  headers: { ..._headers, ...this.headers, ...headers },
101
101
  body,
102
- signal,
103
102
  }).catch((fetchError) => {
104
- if (fetchError.name === 'AbortError') {
105
- throw fetchError
106
- }
107
103
  throw new FunctionsFetchError(fetchError)
108
104
  })
109
105
 
@@ -133,9 +129,6 @@ export class FunctionsClient {
133
129
 
134
130
  return { data, error: null, response }
135
131
  } catch (error) {
136
- if (error instanceof Error && error.name === 'AbortError') {
137
- return { data: null, error: new FunctionsFetchError(error) }
138
- }
139
132
  return {
140
133
  data: null,
141
134
  error,
@@ -1,198 +1,62 @@
1
- declare type BeforeunloadReason = 'cpu' | 'memory' | 'wall_clock' | 'early_drop' | 'termination'
2
-
3
- declare interface WindowEventMap {
4
- load: Event
5
- unload: Event
6
- beforeunload: CustomEvent<BeforeunloadReason>
7
- drain: Event
8
- }
9
-
10
- // TODO(Nyannyacha): These two type defs will be provided later.
11
-
12
- // deno-lint-ignore no-explicit-any
13
- type S3FsConfig = any
14
-
15
- // deno-lint-ignore no-explicit-any
16
- type TmpFsConfig = any
17
-
18
- type OtelPropagators = 'TraceContext' | 'Baggage'
19
- type OtelConsoleConfig = 'Ignore' | 'Capture' | 'Replace'
20
- type OtelConfig = {
21
- tracing_enabled?: boolean
22
- metrics_enabled?: boolean
23
- console?: OtelConsoleConfig
24
- propagators?: OtelPropagators[]
25
- }
26
-
27
- interface UserWorkerFetchOptions {
28
- signal?: AbortSignal
29
- }
30
-
31
- interface PermissionsOptions {
32
- allow_all?: boolean | null
33
- allow_env?: string[] | null
34
- deny_env?: string[] | null
35
- allow_net?: string[] | null
36
- deny_net?: string[] | null
37
- allow_ffi?: string[] | null
38
- deny_ffi?: string[] | null
39
- allow_read?: string[] | null
40
- deny_read?: string[] | null
41
- allow_run?: string[] | null
42
- deny_run?: string[] | null
43
- allow_sys?: string[] | null
44
- deny_sys?: string[] | null
45
- allow_write?: string[] | null
46
- deny_write?: string[] | null
47
- allow_import?: string[] | null
48
- }
49
-
50
- interface UserWorkerCreateContext {
51
- sourceMap?: boolean | null
52
- importMapPath?: string | null
53
- shouldBootstrapMockFnThrowError?: boolean | null
54
- suppressEszipMigrationWarning?: boolean | null
55
- useReadSyncFileAPI?: boolean | null
56
- supervisor?: {
57
- requestAbsentTimeoutMs?: number | null
58
- }
59
- otel?: {
60
- [attribute: string]: string
1
+ declare namespace Supabase {
2
+ export interface ModelOptions {
3
+ /**
4
+ * Pool embeddings by taking their mean. Applies only for `gte-small` model
5
+ */
6
+ mean_pool?: boolean
7
+
8
+ /**
9
+ * Normalize the embeddings result. Applies only for `gte-small` model
10
+ */
11
+ normalize?: boolean
12
+
13
+ /**
14
+ * Stream response from model. Applies only for LLMs like `mistral` (default: false)
15
+ */
16
+ stream?: boolean
17
+
18
+ /**
19
+ * Automatically abort the request to the model after specified time (in seconds). Applies only for LLMs like `mistral` (default: 60)
20
+ */
21
+ timeout?: number
22
+
23
+ /**
24
+ * Mode for the inference API host. (default: 'ollama')
25
+ */
26
+ mode?: 'ollama' | 'openaicompatible'
27
+ signal?: AbortSignal
61
28
  }
62
- }
63
-
64
- interface UserWorkerCreateOptions {
65
- servicePath?: string | null
66
- envVars?: string[][] | [string, string][] | null
67
- noModuleCache?: boolean | null
68
-
69
- forceCreate?: boolean | null
70
- allowRemoteModules?: boolean | null
71
- customModuleRoot?: string | null
72
- permissions?: PermissionsOptions | null
73
-
74
- maybeEszip?: Uint8Array | null
75
- maybeEntrypoint?: string | null
76
- maybeModuleCode?: string | null
77
-
78
- memoryLimitMb?: number | null
79
- lowMemoryMultiplier?: number | null
80
- workerTimeoutMs?: number | null
81
- cpuTimeSoftLimitMs?: number | null
82
- cpuTimeHardLimitMs?: number | null
83
- staticPatterns?: string[] | null
84
-
85
- s3FsConfig?: S3FsConfig | null
86
- tmpFsConfig?: TmpFsConfig | null
87
- otelConfig?: OtelConfig | null
88
-
89
- context?: UserWorkerCreateContext | null
90
- }
91
-
92
- interface HeapStatistics {
93
- totalHeapSize: number
94
- totalHeapSizeExecutable: number
95
- totalPhysicalSize: number
96
- totalAvailableSize: number
97
- totalGlobalHandlesSize: number
98
- usedGlobalHandlesSize: number
99
- usedHeapSize: number
100
- mallocedMemory: number
101
- externalMemory: number
102
- peakMallocedMemory: number
103
- }
104
-
105
- interface RuntimeMetrics {
106
- mainWorkerHeapStats: HeapStatistics
107
- eventWorkerHeapStats?: HeapStatistics
108
- }
109
29
 
110
- interface MemInfo {
111
- total: number
112
- free: number
113
- available: number
114
- buffers: number
115
- cached: number
116
- swapTotal: number
117
- swapFree: number
118
- }
119
-
120
- declare namespace EdgeRuntime {
121
- export namespace ai {
122
- function tryCleanupUnusedSession(): Promise<number>
30
+ export class Session {
31
+ /**
32
+ * Create a new model session using given model
33
+ */
34
+ constructor(model: string, sessionOptions?: unknown)
35
+
36
+ /**
37
+ * Execute the given prompt in model session
38
+ */
39
+ run(
40
+ prompt:
41
+ | string
42
+ | Omit<import('openai').OpenAI.Chat.ChatCompletionCreateParams, 'model' | 'stream'>,
43
+ modelOptions?: ModelOptions
44
+ ): unknown
123
45
  }
124
46
 
125
- class UserWorker {
126
- constructor(key: string)
127
-
128
- fetch(request: Request, options?: UserWorkerFetchOptions): Promise<Response>
129
-
130
- static create(opts: UserWorkerCreateOptions): Promise<UserWorker>
131
- static tryCleanupIdleWorkers(timeoutMs: number): Promise<number>
47
+ /**
48
+ * Provides AI related APIs
49
+ */
50
+ export interface Ai {
51
+ readonly Session: typeof Session
132
52
  }
133
53
 
134
- export function scheduleTermination(): void
135
- export function waitUntil<T>(promise: Promise<T>): Promise<T>
136
- export function getRuntimeMetrics(): Promise<RuntimeMetrics>
137
- export function applySupabaseTag(src: Request, dest: Request): void
138
- export function systemMemoryInfo(): MemInfo
139
- export function raiseSegfault(): void
140
-
141
- export { UserWorker as userWorkers }
54
+ /**
55
+ * Provides AI related APIs
56
+ */
57
+ export const ai: Ai
142
58
  }
143
59
 
144
- declare namespace Supabase {
145
- export namespace ai {
146
- interface ModelOptions {
147
- /**
148
- * Pool embeddings by taking their mean. Applies only for `gte-small` model
149
- */
150
- mean_pool?: boolean
151
-
152
- /**
153
- * Normalize the embeddings result. Applies only for `gte-small` model
154
- */
155
- normalize?: boolean
156
-
157
- /**
158
- * Stream response from model. Applies only for LLMs like `mistral` (default: false)
159
- */
160
- stream?: boolean
161
-
162
- /**
163
- * Automatically abort the request to the model after specified time (in seconds). Applies only for LLMs like `mistral` (default: 60)
164
- */
165
- timeout?: number
166
-
167
- /**
168
- * Mode for the inference API host. (default: 'ollama')
169
- */
170
- mode?: 'ollama' | 'openaicompatible'
171
- signal?: AbortSignal
172
- }
173
-
174
- export class Session {
175
- /**
176
- * Create a new model session using given model
177
- */
178
- constructor(model: string)
179
-
180
- /**
181
- * Execute the given prompt in model session
182
- */
183
- run(
184
- prompt:
185
- | string
186
- | Omit<import('openai').OpenAI.Chat.ChatCompletionCreateParams, 'model' | 'stream'>,
187
- modelOptions?: ModelOptions
188
- ): unknown
189
- }
190
- }
191
- }
192
-
193
- declare namespace Deno {
194
- export namespace errors {
195
- class WorkerRequestCancelled extends Error {}
196
- class WorkerAlreadyRetired extends Error {}
197
- }
60
+ declare namespace EdgeRuntime {
61
+ export function waitUntil<T>(promise: Promise<T>): Promise<T>
198
62
  }
package/src/types.ts CHANGED
@@ -84,8 +84,4 @@ export type FunctionInvokeOptions = {
84
84
  | ReadableStream<Uint8Array>
85
85
  | Record<string, any>
86
86
  | string
87
- /**
88
- * The AbortSignal to use for the request.
89
- * */
90
- signal?: AbortSignal
91
87
  }
package/src/version.ts CHANGED
@@ -1 +1 @@
1
- export const version = '2.5.0'
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, FunctionInvokeOptions, FunctionRegion, FunctionsResponse } 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,EACL,qBAAqB,EACrB,cAAc,EAId,iBAAiB,EAClB,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;CAiGjC"}
@@ -1,134 +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, signal } = 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
- signal,
85
- }).catch((fetchError) => {
86
- if (fetchError.name === 'AbortError') {
87
- throw fetchError;
88
- }
89
- throw new types_1.FunctionsFetchError(fetchError);
90
- });
91
- const isRelayError = response.headers.get('x-relay-error');
92
- if (isRelayError && isRelayError === 'true') {
93
- throw new types_1.FunctionsRelayError(response);
94
- }
95
- if (!response.ok) {
96
- throw new types_1.FunctionsHttpError(response);
97
- }
98
- let responseType = ((_a = response.headers.get('Content-Type')) !== null && _a !== void 0 ? _a : 'text/plain').split(';')[0].trim();
99
- let data;
100
- if (responseType === 'application/json') {
101
- data = yield response.json();
102
- }
103
- else if (responseType === 'application/octet-stream') {
104
- data = yield response.blob();
105
- }
106
- else if (responseType === 'text/event-stream') {
107
- data = response;
108
- }
109
- else if (responseType === 'multipart/form-data') {
110
- data = yield response.formData();
111
- }
112
- else {
113
- // default to text
114
- data = yield response.text();
115
- }
116
- return { data, error: null, response };
117
- }
118
- catch (error) {
119
- if (error instanceof Error && error.name === 'AbortError') {
120
- return { data: null, error: new types_1.FunctionsFetchError(error) };
121
- }
122
- return {
123
- data: null,
124
- error,
125
- response: error instanceof types_1.FunctionsHttpError || error instanceof types_1.FunctionsRelayError
126
- ? error.context
127
- : undefined,
128
- };
129
- }
130
- });
131
- }
132
- }
133
- exports.FunctionsClient = FunctionsClient;
134
- //# 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;QAC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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,70 +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
- * The AbortSignal to use for the request.
67
- * */
68
- signal?: AbortSignal;
69
- };
70
- //# 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,C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@
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.5.0";
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.5.0';
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, FunctionInvokeOptions, FunctionRegion, FunctionsResponse } 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,EACL,qBAAqB,EACrB,cAAc,EAId,iBAAiB,EAClB,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;CAiGjC"}
@@ -1,130 +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 { FunctionRegion, FunctionsFetchError, FunctionsHttpError, FunctionsRelayError, } 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, signal } = 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
- signal,
82
- }).catch((fetchError) => {
83
- if (fetchError.name === 'AbortError') {
84
- throw fetchError;
85
- }
86
- throw new FunctionsFetchError(fetchError);
87
- });
88
- const isRelayError = response.headers.get('x-relay-error');
89
- if (isRelayError && isRelayError === 'true') {
90
- throw new FunctionsRelayError(response);
91
- }
92
- if (!response.ok) {
93
- throw new FunctionsHttpError(response);
94
- }
95
- let responseType = ((_a = response.headers.get('Content-Type')) !== null && _a !== void 0 ? _a : 'text/plain').split(';')[0].trim();
96
- let data;
97
- if (responseType === 'application/json') {
98
- data = yield response.json();
99
- }
100
- else if (responseType === 'application/octet-stream') {
101
- data = yield response.blob();
102
- }
103
- else if (responseType === 'text/event-stream') {
104
- data = response;
105
- }
106
- else if (responseType === 'multipart/form-data') {
107
- data = yield response.formData();
108
- }
109
- else {
110
- // default to text
111
- data = yield response.text();
112
- }
113
- return { data, error: null, response };
114
- }
115
- catch (error) {
116
- if (error instanceof Error && error.name === 'AbortError') {
117
- return { data: null, error: new FunctionsFetchError(error) };
118
- }
119
- return {
120
- data: null,
121
- error,
122
- response: error instanceof FunctionsHttpError || error instanceof FunctionsRelayError
123
- ? error.context
124
- : undefined,
125
- };
126
- }
127
- });
128
- }
129
- }
130
- //# 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,EAGL,cAAc,EACd,mBAAmB,EACnB,kBAAkB,EAClB,mBAAmB,GAEpB,MAAM,SAAS,CAAA;AAEhB,MAAM,OAAO,eAAe;IAM1B,YACE,GAAW,EACX,EACE,OAAO,GAAG,EAAE,EACZ,WAAW,EACX,MAAM,GAAG,cAAc,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,YAAY,CAAC,WAAW,CAAC,CAAA;IACxC,CAAC;IAED;;;OAGG;IACH,OAAO,CAAC,KAAa;QACnB,IAAI,CAAC,OAAO,CAAC,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AAC,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,IAAI,KAAK,YAAY,KAAK,IAAI,KAAK,CAAC,IAAI,KAAK,YAAY,EAAE;oBACzD,OAAO,EAAE,IAAI,EAAE,IAAI,EAAE,KAAK,EAAE,IAAI,mBAAmB,CAAC,KAAK,CAAC,EAAE,CAAA;iBAC7D;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,70 +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
- * The AbortSignal to use for the request.
67
- * */
68
- signal?: AbortSignal;
69
- };
70
- //# 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;IACV;;SAEK;IACL,MAAM,CAAC,EAAE,WAAW,CAAA;CACrB,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.5.0";
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.5.0';
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"}