@@ -2,7 +2,7 @@ import * as abortSignal from 'ext:deno_web/03_abort_signal.js';
2
2
import * as base64 from 'ext:deno_web/05_base64.js' ;
3
3
import * as console from 'ext:deno_console/01_console.js' ;
4
4
import * as crypto from 'ext:deno_crypto/00_crypto.js' ;
5
- import { DOMException } from " ext:deno_web/01_dom_exception.js" ;
5
+ import { DOMException } from ' ext:deno_web/01_dom_exception.js' ;
6
6
import * as encoding from 'ext:deno_web/08_text_encoding.js' ;
7
7
import * as event from 'ext:deno_web/02_event.js' ;
8
8
import * as fetch from 'ext:deno_fetch/26_fetch.js' ;
@@ -20,6 +20,7 @@ import * as response from 'ext:deno_fetch/23_response.js';
20
20
import * as request from 'ext:deno_fetch/23_request.js' ;
21
21
import * as globalInterfaces from 'ext:deno_web/04_global_interfaces.js' ;
22
22
import { SUPABASE_ENV } from 'ext:sb_env/env.js' ;
23
+ import { SupabaseAI } from 'ext:sb_ai/ai.js' ;
23
24
import { registerErrors } from 'ext:sb_core_main_js/js/errors.js' ;
24
25
import {
25
26
formatException ,
@@ -43,12 +44,12 @@ import { SupabaseEventListener } from 'ext:sb_user_event_worker/event_worker.js'
43
44
import * as MainWorker from 'ext:sb_core_main_js/js/main_worker.js' ;
44
45
import * as DenoWebCompression from 'ext:deno_web/14_compression.js' ;
45
46
import * as DenoWSStream from 'ext:deno_websocket/02_websocketstream.js' ;
46
- import * as eventSource from " ext:deno_fetch/27_eventsource.js" ;
47
- import * as WebGPU from " ext:deno_webgpu/00_init.js" ;
48
- import * as WebGPUSurface from " ext:deno_webgpu/02_surface.js" ;
47
+ import * as eventSource from ' ext:deno_fetch/27_eventsource.js' ;
48
+ import * as WebGPU from ' ext:deno_webgpu/00_init.js' ;
49
+ import * as WebGPUSurface from ' ext:deno_webgpu/02_surface.js' ;
49
50
50
- import { primordials , core } from " ext:core/mod.js" ;
51
- import { op_lazy_load_esm } from " ext:core/ops" ;
51
+ import { core , primordials } from ' ext:core/mod.js' ;
52
+ import { op_lazy_load_esm } from ' ext:core/ops' ;
52
53
const ops = core . ops ;
53
54
54
55
const {
@@ -111,7 +112,7 @@ function ImageWritable(getter) {
111
112
}
112
113
function loadImage ( ) {
113
114
if ( ! image ) {
114
- image = op_lazy_load_esm ( " ext:deno_canvas/01_image.js" ) ;
115
+ image = op_lazy_load_esm ( ' ext:deno_canvas/01_image.js' ) ;
115
116
}
116
117
}
117
118
@@ -295,7 +296,13 @@ const deleteDenoApis = (apis) => {
295
296
} ) ;
296
297
} ;
297
298
298
- globalThis . bootstrapSBEdge = ( opts , isUserWorker , isEventsWorker , edgeRuntimeVersion , denoVersion ) => {
299
+ globalThis . bootstrapSBEdge = (
300
+ opts ,
301
+ isUserWorker ,
302
+ isEventsWorker ,
303
+ edgeRuntimeVersion ,
304
+ denoVersion ,
305
+ ) => {
299
306
// We should delete this after initialization,
300
307
// Deleting it during bootstrapping can backfire
301
308
delete globalThis . __bootstrap ;
@@ -318,7 +325,7 @@ globalThis.bootstrapSBEdge = (opts, isUserWorker, isEventsWorker, edgeRuntimeVer
318
325
} ) ;
319
326
320
327
ObjectDefineProperty ( globalThis , 'SUPABASE_VERSION' , readOnly ( String ( edgeRuntimeVersion ) ) ) ;
321
- ObjectDefineProperty ( globalThis , 'DENO_VERSION' , readOnly ( denoVersion ) )
328
+ ObjectDefineProperty ( globalThis , 'DENO_VERSION' , readOnly ( denoVersion ) ) ;
322
329
323
330
// set these overrides after runtimeStart
324
331
ObjectDefineProperties ( denoOverrides , {
@@ -328,17 +335,29 @@ globalThis.bootstrapSBEdge = (opts, isUserWorker, isEventsWorker, edgeRuntimeVer
328
335
args : readOnly ( [ ] ) , // args are set to be empty
329
336
mainModule : getterOnly ( ( ) => ops . op_main_module ( ) ) ,
330
337
version : getterOnly ( ( ) => ( {
331
- deno : `supabase-edge-runtime-${ globalThis . SUPABASE_VERSION } (compatible with Deno v${ globalThis . DENO_VERSION } )` ,
338
+ deno :
339
+ `supabase-edge-runtime-${ globalThis . SUPABASE_VERSION } (compatible with Deno v${ globalThis . DENO_VERSION } )` ,
332
340
v8 : '11.6.189.12' ,
333
341
typescript : '5.1.6' ,
334
342
} ) ) ,
335
343
} ) ;
336
344
ObjectDefineProperty ( globalThis , 'Deno' , readOnly ( denoOverrides ) ) ;
337
345
338
346
setNumCpus ( 1 ) ; // explicitly setting no of CPUs to 1 (since we don't allow workers)
339
- setUserAgent ( `Deno/${ globalThis . DENO_VERSION } (variant; SupabaseEdgeRuntime/${ globalThis . SUPABASE_VERSION } )` ) ;
347
+ setUserAgent (
348
+ `Deno/${ globalThis . DENO_VERSION } (variant; SupabaseEdgeRuntime/${ globalThis . SUPABASE_VERSION } )` ,
349
+ ) ;
340
350
setLanguage ( 'en' ) ;
341
351
352
+ const ai = new SupabaseAI ( ) ;
353
+ Object . defineProperty ( globalThis , 'Supabase_UNSTABLE' , {
354
+ get ( ) {
355
+ return {
356
+ ai,
357
+ } ;
358
+ } ,
359
+ } ) ;
360
+
342
361
if ( isUserWorker ) {
343
362
delete globalThis . EdgeRuntime ;
344
363
@@ -364,7 +383,7 @@ globalThis.bootstrapSBEdge = (opts, isUserWorker, isEventsWorker, edgeRuntimeVer
364
383
}
365
384
366
385
const nodeBootstrap = globalThis . nodeBootstrap ;
367
- if ( nodeBootstrap ) {
386
+ if ( nodeBootstrap ) {
368
387
nodeBootstrap ( false , undefined ) ;
369
388
delete globalThis . nodeBootstrap ;
370
389
}
0 commit comments