stackApp.version

This commit is contained in:
Konstantin Wohlwend 2026-02-17 17:48:28 -08:00
parent 45e8eddd70
commit fd79f626d3
3 changed files with 25 additions and 0 deletions

View File

@ -13,6 +13,22 @@ const signIn = async (clientApp: any) => {
});
};
// ============================================
// version tests
// ============================================
it("clientApp.version should return a valid semver version string", async ({ expect }) => {
const { clientApp } = await createApp({});
expect(clientApp.version).toBeDefined();
expect(typeof clientApp.version).toBe("string");
expect(clientApp.version).toMatch(/^\d+\.\d+\.\d+/);
});
it("serverApp.version should return the same version as clientApp", async ({ expect }) => {
const { clientApp, serverApp } = await createApp({});
expect(serverApp.version).toBe(clientApp.version);
});
// ============================================
// getAccessToken / getRefreshToken tests
// ============================================

View File

@ -1916,6 +1916,10 @@ export class _StackClientAppImplIncomplete<HasTokenStore extends boolean, Projec
return this._interface.projectId as ProjectId;
}
get version(): string {
return clientVersion;
}
protected async _isTrusted(url: string): Promise<boolean> {
// TODO: At some point, we should use the project's trusted domains for this instead of just requiring the URL to be relative
// (note that when we do this, that should be on-top of the relativity check, not replacing it)

View File

@ -47,6 +47,11 @@ export type StackClientApp<HasTokenStore extends boolean = boolean, ProjectId ex
& {
readonly projectId: ProjectId,
/**
* The version of the Stack Auth SDK.
*/
readonly version: string,
readonly urls: Readonly<HandlerUrls>,
signInWithOAuth(provider: string, options?: { returnTo?: string }): Promise<void>,