-
Notifications
You must be signed in to change notification settings - Fork 255
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(*): Set PACKAGE_NAME and PACKAGE_VERSION as the user-agent heade…
…r in BAPI requests (#2579)
- Loading branch information
1 parent
2a615bf
commit c59a2d4
Showing
31 changed files
with
358 additions
and
193 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
--- | ||
'gatsby-plugin-clerk': patch | ||
'@clerk/clerk-sdk-node': patch | ||
'@clerk/backend': patch | ||
'@clerk/fastify': patch | ||
'@clerk/nextjs': patch | ||
'@clerk/remix': patch | ||
--- | ||
|
||
Replace the `Clerk-Backend-SDK` header with `User-Agent` in BAPI requests and update it's value to contain both the package name and the package version of the clerk package | ||
executing the request. Eg request from `@clerk/nextjs` to BAPI with append `User-Agent: @clerk/[email protected]` using the latest version. | ||
|
||
Miscellaneous changes: The backend test build changed to use tsup. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -59,7 +59,7 @@ export default (QUnit: QUnit) => { | |
headers: { | ||
Authorization: 'Bearer deadbeef', | ||
'Content-Type': 'application/json', | ||
'Clerk-Backend-SDK': '@clerk/backend', | ||
'User-Agent': '@clerk/backend@0.0.0-test', | ||
}, | ||
}); | ||
assert.propEqual(jwk, mockRsaJwk); | ||
|
@@ -78,7 +78,7 @@ export default (QUnit: QUnit) => { | |
headers: { | ||
Authorization: 'Bearer deadbeef', | ||
'Content-Type': 'application/json', | ||
'Clerk-Backend-SDK': '@clerk/backend', | ||
'User-Agent': '@clerk/backend@0.0.0-test', | ||
}, | ||
}); | ||
assert.propEqual(jwk, mockRsaJwk); | ||
|
@@ -96,7 +96,7 @@ export default (QUnit: QUnit) => { | |
method: 'GET', | ||
headers: { | ||
'Content-Type': 'application/json', | ||
'Clerk-Backend-SDK': '@clerk/backend', | ||
'User-Agent': '@clerk/backend@0.0.0-test', | ||
}, | ||
}); | ||
assert.propEqual(jwk, mockRsaJwk); | ||
|
@@ -116,7 +116,7 @@ export default (QUnit: QUnit) => { | |
headers: { | ||
Authorization: 'Bearer sk_test_deadbeef', | ||
'Content-Type': 'application/json', | ||
'Clerk-Backend-SDK': '@clerk/backend', | ||
'User-Agent': '@clerk/backend@0.0.0-test', | ||
}, | ||
}); | ||
assert.propEqual(jwk, mockRsaJwk); | ||
|
@@ -203,7 +203,7 @@ export default (QUnit: QUnit) => { | |
action: 'Contact [email protected]', | ||
}); | ||
assert.propContains(err, { | ||
message: `Unable to find a signing key in JWKS that matches the kid='${kid}' of the provided session token. Please make sure that the __session cookie or the HTTP authorization header contain a Clerk-generated session JWT. The following kid are available: ${mockRsaJwkKid}, local`, | ||
message: `Unable to find a signing key in JWKS that matches the kid='${kid}' of the provided session token. Please make sure that the __session cookie or the HTTP authorization header contain a Clerk-generated session JWT. The following kid are available: local, ${mockRsaJwkKid}`, | ||
}); | ||
} else { | ||
// This should never be reached. If it does, the suite should fail | ||
|
@@ -229,7 +229,7 @@ export default (QUnit: QUnit) => { | |
action: 'Contact [email protected]', | ||
}); | ||
assert.propContains(err, { | ||
message: `Unable to find a signing key in JWKS that matches the kid='${kid}' of the provided session token. Please make sure that the __session cookie or the HTTP authorization header contain a Clerk-generated session JWT. The following kid are available: ${mockRsaJwkKid}, local`, | ||
message: `Unable to find a signing key in JWKS that matches the kid='${kid}' of the provided session token. Please make sure that the __session cookie or the HTTP authorization header contain a Clerk-generated session JWT. The following kid are available: local, ${mockRsaJwkKid}`, | ||
}); | ||
} else { | ||
// This should never be reached. If it does, the suite should fail | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
import { defineConfig } from 'tsup'; | ||
|
||
// @ts-ignore | ||
import { name } from './package.json'; | ||
|
||
export default defineConfig(overrideOptions => { | ||
const isWatch = !!overrideOptions.watch; | ||
|
||
return { | ||
entry: ['./src/**/*.{ts,js}'], | ||
outDir: 'tests/dist/', | ||
define: { | ||
PACKAGE_NAME: `"${name}"`, | ||
// use "test" instead of actual package version to avoid updating the tests | ||
// depending on it (eg userAgent related) on every version bump | ||
PACKAGE_VERSION: `"0.0.0-test"`, | ||
__DEV__: `${isWatch}`, | ||
}, | ||
external: ['#crypto', '#fetch'], | ||
clean: true, | ||
minify: false, | ||
tsconfig: 'tsconfig.test.json', | ||
format: 'cjs', | ||
}; | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -8,6 +8,7 @@ exports[`clerk initializes clerk with constants 1`] = ` | |
"apiVersion": "v1", | ||
"jwtKey": "", | ||
"secretKey": "TEST_API_KEY", | ||
"userAgent": "@clerk/[email protected]", | ||
}, | ||
], | ||
] | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.