Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -27,3 +27,6 @@ jobs:
- run: pnpm typecheck

- run: pnpm lint

- name: Verify JSR packaging
run: pnpm dlx jsr publish --dry-run --allow-dirty
5 changes: 5 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -129,6 +129,11 @@ jobs:
# TODO(@mandarini): add back --provenance once repo is OSS
npm publish --access public --tag "${{ steps.version.outputs.tag }}"

- name: Publish to JSR
if: ${{ steps.version.outputs.skip != 'true' }}
continue-on-error: true
run: npx jsr publish --allow-dirty

- name: Create GitHub pre-release
if: ${{ steps.version.outputs.tag == 'rc' }}
env:
Expand Down
13 changes: 13 additions & 0 deletions jsr.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
{
"name": "@supabase/server",
"version": "0.1.4",
"exports": {
".": "./src/index.ts",
"./core": "./src/core/index.ts",
"./adapters/hono": "./src/adapters/hono/index.ts"
},
"publish": {
"include": ["src/**/*.ts", "README.md", "LICENSE"],
"exclude": ["src/**/*.test.ts", "src/**/*.spec.ts"]
}
}
3 changes: 2 additions & 1 deletion release-please-config.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,8 @@
"release-type": "node",
"initial-version": "0.1.0",
"bump-minor-pre-major": true,
"bump-patch-for-minor-pre-major": true
"bump-patch-for-minor-pre-major": true,
"extra-files": ["jsr.json"]
}
},
"$schema": "https://raw.githubusercontent.com/googleapis/release-please/main/schemas/config.json"
Expand Down
5 changes: 4 additions & 1 deletion src/adapters/hono/middleware.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import type { MiddlewareHandler } from 'hono'
import { HTTPException } from 'hono/http-exception'
import { createMiddleware } from 'hono/factory'

Expand Down Expand Up @@ -30,7 +31,9 @@ import type { SupabaseContext, WithSupabaseConfig } from '../../types.js'
* export default { fetch: app.fetch }
* ```
*/
export function withSupabase(config?: Omit<WithSupabaseConfig, 'cors'>) {
export function withSupabase(
config?: Omit<WithSupabaseConfig, 'cors'>,
): MiddlewareHandler<{ Variables: { supabaseContext: SupabaseContext } }> {
return createMiddleware<{
Variables: { supabaseContext: SupabaseContext }
}>(async (c, next) => {
Expand Down
14 changes: 7 additions & 7 deletions src/errors.ts
Original file line number Diff line number Diff line change
Expand Up @@ -57,28 +57,28 @@ export const MissingSecretKeyError = 'MISSING_SECRET_KEY'
export const MissingDefaultSecretKeyError = 'MISSING_DEFAULT_SECRET_KEY'

const EnvErrorMap = {
[MissingSupabaseURLError]: () =>
[MissingSupabaseURLError]: (): EnvError =>
new EnvError(
'SUPABASE_URL is required but not set',
MissingSupabaseURLError,
),
[MissingSecretKeyError]: (name: string) =>
[MissingSecretKeyError]: (name: string): EnvError =>
new EnvError(
`No "${name}" secret key found. Include a "${name}" entry in SUPABASE_SECRET_KEYS.`,
MissingSecretKeyError,
),
[MissingDefaultSecretKeyError]: () =>
[MissingDefaultSecretKeyError]: (): EnvError =>
new EnvError(
'No default secret key found. Set SUPABASE_SECRET_KEY or include a "default" entry in SUPABASE_SECRET_KEYS.',
MissingDefaultSecretKeyError,
),

[MissingPublishableKeyError]: (name: string) =>
[MissingPublishableKeyError]: (name: string): EnvError =>
new EnvError(
`No "${name}" publishable key found. Include a "${name}" entry in SUPABASE_PUBLISHABLE_KEYS.`,
MissingPublishableKeyError,
),
[MissingDefaultPublishableKeyError]: () =>
[MissingDefaultPublishableKeyError]: (): EnvError =>
new EnvError(
'No default publishable key found. Set SUPABASE_PUBLISHABLE_KEY or include a "default" entry in SUPABASE_PUBLISHABLE_KEYS.',
MissingDefaultPublishableKeyError,
Expand Down Expand Up @@ -140,9 +140,9 @@ export const InvalidCredentialsError = 'INVALID_CREDENTIALS'
export const CreateSupabaseClientError = 'CREATE_SUPABASE_CLIENT_ERROR'

const AuthErrorMap = {
[InvalidCredentialsError]: () =>
[InvalidCredentialsError]: (): AuthError =>
new AuthError('Invalid credentials', InvalidCredentialsError, 401),
[CreateSupabaseClientError]: () =>
[CreateSupabaseClientError]: (): AuthError =>
new AuthError(
'Failed to create Supabase client',
CreateSupabaseClientError,
Expand Down
Loading