Skip to content

Commit 476140c

Browse files
committed
chore: refactor-to-latest-effect-api
1 parent aafdc89 commit 476140c

36 files changed

Lines changed: 701 additions & 823 deletions

e2e/mock-api-v2/eslint.config.mjs

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -12,11 +12,6 @@ export default [
1212
'@typescript-eslint/no-empty-object-type': 'off',
1313
},
1414
},
15-
{
16-
files: ['**/*.ts', '**/*.tsx'],
17-
// Override or add rules here
18-
rules: {},
19-
},
2015
{
2116
files: ['**/*.js', '**/*.jsx'],
2217
// Override or add rules here

e2e/mock-api-v2/package.json

Lines changed: 5 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -13,16 +13,13 @@
1313
"test": "pnpm nx nxTest"
1414
},
1515
"dependencies": {
16-
"@effect/language-service": "^0.2.0",
17-
"@effect/platform": "^0.58.27",
18-
"@effect/platform-node": "^0.53.26",
19-
"@effect/schema": "^0.68.23",
20-
"effect": "^3.12.7",
21-
"effect-http": "^0.73.0",
22-
"effect-http-node": "^0.27.0"
16+
"@effect/language-service": "catalog:effect",
17+
"@effect/platform": "catalog:effect",
18+
"@effect/platform-node": "catalog:effect",
19+
"effect": "catalog:effect"
2320
},
2421
"devDependencies": {
25-
"@effect/vitest": "^0.19.0"
22+
"@effect/vitest": "catalog:effect"
2623
},
2724
"nx": {
2825
"tags": ["scope:e2e"],

e2e/mock-api-v2/src/assets/.gitkeep

Whitespace-only changes.

e2e/mock-api-v2/src/endpoints/custom-html.endpoint.ts

Lines changed: 0 additions & 49 deletions
This file was deleted.

e2e/mock-api-v2/src/endpoints/davinci-authorize.endpoint.ts

Lines changed: 0 additions & 34 deletions
This file was deleted.

e2e/mock-api-v2/src/endpoints/open-id-configuration.endpoint.ts

Lines changed: 0 additions & 22 deletions
This file was deleted.

e2e/mock-api-v2/src/endpoints/token.endpoint.ts

Lines changed: 0 additions & 26 deletions
This file was deleted.

e2e/mock-api-v2/src/endpoints/userinfo.endpoint.ts

Lines changed: 0 additions & 25 deletions
This file was deleted.

e2e/mock-api-v2/src/handlers/authorize.handler.ts

Lines changed: 11 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -4,36 +4,22 @@
44
* This software may be modified and distributed under the terms
55
* of the MIT license. See the LICENSE file for details.
66
*/
7-
import { toCookieHeader } from '@effect/platform/Cookies';
87
import { Effect } from 'effect';
9-
import { RouterBuilder } from 'effect-http';
108

119
import { Authorize } from '../services/authorize.service.js';
12-
import { CookieService } from '../services/cookie.service.js';
13-
import { apiSpec } from '../spec.js';
10+
import { MockApi } from '../spec.js';
11+
import { HttpApiBuilder } from '@effect/platform';
1412

15-
const authorizeHandler = RouterBuilder.handler(apiSpec, 'DavinciAuthorize', ({ headers, query }) =>
16-
Effect.gen(function* () {
17-
const { handleAuthorize } = yield* Authorize;
13+
const AuthorizeHandlerMock = HttpApiBuilder.group(MockApi, 'Authorization', (handlers) =>
14+
handlers.handle('DavinciAuthorize', ({ urlParams }) =>
15+
Effect.gen(function* () {
16+
const { handleAuthorize } = yield* Authorize;
1817

19-
/**
20-
* Forward our request to AS
21-
*/
22-
const response = yield* handleAuthorize(headers, query);
18+
const response = yield* handleAuthorize(urlParams);
2319

24-
const { writeCookie } = yield* CookieService;
25-
/**
26-
* Write our cookies to send to the client
27-
*/
28-
const cookie = yield* writeCookie(headers);
29-
30-
return {
31-
...response,
32-
headers: {
33-
'Set-Cookie': toCookieHeader(cookie),
34-
},
35-
};
36-
}),
20+
return response.body;
21+
}),
22+
),
3723
);
3824

39-
export { authorizeHandler };
25+
export { AuthorizeHandlerMock };
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
import { HttpApiBuilder } from '@effect/platform';
2+
import { MockApi } from '../spec.js';
3+
import { Effect } from 'effect';
4+
5+
const HealthCheckLive = HttpApiBuilder.group(MockApi, 'Healthcheck', (handlers) =>
6+
handlers.handle('HealthCheck', () => Effect.succeed('Healthy')),
7+
);
8+
9+
export { HealthCheckLive };

0 commit comments

Comments
 (0)