@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/dist/cjs/ai/ModelType.js
CHANGED
|
@@ -16,6 +16,9 @@ const supportedModelsLookup = {
|
|
|
16
16
|
'Claude 3.5 Haiku': 'anthropic.claude-3-5-haiku-20241022-v1:0',
|
|
17
17
|
'Claude 3.5 Sonnet': 'anthropic.claude-3-5-sonnet-20240620-v1:0',
|
|
18
18
|
'Claude 3.5 Sonnet v2': 'anthropic.claude-3-5-sonnet-20241022-v2:0',
|
|
19
|
+
'Claude 3.7 Sonnet': 'anthropic.claude-3-7-sonnet-20250219-v1:0',
|
|
20
|
+
'Claude Opus 4': 'anthropic.claude-opus-4-20250514-v1:0',
|
|
21
|
+
'Claude Sonnet 4': 'anthropic.claude-sonnet-4-20250514-v1:0',
|
|
19
22
|
// Cohere models
|
|
20
23
|
'Cohere Command R': 'cohere.command-r-v1:0',
|
|
21
24
|
'Cohere Command R+': 'cohere.command-r-plus-v1:0',
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ModelType.js","sources":["../../../src/ai/ModelType.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.model = model;\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 */\nfunction model(modelName) {\n return {\n resourcePath: supportedModelsLookup[modelName],\n };\n}\n"],"names":[],"mappings":";;AACA;AACA;AACA,MAAM,CAAC,cAAc,CAAC,OAAO,EAAE,YAAY,EAAE,EAAE,KAAK,EAAE,IAAI,EAAE,CAAC;AAC7D,OAAO,CAAC,KAAK,GAAG,KAAK;AACrB,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;AACA,SAAS,KAAK,CAAC,SAAS,EAAE;AAC1B,IAAI,OAAO;AACX,QAAQ,YAAY,EAAE,qBAAqB,CAAC,SAAS,CAAC;AACtD,KAAK;AACL;;"}
|
|
1
|
+
{"version":3,"file":"ModelType.js","sources":["../../../src/ai/ModelType.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.model = model;\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 'Claude 3.7 Sonnet': 'anthropic.claude-3-7-sonnet-20250219-v1:0',\n 'Claude Opus 4': 'anthropic.claude-opus-4-20250514-v1:0',\n 'Claude Sonnet 4': 'anthropic.claude-sonnet-4-20250514-v1: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 */\nfunction model(modelName) {\n return {\n resourcePath: supportedModelsLookup[modelName],\n };\n}\n"],"names":[],"mappings":";;AACA;AACA;AACA,MAAM,CAAC,cAAc,CAAC,OAAO,EAAE,YAAY,EAAE,EAAE,KAAK,EAAE,IAAI,EAAE,CAAC;AAC7D,OAAO,CAAC,KAAK,GAAG,KAAK;AACrB,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,IAAI,mBAAmB,EAAE,2CAA2C;AACpE,IAAI,eAAe,EAAE,uCAAuC;AAC5D,IAAI,iBAAiB,EAAE,yCAAyC;AAChE;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;AACA,SAAS,KAAK,CAAC,SAAS,EAAE;AAC1B,IAAI,OAAO;AACX,QAAQ,YAAY,EAAE,qBAAqB,CAAC,SAAS,CAAC;AACtD,KAAK;AACL;;"}
|
package/dist/esm/ModelIndex.d.ts
CHANGED
|
@@ -4,7 +4,7 @@ export type ModelIndexData = {
|
|
|
4
4
|
partitionKey: string;
|
|
5
5
|
sortKeys: readonly unknown[];
|
|
6
6
|
indexName: string;
|
|
7
|
-
queryField: string;
|
|
7
|
+
queryField: string | null;
|
|
8
8
|
};
|
|
9
9
|
export type InternalModelIndexType = ModelIndexType<any, any, any, any> & {
|
|
10
10
|
data: ModelIndexData;
|
|
@@ -12,7 +12,7 @@ export type InternalModelIndexType = ModelIndexType<any, any, any, any> & {
|
|
|
12
12
|
export type ModelIndexType<ModelFieldKeys extends string, PK, SK = readonly [], QueryField = never, K extends keyof ModelIndexType<any, any, any, any> = never> = Omit<{
|
|
13
13
|
sortKeys<FieldKeys extends ModelFieldKeys = ModelFieldKeys, const SK extends ReadonlyArray<Exclude<FieldKeys, PK>> = readonly []>(sortKeys: SK): ModelIndexType<FieldKeys, PK, SK, QueryField, K | 'sortKeys'>;
|
|
14
14
|
name(name: string): ModelIndexType<ModelFieldKeys, PK, SK, QueryField, K | 'name'>;
|
|
15
|
-
queryField<QF extends string = never, MF extends ModelFieldKeys = ModelFieldKeys>(field: QF): ModelIndexType<MF, PK, SK, QF, K | 'queryField'>;
|
|
15
|
+
queryField<QF extends string | null = never, MF extends ModelFieldKeys = ModelFieldKeys>(field: QF): ModelIndexType<MF, PK, SK, QF, K | 'queryField'>;
|
|
16
16
|
}, K> & Brand<typeof brandName>;
|
|
17
17
|
export declare function modelIndex<ModelFieldKeys extends string, PK extends ModelFieldKeys, SK = readonly [], QueryField = never>(partitionKeyFieldName: PK): ModelIndexType<ModelFieldKeys, PK, SK, QueryField, never>;
|
|
18
18
|
export {};
|
|
@@ -740,7 +740,7 @@ const transformedSecondaryIndexesForModel = (modelName, secondaryIndexes, modelF
|
|
|
740
740
|
}
|
|
741
741
|
}
|
|
742
742
|
}
|
|
743
|
-
if (!sortKeys.length && !indexName && !queryField) {
|
|
743
|
+
if (!sortKeys.length && !indexName && !queryField && queryField !== null) {
|
|
744
744
|
return `@index(queryField: "${secondaryIndexDefaultQueryField(modelName, partitionKey)}")`;
|
|
745
745
|
}
|
|
746
746
|
const attributes = [];
|
|
@@ -750,7 +750,10 @@ const transformedSecondaryIndexesForModel = (modelName, secondaryIndexes, modelF
|
|
|
750
750
|
if (sortKeys.length) {
|
|
751
751
|
attributes.push(`sortKeyFields: [${sortKeys.map((sk) => `"${sk}"`).join(', ')}]`);
|
|
752
752
|
}
|
|
753
|
-
if (queryField) {
|
|
753
|
+
if (queryField === null) {
|
|
754
|
+
attributes.push(`queryField: null`);
|
|
755
|
+
}
|
|
756
|
+
else if (queryField) {
|
|
754
757
|
attributes.push(`queryField: "${queryField}"`);
|
|
755
758
|
}
|
|
756
759
|
else {
|