@aws-amplify/graphql-api-construct 1.15.1-ai-streaming.5 → 1.15.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (154) hide show
  1. package/.jsii +19 -19
  2. package/CHANGELOG.md +5 -19
  3. package/lib/amplify-dynamodb-table-wrapper.js +1 -1
  4. package/lib/amplify-graphql-api.js +1 -1
  5. package/lib/amplify-graphql-definition.js +1 -1
  6. package/lib/sql-model-datasource-strategy.js +1 -1
  7. package/node_modules/@aws-amplify/ai-constructs/lib/conversation/conversation_handler_construct.d.ts +1 -12
  8. package/node_modules/@aws-amplify/ai-constructs/lib/conversation/conversation_handler_construct.js +2 -22
  9. package/node_modules/@aws-amplify/ai-constructs/lib/conversation/index.d.ts +2 -2
  10. package/node_modules/@aws-amplify/ai-constructs/lib/conversation/index.js +1 -1
  11. package/node_modules/@aws-amplify/ai-constructs/lib/conversation/runtime/bedrock_converse_adapter.d.ts +2 -8
  12. package/node_modules/@aws-amplify/ai-constructs/lib/conversation/runtime/bedrock_converse_adapter.js +34 -195
  13. package/node_modules/@aws-amplify/ai-constructs/lib/conversation/runtime/conversation_message_history_retriever.js +3 -19
  14. package/node_modules/@aws-amplify/ai-constructs/lib/conversation/runtime/conversation_turn_executor.d.ts +3 -5
  15. package/node_modules/@aws-amplify/ai-constructs/lib/conversation/runtime/conversation_turn_executor.js +5 -20
  16. package/node_modules/@aws-amplify/ai-constructs/lib/conversation/runtime/conversation_turn_response_sender.d.ts +1 -3
  17. package/node_modules/@aws-amplify/ai-constructs/lib/conversation/runtime/conversation_turn_response_sender.js +7 -6
  18. package/node_modules/@aws-amplify/ai-constructs/lib/conversation/runtime/default_handler.d.ts +1 -1
  19. package/node_modules/@aws-amplify/ai-constructs/lib/conversation/runtime/event-tools-provider/event_tools_provider.js +2 -2
  20. package/node_modules/@aws-amplify/ai-constructs/lib/conversation/runtime/event-tools-provider/graphql_tool.d.ts +7 -7
  21. package/node_modules/@aws-amplify/ai-constructs/lib/conversation/runtime/event-tools-provider/graphql_tool.js +2 -3
  22. package/node_modules/@aws-amplify/ai-constructs/lib/conversation/runtime/graphql_request_executor.d.ts +1 -2
  23. package/node_modules/@aws-amplify/ai-constructs/lib/conversation/runtime/graphql_request_executor.js +2 -4
  24. package/node_modules/@aws-amplify/ai-constructs/lib/conversation/runtime/index.d.ts +2 -3
  25. package/node_modules/@aws-amplify/ai-constructs/lib/conversation/runtime/index.js +2 -4
  26. package/node_modules/@aws-amplify/ai-constructs/lib/conversation/runtime/types.d.ts +10 -32
  27. package/node_modules/@aws-amplify/ai-constructs/lib/conversation/runtime/types.js +1 -1
  28. package/node_modules/@aws-amplify/ai-constructs/package.json +2 -9
  29. package/node_modules/@aws-amplify/graphql-auth-transformer/CHANGELOG.md +4 -0
  30. package/node_modules/@aws-amplify/graphql-auth-transformer/LICENSE +201 -0
  31. package/node_modules/@aws-amplify/graphql-auth-transformer/package.json +12 -11
  32. package/node_modules/@aws-amplify/graphql-conversation-transformer/API.md +2 -0
  33. package/node_modules/@aws-amplify/graphql-conversation-transformer/CHANGELOG.md +3 -23
  34. package/node_modules/@aws-amplify/graphql-conversation-transformer/lib/graphql-types/message-model.d.ts +0 -3
  35. package/node_modules/@aws-amplify/graphql-conversation-transformer/lib/graphql-types/message-model.d.ts.map +1 -1
  36. package/node_modules/@aws-amplify/graphql-conversation-transformer/lib/graphql-types/message-model.js +5 -53
  37. package/node_modules/@aws-amplify/graphql-conversation-transformer/lib/graphql-types/message-model.js.map +1 -1
  38. package/node_modules/@aws-amplify/graphql-conversation-transformer/lib/grapqhl-conversation-transformer.d.ts +6 -0
  39. package/node_modules/@aws-amplify/graphql-conversation-transformer/lib/grapqhl-conversation-transformer.d.ts.map +1 -1
  40. package/node_modules/@aws-amplify/graphql-conversation-transformer/lib/grapqhl-conversation-transformer.js +40 -6
  41. package/node_modules/@aws-amplify/graphql-conversation-transformer/lib/grapqhl-conversation-transformer.js.map +1 -1
  42. package/node_modules/@aws-amplify/graphql-conversation-transformer/lib/resolvers/invoke-lambda-resolver-fn.template.js +1 -14
  43. package/node_modules/@aws-amplify/graphql-conversation-transformer/lib/resolvers/invoke-lambda-resolver.d.ts.map +1 -1
  44. package/node_modules/@aws-amplify/graphql-conversation-transformer/lib/resolvers/invoke-lambda-resolver.js +1 -8
  45. package/node_modules/@aws-amplify/graphql-conversation-transformer/lib/resolvers/invoke-lambda-resolver.js.map +1 -1
  46. package/node_modules/@aws-amplify/graphql-conversation-transformer/lib/transformer-steps/conversation-prepare-handler.d.ts.map +1 -1
  47. package/node_modules/@aws-amplify/graphql-conversation-transformer/lib/transformer-steps/conversation-prepare-handler.js +2 -3
  48. package/node_modules/@aws-amplify/graphql-conversation-transformer/lib/transformer-steps/conversation-prepare-handler.js.map +1 -1
  49. package/node_modules/@aws-amplify/graphql-conversation-transformer/lib/transformer-steps/conversation-resolver-generator.d.ts +0 -1
  50. package/node_modules/@aws-amplify/graphql-conversation-transformer/lib/transformer-steps/conversation-resolver-generator.d.ts.map +1 -1
  51. package/node_modules/@aws-amplify/graphql-conversation-transformer/lib/transformer-steps/conversation-resolver-generator.js +4 -20
  52. package/node_modules/@aws-amplify/graphql-conversation-transformer/lib/transformer-steps/conversation-resolver-generator.js.map +1 -1
  53. package/node_modules/@aws-amplify/graphql-conversation-transformer/package.json +11 -10
  54. package/node_modules/@aws-amplify/graphql-default-value-transformer/CHANGELOG.md +4 -0
  55. package/node_modules/@aws-amplify/graphql-default-value-transformer/LICENSE +201 -0
  56. package/node_modules/@aws-amplify/graphql-default-value-transformer/package.json +7 -6
  57. package/node_modules/@aws-amplify/graphql-directives/CHANGELOG.md +6 -0
  58. package/node_modules/@aws-amplify/graphql-directives/LICENSE +201 -0
  59. package/node_modules/@aws-amplify/graphql-directives/lib/directives/conversation.d.ts.map +1 -1
  60. package/node_modules/@aws-amplify/graphql-directives/lib/directives/conversation.js +6 -0
  61. package/node_modules/@aws-amplify/graphql-directives/lib/directives/conversation.js.map +1 -1
  62. package/node_modules/@aws-amplify/graphql-directives/package.json +3 -2
  63. package/node_modules/@aws-amplify/graphql-function-transformer/CHANGELOG.md +4 -0
  64. package/node_modules/@aws-amplify/graphql-function-transformer/LICENSE +201 -0
  65. package/node_modules/@aws-amplify/graphql-function-transformer/package.json +6 -5
  66. package/node_modules/@aws-amplify/graphql-generation-transformer/CHANGELOG.md +4 -0
  67. package/node_modules/@aws-amplify/graphql-generation-transformer/LICENSE +201 -0
  68. package/node_modules/@aws-amplify/graphql-generation-transformer/package.json +6 -5
  69. package/node_modules/@aws-amplify/graphql-http-transformer/CHANGELOG.md +4 -0
  70. package/node_modules/@aws-amplify/graphql-http-transformer/LICENSE +201 -0
  71. package/node_modules/@aws-amplify/graphql-http-transformer/package.json +6 -5
  72. package/node_modules/@aws-amplify/graphql-index-transformer/CHANGELOG.md +4 -0
  73. package/node_modules/@aws-amplify/graphql-index-transformer/LICENSE +201 -0
  74. package/node_modules/@aws-amplify/graphql-index-transformer/package.json +7 -6
  75. package/node_modules/@aws-amplify/graphql-maps-to-transformer/CHANGELOG.md +4 -0
  76. package/node_modules/@aws-amplify/graphql-maps-to-transformer/LICENSE +201 -0
  77. package/node_modules/@aws-amplify/graphql-maps-to-transformer/lib/assets/mapping-lambda.zip +0 -0
  78. package/node_modules/@aws-amplify/graphql-maps-to-transformer/package.json +10 -9
  79. package/node_modules/@aws-amplify/graphql-model-transformer/CHANGELOG.md +4 -0
  80. package/node_modules/@aws-amplify/graphql-model-transformer/LICENSE +201 -0
  81. package/node_modules/@aws-amplify/graphql-model-transformer/lib/rds-lambda.zip +0 -0
  82. package/node_modules/@aws-amplify/graphql-model-transformer/lib/rds-notification-lambda.zip +0 -0
  83. package/node_modules/@aws-amplify/graphql-model-transformer/lib/rds-patching-lambda.zip +0 -0
  84. package/node_modules/@aws-amplify/graphql-model-transformer/package.json +6 -5
  85. package/node_modules/@aws-amplify/graphql-predictions-transformer/CHANGELOG.md +4 -0
  86. package/node_modules/@aws-amplify/graphql-predictions-transformer/LICENSE +201 -0
  87. package/node_modules/@aws-amplify/graphql-predictions-transformer/lib/predictionsLambdaFunction.zip +0 -0
  88. package/node_modules/@aws-amplify/graphql-predictions-transformer/package.json +6 -5
  89. package/node_modules/@aws-amplify/graphql-relational-transformer/CHANGELOG.md +4 -0
  90. package/node_modules/@aws-amplify/graphql-relational-transformer/LICENSE +201 -0
  91. package/node_modules/@aws-amplify/graphql-relational-transformer/package.json +8 -7
  92. package/node_modules/@aws-amplify/graphql-searchable-transformer/CHANGELOG.md +4 -0
  93. package/node_modules/@aws-amplify/graphql-searchable-transformer/LICENSE +201 -0
  94. package/node_modules/@aws-amplify/graphql-searchable-transformer/lib/streaming-lambda.zip +0 -0
  95. package/node_modules/@aws-amplify/graphql-searchable-transformer/package.json +7 -6
  96. package/node_modules/@aws-amplify/graphql-sql-transformer/CHANGELOG.md +4 -0
  97. package/node_modules/@aws-amplify/graphql-sql-transformer/LICENSE +201 -0
  98. package/node_modules/@aws-amplify/graphql-sql-transformer/package.json +7 -6
  99. package/node_modules/@aws-amplify/graphql-transformer/CHANGELOG.md +1 -21
  100. package/node_modules/@aws-amplify/graphql-transformer/package.json +17 -17
  101. package/node_modules/@aws-amplify/graphql-transformer-core/CHANGELOG.md +4 -0
  102. package/node_modules/@aws-amplify/graphql-transformer-core/LICENSE +201 -0
  103. package/node_modules/@aws-amplify/graphql-transformer-core/package.json +4 -3
  104. package/package.json +20 -20
  105. package/node_modules/@aws-amplify/ai-constructs/lib/conversation/runtime/conversation_turn_streaming_response_sender.d.ts +0 -19
  106. package/node_modules/@aws-amplify/ai-constructs/lib/conversation/runtime/conversation_turn_streaming_response_sender.js +0 -38
  107. package/node_modules/@aws-amplify/ai-constructs/lib/conversation/runtime/executable_tool_factory.d.ts +0 -7
  108. package/node_modules/@aws-amplify/ai-constructs/lib/conversation/runtime/executable_tool_factory.js +0 -16
  109. package/node_modules/@aws-amplify/ai-constructs/node_modules/@aws-amplify/backend-output-schemas/README.md +0 -4
  110. package/node_modules/@aws-amplify/ai-constructs/node_modules/@aws-amplify/backend-output-schemas/lib/ai/conversation/index.d.ts +0 -23
  111. package/node_modules/@aws-amplify/ai-constructs/node_modules/@aws-amplify/backend-output-schemas/lib/ai/conversation/index.js +0 -10
  112. package/node_modules/@aws-amplify/ai-constructs/node_modules/@aws-amplify/backend-output-schemas/lib/ai/conversation/v1.d.ts +0 -22
  113. package/node_modules/@aws-amplify/ai-constructs/node_modules/@aws-amplify/backend-output-schemas/lib/ai/conversation/v1.js +0 -11
  114. package/node_modules/@aws-amplify/ai-constructs/node_modules/@aws-amplify/backend-output-schemas/lib/auth/index.d.ts +0 -113
  115. package/node_modules/@aws-amplify/ai-constructs/node_modules/@aws-amplify/backend-output-schemas/lib/auth/index.js +0 -10
  116. package/node_modules/@aws-amplify/ai-constructs/node_modules/@aws-amplify/backend-output-schemas/lib/auth/v1.d.ts +0 -112
  117. package/node_modules/@aws-amplify/ai-constructs/node_modules/@aws-amplify/backend-output-schemas/lib/auth/v1.js +0 -30
  118. package/node_modules/@aws-amplify/ai-constructs/node_modules/@aws-amplify/backend-output-schemas/lib/custom/index.d.ts +0 -23
  119. package/node_modules/@aws-amplify/ai-constructs/node_modules/@aws-amplify/backend-output-schemas/lib/custom/index.js +0 -10
  120. package/node_modules/@aws-amplify/ai-constructs/node_modules/@aws-amplify/backend-output-schemas/lib/custom/v1.d.ts +0 -22
  121. package/node_modules/@aws-amplify/ai-constructs/node_modules/@aws-amplify/backend-output-schemas/lib/custom/v1.js +0 -11
  122. package/node_modules/@aws-amplify/ai-constructs/node_modules/@aws-amplify/backend-output-schemas/lib/function/index.d.ts +0 -23
  123. package/node_modules/@aws-amplify/ai-constructs/node_modules/@aws-amplify/backend-output-schemas/lib/function/index.js +0 -10
  124. package/node_modules/@aws-amplify/ai-constructs/node_modules/@aws-amplify/backend-output-schemas/lib/function/v1.d.ts +0 -22
  125. package/node_modules/@aws-amplify/ai-constructs/node_modules/@aws-amplify/backend-output-schemas/lib/function/v1.js +0 -11
  126. package/node_modules/@aws-amplify/ai-constructs/node_modules/@aws-amplify/backend-output-schemas/lib/graphql/index.d.ts +0 -59
  127. package/node_modules/@aws-amplify/ai-constructs/node_modules/@aws-amplify/backend-output-schemas/lib/graphql/index.js +0 -12
  128. package/node_modules/@aws-amplify/ai-constructs/node_modules/@aws-amplify/backend-output-schemas/lib/graphql/v1.d.ts +0 -59
  129. package/node_modules/@aws-amplify/ai-constructs/node_modules/@aws-amplify/backend-output-schemas/lib/graphql/v1.js +0 -25
  130. package/node_modules/@aws-amplify/ai-constructs/node_modules/@aws-amplify/backend-output-schemas/lib/index.d.ts +0 -508
  131. package/node_modules/@aws-amplify/ai-constructs/node_modules/@aws-amplify/backend-output-schemas/lib/index.js +0 -112
  132. package/node_modules/@aws-amplify/ai-constructs/node_modules/@aws-amplify/backend-output-schemas/lib/platform/index.d.ts +0 -2
  133. package/node_modules/@aws-amplify/ai-constructs/node_modules/@aws-amplify/backend-output-schemas/lib/platform/index.js +0 -18
  134. package/node_modules/@aws-amplify/ai-constructs/node_modules/@aws-amplify/backend-output-schemas/lib/platform/stack_metadata_schemas.d.ts +0 -42
  135. package/node_modules/@aws-amplify/ai-constructs/node_modules/@aws-amplify/backend-output-schemas/lib/platform/stack_metadata_schemas.js +0 -22
  136. package/node_modules/@aws-amplify/ai-constructs/node_modules/@aws-amplify/backend-output-schemas/lib/stack/index.d.ts +0 -28
  137. package/node_modules/@aws-amplify/ai-constructs/node_modules/@aws-amplify/backend-output-schemas/lib/stack/index.js +0 -10
  138. package/node_modules/@aws-amplify/ai-constructs/node_modules/@aws-amplify/backend-output-schemas/lib/stack/v1.d.ts +0 -27
  139. package/node_modules/@aws-amplify/ai-constructs/node_modules/@aws-amplify/backend-output-schemas/lib/stack/v1.js +0 -12
  140. package/node_modules/@aws-amplify/ai-constructs/node_modules/@aws-amplify/backend-output-schemas/lib/storage/index.d.ts +0 -33
  141. package/node_modules/@aws-amplify/ai-constructs/node_modules/@aws-amplify/backend-output-schemas/lib/storage/index.js +0 -10
  142. package/node_modules/@aws-amplify/ai-constructs/node_modules/@aws-amplify/backend-output-schemas/lib/storage/v1.d.ts +0 -32
  143. package/node_modules/@aws-amplify/ai-constructs/node_modules/@aws-amplify/backend-output-schemas/lib/storage/v1.js +0 -33
  144. package/node_modules/@aws-amplify/ai-constructs/node_modules/@aws-amplify/backend-output-schemas/package.json +0 -27
  145. package/node_modules/@aws-amplify/graphql-conversation-transformer/lib/resolvers/assistant-streaming-mutation-reduce-chunks-resolver-fn.template.js +0 -105
  146. package/node_modules/@aws-amplify/graphql-conversation-transformer/lib/resolvers/assistant-streaming-mutation-reduce-chunks-resolver.d.ts +0 -4
  147. package/node_modules/@aws-amplify/graphql-conversation-transformer/lib/resolvers/assistant-streaming-mutation-reduce-chunks-resolver.d.ts.map +0 -1
  148. package/node_modules/@aws-amplify/graphql-conversation-transformer/lib/resolvers/assistant-streaming-mutation-reduce-chunks-resolver.js +0 -25
  149. package/node_modules/@aws-amplify/graphql-conversation-transformer/lib/resolvers/assistant-streaming-mutation-reduce-chunks-resolver.js.map +0 -1
  150. package/node_modules/@aws-amplify/graphql-conversation-transformer/lib/resolvers/assistant-streaming-mutation-resolver-fn.template.js +0 -114
  151. package/node_modules/@aws-amplify/graphql-conversation-transformer/lib/resolvers/assistant-streaming-mutation-resolver.d.ts +0 -4
  152. package/node_modules/@aws-amplify/graphql-conversation-transformer/lib/resolvers/assistant-streaming-mutation-resolver.d.ts.map +0 -1
  153. package/node_modules/@aws-amplify/graphql-conversation-transformer/lib/resolvers/assistant-streaming-mutation-resolver.js +0 -25
  154. package/node_modules/@aws-amplify/graphql-conversation-transformer/lib/resolvers/assistant-streaming-mutation-resolver.js.map +0 -1
@@ -1,42 +0,0 @@
1
- import { z } from 'zod';
2
- /**
3
- * The types here are meant to be used internally when reading / writing backend output to stack metadata.
4
- *
5
- * They represent broader metadata types than the category-specific metadata objects that allows the platform to interact with metadata in a category-agnostic way
6
- * They should not be exposed in public APIs (although they currently are under the "platform" submodule export so they can be consumed by both the backend and client-config packages
7
- */
8
- /**
9
- * Data schema for storing a backend output entry using stack metadata
10
- */
11
- export declare const backendOutputEntryStackMetadataSchema: z.ZodObject<{
12
- version: z.ZodString;
13
- stackOutputs: z.ZodArray<z.ZodString, "many">;
14
- }, "strip", z.ZodTypeAny, {
15
- version: string;
16
- stackOutputs: string[];
17
- }, {
18
- version: string;
19
- stackOutputs: string[];
20
- }>;
21
- /**
22
- * Inferred type from backendOutputEntryStackMetadataSchema
23
- */
24
- export type BackendOutputEntryStackMetadata = z.infer<typeof backendOutputEntryStackMetadataSchema>;
25
- /**
26
- * Data schema for storing backend output using stack metadata
27
- */
28
- export declare const backendOutputStackMetadataSchema: z.ZodRecord<z.ZodString, z.ZodObject<{
29
- version: z.ZodString;
30
- stackOutputs: z.ZodArray<z.ZodString, "many">;
31
- }, "strip", z.ZodTypeAny, {
32
- version: string;
33
- stackOutputs: string[];
34
- }, {
35
- version: string;
36
- stackOutputs: string[];
37
- }>>;
38
- /**
39
- * Inferred type from backendOutputStackMetadataSchema
40
- */
41
- export type BackendOutputStackMetadata = z.infer<typeof backendOutputStackMetadataSchema>;
42
- //# sourceMappingURL=stack_metadata_schemas.d.ts.map
@@ -1,22 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.backendOutputStackMetadataSchema = exports.backendOutputEntryStackMetadataSchema = void 0;
4
- const zod_1 = require("zod");
5
- /**
6
- * The types here are meant to be used internally when reading / writing backend output to stack metadata.
7
- *
8
- * They represent broader metadata types than the category-specific metadata objects that allows the platform to interact with metadata in a category-agnostic way
9
- * They should not be exposed in public APIs (although they currently are under the "platform" submodule export so they can be consumed by both the backend and client-config packages
10
- */
11
- /**
12
- * Data schema for storing a backend output entry using stack metadata
13
- */
14
- exports.backendOutputEntryStackMetadataSchema = zod_1.z.object({
15
- version: zod_1.z.string(),
16
- stackOutputs: zod_1.z.array(zod_1.z.string()),
17
- });
18
- /**
19
- * Data schema for storing backend output using stack metadata
20
- */
21
- exports.backendOutputStackMetadataS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RwdXRTdGFja01ldGFkYXRhU2NoZW1hXG4gKi9cbmV4cG9ydCB0eXBlIEJhY2tlbmRPdXRwdXRTdGFja01ldGFkYXRhID0gei5pbmZlcjxcbiAgdHlwZW9mIGJhY2tlbmRPdXRwdXRTdGFja01ldGFkYXRhU2NoZW1hXG4+O1xuIl19
@@ -1,28 +0,0 @@
1
- import { z } from 'zod';
2
- export declare const versionedStackOutputSchema: z.ZodDiscriminatedUnion<"version", [z.ZodObject<{
3
- version: z.ZodLiteral<"1">;
4
- payload: z.ZodObject<{
5
- deploymentType: z.ZodString;
6
- region: z.ZodString;
7
- }, "strip", z.ZodTypeAny, {
8
- deploymentType: string;
9
- region: string;
10
- }, {
11
- deploymentType: string;
12
- region: string;
13
- }>;
14
- }, "strip", z.ZodTypeAny, {
15
- version: "1";
16
- payload: {
17
- deploymentType: string;
18
- region: string;
19
- };
20
- }, {
21
- version: "1";
22
- payload: {
23
- deploymentType: string;
24
- region: string;
25
- };
26
- }>]>;
27
- export type StackOutput = z.infer<typeof versionedStackOutputSchema>;
28
- //# sourceMappingURL=index.d.ts.map
@@ -1,10 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.versionedStackOutputSchema = void 0;
4
- const zod_1 = require("zod");
5
- const v1_js_1 = require("./v1.js");
6
- exports.versionedStackOutputSchema = zod_1.z.discriminatedUnion('version', [
7
- v1_js_1.stackOutputSchema,
8
- // this is where additional stack major version schemas would go
9
- ]);
10
- //# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiaW5kZXguanMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyIuLi8uLi9zcmMvc3RhY2svaW5kZXgudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6Ijs7O0FBQUEsNkJBQXdCO0FBQ3hCLG1DQUFtRTtBQUV0RCxRQUFBLDBCQUEwQixHQUFHLE9BQUMsQ0FBQyxrQkFBa0IsQ0FBQyxTQUFTLEVBQUU7SUFDeEUseUJBQW1CO0lBQ25CLGdFQUFnRTtDQUNqRSxDQUFDLENBQUMiLCJzb3VyY2VzQ29udGVudCI6WyJpbXBvcnQgeyB6IH0gZnJvbSAnem9kJztcbmltcG9ydCB7IHN0YWNrT3V0cHV0U2NoZW1hIGFzIHN0YWNrT3V0cHV0U2NoZW1hVjEgfSBmcm9tICcuL3YxLmpzJztcblxuZXhwb3J0IGNvbnN0IHZlcnNpb25lZFN0YWNrT3V0cHV0U2NoZW1hID0gei5kaXNjcmltaW5hdGVkVW5pb24oJ3ZlcnNpb24nLCBbXG4gIHN0YWNrT3V0cHV0U2NoZW1hVjEsXG4gIC8vIHRoaXMgaXMgd2hlcmUgYWRkaXRpb25hbCBzdGFjayBtYWpvciB2ZXJzaW9uIHNjaGVtYXMgd291bGQgZ29cbl0pO1xuXG5leHBvcnQgdHlwZSBTdGFja091dHB1dCA9IHouaW5mZXI8dHlwZW9mIHZlcnNpb25lZFN0YWNrT3V0cHV0U2NoZW1hPjtcbiJdfQ==
@@ -1,27 +0,0 @@
1
- import { z } from 'zod';
2
- export declare const stackOutputSchema: z.ZodObject<{
3
- version: z.ZodLiteral<"1">;
4
- payload: z.ZodObject<{
5
- deploymentType: z.ZodString;
6
- region: z.ZodString;
7
- }, "strip", z.ZodTypeAny, {
8
- deploymentType: string;
9
- region: string;
10
- }, {
11
- deploymentType: string;
12
- region: string;
13
- }>;
14
- }, "strip", z.ZodTypeAny, {
15
- version: "1";
16
- payload: {
17
- deploymentType: string;
18
- region: string;
19
- };
20
- }, {
21
- version: "1";
22
- payload: {
23
- deploymentType: string;
24
- region: string;
25
- };
26
- }>;
27
- //# sourceMappingURL=v1.d.ts.map
@@ -1,12 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.stackOutputSchema = void 0;
4
- const zod_1 = require("zod");
5
- exports.stackOutputSchema = zod_1.z.object({
6
- version: zod_1.z.literal('1'),
7
- payload: zod_1.z.object({
8
- deploymentType: zod_1.z.string(),
9
- region: zod_1.z.string(),
10
- }),
11
- });
12
- //# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoidjEuanMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyIuLi8uLi9zcmMvc3RhY2svdjEudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6Ijs7O0FBQUEsNkJBQXdCO0FBRVgsUUFBQSxpQkFBaUIsR0FBRyxPQUFDLENBQUMsTUFBTSxDQUFDO0lBQ3hDLE9BQU8sRUFBRSxPQUFDLENBQUMsT0FBTyxDQUFDLEdBQUcsQ0FBQztJQUN2QixPQUFPLEVBQUUsT0FBQyxDQUFDLE1BQU0sQ0FBQztRQUNoQixjQUFjLEVBQUUsT0FBQyxDQUFDLE1BQU0sRUFBRTtRQUMxQixNQUFNLEVBQUUsT0FBQyxDQUFDLE1BQU0sRUFBRTtLQUNuQixDQUFDO0NBQ0gsQ0FBQyxDQUFDIiwic291cmNlc0NvbnRlbnQiOlsiaW1wb3J0IHsgeiB9IGZyb20gJ3pvZCc7XG5cbmV4cG9ydCBjb25zdCBzdGFja091dHB1dFNjaGVtYSA9IHoub2JqZWN0KHtcbiAgdmVyc2lvbjogei5saXRlcmFsKCcxJyksXG4gIHBheWxvYWQ6IHoub2JqZWN0KHtcbiAgICBkZXBsb3ltZW50VHlwZTogei5zdHJpbmcoKSxcbiAgICByZWdpb246IHouc3RyaW5nKCksXG4gIH0pLFxufSk7XG4iXX0=
@@ -1,33 +0,0 @@
1
- import { z } from 'zod';
2
- export declare const versionedStorageOutputSchema: z.ZodDiscriminatedUnion<"version", [z.ZodObject<{
3
- version: z.ZodLiteral<"1">;
4
- payload: z.ZodObject<{
5
- bucketName: z.ZodString;
6
- storageRegion: z.ZodString;
7
- buckets: z.ZodOptional<z.ZodString>;
8
- }, "strip", z.ZodTypeAny, {
9
- bucketName: string;
10
- storageRegion: string;
11
- buckets?: string | undefined;
12
- }, {
13
- bucketName: string;
14
- storageRegion: string;
15
- buckets?: string | undefined;
16
- }>;
17
- }, "strip", z.ZodTypeAny, {
18
- version: "1";
19
- payload: {
20
- bucketName: string;
21
- storageRegion: string;
22
- buckets?: string | undefined;
23
- };
24
- }, {
25
- version: "1";
26
- payload: {
27
- bucketName: string;
28
- storageRegion: string;
29
- buckets?: string | undefined;
30
- };
31
- }>]>;
32
- export type StorageOutput = z.infer<typeof versionedStorageOutputSchema>;
33
- //# sourceMappingURL=index.d.ts.map
@@ -1,10 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.versionedStorageOutputSchema = void 0;
4
- const zod_1 = require("zod");
5
- const v1_js_1 = require("./v1.js");
6
- exports.versionedStorageOutputSchema = zod_1.z.discriminatedUnion('version', [
7
- v1_js_1.storageOutputSchema,
8
- // this is where additional storage major version schemas would go
9
- ]);
10
- //# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiaW5kZXguanMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyIuLi8uLi9zcmMvc3RvcmFnZS9pbmRleC50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiOzs7QUFBQSw2QkFBd0I7QUFDeEIsbUNBQXVFO0FBRTFELFFBQUEsNEJBQTRCLEdBQUcsT0FBQyxDQUFDLGtCQUFrQixDQUFDLFNBQVMsRUFBRTtJQUMxRSwyQkFBcUI7SUFDckIsa0VBQWtFO0NBQ25FLENBQUMsQ0FBQyIsInNvdXJjZXNDb250ZW50IjpbImltcG9ydCB7IHogfSBmcm9tICd6b2QnO1xuaW1wb3J0IHsgc3RvcmFnZU91dHB1dFNjaGVtYSBhcyBzdG9yYWdlT3V0cHV0U2NoZW1hVjEgfSBmcm9tICcuL3YxLmpzJztcblxuZXhwb3J0IGNvbnN0IHZlcnNpb25lZFN0b3JhZ2VPdXRwdXRTY2hlbWEgPSB6LmRpc2NyaW1pbmF0ZWRVbmlvbigndmVyc2lvbicsIFtcbiAgc3RvcmFnZU91dHB1dFNjaGVtYVYxLFxuICAvLyB0aGlzIGlzIHdoZXJlIGFkZGl0aW9uYWwgc3RvcmFnZSBtYWpvciB2ZXJzaW9uIHNjaGVtYXMgd291bGQgZ29cbl0pO1xuXG5leHBvcnQgdHlwZSBTdG9yYWdlT3V0cHV0ID0gei5pbmZlcjx0eXBlb2YgdmVyc2lvbmVkU3RvcmFnZU91dHB1dFNjaGVtYT47XG4iXX0=
@@ -1,32 +0,0 @@
1
- import { z } from 'zod';
2
- export declare const storageOutputSchema: z.ZodObject<{
3
- version: z.ZodLiteral<"1">;
4
- payload: z.ZodObject<{
5
- bucketName: z.ZodString;
6
- storageRegion: z.ZodString;
7
- buckets: z.ZodOptional<z.ZodString>;
8
- }, "strip", z.ZodTypeAny, {
9
- bucketName: string;
10
- storageRegion: string;
11
- buckets?: string | undefined;
12
- }, {
13
- bucketName: string;
14
- storageRegion: string;
15
- buckets?: string | undefined;
16
- }>;
17
- }, "strip", z.ZodTypeAny, {
18
- version: "1";
19
- payload: {
20
- bucketName: string;
21
- storageRegion: string;
22
- buckets?: string | undefined;
23
- };
24
- }, {
25
- version: "1";
26
- payload: {
27
- bucketName: string;
28
- storageRegion: string;
29
- buckets?: string | undefined;
30
- };
31
- }>;
32
- //# sourceMappingURL=v1.d.ts.map
@@ -1,33 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.storageOutputSchema = void 0;
4
- const zod_1 = require("zod");
5
- const storageAccessActionEnum = zod_1.z.enum([
6
- 'read',
7
- 'get',
8
- 'list',
9
- 'write',
10
- 'delete',
11
- ]);
12
- const pathSchema = zod_1.z.record(zod_1.z.string(), zod_1.z.object({
13
- guest: zod_1.z.array(storageAccessActionEnum).optional(),
14
- authenticated: zod_1.z.array(storageAccessActionEnum).optional(),
15
- groups: zod_1.z.array(storageAccessActionEnum).optional(),
16
- entity: zod_1.z.array(storageAccessActionEnum).optional(),
17
- resource: zod_1.z.array(storageAccessActionEnum).optional(),
18
- }));
19
- const bucketSchema = zod_1.z.object({
20
- name: zod_1.z.string(),
21
- bucketName: zod_1.z.string(),
22
- storageRegion: zod_1.z.string(),
23
- paths: pathSchema.optional(),
24
- });
25
- exports.storageOutputSchema = zod_1.z.object({
26
- version: zod_1.z.literal('1'),
27
- payload: zod_1.z.object({
28
- bucketName: zod_1.z.string(),
29
- storageRegion: zod_1.z.string(),
30
- buckets: zod_1.z.string(zod_1.z.array(bucketSchema)).optional(), // JSON serialized array of bucketSchema
31
- }),
32
- });
33
- //# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoidjEuanMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyIuLi8uLi9zcmMvc3RvcmFnZS92MS50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiOzs7QUFBQSw2QkFBd0I7QUFFeEIsTUFBTSx1QkFBdUIsR0FBRyxPQUFDLENBQUMsSUFBSSxDQUFDO0lBQ3JDLE1BQU07SUFDTixLQUFLO0lBQ0wsTUFBTTtJQUNOLE9BQU87SUFDUCxRQUFRO0NBQ1QsQ0FBQyxDQUFDO0FBRUgsTUFBTSxVQUFVLEdBQUcsT0FBQyxDQUFDLE1BQU0sQ0FDekIsT0FBQyxDQUFDLE1BQU0sRUFBRSxFQUNWLE9BQUMsQ0FBQyxNQUFNLENBQUM7SUFDUCxLQUFLLEVBQUUsT0FBQyxDQUFDLEtBQUssQ0FBQyx1QkFBdUIsQ0FBQyxDQUFDLFFBQVEsRUFBRTtJQUNsRCxhQUFhLEVBQUUsT0FBQyxDQUFDLEtBQUssQ0FBQyx1QkFBdUIsQ0FBQyxDQUFDLFFBQVEsRUFBRTtJQUMxRCxNQUFNLEVBQUUsT0FBQyxDQUFDLEtBQUssQ0FBQyx1QkFBdUIsQ0FBQyxDQUFDLFFBQVEsRUFBRTtJQUNuRCxNQUFNLEVBQUUsT0FBQyxDQUFDLEtBQUssQ0FBQy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@
1
- {
2
- "name": "@aws-amplify/backend-output-schemas",
3
- "version": "1.3.0",
4
- "type": "commonjs",
5
- "publishConfig": {
6
- "access": "public"
7
- },
8
- "exports": {
9
- ".": {
10
- "types": "./lib/index.d.ts",
11
- "import": "./lib/index.js",
12
- "require": "./lib/index.js"
13
- }
14
- },
15
- "main": "lib/index.js",
16
- "types": "lib/index.d.ts",
17
- "scripts": {
18
- "update:api": "api-extractor run --local"
19
- },
20
- "license": "Apache-2.0",
21
- "devDependencies": {
22
- "@aws-amplify/plugin-types": "^1.2.0"
23
- },
24
- "peerDependencies": {
25
- "zod": "^3.22.2"
26
- }
27
- }
@@ -1,105 +0,0 @@
1
- import { util } from '@aws-appsync/utils';
2
- import * as ddb from '@aws-appsync/utils/dynamodb';
3
-
4
- /**
5
- * Sends a request to the attached data source
6
- * @param {import('@aws-appsync/utils').Context} ctx the context
7
- * @returns {*} the request
8
- */
9
- export function request(ctx) {
10
- if (!ctx.args.input.stopReason) {
11
- runtime.earlyReturn(ctx.prev.result);
12
- }
13
- const { id, createdAt, updatedAt } = ctx.stash.defaultValues;
14
- const { events } = ctx.prev.result;
15
-
16
- const content = reduceChunks(events);
17
- const assistantMessage = {
18
- __typename: 'ConversationMessageCustomChat',
19
- role: 'assistant',
20
- createdAt,
21
- updatedAt,
22
- conversationId: ctx.args.input.conversationId,
23
- associatedUserMessageId: ctx.args.input.associatedUserMessageId,
24
- owner: ctx.args.owner,
25
- content
26
- }
27
- // TODO: check if `stopReason` really means end of turn.
28
- // `put` if it does
29
- // `update` if it doesn't
30
- return ddb.put({ key: { id }, item: assistantMessage })
31
- }
32
-
33
-
34
- /**
35
- * Returns the resolver result
36
- * @param {import('@aws-appsync/utils').Context} ctx the context
37
- * @returns {*} the result
38
- */
39
- export function response(ctx) {
40
- // this makes us return a message to the client. Maybe that's ok if / when we're streaming the text back as true
41
- // chunk representations (with index, etc).
42
- if (ctx.args.input.stopReason) {
43
- const { createdAt } = ctx.stash.defaultValues;
44
- const { conversationId } = ctx.result;
45
- const { owner } = ctx.args;
46
- return {
47
- // differentiating with `<id>#response` for now. But this is no bueno.
48
- // either the sentinel value needs to be included in the last chunk with content
49
- // --- or ---
50
- // we need to represent it in the client message type
51
- // --- or ---
52
- // we could potentially just throw an error here, but that's bad.
53
- __typename: 'ConversationMessageStreamPart',
54
- id: `${ctx.args.input.associatedUserMessageId}#stream`,
55
- createdAt,
56
- owner,
57
- conversationId,
58
- ...ctx.args.input,
59
- };
60
- }
61
- return ctx.prev.result;
62
- }
63
-
64
- function reduceChunks(events) {
65
- // we're limited by the AppSync JS runtime as to what we can do here.
66
- // so the code is uhh... a little creative.
67
- function sortEvents(a, b) {
68
- if (a.contentBlockIndex !== b.contentBlockIndex) {
69
- return a.contentBlockIndex - b.contentBlockIndex;
70
- }
71
- return a.contentBlockDeltaIndex - b.contentBlockDeltaIndex;
72
- }
73
-
74
- // arrow functions and inline `function` declarations are not supported for sort.
75
- events.sort(sortEvents);
76
-
77
- // Group events by contentBlockIndex
78
- const groupedEvents = events.reduce(function(acc, event) {
79
- if (!acc[event.contentBlockIndex]) {
80
- acc[event.contentBlockIndex] = [];
81
- }
82
-
83
- if (event.contentBlockText) {
84
- acc[event.contentBlockIndex].push(event.contentBlockText);
85
- }
86
-
87
- if (event.contentBlockToolUse) {
88
- acc[event.contentBlockIndex].push(event.contentBlockToolUse);
89
- }
90
- return acc;
91
- }, {});
92
-
93
- // Concatenate text for each content block
94
- const content = Object.keys(groupedEvents).map((index) => {
95
- const contentBlock = groupedEvents[index];
96
- // toolUse blocks are sent as a single event.
97
- if (contentBlock.length === 1 && contentBlock[0].toolUseId) {
98
- return { toolUse: contentBlock[0] };
99
- }
100
- // text blocks are chunked so we join them.
101
- return { text: contentBlock.join('') };
102
- });
103
-
104
- return content;
105
- }
@@ -1,4 +0,0 @@
1
- import { MappingTemplateProvider } from '@aws-amplify/graphql-transformer-interfaces';
2
- import { ConversationDirectiveConfiguration } from '../grapqhl-conversation-transformer';
3
- export declare const assistantStreamingMutationReduceChunksResolver: (config: ConversationDirectiveConfiguration) => MappingTemplateProvider;
4
- //# sourceMappingURL=assistant-streaming-mutation-reduce-chunks-resolver.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"assistant-streaming-mutation-reduce-chunks-resolver.d.ts","sourceRoot":"","sources":["../../src/resolvers/assistant-streaming-mutation-reduce-chunks-resolver.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,uBAAuB,EAAE,MAAM,6CAA6C,CAAC;AAGtF,OAAO,EAAE,kCAAkC,EAAE,MAAM,qCAAqC,CAAC;AASzF,eAAO,MAAM,8CAA8C,WAAY,kCAAkC,KAAG,uBAY3G,CAAC"}
@@ -1,25 +0,0 @@
1
- "use strict";
2
- var __importDefault = (this && this.__importDefault) || function (mod) {
3
- return (mod && mod.__esModule) ? mod : { "default": mod };
4
- };
5
- Object.defineProperty(exports, "__esModule", { value: true });
6
- exports.assistantStreamingMutationReduceChunksResolver = void 0;
7
- const graphql_transformer_core_1 = require("@aws-amplify/graphql-transformer-core");
8
- const fs_1 = __importDefault(require("fs"));
9
- const path_1 = __importDefault(require("path"));
10
- const graphql_transformer_common_1 = require("graphql-transformer-common");
11
- const assistantStreamingMutationReduceChunksResolver = (config) => {
12
- let resolver = fs_1.default.readFileSync(path_1.default.join(__dirname, 'assistant-streaming-mutation-reduce-chunks-resolver-fn.template.js'), 'utf8');
13
- const fieldName = (0, graphql_transformer_common_1.toUpper)(config.field.name.value);
14
- const substitutions = {
15
- CONVERSATION_MESSAGE_TYPE_NAME: `ConversationMessage${fieldName}`,
16
- };
17
- Object.entries(substitutions).forEach(([key, value]) => {
18
- const replaced = resolver.replace(new RegExp(`\\[\\[${key}\\]\\]`, 'g'), value);
19
- resolver = replaced;
20
- });
21
- const templateName = `Mutation.${config.field.name.value}.assistant-response-stream-reduce-chunks.js`;
22
- return graphql_transformer_core_1.MappingTemplate.s3MappingFunctionCodeFromString(resolver, templateName);
23
- };
24
- exports.assistantStreamingMutationReduceChunksResolver = assistantStreamingMutationReduceChunksResolver;
25
- //# sourceMappingURL=assistant-streaming-mutation-reduce-chunks-resolver.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"assistant-streaming-mutation-reduce-chunks-resolver.js","sourceRoot":"","sources":["../../src/resolvers/assistant-streaming-mutation-reduce-chunks-resolver.ts"],"names":[],"mappings":";;;;;;AAAA,oFAAwE;AAExE,4CAAoB;AACpB,gDAAwB;AAExB,2EAAqD;AAQ9C,MAAM,8CAA8C,GAAG,CAAC,MAA0C,EAA2B,EAAE;IACpI,IAAI,QAAQ,GAAG,YAAE,CAAC,YAAY,CAAC,cAAI,CAAC,IAAI,CAAC,SAAS,EAAE,oEAAoE,CAAC,EAAE,MAAM,CAAC,CAAC;IACnI,MAAM,SAAS,GAAG,IAAA,oCAAO,EAAC,MAAM,CAAC,KAAK,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC;IACnD,MAAM,aAAa,GAAG;QACpB,8BAA8B,EAAE,sBAAsB,SAAS,EAAE;KAClE,CAAC;IACF,MAAM,CAAC,OAAO,CAAC,aAAa,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,GAAG,EAAE,KAAK,CAAC,EAAE,EAAE;QACrD,MAAM,QAAQ,GAAG,QAAQ,CAAC,OAAO,CAAC,IAAI,MAAM,CAAC,SAAS,GAAG,QAAQ,EAAE,GAAG,CAAC,EAAE,KAAK,CAAC,CAAC;QAChF,QAAQ,GAAG,QAAQ,CAAC;IACtB,CAAC,CAAC,CAAC;IACH,MAAM,YAAY,GAAG,YAAY,MAAM,CAAC,KAAK,CAAC,IAAI,CAAC,KAAK,6CAA6C,CAAC;IACtG,OAAO,0CAAe,CAAC,+BAA+B,CAAC,QAAQ,EAAE,YAAY,CAAC,CAAC;AACjF,CAAC,CAAC;AAZW,QAAA,8CAA8C,kDAYzD"}
@@ -1,114 +0,0 @@
1
- import { util } from '@aws-appsync/utils';
2
- import * as ddb from '@aws-appsync/utils/dynamodb';
3
-
4
- /**
5
- * Sends a request to the attached data source
6
- * @param {import('@aws-appsync/utils').Context} ctx the context
7
- * @returns {*} the request
8
- */
9
- export function request(ctx) {
10
- const {
11
- // required
12
- conversationId,
13
- associatedUserMessageId,
14
- contentBlockIndex,
15
- // text chunk
16
- contentBlockText,
17
- contentBlockDeltaIndex,
18
- // tool use
19
- contentBlockToolUse,
20
- // block complete
21
- contentBlockDoneAtIndex,
22
- // turn complete
23
- stopReason,
24
- } = ctx.args.input;
25
-
26
- const { owner } = ctx.args;
27
- const streamId = `${associatedUserMessageId}#stream`;
28
-
29
- if (stopReason) {
30
- // should we be writing the turn complete chunk here?
31
- // probably not. It's just the marker for us to reconcile the chunks.
32
- return ddb.get({ key: { id: streamId } });
33
- }
34
-
35
- // not using this yet. we'll need to enable ttl on the table first.
36
- const now = util.time.nowEpochSeconds()
37
- const ttl = now + 60 * 60 * 24; // 1 day
38
-
39
- const event = {
40
- contentBlockIndex,
41
- contentBlockDeltaIndex,
42
- contentBlockText,
43
- contentBlockToolUse,
44
- contentBlockDoneAtIndex,
45
- };
46
-
47
- // AppSync JS runtime doesn't support Object.fromEntries
48
- const chunk = Object.keys(event)
49
- .filter((k) => event[k] != null)
50
- .reduce((a, k) => ({ ...a, [k]: event[k] }), {});
51
-
52
- // TODO: Use expression names for all attributes.
53
- // reference: https://docs.aws.amazon.com/amazondynamodb/latest/developerguide/ReservedWords.html
54
- const setExpression = 'SET events = list_append(if_not_exists(events, :empty_list), :events), conversationId = :conversationId, #owner = :owner'
55
- const id = streamId
56
- return {
57
- operation: 'UpdateItem',
58
- key: util.dynamodb.toMapValues({ id }),
59
- update: {
60
- expression: setExpression,
61
- expressionValues: util.dynamodb.toMapValues({
62
- ':events': [chunk],
63
- ':empty_list': [],
64
- ':conversationId': conversationId,
65
- ':owner': owner,
66
- }),
67
- expressionNames: {
68
- '#owner': 'owner',
69
- },
70
- },
71
- };
72
- }
73
-
74
- /**
75
- * Returns the resolver result
76
- * @param {import('@aws-appsync/utils').Context} ctx the context
77
- * @returns {*} the result
78
- */
79
- export function response(ctx) {
80
- console.log('>>> response function ctx <<<', ctx);
81
- if (ctx.error) {
82
- util.error(ctx.error.message, ctx.error.type);
83
- }
84
-
85
- const { conversationId } = ctx.result;
86
- const { owner } = ctx.args;
87
-
88
- if (ctx.args.input.contentBlockToolUse || ctx.args.input.contentBlockText) {
89
- console.log('>>> contentBlockToolUse <<<', ctx.args.input.contentBlockToolUse);
90
- console.log('>>> contentBlockText <<<', ctx.args.input.contentBlockText);
91
-
92
- return {
93
- __typename: 'ConversationMessageStreamPart',
94
- id: `${ctx.args.input.associatedUserMessageId}#stream`,
95
- owner,
96
- conversationId,
97
- ...ctx.args.input,
98
- }
99
- }
100
-
101
- if (ctx.args.input.contentBlockDoneAtIndex) {
102
- console.log('>>> contentBlockDoneAtIndex <<<', ctx.args.input.contentBlockDoneAtIndex);
103
- // Do we actually need this event? It's forcing us to return a value to the client here, which is awkward... maybe.
104
- return {
105
- id: `${ctx.args.input.associatedUserMessageId}#stream`,
106
- owner,
107
- conversationId,
108
- ...ctx.args.input,
109
- }
110
- }
111
-
112
- console.log('>>> stopReason <<<', ctx.args.input.stopReason);
113
- return ctx.result;
114
- }
@@ -1,4 +0,0 @@
1
- import { MappingTemplateProvider } from '@aws-amplify/graphql-transformer-interfaces';
2
- import { ConversationDirectiveConfiguration } from '../grapqhl-conversation-transformer';
3
- export declare const assistantStreamingMutationResolver: (config: ConversationDirectiveConfiguration) => MappingTemplateProvider;
4
- //# sourceMappingURL=assistant-streaming-mutation-resolver.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"assistant-streaming-mutation-resolver.d.ts","sourceRoot":"","sources":["../../src/resolvers/assistant-streaming-mutation-resolver.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,uBAAuB,EAAE,MAAM,6CAA6C,CAAC;AAGtF,OAAO,EAAE,kCAAkC,EAAE,MAAM,qCAAqC,CAAC;AASzF,eAAO,MAAM,kCAAkC,WAAY,kCAAkC,KAAG,uBAY/F,CAAC"}
@@ -1,25 +0,0 @@
1
- "use strict";
2
- var __importDefault = (this && this.__importDefault) || function (mod) {
3
- return (mod && mod.__esModule) ? mod : { "default": mod };
4
- };
5
- Object.defineProperty(exports, "__esModule", { value: true });
6
- exports.assistantStreamingMutationResolver = void 0;
7
- const graphql_transformer_core_1 = require("@aws-amplify/graphql-transformer-core");
8
- const fs_1 = __importDefault(require("fs"));
9
- const path_1 = __importDefault(require("path"));
10
- const graphql_transformer_common_1 = require("graphql-transformer-common");
11
- const assistantStreamingMutationResolver = (config) => {
12
- let resolver = fs_1.default.readFileSync(path_1.default.join(__dirname, 'assistant-streaming-mutation-resolver-fn.template.js'), 'utf8');
13
- const fieldName = (0, graphql_transformer_common_1.toUpper)(config.field.name.value);
14
- const substitutions = {
15
- CONVERSATION_MESSAGE_TYPE_NAME: `ConversationMessage${fieldName}`,
16
- };
17
- Object.entries(substitutions).forEach(([key, value]) => {
18
- const replaced = resolver.replace(new RegExp(`\\[\\[${key}\\]\\]`, 'g'), value);
19
- resolver = replaced;
20
- });
21
- const templateName = `Mutation.${config.field.name.value}.assistant-response-stream.js`;
22
- return graphql_transformer_core_1.MappingTemplate.s3MappingFunctionCodeFromString(resolver, templateName);
23
- };
24
- exports.assistantStreamingMutationResolver = assistantStreamingMutationResolver;
25
- //# sourceMappingURL=assistant-streaming-mutation-resolver.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"assistant-streaming-mutation-resolver.js","sourceRoot":"","sources":["../../src/resolvers/assistant-streaming-mutation-resolver.ts"],"names":[],"mappings":";;;;;;AAAA,oFAAwE;AAExE,4CAAoB;AACpB,gDAAwB;AAExB,2EAAqD;AAQ9C,MAAM,kCAAkC,GAAG,CAAC,MAA0C,EAA2B,EAAE;IACxH,IAAI,QAAQ,GAAG,YAAE,CAAC,YAAY,CAAC,cAAI,CAAC,IAAI,CAAC,SAAS,EAAE,sDAAsD,CAAC,EAAE,MAAM,CAAC,CAAC;IACrH,MAAM,SAAS,GAAG,IAAA,oCAAO,EAAC,MAAM,CAAC,KAAK,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC;IACnD,MAAM,aAAa,GAAG;QACpB,8BAA8B,EAAE,sBAAsB,SAAS,EAAE;KAClE,CAAC;IACF,MAAM,CAAC,OAAO,CAAC,aAAa,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,GAAG,EAAE,KAAK,CAAC,EAAE,EAAE;QACrD,MAAM,QAAQ,GAAG,QAAQ,CAAC,OAAO,CAAC,IAAI,MAAM,CAAC,SAAS,GAAG,QAAQ,EAAE,GAAG,CAAC,EAAE,KAAK,CAAC,CAAC;QAChF,QAAQ,GAAG,QAAQ,CAAC;IACtB,CAAC,CAAC,CAAC;IACH,MAAM,YAAY,GAAG,YAAY,MAAM,CAAC,KAAK,CAAC,IAAI,CAAC,KAAK,+BAA+B,CAAC;IACxF,OAAO,0CAAe,CAAC,+BAA+B,CAAC,QAAQ,EAAE,YAAY,CAAC,CAAC;AACjF,CAAC,CAAC;AAZW,QAAA,kCAAkC,sCAY7C"}