Skip to content

Commit 3693d20

Browse files
authored
Merge pull request #3561 from quadratichq/revert-to-v0.20.5
Revert "Merge pull request #3547 from quadratichq/qa"
2 parents afcd6c4 + 58deb93 commit 3693d20

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

67 files changed

+1914
-1482
lines changed

Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ edition = "2024"
1515
description = "Infinite data grid with Python, JavaScript, and SQL built-in"
1616
repository = "https://github.com/quadratichq/quadratic"
1717
license-file = "LICENSE"
18-
version = "0.21.0"
18+
version = "0.20.5"
1919

2020

2121
[profile.release]

VERSION

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
0.21.0
1+
0.20.5

package.json

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "quadratic",
3-
"version": "0.21.0",
3+
"version": "0.20.5",
44
"author": {
55
"name": "David Kircos",
66
"email": "david@quadratichq.com",
@@ -71,7 +71,6 @@
7171
"docker:down": "docker compose --profile all --env-file .env.docker down",
7272
"docker:clean": "docker system prune -af && docker builder prune -af && docker volume prune -af",
7373
"e2e:test": "cd test/e2e && npm run docker:test",
74-
"e2e:test:bail": "cd test/e2e && npm run docker:bail",
7574
"e2e:update": "cd test/e2e && npm run docker:update",
7675
"e2e:ui": "cd test/e2e && npm run test:ui",
7776
"e2e:headed": "cd test/e2e && npm run test:headed",

quadratic-api/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "quadratic-api",
3-
"version": "0.21.0",
3+
"version": "0.20.5",
44
"description": "",
55
"main": "index.js",
66
"scripts": {

quadratic-api/src/app.ts

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,8 @@ import fs from 'fs';
99
import helmet from 'helmet';
1010
import path from 'path';
1111
import winston from 'winston';
12-
import { CORS, LOG_REQUEST_INFO, NODE_ENV, SENTRY_DSN, VERSION } from './env-vars';
12+
import authRouter from './auth/router/authRouter';
13+
import { AUTH_CORS, CORS, LOG_REQUEST_INFO, NODE_ENV, SENTRY_DSN, VERSION } from './env-vars';
1314
import internal_router from './routes/internal';
1415
import { ApiError } from './utils/ApiError';
1516
import logger, { format } from './utils/logger';
@@ -31,6 +32,9 @@ app.use(helmet());
3132
// cookie parser for auth routes
3233
app.use(cookieParser());
3334

35+
// workos auth
36+
app.use('/', cors({ origin: AUTH_CORS, credentials: true }), authRouter);
37+
3438
// set CORS origin from env variable
3539
app.use(cors({ origin: CORS }));
3640

quadratic-api/src/auth/providers/auth.ts

Lines changed: 101 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,19 @@
1+
import type { Request, Response } from 'express';
12
import { AUTH_TYPE } from '../../env-vars';
23
import { getUsersFromOry, jwtConfigOry } from './ory';
3-
import { getUsersFromWorkos, jwtConfigWorkos } from './workos';
4+
import {
5+
authenticateWithCodeWorkos,
6+
authenticateWithRefreshTokenWorkos,
7+
clearCookiesWorkos,
8+
getUsersFromWorkos,
9+
jwtConfigWorkos,
10+
loginWithPasswordWorkos,
11+
logoutSessionWorkos,
12+
resetPasswordWorkos,
13+
sendResetPasswordWorkos,
14+
signupWithPasswordWorkos,
15+
verifyEmailWorkos,
16+
} from './workos';
417

518
export type UsersRequest = {
619
id: number;
@@ -43,3 +56,90 @@ export const jwtConfig = () => {
4356
throw new Error(`Unsupported auth type in jwtConfig(): ${AUTH_TYPE}`);
4457
}
4558
};
59+
60+
export const loginWithPassword = async (args: { email: string; password: string; res: Response }) => {
61+
switch (AUTH_TYPE) {
62+
case 'workos':
63+
return await loginWithPasswordWorkos(args);
64+
default:
65+
throw new Error(`Unsupported auth type in loginWithPassword(): ${AUTH_TYPE}`);
66+
}
67+
};
68+
69+
export const signupWithPassword = async (args: {
70+
email: string;
71+
password: string;
72+
firstName: string;
73+
lastName: string;
74+
res: Response;
75+
}) => {
76+
switch (AUTH_TYPE) {
77+
case 'workos':
78+
return await signupWithPasswordWorkos(args);
79+
default:
80+
throw new Error(`Unsupported auth type in signupWithPassword(): ${AUTH_TYPE}`);
81+
}
82+
};
83+
84+
export const authenticateWithCode = async (args: { code: string; res: Response }) => {
85+
switch (AUTH_TYPE) {
86+
case 'workos':
87+
return await authenticateWithCodeWorkos(args);
88+
default:
89+
throw new Error(`Unsupported auth type in authenticateWithCode(): ${AUTH_TYPE}`);
90+
}
91+
};
92+
93+
export const authenticateWithRefreshToken = async (args: { req: Request; res: Response }) => {
94+
switch (AUTH_TYPE) {
95+
case 'workos':
96+
return await authenticateWithRefreshTokenWorkos(args);
97+
default:
98+
throw new Error(`Unsupported auth type in authenticateWithRefreshToken(): ${AUTH_TYPE}`);
99+
}
100+
};
101+
102+
export const verifyEmail = async (args: { pendingAuthenticationToken: string; code: string; res: Response }) => {
103+
switch (AUTH_TYPE) {
104+
case 'workos':
105+
return await verifyEmailWorkos(args);
106+
default:
107+
throw new Error(`Unsupported auth type in verifyEmail(): ${AUTH_TYPE}`);
108+
}
109+
};
110+
111+
export const logoutSession = async (args: { sessionId: string; res: Response }) => {
112+
switch (AUTH_TYPE) {
113+
case 'workos':
114+
return await logoutSessionWorkos(args);
115+
default:
116+
throw new Error(`Unsupported auth type in logout(): ${AUTH_TYPE}`);
117+
}
118+
};
119+
120+
export const sendResetPassword = async (args: { email: string; res: Response }) => {
121+
switch (AUTH_TYPE) {
122+
case 'workos':
123+
return await sendResetPasswordWorkos(args);
124+
default:
125+
throw new Error(`Unsupported auth type in sendResetPassword(): ${AUTH_TYPE}`);
126+
}
127+
};
128+
129+
export const resetPassword = async (args: { token: string; password: string; res: Response }) => {
130+
switch (AUTH_TYPE) {
131+
case 'workos':
132+
return await resetPasswordWorkos(args);
133+
default:
134+
throw new Error(`Unsupported auth type in resetPassword(): ${AUTH_TYPE}`);
135+
}
136+
};
137+
138+
export const clearCookies = (args: { res: Response }) => {
139+
switch (AUTH_TYPE) {
140+
case 'workos':
141+
return clearCookiesWorkos(args);
142+
default:
143+
throw new Error(`Unsupported auth type in clearCookies(): ${AUTH_TYPE}`);
144+
}
145+
};

0 commit comments

Comments
 (0)