Skip to content

Commit fcf8ca1

Browse files
fix: codegen (#3568)
* fix: codegen * fix: codegen * fix: tsc checks * feat: update package version * fix: rebase --------- Co-authored-by: Webber Wang <webber@codelab.app>
1 parent 6d891e9 commit fcf8ca1

File tree

24 files changed

+3662
-3461
lines changed

24 files changed

+3662
-3461
lines changed

apps/api/webpack.config.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ const withRawCypherFiles = (config, ctx) => {
1212
}
1313

1414
// Nx plugins for webpack.
15-
module.exports = composePlugins(withNx(), withRawCypherFiles, (config) => {
15+
module.exports = composePlugins(withNx({}), withRawCypherFiles, (config) => {
1616
// Update the webpack config as needed here.
1717
// e.g. `config.plugins.push(new MyPlugin())`
1818

dist/apps/cli/main.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1539,7 +1539,7 @@ const bootstrap = async () => {
15391539
void bootstrap();
15401540

15411541
var __webpack_export_target__ = exports;
1542-
for(var i in __webpack_exports__) __webpack_export_target__[i] = __webpack_exports__[i];
1542+
for(var __webpack_i__ in __webpack_exports__) __webpack_export_target__[__webpack_i__] = __webpack_exports__[__webpack_i__];
15431543
if(__webpack_exports__.__esModule) Object.defineProperty(__webpack_export_target__, "__esModule", { value: true });
15441544
/******/ })()
15451545
;

knip.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
},
99
"ignore": [
1010
"dist",
11-
"libs/shared/infra/gql/**",
11+
"libs/shared/infra/gqlgen/**",
1212
"libs/backend/abstract/codegen/**",
1313
"libs/shared/abstract/core/**"
1414
],
Lines changed: 14 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1,25 +1,23 @@
1-
import type { Auth0IdToken, IUserDto } from '@codelab/shared/abstract/core'
1+
import type { Auth0IdToken } from '@codelab/shared/abstract/core'
22
import type { ExecutionContext } from '@nestjs/common'
33

44
import { User } from '@codelab/backend/domain/user'
55
import { createParamDecorator } from '@nestjs/common'
66
import { GqlExecutionContext } from '@nestjs/graphql'
77

8-
export const CurrentUser = createParamDecorator<
9-
unknown,
10-
ExecutionContext,
11-
IUserDto
12-
>((data: unknown, ctx: ExecutionContext) => {
13-
const gqlContext = GqlExecutionContext.create(ctx)
8+
export const CurrentUser = createParamDecorator<unknown, ExecutionContext>(
9+
(data: unknown, ctx: ExecutionContext) => {
10+
const gqlContext = GqlExecutionContext.create(ctx)
1411

15-
// Check if it's a GraphQL execution context
16-
if (gqlContext.getContext().req && gqlContext.getContext().res) {
17-
return gqlContext.getContext().user
18-
}
12+
// Check if it's a GraphQL execution context
13+
if (gqlContext.getContext().req && gqlContext.getContext().res) {
14+
return gqlContext.getContext().user
15+
}
1916

20-
// Otherwise assume it's a CLI execution context
21-
const httpContext = ctx.switchToHttp().getRequest()
22-
const userSession = httpContext.user as Auth0IdToken
17+
// Otherwise assume it's a CLI execution context
18+
const httpContext = ctx.switchToHttp().getRequest()
19+
const userSession = httpContext.user as Auth0IdToken
2320

24-
return User.fromSession(userSession)
25-
})
21+
return User.fromSession(userSession)
22+
},
23+
)

libs/frontend/domain/app/src/repositories/app.repository.ts

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,5 @@
11
import type { IAppDto, IRef } from '@codelab/shared/abstract/core'
2-
import type {
3-
AppOptions,
4-
AppUniqueWhere,
5-
AppWhere,
6-
} from '@codelab/shared/infra/gqlgen'
2+
import type { AppOptions, AppWhere } from '@codelab/shared/infra/gqlgen'
73

84
import {
95
CACHE_TAGS,
@@ -54,7 +50,8 @@ export const appRepository: IAppRepository = withTracingMethods('app', {
5450
)
5551
},
5652

57-
findOne: async (where: AppUniqueWhere) => {
53+
// FIXME: make a unique where
54+
findOne: async (where: AppWhere) => {
5855
return (await appRepository.find(where)).items[0]
5956
},
6057

libs/frontend/domain/atom/src/repositories/atom.repository.ts

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,7 @@
11
import type { IAtomRepository } from '@codelab/frontend/abstract/domain'
22
import type { IAtomDto, IRef } from '@codelab/shared/abstract/core'
33
import type { NextFetchOptions } from '@codelab/shared/abstract/types'
4-
import type {
5-
AtomOptions,
6-
AtomUniqueWhere,
7-
AtomWhere,
8-
} from '@codelab/shared/infra/gqlgen'
4+
import type { AtomOptions, AtomWhere } from '@codelab/shared/infra/gqlgen'
95

106
import {
117
CACHE_TAGS,
@@ -61,7 +57,8 @@ export const atomRepository: IAtomRepository = withTracingMethods('atom', {
6157
return await AtomList({ options, where }, { tags: [CACHE_TAGS.ATOM_LIST] })
6258
},
6359

64-
findOne: async (where: AtomUniqueWhere) => {
60+
// FIXME: make a unique where
61+
findOne: async (where: AtomWhere) => {
6562
return (await atomRepository.find(where)).items[0]
6663
},
6764

libs/frontend/domain/auth-guard/src/repositories/auth-guard.repository.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
import type { IAuthGuardDto, IRef } from '@codelab/shared/abstract/core'
22
import type {
33
AuthGuardOptions,
4-
AuthGuardUniqueWhere,
54
AuthGuardWhere,
65
} from '@codelab/shared/infra/gqlgen'
76

@@ -55,7 +54,8 @@ export const authGuardRepository: IAuthGuardRepository = {
5554
)
5655
},
5756

58-
findOne: async (where: AuthGuardUniqueWhere) => {
57+
// FIXME: make a unique where
58+
findOne: async (where: AuthGuardWhere) => {
5959
return (await authGuardRepository.find(where)).items[0]
6060
},
6161

libs/frontend/domain/component/src/repositories/component.repository.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@ import type { IComponentRepository } from '@codelab/frontend/abstract/domain'
22
import type { IComponentDto, IRef } from '@codelab/shared/abstract/core'
33
import type {
44
ComponentOptions,
5-
ComponentUniqueWhere,
65
ComponentWhere,
76
} from '@codelab/shared/infra/gqlgen'
87

@@ -55,7 +54,8 @@ export const componentRepository: IComponentRepository = {
5554
)
5655
},
5756

58-
findOne: async (where: ComponentUniqueWhere) => {
57+
// FIXME: make a unique where
58+
findOne: async (where: ComponentWhere) => {
5959
return (await componentRepository.find(where)).items[0]
6060
},
6161

libs/frontend/domain/domain/src/repositories/domain.repository.ts

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,5 @@
11
import type { IDomainDto, IRef } from '@codelab/shared/abstract/core'
2-
import type {
3-
DomainOptions,
4-
DomainUniqueWhere,
5-
DomainWhere,
6-
} from '@codelab/shared/infra/gqlgen'
2+
import type { DomainOptions, DomainWhere } from '@codelab/shared/infra/gqlgen'
73

84
import {
95
CACHE_TAGS,
@@ -56,7 +52,8 @@ export const domainRepository: IDomainRepository = {
5652
return DomainList({ options, where }, { tags: [CACHE_TAGS.DOMAIN_LIST] })
5753
},
5854

59-
findOne: async (where: DomainUniqueWhere) => {
55+
// FIXME: make a unique where
56+
findOne: async (where: DomainWhere) => {
6057
return (await domainRepository.find(where)).items[0]
6158
},
6259

libs/frontend/domain/element/src/repositories/element.repository.ts

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -3,11 +3,7 @@ import type {
33
IElementRepository,
44
} from '@codelab/frontend/abstract/domain'
55
import type { IElementDto } from '@codelab/shared/abstract/core'
6-
import type {
7-
ElementOptions,
8-
ElementUniqueWhere,
9-
ElementWhere,
10-
} from '@codelab/shared/infra/gqlgen'
6+
import type { ElementOptions, ElementWhere } from '@codelab/shared/infra/gqlgen'
117

128
import { disconnectAll, disconnectManyAll } from '@codelab/shared/domain/orm'
139
import { Validator } from '@codelab/shared/infra/typebox'
@@ -51,11 +47,13 @@ export const elementRepository: IElementRepository = {
5147
return await ElementList({ options, where })
5248
},
5349

54-
findOne: async (where: ElementUniqueWhere) => {
50+
// FIXME: make a unique where
51+
findOne: async (where: ElementWhere) => {
5552
return (await elementRepository.find(where)).items[0]
5653
},
5754

58-
update: async (where: ElementUniqueWhere, element: IElementDto) => {
55+
// FIXME: make a unique where
56+
update: async (where: ElementWhere, element: IElementDto) => {
5957
console.debug(elementMapper.toUpdateInput(element))
6058

6159
// Disconnect here first for pre/post, issue with generated cypher query

0 commit comments

Comments
 (0)