diff --git a/apps/docs/content/guides/ai/examples/huggingface-image-captioning.mdx b/apps/docs/content/guides/ai/examples/huggingface-image-captioning.mdx index 64012a95fe..d2737bd6e2 100644 --- a/apps/docs/content/guides/ai/examples/huggingface-image-captioning.mdx +++ b/apps/docs/content/guides/ai/examples/huggingface-image-captioning.mdx @@ -41,7 +41,7 @@ Find the complete code on [GitHub](https://github.com/supabase/supabase/tree/mas ```ts import { serve } from 'https://deno.land/std@0.168.0/http/server.ts' import { HfInference } from 'https://esm.sh/@huggingface/inference@2.3.2' -import { createClient } from 'https://esm.sh/@supabase/supabase-js@2.7.1' +import { createClient } from 'jsr:@supabase/supabase-js@2' import { Database } from './types.ts' console.log('Hello from `huggingface-image-captioning` function!') diff --git a/apps/docs/content/guides/ai/hybrid-search.mdx b/apps/docs/content/guides/ai/hybrid-search.mdx index 535b078233..0a21fd1f83 100644 --- a/apps/docs/content/guides/ai/hybrid-search.mdx +++ b/apps/docs/content/guides/ai/hybrid-search.mdx @@ -166,7 +166,7 @@ from In practice, you will likely be calling this from the [Supabase client](/docs/reference/javascript/introduction) or through a custom backend layer. Here is a quick example of how you might call this from an [Edge Function](/docs/guides/functions) using JavaScript: ```tsx -import { createClient } from 'npm:@supabase/supabase-js' +import { createClient } from 'jsr:@supabase/supabase-js@2' import OpenAI from 'npm:openai' const supabaseUrl = Deno.env.get('SUPABASE_URL')! diff --git a/apps/docs/content/guides/functions/ai-models.mdx b/apps/docs/content/guides/functions/ai-models.mdx index a4f3cce8c0..12b40de646 100644 --- a/apps/docs/content/guides/functions/ai-models.mdx +++ b/apps/docs/content/guides/functions/ai-models.mdx @@ -23,7 +23,7 @@ const model = new Supabase.ai.Session('model-name') To get type hints and checks for the API you can import types from `functions-js` at the top of your file: ```ts -import 'https://esm.sh/@supabase/functions-js/src/edge-runtime.d.ts' +import 'jsr:@supabase/functions-js/edge-runtime.d.ts' ``` @@ -100,7 +100,7 @@ Inference via larger models is supported via [Ollama](https://ollama.com/). In t ``` ```ts - import 'https://esm.sh/@supabase/functions-js/src/edge-runtime.d.ts' + import 'jsr:@supabase/functions-js/edge-runtime.d.ts' const session = new Supabase.ai.Session('mistral') Deno.serve(async (req: Request) => { diff --git a/apps/docs/content/guides/functions/auth.mdx b/apps/docs/content/guides/functions/auth.mdx index 73dc436f37..f607c3587e 100644 --- a/apps/docs/content/guides/functions/auth.mdx +++ b/apps/docs/content/guides/functions/auth.mdx @@ -12,7 +12,7 @@ Edge Functions work seamlessly with [Supabase Auth](/docs/guides/auth). When a user makes a request to an Edge Function, you can use the Authorization header to set the Auth context in the Supabase client: ```js mark=9 -import { createClient } from 'https://esm.sh/@supabase/supabase-js@2' +import { createClient } from 'jsr:@supabase/supabase-js@2' Deno.serve(async (req: Request) => { @@ -33,7 +33,7 @@ Importantly, this is done _inside_ the `Deno.serve()` callback argument, so that After initializing a Supabase client with the Auth context, you can use `getUser()` to fetch the user object, and run queries in the context of the user with [Row Level Security (RLS)](/docs/guides/database/postgres/row-level-security) policies enforced. ```js mark=12:13 -import { createClient } from 'https://esm.sh/@supabase/supabase-js@2' +import { createClient } from 'jsr:@supabase/supabase-js@2' Deno.serve(async (req: Request) => { @@ -61,7 +61,7 @@ Deno.serve(async (req: Request) => { After initializing a Supabase client with the Auth context, all queries will be executed with the context of the user. For database queries, this means [Row Level Security](/docs/guides/database/postgres/row-level-security) will be enforced. ```js mark=12 -import { createClient } from 'https://esm.sh/@supabase/supabase-js@2' +import { createClient } from 'jsr:@supabase/supabase-js@2' Deno.serve(async (req: Request) => { diff --git a/apps/docs/content/guides/functions/connect-to-postgres.mdx b/apps/docs/content/guides/functions/connect-to-postgres.mdx index 651c4fe56b..12478874d5 100644 --- a/apps/docs/content/guides/functions/connect-to-postgres.mdx +++ b/apps/docs/content/guides/functions/connect-to-postgres.mdx @@ -14,7 +14,7 @@ You can also use other Postgres clients like [Deno Postgres](https://deno.land/x The `supabase-js` client is a great option for connecting to your Supabase database since it handles authorization with Row Level Security, and it automatically formats your response as JSON. ```ts index.ts -import { createClient } from 'https://esm.sh/@supabase/supabase-js' +import { createClient } from 'jsr:@supabase/supabase-js@2' Deno.serve(async (_req) => { try { diff --git a/apps/docs/content/guides/functions/examples/push-notifications.mdx b/apps/docs/content/guides/functions/examples/push-notifications.mdx index 9a53c86541..b59ad8879a 100644 --- a/apps/docs/content/guides/functions/examples/push-notifications.mdx +++ b/apps/docs/content/guides/functions/examples/push-notifications.mdx @@ -53,7 +53,7 @@ Push notifications are an important part of any mobile app. They allow you to se 1. `supabase secrets set --env-file .env.local` ```ts supabase/functions/push/index.ts - import { createClient } from 'https://esm.sh/@supabase/supabase-js@2.38.4' + import { createClient } from 'jsr:@supabase/supabase-js@2' console.log('Hello from Functions!') diff --git a/apps/docs/content/guides/functions/unit-test.mdx b/apps/docs/content/guides/functions/unit-test.mdx index e08c853b2b..0430bbc325 100644 --- a/apps/docs/content/guides/functions/unit-test.mdx +++ b/apps/docs/content/guides/functions/unit-test.mdx @@ -35,7 +35,7 @@ The following script is a good example to get started with testing your Edge Fun ```typescript function-one-test.ts // Import required libraries and modules import { assert, assertEquals } from 'https://deno.land/std@0.192.0/testing/asserts.ts' -import { createClient, SupabaseClient } from 'https://esm.sh/@supabase/supabase-js@2.23.0' +import { createClient, SupabaseClient } from 'jsr:@supabase/supabase-js@2' // Set up the configuration for the Supabase client const supabaseUrl = Deno.env.get('SUPABASE_URL') ?? '' diff --git a/apps/docs/docs/ref/javascript/installing.mdx b/apps/docs/docs/ref/javascript/installing.mdx index eb133446ab..3a5d4cbe44 100644 --- a/apps/docs/docs/ref/javascript/installing.mdx +++ b/apps/docs/docs/ref/javascript/installing.mdx @@ -73,14 +73,14 @@ custom_edit_url: https://github.com/supabase/supabase/edit/master/web/spec/supab - You can use supabase-js in the Deno runtime via esm.sh: + You can use supabase-js in the Deno runtime via [JSR](https://jsr.io/@supabase/supabase-js): ```ts - import { createClient } from 'https://esm.sh/@supabase/supabase-js@2' + import { createClient } from 'jsr:@supabase/supabase-js@2' ``` diff --git a/apps/www/_blog/2023-02-03-openai-embeddings-postgres-vector.mdx b/apps/www/_blog/2023-02-03-openai-embeddings-postgres-vector.mdx index 2196f41a5b..fb4f913b48 100644 --- a/apps/www/_blog/2023-02-03-openai-embeddings-postgres-vector.mdx +++ b/apps/www/_blog/2023-02-03-openai-embeddings-postgres-vector.mdx @@ -203,7 +203,7 @@ Finally, let's create an [Edge Function](https://supabase.com/docs/guides/functi ```tsx import { serve } from 'https://deno.land/std@0.170.0/http/server.ts' import 'https://deno.land/x/xhr@0.2.1/mod.ts' -import { createClient } from 'https://esm.sh/@supabase/supabase-js@2.5.0' +import { createClient } from 'jsr:@supabase/supabase-js@2' import { Configuration, OpenAIApi } from 'https://esm.sh/openai@3.1.0' import { supabaseClient } from './lib/supabase' @@ -264,7 +264,7 @@ Here's another Edge Function that expands upon the simple example above: ```tsx import { serve } from 'https://deno.land/std@0.170.0/http/server.ts' import 'https://deno.land/x/xhr@0.2.1/mod.ts' -import { createClient } from 'https://esm.sh/@supabase/supabase-js@2.5.0' +import { createClient } from 'jsr:@supabase/supabase-js@2' import GPT3Tokenizer from 'https://esm.sh/gpt3-tokenizer@1.1.5' import { Configuration, OpenAIApi } from 'https://esm.sh/openai@3.1.0' import { oneLine, stripIndent } from 'https://esm.sh/common-tags@1.8.2' diff --git a/apps/www/_blog/2023-08-07-hugging-face-supabase.mdx b/apps/www/_blog/2023-08-07-hugging-face-supabase.mdx index 124805b560..11ef0eca43 100644 --- a/apps/www/_blog/2023-08-07-hugging-face-supabase.mdx +++ b/apps/www/_blog/2023-08-07-hugging-face-supabase.mdx @@ -96,7 +96,7 @@ Let’s step through a small demo where we accept some text, convert it into an ```ts import { serve } from 'https://deno.land/std@0.168.0/http/server.ts' import { env, pipeline } from 'https://cdn.jsdelivr.net/npm/@xenova/transformers@2.5.0' -import { createClient } from 'https://esm.sh/@supabase/supabase-js@2' +import { createClient } from 'jsr:@supabase/supabase-js@2' // Preparation for Deno runtime env.useBrowserCache = false diff --git a/apps/www/components/Products/Functions/WorksWithAuthPanel.tsx b/apps/www/components/Products/Functions/WorksWithAuthPanel.tsx index 470fb46a52..926e1a4f9e 100644 --- a/apps/www/components/Products/Functions/WorksWithAuthPanel.tsx +++ b/apps/www/components/Products/Functions/WorksWithAuthPanel.tsx @@ -1,7 +1,7 @@ import React from 'react' import CodeWindow from '~/components/CodeWindow' -const code = `import { createClient } from 'https://esm.sh/@supabase/supabase-js@2' +const code = `import { createClient } from 'jsr:@supabase/supabase-js@2' Deno.serve(async (req: Request) => { // Create supabase client diff --git a/apps/www/components/Products/Functions/WorksWithStoragePanel.tsx b/apps/www/components/Products/Functions/WorksWithStoragePanel.tsx index 91811b86f4..437fef40e9 100644 --- a/apps/www/components/Products/Functions/WorksWithStoragePanel.tsx +++ b/apps/www/components/Products/Functions/WorksWithStoragePanel.tsx @@ -1,7 +1,7 @@ import React from 'react' import CodeWindow from '~/components/CodeWindow' -const code = `import { createClient } from 'https://esm.sh/@supabase/supabase-js@2' +const code = `import { createClient } from 'jsr:@supabase/supabase-js@2' Deno.serve(async (req: Request) => { // Create supabase client diff --git a/apps/www/data/products/functions/usecase-examples.js b/apps/www/data/products/functions/usecase-examples.js index 1699f9d761..e536fde42e 100644 --- a/apps/www/data/products/functions/usecase-examples.js +++ b/apps/www/data/products/functions/usecase-examples.js @@ -56,7 +56,7 @@ serve(async (req: Request) => { description: `Read and write to any of your buckets, while also respecting storage auth policies.`, size: 'large', code: `import { serve } from "https://deno.land/std@0.114.0/http/server.ts"; -import { createClient } from "https://esm.sh/@supabase/supabase-js@1.33.1"; +import { createClient } from "jsr:@supabase/supabase-js@2"; serve(async (req) => { const SUPABASE_URL = Deno.env.get("SUPABASE_URL") ?? ""; @@ -78,7 +78,7 @@ serve(async (req) => { description: `Read, Write, Update, Insert anything on the database`, size: 'large', code: `import { serve } from "https://deno.land/std@0.114.0/http/server.ts"; -import { createClient } from "https://esm.sh/@supabase/supabase-js@1.33.1"; +import { createClient } from "jsr:@supabase/supabase-js@2"; serve(async () => { const SUPABASE_URL = Deno.env.get("SUPABASE_URL") ?? ""; diff --git a/apps/www/supabase/functions/lw11-og/handler.tsx b/apps/www/supabase/functions/lw11-og/handler.tsx index a8d3fbf854..e036659fb0 100644 --- a/apps/www/supabase/functions/lw11-og/handler.tsx +++ b/apps/www/supabase/functions/lw11-og/handler.tsx @@ -1,6 +1,6 @@ import React from 'https://esm.sh/react@18.2.0?deno-std=0.140.0' import { ImageResponse } from 'https://deno.land/x/og_edge@0.0.4/mod.ts' -import { createClient } from 'https://esm.sh/@supabase/supabase-js@2.7.1' +import { createClient } from 'jsr:@supabase/supabase-js@2' const corsHeaders = { 'Access-Control-Allow-Origin': '*', diff --git a/apps/www/supabase/functions/lwx-og/handler.tsx b/apps/www/supabase/functions/lwx-og/handler.tsx index cfc3445924..b4eea3fbcb 100644 --- a/apps/www/supabase/functions/lwx-og/handler.tsx +++ b/apps/www/supabase/functions/lwx-og/handler.tsx @@ -1,6 +1,6 @@ import React from 'https://esm.sh/react@18.2.0?deno-std=0.140.0' import { ImageResponse } from 'https://deno.land/x/og_edge@0.0.4/mod.ts' -import { createClient } from 'https://esm.sh/@supabase/supabase-js@2.7.1' +import { createClient } from 'jsr:@supabase/supabase-js@2' const corsHeaders = { 'Access-Control-Allow-Origin': '*', diff --git a/apps/www/supabase/functions/lwx-ticket-og/handler.tsx b/apps/www/supabase/functions/lwx-ticket-og/handler.tsx index 2a53663cd2..207d7ac549 100644 --- a/apps/www/supabase/functions/lwx-ticket-og/handler.tsx +++ b/apps/www/supabase/functions/lwx-ticket-og/handler.tsx @@ -1,6 +1,6 @@ import React from 'https://esm.sh/react@18.2.0?deno-std=0.140.0' import { ImageResponse } from 'https://deno.land/x/og_edge@0.0.4/mod.ts' -import { createClient } from 'https://esm.sh/@supabase/supabase-js@2.7.1' +import { createClient } from 'jsr:@supabase/supabase-js@2' const corsHeaders = { 'Access-Control-Allow-Origin': '*', diff --git a/apps/www/supabase/functions/lwx-ticket/handler.tsx b/apps/www/supabase/functions/lwx-ticket/handler.tsx index 63e63787da..72bf3ff3fa 100644 --- a/apps/www/supabase/functions/lwx-ticket/handler.tsx +++ b/apps/www/supabase/functions/lwx-ticket/handler.tsx @@ -1,6 +1,6 @@ import React from 'https://esm.sh/react@18.2.0?deno-std=0.140.0' import { ImageResponse } from 'https://deno.land/x/og_edge@0.0.4/mod.ts' -import { createClient } from 'https://esm.sh/@supabase/supabase-js@2.7.1' +import { createClient } from 'jsr:@supabase/supabase-js@2' const corsHeaders = { 'Access-Control-Allow-Origin': '*', diff --git a/examples/ai/edge-functions/supabase/functions/generate-embedding/index.ts b/examples/ai/edge-functions/supabase/functions/generate-embedding/index.ts index 1fa1b6dc4b..89174e016c 100644 --- a/examples/ai/edge-functions/supabase/functions/generate-embedding/index.ts +++ b/examples/ai/edge-functions/supabase/functions/generate-embedding/index.ts @@ -1,6 +1,6 @@ -import "https://esm.sh/@supabase/functions-js/src/edge-runtime.d.ts"; +import "jsr:@supabase/functions-js/edge-runtime.d.ts"; -import { createClient } from "npm:@supabase/supabase-js@2.42.0"; +import { createClient } from "jsr:@supabase/supabase-js@2"; import { Database, Tables } from "../_shared/database.types.ts"; type EmbeddingsRecord = Tables<"embeddings">; diff --git a/examples/ai/edge-functions/supabase/functions/search/index.ts b/examples/ai/edge-functions/supabase/functions/search/index.ts index 25585e99ce..2f045d7a0a 100644 --- a/examples/ai/edge-functions/supabase/functions/search/index.ts +++ b/examples/ai/edge-functions/supabase/functions/search/index.ts @@ -1,6 +1,6 @@ -import "https://esm.sh/@supabase/functions-js/src/edge-runtime.d.ts"; +import "jsr:@supabase/functions-js/edge-runtime.d.ts"; -import { createClient } from "npm:@supabase/supabase-js@2.42.0"; +import { createClient } from "jsr:@supabase/supabase-js@2"; import { Database } from "../_shared/database.types.ts"; const supabase = createClient( diff --git a/examples/edge-functions/supabase/functions/file-upload-storage/index.ts b/examples/edge-functions/supabase/functions/file-upload-storage/index.ts index 025255da13..e90e5ae71c 100644 --- a/examples/edge-functions/supabase/functions/file-upload-storage/index.ts +++ b/examples/edge-functions/supabase/functions/file-upload-storage/index.ts @@ -2,7 +2,7 @@ // and write files to Supabase Storage and other fields to a database table. import { Application } from 'https://deno.land/x/oak@v11.1.0/mod.ts' -import { createClient } from 'https://esm.sh/@supabase/supabase-js@2.7.1' +import { createClient } from 'jsr:@supabase/supabase-js@2' const MB = 1024 * 1024 diff --git a/examples/edge-functions/supabase/functions/get-tshirt-competition/index.ts b/examples/edge-functions/supabase/functions/get-tshirt-competition/index.ts index 492eeb4a6d..16a89ab145 100644 --- a/examples/edge-functions/supabase/functions/get-tshirt-competition/index.ts +++ b/examples/edge-functions/supabase/functions/get-tshirt-competition/index.ts @@ -2,7 +2,7 @@ // https://deno.land/manual/getting_started/setup_your_environment // This enables autocomplete, go to definition, etc. -import { createClient } from 'https://esm.sh/@supabase/supabase-js@2.7.1' +import { createClient } from 'jsr:@supabase/supabase-js@2' import { corsHeaders } from '../_shared/cors.ts' console.log(`Function "get-tshirt-competition" up and running!`) diff --git a/examples/edge-functions/supabase/functions/huggingface-image-captioning/index.ts b/examples/edge-functions/supabase/functions/huggingface-image-captioning/index.ts index 9134aa44af..4e5a7e909e 100644 --- a/examples/edge-functions/supabase/functions/huggingface-image-captioning/index.ts +++ b/examples/edge-functions/supabase/functions/huggingface-image-captioning/index.ts @@ -1,5 +1,5 @@ import { HfInference } from 'https://esm.sh/@huggingface/inference@2.3.2' -import { createClient } from 'https://esm.sh/@supabase/supabase-js@2.7.1' +import { createClient } from 'jsr:@supabase/supabase-js@2' import { Database } from './types.ts' console.log('Hello from `huggingface-image-captioning` function!') diff --git a/examples/edge-functions/supabase/functions/import_map.json b/examples/edge-functions/supabase/functions/import_map.json index f703de7b56..4007dd0c65 100644 --- a/examples/edge-functions/supabase/functions/import_map.json +++ b/examples/edge-functions/supabase/functions/import_map.json @@ -10,7 +10,7 @@ "std/server": "https://deno.land/std@0.177.0/http/server.ts", "stripe": "https://esm.sh/stripe@11.1.0?target=deno", "sift": "https://deno.land/x/sift@0.6.0/mod.ts", - "@supabase/supabase-js": "https://esm.sh/@supabase/supabase-js@2.7.1", + "@supabase/supabase-js": "jsr:@supabase/supabase-js@2", "postgres": "https://deno.land/x/postgres@v0.17.0/mod.ts", "puppeteer": "https://deno.land/x/puppeteer@16.2.0/mod.ts", "React": "https://esm.sh/react@18.2.0?deno-std=0.177.0", diff --git a/examples/edge-functions/supabase/functions/og-image-with-storage-cdn/handler.tsx b/examples/edge-functions/supabase/functions/og-image-with-storage-cdn/handler.tsx index 2aef3b2be1..824fdbb66a 100644 --- a/examples/edge-functions/supabase/functions/og-image-with-storage-cdn/handler.tsx +++ b/examples/edge-functions/supabase/functions/og-image-with-storage-cdn/handler.tsx @@ -1,6 +1,6 @@ import React from 'https://esm.sh/react@18.2.0?deno-std=0.177.0' import { ImageResponse } from 'https://deno.land/x/og_edge@0.0.4/mod.ts' -import { createClient } from 'https://esm.sh/@supabase/supabase-js@2.7.1' +import { createClient } from 'jsr:@supabase/supabase-js@2' import { corsHeaders } from '../_shared/cors.ts' const STORAGE_URL = 'https://obuldanrptloktxcffvn.supabase.co/storage/v1/object/public/images/lw6' diff --git a/examples/edge-functions/supabase/functions/read-storage/index.ts b/examples/edge-functions/supabase/functions/read-storage/index.ts index 51d84eef8b..938b435b17 100644 --- a/examples/edge-functions/supabase/functions/read-storage/index.ts +++ b/examples/edge-functions/supabase/functions/read-storage/index.ts @@ -2,7 +2,7 @@ // https://deno.land/manual/getting_started/setup_your_environment // This enables autocomplete, go to definition, etc. -import { createClient } from 'https://esm.sh/@supabase/supabase-js@2.7.1' +import { createClient } from 'jsr:@supabase/supabase-js@2' const corsHeaders = { 'Access-Control-Allow-Origin': '*', diff --git a/examples/edge-functions/supabase/functions/restful-tasks/index.ts b/examples/edge-functions/supabase/functions/restful-tasks/index.ts index 77a5b84fdb..4b40c117c5 100644 --- a/examples/edge-functions/supabase/functions/restful-tasks/index.ts +++ b/examples/edge-functions/supabase/functions/restful-tasks/index.ts @@ -2,7 +2,7 @@ // https://deno.land/manual/getting_started/setup_your_environment // This enables autocomplete, go to definition, etc. -import { createClient, SupabaseClient } from 'https://esm.sh/@supabase/supabase-js@2.7.1' +import { createClient, SupabaseClient } from 'jsr:@supabase/supabase-js@2' const corsHeaders = { 'Access-Control-Allow-Origin': '*', diff --git a/examples/edge-functions/supabase/functions/select-from-table-with-auth-rls/index.ts b/examples/edge-functions/supabase/functions/select-from-table-with-auth-rls/index.ts index 93fc185c48..04fa80dd0b 100644 --- a/examples/edge-functions/supabase/functions/select-from-table-with-auth-rls/index.ts +++ b/examples/edge-functions/supabase/functions/select-from-table-with-auth-rls/index.ts @@ -2,7 +2,7 @@ // https://deno.land/manual/getting_started/setup_your_environment // This enables autocomplete, go to definition, etc. -import { createClient } from 'https://esm.sh/@supabase/supabase-js@2.7.1' +import { createClient } from 'jsr:@supabase/supabase-js@2' import { corsHeaders } from '../_shared/cors.ts' console.log(`Function "select-from-table-with-auth-rls" up and running!`) diff --git a/examples/edge-functions/supabase/functions/sentry/index.ts b/examples/edge-functions/supabase/functions/sentry/index.ts index c2919ef4bc..ecdf4bb511 100644 --- a/examples/edge-functions/supabase/functions/sentry/index.ts +++ b/examples/edge-functions/supabase/functions/sentry/index.ts @@ -4,7 +4,7 @@ console.log('Hello from the Sentry Functions Challenge!') -import { createClient } from 'https://esm.sh/@supabase/supabase-js@2.42.5' +import { createClient } from 'jsr:@supabase/supabase-js@2' import * as Sentry from 'https://deno.land/x/sentry@7.102.0/index.mjs' const supabase = createClient( diff --git a/examples/edge-functions/supabase/functions/tweet-to-image/handler.tsx b/examples/edge-functions/supabase/functions/tweet-to-image/handler.tsx index c55060c77e..6d54b55f55 100644 --- a/examples/edge-functions/supabase/functions/tweet-to-image/handler.tsx +++ b/examples/edge-functions/supabase/functions/tweet-to-image/handler.tsx @@ -1,6 +1,6 @@ import React from 'https://esm.sh/react@18.2.0?deno-std=0.140.0' import { ImageResponse } from 'https://deno.land/x/og_edge@0.0.4/mod.ts' -import { createClient } from 'https://esm.sh/@supabase/supabase-js@2.5.0' +import { createClient } from 'jsr:@supabase/supabase-js@2' import { corsHeaders } from '../_shared/cors.ts' import { getTweets } from './getTweet.ts' import Tweet from './Tweet.tsx' diff --git a/examples/edge-functions/supabase/functions/upstash-redis-ratelimit/index.ts b/examples/edge-functions/supabase/functions/upstash-redis-ratelimit/index.ts index 9ecac3b9ff..91774d9cc2 100644 --- a/examples/edge-functions/supabase/functions/upstash-redis-ratelimit/index.ts +++ b/examples/edge-functions/supabase/functions/upstash-redis-ratelimit/index.ts @@ -1,6 +1,6 @@ import { Redis } from 'https://deno.land/x/upstash_redis@v1.19.3/mod.ts' import { Ratelimit } from 'https://cdn.skypack.dev/@upstash/ratelimit@0.4.4' -import { createClient } from 'https://esm.sh/@supabase/supabase-js@2.7.1' +import { createClient } from 'jsr:@supabase/supabase-js@2' console.log(`Function "upstash-redis-counter" up and running!`) diff --git a/examples/user-management/expo-push-notifications/supabase/functions/push/index.ts b/examples/user-management/expo-push-notifications/supabase/functions/push/index.ts index 40903c51f0..79141a0e40 100644 --- a/examples/user-management/expo-push-notifications/supabase/functions/push/index.ts +++ b/examples/user-management/expo-push-notifications/supabase/functions/push/index.ts @@ -1,54 +1,54 @@ // Follow this setup guide to integrate the Deno language server with your editor: // https://deno.land/manual/getting_started/setup_your_environment // This enables autocomplete, go to definition, etc. -import { createClient } from "https://esm.sh/@supabase/supabase-js@2.38.4"; +import { createClient } from 'jsr:@supabase/supabase-js@2' -console.log("Hello from Functions!"); +console.log('Hello from Functions!') interface Notification { - id: string; - user_id: string; - body: string; + id: string + user_id: string + body: string } interface WebhookPayload { - type: "INSERT" | "UPDATE" | "DELETE"; - table: string; - record: Notification; - schema: "public"; - old_record: null | Notification; + type: 'INSERT' | 'UPDATE' | 'DELETE' + table: string + record: Notification + schema: 'public' + old_record: null | Notification } const supabase = createClient( - Deno.env.get("SUPABASE_URL")!, - Deno.env.get("SUPABASE_SERVICE_ROLE_KEY")! -); + Deno.env.get('SUPABASE_URL')!, + Deno.env.get('SUPABASE_SERVICE_ROLE_KEY')! +) Deno.serve(async (req) => { - const payload: WebhookPayload = await req.json(); + const payload: WebhookPayload = await req.json() const { data } = await supabase - .from("profiles") - .select("expo_push_token") - .eq("id", payload.record.user_id) - .single(); + .from('profiles') + .select('expo_push_token') + .eq('id', payload.record.user_id) + .single() - const res = await fetch("https://exp.host/--/api/v2/push/send", { - method: "POST", + const res = await fetch('https://exp.host/--/api/v2/push/send', { + method: 'POST', headers: { - "Content-Type": "application/json", - Authorization: `Bearer ${Deno.env.get("EXPO_ACCESS_TOKEN")}`, + 'Content-Type': 'application/json', + Authorization: `Bearer ${Deno.env.get('EXPO_ACCESS_TOKEN')}`, }, body: JSON.stringify({ to: data?.expo_push_token, - sound: "default", + sound: 'default', body: payload.record.body, }), - }).then((res) => res.json()); + }).then((res) => res.json()) return new Response(JSON.stringify(res), { - headers: { "Content-Type": "application/json" }, - }); -}); + headers: { 'Content-Type': 'application/json' }, + }) +}) // To invoke: // curl -i --location --request POST 'http://localhost:54321/functions/v1/' \ diff --git a/supabase/functions/ai-docs/index.ts b/supabase/functions/ai-docs/index.ts index b01359c146..e87e483694 100644 --- a/supabase/functions/ai-docs/index.ts +++ b/supabase/functions/ai-docs/index.ts @@ -1,6 +1,6 @@ import { serve } from 'https://deno.land/std@0.170.0/http/server.ts' import 'https://deno.land/x/xhr@0.2.1/mod.ts' -import { createClient } from 'https://esm.sh/@supabase/supabase-js@2.5.0' +import { createClient } from 'jsr:@supabase/supabase-js@2' import { codeBlock, oneLine } from 'https://esm.sh/common-tags@1.8.2' import { ChatCompletionRequestMessage, diff --git a/supabase/functions/search-embeddings/index.ts b/supabase/functions/search-embeddings/index.ts index 6ba578baef..91a912fe3f 100644 --- a/supabase/functions/search-embeddings/index.ts +++ b/supabase/functions/search-embeddings/index.ts @@ -1,5 +1,5 @@ import 'https://deno.land/x/xhr@0.2.1/mod.ts' -import { createClient } from 'https://esm.sh/@supabase/supabase-js@2.8.0' +import { createClient } from 'jsr:@supabase/supabase-js@2' import { Configuration, OpenAIApi } from 'https://esm.sh/openai@3.1.0' import { Database } from '../common/database-types.ts' import { ApplicationError, UserError } from '../common/errors.ts'