@aws-amplify/data-schema 1.8.0 → 1.9.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cjs/ModelField.js +6 -2
- package/dist/cjs/ModelField.js.map +1 -1
- package/dist/cjs/SchemaProcessor.js +4 -1
- package/dist/cjs/SchemaProcessor.js.map +1 -1
- package/dist/cjs/runtime/internals/ai/convertItemToConversation.js +5 -1
- package/dist/cjs/runtime/internals/ai/convertItemToConversation.js.map +1 -1
- package/dist/cjs/runtime/internals/ai/createCreateConversationFunction.js +1 -1
- package/dist/cjs/runtime/internals/ai/createCreateConversationFunction.js.map +1 -1
- package/dist/cjs/runtime/internals/ai/createDeleteConversationFunction.js +1 -1
- package/dist/cjs/runtime/internals/ai/createDeleteConversationFunction.js.map +1 -1
- package/dist/cjs/runtime/internals/ai/createGetConversationFunction.js +1 -1
- package/dist/cjs/runtime/internals/ai/createGetConversationFunction.js.map +1 -1
- package/dist/cjs/runtime/internals/ai/createListConversationsFunction.js +1 -1
- package/dist/cjs/runtime/internals/ai/createListConversationsFunction.js.map +1 -1
- package/dist/cjs/runtime/internals/ai/createSendMessageFunction.js.map +1 -1
- package/dist/esm/ModelField.d.ts +6 -2
- package/dist/esm/ModelField.mjs +6 -2
- package/dist/esm/ModelField.mjs.map +1 -1
- package/dist/esm/SchemaProcessor.mjs +5 -2
- package/dist/esm/SchemaProcessor.mjs.map +1 -1
- package/dist/esm/ai/ConversationType.d.ts +6 -1
- package/dist/esm/runtime/internals/ai/convertItemToConversation.d.ts +1 -1
- package/dist/esm/runtime/internals/ai/convertItemToConversation.mjs +5 -1
- package/dist/esm/runtime/internals/ai/convertItemToConversation.mjs.map +1 -1
- package/dist/esm/runtime/internals/ai/createCreateConversationFunction.mjs +1 -1
- package/dist/esm/runtime/internals/ai/createCreateConversationFunction.mjs.map +1 -1
- package/dist/esm/runtime/internals/ai/createDeleteConversationFunction.mjs +1 -1
- package/dist/esm/runtime/internals/ai/createDeleteConversationFunction.mjs.map +1 -1
- package/dist/esm/runtime/internals/ai/createGetConversationFunction.mjs +1 -1
- package/dist/esm/runtime/internals/ai/createGetConversationFunction.mjs.map +1 -1
- package/dist/esm/runtime/internals/ai/createListConversationsFunction.mjs +1 -1
- package/dist/esm/runtime/internals/ai/createListConversationsFunction.mjs.map +1 -1
- package/dist/esm/runtime/internals/ai/createSendMessageFunction.mjs.map +1 -1
- package/dist/meta/cjs.tsbuildinfo +1 -1
- package/package.json +2 -2
- package/src/ModelField.ts +8 -3
- package/src/SchemaProcessor.ts +4 -1
- package/src/ai/ConversationType.ts +8 -1
- package/src/runtime/internals/ai/convertItemToConversation.ts +8 -0
- package/src/runtime/internals/ai/createCreateConversationFunction.ts +4 -0
- package/src/runtime/internals/ai/createDeleteConversationFunction.ts +4 -0
- package/src/runtime/internals/ai/createGetConversationFunction.ts +4 -0
- package/src/runtime/internals/ai/createListConversationsFunction.ts +4 -0
|
@@ -7,12 +7,16 @@ exports.convertItemToConversation = void 0;
|
|
|
7
7
|
const createListMessagesFunction_1 = require("./createListMessagesFunction");
|
|
8
8
|
const createOnMessageFunction_1 = require("./createOnMessageFunction");
|
|
9
9
|
const createSendMessageFunction_1 = require("./createSendMessageFunction");
|
|
10
|
-
const convertItemToConversation = (client, modelIntrospection, conversationId, conversationRouteName, conversationMessageModel, getInternals) => {
|
|
10
|
+
const convertItemToConversation = (client, modelIntrospection, conversationId, conversationCreatedAt, conversationUpdatedAt, conversationRouteName, conversationMessageModel, getInternals, conversationMetadata, conversationName) => {
|
|
11
11
|
if (!conversationId) {
|
|
12
12
|
throw new Error(`An error occurred converting a ${conversationRouteName} conversation: Missing ID`);
|
|
13
13
|
}
|
|
14
14
|
return {
|
|
15
15
|
id: conversationId,
|
|
16
|
+
createdAt: conversationCreatedAt,
|
|
17
|
+
updatedAt: conversationUpdatedAt,
|
|
18
|
+
metadata: conversationMetadata,
|
|
19
|
+
name: conversationName,
|
|
16
20
|
onMessage: (0, createOnMessageFunction_1.createOnMessageFunction)(client, modelIntrospection, conversationId, conversationRouteName, getInternals),
|
|
17
21
|
sendMessage: (0, createSendMessageFunction_1.createSendMessageFunction)(client, modelIntrospection, conversationId, conversationRouteName, getInternals),
|
|
18
22
|
listMessages: (0, createListMessagesFunction_1.createListMessagesFunction)(client, modelIntrospection, conversationId, conversationMessageModel, getInternals),
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"convertItemToConversation.js","sources":["../../../../../src/runtime/internals/ai/convertItemToConversation.ts"],"sourcesContent":["\"use strict\";\n// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\nObject.defineProperty(exports, \"__esModule\", { value: true });\nexports.convertItemToConversation = void 0;\nconst createListMessagesFunction_1 = require(\"./createListMessagesFunction\");\nconst createOnMessageFunction_1 = require(\"./createOnMessageFunction\");\nconst createSendMessageFunction_1 = require(\"./createSendMessageFunction\");\nconst convertItemToConversation = (client, modelIntrospection, conversationId, conversationRouteName, conversationMessageModel, getInternals) => {\n if (!conversationId) {\n throw new Error(`An error occurred converting a ${conversationRouteName} conversation: Missing ID`);\n }\n return {\n id: conversationId,\n onMessage: (0, createOnMessageFunction_1.createOnMessageFunction)(client, modelIntrospection, conversationId, conversationRouteName, getInternals),\n sendMessage: (0, createSendMessageFunction_1.createSendMessageFunction)(client, modelIntrospection, conversationId, conversationRouteName, getInternals),\n listMessages: (0, createListMessagesFunction_1.createListMessagesFunction)(client, modelIntrospection, conversationId, conversationMessageModel, getInternals),\n };\n};\nexports.convertItemToConversation = convertItemToConversation;\n"],"names":[],"mappings":";;AACA;AACA;AACA,MAAM,CAAC,cAAc,CAAC,OAAO,EAAE,YAAY,EAAE,EAAE,KAAK,EAAE,IAAI,EAAE,CAAC,CAAC;AAC9D,OAAO,CAAC,yBAAyB,GAAG,KAAK,CAAC,CAAC;AAC3C,MAAM,4BAA4B,GAAG,OAAO,CAAC,8BAA8B,CAAC,CAAC;AAC7E,MAAM,yBAAyB,GAAG,OAAO,CAAC,2BAA2B,CAAC,CAAC;AACvE,MAAM,2BAA2B,GAAG,OAAO,CAAC,6BAA6B,CAAC,CAAC;AAC3E,MAAM,yBAAyB,GAAG,CAAC,MAAM,EAAE,kBAAkB,EAAE,cAAc,EAAE,qBAAqB,EAAE,wBAAwB,EAAE,YAAY,KAAK;
|
|
1
|
+
{"version":3,"file":"convertItemToConversation.js","sources":["../../../../../src/runtime/internals/ai/convertItemToConversation.ts"],"sourcesContent":["\"use strict\";\n// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\nObject.defineProperty(exports, \"__esModule\", { value: true });\nexports.convertItemToConversation = void 0;\nconst createListMessagesFunction_1 = require(\"./createListMessagesFunction\");\nconst createOnMessageFunction_1 = require(\"./createOnMessageFunction\");\nconst createSendMessageFunction_1 = require(\"./createSendMessageFunction\");\nconst convertItemToConversation = (client, modelIntrospection, conversationId, conversationCreatedAt, conversationUpdatedAt, conversationRouteName, conversationMessageModel, getInternals, conversationMetadata, conversationName) => {\n if (!conversationId) {\n throw new Error(`An error occurred converting a ${conversationRouteName} conversation: Missing ID`);\n }\n return {\n id: conversationId,\n createdAt: conversationCreatedAt,\n updatedAt: conversationUpdatedAt,\n metadata: conversationMetadata,\n name: conversationName,\n onMessage: (0, createOnMessageFunction_1.createOnMessageFunction)(client, modelIntrospection, conversationId, conversationRouteName, getInternals),\n sendMessage: (0, createSendMessageFunction_1.createSendMessageFunction)(client, modelIntrospection, conversationId, conversationRouteName, getInternals),\n listMessages: (0, createListMessagesFunction_1.createListMessagesFunction)(client, modelIntrospection, conversationId, conversationMessageModel, getInternals),\n };\n};\nexports.convertItemToConversation = convertItemToConversation;\n"],"names":[],"mappings":";;AACA;AACA;AACA,MAAM,CAAC,cAAc,CAAC,OAAO,EAAE,YAAY,EAAE,EAAE,KAAK,EAAE,IAAI,EAAE,CAAC,CAAC;AAC9D,OAAO,CAAC,yBAAyB,GAAG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= (0, get_1.getFactory)(client, modelIntrospection, conversationModel, 'CREATE', getInternals, false, (0, getCustomUserAgentDetails_1.getCustomUserAgentDetails)(getCustomUserAgentDetails_1.AiAction.CreateConversation));
|
|
12
12
|
const { data, errors } = await get();
|
|
13
13
|
return {
|
|
14
|
-
data: (0, convertItemToConversation_1.convertItemToConversation)(client, modelIntrospection, data?.id, conversationRouteName, conversationMessageModel, getInternals),
|
|
14
|
+
data: (0, convertItemToConversation_1.convertItemToConversation)(client, modelIntrospection, data?.id, data?.createdAt, data?.updatedAt, conversationRouteName, conversationMessageModel, getInternals, data?.metadata, data?.name),
|
|
15
15
|
errors,
|
|
16
16
|
};
|
|
17
17
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"createCreateConversationFunction.js","sources":["../../../../../src/runtime/internals/ai/createCreateConversationFunction.ts"],"sourcesContent":["\"use strict\";\n// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\nObject.defineProperty(exports, \"__esModule\", { value: true });\nexports.createCreateConversationFunction = void 0;\nconst get_1 = require(\"../operations/get\");\nconst convertItemToConversation_1 = require(\"./convertItemToConversation\");\nconst getCustomUserAgentDetails_1 = require(\"./getCustomUserAgentDetails\");\nconst createCreateConversationFunction = (client, modelIntrospection, conversationRouteName, conversationModel, conversationMessageModel, getInternals) => async () => {\n const get = (0, get_1.getFactory)(client, modelIntrospection, conversationModel, 'CREATE', getInternals, false, (0, getCustomUserAgentDetails_1.getCustomUserAgentDetails)(getCustomUserAgentDetails_1.AiAction.CreateConversation));\n const { data, errors } = await get();\n return {\n data: (0, convertItemToConversation_1.convertItemToConversation)(client, modelIntrospection, data?.id, conversationRouteName, conversationMessageModel, getInternals),\n errors,\n };\n};\nexports.createCreateConversationFunction = createCreateConversationFunction;\n"],"names":[],"mappings":";;AACA;AACA;AACA,MAAM,CAAC,cAAc,CAAC,OAAO,EAAE,YAAY,EAAE,EAAE,KAAK,EAAE,IAAI,EAAE,CAAC,CAAC;AAC9D,OAAO,CAAC,gCAAgC,GAAG,KAAK,CAAC,CAAC;AAClD,MAAM,KAAK,GAAG,OAAO,CAAC,mBAAmB,CAAC,CAAC;AAC3C,MAAM,2BAA2B,GAAG,OAAO,CAAC,6BAA6B,CAAC,CAAC;AAC3E,MAAM,2BAA2B,GAAG,OAAO,CAAC,6BAA6B,CAAC,CAAC;AAC3E,MAAM,gCAAgC,GAAG,CAAC,MAAM,EAAE,kBAAkB,EAAE,qBAAqB,EAAE,iBAAiB,EAAE,wBAAwB,EAAE,YAAY,KAAK,YAAY;AACvK,IAAI,MAAM,GAAG,GAAG,IAAI,KAAK,CAAC,UAAU,EAAE,MAAM,EAAE,kBAAkB,EAAE,iBAAiB,EAAE,QAAQ,EAAE,YAAY,EAAE,KAAK,EAAE,IAAI,2BAA2B,CAAC,yBAAyB,EAAE,2BAA2B,CAAC,QAAQ,CAAC,kBAAkB,CAAC,CAAC,CAAC;AACzO,IAAI,MAAM,EAAE,IAAI,EAAE,MAAM,EAAE,GAAG,MAAM,GAAG,EAAE,CAAC;AACzC,IAAI,OAAO;AACX,QAAQ,IAAI,EAAE,IAAI,2BAA2B,CAAC,yBAAyB,EAAE,MAAM,EAAE,kBAAkB,EAAE,IAAI,EAAE,EAAE,EAAE,qBAAqB,EAAE,wBAAwB,EAAE,YAAY,CAAC;
|
|
1
|
+
{"version":3,"file":"createCreateConversationFunction.js","sources":["../../../../../src/runtime/internals/ai/createCreateConversationFunction.ts"],"sourcesContent":["\"use strict\";\n// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\nObject.defineProperty(exports, \"__esModule\", { value: true });\nexports.createCreateConversationFunction = void 0;\nconst get_1 = require(\"../operations/get\");\nconst convertItemToConversation_1 = require(\"./convertItemToConversation\");\nconst getCustomUserAgentDetails_1 = require(\"./getCustomUserAgentDetails\");\nconst createCreateConversationFunction = (client, modelIntrospection, conversationRouteName, conversationModel, conversationMessageModel, getInternals) => async () => {\n const get = (0, get_1.getFactory)(client, modelIntrospection, conversationModel, 'CREATE', getInternals, false, (0, getCustomUserAgentDetails_1.getCustomUserAgentDetails)(getCustomUserAgentDetails_1.AiAction.CreateConversation));\n const { data, errors } = await get();\n return {\n data: (0, convertItemToConversation_1.convertItemToConversation)(client, modelIntrospection, data?.id, data?.createdAt, data?.updatedAt, conversationRouteName, conversationMessageModel, getInternals, data?.metadata, data?.name),\n errors,\n };\n};\nexports.createCreateConversationFunction = createCreateConversationFunction;\n"],"names":[],"mappings":";;AACA;AACA;AACA,MAAM,CAAC,cAAc,CAAC,OAAO,EAAE,YAAY,EAAE,EAAE,KAAK,EAAE,IAAI,EAAE,CAAC,CAAC;AAC9D,OAAO,CAAC,gCAAgC,GAAG,KAAK,CAAC,CAAC;AAClD,MAAM,KAAK,GAAG,OAAO,CAAC,mBAAmB,CAAC,CAAC;AAC3C,MAAM,2BAA2B,GAAG,OAAO,CAAC,6BAA6B,CAAC,CAAC;AAC3E,MAAM,2BAA2B,GAAG,OAAO,CAAC,6BAA6B,CAAC,CAAC;AAC3E,MAAM,gCAAgC,GAAG,CAAC,MAAM,EAAE,kBAAkB,EAAE,qBAAqB,EAAE,iBAAiB,EAAE,wBAAwB,EAAE,YAAY,KAAK,YAAY;AACvK,IAAI,MAAM,GAAG,GAAG,IAAI,KAAK,CAAC,UAAU,EAAE,MAAM,EAAE,kBAAkB,EAAE,iBAAiB,EAAE,QAAQ,EAAE,YAAY,EAAE,KAAK,EAAE,IAAI,2BAA2B,CAAC,yBAAyB,EAAE,2BAA2B,CAAC,QAAQ,CAAC,kBAAkB,CAAC,CAAC,CAAC;AACzO,IAAI,MAAM,EAAE,IAAI,EAAE,MAAM,EAAE,GAAG,MAAM,GAAG,EAAE,CAAC;AACzC,IAAI,OAAO;AACX,QAAQ,IAAI,EAAE,IAAI,2BAA2B,CAAC,yBAAyB,EAAE,MAAM,EAAE,kBAAkB,EAAE,IAAI,EAAE,EAAE,EAAE,IAAI,EAAE,SAAS,EAAE,IAAI,EAAE,SAAS,EAAE,qBAAqB,EAAE,wBAAwB,EAAE,YAAY,EAAE,IAAI,EAAE,QAAQ,EAAE,IAAI,EAAE,IAAI,CAAC;AAC3O,QAAQ,MAAM;AACd,KAAK,CAAC;AACN,CAAC,CAAC;AACF,OAAO,CAAC,gCAAgC,GAAG,gCAAgC;;"}
|
|
@@ -12,7 +12,7 @@ const createDeleteConversationFunction = (client, modelIntrospection, conversati
|
|
|
12
12
|
const { data, errors } = await deleteOperation({ id });
|
|
13
13
|
return {
|
|
14
14
|
data: data
|
|
15
|
-
? (0, convertItemToConversation_1.convertItemToConversation)(client, modelIntrospection, data?.id, conversationRouteName, conversationMessageModel, getInternals)
|
|
15
|
+
? (0, convertItemToConversation_1.convertItemToConversation)(client, modelIntrospection, data?.id, data?.createdAt, data?.updatedAt, conversationRouteName, conversationMessageModel, getInternals, data?.metadata, data?.name)
|
|
16
16
|
: data,
|
|
17
17
|
errors,
|
|
18
18
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"createDeleteConversationFunction.js","sources":["../../../../../src/runtime/internals/ai/createDeleteConversationFunction.ts"],"sourcesContent":["\"use strict\";\n// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\nObject.defineProperty(exports, \"__esModule\", { value: true });\nexports.createDeleteConversationFunction = void 0;\nconst get_1 = require(\"../operations/get\");\nconst convertItemToConversation_1 = require(\"./convertItemToConversation\");\nconst getCustomUserAgentDetails_1 = require(\"./getCustomUserAgentDetails\");\nconst createDeleteConversationFunction = (client, modelIntrospection, conversationRouteName, conversationModel, conversationMessageModel, getInternals) => async ({ id }) => {\n const deleteOperation = (0, get_1.getFactory)(client, modelIntrospection, conversationModel, 'DELETE', getInternals, false, (0, getCustomUserAgentDetails_1.getCustomUserAgentDetails)(getCustomUserAgentDetails_1.AiAction.DeleteConversation));\n const { data, errors } = await deleteOperation({ id });\n return {\n data: data\n ? (0, convertItemToConversation_1.convertItemToConversation)(client, modelIntrospection, data?.id, conversationRouteName, conversationMessageModel, getInternals)\n : data,\n errors,\n };\n};\nexports.createDeleteConversationFunction = createDeleteConversationFunction;\n"],"names":[],"mappings":";;AACA;AACA;AACA,MAAM,CAAC,cAAc,CAAC,OAAO,EAAE,YAAY,EAAE,EAAE,KAAK,EAAE,IAAI,EAAE,CAAC,CAAC;AAC9D,OAAO,CAAC,gCAAgC,GAAG,KAAK,CAAC,CAAC;AAClD,MAAM,KAAK,GAAG,OAAO,CAAC,mBAAmB,CAAC,CAAC;AAC3C,MAAM,2BAA2B,GAAG,OAAO,CAAC,6BAA6B,CAAC,CAAC;AAC3E,MAAM,2BAA2B,GAAG,OAAO,CAAC,6BAA6B,CAAC,CAAC;AAC3E,MAAM,gCAAgC,GAAG,CAAC,MAAM,EAAE,kBAAkB,EAAE,qBAAqB,EAAE,iBAAiB,EAAE,wBAAwB,EAAE,YAAY,KAAK,OAAO,EAAE,EAAE,EAAE,KAAK;AAC7K,IAAI,MAAM,eAAe,GAAG,IAAI,KAAK,CAAC,UAAU,EAAE,MAAM,EAAE,kBAAkB,EAAE,iBAAiB,EAAE,QAAQ,EAAE,YAAY,EAAE,KAAK,EAAE,IAAI,2BAA2B,CAAC,yBAAyB,EAAE,2BAA2B,CAAC,QAAQ,CAAC,kBAAkB,CAAC,CAAC,CAAC;AACrP,IAAI,MAAM,EAAE,IAAI,EAAE,MAAM,EAAE,GAAG,MAAM,eAAe,CAAC,EAAE,EAAE,EAAE,CAAC,CAAC;AAC3D,IAAI,OAAO;AACX,QAAQ,IAAI,EAAE,IAAI;AAClB,cAAc,IAAI,2BAA2B,CAAC,yBAAyB,EAAE,MAAM,EAAE,kBAAkB,EAAE,IAAI,EAAE,EAAE,EAAE,qBAAqB,EAAE,wBAAwB,EAAE,YAAY,CAAC;
|
|
1
|
+
{"version":3,"file":"createDeleteConversationFunction.js","sources":["../../../../../src/runtime/internals/ai/createDeleteConversationFunction.ts"],"sourcesContent":["\"use strict\";\n// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\nObject.defineProperty(exports, \"__esModule\", { value: true });\nexports.createDeleteConversationFunction = void 0;\nconst get_1 = require(\"../operations/get\");\nconst convertItemToConversation_1 = require(\"./convertItemToConversation\");\nconst getCustomUserAgentDetails_1 = require(\"./getCustomUserAgentDetails\");\nconst createDeleteConversationFunction = (client, modelIntrospection, conversationRouteName, conversationModel, conversationMessageModel, getInternals) => async ({ id }) => {\n const deleteOperation = (0, get_1.getFactory)(client, modelIntrospection, conversationModel, 'DELETE', getInternals, false, (0, getCustomUserAgentDetails_1.getCustomUserAgentDetails)(getCustomUserAgentDetails_1.AiAction.DeleteConversation));\n const { data, errors } = await deleteOperation({ id });\n return {\n data: data\n ? (0, convertItemToConversation_1.convertItemToConversation)(client, modelIntrospection, data?.id, data?.createdAt, data?.updatedAt, conversationRouteName, conversationMessageModel, getInternals, data?.metadata, data?.name)\n : data,\n errors,\n };\n};\nexports.createDeleteConversationFunction = createDeleteConversationFunction;\n"],"names":[],"mappings":";;AACA;AACA;AACA,MAAM,CAAC,cAAc,CAAC,OAAO,EAAE,YAAY,EAAE,EAAE,KAAK,EAAE,IAAI,EAAE,CAAC,CAAC;AAC9D,OAAO,CAAC,gCAAgC,GAAG,KAAK,CAAC,CAAC;AAClD,MAAM,KAAK,GAAG,OAAO,CAAC,mBAAmB,CAAC,CAAC;AAC3C,MAAM,2BAA2B,GAAG,OAAO,CAAC,6BAA6B,CAAC,CAAC;AAC3E,MAAM,2BAA2B,GAAG,OAAO,CAAC,6BAA6B,CAAC,CAAC;AAC3E,MAAM,gCAAgC,GAAG,CAAC,MAAM,EAAE,kBAAkB,EAAE,qBAAqB,EAAE,iBAAiB,EAAE,wBAAwB,EAAE,YAAY,KAAK,OAAO,EAAE,EAAE,EAAE,KAAK;AAC7K,IAAI,MAAM,eAAe,GAAG,IAAI,KAAK,CAAC,UAAU,EAAE,MAAM,EAAE,kBAAkB,EAAE,iBAAiB,EAAE,QAAQ,EAAE,YAAY,EAAE,KAAK,EAAE,IAAI,2BAA2B,CAAC,yBAAyB,EAAE,2BAA2B,CAAC,QAAQ,CAAC,kBAAkB,CAAC,CAAC,CAAC;AACrP,IAAI,MAAM,EAAE,IAAI,EAAE,MAAM,EAAE,GAAG,MAAM,eAAe,CAAC,EAAE,EAAE,EAAE,CAAC,CAAC;AAC3D,IAAI,OAAO;AACX,QAAQ,IAAI,EAAE,IAAI;AAClB,cAAc,IAAI,2BAA2B,CAAC,yBAAyB,EAAE,MAAM,EAAE,kBAAkB,EAAE,IAAI,EAAE,EAAE,EAAE,IAAI,EAAE,SAAS,EAAE,IAAI,EAAE,SAAS,EAAE,qBAAqB,EAAE,wBAAwB,EAAE,YAAY,EAAE,IAAI,EAAE,QAAQ,EAAE,IAAI,EAAE,IAAI,CAAC;AAC3O,cAAc,IAAI;AAClB,QAAQ,MAAM;AACd,KAAK,CAAC;AACN,CAAC,CAAC;AACF,OAAO,CAAC,gCAAgC,GAAG,gCAAgC;;"}
|
|
@@ -12,7 +12,7 @@ const createGetConversationFunction = (client, modelIntrospection, conversationR
|
|
|
12
12
|
const { data, errors } = await get({ id });
|
|
13
13
|
return {
|
|
14
14
|
data: data
|
|
15
|
-
? (0, convertItemToConversation_1.convertItemToConversation)(client, modelIntrospection, data.id, conversationRouteName, conversationMessageModel, getInternals)
|
|
15
|
+
? (0, convertItemToConversation_1.convertItemToConversation)(client, modelIntrospection, data.id, data.createdAt, data.updatedAt, conversationRouteName, conversationMessageModel, getInternals, data?.metadata, data?.name)
|
|
16
16
|
: data,
|
|
17
17
|
errors,
|
|
18
18
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"createGetConversationFunction.js","sources":["../../../../../src/runtime/internals/ai/createGetConversationFunction.ts"],"sourcesContent":["\"use strict\";\n// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\nObject.defineProperty(exports, \"__esModule\", { value: true });\nexports.createGetConversationFunction = void 0;\nconst get_1 = require(\"../operations/get\");\nconst convertItemToConversation_1 = require(\"./convertItemToConversation\");\nconst getCustomUserAgentDetails_1 = require(\"./getCustomUserAgentDetails\");\nconst createGetConversationFunction = (client, modelIntrospection, conversationRouteName, conversationModel, conversationMessageModel, getInternals) => async ({ id }) => {\n const get = (0, get_1.getFactory)(client, modelIntrospection, conversationModel, 'GET', getInternals, false, (0, getCustomUserAgentDetails_1.getCustomUserAgentDetails)(getCustomUserAgentDetails_1.AiAction.GetConversation));\n const { data, errors } = await get({ id });\n return {\n data: data\n ? (0, convertItemToConversation_1.convertItemToConversation)(client, modelIntrospection, data.id, conversationRouteName, conversationMessageModel, getInternals)\n : data,\n errors,\n };\n};\nexports.createGetConversationFunction = createGetConversationFunction;\n"],"names":[],"mappings":";;AACA;AACA;AACA,MAAM,CAAC,cAAc,CAAC,OAAO,EAAE,YAAY,EAAE,EAAE,KAAK,EAAE,IAAI,EAAE,CAAC,CAAC;AAC9D,OAAO,CAAC,6BAA6B,GAAG,KAAK,CAAC,CAAC;AAC/C,MAAM,KAAK,GAAG,OAAO,CAAC,mBAAmB,CAAC,CAAC;AAC3C,MAAM,2BAA2B,GAAG,OAAO,CAAC,6BAA6B,CAAC,CAAC;AAC3E,MAAM,2BAA2B,GAAG,OAAO,CAAC,6BAA6B,CAAC,CAAC;AAC3E,MAAM,6BAA6B,GAAG,CAAC,MAAM,EAAE,kBAAkB,EAAE,qBAAqB,EAAE,iBAAiB,EAAE,wBAAwB,EAAE,YAAY,KAAK,OAAO,EAAE,EAAE,EAAE,KAAK;AAC1K,IAAI,MAAM,GAAG,GAAG,IAAI,KAAK,CAAC,UAAU,EAAE,MAAM,EAAE,kBAAkB,EAAE,iBAAiB,EAAE,KAAK,EAAE,YAAY,EAAE,KAAK,EAAE,IAAI,2BAA2B,CAAC,yBAAyB,EAAE,2BAA2B,CAAC,QAAQ,CAAC,eAAe,CAAC,CAAC,CAAC;AACnO,IAAI,MAAM,EAAE,IAAI,EAAE,MAAM,EAAE,GAAG,MAAM,GAAG,CAAC,EAAE,EAAE,EAAE,CAAC,CAAC;AAC/C,IAAI,OAAO;AACX,QAAQ,IAAI,EAAE,IAAI;AAClB,cAAc,IAAI,2BAA2B,CAAC,yBAAyB,EAAE,MAAM,EAAE,kBAAkB,EAAE,IAAI,CAAC,EAAE,EAAE,qBAAqB,EAAE,wBAAwB,EAAE,YAAY,CAAC;
|
|
1
|
+
{"version":3,"file":"createGetConversationFunction.js","sources":["../../../../../src/runtime/internals/ai/createGetConversationFunction.ts"],"sourcesContent":["\"use strict\";\n// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\nObject.defineProperty(exports, \"__esModule\", { value: true });\nexports.createGetConversationFunction = void 0;\nconst get_1 = require(\"../operations/get\");\nconst convertItemToConversation_1 = require(\"./convertItemToConversation\");\nconst getCustomUserAgentDetails_1 = require(\"./getCustomUserAgentDetails\");\nconst createGetConversationFunction = (client, modelIntrospection, conversationRouteName, conversationModel, conversationMessageModel, getInternals) => async ({ id }) => {\n const get = (0, get_1.getFactory)(client, modelIntrospection, conversationModel, 'GET', getInternals, false, (0, getCustomUserAgentDetails_1.getCustomUserAgentDetails)(getCustomUserAgentDetails_1.AiAction.GetConversation));\n const { data, errors } = await get({ id });\n return {\n data: data\n ? (0, convertItemToConversation_1.convertItemToConversation)(client, modelIntrospection, data.id, data.createdAt, data.updatedAt, conversationRouteName, conversationMessageModel, getInternals, data?.metadata, data?.name)\n : data,\n errors,\n };\n};\nexports.createGetConversationFunction = createGetConversationFunction;\n"],"names":[],"mappings":";;AACA;AACA;AACA,MAAM,CAAC,cAAc,CAAC,OAAO,EAAE,YAAY,EAAE,EAAE,KAAK,EAAE,IAAI,EAAE,CAAC,CAAC;AAC9D,OAAO,CAAC,6BAA6B,GAAG,KAAK,CAAC,CAAC;AAC/C,MAAM,KAAK,GAAG,OAAO,CAAC,mBAAmB,CAAC,CAAC;AAC3C,MAAM,2BAA2B,GAAG,OAAO,CAAC,6BAA6B,CAAC,CAAC;AAC3E,MAAM,2BAA2B,GAAG,OAAO,CAAC,6BAA6B,CAAC,CAAC;AAC3E,MAAM,6BAA6B,GAAG,CAAC,MAAM,EAAE,kBAAkB,EAAE,qBAAqB,EAAE,iBAAiB,EAAE,wBAAwB,EAAE,YAAY,KAAK,OAAO,EAAE,EAAE,EAAE,KAAK;AAC1K,IAAI,MAAM,GAAG,GAAG,IAAI,KAAK,CAAC,UAAU,EAAE,MAAM,EAAE,kBAAkB,EAAE,iBAAiB,EAAE,KAAK,EAAE,YAAY,EAAE,KAAK,EAAE,IAAI,2BAA2B,CAAC,yBAAyB,EAAE,2BAA2B,CAAC,QAAQ,CAAC,eAAe,CAAC,CAAC,CAAC;AACnO,IAAI,MAAM,EAAE,IAAI,EAAE,MAAM,EAAE,GAAG,MAAM,GAAG,CAAC,EAAE,EAAE,EAAE,CAAC,CAAC;AAC/C,IAAI,OAAO;AACX,QAAQ,IAAI,EAAE,IAAI;AAClB,cAAc,IAAI,2BAA2B,CAAC,yBAAyB,EAAE,MAAM,EAAE,kBAAkB,EAAE,IAAI,CAAC,EAAE,EAAE,IAAI,CAAC,SAAS,EAAE,IAAI,CAAC,SAAS,EAAE,qBAAqB,EAAE,wBAAwB,EAAE,YAAY,EAAE,IAAI,EAAE,QAAQ,EAAE,IAAI,EAAE,IAAI,CAAC;AACxO,cAAc,IAAI;AAClB,QAAQ,MAAM;AACd,KAAK,CAAC;AACN,CAAC,CAAC;AACF,OAAO,CAAC,6BAA6B,GAAG,6BAA6B;;"}
|
|
@@ -12,7 +12,7 @@ const createListConversationsFunction = (client, modelIntrospection, conversatio
|
|
|
12
12
|
const { data, nextToken, errors } = await list(input);
|
|
13
13
|
return {
|
|
14
14
|
data: data.map((datum) => {
|
|
15
|
-
return (0, convertItemToConversation_1.convertItemToConversation)(client, modelIntrospection, datum.id, conversationRouteName, conversationMessageModel, getInternals);
|
|
15
|
+
return (0, convertItemToConversation_1.convertItemToConversation)(client, modelIntrospection, datum.id, datum.createdAt, datum.updatedAt, conversationRouteName, conversationMessageModel, getInternals, datum?.metadata, datum?.name);
|
|
16
16
|
}),
|
|
17
17
|
nextToken,
|
|
18
18
|
errors,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"createListConversationsFunction.js","sources":["../../../../../src/runtime/internals/ai/createListConversationsFunction.ts"],"sourcesContent":["\"use strict\";\n// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\nObject.defineProperty(exports, \"__esModule\", { value: true });\nexports.createListConversationsFunction = void 0;\nconst list_1 = require(\"../operations/list\");\nconst convertItemToConversation_1 = require(\"./convertItemToConversation\");\nconst getCustomUserAgentDetails_1 = require(\"./getCustomUserAgentDetails\");\nconst createListConversationsFunction = (client, modelIntrospection, conversationRouteName, conversationModel, conversationMessageModel, getInternals) => async (input) => {\n const list = (0, list_1.listFactory)(client, modelIntrospection, conversationModel, getInternals, false, (0, getCustomUserAgentDetails_1.getCustomUserAgentDetails)(getCustomUserAgentDetails_1.AiAction.ListConversations));\n const { data, nextToken, errors } = await list(input);\n return {\n data: data.map((datum) => {\n return (0, convertItemToConversation_1.convertItemToConversation)(client, modelIntrospection, datum.id, conversationRouteName, conversationMessageModel, getInternals);\n }),\n nextToken,\n errors,\n };\n};\nexports.createListConversationsFunction = createListConversationsFunction;\n"],"names":[],"mappings":";;AACA;AACA;AACA,MAAM,CAAC,cAAc,CAAC,OAAO,EAAE,YAAY,EAAE,EAAE,KAAK,EAAE,IAAI,EAAE,CAAC,CAAC;AAC9D,OAAO,CAAC,+BAA+B,GAAG,KAAK,CAAC,CAAC;AACjD,MAAM,MAAM,GAAG,OAAO,CAAC,oBAAoB,CAAC,CAAC;AAC7C,MAAM,2BAA2B,GAAG,OAAO,CAAC,6BAA6B,CAAC,CAAC;AAC3E,MAAM,2BAA2B,GAAG,OAAO,CAAC,6BAA6B,CAAC,CAAC;AAC3E,MAAM,+BAA+B,GAAG,CAAC,MAAM,EAAE,kBAAkB,EAAE,qBAAqB,EAAE,iBAAiB,EAAE,wBAAwB,EAAE,YAAY,KAAK,OAAO,KAAK,KAAK;AAC3K,IAAI,MAAM,IAAI,GAAG,IAAI,MAAM,CAAC,WAAW,EAAE,MAAM,EAAE,kBAAkB,EAAE,iBAAiB,EAAE,YAAY,EAAE,KAAK,EAAE,IAAI,2BAA2B,CAAC,yBAAyB,EAAE,2BAA2B,CAAC,QAAQ,CAAC,iBAAiB,CAAC,CAAC,CAAC;AACjO,IAAI,MAAM,EAAE,IAAI,EAAE,SAAS,EAAE,MAAM,EAAE,GAAG,MAAM,IAAI,CAAC,KAAK,CAAC,CAAC;AAC1D,IAAI,OAAO;AACX,QAAQ,IAAI,EAAE,IAAI,CAAC,GAAG,CAAC,CAAC,KAAK,KAAK;AAClC,YAAY,OAAO,IAAI,2BAA2B,CAAC,yBAAyB,EAAE,MAAM,EAAE,kBAAkB,EAAE,KAAK,CAAC,EAAE,EAAE,qBAAqB,EAAE,wBAAwB,EAAE,YAAY,CAAC,CAAC;
|
|
1
|
+
{"version":3,"file":"createListConversationsFunction.js","sources":["../../../../../src/runtime/internals/ai/createListConversationsFunction.ts"],"sourcesContent":["\"use strict\";\n// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\nObject.defineProperty(exports, \"__esModule\", { value: true });\nexports.createListConversationsFunction = void 0;\nconst list_1 = require(\"../operations/list\");\nconst convertItemToConversation_1 = require(\"./convertItemToConversation\");\nconst getCustomUserAgentDetails_1 = require(\"./getCustomUserAgentDetails\");\nconst createListConversationsFunction = (client, modelIntrospection, conversationRouteName, conversationModel, conversationMessageModel, getInternals) => async (input) => {\n const list = (0, list_1.listFactory)(client, modelIntrospection, conversationModel, getInternals, false, (0, getCustomUserAgentDetails_1.getCustomUserAgentDetails)(getCustomUserAgentDetails_1.AiAction.ListConversations));\n const { data, nextToken, errors } = await list(input);\n return {\n data: data.map((datum) => {\n return (0, convertItemToConversation_1.convertItemToConversation)(client, modelIntrospection, datum.id, datum.createdAt, datum.updatedAt, conversationRouteName, conversationMessageModel, getInternals, datum?.metadata, datum?.name);\n }),\n nextToken,\n errors,\n };\n};\nexports.createListConversationsFunction = createListConversationsFunction;\n"],"names":[],"mappings":";;AACA;AACA;AACA,MAAM,CAAC,cAAc,CAAC,OAAO,EAAE,YAAY,EAAE,EAAE,KAAK,EAAE,IAAI,EAAE,CAAC,CAAC;AAC9D,OAAO,CAAC,+BAA+B,GAAG,KAAK,CAAC,CAAC;AACjD,MAAM,MAAM,GAAG,OAAO,CAAC,oBAAoB,CAAC,CAAC;AAC7C,MAAM,2BAA2B,GAAG,OAAO,CAAC,6BAA6B,CAAC,CAAC;AAC3E,MAAM,2BAA2B,GAAG,OAAO,CAAC,6BAA6B,CAAC,CAAC;AAC3E,MAAM,+BAA+B,GAAG,CAAC,MAAM,EAAE,kBAAkB,EAAE,qBAAqB,EAAE,iBAAiB,EAAE,wBAAwB,EAAE,YAAY,KAAK,OAAO,KAAK,KAAK;AAC3K,IAAI,MAAM,IAAI,GAAG,IAAI,MAAM,CAAC,WAAW,EAAE,MAAM,EAAE,kBAAkB,EAAE,iBAAiB,EAAE,YAAY,EAAE,KAAK,EAAE,IAAI,2BAA2B,CAAC,yBAAyB,EAAE,2BAA2B,CAAC,QAAQ,CAAC,iBAAiB,CAAC,CAAC,CAAC;AACjO,IAAI,MAAM,EAAE,IAAI,EAAE,SAAS,EAAE,MAAM,EAAE,GAAG,MAAM,IAAI,CAAC,KAAK,CAAC,CAAC;AAC1D,IAAI,OAAO;AACX,QAAQ,IAAI,EAAE,IAAI,CAAC,GAAG,CAAC,CAAC,KAAK,KAAK;AAClC,YAAY,OAAO,IAAI,2BAA2B,CAAC,yBAAyB,EAAE,MAAM,EAAE,kBAAkB,EAAE,KAAK,CAAC,EAAE,EAAE,KAAK,CAAC,SAAS,EAAE,KAAK,CAAC,SAAS,EAAE,qBAAqB,EAAE,wBAAwB,EAAE,YAAY,EAAE,KAAK,EAAE,QAAQ,EAAE,KAAK,EAAE,IAAI,CAAC,CAAC;AACnP,SAAS,CAAC;AACV,QAAQ,SAAS;AACjB,QAAQ,MAAM;AACd,KAAK,CAAC;AACN,CAAC,CAAC;AACF,OAAO,CAAC,+BAA+B,GAAG,+BAA+B;;"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"createSendMessageFunction.js","sources":["../../../../../src/runtime/internals/ai/createSendMessageFunction.ts"],"sourcesContent":["\"use strict\";\n// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\nObject.defineProperty(exports, \"__esModule\", { value: true });\nexports.createSendMessageFunction = void 0;\nconst custom_1 = require(\"../operations/custom\");\nconst convertItemToConversationMessage_1 = require(\"./convertItemToConversationMessage\");\nconst conversationMessageSerializers_1 = require(\"./conversationMessageSerializers\");\nconst getCustomUserAgentDetails_1 = require(\"./getCustomUserAgentDetails\");\nconst createSendMessageFunction = (client, modelIntrospection, conversationId, conversationRouteName, getInternals) => async (input) => {\n const { conversations } = modelIntrospection;\n // Safe guard for standalone function. When called as part of client generation, this should never be falsy.\n if (!conversations) {\n return {};\n }\n const processedInput = typeof input === 'string' ? { content: [{ text: input }] } : input;\n const { content, aiContext, toolConfiguration } = processedInput;\n const sendSchema = conversations[conversationRouteName].message.send;\n const sendOperation = (0, custom_1.customOpFactory)(client, modelIntrospection, 'mutation', sendSchema, false, getInternals, (0, getCustomUserAgentDetails_1.getCustomUserAgentDetails)(getCustomUserAgentDetails_1.AiAction.SendMessage));\n const { data, errors } = await sendOperation({\n conversationId,\n content: (0, conversationMessageSerializers_1.serializeContent)(content),\n ...(aiContext && { aiContext: (0, conversationMessageSerializers_1.serializeAiContext)(aiContext) }),\n ...(toolConfiguration && {\n toolConfiguration: (0, conversationMessageSerializers_1.serializeToolConfiguration)(toolConfiguration),\n }),\n });\n return {\n data: data ? (0, convertItemToConversationMessage_1.convertItemToConversationMessage)(data) : data,\n errors,\n };\n};\nexports.createSendMessageFunction = createSendMessageFunction;\n"],"names":[],"mappings":";;AACA;AACA;AACA,MAAM,CAAC,cAAc,CAAC,OAAO,EAAE,YAAY,EAAE,EAAE,KAAK,EAAE,IAAI,EAAE,CAAC,CAAC;AAC9D,OAAO,CAAC,yBAAyB,GAAG,KAAK,CAAC,CAAC;AAC3C,MAAM,QAAQ,GAAG,OAAO,CAAC,sBAAsB,CAAC,CAAC;AACjD,MAAM,kCAAkC,GAAG,OAAO,CAAC,oCAAoC,CAAC,CAAC;AACzF,MAAM,gCAAgC,GAAG,OAAO,CAAC,kCAAkC,CAAC,CAAC;AACrF,MAAM,2BAA2B,GAAG,OAAO,CAAC,6BAA6B,CAAC,CAAC;AAC3E,MAAM,yBAAyB,GAAG,CAAC,MAAM,EAAE,kBAAkB,EAAE,cAAc,EAAE,qBAAqB,EAAE,YAAY,KAAK,OAAO,KAAK,KAAK;AACxI,IAAI,MAAM,EAAE,aAAa,EAAE,GAAG,kBAAkB,CAAC;AACjD;AACA,IAAI,IAAI,CAAC,aAAa,EAAE;AACxB,QAAQ,OAAO,EAAE,CAAC;AAClB,KAAK;AACL,IAAI,MAAM,cAAc,GAAG,OAAO,KAAK,KAAK,QAAQ,GAAG,EAAE,OAAO,EAAE,CAAC,EAAE,IAAI,EAAE,KAAK,EAAE,CAAC,EAAE,GAAG,KAAK,CAAC;AAC9F,IAAI,MAAM,EAAE,OAAO,EAAE,SAAS,EAAE,iBAAiB,EAAE,GAAG,cAAc,CAAC;AACrE,IAAI,MAAM,UAAU,GAAG,aAAa,CAAC,qBAAqB,CAAC,CAAC,OAAO,CAAC,IAAI,CAAC;AACzE,IAAI,MAAM,aAAa,GAAG,IAAI,QAAQ,CAAC,eAAe,EAAE,MAAM,EAAE,kBAAkB,EAAE,UAAU,EAAE,UAAU,EAAE,KAAK,EAAE,YAAY,EAAE,IAAI,2BAA2B,CAAC,yBAAyB,EAAE,2BAA2B,CAAC,QAAQ,CAAC,WAAW,CAAC,CAAC,CAAC;AAC/O,IAAI,MAAM,EAAE,IAAI,EAAE,MAAM,EAAE,GAAG,MAAM,aAAa,CAAC;AACjD,QAAQ,cAAc;AACtB,QAAQ,OAAO,EAAE,IAAI,gCAAgC,CAAC,gBAAgB,EAAE,OAAO,CAAC;AAChF,QAAQ,IAAI,SAAS,IAAI,EAAE,SAAS,EAAE,IAAI,gCAAgC,CAAC,kBAAkB,EAAE,SAAS,CAAC,EAAE;
|
|
1
|
+
{"version":3,"file":"createSendMessageFunction.js","sources":["../../../../../src/runtime/internals/ai/createSendMessageFunction.ts"],"sourcesContent":["\"use strict\";\n// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\nObject.defineProperty(exports, \"__esModule\", { value: true });\nexports.createSendMessageFunction = void 0;\nconst custom_1 = require(\"../operations/custom\");\nconst convertItemToConversationMessage_1 = require(\"./convertItemToConversationMessage\");\nconst conversationMessageSerializers_1 = require(\"./conversationMessageSerializers\");\nconst getCustomUserAgentDetails_1 = require(\"./getCustomUserAgentDetails\");\nconst createSendMessageFunction = (client, modelIntrospection, conversationId, conversationRouteName, getInternals) => async (input) => {\n const { conversations } = modelIntrospection;\n // Safe guard for standalone function. When called as part of client generation, this should never be falsy.\n if (!conversations) {\n return {};\n }\n const processedInput = typeof input === 'string' ? { content: [{ text: input }] } : input;\n const { content, aiContext, toolConfiguration } = processedInput;\n const sendSchema = conversations[conversationRouteName].message.send;\n const sendOperation = (0, custom_1.customOpFactory)(client, modelIntrospection, 'mutation', sendSchema, false, getInternals, (0, getCustomUserAgentDetails_1.getCustomUserAgentDetails)(getCustomUserAgentDetails_1.AiAction.SendMessage));\n const { data, errors } = await sendOperation({\n conversationId,\n content: (0, conversationMessageSerializers_1.serializeContent)(content),\n ...(aiContext && { aiContext: (0, conversationMessageSerializers_1.serializeAiContext)(aiContext) }),\n ...(toolConfiguration && {\n toolConfiguration: (0, conversationMessageSerializers_1.serializeToolConfiguration)(toolConfiguration),\n }),\n });\n return {\n data: data ? (0, convertItemToConversationMessage_1.convertItemToConversationMessage)(data) : data,\n errors,\n };\n};\nexports.createSendMessageFunction = createSendMessageFunction;\n"],"names":[],"mappings":";;AACA;AACA;AACA,MAAM,CAAC,cAAc,CAAC,OAAO,EAAE,YAAY,EAAE,EAAE,KAAK,EAAE,IAAI,EAAE,CAAC,CAAC;AAC9D,OAAO,CAAC,yBAAyB,GAAG,KAAK,CAAC,CAAC;AAC3C,MAAM,QAAQ,GAAG,OAAO,CAAC,sBAAsB,CAAC,CAAC;AACjD,MAAM,kCAAkC,GAAG,OAAO,CAAC,oCAAoC,CAAC,CAAC;AACzF,MAAM,gCAAgC,GAAG,OAAO,CAAC,kCAAkC,CAAC,CAAC;AACrF,MAAM,2BAA2B,GAAG,OAAO,CAAC,6BAA6B,CAAC,CAAC;AAC3E,MAAM,yBAAyB,GAAG,CAAC,MAAM,EAAE,kBAAkB,EAAE,cAAc,EAAE,qBAAqB,EAAE,YAAY,KAAK,OAAO,KAAK,KAAK;AACxI,IAAI,MAAM,EAAE,aAAa,EAAE,GAAG,kBAAkB,CAAC;AACjD;AACA,IAAI,IAAI,CAAC,aAAa,EAAE;AACxB,QAAQ,OAAO,EAAE,CAAC;AAClB,KAAK;AACL,IAAI,MAAM,cAAc,GAAG,OAAO,KAAK,KAAK,QAAQ,GAAG,EAAE,OAAO,EAAE,CAAC,EAAE,IAAI,EAAE,KAAK,EAAE,CAAC,EAAE,GAAG,KAAK,CAAC;AAC9F,IAAI,MAAM,EAAE,OAAO,EAAE,SAAS,EAAE,iBAAiB,EAAE,GAAG,cAAc,CAAC;AACrE,IAAI,MAAM,UAAU,GAAG,aAAa,CAAC,qBAAqB,CAAC,CAAC,OAAO,CAAC,IAAI,CAAC;AACzE,IAAI,MAAM,aAAa,GAAG,IAAI,QAAQ,CAAC,eAAe,EAAE,MAAM,EAAE,kBAAkB,EAAE,UAAU,EAAE,UAAU,EAAE,KAAK,EAAE,YAAY,EAAE,IAAI,2BAA2B,CAAC,yBAAyB,EAAE,2BAA2B,CAAC,QAAQ,CAAC,WAAW,CAAC,CAAC,CAAC;AAC/O,IAAI,MAAM,EAAE,IAAI,EAAE,MAAM,EAAE,GAAG,MAAM,aAAa,CAAC;AACjD,QAAQ,cAAc;AACtB,QAAQ,OAAO,EAAE,IAAI,gCAAgC,CAAC,gBAAgB,EAAE,OAAO,CAAC;AAChF,QAAQ,IAAI,SAAS,IAAI,EAAE,SAAS,EAAE,IAAI,gCAAgC,CAAC,kBAAkB,EAAE,SAAS,CAAC,EAAE,CAAC;AAC5G,QAAQ,IAAI,iBAAiB,IAAI;AACjC,YAAY,iBAAiB,EAAE,IAAI,gCAAgC,CAAC,0BAA0B,EAAE,iBAAiB,CAAC;AAClH,SAAS,CAAC;AACV,KAAK,CAAC,CAAC;AACP,IAAI,OAAO;AACX,QAAQ,IAAI,EAAE,IAAI,GAAG,IAAI,kCAAkC,CAAC,gCAAgC,EAAE,IAAI,CAAC,GAAG,IAAI;AAC1G,QAAQ,MAAM;AACd,KAAK,CAAC;AACN,CAAC,CAAC;AACF,OAAO,CAAC,yBAAyB,GAAG,yBAAyB;;"}
|
package/dist/esm/ModelField.d.ts
CHANGED
|
@@ -5,6 +5,10 @@ import type { brandSymbol } from './util/Brand.js';
|
|
|
5
5
|
* Used to "attach" auth types to ModelField without exposing them on the builder.
|
|
6
6
|
*/
|
|
7
7
|
export declare const __auth: unique symbol;
|
|
8
|
+
/**
|
|
9
|
+
* Used by `.default()` to represent a generated field (SQL).
|
|
10
|
+
*/
|
|
11
|
+
export declare const __generated: unique symbol;
|
|
8
12
|
declare const brandName = "modelField";
|
|
9
13
|
export declare enum ModelFieldType {
|
|
10
14
|
Id = "ID",
|
|
@@ -34,7 +38,7 @@ type FieldData = {
|
|
|
34
38
|
required: boolean;
|
|
35
39
|
array: boolean;
|
|
36
40
|
arrayRequired: boolean;
|
|
37
|
-
default: undefined | ModelFieldTypeParamOuter;
|
|
41
|
+
default: undefined | symbol | ModelFieldTypeParamOuter;
|
|
38
42
|
authorization: Authorization<any, any, any>[];
|
|
39
43
|
};
|
|
40
44
|
type ModelFieldTypeParamInner = string | number | boolean | Date | Json | null;
|
|
@@ -70,7 +74,7 @@ export type ModelField<T extends ModelFieldTypeParamOuter = ModelFieldTypeParamO
|
|
|
70
74
|
* Sets a default value for the scalar type.
|
|
71
75
|
* @param value the default value
|
|
72
76
|
*/
|
|
73
|
-
default(value
|
|
77
|
+
default(value?: ModelFieldTypeParamOuter): ModelField<T, UsedMethod | 'default'>;
|
|
74
78
|
/**
|
|
75
79
|
* Configures field-level authorization rules. Pass in an array of authorizations `(allow => allow.____)` to mix and match
|
|
76
80
|
* multiple authorization rules for this field.
|
package/dist/esm/ModelField.mjs
CHANGED
|
@@ -5,6 +5,10 @@ import { allow } from './Authorization.mjs';
|
|
|
5
5
|
* Used to "attach" auth types to ModelField without exposing them on the builder.
|
|
6
6
|
*/
|
|
7
7
|
const __auth = Symbol('__auth');
|
|
8
|
+
/**
|
|
9
|
+
* Used by `.default()` to represent a generated field (SQL).
|
|
10
|
+
*/
|
|
11
|
+
const __generated = Symbol('__generated');
|
|
8
12
|
const brandName = 'modelField';
|
|
9
13
|
var ModelFieldType;
|
|
10
14
|
(function (ModelFieldType) {
|
|
@@ -72,7 +76,7 @@ function _field(fieldType) {
|
|
|
72
76
|
return this;
|
|
73
77
|
},
|
|
74
78
|
default(val) {
|
|
75
|
-
data.default = val;
|
|
79
|
+
data.default = typeof val === 'undefined' ? __generated : val;
|
|
76
80
|
_meta.lastInvokedMethod = 'default';
|
|
77
81
|
return this;
|
|
78
82
|
},
|
|
@@ -195,5 +199,5 @@ function ipAddress() {
|
|
|
195
199
|
return _field(ModelFieldType.IPAddress);
|
|
196
200
|
}
|
|
197
201
|
|
|
198
|
-
export { ModelFieldDataType, ModelFieldType, __auth, boolean, date, datetime, email, float, id, integer, ipAddress, json, phone, string, time, timestamp, url };
|
|
202
|
+
export { ModelFieldDataType, ModelFieldType, __auth, __generated, boolean, date, datetime, email, float, id, integer, ipAddress, json, phone, string, time, timestamp, url };
|
|
199
203
|
//# sourceMappingURL=ModelField.mjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ModelField.mjs","sources":["../../src/ModelField.ts"],"sourcesContent":["import { brand } from './util';\nimport { allow } from './Authorization';\n/**\n * Used to \"attach\" auth types to ModelField without exposing them on the builder.\n */\nexport const __auth = Symbol('__auth');\nconst brandName = 'modelField';\nexport var ModelFieldType;\n(function (ModelFieldType) {\n ModelFieldType[\"Id\"] = \"ID\";\n ModelFieldType[\"String\"] = \"String\";\n ModelFieldType[\"Integer\"] = \"Int\";\n ModelFieldType[\"Float\"] = \"Float\";\n ModelFieldType[\"Boolean\"] = \"Boolean\";\n ModelFieldType[\"Date\"] = \"AWSDate\";\n ModelFieldType[\"Time\"] = \"AWSTime\";\n ModelFieldType[\"DateTime\"] = \"AWSDateTime\";\n ModelFieldType[\"Timestamp\"] = \"AWSTimestamp\";\n ModelFieldType[\"Email\"] = \"AWSEmail\";\n ModelFieldType[\"JSON\"] = \"AWSJSON\";\n ModelFieldType[\"Phone\"] = \"AWSPhone\";\n ModelFieldType[\"Url\"] = \"AWSURL\";\n ModelFieldType[\"IPAddress\"] = \"AWSIPAddress\";\n})(ModelFieldType || (ModelFieldType = {}));\nexport var ModelFieldDataType;\n(function (ModelFieldDataType) {\n ModelFieldDataType[\"String\"] = \"string\";\n ModelFieldDataType[\"Number\"] = \"number\";\n ModelFieldDataType[\"Boolean\"] = \"boolean\";\n ModelFieldDataType[\"Date\"] = \"Date\";\n ModelFieldDataType[\"JSON\"] = \"any\";\n})(ModelFieldDataType || (ModelFieldDataType = {}));\n/**\n * Model Field Implementation\n *\n * @typeParam T - holds the JS data type of the field; invoking the public methods changes this type accordingly\n * @example\n * string() => T = string | null\n * string().array() => T = Array<string | null> | null\n * string().array().required() => T = Array<string | null>\n * string().required().array().required() => T = Array<string>\n *\n * @param fieldType - stores the GraphQL data type of the field\n */\nfunction _field(fieldType) {\n const _meta = {\n lastInvokedMethod: null,\n };\n const data = {\n fieldType,\n required: false,\n array: false,\n arrayRequired: false,\n default: undefined,\n authorization: [],\n };\n const builder = {\n required() {\n if (_meta.lastInvokedMethod === 'array') {\n data.arrayRequired = true;\n }\n else {\n data.required = true;\n }\n _meta.lastInvokedMethod = 'required';\n return this;\n },\n array() {\n data.array = true;\n _meta.lastInvokedMethod = 'array';\n return this;\n },\n default(val) {\n data.default = val;\n _meta.lastInvokedMethod = 'default';\n return this;\n },\n authorization(callback) {\n const { resource: _, ...rest } = allow;\n const rules = callback(rest);\n data.authorization = Array.isArray(rules) ? rules : [rules];\n _meta.lastInvokedMethod = 'authorization';\n return this;\n },\n ...brand(brandName),\n };\n // this double cast gives us a Subtyping Constraint i.e., hides `data` from the public API,\n // but makes it available internally when needed\n return { ...builder, data };\n}\n/**\n * A unique identifier scalar type. This scalar is serialized like a String but isn't meant to be human-readable.\n * If not specified on create operations, a ULID will be auto-generated service-side.\n * @returns ID field definition\n */\nexport function id() {\n return _field(ModelFieldType.Id);\n}\n/**\n * A string scalar type that is represented server-side as a UTF-8 character sequence.\n * @returns string field definition\n */\nexport function string() {\n return _field(ModelFieldType.String);\n}\n/**\n * An integer scalar type with a supported value range between -(2^31) and 2^31-1.\n * @returns integer field definition\n */\nexport function integer() {\n return _field(ModelFieldType.Integer);\n}\n/**\n * A float scalar type following represented server-side as an IEEE 754 floating point value.\n * @returns float field definition\n */\nexport function float() {\n return _field(ModelFieldType.Float);\n}\n/**\n * A boolean scalar type that can be either true or false.\n * @returns boolean field definition\n */\nexport function boolean() {\n return _field(ModelFieldType.Boolean);\n}\n/**\n * A date scalar type that is represented server-side as an extended ISO 8601 date string in the format `YYYY-MM-DD`.\n * @returns date field definition\n */\nexport function date() {\n return _field(ModelFieldType.Date);\n}\n/**\n * A time scalar type that is represented server-side as an extended ISO 8601 time string in the format `hh:mm:ss.sss`.\n * @returns time field definition\n */\nexport function time() {\n return _field(ModelFieldType.Time);\n}\n/**\n * A date time scalar type that is represented server-side as an extended ISO 8601 date and time string in the format `YYYY-MM-DDThh:mm:ss.sssZ`.\n * @returns datetime field definition\n */\nexport function datetime() {\n return _field(ModelFieldType.DateTime);\n}\n/**\n * A timestamp scalar type that is represented by an integer value of the number of seconds before or after `1970-01-01-T00:00Z`.\n * @returns timestamp field definition\n */\nexport function timestamp() {\n return _field(ModelFieldType.Timestamp);\n}\n/**\n * An email scalar type that is represented server-side in the format `local-part@domain-part` as defined by RFC 822.\n * @returns email field definition\n */\nexport function email() {\n return _field(ModelFieldType.Email);\n}\n/**\n * A JSON scalar type that is automatically parsed and loaded server-side as maps, lists, or scalar values\n * rather than as the literal input strings.\n * @returns JSON field definition\n */\nexport function json() {\n return _field(ModelFieldType.JSON);\n}\n/**\n * A phone number scalar type thas is stored as a string server-side. Phone numbers can contain either spaces\n * or hyphens to separate digit groups. Phone numbers without a country code are assumed to be US/North American numbers adhering\n * to the North American Numbering Plan.\n * @returns phone number field definition\n */\nexport function phone() {\n return _field(ModelFieldType.Phone);\n}\n/**\n * A URL scalar type as defined by RFC 1738. For example, https://www.amazon.com/dp/B000NZW3KC/ or mailto:example@example.com.\n * URLs must contain a schema (http, mailto) and can't contain two forward slashes (//) in the path part.\n * @returns URL field definition\n */\nexport function url() {\n return _field(ModelFieldType.Url);\n}\n/**\n * A valid IPv4 or IPv6 address scalar type. IPv4 addresses are expected in quad-dotted notation (123.12.34.56). IPv6 addresses\n * are expected in non-bracketed, colon-separated format (1a2b:3c4b:🔢4567). You can include an optional CIDR suffix (123.45.67.89/16)\n * to indicate subnet mask.\n * @returns IP address field definition\n */\nexport function ipAddress() {\n return _field(ModelFieldType.IPAddress);\n}\n"],"names":[],"mappings":";;;AAEA;AACA;AACA;AACY,MAAC,MAAM,GAAG,MAAM,CAAC,QAAQ,EAAE;AACvC,MAAM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AI,OAAO,MAAM,CAAC,cAAc,CAAC,IAAI,CAAC,CAAC;AACvC,CAAC;AACD;AACA;AACA;AACA;AACO,SAAS,QAAQ,GAAG;AAC3B,IAAI,OAAO,MAAM,CAAC,cAAc,CAAC,QAAQ,CAAC,CAAC;AAC3C,CAAC;AACD;AACA;AACA;AACA;AACO,SAAS,SAAS,GAAG;AAC5B,IAAI,OAAO,MAAM,CAAC,cAAc,CAAC,SAAS,CAAC,CAAC;AAC5C,CAAC;AACD;AACA;AACA;AACA;AACO,SAAS,KAAK,GAAG;AACxB,IAAI,OAAO,MAAM,CAAC,cAAc,CAAC,KAAK,CAAC,CAAC;AACxC,CAAC;AACD;AACA;AACA;AACA;AACA;AACO,SAAS,IAAI,GAAG;AACvB,IAAI,OAAO,MAAM,CAAC,cAAc,CAAC,IAAI,CAAC,CAAC;AACvC,CAAC;AACD;AACA;AACA;AACA;AACA;AACA;AACO,SAAS,KAAK,GAAG;AACxB,IAAI,OAAO,MAAM,CAAC,cAAc,CAAC,KAAK,CAAC,CAAC;AACxC,CAAC;AACD;AACA;AACA;AACA;AACA;AACO,SAAS,GAAG,GAAG;AACtB,IAAI,OAAO,MAAM,CAAC,cAAc,CAAC,GAAG,CAAC,CAAC;AACtC,CAAC;AACD;AACA;AACA;AACA;AACA;AACA;AACO,SAAS,SAAS,GAAG;AAC5B,IAAI,OAAO,MAAM,CAAC,cAAc,CAAC,SAAS,CAAC,CAAC;AAC5C;;;;"}
|
|
1
|
+
{"version":3,"file":"ModelField.mjs","sources":["../../src/ModelField.ts"],"sourcesContent":["import { brand } from './util';\nimport { allow } from './Authorization';\n/**\n * Used to \"attach\" auth types to ModelField without exposing them on the builder.\n */\nexport const __auth = Symbol('__auth');\n/**\n * Used by `.default()` to represent a generated field (SQL).\n */\nexport const __generated = Symbol('__generated');\nconst brandName = 'modelField';\nexport var ModelFieldType;\n(function (ModelFieldType) {\n ModelFieldType[\"Id\"] = \"ID\";\n ModelFieldType[\"String\"] = \"String\";\n ModelFieldType[\"Integer\"] = \"Int\";\n ModelFieldType[\"Float\"] = \"Float\";\n ModelFieldType[\"Boolean\"] = \"Boolean\";\n ModelFieldType[\"Date\"] = \"AWSDate\";\n ModelFieldType[\"Time\"] = \"AWSTime\";\n ModelFieldType[\"DateTime\"] = \"AWSDateTime\";\n ModelFieldType[\"Timestamp\"] = \"AWSTimestamp\";\n ModelFieldType[\"Email\"] = \"AWSEmail\";\n ModelFieldType[\"JSON\"] = \"AWSJSON\";\n ModelFieldType[\"Phone\"] = \"AWSPhone\";\n ModelFieldType[\"Url\"] = \"AWSURL\";\n ModelFieldType[\"IPAddress\"] = \"AWSIPAddress\";\n})(ModelFieldType || (ModelFieldType = {}));\nexport var ModelFieldDataType;\n(function (ModelFieldDataType) {\n ModelFieldDataType[\"String\"] = \"string\";\n ModelFieldDataType[\"Number\"] = \"number\";\n ModelFieldDataType[\"Boolean\"] = \"boolean\";\n ModelFieldDataType[\"Date\"] = \"Date\";\n ModelFieldDataType[\"JSON\"] = \"any\";\n})(ModelFieldDataType || (ModelFieldDataType = {}));\n/**\n * Model Field Implementation\n *\n * @typeParam T - holds the JS data type of the field; invoking the public methods changes this type accordingly\n * @example\n * string() => T = string | null\n * string().array() => T = Array<string | null> | null\n * string().array().required() => T = Array<string | null>\n * string().required().array().required() => T = Array<string>\n *\n * @param fieldType - stores the GraphQL data type of the field\n */\nfunction _field(fieldType) {\n const _meta = {\n lastInvokedMethod: null,\n };\n const data = {\n fieldType,\n required: false,\n array: false,\n arrayRequired: false,\n default: undefined,\n authorization: [],\n };\n const builder = {\n required() {\n if (_meta.lastInvokedMethod === 'array') {\n data.arrayRequired = true;\n }\n else {\n data.required = true;\n }\n _meta.lastInvokedMethod = 'required';\n return this;\n },\n array() {\n data.array = true;\n _meta.lastInvokedMethod = 'array';\n return this;\n },\n default(val) {\n data.default = typeof val === 'undefined' ? __generated : val;\n _meta.lastInvokedMethod = 'default';\n return this;\n },\n authorization(callback) {\n const { resource: _, ...rest } = allow;\n const rules = callback(rest);\n data.authorization = Array.isArray(rules) ? rules : [rules];\n _meta.lastInvokedMethod = 'authorization';\n return this;\n },\n ...brand(brandName),\n };\n // this double cast gives us a Subtyping Constraint i.e., hides `data` from the public API,\n // but makes it available internally when needed\n return { ...builder, data };\n}\n/**\n * A unique identifier scalar type. This scalar is serialized like a String but isn't meant to be human-readable.\n * If not specified on create operations, a ULID will be auto-generated service-side.\n * @returns ID field definition\n */\nexport function id() {\n return _field(ModelFieldType.Id);\n}\n/**\n * A string scalar type that is represented server-side as a UTF-8 character sequence.\n * @returns string field definition\n */\nexport function string() {\n return _field(ModelFieldType.String);\n}\n/**\n * An integer scalar type with a supported value range between -(2^31) and 2^31-1.\n * @returns integer field definition\n */\nexport function integer() {\n return _field(ModelFieldType.Integer);\n}\n/**\n * A float scalar type following represented server-side as an IEEE 754 floating point value.\n * @returns float field definition\n */\nexport function float() {\n return _field(ModelFieldType.Float);\n}\n/**\n * A boolean scalar type that can be either true or false.\n * @returns boolean field definition\n */\nexport function boolean() {\n return _field(ModelFieldType.Boolean);\n}\n/**\n * A date scalar type that is represented server-side as an extended ISO 8601 date string in the format `YYYY-MM-DD`.\n * @returns date field definition\n */\nexport function date() {\n return _field(ModelFieldType.Date);\n}\n/**\n * A time scalar type that is represented server-side as an extended ISO 8601 time string in the format `hh:mm:ss.sss`.\n * @returns time field definition\n */\nexport function time() {\n return _field(ModelFieldType.Time);\n}\n/**\n * A date time scalar type that is represented server-side as an extended ISO 8601 date and time string in the format `YYYY-MM-DDThh:mm:ss.sssZ`.\n * @returns datetime field definition\n */\nexport function datetime() {\n return _field(ModelFieldType.DateTime);\n}\n/**\n * A timestamp scalar type that is represented by an integer value of the number of seconds before or after `1970-01-01-T00:00Z`.\n * @returns timestamp field definition\n */\nexport function timestamp() {\n return _field(ModelFieldType.Timestamp);\n}\n/**\n * An email scalar type that is represented server-side in the format `local-part@domain-part` as defined by RFC 822.\n * @returns email field definition\n */\nexport function email() {\n return _field(ModelFieldType.Email);\n}\n/**\n * A JSON scalar type that is automatically parsed and loaded server-side as maps, lists, or scalar values\n * rather than as the literal input strings.\n * @returns JSON field definition\n */\nexport function json() {\n return _field(ModelFieldType.JSON);\n}\n/**\n * A phone number scalar type thas is stored as a string server-side. Phone numbers can contain either spaces\n * or hyphens to separate digit groups. Phone numbers without a country code are assumed to be US/North American numbers adhering\n * to the North American Numbering Plan.\n * @returns phone number field definition\n */\nexport function phone() {\n return _field(ModelFieldType.Phone);\n}\n/**\n * A URL scalar type as defined by RFC 1738. For example, https://www.amazon.com/dp/B000NZW3KC/ or mailto:example@example.com.\n * URLs must contain a schema (http, mailto) and can't contain two forward slashes (//) in the path part.\n * @returns URL field definition\n */\nexport function url() {\n return _field(ModelFieldType.Url);\n}\n/**\n * A valid IPv4 or IPv6 address scalar type. IPv4 addresses are expected in quad-dotted notation (123.12.34.56). IPv6 addresses\n * are expected in non-bracketed, colon-separated format (1a2b:3c4b:🔢4567). You can include an optional CIDR suffix (123.45.67.89/16)\n * to indicate subnet mask.\n * @returns IP address field definition\n */\nexport function ipAddress() {\n return _field(ModelFieldType.IPAddress);\n}\n"],"names":[],"mappings":";;;AAEA;AACA;AACA;AACY,MAAC,MAAM,GAAG,MAAM,CAAC,QAAQ,EAAE;AACvC;AACA;AACA;AACY,MAAC,WAAW,GAAG,MAAM,CAAC,aAAa,EAAE;AACjD,MAAM,SAAS,GAAG,YAAY,CAAC;AACrB,IAAC,eAAe;AAC1B,CAAC,UAAU,cAAc,EAAE;AAC3B,IAAI,cAAc,CAAC,IAAI,CAAC,GAAG,IAAI,CAAC;AAChC,IAAI,cAAc,CAAC,QAAQ,CAAC,GAAG,QAAQ,CAAC;AACxC,IAAI,cAAc,CAAC,SAAS,CAAC,GAAG,KAAK,CAAC;AACtC,IAAI,cAAc,CAAC,OAAO,CAAC,GAAG,OAAO,CAAC;AACtC,IAAI,cAAc,CAAC,SAAS,CAAC,GAAG,SAAS,CAAC;AAC1C,IAAI,cAAc,CAAC,MAAM,C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G;AACxB,IAAI,OAAO,MAAM,CAAC,cAAc,CAAC,KAAK,CAAC,CAAC;AACxC,CAAC;AACD;AACA;AACA;AACA;AACA;AACO,SAAS,IAAI,GAAG;AACvB,IAAI,OAAO,MAAM,CAAC,cAAc,CAAC,IAAI,CAAC,CAAC;AACvC,CAAC;AACD;AACA;AACA;AACA;AACA;AACA;AACO,SAAS,KAAK,GAAG;AACxB,IAAI,OAAO,MAAM,CAAC,cAAc,CAAC,KAAK,CAAC,CAAC;AACxC,CAAC;AACD;AACA;AACA;AACA;AACA;AACO,SAAS,GAAG,GAAG;AACtB,IAAI,OAAO,MAAM,CAAC,cAAc,CAAC,GAAG,CAAC,CAAC;AACtC,CAAC;AACD;AACA;AACA;AACA;AACA;AACA;AACO,SAAS,SAAS,GAAG;AAC5B,IAAI,OAAO,MAAM,CAAC,cAAc,CAAC,SAAS,CAAC,CAAC;AAC5C;;;;"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { ModelFieldType, string } from './ModelField.mjs';
|
|
1
|
+
import { ModelFieldType, string, __generated } from './ModelField.mjs';
|
|
2
2
|
import { ModelRelationshipTypes } from './ModelRelationalField.mjs';
|
|
3
3
|
import { accessData, accessSchemaData } from './Authorization.mjs';
|
|
4
4
|
import { CustomOperationNames } from './CustomOperation.mjs';
|
|
@@ -92,7 +92,10 @@ function scalarFieldToGql(fieldDef, identifier, secondaryIndexes = []) {
|
|
|
92
92
|
field += '!';
|
|
93
93
|
}
|
|
94
94
|
}
|
|
95
|
-
if (_default
|
|
95
|
+
if (_default === __generated) {
|
|
96
|
+
field += ` @default`;
|
|
97
|
+
}
|
|
98
|
+
else if (_default !== undefined) {
|
|
96
99
|
field += ` @default(value: "${_default?.toString()}")`;
|
|
97
100
|
}
|
|
98
101
|
for (const index of secondaryIndexes) {
|