Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: configure to publish to JSR #82

Merged
merged 2 commits into from
May 11, 2024
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
4 changes: 4 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,10 @@ jobs:

runs-on: ubuntu-latest

permissions:
contents: read
id-token: write

steps:
- uses: actions/checkout@v4

Expand Down
3 changes: 2 additions & 1 deletion .releaserc.json
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@
"@semantic-release/commit-analyzer",
"@semantic-release/release-notes-generator",
"@semantic-release/github",
"@semantic-release/npm"
"@semantic-release/npm",
"@sebbo2002/semantic-release-jsr"
]
}
8 changes: 8 additions & 0 deletions jsr.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
{
"name": "@supabase/functions-js",
"version": "0.0.0-automated",
"exports": {
".": "./src/index.ts",
"./edge-runtime.d.ts": "./src/edge-runtime.d.ts"
}
}
93 changes: 93 additions & 0 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@
"@supabase/node-fetch": "^2.6.14"
},
"devDependencies": {
"@sebbo2002/semantic-release-jsr": "^1.0.0",
"@types/jest": "^28.1.0",
"@types/jsonwebtoken": "^8.5.8",
"@types/node": "^18.7.0",
Expand Down
4 changes: 2 additions & 2 deletions src/index.ts
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
export { FunctionsClient } from './FunctionsClient'
export {
FunctionInvokeOptions,
type FunctionInvokeOptions,
FunctionsError,
FunctionsFetchError,
FunctionsHttpError,
FunctionsRelayError,
FunctionRegion,
FunctionsResponse
type FunctionsResponse,
} from './types'
2 changes: 1 addition & 1 deletion src/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ export type FunctionInvokeOptions = {
/**
* The Region to invoke the function in.
*/
region?: FunctionRegion;
region?: FunctionRegion
/**
* The body of the request.
*/
Expand Down
14 changes: 8 additions & 6 deletions test/spec/params.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -248,7 +248,7 @@ describe('params reached to function', () => {
'custom-header': customHeader,
Authorization: `Bearer ${apiKey}`,
},
region: FunctionRegion.Any
region: FunctionRegion.Any,
})

log('assert no error')
Expand Down Expand Up @@ -278,23 +278,25 @@ describe('params reached to function', () => {
* @feature headers
*/
log('create FunctionsClient')
const fclient = new FunctionsClient(`http://localhost:${relay.container.getMappedPort(8081)}`,{region: FunctionRegion.ApNortheast1})
const fclient = new FunctionsClient(`http://localhost:${relay.container.getMappedPort(8081)}`, {
region: FunctionRegion.ApNortheast1,
})

log('invoke mirror')
const customHeader = nanoid()


const { data, error } = await fclient.invoke<MirrorResponse>('mirror', {
headers: {
'custom-header': customHeader,
Authorization: `Bearer ${apiKey}`
Authorization: `Bearer ${apiKey}`,
},
})

log('assert no error')
expect(
(data?.headers as [Array<string>]).filter(([k, v]) => k === 'x-region' && v === FunctionRegion.ApNortheast1)
.length > 0
(data?.headers as [Array<string>]).filter(
([k, v]) => k === 'x-region' && v === FunctionRegion.ApNortheast1
).length > 0
).toBe(true)
})

Expand Down
1 change: 1 addition & 0 deletions tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@

"esModuleInterop": true,
"moduleResolution": "Node",
"isolatedModules": true,

"forceConsistentCasingInFileNames": true,
"stripInternal": true,
Expand Down
Loading