@aws-amplify/graphql-api-construct 1.15.0 → 1.15.1-ai-streaming.0
Sign up to get free protection for your applications and to get access to all the features.
- package/.jsii +5 -5
- package/CHANGELOG.md +4 -0
- package/lib/amplify-dynamodb-table-wrapper.js +1 -1
- package/lib/amplify-graphql-api.js +1 -1
- package/lib/amplify-graphql-definition.js +1 -1
- package/lib/sql-model-datasource-strategy.js +1 -1
- package/node_modules/@aws-amplify/ai-constructs/lib/conversation/conversation_handler_construct.d.ts +12 -1
- package/node_modules/@aws-amplify/ai-constructs/lib/conversation/conversation_handler_construct.js +19 -2
- package/node_modules/@aws-amplify/ai-constructs/lib/conversation/index.d.ts +2 -2
- package/node_modules/@aws-amplify/ai-constructs/lib/conversation/index.js +1 -1
- package/node_modules/@aws-amplify/ai-constructs/lib/conversation/runtime/bedrock_converse_adapter.d.ts +11 -1
- package/node_modules/@aws-amplify/ai-constructs/lib/conversation/runtime/bedrock_converse_adapter.js +176 -42
- package/node_modules/@aws-amplify/ai-constructs/lib/conversation/runtime/conversation_message_history_retriever.js +2 -2
- package/node_modules/@aws-amplify/ai-constructs/lib/conversation/runtime/conversation_turn_executor.d.ts +3 -5
- package/node_modules/@aws-amplify/ai-constructs/lib/conversation/runtime/conversation_turn_executor.js +10 -7
- package/node_modules/@aws-amplify/ai-constructs/lib/conversation/runtime/conversation_turn_response_sender.d.ts +3 -1
- package/node_modules/@aws-amplify/ai-constructs/lib/conversation/runtime/conversation_turn_response_sender.js +6 -7
- package/node_modules/@aws-amplify/ai-constructs/lib/conversation/runtime/conversation_turn_streaming_response_sender.d.ts +33 -0
- package/node_modules/@aws-amplify/ai-constructs/lib/conversation/runtime/conversation_turn_streaming_response_sender.js +38 -0
- package/node_modules/@aws-amplify/ai-constructs/lib/conversation/runtime/default_handler.d.ts +1 -1
- package/node_modules/@aws-amplify/ai-constructs/lib/conversation/runtime/event-tools-provider/event_tools_provider.js +2 -2
- package/node_modules/@aws-amplify/ai-constructs/lib/conversation/runtime/event-tools-provider/graphql_tool.d.ts +7 -7
- package/node_modules/@aws-amplify/ai-constructs/lib/conversation/runtime/event-tools-provider/graphql_tool.js +3 -2
- package/node_modules/@aws-amplify/ai-constructs/lib/conversation/runtime/executable_tool_factory.d.ts +7 -0
- package/node_modules/@aws-amplify/ai-constructs/lib/conversation/runtime/executable_tool_factory.js +16 -0
- package/node_modules/@aws-amplify/ai-constructs/lib/conversation/runtime/graphql_request_executor.d.ts +2 -1
- package/node_modules/@aws-amplify/ai-constructs/lib/conversation/runtime/graphql_request_executor.js +4 -2
- package/node_modules/@aws-amplify/ai-constructs/lib/conversation/runtime/index.d.ts +3 -2
- package/node_modules/@aws-amplify/ai-constructs/lib/conversation/runtime/index.js +4 -2
- package/node_modules/@aws-amplify/ai-constructs/lib/conversation/runtime/types.d.ts +11 -10
- package/node_modules/@aws-amplify/ai-constructs/lib/conversation/runtime/types.js +1 -1
- package/node_modules/@aws-amplify/ai-constructs/node_modules/@aws-amplify/backend-output-schemas/README.md +4 -0
- package/node_modules/@aws-amplify/ai-constructs/node_modules/@aws-amplify/backend-output-schemas/lib/ai/conversation/index.d.ts +23 -0
- package/node_modules/@aws-amplify/ai-constructs/node_modules/@aws-amplify/backend-output-schemas/lib/ai/conversation/index.js +10 -0
- package/node_modules/@aws-amplify/ai-constructs/node_modules/@aws-amplify/backend-output-schemas/lib/ai/conversation/v1.d.ts +22 -0
- package/node_modules/@aws-amplify/ai-constructs/node_modules/@aws-amplify/backend-output-schemas/lib/ai/conversation/v1.js +11 -0
- package/node_modules/@aws-amplify/ai-constructs/node_modules/@aws-amplify/backend-output-schemas/lib/auth/index.d.ts +113 -0
- package/node_modules/@aws-amplify/ai-constructs/node_modules/@aws-amplify/backend-output-schemas/lib/auth/index.js +10 -0
- package/node_modules/@aws-amplify/ai-constructs/node_modules/@aws-amplify/backend-output-schemas/lib/auth/v1.d.ts +112 -0
- package/node_modules/@aws-amplify/ai-constructs/node_modules/@aws-amplify/backend-output-schemas/lib/auth/v1.js +30 -0
- package/node_modules/@aws-amplify/ai-constructs/node_modules/@aws-amplify/backend-output-schemas/lib/custom/index.d.ts +23 -0
- package/node_modules/@aws-amplify/ai-constructs/node_modules/@aws-amplify/backend-output-schemas/lib/custom/index.js +10 -0
- package/node_modules/@aws-amplify/ai-constructs/node_modules/@aws-amplify/backend-output-schemas/lib/custom/v1.d.ts +22 -0
- package/node_modules/@aws-amplify/ai-constructs/node_modules/@aws-amplify/backend-output-schemas/lib/custom/v1.js +11 -0
- package/node_modules/@aws-amplify/ai-constructs/node_modules/@aws-amplify/backend-output-schemas/lib/function/index.d.ts +23 -0
- package/node_modules/@aws-amplify/ai-constructs/node_modules/@aws-amplify/backend-output-schemas/lib/function/index.js +10 -0
- package/node_modules/@aws-amplify/ai-constructs/node_modules/@aws-amplify/backend-output-schemas/lib/function/v1.d.ts +22 -0
- package/node_modules/@aws-amplify/ai-constructs/node_modules/@aws-amplify/backend-output-schemas/lib/function/v1.js +11 -0
- package/node_modules/@aws-amplify/ai-constructs/node_modules/@aws-amplify/backend-output-schemas/lib/graphql/index.d.ts +59 -0
- package/node_modules/@aws-amplify/ai-constructs/node_modules/@aws-amplify/backend-output-schemas/lib/graphql/index.js +12 -0
- package/node_modules/@aws-amplify/ai-constructs/node_modules/@aws-amplify/backend-output-schemas/lib/graphql/v1.d.ts +59 -0
- package/node_modules/@aws-amplify/ai-constructs/node_modules/@aws-amplify/backend-output-schemas/lib/graphql/v1.js +25 -0
- package/node_modules/@aws-amplify/ai-constructs/node_modules/@aws-amplify/backend-output-schemas/lib/index.d.ts +508 -0
- package/node_modules/@aws-amplify/ai-constructs/node_modules/@aws-amplify/backend-output-schemas/lib/index.js +112 -0
- package/node_modules/@aws-amplify/ai-constructs/node_modules/@aws-amplify/backend-output-schemas/lib/platform/index.d.ts +2 -0
- package/node_modules/@aws-amplify/ai-constructs/node_modules/@aws-amplify/backend-output-schemas/lib/platform/index.js +18 -0
- package/node_modules/@aws-amplify/ai-constructs/node_modules/@aws-amplify/backend-output-schemas/lib/platform/stack_metadata_schemas.d.ts +42 -0
- package/node_modules/@aws-amplify/ai-constructs/node_modules/@aws-amplify/backend-output-schemas/lib/platform/stack_metadata_schemas.js +22 -0
- package/node_modules/@aws-amplify/ai-constructs/node_modules/@aws-amplify/backend-output-schemas/lib/stack/index.d.ts +28 -0
- package/node_modules/@aws-amplify/ai-constructs/node_modules/@aws-amplify/backend-output-schemas/lib/stack/index.js +10 -0
- package/node_modules/@aws-amplify/ai-constructs/node_modules/@aws-amplify/backend-output-schemas/lib/stack/v1.d.ts +27 -0
- package/node_modules/@aws-amplify/ai-constructs/node_modules/@aws-amplify/backend-output-schemas/lib/stack/v1.js +12 -0
- package/node_modules/@aws-amplify/ai-constructs/node_modules/@aws-amplify/backend-output-schemas/lib/storage/index.d.ts +33 -0
- package/node_modules/@aws-amplify/ai-constructs/node_modules/@aws-amplify/backend-output-schemas/lib/storage/index.js +10 -0
- package/node_modules/@aws-amplify/ai-constructs/node_modules/@aws-amplify/backend-output-schemas/lib/storage/v1.d.ts +32 -0
- package/node_modules/@aws-amplify/ai-constructs/node_modules/@aws-amplify/backend-output-schemas/lib/storage/v1.js +33 -0
- package/node_modules/@aws-amplify/ai-constructs/node_modules/@aws-amplify/backend-output-schemas/package.json +27 -0
- package/node_modules/@aws-amplify/ai-constructs/package.json +9 -2
- package/node_modules/@aws-amplify/graphql-auth-transformer/package.json +1 -2
- package/node_modules/@aws-amplify/graphql-conversation-transformer/CHANGELOG.md +4 -0
- package/node_modules/@aws-amplify/graphql-conversation-transformer/lib/graphql-types/message-model.d.ts +2 -0
- package/node_modules/@aws-amplify/graphql-conversation-transformer/lib/graphql-types/message-model.d.ts.map +1 -1
- package/node_modules/@aws-amplify/graphql-conversation-transformer/lib/graphql-types/message-model.js +34 -3
- package/node_modules/@aws-amplify/graphql-conversation-transformer/lib/graphql-types/message-model.js.map +1 -1
- package/node_modules/@aws-amplify/graphql-conversation-transformer/lib/resolvers/assistant-streaming-mutation-reduce-chunks-resolver-fn.template.js +101 -0
- package/node_modules/@aws-amplify/graphql-conversation-transformer/lib/resolvers/assistant-streaming-mutation-reduce-chunks-resolver.d.ts +4 -0
- package/node_modules/@aws-amplify/graphql-conversation-transformer/lib/resolvers/assistant-streaming-mutation-reduce-chunks-resolver.d.ts.map +1 -0
- package/node_modules/@aws-amplify/graphql-conversation-transformer/lib/resolvers/assistant-streaming-mutation-reduce-chunks-resolver.js +25 -0
- package/node_modules/@aws-amplify/graphql-conversation-transformer/lib/resolvers/assistant-streaming-mutation-reduce-chunks-resolver.js.map +1 -0
- package/node_modules/@aws-amplify/graphql-conversation-transformer/lib/resolvers/assistant-streaming-mutation-resolver-fn.template.js +121 -0
- package/node_modules/@aws-amplify/graphql-conversation-transformer/lib/resolvers/assistant-streaming-mutation-resolver.d.ts +4 -0
- package/node_modules/@aws-amplify/graphql-conversation-transformer/lib/resolvers/assistant-streaming-mutation-resolver.d.ts.map +1 -0
- package/node_modules/@aws-amplify/graphql-conversation-transformer/lib/resolvers/assistant-streaming-mutation-resolver.js +25 -0
- package/node_modules/@aws-amplify/graphql-conversation-transformer/lib/resolvers/assistant-streaming-mutation-resolver.js.map +1 -0
- package/node_modules/@aws-amplify/graphql-conversation-transformer/lib/resolvers/invoke-lambda-resolver-fn.template.js +14 -1
- package/node_modules/@aws-amplify/graphql-conversation-transformer/lib/resolvers/invoke-lambda-resolver.d.ts.map +1 -1
- package/node_modules/@aws-amplify/graphql-conversation-transformer/lib/resolvers/invoke-lambda-resolver.js +6 -0
- package/node_modules/@aws-amplify/graphql-conversation-transformer/lib/resolvers/invoke-lambda-resolver.js.map +1 -1
- package/node_modules/@aws-amplify/graphql-conversation-transformer/lib/transformer-steps/conversation-prepare-handler.d.ts.map +1 -1
- package/node_modules/@aws-amplify/graphql-conversation-transformer/lib/transformer-steps/conversation-prepare-handler.js +3 -2
- package/node_modules/@aws-amplify/graphql-conversation-transformer/lib/transformer-steps/conversation-prepare-handler.js.map +1 -1
- package/node_modules/@aws-amplify/graphql-conversation-transformer/lib/transformer-steps/conversation-resolver-generator.d.ts +1 -0
- package/node_modules/@aws-amplify/graphql-conversation-transformer/lib/transformer-steps/conversation-resolver-generator.d.ts.map +1 -1
- package/node_modules/@aws-amplify/graphql-conversation-transformer/lib/transformer-steps/conversation-resolver-generator.js +16 -0
- package/node_modules/@aws-amplify/graphql-conversation-transformer/lib/transformer-steps/conversation-resolver-generator.js.map +1 -1
- package/node_modules/@aws-amplify/graphql-conversation-transformer/package.json +3 -3
- package/node_modules/@aws-amplify/graphql-default-value-transformer/package.json +1 -2
- package/node_modules/@aws-amplify/graphql-directives/package.json +1 -2
- package/node_modules/@aws-amplify/graphql-function-transformer/package.json +1 -2
- package/node_modules/@aws-amplify/graphql-generation-transformer/package.json +1 -2
- package/node_modules/@aws-amplify/graphql-http-transformer/package.json +1 -2
- package/node_modules/@aws-amplify/graphql-index-transformer/package.json +1 -2
- package/node_modules/@aws-amplify/graphql-maps-to-transformer/lib/assets/mapping-lambda.zip +0 -0
- package/node_modules/@aws-amplify/graphql-maps-to-transformer/package.json +1 -2
- package/node_modules/@aws-amplify/graphql-model-transformer/lib/rds-lambda.zip +0 -0
- package/node_modules/@aws-amplify/graphql-model-transformer/lib/rds-notification-lambda.zip +0 -0
- package/node_modules/@aws-amplify/graphql-model-transformer/lib/rds-patching-lambda.zip +0 -0
- package/node_modules/@aws-amplify/graphql-model-transformer/package.json +1 -2
- package/node_modules/@aws-amplify/graphql-predictions-transformer/lib/predictionsLambdaFunction.zip +0 -0
- package/node_modules/@aws-amplify/graphql-predictions-transformer/package.json +1 -2
- package/node_modules/@aws-amplify/graphql-relational-transformer/package.json +1 -2
- package/node_modules/@aws-amplify/graphql-searchable-transformer/lib/streaming-lambda.zip +0 -0
- package/node_modules/@aws-amplify/graphql-searchable-transformer/package.json +1 -2
- package/node_modules/@aws-amplify/graphql-sql-transformer/package.json +1 -2
- package/node_modules/@aws-amplify/graphql-transformer/CHANGELOG.md +4 -0
- package/node_modules/@aws-amplify/graphql-transformer/package.json +3 -3
- package/node_modules/@aws-amplify/graphql-transformer-core/package.json +1 -2
- package/node_modules/@aws-amplify/graphql-transformer-interfaces/package.json +1 -2
- package/package.json +5 -5
- package/node_modules/@aws-amplify/graphql-auth-transformer/LICENSE +0 -201
- package/node_modules/@aws-amplify/graphql-default-value-transformer/LICENSE +0 -201
- package/node_modules/@aws-amplify/graphql-directives/LICENSE +0 -201
- package/node_modules/@aws-amplify/graphql-function-transformer/LICENSE +0 -201
- package/node_modules/@aws-amplify/graphql-generation-transformer/LICENSE +0 -201
- package/node_modules/@aws-amplify/graphql-http-transformer/LICENSE +0 -201
- package/node_modules/@aws-amplify/graphql-index-transformer/LICENSE +0 -201
- package/node_modules/@aws-amplify/graphql-maps-to-transformer/LICENSE +0 -201
- package/node_modules/@aws-amplify/graphql-model-transformer/LICENSE +0 -201
- package/node_modules/@aws-amplify/graphql-predictions-transformer/LICENSE +0 -201
- package/node_modules/@aws-amplify/graphql-relational-transformer/LICENSE +0 -201
- package/node_modules/@aws-amplify/graphql-searchable-transformer/LICENSE +0 -201
- package/node_modules/@aws-amplify/graphql-sql-transformer/LICENSE +0 -201
- package/node_modules/@aws-amplify/graphql-transformer-core/LICENSE +0 -201
- package/node_modules/@aws-amplify/graphql-transformer-interfaces/LICENSE +0 -201
@@ -0,0 +1,42 @@
|
|
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
|
@@ -0,0 +1,22 @@
|
|
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.backendOutputStackMetadataSchema = zod_1.z.record(exports.backendOutputEntryStackMetadataSchema);
|
22
|
+
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoic3RhY2tfbWV0YWRhdGFfc2NoZW1hcy5qcyIsInNvdXJjZVJvb3QiOiIiLCJzb3VyY2VzIjpbIi4uLy4uL3NyYy9wbGF0Zm9ybS9zdGFja19tZXRhZGF0YV9zY2hlbWFzLnRzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiI7OztBQUFBLDZCQUF3QjtBQUV4Qjs7Ozs7R0FLRztBQUVIOztHQUVHO0FBQ1UsUUFBQSxxQ0FBcUMsR0FBRyxPQUFDLENBQUMsTUFBTSxDQUFDO0lBQzVELE9BQU8sRUFBRSxPQUFDLENBQUMsTUFBTSxFQUFFO0lBQ25CLFlBQVksRUFBRSxPQUFDLENBQUMsS0FBSyxDQUFDLE9BQUMsQ0FBQyxNQUFNLEVBQUUsQ0FBQztDQUNsQyxDQUFDLENBQUM7QUFTSDs7R0FFRztBQUNVLFFBQUEsZ0NBQWdDLEdBQUcsT0FBQyxDQUFDLE1BQU0sQ0FDdEQsNkNBQXFDLENBQ3RDLENBQUMiLCJzb3VyY2VzQ29udGVudCI6WyJpbXBvcnQgeyB6IH0gZnJvbSAnem9kJztcblxuLyoqXG4gKiBUaGUgdHlwZXMgaGVyZSBhcmUgbWVhbnQgdG8gYmUgdXNlZCBpbnRlcm5hbGx5IHdoZW4gcmVhZGluZyAvIHdyaXRpbmcgYmFja2VuZCBvdXRwdXQgdG8gc3RhY2sgbWV0YWRhdGEuXG4gKlxuICogVGhleSByZXByZXNlbnQgYnJvYWRlciBtZXRhZGF0YSB0eXBlcyB0aGFuIHRo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dXRTdGFja01ldGFkYXRhU2NoZW1hID0gei5yZWNvcmQoXG4gIGJhY2tlbmRPdXRwdXRFbnRyeVN0YWNrTWV0YWRhdGFTY2hlbWFcbik7XG5cbi8qKlxuICogSW5mZXJyZWQgdHlwZSBmcm9tIGJhY2tlbmRPdXRwdXRTdGFja01ldGFkYXRhU2NoZW1hXG4gKi9cbmV4cG9ydCB0eXBlIEJhY2tlbmRPdXRwdXRTdGFja01ldGFkYXRhID0gei5pbmZlcjxcbiAgdHlwZW9mIGJhY2tlbmRPdXRwdXRTdGFja01ldGFkYXRhU2NoZW1hXG4+O1xuIl19
|
@@ -0,0 +1,28 @@
|
|
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
|
@@ -0,0 +1,10 @@
|
|
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==
|
@@ -0,0 +1,27 @@
|
|
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
|
@@ -0,0 +1,12 @@
|
|
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=
|
@@ -0,0 +1,33 @@
|
|
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
|
@@ -0,0 +1,10 @@
|
|
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=
|
@@ -0,0 +1,32 @@
|
|
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
|
@@ -0,0 +1,33 @@
|
|
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,eyJ2ZXJzaW9uIjozLCJmaWxlIjoidjEuanMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyIuLi8uLi9zcmMvc3RvcmFnZS92MS50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiOzs7QUFBQSw2QkFBd0I7QUFFeEIsTUFBTSx1QkFBdUIsR0FBRyxPQUFDLENBQUMsSUFBSSxDQUFDO0lBQ3JDLE1BQU07SUFDTixLQUFLO0lBQ0wsTUFBTTtJQUNOLE9BQU87SUFDUCxRQUFRO0NBQ1QsQ0FBQyxDQUFDO0FBRUgsTUFBTSxVQUFVLEdBQUcsT0FBQyxDQUFDLE1BQU0sQ0FDekIsT0FBQyxDQUFDLE1BQU0sRUFBRSxFQUNWLE9BQUMsQ0FBQyxNQUFNLENBQUM7SUFDUCxLQUFLLEVBQUUsT0FBQyxDQUFDLEtBQUssQ0FBQyx1QkFBdUIsQ0FBQyxDQUFDLFFBQVEsRUFBRTtJQUNsRCxhQUFhLEVBQUUsT0FBQyxDQUFDLEtBQUssQ0FBQyx1QkFBdUIsQ0FBQyxDQUFDLFFBQVEsRUFBRTtJQUMxRCxNQUFNLEVBQUUsT0FBQyxDQUFDLEtBQUssQ0FBQyx1QkFBdUI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lhbGl6ZWQgYXJyYXkgb2YgYnVja2V0U2NoZW1hXG4gIH0pLFxufSk7XG4iXX0=
|
@@ -0,0 +1,27 @@
|
|
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,6 +1,6 @@
|
|
1
1
|
{
|
2
2
|
"name": "@aws-amplify/ai-constructs",
|
3
|
-
"version": "0.
|
3
|
+
"version": "0.0.0-test-20241010141034",
|
4
4
|
"type": "commonjs",
|
5
5
|
"publishConfig": {
|
6
6
|
"access": "public"
|
@@ -26,9 +26,16 @@
|
|
26
26
|
},
|
27
27
|
"license": "Apache-2.0",
|
28
28
|
"dependencies": {
|
29
|
+
"@aws-amplify/backend-output-schemas": "^1.3.0",
|
30
|
+
"@aws-amplify/platform-core": "^1.1.0",
|
29
31
|
"@aws-amplify/plugin-types": "^1.0.1",
|
30
32
|
"@aws-sdk/client-bedrock-runtime": "^3.622.0",
|
31
|
-
"@smithy/types": "^3.3.0"
|
33
|
+
"@smithy/types": "^3.3.0",
|
34
|
+
"json-schema-to-ts": "^3.1.1"
|
35
|
+
},
|
36
|
+
"devDependencies": {
|
37
|
+
"@aws-amplify/backend-output-storage": "^1.1.2",
|
38
|
+
"typescript": "^5.0.0"
|
32
39
|
},
|
33
40
|
"peerDependencies": {
|
34
41
|
"aws-cdk-lib": "^2.152.0",
|
@@ -3,6 +3,10 @@
|
|
3
3
|
All notable changes to this project will be documented in this file.
|
4
4
|
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
|
5
5
|
|
6
|
+
## [0.3.1-ai-streaming.0](https://github.com/aws-amplify/amplify-category-api/compare/@aws-amplify/graphql-conversation-transformer@0.3.0...@aws-amplify/graphql-conversation-transformer@0.3.1-ai-streaming.0) (2024-10-11)
|
7
|
+
|
8
|
+
**Note:** Version bump only for package @aws-amplify/graphql-conversation-transformer
|
9
|
+
|
6
10
|
# [0.3.0](https://github.com/aws-amplify/amplify-category-api/compare/@aws-amplify/graphql-conversation-transformer@0.2.2...@aws-amplify/graphql-conversation-transformer@0.3.0) (2024-10-10)
|
7
11
|
|
8
12
|
### Bug Fixes
|
@@ -8,6 +8,8 @@ export type MessageModel = {
|
|
8
8
|
messageSubscription: FieldDefinitionNode;
|
9
9
|
assistantMutationInput: InputObjectTypeDefinitionNode;
|
10
10
|
assistantMutationField: FieldDefinitionNode;
|
11
|
+
assistantStreamingMutationInput: InputObjectTypeDefinitionNode;
|
12
|
+
assistantStreamingMutationField: FieldDefinitionNode;
|
11
13
|
};
|
12
14
|
export declare const createMessageModel: (conversationModelName: string, messageModelName: string, referenceFieldName: string, capitalizedFieldName: string, conversationMessageInterface: NamedTypeNode) => MessageModel;
|
13
15
|
//# sourceMappingURL=message-model.d.ts.map
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"message-model.d.ts","sourceRoot":"","sources":["../../src/graphql-types/message-model.ts"],"names":[],"mappings":"AACA,OAAO,EACL,aAAa,EAEb,mBAAmB,EACnB,wBAAwB,EACxB,aAAa,EAEb,6BAA6B,EAC9B,MAAM,SAAS,CAAC;AAsBjB,MAAM,MAAM,YAAY,GAAG;IACzB,oBAAoB,EAAE,aAAa,CAAC;IACpC,qBAAqB,EAAE,aAAa,CAAC;IACrC,qCAAqC,EAAE,aAAa,CAAC;IACrD,wBAAwB,EAAE,mBAAmB,CAAC;IAC9C,YAAY,EAAE,wBAAwB,CAAC;IACvC,mBAAmB,EAAE,mBAAmB,CAAC;IACzC,sBAAsB,EAAE,6BAA6B,CAAC;IACtD,sBAAsB,EAAE,mBAAmB,CAAC;
|
1
|
+
{"version":3,"file":"message-model.d.ts","sourceRoot":"","sources":["../../src/graphql-types/message-model.ts"],"names":[],"mappings":"AACA,OAAO,EACL,aAAa,EAEb,mBAAmB,EACnB,wBAAwB,EACxB,aAAa,EAEb,6BAA6B,EAC9B,MAAM,SAAS,CAAC;AAsBjB,MAAM,MAAM,YAAY,GAAG;IACzB,oBAAoB,EAAE,aAAa,CAAC;IACpC,qBAAqB,EAAE,aAAa,CAAC;IACrC,qCAAqC,EAAE,aAAa,CAAC;IACrD,wBAAwB,EAAE,mBAAmB,CAAC;IAC9C,YAAY,EAAE,wBAAwB,CAAC;IACvC,mBAAmB,EAAE,mBAAmB,CAAC;IACzC,sBAAsB,EAAE,6BAA6B,CAAC;IACtD,sBAAsB,EAAE,mBAAmB,CAAC;IAC5C,+BAA+B,EAAE,6BAA6B,CAAC;IAC/D,+BAA+B,EAAE,mBAAmB,CAAC;CACtD,CAAC;AA6BF,eAAO,MAAM,kBAAkB,0BACN,MAAM,oBACX,MAAM,sBACJ,MAAM,wBACJ,MAAM,gCACE,aAAa,KAC1C,YAgDF,CAAC"}
|
@@ -7,14 +7,20 @@ const graphql_transformer_common_1 = require("graphql-transformer-common");
|
|
7
7
|
const createMessageModel = (conversationModelName, messageModelName, referenceFieldName, capitalizedFieldName, conversationMessageInterface) => {
|
8
8
|
const messageSubscriptionFieldName = `onCreateAssistantResponse${capitalizedFieldName}`;
|
9
9
|
const assistantMutationFieldName = `createAssistantResponse${capitalizedFieldName}`;
|
10
|
+
const assistantStreamingMutationFieldName = `createAssistantResponseStream${capitalizedFieldName}`;
|
10
11
|
const messageAuthDirective = constructMessageAuthDirective();
|
11
12
|
const messageModelDirective = constructMessageModelDirective();
|
12
13
|
const messageBelongsToConversationDirective = constructMessageSessionFieldBelongsToDirective(referenceFieldName);
|
13
14
|
const messageConversationField = constructMessageSessionField(messageBelongsToConversationDirective, conversationModelName);
|
14
15
|
const messageModel = constructConversationMessageModel(messageModelName, messageConversationField, referenceFieldName, [messageModelDirective, messageAuthDirective], conversationMessageInterface);
|
15
|
-
const messageSubscription = constructMessageSubscription(messageSubscriptionFieldName, messageModelName,
|
16
|
+
const messageSubscription = constructMessageSubscription(messageSubscriptionFieldName, messageModelName, [
|
17
|
+
assistantMutationFieldName,
|
18
|
+
assistantStreamingMutationFieldName,
|
19
|
+
]);
|
16
20
|
const assistantMutationInput = constructAssistantResponseMutationInput(messageModelName);
|
17
21
|
const assistantMutationField = constructAssistantMutationField(assistantMutationFieldName, messageModelName, assistantMutationInput.name.value);
|
22
|
+
const assistantStreamingMutationInput = constructAssistantResponseStreamingMutationInput(messageModelName);
|
23
|
+
const assistantStreamingMutationField = constructAssistantStreamingMutationField(assistantStreamingMutationFieldName, messageModelName, assistantStreamingMutationInput.name.value);
|
18
24
|
return {
|
19
25
|
messageAuthDirective,
|
20
26
|
messageModelDirective,
|
@@ -24,6 +30,8 @@ const createMessageModel = (conversationModelName, messageModelName, referenceFi
|
|
24
30
|
messageSubscription,
|
25
31
|
assistantMutationInput,
|
26
32
|
assistantMutationField,
|
33
|
+
assistantStreamingMutationInput,
|
34
|
+
assistantStreamingMutationField,
|
27
35
|
};
|
28
36
|
};
|
29
37
|
exports.createMessageModel = createMessageModel;
|
@@ -80,8 +88,8 @@ const constructConversationMessageModel = (modelName, sessionField, referenceFie
|
|
80
88
|
};
|
81
89
|
return object;
|
82
90
|
};
|
83
|
-
const constructMessageSubscription = (subscriptionName, conversationMessageTypeName,
|
84
|
-
const awsSubscribeDirective = (0, graphql_transformer_common_1.makeDirective)('aws_subscribe', [(0, graphql_transformer_common_1.makeArgument)('mutations', (0, graphql_transformer_common_1.makeValueNode)(
|
91
|
+
const constructMessageSubscription = (subscriptionName, conversationMessageTypeName, onMutationNames) => {
|
92
|
+
const awsSubscribeDirective = (0, graphql_transformer_common_1.makeDirective)('aws_subscribe', [(0, graphql_transformer_common_1.makeArgument)('mutations', (0, graphql_transformer_common_1.makeValueNode)(onMutationNames))]);
|
85
93
|
const cognitoAuthDirective = (0, graphql_transformer_common_1.makeDirective)('aws_cognito_user_pools', []);
|
86
94
|
const args = [(0, graphql_transformer_common_1.makeInputValueDefinition)('conversationId', (0, graphql_transformer_common_1.makeNamedType)('ID'))];
|
87
95
|
const subscriptionField = (0, graphql_transformer_common_1.makeField)(subscriptionName, args, (0, graphql_transformer_common_1.makeNamedType)(conversationMessageTypeName), [
|
@@ -108,4 +116,27 @@ const constructAssistantResponseMutationInput = (messageModelName) => {
|
|
108
116
|
],
|
109
117
|
};
|
110
118
|
};
|
119
|
+
const constructAssistantStreamingMutationField = (fieldName, messageModelName, inputTypeName) => {
|
120
|
+
const args = [(0, graphql_transformer_common_1.makeInputValueDefinition)('input', (0, graphql_transformer_common_1.makeNonNullType)((0, graphql_transformer_common_1.makeNamedType)(inputTypeName)))];
|
121
|
+
const cognitoAuthDirective = (0, graphql_transformer_common_1.makeDirective)('aws_cognito_user_pools', []);
|
122
|
+
const createAssistantResponseMutation = (0, graphql_transformer_common_1.makeField)(fieldName, args, (0, graphql_transformer_common_1.makeNamedType)(messageModelName), [cognitoAuthDirective]);
|
123
|
+
return createAssistantResponseMutation;
|
124
|
+
};
|
125
|
+
const constructAssistantResponseStreamingMutationInput = (messageModelName) => {
|
126
|
+
const inputName = `Create${messageModelName}AssistantStreamingInput`;
|
127
|
+
return {
|
128
|
+
kind: 'InputObjectTypeDefinition',
|
129
|
+
name: { kind: 'Name', value: inputName },
|
130
|
+
fields: [
|
131
|
+
(0, graphql_transformer_common_1.makeInputValueDefinition)('conversationId', (0, graphql_transformer_common_1.makeNonNullType)((0, graphql_transformer_common_1.makeNamedType)('ID'))),
|
132
|
+
(0, graphql_transformer_common_1.makeInputValueDefinition)('associatedUserMessageId', (0, graphql_transformer_common_1.makeNonNullType)((0, graphql_transformer_common_1.makeNamedType)('ID'))),
|
133
|
+
(0, graphql_transformer_common_1.makeInputValueDefinition)('contentBlockIndex', (0, graphql_transformer_common_1.makeNonNullType)((0, graphql_transformer_common_1.makeNamedType)('Int'))),
|
134
|
+
(0, graphql_transformer_common_1.makeInputValueDefinition)('contentBlockText', (0, graphql_transformer_common_1.makeNamedType)('String')),
|
135
|
+
(0, graphql_transformer_common_1.makeInputValueDefinition)('contentBlockDeltaIndex', (0, graphql_transformer_common_1.makeNamedType)('Int')),
|
136
|
+
(0, graphql_transformer_common_1.makeInputValueDefinition)('contentBlockToolUse', (0, graphql_transformer_common_1.makeNamedType)('String')),
|
137
|
+
(0, graphql_transformer_common_1.makeInputValueDefinition)('contentBlockDoneAtIndex', (0, graphql_transformer_common_1.makeNamedType)('Int')),
|
138
|
+
(0, graphql_transformer_common_1.makeInputValueDefinition)('stopReason', (0, graphql_transformer_common_1.makeNamedType)('String')),
|
139
|
+
],
|
140
|
+
};
|
141
|
+
};
|
111
142
|
//# sourceMappingURL=message-model.js.map
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"message-model.js","sourceRoot":"","sources":["../../src/graphql-types/message-model.ts"],"names":[],"mappings":";;;AAAA,wEAAqE;AACrE,qCAQiB;AACjB,2EAWoC;
|
1
|
+
{"version":3,"file":"message-model.js","sourceRoot":"","sources":["../../src/graphql-types/message-model.ts"],"names":[],"mappings":";;;AAAA,wEAAqE;AACrE,qCAQiB;AACjB,2EAWoC;AAkD7B,MAAM,kBAAkB,GAAG,CAChC,qBAA6B,EAC7B,gBAAwB,EACxB,kBAA0B,EAC1B,oBAA4B,EAC5B,4BAA2C,EAC7B,EAAE;IAChB,MAAM,4BAA4B,GAAG,4BAA4B,oBAAoB,EAAE,CAAC;IACxF,MAAM,0BAA0B,GAAG,0BAA0B,oBA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B,EAAiC,EAAE;IACnH,MAAM,SAAS,GAAG,SAAS,gBAAgB,yBAAyB,CAAC;IACrE,OAAO;QACL,IAAI,EAAE,2BAA2B;QACjC,IAAI,EAAE,EAAE,IAAI,EAAE,MAAM,EAAE,KAAK,EAAE,SAAS,EAAE;QACxC,MAAM,EAAE;YACN,IAAA,qDAAwB,EAAC,gBAAgB,EAAE,IAAA,4CAAe,EAAC,IAAA,0CAAa,EAAC,IAAI,CAAC,CAAC,CAAC;YAChF,IAAA,qDAAwB,EAAC,yBAAyB,EAAE,IAAA,4CAAe,EAAC,IAAA,0CAAa,EAAC,IAAI,CAAC,CAAC,CAAC;YACzF,IAAA,qDAAwB,EAAC,mBAAmB,EAAE,IAAA,4CAAe,EAAC,IAAA,0CAAa,EAAC,KAAK,CAAC,CAAC,CAAC;YAEpF,IAAA,qDAAwB,EAAC,kBAAkB,EAAE,IAAA,0CAAa,EAAC,QAAQ,CAAC,CAAC;YACrE,IAAA,qDAAwB,EAAC,wBAAwB,EAAE,IAAA,0CAAa,EAAC,KAAK,CAAC,CAAC;YAExE,IAAA,qDAAwB,EAAC,qBAAqB,EAAE,IAAA,0CAAa,EAAC,QAAQ,CAAC,CAAC;YACxE,IAAA,qDAAwB,EAAC,yBAAyB,EAAE,IAAA,0CAAa,EAAC,KAAK,CAAC,CAAC;YAEzE,IAAA,qDAAwB,EAAC,YAAY,EAAE,IAAA,0CAAa,EAAC,QAAQ,CAAC,CAAC;SAChE;KACF,CAAC;AACJ,CAAC,CAAC"}
|
@@ -0,0 +1,101 @@
|
|
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
|
+
return {
|
44
|
+
// differentiating with `<id>#response` for now. But this is no bueno.
|
45
|
+
// either the sentinel value needs to be included in the last chunk with content
|
46
|
+
// --- or ---
|
47
|
+
// we need to represent it in the client message type
|
48
|
+
// --- or ---
|
49
|
+
// we could potentially just throw an error here, but that's bad.
|
50
|
+
id: `${ctx.args.input.associatedUserMessageId}#response`,
|
51
|
+
createdAt: ctx.stash.defaultValues.createdAt,
|
52
|
+
updatedAt: ctx.stash.defaultValues.updatedAt,
|
53
|
+
conversationId: ctx.args.input.conversationId
|
54
|
+
};
|
55
|
+
}
|
56
|
+
return ctx.prev.result;
|
57
|
+
}
|
58
|
+
|
59
|
+
// TODO: handle toolUse blocks
|
60
|
+
function reduceChunks(events) {
|
61
|
+
// we're limited by the AppSync JS runtime as to what we can do here.
|
62
|
+
// so the code is uhh... a little creative.
|
63
|
+
function sortEvents(a, b) {
|
64
|
+
if (a.contentBlockIndex !== b.contentBlockIndex) {
|
65
|
+
return a.contentBlockIndex - b.contentBlockIndex;
|
66
|
+
}
|
67
|
+
return a.contentBlockDeltaIndex - b.contentBlockDeltaIndex;
|
68
|
+
}
|
69
|
+
|
70
|
+
// arrow functions and inline `function` declarations are not supported for sort.
|
71
|
+
events.sort(sortEvents);
|
72
|
+
|
73
|
+
// Group events by contentBlockIndex
|
74
|
+
const groupedEvents = events.reduce(function(acc, event) {
|
75
|
+
if (!acc[event.contentBlockIndex]) {
|
76
|
+
acc[event.contentBlockIndex] = [];
|
77
|
+
}
|
78
|
+
|
79
|
+
if (event.contentBlockText) {
|
80
|
+
acc[event.contentBlockIndex].push(event.contentBlockText);
|
81
|
+
}
|
82
|
+
|
83
|
+
if (event.contentBlockToolUse) {
|
84
|
+
acc[event.contentBlockIndex].push(event.contentBlockToolUse);
|
85
|
+
}
|
86
|
+
return acc;
|
87
|
+
}, {});
|
88
|
+
|
89
|
+
// Concatenate text for each content block
|
90
|
+
const content = Object.keys(groupedEvents).map((index) => {
|
91
|
+
const contentBlock = groupedEvents[index];
|
92
|
+
// toolUse blocks are sent as a single event.
|
93
|
+
if (contentBlock.length === 1 && contentBlock[0].toolUseId) {
|
94
|
+
return { toolUse: contentBlock[0] };
|
95
|
+
}
|
96
|
+
// text blocks are chunked so we join them.
|
97
|
+
return { text: contentBlock.join('') };
|
98
|
+
});
|
99
|
+
|
100
|
+
return content;
|
101
|
+
}
|
@@ -0,0 +1,4 @@
|
|
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
|
@@ -0,0 +1 @@
|
|
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"}
|
@@ -0,0 +1,25 @@
|
|
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.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
|
@@ -0,0 +1 @@
|
|
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,+BAA+B,CAAC;IACxF,OAAO,0CAAe,CAAC,+BAA+B,CAAC,QAAQ,EAAE,YAAY,CAAC,CAAC;AACjF,CAAC,CAAC;AAZW,QAAA,8CAA8C,kDAYzD"}
|