@aws-amplify/data-schema
Advanced tools
Comparing version 0.0.0-asynclambda-20240911175119 to 0.0.0-asynclambda-20240912010846
@@ -23,6 +23,14 @@ 'use strict'; | ||
const [key] = Object.keys(value.data); | ||
// Will need flattening here if/when custom selection set support is added: | ||
const data = value.data[key]; | ||
const [initialized] = (0, APIClient_1.initializeModel)(client, name, [data], modelIntrospection, auth.authMode, auth.authToken); | ||
return initialized; | ||
const flattenedResult = (0, APIClient_1.flattenItems)(modelIntrospection, name, data); | ||
if (flattenedResult === null) { | ||
return null; | ||
} | ||
else if (args?.selectionSet) { | ||
return flattenedResult; | ||
} | ||
else { | ||
const [initialized] = (0, APIClient_1.initializeModel)(client, name, [flattenedResult], modelIntrospection, auth.authMode, auth.authToken); | ||
return initialized; | ||
} | ||
})); | ||
@@ -29,0 +37,0 @@ }; |
{ | ||
"name": "@aws-amplify/data-schema", | ||
"version": "0.0.0-asynclambda-20240911175119", | ||
"version": "0.0.0-asynclambda-20240912010846", | ||
"license": "Apache-2.0", | ||
@@ -5,0 +5,0 @@ "repository": { |
@@ -20,2 +20,3 @@ // Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. | ||
initializeModel, | ||
flattenItems, | ||
} from '../APIClient'; | ||
@@ -63,14 +64,21 @@ | ||
const [key] = Object.keys(value.data); | ||
// Will need flattening here if/when custom selection set support is added: | ||
const data = (value.data as any)[key]; | ||
const [initialized] = initializeModel( | ||
client, | ||
name, | ||
[data], | ||
modelIntrospection, | ||
auth.authMode, | ||
auth.authToken, | ||
); | ||
const flattenedResult = flattenItems(modelIntrospection, name, data); | ||
return initialized; | ||
if (flattenedResult === null) { | ||
return null; | ||
} else if (args?.selectionSet) { | ||
return flattenedResult; | ||
} else { | ||
const [initialized] = initializeModel( | ||
client, | ||
name, | ||
[flattenedResult], | ||
modelIntrospection, | ||
auth.authMode, | ||
auth.authToken, | ||
); | ||
return initialized; | ||
} | ||
}), | ||
@@ -77,0 +85,0 @@ ); |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
2160773
29599