Files
api/web/codegen.ts
Eli Bosley 586653ccc1 chore: add a prefix scalar instead of prefix plugin (#1361)
<!-- This is an auto-generated comment: release notes by coderabbit.ai
-->
## Summary by CodeRabbit

- **New Features**
- Introduced a new `PrefixedID` scalar type for all GraphQL IDs,
ensuring unique identifiers across multiple servers by prefixing IDs
with a server identifier.
- Added detailed documentation for the `PrefixedID` scalar in the API
schema.
- Grouped VM and parity check mutations under dedicated fields for
better organization.
- Added new scalar `Port` and input type `AccessUrlInput` for improved
type safety.

- **Refactor**
- Replaced all usages of standard `ID` or `String` with `PrefixedID` for
IDs in queries, mutations, and models.
- Consolidated ID handling by extending a common `Node` base class
across models, removing redundant `id` declarations.
- Updated GraphQL argument types and resolver signatures to explicitly
use `PrefixedID`.
- Updated GraphQL code generation to map `PrefixedID` to TypeScript
`string`.

- **Bug Fixes**
- Enhanced test assertions to verify API key creation timestamps are
strings.
  - Fixed internal property naming for registration ID.

- **Chores**
- Removed legacy ID prefix Apollo Server plugin in favor of the new
scalar approach.
  - Cleaned up imports and unused fields related to ID handling.
<!-- end of auto-generated comment: release notes by coderabbit.ai -->

---------

Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com>
2025-04-29 12:22:18 -04:00

44 lines
810 B
TypeScript

import type { CodegenConfig } from '@graphql-codegen/cli';
const config: CodegenConfig = {
overwrite: true,
documents: ['./**/**/*.ts'],
ignoreNoDocuments: false,
config: {
namingConvention: {
enumValues: 'change-case-all#upperCase',
transformUnderscore: true,
},
scalars: {
DateTime: 'string',
Long: 'number',
JSON: 'any',
URL: 'URL',
Port: 'number',
UUID: 'string',
PrefixedID: 'string',
},
},
generates: {
'composables/gql/': {
preset: 'client',
config: {
useTypeImports: true,
},
schema: '../api/generated-schema.graphql',
plugins: [
{
add: {
content: '/* eslint-disable */',
},
},
],
},
},
};
export default config;