mirror of
https://github.com/stashapp/stash.git
synced 2025-12-18 04:44:37 +03:00
Improve client-side graphql scalar types (#4511)
* Add types to graphql scalars * Upgrade dependencies * Override UI config type * Remove all IUIConfig casts * Add tableColumns to IUIConfig * Add BoolMap type, set strictScalars * Add PluginConfigMap * Replace any with unknown * Add SavedObjectFilter and SavedUIOptions * Remove unused items from CriterionType
This commit is contained in:
42
ui/v2.5/codegen.ts
Normal file
42
ui/v2.5/codegen.ts
Normal file
@@ -0,0 +1,42 @@
|
||||
import type { CodegenConfig } from "@graphql-codegen/cli";
|
||||
|
||||
const config: CodegenConfig = {
|
||||
schema: [
|
||||
"../../graphql/schema/**/*.graphql",
|
||||
"graphql/client-schema.graphql",
|
||||
],
|
||||
config: {
|
||||
// makes conflicting fields override rather than error
|
||||
onFieldTypeConflict: (_existing: unknown, other: unknown) => other,
|
||||
},
|
||||
documents: "graphql/**/*.graphql",
|
||||
generates: {
|
||||
"src/core/generated-graphql.ts": {
|
||||
plugins: [
|
||||
"time",
|
||||
"typescript",
|
||||
"typescript-operations",
|
||||
"typescript-react-apollo",
|
||||
],
|
||||
config: {
|
||||
strictScalars: true,
|
||||
scalars: {
|
||||
Time: "string",
|
||||
Timestamp: "string",
|
||||
Map: "{ [key: string]: unknown }",
|
||||
BoolMap: "{ [key: string]: boolean }",
|
||||
PluginConfigMap: "{ [id: string]: { [key: string]: unknown } }",
|
||||
Any: "unknown",
|
||||
Int64: "number",
|
||||
Upload: "File",
|
||||
UIConfig: "src/core/config#IUIConfig",
|
||||
SavedObjectFilter: "src/models/list-filter/types#SavedObjectFilter",
|
||||
SavedUIOptions: "src/models/list-filter/types#SavedUIOptions",
|
||||
},
|
||||
withRefetchFn: true,
|
||||
},
|
||||
},
|
||||
},
|
||||
};
|
||||
|
||||
export default config;
|
||||
Reference in New Issue
Block a user