Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 15 additions & 2 deletions apps/hash-api/codegen.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,17 +13,30 @@ const config: CodegenConfig = {
noSchemaStitching: true,
},
},
"./src/graphql/schema-types.gen.ts": {
plugins: ["typescript", "typescript-resolvers"],
hooks: {
afterOneFileWrite: ["oxfmt --write --ignore-path /dev/null"],
},
config: {
noSchemaStitching: true,
...baseGraphQlCodegenConfig,
},
},
"./src/graphql/api-types.gen.ts": {
plugins: ["typescript", "typescript-resolvers", "typescript-operations"],
plugins: [
{ add: { content: 'export * from "./schema-types.gen";' } },
"typescript-operations",
],
documents: [
"../../libs/@local/hash-isomorphic-utils/src/graphql/queries/**/*.ts",
],
hooks: {
afterOneFileWrite: ["oxfmt --write --ignore-path /dev/null"],
},
config: {
noSchemaStitching: true,
...baseGraphQlCodegenConfig,
importSchemaTypesFrom: "./src/graphql/schema-types.gen.ts",
},
},
},
Expand Down
9 changes: 5 additions & 4 deletions apps/hash-api/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -113,10 +113,11 @@
},
"devDependencies": {
"@faker-js/faker": "10.5.0",
"@graphql-codegen/cli": "^6.2.1",
"@graphql-codegen/introspection": "5.0.1",
"@graphql-codegen/typescript": "5.0.9",
"@graphql-codegen/typescript-resolvers": "5.1.7",
"@graphql-codegen/add": "7.1.1",
"@graphql-codegen/cli": "^7.4.6",
"@graphql-codegen/introspection": "6.1.0",
"@graphql-codegen/typescript": "6.1.2",
"@graphql-codegen/typescript-resolvers": "6.1.1",
"@local/eslint": "workspace:*",
"@local/tsconfig": "workspace:*",
"@tsconfig/bases": "catalog:",
Expand Down
18 changes: 16 additions & 2 deletions apps/hash-frontend/codegen.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,13 +10,27 @@ const config: CodegenConfig = {
"./src/graphql/fragment-types.gen.json": {
plugins: ["fragment-matcher"],
},
"./src/graphql/schema-types.gen.ts": {
plugins: ["typescript"],
config: baseGraphQlCodegenConfig,
},
"./src/graphql/api-types.gen.ts": {
plugins: ["typescript", "typescript-operations"],
plugins: [
{ add: { content: 'export * from "./schema-types.gen";' } },
"typescript-operations",
],
documents: [
"./src/graphql/queries/**/*.ts",
"../../libs/@local/hash-isomorphic-utils/src/graphql/queries/**/*.ts",
],
config: baseGraphQlCodegenConfig,
config: {
...baseGraphQlCodegenConfig,
importSchemaTypesFrom: "./src/graphql/schema-types.gen.ts",
// Apollo Client adds `__typename` to every selection set except the
// root operation type.
nonOptionalTypename: true,
skipTypeNameForRoot: true,
},
},
},
};
Expand Down
9 changes: 5 additions & 4 deletions apps/hash-frontend/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -159,10 +159,11 @@
"zod": "4.4.3"
},
"devDependencies": {
"@graphql-codegen/cli": "^6.2.1",
"@graphql-codegen/fragment-matcher": "6.0.0",
"@graphql-codegen/typescript": "5.0.9",
"@graphql-codegen/typescript-operations": "5.0.9",
"@graphql-codegen/add": "7.1.1",
"@graphql-codegen/cli": "^7.4.6",
"@graphql-codegen/fragment-matcher": "7.1.0",
"@graphql-codegen/typescript": "6.1.2",
"@graphql-codegen/typescript-operations": "6.1.10",
"@local/eslint": "workspace:*",
"@local/tsconfig": "workspace:*",
"@next/bundle-analyzer": "16.3.8",
Expand Down
3 changes: 1 addition & 2 deletions apps/hash-frontend/src/pages/workers.page/flow-run-table.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,6 @@ import type {
import type { VirtualizedTableSort } from "../shared/virtualized-table/header/sort";
import type { EntityId, EntityUuid } from "@blockprotocol/type-system";
import type { Subtype } from "@local/advanced-types/subtype";
import type { FlowRun } from "@local/hash-isomorphic-utils/graphql/api-types.gen";

type FieldId =
| "web"
Expand Down Expand Up @@ -360,7 +359,7 @@ export const FlowRunTable = ({
const cost = usageByFlowRun[flowRunEntityId]?.total ?? null;

// Extract flowScheduleId if present (for scheduled runs)
const flowScheduleId = (flowRun as FlowRun).flowScheduleId ?? null;
const flowScheduleId = flowRun.flowScheduleId ?? null;

return {
id: flowRunEntityId,
Expand Down
14 changes: 12 additions & 2 deletions apps/plugin-browser/codegen.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,13 +10,23 @@ const config: CodegenConfig = {
"./src/graphql/fragment-types.gen.json": {
plugins: ["fragment-matcher"],
},
"./src/graphql/schema-types.gen.ts": {
plugins: ["typescript"],
config: baseGraphQlCodegenConfig,
},
"./src/graphql/api-types.gen.ts": {
plugins: ["typescript", "typescript-operations"],
plugins: [
{ add: { content: 'export * from "./schema-types.gen";' } },
"typescript-operations",
],
documents: [
"./src/graphql/queries/**/*.ts",
"../../libs/@local/hash-isomorphic-utils/src/graphql/queries/**/*.ts",
],
config: baseGraphQlCodegenConfig,
config: {
...baseGraphQlCodegenConfig,
importSchemaTypesFrom: "./src/graphql/schema-types.gen.ts",
},
},
},
};
Expand Down
3 changes: 2 additions & 1 deletion apps/plugin-browser/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,8 @@
"@babel/preset-env": "7.28.3",
"@babel/preset-react": "7.27.1",
"@blockprotocol/core": "0.1.5",
"@graphql-codegen/cli": "^6.2.1",
"@graphql-codegen/add": "7.1.1",
"@graphql-codegen/cli": "^7.4.6",
"@local/eslint": "workspace:*",
"@local/hash-graph-client": "workspace:*",
"@local/hash-isomorphic-utils": "workspace:*",
Expand Down
21 changes: 19 additions & 2 deletions libs/@local/hash-isomorphic-utils/codegen.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,13 +9,30 @@ const config: CodegenConfig = {
"./src/graphql/fragment-types.gen.json": {
plugins: ["fragment-matcher"],
},
"./src/graphql/schema-types.gen.ts": {
plugins: ["typescript"],
config: {
// Apollo Client adds `__typename` to every object in a response except
// the root operation type, so the generated types include it.
skipTypename: false,
// Use shared scalars
scalars: _localRelativeScalars,
},
},
"./src/graphql/api-types.gen.ts": {
plugins: ["typescript", "typescript-operations"],
plugins: [
{ add: { content: 'export * from "./schema-types.gen.js";' } },
"typescript-operations",
],
documents: ["./src/graphql/queries/**/*.ts"],
config: {
skipTypename: true,
// Use shared scalars
scalars: _localRelativeScalars,
importSchemaTypesFrom: "./src/graphql/schema-types.gen.ts",
importExtension: ".js",
// Match the `__typename` Apollo Client adds; see `skipTypename` above.
nonOptionalTypename: true,
skipTypeNameForRoot: true,
},
},
},
Expand Down
9 changes: 5 additions & 4 deletions libs/@local/hash-isomorphic-utils/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -58,10 +58,11 @@
},
"devDependencies": {
"@blockprotocol/type-system": "workspace:*",
"@graphql-codegen/cli": "^6.2.1",
"@graphql-codegen/fragment-matcher": "6.0.0",
"@graphql-codegen/typescript": "5.0.9",
"@graphql-codegen/typescript-operations": "5.0.9",
"@graphql-codegen/add": "7.1.1",
"@graphql-codegen/cli": "^7.4.6",
"@graphql-codegen/fragment-matcher": "7.1.0",
"@graphql-codegen/typescript": "6.1.2",
"@graphql-codegen/typescript-operations": "6.1.10",
"@local/eslint": "workspace:*",
"@local/tsconfig": "workspace:*",
"@temporalio/workflow": "1.20.2",
Expand Down
2 changes: 1 addition & 1 deletion libs/@local/hash-isomorphic-utils/src/graph-queries.ts
Original file line number Diff line number Diff line change
Expand Up @@ -227,7 +227,7 @@ export const mapGqlSubgraphFieldsFragmentToSubgraph = <
| Exclude<SubgraphRootType, EntityRootType>
| EntityRootType<HashEntity>,
>(
subgraph: SubgraphFieldsFragment,
subgraph: Omit<SubgraphFieldsFragment, "__typename">,
) => deserializeSubgraph<RootType>(subgraph);

export const notificationTypesToIgnore = [
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,10 @@
import { scalars } from "./scalar-mapping.js";

import type { TypeScriptPluginConfig } from "@graphql-codegen/typescript";
import type { TypeScriptDocumentsPluginConfig } from "@graphql-codegen/typescript-operations";

export const baseGraphQlCodegenConfig: TypeScriptDocumentsPluginConfig = {
export const baseGraphQlCodegenConfig: TypeScriptPluginConfig &
TypeScriptDocumentsPluginConfig = {
arrayInputCoercion: false,
avoidOptionals: {
defaultValue: true,
Expand Down
9 changes: 4 additions & 5 deletions tests/hash-backend-integration/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -31,11 +31,10 @@
"@apps/hash-ai-worker-ts": "workspace:*",
"@apps/hash-integration-worker": "workspace:*",
"@blockprotocol/graph": "workspace:*",
"@graphql-codegen/cli": "^6.2.1",
"@graphql-codegen/introspection": "5.0.1",
"@graphql-codegen/typescript": "5.0.9",
"@graphql-codegen/typescript-graphql-request": "7.0.0",
"@graphql-codegen/typescript-resolvers": "5.1.7",
"@graphql-codegen/cli": "^7.4.6",
"@graphql-codegen/introspection": "6.1.0",
"@graphql-codegen/typescript": "6.1.2",
"@graphql-codegen/typescript-resolvers": "6.1.1",
"@local/eslint": "workspace:*",
"@local/tsconfig": "workspace:*",
"@tsconfig/bases": "catalog:",
Expand Down
14 changes: 12 additions & 2 deletions tests/hash-playwright/codegen.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,13 +10,23 @@ const config: CodegenConfig = {
"./tests/graphql/fragment-types.gen.json": {
plugins: ["fragment-matcher"],
},
"./tests/graphql/schema-types.gen.ts": {
plugins: ["typescript"],
config: baseGraphQlCodegenConfig,
},
"./tests/graphql/api-types.gen.ts": {
plugins: ["typescript", "typescript-operations"],
plugins: [
{ add: { content: 'export * from "./schema-types.gen";' } },
"typescript-operations",
],
documents: [
"./tests/graphql/queries/**/*.ts",
"../../libs/@local/hash-isomorphic-utils/src/graphql/queries/**/*.ts",
],
config: baseGraphQlCodegenConfig,
config: {
...baseGraphQlCodegenConfig,
importSchemaTypesFrom: "./tests/graphql/schema-types.gen.ts",
},
},
},
};
Expand Down
3 changes: 2 additions & 1 deletion tests/hash-playwright/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,8 @@
"@apps/hash-frontend": "workspace:*",
"@apps/plugin-browser": "workspace:*",
"@blockprotocol/graph": "workspace:*",
"@graphql-codegen/cli": "^6.2.1",
"@graphql-codegen/add": "7.1.1",
"@graphql-codegen/cli": "^7.4.6",
"@local/eslint": "workspace:*",
"@tsconfig/bases": "catalog:",
"@types/chrome": "0.1.40",
Expand Down
Loading
Loading