From e2e3482f421f89de9a50eb85a7c945e73cbabd2e Mon Sep 17 00:00:00 2001 From: Chris F <5827964+cshfang@users.noreply.github.com> Date: Thu, 12 Sep 2024 10:59:59 -0700 Subject: [PATCH] chore: Update GraphQL configuration shape to expect AI routes (#13799) * chore: Update GraphQL configuration shape to expect AI routes * Bump minimum data-schema version * Bump size limit --- packages/api-graphql/package.json | 2 +- packages/aws-amplify/package.json | 2 +- packages/core/src/singleton/API/types.ts | 45 ++++++++++++++++++++---- yarn.lock | 43 +++++++++++++++++----- 4 files changed, 76 insertions(+), 16 deletions(-) diff --git a/packages/api-graphql/package.json b/packages/api-graphql/package.json index ae98edafa95..7a6ed7ead52 100644 --- a/packages/api-graphql/package.json +++ b/packages/api-graphql/package.json @@ -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", diff --git a/packages/aws-amplify/package.json b/packages/aws-amplify/package.json index ceb48b8fa23..23885357eb9 100644 --- a/packages/aws-amplify/package.json +++ b/packages/aws-amplify/package.json @@ -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", diff --git a/packages/core/src/singleton/API/types.ts b/packages/core/src/singleton/API/types.ts index 20dd5bd3dfc..3909d264180 100644 --- a/packages/core/src/singleton/API/types.ts +++ b/packages/core/src/singleton/API/types.ts @@ -111,6 +111,8 @@ export interface ModelIntrospectionSchema { queries?: CustomOperations; mutations?: CustomOperations; subscriptions?: CustomOperations; + conversations?: SchemaConversationRoutes; + generations?: SchemaGenerationRoutes; } /** @@ -120,6 +122,27 @@ export type SchemaModels = Record; export type SchemaNonModels = Record; export type SchemaEnums = Record; export type CustomOperations = Record; +type SchemaConversationRoutes = Record; +type SchemaGenerationRoutes = Record; + +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; @@ -164,7 +187,7 @@ export type CustomOperationArguments = Record; export interface CustomOperationArgument { name: string; - type: FieldType; + type: InputFieldType; isArray: boolean; isRequired: boolean; isArrayNullable?: boolean; @@ -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' @@ -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; /** diff --git a/yarn.lock b/yarn.lock index e3e9b5f2400..93e4fffdea3 100644 --- a/yarn.lock +++ b/yarn.lock @@ -18,13 +18,15 @@ graphql "15.8.0" rxjs "^7.8.1" -"@aws-amplify/data-schema@^1.0.0": - version "1.3.10" - resolved "https://registry.yarnpkg.com/@aws-amplify/data-schema/-/data-schema-1.3.10.tgz#e83ef1d8d11efb821b282e499c373f64f3bf60ae" - integrity sha512-rUo6wb+DO6aGCSeSiB8wb92O4cEuN4sZBXn7TgqaYc8Bv4HutrLaIlptgXCYJMkaAp/h9rxyi6wIFJ7bEyD/6g== +"@aws-amplify/data-schema@^1.5.0": + version "1.5.1" + resolved "https://registry.yarnpkg.com/@aws-amplify/data-schema/-/data-schema-1.5.1.tgz#d9f2e263e10f7bd8dc9c1908a4ac0e795e581b7c" + integrity sha512-hFDqqwHqdoFazmvGOApCX8kqrdoum9YJikmAQN5tP2sgnCT++lqznFw2F4PPqDJRxhQP1AYuwhbbRBvGLMbs/w== dependencies: "@aws-amplify/data-schema-types" "*" + "@smithy/util-base64" "^3.0.0" "@types/aws-lambda" "^8.10.134" + "@types/json-schema" "^7.0.15" rxjs "^7.8.1" "@aws-crypto/crc32@3.0.0": @@ -5169,7 +5171,7 @@ "@types/tough-cookie" "*" parse5 "^7.0.0" -"@types/json-schema@*", "@types/json-schema@^7.0.12", "@types/json-schema@^7.0.5", "@types/json-schema@^7.0.8": +"@types/json-schema@*", "@types/json-schema@^7.0.12", "@types/json-schema@^7.0.15", "@types/json-schema@^7.0.5", "@types/json-schema@^7.0.8": version "7.0.15" resolved "https://registry.yarnpkg.com/@types/json-schema/-/json-schema-7.0.15.tgz#596a1747233694d50f6ad8a7869fcb6f56cf5841" integrity sha512-5+fP8P8MFNC+AyZCDxrB2pkZFPGzqQWUzpSeuuVLvm8VMcorNYavBqoFcxK8bQz4Qsbn4oUEEem4wDLfcysGHA== @@ -14505,7 +14507,16 @@ string-length@^4.0.1: char-regex "^1.0.2" strip-ansi "^6.0.0" -"string-width-cjs@npm:string-width@^4.2.0", "string-width@^1.0.2 || 2 || 3 || 4", string-width@^4.1.0, string-width@^4.2.0, string-width@^4.2.3: +"string-width-cjs@npm:string-width@^4.2.0": + version "4.2.3" + resolved "https://registry.yarnpkg.com/string-width/-/string-width-4.2.3.tgz#269c7117d27b05ad2e536830a8ec895ef9c6d010" + integrity sha512-wKyQRQpjJ0sIp62ErSZdGsjMJWsap5oRNihHhu6G7JVO/9jIB6UyevL+tXuOqrng8j/cxKTWyWUwvSTriiZz/g== + dependencies: + emoji-regex "^8.0.0" + is-fullwidth-code-point "^3.0.0" + strip-ansi "^6.0.1" + +"string-width@^1.0.2 || 2 || 3 || 4", string-width@^4.1.0, string-width@^4.2.0, string-width@^4.2.3: version "4.2.3" resolved "https://registry.yarnpkg.com/string-width/-/string-width-4.2.3.tgz#269c7117d27b05ad2e536830a8ec895ef9c6d010" integrity sha512-wKyQRQpjJ0sIp62ErSZdGsjMJWsap5oRNihHhu6G7JVO/9jIB6UyevL+tXuOqrng8j/cxKTWyWUwvSTriiZz/g== @@ -14583,7 +14594,7 @@ string_decoder@~1.1.1: dependencies: safe-buffer "~5.1.0" -"strip-ansi-cjs@npm:strip-ansi@^6.0.1", strip-ansi@^6.0.0, strip-ansi@^6.0.1: +"strip-ansi-cjs@npm:strip-ansi@^6.0.1": version "6.0.1" resolved "https://registry.yarnpkg.com/strip-ansi/-/strip-ansi-6.0.1.tgz#9e26c63d30f53443e9489495b2105d37b67a85d9" integrity sha512-Y38VPSHcqkFrCpFnQ9vuSXmquuv5oXOKpGeT6aGrr3o3Gc9AlVa6JBfUSOCnbxGGZF+/0ooI7KrPuUSztUdU5A== @@ -14597,6 +14608,13 @@ strip-ansi@^5.0.0, strip-ansi@^5.1.0, strip-ansi@^5.2.0: dependencies: ansi-regex "^4.1.0" +strip-ansi@^6.0.0, strip-ansi@^6.0.1: + version "6.0.1" + resolved "https://registry.yarnpkg.com/strip-ansi/-/strip-ansi-6.0.1.tgz#9e26c63d30f53443e9489495b2105d37b67a85d9" + integrity sha512-Y38VPSHcqkFrCpFnQ9vuSXmquuv5oXOKpGeT6aGrr3o3Gc9AlVa6JBfUSOCnbxGGZF+/0ooI7KrPuUSztUdU5A== + dependencies: + ansi-regex "^5.0.1" + strip-ansi@^7.0.1, strip-ansi@^7.1.0: version "7.1.0" resolved "https://registry.yarnpkg.com/strip-ansi/-/strip-ansi-7.1.0.tgz#d5b6568ca689d8561370b0707685d22434faff45" @@ -15734,7 +15752,7 @@ wordwrap@^1.0.0: resolved "https://registry.yarnpkg.com/wordwrap/-/wordwrap-1.0.0.tgz#27584810891456a4171c8d0226441ade90cbcaeb" integrity sha512-gvVzJFlPycKc5dZN4yPkP8w7Dc37BtP1yczEneOb4uq34pXZcvrtRTmWV8W+Ume+XCxKgbjM+nevkyFPMybd4Q== -"wrap-ansi-cjs@npm:wrap-ansi@^7.0.0", wrap-ansi@^7.0.0: +"wrap-ansi-cjs@npm:wrap-ansi@^7.0.0": version "7.0.0" resolved "https://registry.yarnpkg.com/wrap-ansi/-/wrap-ansi-7.0.0.tgz#67e145cff510a6a6984bdf1152911d69d2eb9e43" integrity sha512-YVGIj2kamLSTxw6NsZjoBxfSwsn0ycdesmc4p+Q21c5zPuZ1pl+NfxVdxPtdHvmNVOQ6XSYG4AUtyt/Fi7D16Q== @@ -15761,6 +15779,15 @@ wrap-ansi@^6.0.1, wrap-ansi@^6.2.0: string-width "^4.1.0" strip-ansi "^6.0.0" +wrap-ansi@^7.0.0: + version "7.0.0" + resolved "https://registry.yarnpkg.com/wrap-ansi/-/wrap-ansi-7.0.0.tgz#67e145cff510a6a6984bdf1152911d69d2eb9e43" + integrity sha512-YVGIj2kamLSTxw6NsZjoBxfSwsn0ycdesmc4p+Q21c5zPuZ1pl+NfxVdxPtdHvmNVOQ6XSYG4AUtyt/Fi7D16Q== + dependencies: + ansi-styles "^4.0.0" + string-width "^4.1.0" + strip-ansi "^6.0.0" + wrap-ansi@^8.1.0: version "8.1.0" resolved "https://registry.yarnpkg.com/wrap-ansi/-/wrap-ansi-8.1.0.tgz#56dc22368ee570face1b49819975d9b9a5ead214"