Skip to content

Commit

Permalink
chore: Update GraphQL configuration shape to expect AI routes (#13799)
Browse files Browse the repository at this point in the history
* chore: Update GraphQL configuration shape to expect AI routes

* Bump minimum data-schema version

* Bump size limit
  • Loading branch information
cshfang authored Sep 12, 2024
1 parent a76b594 commit e2e3482
Show file tree
Hide file tree
Showing 4 changed files with 76 additions and 16 deletions.
2 changes: 1 addition & 1 deletion packages/api-graphql/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@
"dependencies": {
"@aws-amplify/api-rest": "4.0.47",
"@aws-amplify/core": "6.4.0",
"@aws-amplify/data-schema": "^1.0.0",
"@aws-amplify/data-schema": "^1.5.0",
"@aws-sdk/types": "3.387.0",
"graphql": "15.8.0",
"rxjs": "^7.8.1",
Expand Down
2 changes: 1 addition & 1 deletion packages/aws-amplify/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -335,7 +335,7 @@
"name": "[API] generateClient (AppSync)",
"path": "./dist/esm/api/index.mjs",
"import": "{ generateClient }",
"limit": "41.5 kB"
"limit": "43.1 kB"
},
{
"name": "[API] REST API handlers",
Expand Down
45 changes: 39 additions & 6 deletions packages/core/src/singleton/API/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -111,6 +111,8 @@ export interface ModelIntrospectionSchema {
queries?: CustomOperations;
mutations?: CustomOperations;
subscriptions?: CustomOperations;
conversations?: SchemaConversationRoutes;
generations?: SchemaGenerationRoutes;
}

/**
Expand All @@ -120,6 +122,27 @@ export type SchemaModels = Record<string, SchemaModel>;
export type SchemaNonModels = Record<string, SchemaNonModel>;
export type SchemaEnums = Record<string, SchemaEnum>;
export type CustomOperations = Record<string, CustomOperation>;
type SchemaConversationRoutes = Record<string, SchemaConversationRoute>;
type SchemaGenerationRoutes = Record<string, CustomOperation>;

interface SchemaConversationRoute {
name: string;
models: SchemaModels;
nonModels: SchemaNonModels;
enums: SchemaEnums;
conversation: SchemaConversation;
message: SchemaConversationMessage;
}

interface SchemaConversation {
modelName: string;
}

interface SchemaConversationMessage {
modelName: string;
subscribe: CustomOperation;
send: CustomOperation;
}

export interface SchemaModel {
name: string;
Expand Down Expand Up @@ -164,7 +187,7 @@ export type CustomOperationArguments = Record<string, CustomOperationArgument>;

export interface CustomOperationArgument {
name: string;
type: FieldType;
type: InputFieldType;
isArray: boolean;
isRequired: boolean;
isArrayNullable?: boolean;
Expand Down Expand Up @@ -192,7 +215,15 @@ export interface NonModelFieldType {
nonModel: string;
}

export type FieldType =
interface EnumType {
enum: string;
}

interface InputType {
input: string;
}

type ScalarType =
| 'ID'
| 'String'
| 'Int'
Expand All @@ -206,10 +237,12 @@ export type FieldType =
| 'AWSIPAddress'
| 'Boolean'
| 'AWSJSON'
| 'AWSPhone'
| { enum: string }
| ModelFieldType
| NonModelFieldType;
| 'AWSPhone';

type FieldType = ScalarType | EnumType | ModelFieldType | NonModelFieldType;

type InputFieldType = ScalarType | EnumType | InputType;

export type FieldAttribute = ModelAttribute;

/**
Expand Down
43 changes: 35 additions & 8 deletions yarn.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit e2e3482

Please sign in to comment.