@aws-amplify/data-schema 1.20.5 → 1.21.1
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/SchemaProcessor.js +5 -2
- package/dist/cjs/SchemaProcessor.js.map +1 -1
- package/dist/cjs/ai/ModelType.js +3 -0
- package/dist/cjs/ai/ModelType.js.map +1 -1
- package/dist/esm/ModelIndex.d.ts +2 -2
- package/dist/esm/SchemaProcessor.mjs +5 -2
- package/dist/esm/SchemaProcessor.mjs.map +1 -1
- package/dist/esm/ai/ModelType.d.ts +3 -0
- package/dist/esm/ai/ModelType.mjs +3 -0
- package/dist/esm/ai/ModelType.mjs.map +1 -1
- package/dist/meta/cjs.tsbuildinfo +1 -1
- package/package.json +2 -2
- package/src/ModelIndex.ts +2 -2
- package/src/SchemaProcessor.ts +8 -5
- package/src/ai/ModelType.ts +3 -0
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@aws-amplify/data-schema",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.21.1",
|
|
4
4
|
"license": "Apache-2.0",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|
|
@@ -18,7 +18,7 @@
|
|
|
18
18
|
"docs:temp": "api-extractor run && api-documenter markdown --input-folder temp --output-folder temp/docs",
|
|
19
19
|
"check:api": "rimraf temp && npm run docs:temp && tsx ../../scripts/shallow-dir-diff.ts docs temp/docs",
|
|
20
20
|
"lint": "eslint .",
|
|
21
|
-
"test": "jest"
|
|
21
|
+
"test": "jest --coverage"
|
|
22
22
|
},
|
|
23
23
|
"exports": {
|
|
24
24
|
".": {
|
package/src/ModelIndex.ts
CHANGED
|
@@ -6,7 +6,7 @@ export type ModelIndexData = {
|
|
|
6
6
|
partitionKey: string;
|
|
7
7
|
sortKeys: readonly unknown[];
|
|
8
8
|
indexName: string;
|
|
9
|
-
queryField: string;
|
|
9
|
+
queryField: string | null;
|
|
10
10
|
};
|
|
11
11
|
|
|
12
12
|
export type InternalModelIndexType = ModelIndexType<any, any, any, any> & {
|
|
@@ -31,7 +31,7 @@ export type ModelIndexType<
|
|
|
31
31
|
name: string,
|
|
32
32
|
): ModelIndexType<ModelFieldKeys, PK, SK, QueryField, K | 'name'>;
|
|
33
33
|
queryField<
|
|
34
|
-
QF extends string = never,
|
|
34
|
+
QF extends string | null = never,
|
|
35
35
|
MF extends ModelFieldKeys = ModelFieldKeys,
|
|
36
36
|
>(
|
|
37
37
|
field: QF,
|
package/src/SchemaProcessor.ts
CHANGED
|
@@ -217,7 +217,7 @@ function scalarFieldToGql(
|
|
|
217
217
|
for (const index of secondaryIndexes) {
|
|
218
218
|
field += ` ${index}`;
|
|
219
219
|
}
|
|
220
|
-
|
|
220
|
+
|
|
221
221
|
// Add validation directives for each validation rule
|
|
222
222
|
for (const validationRule of validation) {
|
|
223
223
|
const valueStr = typeof validationRule.value === 'number' ? validationRule.value.toString() : validationRule.value;
|
|
@@ -227,7 +227,7 @@ function scalarFieldToGql(
|
|
|
227
227
|
field += ` @validate(type: ${validationRule.type}, value: "${valueStr}")`;
|
|
228
228
|
}
|
|
229
229
|
}
|
|
230
|
-
|
|
230
|
+
|
|
231
231
|
return field;
|
|
232
232
|
}
|
|
233
233
|
|
|
@@ -1116,7 +1116,7 @@ const transformedSecondaryIndexesForModel = (
|
|
|
1116
1116
|
partitionKey: string,
|
|
1117
1117
|
sortKeys: readonly string[],
|
|
1118
1118
|
indexName: string,
|
|
1119
|
-
queryField: string,
|
|
1119
|
+
queryField: string | null,
|
|
1120
1120
|
): string => {
|
|
1121
1121
|
for (const keyName of [partitionKey, ...sortKeys]) {
|
|
1122
1122
|
const field = modelFields[keyName];
|
|
@@ -1131,7 +1131,7 @@ const transformedSecondaryIndexesForModel = (
|
|
|
1131
1131
|
}
|
|
1132
1132
|
}
|
|
1133
1133
|
|
|
1134
|
-
if (!sortKeys.length && !indexName && !queryField) {
|
|
1134
|
+
if (!sortKeys.length && !indexName && !queryField && queryField !== null) {
|
|
1135
1135
|
return `@index(queryField: "${secondaryIndexDefaultQueryField(
|
|
1136
1136
|
modelName,
|
|
1137
1137
|
partitionKey,
|
|
@@ -1150,7 +1150,10 @@ const transformedSecondaryIndexesForModel = (
|
|
|
1150
1150
|
);
|
|
1151
1151
|
}
|
|
1152
1152
|
|
|
1153
|
-
if
|
|
1153
|
+
if(queryField === null) {
|
|
1154
|
+
attributes.push(`queryField: null`);
|
|
1155
|
+
}
|
|
1156
|
+
else if (queryField) {
|
|
1154
1157
|
attributes.push(`queryField: "${queryField}"`);
|
|
1155
1158
|
} else {
|
|
1156
1159
|
attributes.push(
|
package/src/ai/ModelType.ts
CHANGED
|
@@ -15,6 +15,9 @@ const supportedModelsLookup = {
|
|
|
15
15
|
'Claude 3.5 Haiku': 'anthropic.claude-3-5-haiku-20241022-v1:0',
|
|
16
16
|
'Claude 3.5 Sonnet': 'anthropic.claude-3-5-sonnet-20240620-v1:0',
|
|
17
17
|
'Claude 3.5 Sonnet v2': 'anthropic.claude-3-5-sonnet-20241022-v2:0',
|
|
18
|
+
'Claude 3.7 Sonnet': 'anthropic.claude-3-7-sonnet-20250219-v1:0',
|
|
19
|
+
'Claude Opus 4': 'anthropic.claude-opus-4-20250514-v1:0',
|
|
20
|
+
'Claude Sonnet 4': 'anthropic.claude-sonnet-4-20250514-v1:0',
|
|
18
21
|
// Cohere models
|
|
19
22
|
'Cohere Command R': 'cohere.command-r-v1:0',
|
|
20
23
|
'Cohere Command R+': 'cohere.command-r-plus-v1:0',
|