@aws-amplify/data-schema 1.19.0 → 1.20.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.
Files changed (198) hide show
  1. package/dist/cjs/Authorization.js.map +1 -1
  2. package/dist/cjs/ClientSchema/utilities/index.js.map +1 -1
  3. package/dist/cjs/CombineSchema.js +2 -2
  4. package/dist/cjs/CombineSchema.js.map +1 -1
  5. package/dist/cjs/CustomOperation.js +5 -5
  6. package/dist/cjs/CustomOperation.js.map +1 -1
  7. package/dist/cjs/CustomType.js +1 -2
  8. package/dist/cjs/CustomType.js.map +1 -1
  9. package/dist/cjs/EnumType.js +1 -2
  10. package/dist/cjs/EnumType.js.map +1 -1
  11. package/dist/cjs/Handler.js +2 -2
  12. package/dist/cjs/Handler.js.map +1 -1
  13. package/dist/cjs/ModelField.js +24 -17
  14. package/dist/cjs/ModelField.js.map +1 -1
  15. package/dist/cjs/ModelIndex.js +1 -2
  16. package/dist/cjs/ModelIndex.js.map +1 -1
  17. package/dist/cjs/ModelRelationshipField.js +4 -4
  18. package/dist/cjs/ModelRelationshipField.js.map +1 -1
  19. package/dist/cjs/ModelSchema.js +3 -3
  20. package/dist/cjs/ModelSchema.js.map +1 -1
  21. package/dist/cjs/ModelType.js +2 -2
  22. package/dist/cjs/ModelType.js.map +1 -1
  23. package/dist/cjs/RefType.js +1 -2
  24. package/dist/cjs/RefType.js.map +1 -1
  25. package/dist/cjs/SchemaProcessor.js +12 -3
  26. package/dist/cjs/SchemaProcessor.js.map +1 -1
  27. package/dist/cjs/Validate.js +145 -0
  28. package/dist/cjs/Validate.js.map +1 -0
  29. package/dist/cjs/a.js.map +1 -1
  30. package/dist/cjs/ai/ConversationSchemaGraphQLTypes.js.map +1 -1
  31. package/dist/cjs/ai/ConversationSchemaProcessor.js.map +1 -1
  32. package/dist/cjs/ai/ConversationType.js +3 -3
  33. package/dist/cjs/ai/ConversationType.js.map +1 -1
  34. package/dist/cjs/ai/ModelType.js +1 -2
  35. package/dist/cjs/ai/ModelType.js.map +1 -1
  36. package/dist/cjs/index.js.map +1 -1
  37. package/dist/cjs/internals/index.js.map +1 -1
  38. package/dist/cjs/runtime/addSchemaToClient.js +1 -2
  39. package/dist/cjs/runtime/addSchemaToClient.js.map +1 -1
  40. package/dist/cjs/runtime/addSchemaToClientWithInstance.js +1 -2
  41. package/dist/cjs/runtime/addSchemaToClientWithInstance.js.map +1 -1
  42. package/dist/cjs/runtime/bridge-types.js.map +1 -1
  43. package/dist/cjs/runtime/client/index.js.map +1 -1
  44. package/dist/cjs/runtime/client/index.v3.js.map +1 -1
  45. package/dist/cjs/runtime/index.js.map +1 -1
  46. package/dist/cjs/runtime/index.v3.js.map +1 -1
  47. package/dist/cjs/runtime/internals/APIClient.js +10 -10
  48. package/dist/cjs/runtime/internals/APIClient.js.map +1 -1
  49. package/dist/cjs/runtime/internals/ai/conversationMessageDeserializers.js.map +1 -1
  50. package/dist/cjs/runtime/internals/ai/conversationMessageSerializers.js.map +1 -1
  51. package/dist/cjs/runtime/internals/ai/conversationStreamEventDeserializers.js.map +1 -1
  52. package/dist/cjs/runtime/internals/ai/convertItemToConversation.js.map +1 -1
  53. package/dist/cjs/runtime/internals/ai/convertItemToConversationMessage.js.map +1 -1
  54. package/dist/cjs/runtime/internals/ai/createCreateConversationFunction.js.map +1 -1
  55. package/dist/cjs/runtime/internals/ai/createDeleteConversationFunction.js.map +1 -1
  56. package/dist/cjs/runtime/internals/ai/createGetConversationFunction.js.map +1 -1
  57. package/dist/cjs/runtime/internals/ai/createListConversationsFunction.js.map +1 -1
  58. package/dist/cjs/runtime/internals/ai/createListMessagesFunction.js.map +1 -1
  59. package/dist/cjs/runtime/internals/ai/createOnStreamEventFunction.js.map +1 -1
  60. package/dist/cjs/runtime/internals/ai/createSendMessageFunction.js.map +1 -1
  61. package/dist/cjs/runtime/internals/ai/createUpdateConversationFunction.js.map +1 -1
  62. package/dist/cjs/runtime/internals/ai/getCustomUserAgentDetails.js +2 -2
  63. package/dist/cjs/runtime/internals/ai/getCustomUserAgentDetails.js.map +1 -1
  64. package/dist/cjs/runtime/internals/cancellation.js +2 -3
  65. package/dist/cjs/runtime/internals/cancellation.js.map +1 -1
  66. package/dist/cjs/runtime/internals/clientUtils.js.map +1 -1
  67. package/dist/cjs/runtime/internals/generateCustomOperationsProperty.js +4 -5
  68. package/dist/cjs/runtime/internals/generateCustomOperationsProperty.js.map +1 -1
  69. package/dist/cjs/runtime/internals/index.js.map +1 -1
  70. package/dist/cjs/runtime/internals/operations/custom.js +1 -2
  71. package/dist/cjs/runtime/internals/operations/custom.js.map +1 -1
  72. package/dist/cjs/runtime/internals/operations/get.js +1 -2
  73. package/dist/cjs/runtime/internals/operations/get.js.map +1 -1
  74. package/dist/cjs/runtime/internals/operations/indexQuery.js +1 -2
  75. package/dist/cjs/runtime/internals/operations/indexQuery.js.map +1 -1
  76. package/dist/cjs/runtime/internals/operations/list.js +1 -2
  77. package/dist/cjs/runtime/internals/operations/list.js.map +1 -1
  78. package/dist/cjs/runtime/internals/operations/observeQuery.js +1 -2
  79. package/dist/cjs/runtime/internals/operations/observeQuery.js.map +1 -1
  80. package/dist/cjs/runtime/internals/operations/subscription.js +1 -2
  81. package/dist/cjs/runtime/internals/operations/subscription.js.map +1 -1
  82. package/dist/cjs/runtime/internals/operations/utils.js +2 -3
  83. package/dist/cjs/runtime/internals/operations/utils.js.map +1 -1
  84. package/dist/cjs/runtime/internals/server/generateModelsProperty.js +1 -2
  85. package/dist/cjs/runtime/internals/server/generateModelsProperty.js.map +1 -1
  86. package/dist/cjs/runtime/internals/server/index.js.map +1 -1
  87. package/dist/cjs/runtime/internals/utils/clientProperties/generateConversationsProperty.js +1 -2
  88. package/dist/cjs/runtime/internals/utils/clientProperties/generateConversationsProperty.js.map +1 -1
  89. package/dist/cjs/runtime/internals/utils/clientProperties/generateEnumsProperty.js.map +1 -1
  90. package/dist/cjs/runtime/internals/utils/clientProperties/generateGenerationsProperty.js +1 -2
  91. package/dist/cjs/runtime/internals/utils/clientProperties/generateGenerationsProperty.js.map +1 -1
  92. package/dist/cjs/runtime/internals/utils/clientProperties/generateModelsProperty.js +1 -2
  93. package/dist/cjs/runtime/internals/utils/clientProperties/generateModelsProperty.js.map +1 -1
  94. package/dist/cjs/runtime/internals/utils/runtimeTypeGuards/isApiGraphQLProviderConfig.js +1 -2
  95. package/dist/cjs/runtime/internals/utils/runtimeTypeGuards/isApiGraphQLProviderConfig.js.map +1 -1
  96. package/dist/cjs/runtime/internals/utils/runtimeTypeGuards/isConfigureEventWithResourceConfig.js +1 -2
  97. package/dist/cjs/runtime/internals/utils/runtimeTypeGuards/isConfigureEventWithResourceConfig.js.map +1 -1
  98. package/dist/cjs/runtime/internals/utils/runtimeTypeGuards/isGraphQLResponseWithErrors.js +1 -2
  99. package/dist/cjs/runtime/internals/utils/runtimeTypeGuards/isGraphQLResponseWithErrors.js.map +1 -1
  100. package/dist/cjs/runtime/utils/findIndexByFields.js +1 -2
  101. package/dist/cjs/runtime/utils/findIndexByFields.js.map +1 -1
  102. package/dist/cjs/runtime/utils/index.js.map +1 -1
  103. package/dist/cjs/runtime/utils/resolveOwnerFields.js +1 -2
  104. package/dist/cjs/runtime/utils/resolveOwnerFields.js.map +1 -1
  105. package/dist/cjs/runtime/utils/resolvePKFields.js +1 -2
  106. package/dist/cjs/runtime/utils/resolvePKFields.js.map +1 -1
  107. package/dist/cjs/runtime/utils/selfAwareAsync.js +1 -2
  108. package/dist/cjs/runtime/utils/selfAwareAsync.js.map +1 -1
  109. package/dist/cjs/runtime/utils/stringTransformation.js +1 -2
  110. package/dist/cjs/runtime/utils/stringTransformation.js.map +1 -1
  111. package/dist/cjs/util/Brand.js +3 -3
  112. package/dist/cjs/util/Brand.js.map +1 -1
  113. package/dist/cjs/util/index.js.map +1 -1
  114. package/dist/esm/Authorization.d.ts +8 -8
  115. package/dist/esm/Authorization.mjs.map +1 -1
  116. package/dist/esm/CombineSchema.mjs.map +1 -1
  117. package/dist/esm/CustomOperation.mjs.map +1 -1
  118. package/dist/esm/CustomType.mjs.map +1 -1
  119. package/dist/esm/EnumType.mjs.map +1 -1
  120. package/dist/esm/Handler.mjs.map +1 -1
  121. package/dist/esm/ModelField.d.ts +39 -24
  122. package/dist/esm/ModelField.mjs +9 -2
  123. package/dist/esm/ModelField.mjs.map +1 -1
  124. package/dist/esm/ModelIndex.mjs.map +1 -1
  125. package/dist/esm/ModelRelationshipField.mjs.map +1 -1
  126. package/dist/esm/ModelSchema.mjs.map +1 -1
  127. package/dist/esm/ModelType.d.ts +1 -1
  128. package/dist/esm/ModelType.mjs.map +1 -1
  129. package/dist/esm/RefType.mjs.map +1 -1
  130. package/dist/esm/SchemaProcessor.mjs +12 -2
  131. package/dist/esm/SchemaProcessor.mjs.map +1 -1
  132. package/dist/esm/Validate.d.ts +218 -0
  133. package/dist/esm/Validate.mjs +142 -0
  134. package/dist/esm/Validate.mjs.map +1 -0
  135. package/dist/esm/ai/ConversationSchemaGraphQLTypes.mjs.map +1 -1
  136. package/dist/esm/ai/ConversationSchemaProcessor.mjs.map +1 -1
  137. package/dist/esm/ai/ConversationType.mjs.map +1 -1
  138. package/dist/esm/ai/ModelType.mjs.map +1 -1
  139. package/dist/esm/index.d.ts +1 -1
  140. package/dist/esm/runtime/addSchemaToClient.mjs.map +1 -1
  141. package/dist/esm/runtime/addSchemaToClientWithInstance.mjs.map +1 -1
  142. package/dist/esm/runtime/bridge-types.mjs.map +1 -1
  143. package/dist/esm/runtime/internals/APIClient.mjs.map +1 -1
  144. package/dist/esm/runtime/internals/ai/conversationMessageDeserializers.mjs.map +1 -1
  145. package/dist/esm/runtime/internals/ai/conversationMessageSerializers.mjs.map +1 -1
  146. package/dist/esm/runtime/internals/ai/conversationStreamEventDeserializers.mjs.map +1 -1
  147. package/dist/esm/runtime/internals/ai/convertItemToConversation.mjs.map +1 -1
  148. package/dist/esm/runtime/internals/ai/createCreateConversationFunction.d.ts +1 -1
  149. package/dist/esm/runtime/internals/ai/createCreateConversationFunction.mjs.map +1 -1
  150. package/dist/esm/runtime/internals/ai/createDeleteConversationFunction.d.ts +1 -1
  151. package/dist/esm/runtime/internals/ai/createDeleteConversationFunction.mjs.map +1 -1
  152. package/dist/esm/runtime/internals/ai/createGetConversationFunction.d.ts +1 -1
  153. package/dist/esm/runtime/internals/ai/createGetConversationFunction.mjs.map +1 -1
  154. package/dist/esm/runtime/internals/ai/createListConversationsFunction.d.ts +1 -1
  155. package/dist/esm/runtime/internals/ai/createListConversationsFunction.mjs.map +1 -1
  156. package/dist/esm/runtime/internals/ai/createListMessagesFunction.d.ts +1 -1
  157. package/dist/esm/runtime/internals/ai/createListMessagesFunction.mjs.map +1 -1
  158. package/dist/esm/runtime/internals/ai/createOnStreamEventFunction.d.ts +1 -1
  159. package/dist/esm/runtime/internals/ai/createOnStreamEventFunction.mjs.map +1 -1
  160. package/dist/esm/runtime/internals/ai/createSendMessageFunction.d.ts +1 -1
  161. package/dist/esm/runtime/internals/ai/createSendMessageFunction.mjs +1 -1
  162. package/dist/esm/runtime/internals/ai/createSendMessageFunction.mjs.map +1 -1
  163. package/dist/esm/runtime/internals/ai/createUpdateConversationFunction.d.ts +1 -1
  164. package/dist/esm/runtime/internals/ai/createUpdateConversationFunction.mjs.map +1 -1
  165. package/dist/esm/runtime/internals/ai/getCustomUserAgentDetails.mjs.map +1 -1
  166. package/dist/esm/runtime/internals/cancellation.mjs.map +1 -1
  167. package/dist/esm/runtime/internals/clientUtils.mjs.map +1 -1
  168. package/dist/esm/runtime/internals/generateCustomOperationsProperty.d.ts +3 -3
  169. package/dist/esm/runtime/internals/generateCustomOperationsProperty.mjs.map +1 -1
  170. package/dist/esm/runtime/internals/operations/custom.mjs.map +1 -1
  171. package/dist/esm/runtime/internals/operations/get.mjs.map +1 -1
  172. package/dist/esm/runtime/internals/operations/indexQuery.mjs +1 -1
  173. package/dist/esm/runtime/internals/operations/indexQuery.mjs.map +1 -1
  174. package/dist/esm/runtime/internals/operations/list.mjs.map +1 -1
  175. package/dist/esm/runtime/internals/operations/observeQuery.mjs.map +1 -1
  176. package/dist/esm/runtime/internals/operations/subscription.mjs.map +1 -1
  177. package/dist/esm/runtime/internals/operations/utils.mjs.map +1 -1
  178. package/dist/esm/runtime/internals/server/generateModelsProperty.mjs.map +1 -1
  179. package/dist/esm/runtime/internals/utils/clientProperties/generateConversationsProperty.mjs.map +1 -1
  180. package/dist/esm/runtime/internals/utils/clientProperties/generateEnumsProperty.d.ts +1 -1
  181. package/dist/esm/runtime/internals/utils/clientProperties/generateEnumsProperty.mjs.map +1 -1
  182. package/dist/esm/runtime/internals/utils/clientProperties/generateGenerationsProperty.mjs.map +1 -1
  183. package/dist/esm/runtime/internals/utils/clientProperties/generateModelsProperty.mjs.map +1 -1
  184. package/dist/esm/runtime/internals/utils/runtimeTypeGuards/isApiGraphQLProviderConfig.mjs.map +1 -1
  185. package/dist/esm/runtime/internals/utils/runtimeTypeGuards/isConfigureEventWithResourceConfig.mjs.map +1 -1
  186. package/dist/esm/runtime/internals/utils/runtimeTypeGuards/isGraphQLResponseWithErrors.mjs.map +1 -1
  187. package/dist/esm/runtime/utils/findIndexByFields.mjs.map +1 -1
  188. package/dist/esm/runtime/utils/resolveOwnerFields.mjs.map +1 -1
  189. package/dist/esm/runtime/utils/resolvePKFields.mjs.map +1 -1
  190. package/dist/esm/runtime/utils/selfAwareAsync.mjs.map +1 -1
  191. package/dist/esm/runtime/utils/stringTransformation.mjs.map +1 -1
  192. package/dist/esm/util/Brand.mjs.map +1 -1
  193. package/dist/meta/cjs.tsbuildinfo +1 -1
  194. package/package.json +1 -1
  195. package/src/ModelField.ts +70 -29
  196. package/src/SchemaProcessor.ts +12 -0
  197. package/src/Validate.ts +418 -0
  198. package/src/index.ts +1 -1
@@ -0,0 +1,218 @@
1
+ import { ModelFieldType } from './ModelField';
2
+ /**
3
+ * The types of validations supported
4
+ */
5
+ export declare enum ValidationType {
6
+ GT = "gt",
7
+ LT = "lt",
8
+ GTE = "gte",
9
+ LTE = "lte",
10
+ MIN_LENGTH = "minLength",
11
+ MAX_LENGTH = "maxLength",
12
+ STARTS_WITH = "startsWith",
13
+ ENDS_WITH = "endsWith",
14
+ MATCHES = "matches"
15
+ }
16
+ /**
17
+ * Represents a validation rule to be applied to a field
18
+ */
19
+ export interface ValidationRule {
20
+ type: ValidationType;
21
+ value: string | number;
22
+ errorMessage?: string;
23
+ }
24
+ /**
25
+ * Interface for string validation methods without any exclusions
26
+ */
27
+ export interface StringValidationBuilderBase<T, ExcludedMethods extends string = never> {
28
+ /**
29
+ * Validates that a string field has at least the specified length
30
+ *
31
+ * ⚠️ Only applicable to string fields
32
+ *
33
+ * @example
34
+ * // String field example
35
+ * a.string().validate(v => v.minLength(5, 'String must be at least 5 characters'))
36
+ *
37
+ * @param length - The minimum length required
38
+ * @param errorMessage - Optional custom error message
39
+ */
40
+ minLength(length: number, errorMessage?: string): StringValidationBuilder<T, ExcludedMethods | 'minLength'>;
41
+ /**
42
+ * Validates that a string field does not exceed the specified length
43
+ *
44
+ * ⚠️ Only applicable to string fields
45
+ *
46
+ * @example
47
+ * // String field example
48
+ * a.string().validate(v => v.maxLength(100, 'String must be at most 100 characters'))
49
+ *
50
+ * @param length - The maximum length allowed
51
+ * @param errorMessage - Optional custom error message
52
+ */
53
+ maxLength(length: number, errorMessage?: string): StringValidationBuilder<T, ExcludedMethods | 'maxLength'>;
54
+ /**
55
+ * Validates that a string field starts with the specified prefix
56
+ *
57
+ * ⚠️ Only applicable to string fields
58
+ *
59
+ * @example
60
+ * // String field example
61
+ * a.string().validate(v => v.startsWith("prefix-", 'String must start with prefix-'))
62
+ *
63
+ * @param prefix - The prefix the string must start with
64
+ * @param errorMessage - Optional custom error message
65
+ */
66
+ startsWith(prefix: string, errorMessage?: string): StringValidationBuilder<T, ExcludedMethods | 'startsWith'>;
67
+ /**
68
+ * Validates that a string field ends with the specified suffix
69
+ *
70
+ * ⚠️ Only applicable to string fields
71
+ * @example
72
+ * // String field example
73
+ * a.string().validate(v => v.endsWith("-suffix", 'String must end with -suffix'))
74
+ *
75
+ * @param suffix - The suffix the string must end with
76
+ * @param errorMessage - Optional custom error message
77
+ */
78
+ endsWith(suffix: string, errorMessage?: string): StringValidationBuilder<T, ExcludedMethods | 'endsWith'>;
79
+ /**
80
+ * Validates that a string field matches the specified regular expression pattern
81
+ *
82
+ * ⚠️ Only applicable to string fields
83
+ * @example
84
+ * // String field example
85
+ * a.string().validate(v => v.matches("^[a-zA-Z0-9]+$", 'String must match the regex pattern'))
86
+ *
87
+ * @param pattern - The regex pattern the string must match
88
+ * @param errorMessage - Optional custom error message
89
+ */
90
+ matches(pattern: string, errorMessage?: string): StringValidationBuilder<T, ExcludedMethods | 'matches'>;
91
+ }
92
+ /**
93
+ * Interface for string validation methods with specific validators excluded
94
+ *
95
+ * This is to disallow duplicate validation operators on the same field, which is not supported in the Validate Transformer.
96
+ */
97
+ export type StringValidationBuilder<T, ExcludedMethods extends string = never> = Omit<StringValidationBuilderBase<T, ExcludedMethods>, ExcludedMethods & keyof StringValidationBuilderBase<T, ExcludedMethods>>;
98
+ /**
99
+ * Interface for numeric validation methods without any exclusions
100
+ */
101
+ export interface NumericValidationBuilderBase<T, ExcludedMethods extends string = never> {
102
+ /**
103
+ * Validates that a numeric field is greater than the specified value
104
+ *
105
+ * ⚠️ Only applicable for integer or float fields
106
+ *
107
+ * @example
108
+ * // Integer field example
109
+ * a.integer().validate(v => v.gt(10, 'Integer must be greater than 10'))
110
+ *
111
+ * // Float field example
112
+ * a.float().validate(v => v.gt(3.14, 'Float must be greater than 3.14'))
113
+ *
114
+ * @param value - The value that the field must be greater than
115
+ * @param errorMessage - Optional custom error message
116
+ */
117
+ gt(value: number, errorMessage?: string): NumericValidationBuilder<T, ExcludedMethods | 'gt' | 'positive'>;
118
+ /**
119
+ * Validates that a numeric field is less than the specified value
120
+ *
121
+ * ⚠️ Only applicable for integer or float fields
122
+ * @example
123
+ * // Integer field example
124
+ * a.integer().validate(v => v.lt(10, 'Integer must be less than 10'))
125
+ *
126
+ * // Float field example
127
+ * a.float().validate(v => v.lt(3.14, 'Float must be less than 3.14'))
128
+ *
129
+ * @param value - The value that the field must be less than
130
+ * @param errorMessage - Optional custom error message
131
+ */
132
+ lt(value: number, errorMessage?: string): NumericValidationBuilder<T, ExcludedMethods | 'lt' | 'negative'>;
133
+ /**
134
+ * Validates that a numeric field is greater than or equal to the specified value
135
+ *
136
+ * ⚠️ Only applicable for integer or float fields
137
+ *
138
+ * @example
139
+ * // Integer field example
140
+ * a.integer().validate(v => v.gte(10, 'Integer must be greater than or equal to 10'))
141
+ *
142
+ * // Float field example
143
+ * a.float().validate(v => v.gte(3.14, 'Float must be greater than or equal to 3.14'))
144
+ *
145
+ * @param value - The value that the field must be greater than or equal to
146
+ * @param errorMessage - Optional custom error message
147
+ */
148
+ gte(value: number, errorMessage?: string): NumericValidationBuilder<T, ExcludedMethods | 'gte'>;
149
+ /**
150
+ * Validates that a numeric field is less than or equal to the specified value
151
+ *
152
+ * ⚠️ Only applicable for integer or float fields
153
+ * @example
154
+ * // Integer field example
155
+ * a.integer().validate(v => v.lte(10, 'Integer must be less than or equal to 10'))
156
+ *
157
+ * // Float field example
158
+ * a.float().validate(v => v.lte(3.14, 'Float must be less than or equal to 3.14'))
159
+ *
160
+ * @param value - The value that the field must be less than or equal to
161
+ * @param errorMessage - Optional custom error message
162
+ */
163
+ lte(value: number, errorMessage?: string): NumericValidationBuilder<T, ExcludedMethods | 'lte'>;
164
+ /**
165
+ * Validates that a numeric field is positive
166
+ *
167
+ * ⚠️ Only applicable for integer or float fields
168
+ *
169
+ * @example
170
+ * // Integer field example
171
+ * a.integer().validate(v => v.positive('Integer must be positive'))
172
+ *
173
+ * // Float field example
174
+ * a.float().validate(v => v.positive('Float must be positive'))
175
+ *
176
+ * @param errorMessage - Optional custom error message
177
+ */
178
+ positive(errorMessage?: string): NumericValidationBuilder<T, ExcludedMethods | 'positive' | 'gt'>;
179
+ /**
180
+ * Validates that a numeric field is negative
181
+ *
182
+ * ⚠️ Only applicable for integer or float fields
183
+ * @example
184
+ * // Integer field example
185
+ * a.integer().validate(v => v.negative('Integer must be negative'))
186
+ *
187
+ * // Float field example
188
+ * a.float().validate(v => v.negative('Float must be negative'))
189
+ *
190
+ * @param errorMessage - Optional custom error message
191
+ */
192
+ negative(errorMessage?: string): NumericValidationBuilder<T, ExcludedMethods | 'negative' | 'lt'>;
193
+ }
194
+ /**
195
+ * Interface for numeric validation methods with specific validators excluded
196
+ *
197
+ * This is to disallow duplicate validation operators on the same field, which is not supported in the Validate Transformer.
198
+ */
199
+ export type NumericValidationBuilder<T, ExcludedMethods extends string = never> = Omit<NumericValidationBuilderBase<T, ExcludedMethods>, ExcludedMethods & keyof NumericValidationBuilderBase<T, ExcludedMethods>>;
200
+ /**
201
+ * Maps a ModelFieldType to the appropriate validation builder type
202
+ *
203
+ * Note: This type intentionally uses the public interfaces which don't expose the getRules method
204
+ */
205
+ export type FieldTypeToValidationBuilder<T, FT extends ModelFieldType> = FT extends ModelFieldType.String ? StringValidationBuilder<T, never> : FT extends ModelFieldType.Integer | ModelFieldType.Float ? NumericValidationBuilder<T, never> : never;
206
+ /**
207
+ * A builder for creating field validation rules
208
+ * @typeParam T - The type of the field being validated
209
+ */
210
+ export type ValidationBuilder<T> = StringValidationBuilderBase<T> & NumericValidationBuilderBase<T>;
211
+ /**
212
+ * Creates a type-safe validation builder for a specific field type with access to get the rules
213
+ * @returns An object containing the validation builder and a function to get the rules
214
+ */
215
+ export declare function createValidationBuilder<T, FT extends ModelFieldType>(): {
216
+ builder: FieldTypeToValidationBuilder<T, FT>;
217
+ getRules: () => ValidationRule[];
218
+ };
@@ -0,0 +1,142 @@
1
+ /**
2
+ * The types of validations supported
3
+ */
4
+ var ValidationType;
5
+ (function (ValidationType) {
6
+ ValidationType["GT"] = "gt";
7
+ ValidationType["LT"] = "lt";
8
+ ValidationType["GTE"] = "gte";
9
+ ValidationType["LTE"] = "lte";
10
+ ValidationType["MIN_LENGTH"] = "minLength";
11
+ ValidationType["MAX_LENGTH"] = "maxLength";
12
+ ValidationType["STARTS_WITH"] = "startsWith";
13
+ ValidationType["ENDS_WITH"] = "endsWith";
14
+ ValidationType["MATCHES"] = "matches";
15
+ })(ValidationType || (ValidationType = {}));
16
+ /**
17
+ * Creates an internal validation builder for a specific field type
18
+ * @typeParam T - The type of the field being validated
19
+ */
20
+ function createValidationBuilderInternal() {
21
+ const rules = [];
22
+ const builder = {
23
+ /**
24
+ * Validates that a numeric field is greater than the specified value
25
+ * @param value - The value that the field must be greater than
26
+ * @param errorMessage - Optional custom error message
27
+ */
28
+ gt(value, errorMessage) {
29
+ rules.push({ type: ValidationType.GT, value, errorMessage });
30
+ return this;
31
+ },
32
+ /**
33
+ * Validates that a numeric field is less than the specified value
34
+ * @param value - The value that the field must be less than
35
+ * @param errorMessage - Optional custom error message
36
+ */
37
+ lt(value, errorMessage) {
38
+ rules.push({ type: ValidationType.LT, value, errorMessage });
39
+ return this;
40
+ },
41
+ /**
42
+ * Validates that a numeric field is greater than or equal to the specified value
43
+ * @param value - The value that the field must be greater than or equal to
44
+ * @param errorMessage - Optional custom error message
45
+ */
46
+ gte(value, errorMessage) {
47
+ rules.push({ type: ValidationType.GTE, value, errorMessage });
48
+ return this;
49
+ },
50
+ /**
51
+ * Validates that a numeric field is less than or equal to the specified value
52
+ * @param value - The value that the field must be less than or equal to
53
+ * @param errorMessage - Optional custom error message
54
+ */
55
+ lte(value, errorMessage) {
56
+ rules.push({ type: ValidationType.LTE, value, errorMessage });
57
+ return this;
58
+ },
59
+ /**
60
+ * Validates that a numeric field is positive. We use gt(0) internally to achieve this.
61
+ * @param errorMessage - Optional custom error message
62
+ */
63
+ positive(errorMessage) {
64
+ rules.push({ type: ValidationType.GT, value: 0, errorMessage });
65
+ return this;
66
+ },
67
+ /**
68
+ * Validates that a numeric field is negative. We use lt(0) internally to achieve this.
69
+ * @param errorMessage - Optional custom error message
70
+ */
71
+ negative(errorMessage) {
72
+ rules.push({ type: ValidationType.LT, value: 0, errorMessage });
73
+ return this;
74
+ },
75
+ /**
76
+ * Validates that a string field has at least the specified length
77
+ * @param length - The minimum length required
78
+ * @param errorMessage - Optional custom error message
79
+ */
80
+ minLength(length, errorMessage) {
81
+ rules.push({ type: ValidationType.MIN_LENGTH, value: length, errorMessage });
82
+ return this;
83
+ },
84
+ /**
85
+ * Validates that a string field does not exceed the specified length
86
+ * @param length - The maximum length allowed
87
+ * @param errorMessage - Optional custom error message
88
+ */
89
+ maxLength(length, errorMessage) {
90
+ rules.push({ type: ValidationType.MAX_LENGTH, value: length, errorMessage });
91
+ return this;
92
+ },
93
+ /**
94
+ * Validates that a string field starts with the specified prefix
95
+ * @param prefix - The prefix the string must start with
96
+ * @param errorMessage - Optional custom error message
97
+ */
98
+ startsWith(prefix, errorMessage) {
99
+ rules.push({ type: ValidationType.STARTS_WITH, value: prefix, errorMessage });
100
+ return this;
101
+ },
102
+ /**
103
+ * Validates that a string field ends with the specified suffix
104
+ * @param suffix - The suffix the string must end with
105
+ * @param errorMessage - Optional custom error message
106
+ */
107
+ endsWith(suffix, errorMessage) {
108
+ rules.push({ type: ValidationType.ENDS_WITH, value: suffix, errorMessage });
109
+ return this;
110
+ },
111
+ /**
112
+ * Validates that a string field matches the specified regular expression pattern
113
+ * @param pattern - The regex pattern the string must match
114
+ * @param errorMessage - Optional custom error message
115
+ */
116
+ matches(pattern, errorMessage) {
117
+ rules.push({ type: ValidationType.MATCHES, value: pattern, errorMessage });
118
+ return this;
119
+ },
120
+ /**
121
+ * Returns all the validation rules defined by this builder
122
+ */
123
+ getRules() {
124
+ return rules;
125
+ }
126
+ };
127
+ return builder;
128
+ }
129
+ /**
130
+ * Creates a type-safe validation builder for a specific field type with access to get the rules
131
+ * @returns An object containing the validation builder and a function to get the rules
132
+ */
133
+ function createValidationBuilder() {
134
+ const internalBuilder = createValidationBuilderInternal();
135
+ return {
136
+ builder: internalBuilder,
137
+ getRules: () => internalBuilder.getRules()
138
+ };
139
+ }
140
+
141
+ export { ValidationType, createValidationBuilder };
142
+ //# sourceMappingURL=Validate.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Validate.mjs","sources":["../../src/Validate.ts"],"sourcesContent":["/**\n * The types of validations supported\n */\nexport var ValidationType;\n(function (ValidationType) {\n ValidationType[\"GT\"] = \"gt\";\n ValidationType[\"LT\"] = \"lt\";\n ValidationType[\"GTE\"] = \"gte\";\n ValidationType[\"LTE\"] = \"lte\";\n ValidationType[\"MIN_LENGTH\"] = \"minLength\";\n ValidationType[\"MAX_LENGTH\"] = \"maxLength\";\n ValidationType[\"STARTS_WITH\"] = \"startsWith\";\n ValidationType[\"ENDS_WITH\"] = \"endsWith\";\n ValidationType[\"MATCHES\"] = \"matches\";\n})(ValidationType || (ValidationType = {}));\n/**\n * Creates an internal validation builder for a specific field type\n * @typeParam T - The type of the field being validated\n */\nfunction createValidationBuilderInternal() {\n const rules = [];\n const builder = {\n /**\n * Validates that a numeric field is greater than the specified value\n * @param value - The value that the field must be greater than\n * @param errorMessage - Optional custom error message\n */\n gt(value, errorMessage) {\n rules.push({ type: ValidationType.GT, value, errorMessage });\n return this;\n },\n /**\n * Validates that a numeric field is less than the specified value\n * @param value - The value that the field must be less than\n * @param errorMessage - Optional custom error message\n */\n lt(value, errorMessage) {\n rules.push({ type: ValidationType.LT, value, errorMessage });\n return this;\n },\n /**\n * Validates that a numeric field is greater than or equal to the specified value\n * @param value - The value that the field must be greater than or equal to\n * @param errorMessage - Optional custom error message\n */\n gte(value, errorMessage) {\n rules.push({ type: ValidationType.GTE, value, errorMessage });\n return this;\n },\n /**\n * Validates that a numeric field is less than or equal to the specified value\n * @param value - The value that the field must be less than or equal to\n * @param errorMessage - Optional custom error message\n */\n lte(value, errorMessage) {\n rules.push({ type: ValidationType.LTE, value, errorMessage });\n return this;\n },\n /**\n * Validates that a numeric field is positive. We use gt(0) internally to achieve this.\n * @param errorMessage - Optional custom error message\n */\n positive(errorMessage) {\n rules.push({ type: ValidationType.GT, value: 0, errorMessage });\n return this;\n },\n /**\n * Validates that a numeric field is negative. We use lt(0) internally to achieve this.\n * @param errorMessage - Optional custom error message\n */\n negative(errorMessage) {\n rules.push({ type: ValidationType.LT, value: 0, errorMessage });\n return this;\n },\n /**\n * Validates that a string field has at least the specified length\n * @param length - The minimum length required\n * @param errorMessage - Optional custom error message\n */\n minLength(length, errorMessage) {\n rules.push({ type: ValidationType.MIN_LENGTH, value: length, errorMessage });\n return this;\n },\n /**\n * Validates that a string field does not exceed the specified length\n * @param length - The maximum length allowed\n * @param errorMessage - Optional custom error message\n */\n maxLength(length, errorMessage) {\n rules.push({ type: ValidationType.MAX_LENGTH, value: length, errorMessage });\n return this;\n },\n /**\n * Validates that a string field starts with the specified prefix\n * @param prefix - The prefix the string must start with\n * @param errorMessage - Optional custom error message\n */\n startsWith(prefix, errorMessage) {\n rules.push({ type: ValidationType.STARTS_WITH, value: prefix, errorMessage });\n return this;\n },\n /**\n * Validates that a string field ends with the specified suffix\n * @param suffix - The suffix the string must end with\n * @param errorMessage - Optional custom error message\n */\n endsWith(suffix, errorMessage) {\n rules.push({ type: ValidationType.ENDS_WITH, value: suffix, errorMessage });\n return this;\n },\n /**\n * Validates that a string field matches the specified regular expression pattern\n * @param pattern - The regex pattern the string must match\n * @param errorMessage - Optional custom error message\n */\n matches(pattern, errorMessage) {\n rules.push({ type: ValidationType.MATCHES, value: pattern, errorMessage });\n return this;\n },\n /**\n * Returns all the validation rules defined by this builder\n */\n getRules() {\n return rules;\n }\n };\n return builder;\n}\n/**\n * Creates a type-safe validation builder for a specific field type with access to get the rules\n * @returns An object containing the validation builder and a function to get the rules\n */\nexport function createValidationBuilder() {\n const internalBuilder = createValidationBuilderInternal();\n return {\n builder: internalBuilder,\n getRules: () => internalBuilder.getRules()\n };\n}\n"],"names":[],"mappings":"AAAA;AACA;AACA;AACU,IAAC;AACX,CAAC,UAAU,cAAc,EAAE;AAC3B,IAAI,cAAc,CAAC,IAAI,C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cAAc,CAAC,WAAW,EAAE,KAAK,EAAE,MAAM,EAAE,YAAY,EAAE,CAAC;AACzF,YAAY,OAAO,IAAI;AACvB,SAAS;AACT;AACA;AACA;AACA;AACA;AACA,QAAQ,QAAQ,CAAC,MAAM,EAAE,YAAY,EAAE;AACvC,YAAY,KAAK,CAAC,IAAI,CAAC,EAAE,IAAI,EAAE,cAAc,CAAC,SAAS,EAAE,KAAK,EAAE,MAAM,EAAE,YAAY,EAAE,CAAC;AACvF,YAAY,OAAO,IAAI;AACvB,SAAS;AACT;AACA;AACA;AACA;AACA;AACA,QAAQ,OAAO,CAAC,OAAO,EAAE,YAAY,EAAE;AACvC,YAAY,KAAK,CAAC,IAAI,CAAC,EAAE,IAAI,EAAE,cAAc,CAAC,OAAO,EAAE,KAAK,EAAE,OAAO,EAAE,YAAY,EAAE,CAAC;AACtF,YAAY,OAAO,IAAI;AACvB,SAAS;AACT;AACA;AACA;AACA,QAAQ,QAAQ,GAAG;AACnB,YAAY,OAAO,KAAK;AACxB;AACA,KAAK;AACL,IAAI,OAAO,OAAO;AAClB;AACA;AACA;AACA;AACA;AACO,SAAS,uBAAuB,GAAG;AAC1C,IAAI,MAAM,eAAe,GAAG,+BAA+B,EAAE;AAC7D,IAAI,OAAO;AACX,QAAQ,OAAO,EAAE,eAAe;AAChC,QAAQ,QAAQ,EAAE,MAAM,eAAe,CAAC,QAAQ;AAChD,KAAK;AACL;;;;"}
@@ -1 +1 @@
1
- {"version":3,"file":"ConversationSchemaGraphQLTypes.mjs","sources":["../../../src/ai/ConversationSchemaGraphQLTypes.ts"],"sourcesContent":["export const CONVERSATION_SCHEMA_GRAPHQL_TYPES = \n/* GraphQL */ `enum AmplifyAIConversationParticipantRole {\n user\n assistant\n}\n\ninterface AmplifyAIConversationMessage {\n id: ID!\n conversationId: ID!\n associatedUserMessageId: ID\n role: AmplifyAIConversationParticipantRole\n content: [AmplifyAIContentBlock]\n aiContext: AWSJSON\n toolConfiguration: AmplifyAIToolConfiguration\n createdAt: AWSDateTime\n updatedAt: AWSDateTime\n owner: String\n}\n\ninput AmplifyAIDocumentBlockSourceInput {\n bytes: String\n}\n\ninput AmplifyAIDocumentBlockInput {\n format: String!\n name: String!\n source: AmplifyAIDocumentBlockSourceInput!\n}\n\ninput AmplifyAIImageBlockSourceInput {\n bytes: String\n}\n\ninput AmplifyAIImageBlockInput {\n format: String!\n source: AmplifyAIImageBlockSourceInput!\n}\n\ninput AmplifyAIToolUseBlockInput {\n toolUseId: String!\n name: String!\n input: AWSJSON!\n}\n\ninput AmplifyAIToolResultContentBlockInput {\n document: AmplifyAIDocumentBlockInput\n image: AmplifyAIImageBlockInput\n json: AWSJSON\n text: String\n}\n\ninput AmplifyAIToolResultBlockInput {\n content: [AmplifyAIToolResultContentBlockInput!]!\n toolUseId: String!\n status: String\n}\n\ntype AmplifyAIDocumentBlockSource {\n bytes: String\n}\n\ntype AmplifyAIDocumentBlock {\n format: String!\n name: String!\n source: AmplifyAIDocumentBlockSource!\n}\n\ntype AmplifyAIImageBlock {\n format: String!\n source: AmplifyAIImageBlockSource!\n}\n\ntype AmplifyAIImageBlockSource {\n bytes: String\n}\n\ntype AmplifyAIToolUseBlock {\n toolUseId: String!\n name: String!\n input: AWSJSON!\n}\n\ntype AmplifyAIToolResultContentBlock {\n document: AmplifyAIDocumentBlock\n image: AmplifyAIImageBlock\n json: AWSJSON\n text: String\n}\n\ntype AmplifyAIToolResultBlock {\n content: [AmplifyAIToolResultContentBlock!]!\n toolUseId: String!\n status: String\n}\n\ntype AmplifyAIContentBlockText {\n text: String\n}\n\ntype AmplifyAIContentBlockImage {\n image: AmplifyAIImageBlock\n}\n\ntype AmplifyAIContentBlockDocument {\n document: AmplifyAIDocumentBlock\n}\n\ntype AmplifyAIContentBlockToolUse {\n toolUse: AmplifyAIToolUseBlock\n}\n\ntype AmplifyAIContentBlockToolResult {\n toolResult: AmplifyAIToolResultBlock\n}\n\ninput AmplifyAIContentBlockInput {\n text: String\n document: AmplifyAIDocumentBlockInput\n image: AmplifyAIImageBlockInput\n toolResult: AmplifyAIToolResultBlockInput\n toolUse: AmplifyAIToolUseBlockInput\n}\n\ntype AmplifyAIContentBlock {\n text: String\n document: AmplifyAIDocumentBlock\n image: AmplifyAIImageBlock\n toolResult: AmplifyAIToolResultBlock\n toolUse: AmplifyAIToolUseBlock\n}\n\ninput AmplifyAIToolConfigurationInput {\n tools: [AmplifyAIToolInput]\n}\n\ninput AmplifyAIToolInput {\n toolSpec: AmplifyAIToolSpecificationInput\n}\n\ninput AmplifyAIToolSpecificationInput {\n name: String!\n description: String\n inputSchema: AmplifyAIToolInputSchemaInput!\n}\n\ninput AmplifyAIToolInputSchemaInput {\n json: AWSJSON\n}\n\ntype AmplifyAIToolConfiguration {\n tools: [AmplifyAITool]\n}\n\ntype AmplifyAITool {\n toolSpec: AmplifyAIToolSpecification\n}\n\ntype AmplifyAIToolSpecification {\n name: String!\n description: String\n inputSchema: AmplifyAIToolInputSchema!\n}\n\ntype AmplifyAIToolInputSchema {\n json: AWSJSON\n}\n\ntype AmplifyAIConversationMessageStreamPart @aws_cognito_user_pools {\n id: ID!\n owner: String\n conversationId: ID!\n associatedUserMessageId: ID!\n contentBlockIndex: Int\n contentBlockText: String\n contentBlockDeltaIndex: Int\n contentBlockToolUse: AmplifyAIToolUseBlock\n contentBlockDoneAtIndex: Int\n stopReason: String\n errors: [AmplifyAIConversationTurnError]\n p: String\n}\n\ntype AmplifyAIConversationTurnError @aws_cognito_user_pools {\n message: String!\n errorType: String!\n}`;\n"],"names":[],"mappings":"AAAY,MAAC,iCAAiC;AAC9C,cAAc,CAAC;AACf;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,CAAC;;;;"}
1
+ {"version":3,"file":"ConversationSchemaGraphQLTypes.mjs","sources":["../../../src/ai/ConversationSchemaGraphQLTypes.ts"],"sourcesContent":["export const CONVERSATION_SCHEMA_GRAPHQL_TYPES = \n/* GraphQL */ `enum AmplifyAIConversationParticipantRole {\n user\n assistant\n}\n\ninterface AmplifyAIConversationMessage {\n id: ID!\n conversationId: ID!\n associatedUserMessageId: ID\n role: AmplifyAIConversationParticipantRole\n content: [AmplifyAIContentBlock]\n aiContext: AWSJSON\n toolConfiguration: AmplifyAIToolConfiguration\n createdAt: AWSDateTime\n updatedAt: AWSDateTime\n owner: String\n}\n\ninput AmplifyAIDocumentBlockSourceInput {\n bytes: String\n}\n\ninput AmplifyAIDocumentBlockInput {\n format: String!\n name: String!\n source: AmplifyAIDocumentBlockSourceInput!\n}\n\ninput AmplifyAIImageBlockSourceInput {\n bytes: String\n}\n\ninput AmplifyAIImageBlockInput {\n format: String!\n source: AmplifyAIImageBlockSourceInput!\n}\n\ninput AmplifyAIToolUseBlockInput {\n toolUseId: String!\n name: String!\n input: AWSJSON!\n}\n\ninput AmplifyAIToolResultContentBlockInput {\n document: AmplifyAIDocumentBlockInput\n image: AmplifyAIImageBlockInput\n json: AWSJSON\n text: String\n}\n\ninput AmplifyAIToolResultBlockInput {\n content: [AmplifyAIToolResultContentBlockInput!]!\n toolUseId: String!\n status: String\n}\n\ntype AmplifyAIDocumentBlockSource {\n bytes: String\n}\n\ntype AmplifyAIDocumentBlock {\n format: String!\n name: String!\n source: AmplifyAIDocumentBlockSource!\n}\n\ntype AmplifyAIImageBlock {\n format: String!\n source: AmplifyAIImageBlockSource!\n}\n\ntype AmplifyAIImageBlockSource {\n bytes: String\n}\n\ntype AmplifyAIToolUseBlock {\n toolUseId: String!\n name: String!\n input: AWSJSON!\n}\n\ntype AmplifyAIToolResultContentBlock {\n document: AmplifyAIDocumentBlock\n image: AmplifyAIImageBlock\n json: AWSJSON\n text: String\n}\n\ntype AmplifyAIToolResultBlock {\n content: [AmplifyAIToolResultContentBlock!]!\n toolUseId: String!\n status: String\n}\n\ntype AmplifyAIContentBlockText {\n text: String\n}\n\ntype AmplifyAIContentBlockImage {\n image: AmplifyAIImageBlock\n}\n\ntype AmplifyAIContentBlockDocument {\n document: AmplifyAIDocumentBlock\n}\n\ntype AmplifyAIContentBlockToolUse {\n toolUse: AmplifyAIToolUseBlock\n}\n\ntype AmplifyAIContentBlockToolResult {\n toolResult: AmplifyAIToolResultBlock\n}\n\ninput AmplifyAIContentBlockInput {\n text: String\n document: AmplifyAIDocumentBlockInput\n image: AmplifyAIImageBlockInput\n toolResult: AmplifyAIToolResultBlockInput\n toolUse: AmplifyAIToolUseBlockInput\n}\n\ntype AmplifyAIContentBlock {\n text: String\n document: AmplifyAIDocumentBlock\n image: AmplifyAIImageBlock\n toolResult: AmplifyAIToolResultBlock\n toolUse: AmplifyAIToolUseBlock\n}\n\ninput AmplifyAIToolConfigurationInput {\n tools: [AmplifyAIToolInput]\n}\n\ninput AmplifyAIToolInput {\n toolSpec: AmplifyAIToolSpecificationInput\n}\n\ninput AmplifyAIToolSpecificationInput {\n name: String!\n description: String\n inputSchema: AmplifyAIToolInputSchemaInput!\n}\n\ninput AmplifyAIToolInputSchemaInput {\n json: AWSJSON\n}\n\ntype AmplifyAIToolConfiguration {\n tools: [AmplifyAITool]\n}\n\ntype AmplifyAITool {\n toolSpec: AmplifyAIToolSpecification\n}\n\ntype AmplifyAIToolSpecification {\n name: String!\n description: String\n inputSchema: AmplifyAIToolInputSchema!\n}\n\ntype AmplifyAIToolInputSchema {\n json: AWSJSON\n}\n\ntype AmplifyAIConversationMessageStreamPart @aws_cognito_user_pools {\n id: ID!\n owner: String\n conversationId: ID!\n associatedUserMessageId: ID!\n contentBlockIndex: Int\n contentBlockText: String\n contentBlockDeltaIndex: Int\n contentBlockToolUse: AmplifyAIToolUseBlock\n contentBlockDoneAtIndex: Int\n stopReason: String\n errors: [AmplifyAIConversationTurnError]\n p: String\n}\n\ntype AmplifyAIConversationTurnError @aws_cognito_user_pools {\n message: String!\n errorType: String!\n}`;\n"],"names":[],"mappings":"AAAY,MAAC,iCAAiC;AAC9C,cAAc,CAAC;AACf;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,CAAC;;;;"}
@@ -1 +1 @@
1
- {"version":3,"file":"ConversationSchemaProcessor.mjs","sources":["../../../src/ai/ConversationSchemaProcessor.ts"],"sourcesContent":["import { accessData } from '../Authorization';\nimport { capitalize } from '../runtime/utils';\nexport const createConversationField = (typeDef, typeName) => {\n const { aiModel, systemPrompt, handler, tools } = typeDef;\n const { strategy, provider } = extractAuthorization(typeDef, typeName);\n const args = {\n aiModel: aiModel.resourcePath,\n // This is done to escape newlines in potentially multi-line system prompts\n // e.g.\n // realtorChat: a.conversation({\n // aiModel: a.ai.model('Claude 3 Haiku'),\n // systemPrompt: `You are a helpful real estate assistant\n // Respond in the poetic form of haiku.`,\n // }),\n //\n // It doesn't affect non multi-line string inputs for system prompts\n systemPrompt: systemPrompt.replace(/\\r?\\n/g, '\\\\n'),\n };\n const argsString = Object.entries(args)\n .map(([key, value]) => `${key}: \"${value}\"`)\n .join(', ');\n const authString = `, auth: { strategy: ${strategy}, provider: ${provider} }`;\n const functionHandler = {};\n let handlerString = '';\n if (handler) {\n const functionName = `Fn${capitalize(typeName)}`;\n const eventVersion = handler.eventVersion;\n handlerString = `, handler: { functionName: \"${functionName}\", eventVersion: \"${eventVersion}\" }`;\n functionHandler[functionName] = handler;\n }\n const toolsString = tools?.length\n ? `, tools: [${getConversationToolsString(tools)}]`\n : '';\n const conversationDirective = `@conversation(${argsString}${authString}${handlerString}${toolsString})`;\n const field = `${typeName}(conversationId: ID!, content: [AmplifyAIContentBlockInput], aiContext: AWSJSON, toolConfiguration: AmplifyAIToolConfigurationInput): AmplifyAIConversationMessage ${conversationDirective} @aws_cognito_user_pools`;\n return { field, functionHandler };\n};\nconst isRef = (query) => query?.data?.type === 'ref';\nconst extractAuthorization = (typeDef, typeName) => {\n const { authorization } = typeDef.data;\n if (authorization.length === 0) {\n throw new Error(`Conversation ${typeName} is missing authorization rules. Use .authorization((allow) => allow.owner()) to configure authorization for your conversation route.`);\n }\n const { strategy, provider } = accessData(authorization[0]);\n if (strategy !== 'owner' || provider !== 'userPools') {\n throw new Error(`Conversation ${typeName} must use owner authorization with a user pool provider. Use .authorization((allow) => allow.owner()) to configure authorization for your conversation route.`);\n }\n return { strategy, provider };\n};\nconst getConversationToolsString = (tools) => tools\n .map((tool) => {\n const { name, description } = tool;\n // https://docs.aws.amazon.com/bedrock/latest/APIReference/API_runtime_ToolSpecification.html\n // Pattern: ^[a-zA-Z][a-zA-Z0-9_]*$\n // Length Constraints: Minimum length of 1. Maximum length of 64.\n const isValidToolName = /^[a-zA-Z][a-zA-Z0-9_]*$/.test(name) &&\n name.length >= 1 &&\n name.length <= 64;\n if (!isValidToolName) {\n throw new Error(`Tool name must be between 1 and 64 characters, start with a letter, and contain only letters, numbers, and underscores. Found: ${name}`);\n }\n const toolDefinition = extractToolDefinition(tool);\n return `{ name: \"${name}\", description: \"${description}\", ${toolDefinition} }`;\n})\n .join(', ');\nconst extractToolDefinition = (tool) => {\n if ('model' in tool) {\n if (!isRef(tool.model))\n throw new Error(`Unexpected model was found in tool ${tool}.`);\n const { model, modelOperation } = tool;\n return `modelName: \"${model.data.link}\", modelOperation: ${modelOperation}`;\n }\n if (!isRef(tool.query))\n throw new Error(`Unexpected query was found in tool ${tool}.`);\n return `queryName: \"${tool.query.data.link}\"`;\n};\n"],"names":[],"mappings":";;;AAEY,MAAC,uBAAuB,GAAG,CAAC,OAAO,EAAE,QAAQ,KAAK;AAC9D,IAAI,MAAM,EAAE,OAAO,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C,IAAI,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;AAClD,CAAC;;;;"}
1
+ {"version":3,"file":"ConversationSchemaProcessor.mjs","sources":["../../../src/ai/ConversationSchemaProcessor.ts"],"sourcesContent":["import { accessData } from '../Authorization';\nimport { capitalize } from '../runtime/utils';\nexport const createConversationField = (typeDef, typeName) => {\n const { aiModel, systemPrompt, handler, tools } = typeDef;\n const { strategy, provider } = extractAuthorization(typeDef, typeName);\n const args = {\n aiModel: aiModel.resourcePath,\n // This is done to escape newlines in potentially multi-line system prompts\n // e.g.\n // realtorChat: a.conversation({\n // aiModel: a.ai.model('Claude 3 Haiku'),\n // systemPrompt: `You are a helpful real estate assistant\n // Respond in the poetic form of haiku.`,\n // }),\n //\n // It doesn't affect non multi-line string inputs for system prompts\n systemPrompt: systemPrompt.replace(/\\r?\\n/g, '\\\\n'),\n };\n const argsString = Object.entries(args)\n .map(([key, value]) => `${key}: \"${value}\"`)\n .join(', ');\n const authString = `, auth: { strategy: ${strategy}, provider: ${provider} }`;\n const functionHandler = {};\n let handlerString = '';\n if (handler) {\n const functionName = `Fn${capitalize(typeName)}`;\n const eventVersion = handler.eventVersion;\n handlerString = `, handler: { functionName: \"${functionName}\", eventVersion: \"${eventVersion}\" }`;\n functionHandler[functionName] = handler;\n }\n const toolsString = tools?.length\n ? `, tools: [${getConversationToolsString(tools)}]`\n : '';\n const conversationDirective = `@conversation(${argsString}${authString}${handlerString}${toolsString})`;\n const field = `${typeName}(conversationId: ID!, content: [AmplifyAIContentBlockInput], aiContext: AWSJSON, toolConfiguration: AmplifyAIToolConfigurationInput): AmplifyAIConversationMessage ${conversationDirective} @aws_cognito_user_pools`;\n return { field, functionHandler };\n};\nconst isRef = (query) => query?.data?.type === 'ref';\nconst extractAuthorization = (typeDef, typeName) => {\n const { authorization } = typeDef.data;\n if (authorization.length === 0) {\n throw new Error(`Conversation ${typeName} is missing authorization rules. Use .authorization((allow) => allow.owner()) to configure authorization for your conversation route.`);\n }\n const { strategy, provider } = accessData(authorization[0]);\n if (strategy !== 'owner' || provider !== 'userPools') {\n throw new Error(`Conversation ${typeName} must use owner authorization with a user pool provider. Use .authorization((allow) => allow.owner()) to configure authorization for your conversation route.`);\n }\n return { strategy, provider };\n};\nconst getConversationToolsString = (tools) => tools\n .map((tool) => {\n const { name, description } = tool;\n // https://docs.aws.amazon.com/bedrock/latest/APIReference/API_runtime_ToolSpecification.html\n // Pattern: ^[a-zA-Z][a-zA-Z0-9_]*$\n // Length Constraints: Minimum length of 1. Maximum length of 64.\n const isValidToolName = /^[a-zA-Z][a-zA-Z0-9_]*$/.test(name) &&\n name.length >= 1 &&\n name.length <= 64;\n if (!isValidToolName) {\n throw new Error(`Tool name must be between 1 and 64 characters, start with a letter, and contain only letters, numbers, and underscores. Found: ${name}`);\n }\n const toolDefinition = extractToolDefinition(tool);\n return `{ name: \"${name}\", description: \"${description}\", ${toolDefinition} }`;\n})\n .join(', ');\nconst extractToolDefinition = (tool) => {\n if ('model' in tool) {\n if (!isRef(tool.model))\n throw new Error(`Unexpected model was found in tool ${tool}.`);\n const { model, modelOperation } = tool;\n return `modelName: \"${model.data.link}\", modelOperation: ${modelOperation}`;\n }\n if (!isRef(tool.query))\n throw new Error(`Unexpected query was found in tool ${tool}.`);\n return `queryName: \"${tool.query.data.link}\"`;\n};\n"],"names":[],"mappings":";;;AAEY,MAAC,uBAAuB,GAAG,CAAC,OAAO,EAAE,QAAQ,KAAK;AAC9D,IAAI,MAAM,EAAE,OAAO,EAAE,YAAY,EAAE,OAAO,EAAE,KAAK,EAAE,GAAG,OAAO;AAC7D,IAAI,MAAM,EAAE,QAAQ,EAAE,QAAQ,EAAE,GAAG,oBAAoB,CAAC,OAAO,EAAE,QAAQ,CAAC;AAC1E,IAAI,MAAM,IAAI,GAAG;AACjB,QAAQ,OAAO,EAAE,OAAO,CAAC,YAAY;AACrC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,QAAQ,YAAY,EAAE,YAAY,CAA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C;AAClF,CAAC;AACD,KAAK,IAAI,CAAC,IAAI,CAAC;AACf,MAAM,qBAAqB,GAAG,CAAC,IAAI,KAAK;AACxC,IAAI,IAAI,OAAO,IAAI,IAAI,EAAE;AACzB,QAAQ,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,KAAK,CAAC;AAC9B,YAAY,MAAM,IAAI,KAAK,CAAC,CAAC,mCAAmC,EAAE,IAAI,CAAC,CAAC,CAAC,CAAC;AAC1E,QAAQ,MAAM,EAAE,KAAK,EAAE,cAAc,EAAE,GAAG,IAAI;AAC9C,QAAQ,OAAO,CAAC,YAAY,EAAE,KAAK,CAAC,IAAI,CAAC,IAAI,CAAC,mBAAmB,EAAE,cAAc,CAAC,CAAC;AACnF;AACA,IAAI,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,KAAK,CAAC;AAC1B,QAAQ,MAAM,IAAI,KAAK,CAAC,CAAC,mCAAmC,EAAE,IAAI,CAAC,CAAC,CAAC,CAAC;AACtE,IAAI,OAAO,CAAC,YAAY,EAAE,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC,CAAC;AACjD,CAAC;;;;"}
@@ -1 +1 @@
1
- {"version":3,"file":"ConversationType.mjs","sources":["../../../src/ai/ConversationType.ts"],"sourcesContent":["// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\nimport { allowForConversations } from '../Authorization';\nimport { brand } from '../util';\nexport const brandName = 'conversationCustomOperation';\n/**\n * Define a data tool to be used within an AI conversation route.\n *\n * @remarks\n *\n * Data tools can use a model generated list query or a custom query.\n * The tool's name must satisfy the following requirements:\n * - Be unique across all tools for a given conversation.\n * - Length must be between 1 and 64 characters.\n * - Must start with a letter.\n * - Must contain only letters, numbers, and underscores.\n *\n * The tool's `name` and `description` are used by the LLM to help it understand\n * the tool's purpose.\n *\n * @example\n *\n * realtorChat: a.conversation({\n * aiModel: a.ai.model('Claude 3 Haiku'),\n * systemPrompt: 'You are a helpful real estate assistant',\n * tools: [\n * // Data tools can use a model generated list query.\n * a.ai.dataTool({\n * name: 'get_listed_properties',\n * description: 'Get properties currently listed for sale',\n * model: a.model('RealEstateProperty'),\n * modelOperation: 'list',\n * }),\n * // Data tools can also use a custom query.\n * a.ai.dataTool({\n * name: 'get_oncall_realtor',\n * description: 'Get the oncall realtor',\n * query: a.query('getOnCallRealtor'),\n * }),\n * ],\n * })\n * @returns a data tool definition\n */\nexport function dataTool(input) {\n return input;\n}\nfunction _conversation(input) {\n const data = {\n authorization: [],\n };\n const builder = {\n authorization(callback) {\n const rules = callback(allowForConversations);\n data.authorization = Array.isArray(rules) ? rules : [rules];\n return this;\n },\n };\n return {\n ...brand(brandName),\n ...input,\n ...builder,\n data,\n };\n}\n/**\n * Define an AI conversation route which enables multi-turn conversation APIs for interacting with specified AI model.\n * @example\n * realtorChat: a.conversation({\n * aiModel: { resourcePath },\n * systemPrompt: 'You are a helpful real estate assistant',\n * })\n * @returns a conversation route definition\n */\nexport function conversation(input) {\n return _conversation(input);\n}\n"],"names":[],"mappings":";;;AAAA;AACA;AAGY,MAAC,SAAS,GAAG,8BAA8B;AACvD;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACO,SAAS,QAAQ,CAAC,KAAK,EAAE;AAChC,IAAI,OAAO,KAAK,CAAC;AACjB,CAAC;AACD,SAAS,aAAa,CAAC,KAAK,EAAE;AAC9B,IAAI,MAAM,IAAI,GAAG;AACjB,QAAQ,aAAa,EAAE,EAAE;AACzB,KAAK,CAAC;AACN,IAAI,MAAM,OAAO,GAAG;AACpB,QAAQ,aAAa,CAAC,QAAQ,EAAE;AAChC,YAAY,MAAM,KAAK,GAAG,QAAQ,CAAC,qBAAqB,CAAC,CAAC;AAC1D,YAAY,IAAI,CAAC,aAAa,GAAG,KAAK,CAAC,OAAO,CAAC,KAAK,CAAC,GAAG,KAAK,GAAG,CAAC,KAAK,CAAC,CAAC;AACxE,YAAY,OAAO,IAAI,CAAC;AACxB,SAAS;AACT,KAAK,CAAC;AACN,IAAI,OAAO;AACX,QAAQ,GAAG,KAAK,CAAC,SAAS,CAAC;AAC3B,QAAQ,GAAG,KAAK;AAChB,QAAQ,GAAG,OAAO;AAClB,QAAQ,IAAI;AACZ,KAAK,CAAC;AACN,CAAC;AACD;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACO,SAAS,YAAY,CAAC,KAAK,EAAE;AACpC,IAAI,OAAO,aAAa,CAAC,KAAK,CAAC,CAAC;AAChC;;;;"}
1
+ {"version":3,"file":"ConversationType.mjs","sources":["../../../src/ai/ConversationType.ts"],"sourcesContent":["// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\nimport { allowForConversations } from '../Authorization';\nimport { brand } from '../util';\nexport const brandName = 'conversationCustomOperation';\n/**\n * Define a data tool to be used within an AI conversation route.\n *\n * @remarks\n *\n * Data tools can use a model generated list query or a custom query.\n * The tool's name must satisfy the following requirements:\n * - Be unique across all tools for a given conversation.\n * - Length must be between 1 and 64 characters.\n * - Must start with a letter.\n * - Must contain only letters, numbers, and underscores.\n *\n * The tool's `name` and `description` are used by the LLM to help it understand\n * the tool's purpose.\n *\n * @example\n *\n * realtorChat: a.conversation({\n * aiModel: a.ai.model('Claude 3 Haiku'),\n * systemPrompt: 'You are a helpful real estate assistant',\n * tools: [\n * // Data tools can use a model generated list query.\n * a.ai.dataTool({\n * name: 'get_listed_properties',\n * description: 'Get properties currently listed for sale',\n * model: a.model('RealEstateProperty'),\n * modelOperation: 'list',\n * }),\n * // Data tools can also use a custom query.\n * a.ai.dataTool({\n * name: 'get_oncall_realtor',\n * description: 'Get the oncall realtor',\n * query: a.query('getOnCallRealtor'),\n * }),\n * ],\n * })\n * @returns a data tool definition\n */\nexport function dataTool(input) {\n return input;\n}\nfunction _conversation(input) {\n const data = {\n authorization: [],\n };\n const builder = {\n authorization(callback) {\n const rules = callback(allowForConversations);\n data.authorization = Array.isArray(rules) ? rules : [rules];\n return this;\n },\n };\n return {\n ...brand(brandName),\n ...input,\n ...builder,\n data,\n };\n}\n/**\n * Define an AI conversation route which enables multi-turn conversation APIs for interacting with specified AI model.\n * @example\n * realtorChat: a.conversation({\n * aiModel: { resourcePath },\n * systemPrompt: 'You are a helpful real estate assistant',\n * })\n * @returns a conversation route definition\n */\nexport function conversation(input) {\n return _conversation(input);\n}\n"],"names":[],"mappings":";;;AAAA;AACA;AAGY,MAAC,SAAS,GAAG;AACzB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACO,SAAS,QAAQ,CAAC,KAAK,EAAE;AAChC,IAAI,OAAO,KAAK;AAChB;AACA,SAAS,aAAa,CAAC,KAAK,EAAE;AAC9B,IAAI,MAAM,IAAI,GAAG;AACjB,QAAQ,aAAa,EAAE,EAAE;AACzB,KAAK;AACL,IAAI,MAAM,OAAO,GAAG;AACpB,QAAQ,aAAa,CAAC,QAAQ,EAAE;AAChC,YAAY,MAAM,KAAK,GAAG,QAAQ,CAAC,qBAAqB,CAAC;AACzD,YAAY,IAAI,CAAC,aAAa,GAAG,KAAK,CAAC,OAAO,CAAC,KAAK,CAAC,GAAG,KAAK,GAAG,CAAC,KAAK,CAAC;AACvE,YAAY,OAAO,IAAI;AACvB,SAAS;AACT,KAAK;AACL,IAAI,OAAO;AACX,QAAQ,GAAG,KAAK,CAAC,SAAS,CAAC;AAC3B,QAAQ,GAAG,KAAK;AAChB,QAAQ,GAAG,OAAO;AAClB,QAAQ,IAAI;AACZ,KAAK;AACL;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACO,SAAS,YAAY,CAAC,KAAK,EAAE;AACpC,IAAI,OAAO,aAAa,CAAC,KAAK,CAAC;AAC/B;;;;"}
@@ -1 +1 @@
1
- {"version":3,"file":"ModelType.mjs","sources":["../../../src/ai/ModelType.ts"],"sourcesContent":["// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\nconst supportedModelsLookup = {\n // Amazon Nova models\n 'Amazon Nova Pro': 'amazon.nova-pro-v1:0',\n 'Amazon Nova Lite': 'amazon.nova-lite-v1:0',\n 'Amazon Nova Micro': 'amazon.nova-micro-v1:0',\n // Anthropic models\n 'Claude 3 Haiku': 'anthropic.claude-3-haiku-20240307-v1:0',\n 'Claude 3 Opus': 'anthropic.claude-3-opus-20240229-v1:0',\n 'Claude 3 Sonnet': 'anthropic.claude-3-sonnet-20240229-v1:0',\n 'Claude 3.5 Haiku': 'anthropic.claude-3-5-haiku-20241022-v1:0',\n 'Claude 3.5 Sonnet': 'anthropic.claude-3-5-sonnet-20240620-v1:0',\n 'Claude 3.5 Sonnet v2': 'anthropic.claude-3-5-sonnet-20241022-v2:0',\n // Cohere models\n 'Cohere Command R': 'cohere.command-r-v1:0',\n 'Cohere Command R+': 'cohere.command-r-plus-v1:0',\n // Meta models\n 'Llama 3.1 8B Instruct': 'meta.llama3-1-8b-instruct-v1:0',\n 'Llama 3.1 70B Instruct': 'meta.llama3-1-70b-instruct-v1:0',\n 'Llama 3.1 405B Instruct': 'meta.llama3-1-405b-instruct-v1:0',\n // Mistral AI models\n 'Mistral Large': 'mistral.mistral-large-2402-v1:0',\n 'Mistral Large 2': 'mistral.mistral-large-2407-v1:0',\n 'Mistral Small': 'mistral.mistral-small-2402-v1:0',\n};\n/**\n * Bedrock models currently supporting Converse API and Tool use\n * @see {@link https://docs.aws.amazon.com/bedrock/latest/userguide/conversation-inference.html#conversation-inference-supported-models-features}\n */\nexport function model(modelName) {\n return {\n resourcePath: supportedModelsLookup[modelName],\n };\n}\n"],"names":[],"mappings":"AAAA;AACA;AACA,MAAM,qBAAqB,GAAG;AAC9B;AACA,IAAI,iBAAiB,EAAE,sBAAsB;AAC7C,IAAI,kBAAkB,EAAE,uBAAuB;AAC/C,IAAI,mBAAmB,EAAE,wBAAwB;AACjD;AACA,IAAI,gBAAgB,EAAE,wCAAwC;AAC9D,IAAI,eAAe,EAAE,uCAAuC;AAC5D,IAAI,iBAAiB,EAAE,yCAAyC;AAChE,IAAI,kBAAkB,EAAE,0CAA0C;AAClE,IAAI,mBAAmB,EAAE,2CAA2C;AACpE,IAAI,sBAAsB,EAAE,2CAA2C;AACvE;AACA,IAAI,kBAAkB,EAAE,uBAAuB;AAC/C,IAAI,mBAAmB,EAAE,4BAA4B;AACrD;AACA,IAAI,uBAAuB,EAAE,gCAAgC;AAC7D,IAAI,wBAAwB,EAAE,iCAAiC;AAC/D,IAAI,yBAAyB,EAAE,kCAAkC;AACjE;AACA,IAAI,eAAe,EAAE,iCAAiC;AACtD,IAAI,iBAAiB,EAAE,iCAAiC;AACxD,IAAI,eAAe,EAAE,iCAAiC;AACtD,CAAC,CAAC;AACF;AACA;AACA;AACA;AACO,SAAS,KAAK,CAAC,SAAS,EAAE;AACjC,IAAI,OAAO;AACX,QAAQ,YAAY,EAAE,qBAAqB,CAAC,SAAS,CAAC;AACtD,KAAK,CAAC;AACN;;;;"}
1
+ {"version":3,"file":"ModelType.mjs","sources":["../../../src/ai/ModelType.ts"],"sourcesContent":["// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\nconst supportedModelsLookup = {\n // Amazon Nova models\n 'Amazon Nova Pro': 'amazon.nova-pro-v1:0',\n 'Amazon Nova Lite': 'amazon.nova-lite-v1:0',\n 'Amazon Nova Micro': 'amazon.nova-micro-v1:0',\n // Anthropic models\n 'Claude 3 Haiku': 'anthropic.claude-3-haiku-20240307-v1:0',\n 'Claude 3 Opus': 'anthropic.claude-3-opus-20240229-v1:0',\n 'Claude 3 Sonnet': 'anthropic.claude-3-sonnet-20240229-v1:0',\n 'Claude 3.5 Haiku': 'anthropic.claude-3-5-haiku-20241022-v1:0',\n 'Claude 3.5 Sonnet': 'anthropic.claude-3-5-sonnet-20240620-v1:0',\n 'Claude 3.5 Sonnet v2': 'anthropic.claude-3-5-sonnet-20241022-v2:0',\n // Cohere models\n 'Cohere Command R': 'cohere.command-r-v1:0',\n 'Cohere Command R+': 'cohere.command-r-plus-v1:0',\n // Meta models\n 'Llama 3.1 8B Instruct': 'meta.llama3-1-8b-instruct-v1:0',\n 'Llama 3.1 70B Instruct': 'meta.llama3-1-70b-instruct-v1:0',\n 'Llama 3.1 405B Instruct': 'meta.llama3-1-405b-instruct-v1:0',\n // Mistral AI models\n 'Mistral Large': 'mistral.mistral-large-2402-v1:0',\n 'Mistral Large 2': 'mistral.mistral-large-2407-v1:0',\n 'Mistral Small': 'mistral.mistral-small-2402-v1:0',\n};\n/**\n * Bedrock models currently supporting Converse API and Tool use\n * @see {@link https://docs.aws.amazon.com/bedrock/latest/userguide/conversation-inference.html#conversation-inference-supported-models-features}\n */\nexport function model(modelName) {\n return {\n resourcePath: supportedModelsLookup[modelName],\n };\n}\n"],"names":[],"mappings":"AAAA;AACA;AACA,MAAM,qBAAqB,GAAG;AAC9B;AACA,IAAI,iBAAiB,EAAE,sBAAsB;AAC7C,IAAI,kBAAkB,EAAE,uBAAuB;AAC/C,IAAI,mBAAmB,EAAE,wBAAwB;AACjD;AACA,IAAI,gBAAgB,EAAE,wCAAwC;AAC9D,IAAI,eAAe,EAAE,uCAAuC;AAC5D,IAAI,iBAAiB,EAAE,yCAAyC;AAChE,IAAI,kBAAkB,EAAE,0CAA0C;AAClE,IAAI,mBAAmB,EAAE,2CAA2C;AACpE,IAAI,sBAAsB,EAAE,2CAA2C;AACvE;AACA,IAAI,kBAAkB,EAAE,uBAAuB;AAC/C,IAAI,mBAAmB,EAAE,4BAA4B;AACrD;AACA,IAAI,uBAAuB,EAAE,gCAAgC;AAC7D,IAAI,wBAAwB,EAAE,iCAAiC;AAC/D,IAAI,yBAAyB,EAAE,kCAAkC;AACjE;AACA,IAAI,eAAe,EAAE,iCAAiC;AACtD,IAAI,iBAAiB,EAAE,iCAAiC;AACxD,IAAI,eAAe,EAAE,iCAAiC;AACtD,CAAC;AACD;AACA;AACA;AACA;AACO,SAAS,KAAK,CAAC,SAAS,EAAE;AACjC,IAAI,OAAO;AACX,QAAQ,YAAY,EAAE,qBAAqB,CAAC,SAAS,CAAC;AACtD,KAAK;AACL;;;;"}
@@ -5,7 +5,7 @@ export type { ClientSchema };
5
5
  export type { CombinedModelSchema } from './CombineSchema';
6
6
  export type { Authorization, ResourceAuthorization } from './Authorization';
7
7
  export type { CustomOperation } from './CustomOperation';
8
- export type { ModelField, Nullable, Json } from './ModelField';
8
+ export type { ModelField, ModelFieldType, Nullable, Json } from './ModelField';
9
9
  export type { ModelSchema, RDSModelSchema } from './ModelSchema';
10
10
  export type { ModelType, ModelDefaultIdentifier } from './ModelType';
11
11
  export type { RefType } from './RefType';
@@ -1 +1 @@
1
- {"version":3,"file":"addSchemaToClient.mjs","sources":["../../../src/runtime/addSchemaToClient.ts"],"sourcesContent":["// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\nimport { generateConversationsProperty, generateCustomQueriesProperty, generateCustomMutationsProperty, generateCustomSubscriptionsProperty, generateEnumsProperty, generateGenerationsProperty, generateModelsProperty, upgradeClientCancellation, } from './internals';\nexport function addSchemaToClient(client, apiGraphqlConfig, getInternals) {\n upgradeClientCancellation(client);\n client.models = generateModelsProperty(client, apiGraphqlConfig, getInternals);\n client.enums = generateEnumsProperty(apiGraphqlConfig);\n client.queries = generateCustomQueriesProperty(client, apiGraphqlConfig, getInternals);\n client.mutations = generateCustomMutationsProperty(client, apiGraphqlConfig, getInternals);\n client.subscriptions = generateCustomSubscriptionsProperty(client, apiGraphqlConfig, getInternals);\n client.conversations = generateConversationsProperty(client, apiGraphqlConfig, getInternals);\n client.generations = generateGenerationsProperty(client, apiGraphqlConfig, getInternals);\n return client;\n}\n"],"names":[],"mappings":";;;;;;;AAAA;AACA;AAEO,SAAS,iBAAiB,CAAC,MAAM,EAAE,gBAAgB,EAAE,YAAY,EAAE;AAC1E,IAAI,yBAAyB,CAAC,MAAM,CAAC,CAAC;AACtC,IAAI,MAAM,CAAC,MAAM,GAAG,sBAAsB,CAAC,MAAM,EAAE,gBAAgB,EAAE,YAAY,CAAC,CAAC;AACnF,IAAI,MAAM,CAAC,KAAK,GAAG,qBAAqB,CAAC,gBAAgB,CAAC,CAAC;AAC3D,IAAI,MAAM,CAAC,OAAO,GAAG,6BAA6B,CAAC,MAAM,EAAE,gBAAgB,EAAE,YAAY,CAAC,CAAC;AAC3F,IAAI,MAAM,CAAC,SAAS,GAAG,+BAA+B,CAAC,MAAM,EAAE,gBAAgB,EAAE,YAAY,CAAC,CAAC;AAC/F,IAAI,MAAM,CAAC,aAAa,GAAG,mCAAmC,CAAC,MAAM,EAAE,gBAAgB,EAAE,YAAY,CAAC,CAAC;AACvG,IAAI,MAAM,CAAC,aAAa,GAAG,6BAA6B,CAAC,MAAM,EAAE,gBAAgB,EAAE,YAAY,CAAC,CAAC;AACjG,IAAI,MAAM,CAAC,WAAW,GAAG,2BAA2B,CAAC,MAAM,EAAE,gBAAgB,EAAE,YAAY,CAAC,CAAC;AAC7F,IAAI,OAAO,MAAM,CAAC;AAClB;;;;"}
1
+ {"version":3,"file":"addSchemaToClient.mjs","sources":["../../../src/runtime/addSchemaToClient.ts"],"sourcesContent":["// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\nimport { generateConversationsProperty, generateCustomQueriesProperty, generateCustomMutationsProperty, generateCustomSubscriptionsProperty, generateEnumsProperty, generateGenerationsProperty, generateModelsProperty, upgradeClientCancellation, } from './internals';\nexport function addSchemaToClient(client, apiGraphqlConfig, getInternals) {\n upgradeClientCancellation(client);\n client.models = generateModelsProperty(client, apiGraphqlConfig, getInternals);\n client.enums = generateEnumsProperty(apiGraphqlConfig);\n client.queries = generateCustomQueriesProperty(client, apiGraphqlConfig, getInternals);\n client.mutations = generateCustomMutationsProperty(client, apiGraphqlConfig, getInternals);\n client.subscriptions = generateCustomSubscriptionsProperty(client, apiGraphqlConfig, getInternals);\n client.conversations = generateConversationsProperty(client, apiGraphqlConfig, getInternals);\n client.generations = generateGenerationsProperty(client, apiGraphqlConfig, getInternals);\n return client;\n}\n"],"names":[],"mappings":";;;;;;;AAAA;AACA;AAEO,SAAS,iBAAiB,CAAC,MAAM,EAAE,gBAAgB,EAAE,YAAY,EAAE;AAC1E,IAAI,yBAAyB,CAAC,MAAM,CAAC;AACrC,IAAI,MAAM,CAAC,MAAM,GAAG,sBAAsB,CAAC,MAAM,EAAE,gBAAgB,EAAE,YAAY,CAAC;AAClF,IAAI,MAAM,CAAC,KAAK,GAAG,qBAAqB,CAAC,gBAAgB,CAAC;AAC1D,IAAI,MAAM,CAAC,OAAO,GAAG,6BAA6B,CAAC,MAAM,EAAE,gBAAgB,EAAE,YAAY,CAAC;AAC1F,IAAI,MAAM,CAAC,SAAS,GAAG,+BAA+B,CAAC,MAAM,EAAE,gBAAgB,EAAE,YAAY,CAAC;AAC9F,IAAI,MAAM,CAAC,aAAa,GAAG,mCAAmC,CAAC,MAAM,EAAE,gBAAgB,EAAE,YAAY,CAAC;AACtG,IAAI,MAAM,CAAC,aAAa,GAAG,6BAA6B,CAAC,MAAM,EAAE,gBAAgB,EAAE,YAAY,CAAC;AAChG,IAAI,MAAM,CAAC,WAAW,GAAG,2BAA2B,CAAC,MAAM,EAAE,gBAAgB,EAAE,YAAY,CAAC;AAC5F,IAAI,OAAO,MAAM;AACjB;;;;"}
@@ -1 +1 @@
1
- {"version":3,"file":"addSchemaToClientWithInstance.mjs","sources":["../../../src/runtime/addSchemaToClientWithInstance.ts"],"sourcesContent":["// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\nimport { isApiGraphQLConfig } from './internals/utils/runtimeTypeGuards/isApiGraphQLProviderConfig';\nimport { generateCustomQueriesProperty, generateCustomMutationsProperty, generateEnumsProperty, upgradeClientCancellation, } from './internals';\nimport { generateModelsProperty as generateModelsPropertyServer } from './internals/server';\n// TODO: separate import path\nexport function addSchemaToClientWithInstance(client, params, getInternals) {\n const apiGraphqlConfig = params.config?.API?.GraphQL;\n if (isApiGraphQLConfig(apiGraphqlConfig)) {\n upgradeClientCancellation(client);\n client.models = generateModelsPropertyServer(client, params, getInternals);\n client.enums = generateEnumsProperty(apiGraphqlConfig);\n client.queries = generateCustomQueriesProperty(client, apiGraphqlConfig, getInternals);\n client.mutations = generateCustomMutationsProperty(client, apiGraphqlConfig, getInternals);\n }\n return client;\n}\n"],"names":["generateModelsPropertyServer"],"mappings":";;;;;;;;;AAAA;AACA;AAIA;AACO,SAAS,6BAA6B,CAAC,MAAM,EAAE,MAAM,EAAE,YAAY,EAAE;AAC5E,IAAI,MAAM,gBAAgB,GAAG,MAAM,CAAC,MAAM,EAAE,GAAG,EAAE,OAAO,CAAC;AACzD,IAAI,IAAI,kBAAkB,CAAC,gBAAgB,CAAC,EAAE;AAC9C,QAAQ,yBAAyB,CAAC,MAAM,CAAC,CAAC;AAC1C,QAAQ,MAAM,CAAC,MAAM,GAAGA,sBAA4B,CAAC,MAAM,EAAE,MAAM,EAAE,YAAY,CAAC,CAAC;AACnF,QAAQ,MAAM,CAAC,KAAK,GAAG,qBAAqB,CAAC,gBAAgB,CAAC,CAAC;AAC/D,QAAQ,MAAM,CAAC,OAAO,GAAG,6BAA6B,CAAC,MAAM,EAAE,gBAAgB,EAAE,YAAY,CAAC,CAAC;AAC/F,QAAQ,MAAM,CAAC,SAAS,GAAG,+BAA+B,CAAC,MAAM,EAAE,gBAAgB,EAAE,YAAY,CAAC,CAAC;AACnG,KAAK;AACL,IAAI,OAAO,MAAM,CAAC;AAClB;;;;"}
1
+ {"version":3,"file":"addSchemaToClientWithInstance.mjs","sources":["../../../src/runtime/addSchemaToClientWithInstance.ts"],"sourcesContent":["// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\nimport { isApiGraphQLConfig } from './internals/utils/runtimeTypeGuards/isApiGraphQLProviderConfig';\nimport { generateCustomQueriesProperty, generateCustomMutationsProperty, generateEnumsProperty, upgradeClientCancellation, } from './internals';\nimport { generateModelsProperty as generateModelsPropertyServer } from './internals/server';\n// TODO: separate import path\nexport function addSchemaToClientWithInstance(client, params, getInternals) {\n const apiGraphqlConfig = params.config?.API?.GraphQL;\n if (isApiGraphQLConfig(apiGraphqlConfig)) {\n upgradeClientCancellation(client);\n client.models = generateModelsPropertyServer(client, params, getInternals);\n client.enums = generateEnumsProperty(apiGraphqlConfig);\n client.queries = generateCustomQueriesProperty(client, apiGraphqlConfig, getInternals);\n client.mutations = generateCustomMutationsProperty(client, apiGraphqlConfig, getInternals);\n }\n return client;\n}\n"],"names":["generateModelsPropertyServer"],"mappings":";;;;;;;;;AAAA;AACA;AAIA;AACO,SAAS,6BAA6B,CAAC,MAAM,EAAE,MAAM,EAAE,YAAY,EAAE;AAC5E,IAAI,MAAM,gBAAgB,GAAG,MAAM,CAAC,MAAM,EAAE,GAAG,EAAE,OAAO;AACxD,IAAI,IAAI,kBAAkB,CAAC,gBAAgB,CAAC,EAAE;AAC9C,QAAQ,yBAAyB,CAAC,MAAM,CAAC;AACzC,QAAQ,MAAM,CAAC,MAAM,GAAGA,sBAA4B,CAAC,MAAM,EAAE,MAAM,EAAE,YAAY,CAAC;AAClF,QAAQ,MAAM,CAAC,KAAK,GAAG,qBAAqB,CAAC,gBAAgB,CAAC;AAC9D,QAAQ,MAAM,CAAC,OAAO,GAAG,6BAA6B,CAAC,MAAM,EAAE,gBAAgB,EAAE,YAAY,CAAC;AAC9F,QAAQ,MAAM,CAAC,SAAS,GAAG,+BAA+B,CAAC,MAAM,EAAE,gBAAgB,EAAE,YAAY,CAAC;AAClG;AACA,IAAI,OAAO,MAAM;AACjB;;;;"}
@@ -1 +1 @@
1
- {"version":3,"file":"bridge-types.mjs","sources":["../../../src/runtime/bridge-types.ts"],"sourcesContent":["/* eslint-disable @typescript-eslint/no-namespace */\n/**\n * Field-level Relationship Definitions\n */\nexport var CodeGenConnectionType;\n(function (CodeGenConnectionType) {\n CodeGenConnectionType[\"HAS_ONE\"] = \"HAS_ONE\";\n CodeGenConnectionType[\"BELONGS_TO\"] = \"BELONGS_TO\";\n CodeGenConnectionType[\"HAS_MANY\"] = \"HAS_MANY\";\n})(CodeGenConnectionType || (CodeGenConnectionType = {}));\n"],"names":[],"mappings":"AAAA;AACA;AACA;AACA;AACU,IAAC,sBAAsB;AACjC,CAAC,UAAU,qBAAqB,EAAE;AAClC,IAAI,qBAAqB,CAAC,SAAS,CAAC,GAAG,SAAS,CAAC;AACjD,IAAI,qBAAqB,CAAC,YAAY,CAAC,GAAG,YAAY,CAAC;AACvD,IAAI,qBAAqB,CAAC,UAAU,CAAC,GAAG,UAAU,CAAC;AACnD,CAAC,EAAE,qBAAqB,KAAK,qBAAqB,GAAG,EAAE,CAAC,CAAC;;;;"}
1
+ {"version":3,"file":"bridge-types.mjs","sources":["../../../src/runtime/bridge-types.ts"],"sourcesContent":["/* eslint-disable @typescript-eslint/no-namespace */\n/**\n * Field-level Relationship Definitions\n */\nexport var CodeGenConnectionType;\n(function (CodeGenConnectionType) {\n CodeGenConnectionType[\"HAS_ONE\"] = \"HAS_ONE\";\n CodeGenConnectionType[\"BELONGS_TO\"] = \"BELONGS_TO\";\n CodeGenConnectionType[\"HAS_MANY\"] = \"HAS_MANY\";\n})(CodeGenConnectionType || (CodeGenConnectionType = {}));\n"],"names":[],"mappings":"AAAA;AACA;AACA;AACA;AACU,IAAC;AACX,CAAC,UAAU,qBAAqB,EAAE;AAClC,IAAI,qBAAqB,CAAC,SAAS,CAAC,GAAG,SAAS;AAChD,IAAI,qBAAqB,CAAC,YAAY,CAAC,GAAG,YAAY;AACtD,IAAI,qBAAqB,CAAC,UAAU,CAAC,GAAG,UAAU;AAClD,CAAC,EAAE,qBAAqB,KAAK,qBAAqB,GAAG,EAAE,CAAC,CAAC;;;;"}