feat(portal-shell): restore codegen typescript-operations for data-ana domain (P1-7)
ARCHITECTURE.md §10 P1-7: dashboard domain's 6 operations strictly match the schema, so disable skipDocumentsValidation for that output and restore per-operation type generation. Changes: - codegen.yml: add dashboard-types.ts output (typescript + typescript-operations plugins, skipDocumentsValidation: false); move documents config into each generates entry - dashboard.ts: remove 14 handwritten interfaces and 6 internal query type aliases; derive types via NonNullable<GetXxxQuery['xxx']> so the public hook API shape stays unchanged - admin/student/teacher page.tsx: add ?? "--" / ?? 0 null guards on StatCard value props to match schema nullable semantics (parent page already uses toFixed chain, no change needed) Acceptance (ARCHITECTURE.md §10 P1-7): - codegen 3 outputs all SUCCESS - tsc 0 errors / eslint 0 errors / vitest 231 passed / next build ok - 6 operations strictly match schema with 0 errors Refs: ARCHITECTURE.md §5.3 data layer / §10 P1-7
This commit is contained in:
@@ -10,14 +10,17 @@
|
||||
# - __generated__/types.ts: all GraphQL schema types (always generated)
|
||||
# - __generated__/operations.ts: DocumentNode constants emitted from
|
||||
# operations/*.graphql.ts via typescript-document-nodes plugin.
|
||||
# - __generated__/dashboard-types.ts: per-operation types for data-ana domain
|
||||
# (skipDocumentsValidation: false). Other domains still reference forward-looking
|
||||
# spec fields not yet in services subgraph SDL; they remain on the global
|
||||
# skipDocumentsValidation: true. As services catch up, additional per-domain
|
||||
# outputs can be added (config → core-edu → content → msg → iam order).
|
||||
#
|
||||
# Related: spec section 2.4
|
||||
# Related: spec section 2.4 / 5.3, ARCHITECTURE.md §10 P1-7
|
||||
|
||||
schema:
|
||||
- src/lib/api/__generated__/combined-schema.graphql
|
||||
|
||||
documents: src/lib/api/operations/**/*.graphql.ts
|
||||
|
||||
# Schema validation is skipped because services/ai subgraph has invalid input
|
||||
# types (ChatRequestInput.messages references output type ChatMessage; same
|
||||
# for ChatResponseInput.usage → Usage). normalize-schema.ts rewrites those
|
||||
@@ -28,6 +31,7 @@ generates:
|
||||
src/lib/api/__generated__/types.ts:
|
||||
plugins:
|
||||
- typescript
|
||||
|
||||
src/lib/api/__generated__/operations.ts:
|
||||
# typescript-document-nodes only: emits typed DocumentNode constants
|
||||
# from the gql templates in operations/*.graphql.ts. We deliberately
|
||||
@@ -35,9 +39,26 @@ generates:
|
||||
# forward-looking spec fields (grades, myClasses, lessonPlans, etc.)
|
||||
# that are not yet present in services subgraph SDL; once services
|
||||
# catch up we can re-add typescript-operations for full query typing.
|
||||
# Per-domain typed outputs (e.g. dashboard-types.ts) cover the
|
||||
# operations whose fields DO match the schema today (P1-7).
|
||||
documents: src/lib/api/operations/**/*.graphql.ts
|
||||
plugins:
|
||||
- typescript-document-nodes
|
||||
|
||||
# P1-7: data-ana domain (dashboard.graphql.ts) — skipDocumentsValidation
|
||||
# closed because all 6 operations strictly match the schema. Generates
|
||||
# per-operation types so lib/api/dashboard.ts can drop its hand-written
|
||||
# interfaces. Config domain closure deferred until LayoutTemplateGql
|
||||
# schema adds `availableSlots` (admin.graphql.ts GET_LAYOUT_TEMPLATES_DOC
|
||||
# queries that field but it is not yet in the subgraph SDL).
|
||||
src/lib/api/__generated__/dashboard-types.ts:
|
||||
documents: src/lib/api/operations/dashboard.graphql.ts
|
||||
plugins:
|
||||
- typescript
|
||||
- typescript-operations
|
||||
config:
|
||||
skipDocumentsValidation: false
|
||||
|
||||
config:
|
||||
preResolveTypes: true
|
||||
skipTypename: true
|
||||
@@ -49,8 +70,9 @@ config:
|
||||
# Skip document validation against schema. portal-shell widgets use spec
|
||||
# forward-looking fields (grades, myClasses, lessonPlans, etc.) not yet
|
||||
# implemented in services subgraph SDL. Without this flag, codegen would
|
||||
# emit 44 "Cannot query field X on type Query" errors and refuse to write
|
||||
# emit 44 "Cannot query Field X on type Query" errors and refuse to write
|
||||
# operations.ts. The runtime apollo-router validates documents at request
|
||||
# time, so skipping here only affects codegen-time type generation.
|
||||
# Once services catch up, remove this flag to re-enable validation.
|
||||
# Per-output overrides (see dashboard-types.ts above) close this flag for
|
||||
# specific domains whose operations DO match the schema (P1-7).
|
||||
skipDocumentsValidation: true
|
||||
|
||||
Reference in New Issue
Block a user