@aws-amplify/api-graphql 4.0.17 → 4.0.18-experimental-lerna-test.d2b0b08.55
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/Providers/AWSAppSyncRealTimeProvider/index.js +40 -31
- package/dist/cjs/Providers/AWSAppSyncRealTimeProvider/index.js.map +1 -1
- package/dist/cjs/internals/APIClient.js +145 -54
- package/dist/cjs/internals/APIClient.js.map +1 -1
- package/dist/cjs/internals/InternalGraphQLAPI.js +41 -42
- package/dist/cjs/internals/InternalGraphQLAPI.js.map +1 -1
- package/dist/cjs/internals/generateClient.js +15 -5
- package/dist/cjs/internals/generateClient.js.map +1 -1
- package/dist/cjs/internals/generateCustomOperationsProperty.js +50 -0
- package/dist/cjs/internals/generateCustomOperationsProperty.js.map +1 -0
- package/dist/cjs/internals/operations/custom.js +356 -0
- package/dist/cjs/internals/operations/custom.js.map +1 -0
- package/dist/cjs/internals/operations/get.js +1 -1
- package/dist/cjs/internals/operations/get.js.map +1 -1
- package/dist/cjs/internals/operations/indexQuery.js +1 -1
- package/dist/cjs/internals/operations/indexQuery.js.map +1 -1
- package/dist/cjs/internals/operations/list.js +2 -2
- package/dist/cjs/internals/operations/list.js.map +1 -1
- package/dist/cjs/internals/operations/subscription.js +1 -1
- package/dist/cjs/internals/operations/subscription.js.map +1 -1
- package/dist/cjs/internals/server/generateClientWithAmplifyInstance.js +12 -2
- package/dist/cjs/internals/server/generateClientWithAmplifyInstance.js.map +1 -1
- package/dist/cjs/internals/server/generateModelsProperty.js +1 -1
- package/dist/cjs/internals/server/generateModelsProperty.js.map +1 -1
- package/dist/cjs/internals/utils/clientProperties/generateEnumsProperty.js.map +1 -0
- package/dist/cjs/internals/utils/{generateModelsProperty.js → clientProperties/generateModelsProperty.js} +7 -7
- package/dist/cjs/internals/utils/clientProperties/generateModelsProperty.js.map +1 -0
- package/dist/cjs/internals/utils/runtimeTypeGuards/isApiGraphQLProviderConfig.js.map +1 -0
- package/dist/cjs/internals/utils/runtimeTypeGuards/isConfigureEventWithResourceConfig.js.map +1 -0
- package/dist/cjs/internals/utils/runtimeTypeGuards/isGraphQLResponseWithErrors.js +15 -0
- package/dist/cjs/internals/utils/runtimeTypeGuards/isGraphQLResponseWithErrors.js.map +1 -0
- package/dist/cjs/internals/v6.js +0 -2
- package/dist/cjs/internals/v6.js.map +1 -1
- package/dist/cjs/utils/errors/constants.js +47 -0
- package/dist/cjs/utils/errors/constants.js.map +1 -0
- package/dist/cjs/utils/errors/createGraphQLResultWithError.js +15 -0
- package/dist/cjs/utils/errors/createGraphQLResultWithError.js.map +1 -0
- package/dist/cjs/utils/errors/index.js +3 -1
- package/dist/cjs/utils/errors/index.js.map +1 -1
- package/dist/cjs/utils/errors/repackageAuthError.js +7 -7
- package/dist/cjs/utils/errors/repackageAuthError.js.map +1 -1
- package/dist/cjs/utils/resolveOwnerFields.js +6 -0
- package/dist/cjs/utils/resolveOwnerFields.js.map +1 -1
- package/dist/esm/GraphQLAPI.d.ts +2 -2
- package/dist/esm/GraphQLAPI.mjs.map +1 -1
- package/dist/esm/Providers/AWSAppSyncRealTimeProvider/index.d.ts +8 -8
- package/dist/esm/Providers/AWSAppSyncRealTimeProvider/index.mjs +40 -31
- package/dist/esm/Providers/AWSAppSyncRealTimeProvider/index.mjs.map +1 -1
- package/dist/esm/internals/APIClient.d.ts +10 -9
- package/dist/esm/internals/APIClient.mjs +144 -54
- package/dist/esm/internals/APIClient.mjs.map +1 -1
- package/dist/esm/internals/InternalGraphQLAPI.d.ts +1 -1
- package/dist/esm/internals/InternalGraphQLAPI.mjs +45 -44
- package/dist/esm/internals/InternalGraphQLAPI.mjs.map +1 -1
- package/dist/esm/internals/generateClient.mjs +15 -5
- package/dist/esm/internals/generateClient.mjs.map +1 -1
- package/dist/esm/internals/generateCustomOperationsProperty.d.ts +9 -0
- package/dist/esm/internals/generateCustomOperationsProperty.mjs +45 -0
- package/dist/esm/internals/generateCustomOperationsProperty.mjs.map +1 -0
- package/dist/esm/internals/operations/custom.d.ts +63 -0
- package/dist/esm/internals/operations/custom.mjs +354 -0
- package/dist/esm/internals/operations/custom.mjs.map +1 -0
- package/dist/esm/internals/operations/get.d.ts +1 -1
- package/dist/esm/internals/operations/get.mjs +1 -1
- package/dist/esm/internals/operations/get.mjs.map +1 -1
- package/dist/esm/internals/operations/indexQuery.d.ts +3 -3
- package/dist/esm/internals/operations/indexQuery.mjs +1 -1
- package/dist/esm/internals/operations/indexQuery.mjs.map +1 -1
- package/dist/esm/internals/operations/list.d.ts +1 -1
- package/dist/esm/internals/operations/list.mjs +2 -2
- package/dist/esm/internals/operations/list.mjs.map +1 -1
- package/dist/esm/internals/operations/subscription.d.ts +1 -1
- package/dist/esm/internals/operations/subscription.mjs +1 -1
- package/dist/esm/internals/operations/subscription.mjs.map +1 -1
- package/dist/esm/internals/server/generateClientWithAmplifyInstance.d.ts +1 -1
- package/dist/esm/internals/server/generateClientWithAmplifyInstance.mjs +12 -2
- package/dist/esm/internals/server/generateClientWithAmplifyInstance.mjs.map +1 -1
- package/dist/esm/internals/server/generateModelsProperty.d.ts +3 -3
- package/dist/esm/internals/server/generateModelsProperty.mjs +1 -1
- package/dist/esm/internals/server/generateModelsProperty.mjs.map +1 -1
- package/dist/esm/internals/types.d.ts +2 -2
- package/dist/esm/internals/utils/clientProperties/generateEnumsProperty.mjs.map +1 -0
- package/dist/esm/internals/utils/{generateModelsProperty.d.ts → clientProperties/generateModelsProperty.d.ts} +2 -2
- package/dist/esm/internals/utils/{generateModelsProperty.mjs → clientProperties/generateModelsProperty.mjs} +7 -7
- package/dist/esm/internals/utils/clientProperties/generateModelsProperty.mjs.map +1 -0
- package/dist/esm/internals/utils/runtimeTypeGuards/isApiGraphQLProviderConfig.mjs.map +1 -0
- package/dist/esm/internals/utils/runtimeTypeGuards/isConfigureEventWithResourceConfig.mjs.map +1 -0
- package/dist/esm/internals/utils/runtimeTypeGuards/isGraphQLResponseWithErrors.d.ts +2 -0
- package/dist/esm/internals/utils/runtimeTypeGuards/isGraphQLResponseWithErrors.mjs +12 -0
- package/dist/esm/internals/utils/runtimeTypeGuards/isGraphQLResponseWithErrors.mjs.map +1 -0
- package/dist/esm/internals/v6.d.ts +1 -1
- package/dist/esm/internals/v6.mjs +0 -2
- package/dist/esm/internals/v6.mjs.map +1 -1
- package/dist/esm/types/index.d.ts +43 -35
- package/dist/esm/utils/ConnectionStateMonitor.d.ts +2 -2
- package/dist/esm/utils/ConnectionStateMonitor.mjs.map +1 -1
- package/dist/esm/utils/ReachabilityMonitor/index.native.mjs.map +1 -1
- package/dist/esm/utils/errors/constants.d.ts +7 -0
- package/dist/esm/utils/errors/constants.mjs +46 -0
- package/dist/esm/utils/errors/constants.mjs.map +1 -0
- package/dist/esm/utils/errors/createGraphQLResultWithError.d.ts +2 -0
- package/dist/esm/utils/errors/createGraphQLResultWithError.mjs +13 -0
- package/dist/esm/utils/errors/createGraphQLResultWithError.mjs.map +1 -0
- package/dist/esm/utils/errors/index.d.ts +1 -0
- package/dist/esm/utils/errors/index.mjs +1 -0
- package/dist/esm/utils/errors/index.mjs.map +1 -1
- package/dist/esm/utils/errors/repackageAuthError.d.ts +3 -7
- package/dist/esm/utils/errors/repackageAuthError.mjs +6 -6
- package/dist/esm/utils/errors/repackageAuthError.mjs.map +1 -1
- package/dist/esm/utils/findIndexByFields.d.ts +1 -1
- package/dist/esm/utils/resolveConfig.mjs +1 -0
- package/dist/esm/utils/resolveConfig.mjs.map +1 -1
- package/dist/esm/utils/resolveOwnerFields.mjs +6 -0
- package/dist/esm/utils/resolveOwnerFields.mjs.map +1 -1
- package/package.json +8 -7
- package/src/GraphQLAPI.ts +4 -3
- package/src/Providers/AWSAppSyncRealTimeProvider/index.ts +84 -64
- package/src/internals/APIClient.ts +242 -104
- package/src/internals/InternalGraphQLAPI.ts +65 -75
- package/src/internals/clientUtils.ts +1 -1
- package/src/internals/generateClient.ts +43 -6
- package/src/internals/generateCustomOperationsProperty.ts +112 -0
- package/src/internals/operations/custom.ts +492 -0
- package/src/internals/operations/get.ts +10 -9
- package/src/internals/operations/indexQuery.ts +13 -12
- package/src/internals/operations/list.ts +11 -15
- package/src/internals/operations/observeQuery.ts +3 -1
- package/src/internals/operations/subscription.ts +14 -10
- package/src/internals/server/generateClientWithAmplifyInstance.ts +26 -7
- package/src/internals/server/generateModelsProperty.ts +12 -6
- package/src/internals/types.ts +2 -2
- package/src/internals/utils/{generateEnumsProperty.ts → clientProperties/generateEnumsProperty.ts} +7 -6
- package/src/internals/utils/{generateModelsProperty.ts → clientProperties/generateModelsProperty.ts} +11 -10
- package/src/internals/utils/runtimeTypeGuards/isGraphQLResponseWithErrors.ts +15 -0
- package/src/internals/v6.ts +6 -4
- package/src/server/generateClient.ts +4 -1
- package/src/types/PubSub.ts +1 -0
- package/src/types/index.ts +61 -45
- package/src/utils/ConnectionStateMonitor.ts +8 -3
- package/src/utils/ReachabilityMonitor/index.native.ts +1 -1
- package/src/utils/ReachabilityMonitor/index.ts +1 -0
- package/src/utils/ReconnectionMonitor.ts +1 -0
- package/src/utils/errors/constants.ts +56 -0
- package/src/utils/errors/createGraphQLResultWithError.ts +15 -0
- package/src/utils/errors/index.ts +1 -0
- package/src/utils/errors/repackageAuthError.ts +11 -14
- package/src/utils/findIndexByFields.ts +1 -1
- package/src/utils/resolveConfig.ts +1 -0
- package/src/utils/resolveLibraryOptions.ts +1 -0
- package/src/utils/resolveOwnerFields.ts +19 -7
- package/src/utils/resolvePKFields.ts +1 -0
- package/dist/cjs/internals/utils/generateEnumsProperty.js.map +0 -1
- package/dist/cjs/internals/utils/generateModelsProperty.js.map +0 -1
- package/dist/cjs/internals/utils/isApiGraphQLProviderConfig.js.map +0 -1
- package/dist/cjs/internals/utils/isConfigureEventWithResourceConfig.js.map +0 -1
- package/dist/esm/internals/utils/generateEnumsProperty.mjs.map +0 -1
- package/dist/esm/internals/utils/generateModelsProperty.mjs.map +0 -1
- package/dist/esm/internals/utils/isApiGraphQLProviderConfig.mjs.map +0 -1
- package/dist/esm/internals/utils/isConfigureEventWithResourceConfig.mjs.map +0 -1
- /package/dist/cjs/internals/utils/{generateEnumsProperty.js → clientProperties/generateEnumsProperty.js} +0 -0
- /package/dist/cjs/internals/utils/{isApiGraphQLProviderConfig.js → runtimeTypeGuards/isApiGraphQLProviderConfig.js} +0 -0
- /package/dist/cjs/internals/utils/{isConfigureEventWithResourceConfig.js → runtimeTypeGuards/isConfigureEventWithResourceConfig.js} +0 -0
- /package/dist/esm/internals/utils/{generateEnumsProperty.d.ts → clientProperties/generateEnumsProperty.d.ts} +0 -0
- /package/dist/esm/internals/utils/{generateEnumsProperty.mjs → clientProperties/generateEnumsProperty.mjs} +0 -0
- /package/dist/esm/internals/utils/{isApiGraphQLProviderConfig.d.ts → runtimeTypeGuards/isApiGraphQLProviderConfig.d.ts} +0 -0
- /package/dist/esm/internals/utils/{isApiGraphQLProviderConfig.mjs → runtimeTypeGuards/isApiGraphQLProviderConfig.mjs} +0 -0
- /package/dist/esm/internals/utils/{isConfigureEventWithResourceConfig.d.ts → runtimeTypeGuards/isConfigureEventWithResourceConfig.d.ts} +0 -0
- /package/dist/esm/internals/utils/{isConfigureEventWithResourceConfig.mjs → runtimeTypeGuards/isConfigureEventWithResourceConfig.mjs} +0 -0
- /package/src/internals/utils/{isApiGraphQLProviderConfig.ts → runtimeTypeGuards/isApiGraphQLProviderConfig.ts} +0 -0
- /package/src/internals/utils/{isConfigureEventWithResourceConfig.ts → runtimeTypeGuards/isConfigureEventWithResourceConfig.ts} +0 -0
|
@@ -1,11 +1,9 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
3
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
4
|
-
exports.getCustomHeaders = exports.authModeParams = exports.normalizeMutationInput = exports.buildGraphQLVariables = exports.generateGraphQLDocument = exports.generateSelectionSet = exports.selectionSetIRToString = exports.customSelectionSetToIR = exports.graphQLOperationsInfo = exports.initializeModel = exports.flattenItems = void 0;
|
|
5
|
-
// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
|
|
6
|
-
// SPDX-License-Identifier: Apache-2.0
|
|
7
|
-
const resolveOwnerFields_1 = require("../utils/resolveOwnerFields");
|
|
4
|
+
exports.getCustomHeaders = exports.authModeParams = exports.normalizeMutationInput = exports.buildGraphQLVariables = exports.generateGraphQLDocument = exports.generateSelectionSet = exports.selectionSetIRToString = exports.customSelectionSetToIR = exports.defaultSelectionSetForNonModelWithIR = exports.graphQLOperationsInfo = exports.initializeModel = exports.flattenItems = void 0;
|
|
8
5
|
const types_1 = require("../types");
|
|
6
|
+
const resolveOwnerFields_1 = require("../utils/resolveOwnerFields");
|
|
9
7
|
const connectionType = {
|
|
10
8
|
HAS_ONE: 'HAS_ONE',
|
|
11
9
|
HAS_MANY: 'HAS_MANY',
|
|
@@ -54,14 +52,17 @@ function initializeModel(client, modelName, result, modelIntrospection, authMode
|
|
|
54
52
|
'associatedWith' in modelField.association) {
|
|
55
53
|
connectionFields = modelField.association.associatedWith;
|
|
56
54
|
}
|
|
57
|
-
|
|
55
|
+
const targetNames = [];
|
|
58
56
|
if (modelField.association && 'targetNames' in modelField.association) {
|
|
59
|
-
targetNames
|
|
57
|
+
targetNames.push(...modelField.association.targetNames);
|
|
60
58
|
}
|
|
61
59
|
switch (relationType) {
|
|
62
60
|
case connectionType.HAS_ONE:
|
|
63
|
-
case connectionType.BELONGS_TO:
|
|
64
|
-
const sortKeyValues = relatedModelSKFieldNames.reduce(
|
|
61
|
+
case connectionType.BELONGS_TO: {
|
|
62
|
+
const sortKeyValues = relatedModelSKFieldNames.reduce(
|
|
63
|
+
// TODO(Eslint): is this implementation correct?
|
|
64
|
+
// eslint-disable-next-line array-callback-return
|
|
65
|
+
(acc, curVal) => {
|
|
65
66
|
if (record[curVal]) {
|
|
66
67
|
return (acc[curVal] = record[curVal]);
|
|
67
68
|
}
|
|
@@ -95,7 +96,8 @@ function initializeModel(client, modelName, result, modelIntrospection, authMode
|
|
|
95
96
|
};
|
|
96
97
|
}
|
|
97
98
|
break;
|
|
98
|
-
|
|
99
|
+
}
|
|
100
|
+
case connectionType.HAS_MANY: {
|
|
99
101
|
const parentPk = introModel.primaryKeyInfo.primaryKeyFieldName;
|
|
100
102
|
const parentSK = introModel.primaryKeyInfo.sortKeyFieldNames;
|
|
101
103
|
// M:N check - TODO: refactor
|
|
@@ -178,6 +180,7 @@ function initializeModel(client, modelName, result, modelIntrospection, authMode
|
|
|
178
180
|
};
|
|
179
181
|
}
|
|
180
182
|
break;
|
|
183
|
+
}
|
|
181
184
|
}
|
|
182
185
|
}
|
|
183
186
|
return { ...record, ...initializedRelationalFields };
|
|
@@ -197,15 +200,47 @@ exports.graphQLOperationsInfo = {
|
|
|
197
200
|
OBSERVE_QUERY: { operationPrefix: 'observeQuery', usePlural: false },
|
|
198
201
|
};
|
|
199
202
|
const SELECTION_SET_WILDCARD = '*';
|
|
203
|
+
function defaultSelectionSetForNonModelWithIR(nonModelDefinition, modelIntrospection) {
|
|
204
|
+
const { fields } = nonModelDefinition;
|
|
205
|
+
const mappedFields = Object.values(fields)
|
|
206
|
+
.map(({ type, name }) => {
|
|
207
|
+
if (typeof type.enum === 'string') {
|
|
208
|
+
return [name, FIELD_IR];
|
|
209
|
+
}
|
|
210
|
+
if (typeof type.nonModel === 'string') {
|
|
211
|
+
return [
|
|
212
|
+
name,
|
|
213
|
+
defaultSelectionSetForNonModelWithIR(modelIntrospection.nonModels[type.nonModel], modelIntrospection),
|
|
214
|
+
];
|
|
215
|
+
}
|
|
216
|
+
if (typeof type === 'string') {
|
|
217
|
+
return [name, FIELD_IR];
|
|
218
|
+
}
|
|
219
|
+
return undefined;
|
|
220
|
+
})
|
|
221
|
+
.filter((pair) => pair !== undefined);
|
|
222
|
+
return Object.fromEntries(mappedFields);
|
|
223
|
+
}
|
|
224
|
+
exports.defaultSelectionSetForNonModelWithIR = defaultSelectionSetForNonModelWithIR;
|
|
200
225
|
function defaultSelectionSetForModel(modelDefinition) {
|
|
201
226
|
// fields that are explicitly part of the graphql schema; not
|
|
202
227
|
// inferred from owner auth rules.
|
|
203
228
|
const { fields } = modelDefinition;
|
|
204
229
|
const explicitFields = Object.values(fields)
|
|
205
230
|
// Default selection set omits model fields
|
|
206
|
-
.map(({ type, name }) =>
|
|
207
|
-
(typeof type === '
|
|
208
|
-
|
|
231
|
+
.map(({ type, name }) => {
|
|
232
|
+
if (typeof type === 'string')
|
|
233
|
+
return name;
|
|
234
|
+
if (typeof type === 'object') {
|
|
235
|
+
if (typeof type?.enum === 'string') {
|
|
236
|
+
return name;
|
|
237
|
+
}
|
|
238
|
+
else if (typeof type?.nonModel === 'string') {
|
|
239
|
+
return `${name}.${SELECTION_SET_WILDCARD}`;
|
|
240
|
+
}
|
|
241
|
+
}
|
|
242
|
+
return undefined;
|
|
243
|
+
})
|
|
209
244
|
.filter(Boolean);
|
|
210
245
|
// fields used for owner auth rules that may or may not also
|
|
211
246
|
// be explicit on the model.
|
|
@@ -232,52 +267,86 @@ const FIELD_IR = '';
|
|
|
232
267
|
* }
|
|
233
268
|
* ```
|
|
234
269
|
*/
|
|
235
|
-
function customSelectionSetToIR(
|
|
236
|
-
const dotNotationToObject = (path,
|
|
270
|
+
function customSelectionSetToIR(modelIntrospection, modelName, selectionSet) {
|
|
271
|
+
const dotNotationToObject = (path, modelOrNonModelName) => {
|
|
237
272
|
const [fieldName, ...rest] = path.split('.');
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
273
|
+
const nested = rest[0];
|
|
274
|
+
const modelOrNonModelDefinition = modelIntrospection.models[modelOrNonModelName] ??
|
|
275
|
+
modelIntrospection.nonModels[modelOrNonModelName];
|
|
276
|
+
const modelOrNonModelFields = modelOrNonModelDefinition?.fields;
|
|
277
|
+
const relatedModel = modelOrNonModelFields?.[fieldName]?.type?.model;
|
|
278
|
+
const relatedModelDefinition = modelIntrospection.models[relatedModel];
|
|
279
|
+
const relatedNonModel = modelOrNonModelFields?.[fieldName]?.type?.nonModel;
|
|
280
|
+
const relatedNonModelDefinition = modelIntrospection.nonModels[relatedNonModel];
|
|
281
|
+
const isModelOrNonModelOrFieldType = relatedModelDefinition
|
|
282
|
+
? 'model'
|
|
283
|
+
: relatedNonModelDefinition
|
|
284
|
+
? 'nonModel'
|
|
285
|
+
: 'field';
|
|
286
|
+
if (isModelOrNonModelOrFieldType === 'nonModel') {
|
|
287
|
+
let result = {};
|
|
288
|
+
if (!nested) {
|
|
289
|
+
throw Error(`${fieldName} must declare a wildcard (*) or a field of custom type ${relatedNonModel}`);
|
|
290
|
+
}
|
|
291
|
+
if (nested === SELECTION_SET_WILDCARD) {
|
|
292
|
+
result = {
|
|
293
|
+
[fieldName]: defaultSelectionSetForNonModelWithIR(relatedNonModelDefinition, modelIntrospection),
|
|
294
|
+
};
|
|
295
|
+
}
|
|
296
|
+
else {
|
|
297
|
+
result = {
|
|
298
|
+
[fieldName]: dotNotationToObject(rest.join('.'), relatedNonModel),
|
|
299
|
+
};
|
|
300
|
+
}
|
|
301
|
+
return result;
|
|
241
302
|
}
|
|
242
|
-
else {
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
const relatedModel = modelFields[fieldName]?.type
|
|
247
|
-
?.model;
|
|
248
|
-
if (!relatedModel) {
|
|
249
|
-
// TODO: may need to change this to support custom types
|
|
250
|
-
throw Error(`${fieldName} is not a model field`);
|
|
303
|
+
else if (isModelOrNonModelOrFieldType === 'model') {
|
|
304
|
+
let result = {};
|
|
305
|
+
if (!nested) {
|
|
306
|
+
throw Error(`${fieldName} must declare a wildcard (*) or a field of model ${relatedModel}`);
|
|
251
307
|
}
|
|
252
308
|
if (nested === SELECTION_SET_WILDCARD) {
|
|
253
|
-
const
|
|
309
|
+
const nestedRelatedModelDefinition = modelIntrospection.models[relatedModel];
|
|
254
310
|
result = {
|
|
255
|
-
[fieldName]:
|
|
311
|
+
[fieldName]: modelsDefaultSelectionSetIR(nestedRelatedModelDefinition),
|
|
256
312
|
};
|
|
257
313
|
}
|
|
258
314
|
else {
|
|
259
|
-
const exists = Boolean(modelFields[fieldName]);
|
|
260
|
-
if (!exists) {
|
|
261
|
-
throw Error(`${fieldName} is not a field of model ${modelName}`);
|
|
262
|
-
}
|
|
263
315
|
result = {
|
|
264
316
|
[fieldName]: dotNotationToObject(rest.join('.'), relatedModel),
|
|
265
317
|
};
|
|
266
318
|
}
|
|
267
|
-
if (
|
|
319
|
+
if (modelOrNonModelFields[fieldName]?.isArray) {
|
|
268
320
|
result = {
|
|
269
321
|
[fieldName]: {
|
|
270
322
|
items: result[fieldName],
|
|
271
323
|
},
|
|
272
324
|
};
|
|
273
325
|
}
|
|
326
|
+
return result;
|
|
327
|
+
}
|
|
328
|
+
else {
|
|
329
|
+
const modelField = modelOrNonModelFields?.[fieldName];
|
|
330
|
+
const nonModelDefinition = modelIntrospection.nonModels[modelOrNonModelName];
|
|
331
|
+
const nonModelField = nonModelDefinition?.fields?.[fieldName];
|
|
332
|
+
if (!nonModelDefinition) {
|
|
333
|
+
const isOwnerField = (0, resolveOwnerFields_1.resolveOwnerFields)(modelOrNonModelDefinition).includes(fieldName);
|
|
334
|
+
if (!modelField && !isOwnerField) {
|
|
335
|
+
throw Error(`${fieldName} is not a field of model ${modelOrNonModelName}`);
|
|
336
|
+
}
|
|
337
|
+
}
|
|
338
|
+
else {
|
|
339
|
+
if (!nonModelField) {
|
|
340
|
+
throw Error(`${fieldName} is not a field of custom type ${modelOrNonModelName}`);
|
|
341
|
+
}
|
|
342
|
+
}
|
|
343
|
+
return { [fieldName]: FIELD_IR };
|
|
274
344
|
}
|
|
275
|
-
return result;
|
|
276
345
|
};
|
|
277
346
|
return selectionSet.reduce((resultObj, path) => deepMergeSelectionSetObjects(dotNotationToObject(path, modelName), resultObj), {});
|
|
278
347
|
}
|
|
279
348
|
exports.customSelectionSetToIR = customSelectionSetToIR;
|
|
280
|
-
const
|
|
349
|
+
const modelsDefaultSelectionSetIR = (relatedModelDefinition) => {
|
|
281
350
|
const defaultSelectionSet = defaultSelectionSetForModel(relatedModelDefinition);
|
|
282
351
|
const reduced = defaultSelectionSet.reduce((acc, curVal) => {
|
|
283
352
|
acc[curVal] = FIELD_IR;
|
|
@@ -330,9 +399,10 @@ function deepMergeSelectionSetObjects(source, target) {
|
|
|
330
399
|
const isObject = (obj) => obj && typeof obj === 'object';
|
|
331
400
|
for (const key in source) {
|
|
332
401
|
// This verification avoids 'Prototype Pollution' issue
|
|
333
|
-
if (!
|
|
402
|
+
if (!Object.prototype.hasOwnProperty.call(source, key))
|
|
334
403
|
continue;
|
|
335
|
-
if (
|
|
404
|
+
if (Object.prototype.hasOwnProperty.call(target, key) &&
|
|
405
|
+
isObject(target[key])) {
|
|
336
406
|
deepMergeSelectionSetObjects(source[key], target[key]);
|
|
337
407
|
}
|
|
338
408
|
else {
|
|
@@ -341,18 +411,15 @@ function deepMergeSelectionSetObjects(source, target) {
|
|
|
341
411
|
}
|
|
342
412
|
return target;
|
|
343
413
|
}
|
|
344
|
-
function generateSelectionSet(
|
|
345
|
-
const modelDefinition =
|
|
346
|
-
|
|
347
|
-
return defaultSelectionSetForModel(modelDefinition).join(' ');
|
|
348
|
-
}
|
|
349
|
-
const selSetIr = customSelectionSetToIR(modelDefinitions, modelName, selectionSet);
|
|
414
|
+
function generateSelectionSet(modelIntrospection, modelName, selectionSet) {
|
|
415
|
+
const modelDefinition = modelIntrospection.models[modelName];
|
|
416
|
+
const selSetIr = customSelectionSetToIR(modelIntrospection, modelName, selectionSet ?? defaultSelectionSetForModel(modelDefinition));
|
|
350
417
|
const selSetString = selectionSetIRToString(selSetIr);
|
|
351
418
|
return selSetString;
|
|
352
419
|
}
|
|
353
420
|
exports.generateSelectionSet = generateSelectionSet;
|
|
354
|
-
function generateGraphQLDocument(
|
|
355
|
-
const modelDefinition =
|
|
421
|
+
function generateGraphQLDocument(modelIntrospection, modelName, modelOperation, listArgs, indexMeta) {
|
|
422
|
+
const modelDefinition = modelIntrospection.models[modelName];
|
|
356
423
|
const { name, pluralName, fields, primaryKeyInfo: { isCustomPrimaryKey, primaryKeyFieldName, sortKeyFieldNames, }, } = modelDefinition;
|
|
357
424
|
const { operationPrefix, usePlural } = exports.graphQLOperationsInfo[modelOperation];
|
|
358
425
|
const { selectionSet } = listArgs || {};
|
|
@@ -380,7 +447,7 @@ function generateGraphQLDocument(modelDefinitions, modelName, modelOperation, li
|
|
|
380
447
|
let graphQLOperationType;
|
|
381
448
|
let graphQLSelectionSet;
|
|
382
449
|
let graphQLArguments;
|
|
383
|
-
const selectionSetFields = generateSelectionSet(
|
|
450
|
+
const selectionSetFields = generateSelectionSet(modelIntrospection, modelName, selectionSet);
|
|
384
451
|
switch (modelOperation) {
|
|
385
452
|
case 'CREATE':
|
|
386
453
|
case 'UPDATE':
|
|
@@ -391,6 +458,8 @@ function generateGraphQLDocument(modelDefinitions, modelName, modelOperation, li
|
|
|
391
458
|
operationPrefix.slice(1)}${name}Input!`,
|
|
392
459
|
});
|
|
393
460
|
graphQLOperationType ?? (graphQLOperationType = 'mutation');
|
|
461
|
+
// TODO(Eslint): this this case clause correct without the break statement?
|
|
462
|
+
// eslint-disable-next-line no-fallthrough
|
|
394
463
|
case 'READ':
|
|
395
464
|
graphQLArguments ??
|
|
396
465
|
(graphQLArguments = isCustomPrimaryKey
|
|
@@ -402,27 +471,40 @@ function generateGraphQLDocument(modelDefinitions, modelName, modelOperation, li
|
|
|
402
471
|
[primaryKeyFieldName]: `${fields[primaryKeyFieldName].type}!`,
|
|
403
472
|
});
|
|
404
473
|
graphQLSelectionSet ?? (graphQLSelectionSet = selectionSetFields);
|
|
474
|
+
// TODO(Eslint): this this case clause correct without the break statement?
|
|
475
|
+
// eslint-disable-next-line no-fallthrough
|
|
405
476
|
case 'LIST':
|
|
406
477
|
graphQLArguments ??
|
|
407
478
|
(graphQLArguments = {
|
|
408
479
|
filter: `Model${name}FilterInput`,
|
|
480
|
+
...(sortKeyFieldNames.length > 0
|
|
481
|
+
? [primaryKeyFieldName, ...sortKeyFieldNames].reduce((acc, fieldName) => {
|
|
482
|
+
acc[fieldName] = `${fields[fieldName].type}`;
|
|
483
|
+
return acc;
|
|
484
|
+
}, { sortDirection: 'ModelSortDirection' })
|
|
485
|
+
: []),
|
|
409
486
|
limit: 'Int',
|
|
410
487
|
nextToken: 'String',
|
|
411
488
|
});
|
|
412
489
|
graphQLOperationType ?? (graphQLOperationType = 'query');
|
|
413
490
|
graphQLSelectionSet ??
|
|
414
491
|
(graphQLSelectionSet = `items { ${selectionSetFields} } nextToken __typename`);
|
|
492
|
+
// TODO(Eslint): this this case clause correct without the break statement?
|
|
493
|
+
// eslint-disable-next-line no-fallthrough
|
|
415
494
|
case 'INDEX_QUERY':
|
|
416
495
|
graphQLArguments ??
|
|
417
496
|
(graphQLArguments = {
|
|
418
497
|
...indexQueryArgs,
|
|
419
498
|
filter: `Model${name}FilterInput`,
|
|
499
|
+
sortDirection: 'ModelSortDirection',
|
|
420
500
|
limit: 'Int',
|
|
421
501
|
nextToken: 'String',
|
|
422
502
|
});
|
|
423
503
|
graphQLOperationType ?? (graphQLOperationType = 'query');
|
|
424
504
|
graphQLSelectionSet ??
|
|
425
505
|
(graphQLSelectionSet = `items { ${selectionSetFields} } nextToken __typename`);
|
|
506
|
+
// TODO(Eslint): this this case clause correct without the break statement?
|
|
507
|
+
// eslint-disable-next-line no-fallthrough
|
|
426
508
|
case 'ONCREATE':
|
|
427
509
|
case 'ONUPDATE':
|
|
428
510
|
case 'ONDELETE':
|
|
@@ -438,9 +520,9 @@ function generateGraphQLDocument(modelDefinitions, modelName, modelOperation, li
|
|
|
438
520
|
throw new Error('Internal error: Attempted to generate graphql document for observeQuery. Please report this error.');
|
|
439
521
|
}
|
|
440
522
|
const graphQLDocument = `${graphQLOperationType}${graphQLArguments
|
|
441
|
-
? `(${Object.entries(graphQLArguments).map(([fieldName, type]) =>
|
|
523
|
+
? `(${Object.entries(graphQLArguments).map(([fieldName, type]) => `$${fieldName}: ${type}`)})`
|
|
442
524
|
: ''} { ${graphQLFieldName}${graphQLArguments
|
|
443
|
-
? `(${Object.keys(graphQLArguments).map(fieldName => `${fieldName}:
|
|
525
|
+
? `(${Object.keys(graphQLArguments).map(fieldName => `${fieldName}: $${fieldName}`)})`
|
|
444
526
|
: ''} { ${graphQLSelectionSet} } }`;
|
|
445
527
|
return graphQLDocument;
|
|
446
528
|
}
|
|
@@ -487,6 +569,10 @@ function buildGraphQLVariables(modelDefinition, operation, arg, modelIntrospecti
|
|
|
487
569
|
if (arg?.filter) {
|
|
488
570
|
variables.filter = arg.filter;
|
|
489
571
|
}
|
|
572
|
+
if (arg?.sortDirection) {
|
|
573
|
+
variables.sortDirection = arg.sortDirection;
|
|
574
|
+
variables[primaryKeyFieldName] = arg[primaryKeyFieldName];
|
|
575
|
+
}
|
|
490
576
|
if (arg?.nextToken) {
|
|
491
577
|
variables.nextToken = arg.nextToken;
|
|
492
578
|
}
|
|
@@ -494,7 +580,7 @@ function buildGraphQLVariables(modelDefinition, operation, arg, modelIntrospecti
|
|
|
494
580
|
variables.limit = arg.limit;
|
|
495
581
|
}
|
|
496
582
|
break;
|
|
497
|
-
case 'INDEX_QUERY':
|
|
583
|
+
case 'INDEX_QUERY': {
|
|
498
584
|
const { pk, sk = [] } = indexMeta;
|
|
499
585
|
variables[pk] = arg[pk];
|
|
500
586
|
for (const skField of sk) {
|
|
@@ -503,6 +589,9 @@ function buildGraphQLVariables(modelDefinition, operation, arg, modelIntrospecti
|
|
|
503
589
|
if (arg?.filter) {
|
|
504
590
|
variables.filter = arg.filter;
|
|
505
591
|
}
|
|
592
|
+
if (arg?.sortDirection) {
|
|
593
|
+
variables.sortDirection = arg.sortDirection;
|
|
594
|
+
}
|
|
506
595
|
if (arg?.nextToken) {
|
|
507
596
|
variables.nextToken = arg.nextToken;
|
|
508
597
|
}
|
|
@@ -510,6 +599,7 @@ function buildGraphQLVariables(modelDefinition, operation, arg, modelIntrospecti
|
|
|
510
599
|
variables.limit = arg.limit;
|
|
511
600
|
}
|
|
512
601
|
break;
|
|
602
|
+
}
|
|
513
603
|
case 'ONCREATE':
|
|
514
604
|
case 'ONUPDATE':
|
|
515
605
|
case 'ONDELETE':
|
|
@@ -519,9 +609,10 @@ function buildGraphQLVariables(modelDefinition, operation, arg, modelIntrospecti
|
|
|
519
609
|
break;
|
|
520
610
|
case 'OBSERVE_QUERY':
|
|
521
611
|
throw new Error('Internal error: Attempted to build variables for observeQuery. Please report this error.');
|
|
522
|
-
default:
|
|
612
|
+
default: {
|
|
523
613
|
const exhaustiveCheck = operation;
|
|
524
614
|
throw new Error(`Unhandled operation case: ${exhaustiveCheck}`);
|
|
615
|
+
}
|
|
525
616
|
}
|
|
526
617
|
return variables;
|
|
527
618
|
}
|
|
@@ -584,7 +675,7 @@ exports.normalizeMutationInput = normalizeMutationInput;
|
|
|
584
675
|
* as a fallback.
|
|
585
676
|
*
|
|
586
677
|
* @param client Configured client from `generateClient`
|
|
587
|
-
* @param options Args/Options
|
|
678
|
+
* @param options Args/Options object from call site.
|
|
588
679
|
* @returns
|
|
589
680
|
*/
|
|
590
681
|
function authModeParams(client, options = {}) {
|
|
@@ -596,9 +687,9 @@ function authModeParams(client, options = {}) {
|
|
|
596
687
|
exports.authModeParams = authModeParams;
|
|
597
688
|
/**
|
|
598
689
|
* Retrieves custom headers from either the client or request options.
|
|
599
|
-
* @param
|
|
600
|
-
* @param
|
|
601
|
-
* @returns {CustomHeaders}
|
|
690
|
+
* @param client V6Client | V6ClientSSRRequest | V6ClientSSRCookies - for extracting client headers
|
|
691
|
+
* @param requestHeaders {@link CustomHeaders} - request headers
|
|
692
|
+
* @returns custom headers as {@link CustomHeaders}
|
|
602
693
|
*/
|
|
603
694
|
function getCustomHeaders(client, requestHeaders) {
|
|
604
695
|
let headers = client[types_1.__headers] || {};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"APIClient.js","sources":["../../../src/internals/APIClient.ts"],"sourcesContent":["\"use strict\";\nObject.defineProperty(exports, \"__esModule\", { value: true });\nexports.getCustomHeaders = exports.authModeParams = exports.normalizeMutationInput = exports.buildGraphQLVariables = exports.generateGraphQLDocument = exports.generateSelectionSet = exports.selectionSetIRToString = exports.customSelectionSetToIR = exports.graphQLOperationsInfo = exports.initializeModel = exports.flattenItems = void 0;\n// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\nconst resolveOwnerFields_1 = require(\"../utils/resolveOwnerFields\");\nconst types_1 = require(\"../types\");\nconst connectionType = {\n HAS_ONE: 'HAS_ONE',\n HAS_MANY: 'HAS_MANY',\n BELONGS_TO: 'BELONGS_TO',\n};\n/**\n *\n * @param GraphQL response object\n * @returns response object with `items` properties flattened\n */\nconst flattenItems = (obj) => {\n const res = {};\n Object.entries(obj).forEach(([prop, value]) => {\n if (typeof value === 'object' && !Array.isArray(value) && value !== null) {\n if (value.items !== undefined) {\n res[prop] = value.items.map((item) => (0, exports.flattenItems)(item));\n return;\n }\n res[prop] = (0, exports.flattenItems)(value);\n return;\n }\n res[prop] = value;\n });\n return res;\n};\nexports.flattenItems = flattenItems;\n// TODO: this should accept single result to support CRUD methods; create helper for array/list\nfunction initializeModel(client, modelName, result, modelIntrospection, authMode, authToken, context = false) {\n const introModel = modelIntrospection.models[modelName];\n const introModelFields = introModel.fields;\n const modelFields = Object.entries(introModelFields)\n .filter(([_, field]) => field?.type?.model !== undefined)\n .map(([fieldName]) => fieldName);\n return result.map(record => {\n const initializedRelationalFields = {};\n for (const fieldName of modelFields) {\n const modelField = introModelFields[fieldName];\n const modelFieldType = modelField?.type;\n const relatedModelName = modelFieldType.model;\n const relatedModel = modelIntrospection.models[relatedModelName];\n const relatedModelPKFieldName = relatedModel.primaryKeyInfo.primaryKeyFieldName;\n const relatedModelSKFieldNames = relatedModel.primaryKeyInfo.sortKeyFieldNames;\n const relationType = modelField.association?.connectionType;\n let connectionFields = [];\n if (modelField.association &&\n 'associatedWith' in modelField.association) {\n connectionFields = modelField.association.associatedWith;\n }\n let targetNames = [];\n if (modelField.association && 'targetNames' in modelField.association) {\n targetNames = modelField.association.targetNames;\n }\n switch (relationType) {\n case connectionType.HAS_ONE:\n case connectionType.BELONGS_TO:\n const sortKeyValues = relatedModelSKFieldNames.reduce((acc, curVal) => {\n if (record[curVal]) {\n return (acc[curVal] = record[curVal]);\n }\n }, {});\n if (context) {\n initializedRelationalFields[fieldName] = (contextSpec, options) => {\n if (record[targetNames[0]]) {\n return client.models[relatedModelName].get(contextSpec, {\n [relatedModelPKFieldName]: record[targetNames[0]],\n ...sortKeyValues,\n }, {\n authMode: options?.authMode || authMode,\n authToken: options?.authToken || authToken,\n });\n }\n return undefined;\n };\n }\n else {\n initializedRelationalFields[fieldName] = (options) => {\n if (record[targetNames[0]]) {\n return client.models[relatedModelName].get({\n [relatedModelPKFieldName]: record[targetNames[0]],\n ...sortKeyValues,\n }, {\n authMode: options?.authMode || authMode,\n authToken: options?.authToken || authToken,\n });\n }\n return undefined;\n };\n }\n break;\n case connectionType.HAS_MANY:\n const parentPk = introModel.primaryKeyInfo.primaryKeyFieldName;\n const parentSK = introModel.primaryKeyInfo.sortKeyFieldNames;\n // M:N check - TODO: refactor\n const relatedModelField = relatedModel.fields[connectionFields[0]];\n const relatedModelFieldType = relatedModelField.type;\n if (relatedModelFieldType.model) {\n let relatedTargetNames = [];\n if (relatedModelField.association &&\n 'targetNames' in relatedModelField.association) {\n relatedTargetNames = relatedModelField.association?.targetNames;\n }\n const hasManyFilter = relatedTargetNames.map((field, idx) => {\n if (idx === 0) {\n return { [field]: { eq: record[parentPk] } };\n }\n return { [field]: { eq: record[parentSK[idx - 1]] } };\n });\n if (context) {\n initializedRelationalFields[fieldName] = (contextSpec, options) => {\n if (record[parentPk]) {\n return client.models[relatedModelName].list(contextSpec, {\n filter: { and: hasManyFilter },\n limit: options?.limit,\n nextToken: options?.nextToken,\n authMode: options?.authMode || authMode,\n authToken: options?.authToken || authToken,\n });\n }\n return [];\n };\n }\n else {\n initializedRelationalFields[fieldName] = (options) => {\n if (record[parentPk]) {\n return client.models[relatedModelName].list({\n filter: { and: hasManyFilter },\n limit: options?.limit,\n nextToken: options?.nextToken,\n authMode: options?.authMode || authMode,\n authToken: options?.authToken || authToken,\n });\n }\n return [];\n };\n }\n break;\n }\n const hasManyFilter = connectionFields.map((field, idx) => {\n if (idx === 0) {\n return { [field]: { eq: record[parentPk] } };\n }\n return { [field]: { eq: record[parentSK[idx - 1]] } };\n });\n if (context) {\n initializedRelationalFields[fieldName] = (contextSpec, options) => {\n if (record[parentPk]) {\n return client.models[relatedModelName].list(contextSpec, {\n filter: { and: hasManyFilter },\n limit: options?.limit,\n nextToken: options?.nextToken,\n authMode: options?.authMode || authMode,\n authToken: options?.authToken || authToken,\n });\n }\n return [];\n };\n }\n else {\n initializedRelationalFields[fieldName] = (options) => {\n if (record[parentPk]) {\n return client.models[relatedModelName].list({\n filter: { and: hasManyFilter },\n limit: options?.limit,\n nextToken: options?.nextToken,\n authMode: options?.authMode || authMode,\n authToken: options?.authToken || authToken,\n });\n }\n return [];\n };\n }\n break;\n default:\n break;\n }\n }\n return { ...record, ...initializedRelationalFields };\n });\n}\nexports.initializeModel = initializeModel;\nexports.graphQLOperationsInfo = {\n CREATE: { operationPrefix: 'create', usePlural: false },\n READ: { operationPrefix: 'get', usePlural: false },\n UPDATE: { operationPrefix: 'update', usePlural: false },\n DELETE: { operationPrefix: 'delete', usePlural: false },\n LIST: { operationPrefix: 'list', usePlural: true },\n INDEX_QUERY: { operationPrefix: '', usePlural: false },\n ONCREATE: { operationPrefix: 'onCreate', usePlural: false },\n ONUPDATE: { operationPrefix: 'onUpdate', usePlural: false },\n ONDELETE: { operationPrefix: 'onDelete', usePlural: false },\n OBSERVE_QUERY: { operationPrefix: 'observeQuery', usePlural: false },\n};\nconst SELECTION_SET_WILDCARD = '*';\nfunction defaultSelectionSetForModel(modelDefinition) {\n // fields that are explicitly part of the graphql schema; not\n // inferred from owner auth rules.\n const { fields } = modelDefinition;\n const explicitFields = Object.values(fields)\n // Default selection set omits model fields\n .map(({ type, name }) => (typeof type === 'string' ||\n (typeof type === 'object' && typeof type?.enum === 'string')) &&\n name)\n .filter(Boolean);\n // fields used for owner auth rules that may or may not also\n // be explicit on the model.\n const ownerFields = (0, resolveOwnerFields_1.resolveOwnerFields)(modelDefinition);\n return Array.from(new Set(explicitFields.concat(ownerFields)));\n}\nconst FIELD_IR = '';\n/**\n * Generates nested Custom Selection Set IR from path\n *\n * @param modelDefinitions\n * @param modelName\n * @param selectionSet - array of object paths\n * @example\n * ### Given\n * `selectionSet = ['id', 'comments.post.id']`\n * ### Returns\n * ```ts\n * {\n * id: '',\n * comments: {\n * items: { post: { id: '' } }\n * }\n * }\n * ```\n */\nfunction customSelectionSetToIR(modelDefinitions, modelName, selectionSet) {\n const dotNotationToObject = (path, modelName) => {\n const [fieldName, ...rest] = path.split('.');\n let result = {};\n if (rest.length === 0) {\n result = { [fieldName]: FIELD_IR };\n }\n else {\n const nested = rest[0];\n const modelDefinition = modelDefinitions[modelName];\n const modelFields = modelDefinition.fields;\n const relatedModel = modelFields[fieldName]?.type\n ?.model;\n if (!relatedModel) {\n // TODO: may need to change this to support custom types\n throw Error(`${fieldName} is not a model field`);\n }\n if (nested === SELECTION_SET_WILDCARD) {\n const relatedModelDefinition = modelDefinitions[relatedModel];\n result = {\n [fieldName]: defaultSelectionSetIR(relatedModelDefinition),\n };\n }\n else {\n const exists = Boolean(modelFields[fieldName]);\n if (!exists) {\n throw Error(`${fieldName} is not a field of model ${modelName}`);\n }\n result = {\n [fieldName]: dotNotationToObject(rest.join('.'), relatedModel),\n };\n }\n if (modelFields[fieldName]?.isArray) {\n result = {\n [fieldName]: {\n items: result[fieldName],\n },\n };\n }\n }\n return result;\n };\n return selectionSet.reduce((resultObj, path) => deepMergeSelectionSetObjects(dotNotationToObject(path, modelName), resultObj), {});\n}\nexports.customSelectionSetToIR = customSelectionSetToIR;\nconst defaultSelectionSetIR = (relatedModelDefinition) => {\n const defaultSelectionSet = defaultSelectionSetForModel(relatedModelDefinition);\n const reduced = defaultSelectionSet.reduce((acc, curVal) => {\n acc[curVal] = FIELD_IR;\n return acc;\n }, {});\n return reduced;\n};\n/**\n * Stringifies selection set IR\n * * @example\n * ### Given\n * ```ts\n * {\n * id: '',\n * comments: {\n * items: { post: { id: '' } }\n * }\n * }\n * ```\n * ### Returns\n * `'id comments { items { post { id } } }'`\n */\nfunction selectionSetIRToString(obj) {\n const res = [];\n Object.entries(obj).forEach(([fieldName, value]) => {\n if (value === FIELD_IR) {\n res.push(fieldName);\n }\n else if (typeof value === 'object' && value !== null) {\n if (value?.items) {\n res.push(fieldName, '{', 'items', '{', selectionSetIRToString(value.items), '}', '}');\n }\n else {\n res.push(fieldName, '{', selectionSetIRToString(value), '}');\n }\n }\n });\n return res.join(' ');\n}\nexports.selectionSetIRToString = selectionSetIRToString;\n/**\n * Recursively merges selection set objects from `source` onto `target`.\n *\n * `target` will be updated. `source` will be left alone.\n *\n * @param source The object to merge into target.\n * @param target The object to be mutated.\n */\nfunction deepMergeSelectionSetObjects(source, target) {\n const isObject = (obj) => obj && typeof obj === 'object';\n for (const key in source) {\n // This verification avoids 'Prototype Pollution' issue\n if (!source.hasOwnProperty(key))\n continue;\n if (target.hasOwnProperty(key) && isObject(target[key])) {\n deepMergeSelectionSetObjects(source[key], target[key]);\n }\n else {\n target[key] = source[key];\n }\n }\n return target;\n}\nfunction generateSelectionSet(modelDefinitions, modelName, selectionSet) {\n const modelDefinition = modelDefinitions[modelName];\n if (!selectionSet) {\n return defaultSelectionSetForModel(modelDefinition).join(' ');\n }\n const selSetIr = customSelectionSetToIR(modelDefinitions, modelName, selectionSet);\n const selSetString = selectionSetIRToString(selSetIr);\n return selSetString;\n}\nexports.generateSelectionSet = generateSelectionSet;\nfunction generateGraphQLDocument(modelDefinitions, modelName, modelOperation, listArgs, indexMeta) {\n const modelDefinition = modelDefinitions[modelName];\n const { name, pluralName, fields, primaryKeyInfo: { isCustomPrimaryKey, primaryKeyFieldName, sortKeyFieldNames, }, } = modelDefinition;\n const { operationPrefix, usePlural } = exports.graphQLOperationsInfo[modelOperation];\n const { selectionSet } = listArgs || {};\n let graphQLFieldName;\n let indexQueryArgs;\n if (operationPrefix) {\n graphQLFieldName = `${operationPrefix}${usePlural ? pluralName : name}`;\n }\n else if (indexMeta) {\n const { queryField, pk, sk = [] } = indexMeta;\n graphQLFieldName = queryField;\n const skQueryArgs = sk.reduce((acc, fieldName) => {\n const fieldType = fields[fieldName].type;\n acc[fieldName] = `Model${fieldType}KeyConditionInput`;\n return acc;\n }, {});\n indexQueryArgs = {\n [pk]: `${fields[pk].type}!`,\n ...skQueryArgs,\n };\n }\n else {\n throw new Error('Error generating GraphQL Document - invalid operation name');\n }\n let graphQLOperationType;\n let graphQLSelectionSet;\n let graphQLArguments;\n const selectionSetFields = generateSelectionSet(modelDefinitions, modelName, selectionSet);\n switch (modelOperation) {\n case 'CREATE':\n case 'UPDATE':\n case 'DELETE':\n graphQLArguments ??\n (graphQLArguments = {\n input: `${operationPrefix.charAt(0).toLocaleUpperCase() +\n operationPrefix.slice(1)}${name}Input!`,\n });\n graphQLOperationType ?? (graphQLOperationType = 'mutation');\n case 'READ':\n graphQLArguments ??\n (graphQLArguments = isCustomPrimaryKey\n ? [primaryKeyFieldName, ...sortKeyFieldNames].reduce((acc, fieldName) => {\n acc[fieldName] = `${fields[fieldName].type}!`;\n return acc;\n }, {})\n : {\n [primaryKeyFieldName]: `${fields[primaryKeyFieldName].type}!`,\n });\n graphQLSelectionSet ?? (graphQLSelectionSet = selectionSetFields);\n case 'LIST':\n graphQLArguments ??\n (graphQLArguments = {\n filter: `Model${name}FilterInput`,\n limit: 'Int',\n nextToken: 'String',\n });\n graphQLOperationType ?? (graphQLOperationType = 'query');\n graphQLSelectionSet ??\n (graphQLSelectionSet = `items { ${selectionSetFields} } nextToken __typename`);\n case 'INDEX_QUERY':\n graphQLArguments ??\n (graphQLArguments = {\n ...indexQueryArgs,\n filter: `Model${name}FilterInput`,\n limit: 'Int',\n nextToken: 'String',\n });\n graphQLOperationType ?? (graphQLOperationType = 'query');\n graphQLSelectionSet ??\n (graphQLSelectionSet = `items { ${selectionSetFields} } nextToken __typename`);\n case 'ONCREATE':\n case 'ONUPDATE':\n case 'ONDELETE':\n graphQLArguments ??\n (graphQLArguments = {\n filter: `ModelSubscription${name}FilterInput`,\n });\n graphQLOperationType ?? (graphQLOperationType = 'subscription');\n graphQLSelectionSet ?? (graphQLSelectionSet = selectionSetFields);\n break;\n case 'OBSERVE_QUERY':\n default:\n throw new Error('Internal error: Attempted to generate graphql document for observeQuery. Please report this error.');\n }\n const graphQLDocument = `${graphQLOperationType}${graphQLArguments\n ? `(${Object.entries(graphQLArguments).map(([fieldName, type]) => `\\$${fieldName}: ${type}`)})`\n : ''} { ${graphQLFieldName}${graphQLArguments\n ? `(${Object.keys(graphQLArguments).map(fieldName => `${fieldName}: \\$${fieldName}`)})`\n : ''} { ${graphQLSelectionSet} } }`;\n return graphQLDocument;\n}\nexports.generateGraphQLDocument = generateGraphQLDocument;\nfunction buildGraphQLVariables(modelDefinition, operation, arg, modelIntrospection, indexMeta) {\n const { fields, primaryKeyInfo: { isCustomPrimaryKey, primaryKeyFieldName, sortKeyFieldNames, }, } = modelDefinition;\n let variables = {};\n // TODO: process input\n switch (operation) {\n case 'CREATE':\n variables = {\n input: arg\n ? normalizeMutationInput(arg, modelDefinition, modelIntrospection)\n : {},\n };\n break;\n case 'UPDATE':\n // readonly fields are not updated\n variables = {\n input: arg\n ? Object.fromEntries(Object.entries(normalizeMutationInput(arg, modelDefinition, modelIntrospection)).filter(([fieldName]) => {\n const { isReadOnly } = fields[fieldName];\n return !isReadOnly;\n }))\n : {},\n };\n break;\n case 'READ':\n case 'DELETE':\n // only identifiers are sent\n if (arg) {\n variables = isCustomPrimaryKey\n ? [primaryKeyFieldName, ...sortKeyFieldNames].reduce((acc, fieldName) => {\n acc[fieldName] = arg[fieldName];\n return acc;\n }, {})\n : { [primaryKeyFieldName]: arg[primaryKeyFieldName] };\n }\n if (operation === 'DELETE') {\n variables = { input: variables };\n }\n break;\n case 'LIST':\n if (arg?.filter) {\n variables.filter = arg.filter;\n }\n if (arg?.nextToken) {\n variables.nextToken = arg.nextToken;\n }\n if (arg?.limit) {\n variables.limit = arg.limit;\n }\n break;\n case 'INDEX_QUERY':\n const { pk, sk = [] } = indexMeta;\n variables[pk] = arg[pk];\n for (const skField of sk) {\n variables[skField] = arg[skField];\n }\n if (arg?.filter) {\n variables.filter = arg.filter;\n }\n if (arg?.nextToken) {\n variables.nextToken = arg.nextToken;\n }\n if (arg?.limit) {\n variables.limit = arg.limit;\n }\n break;\n case 'ONCREATE':\n case 'ONUPDATE':\n case 'ONDELETE':\n if (arg?.filter) {\n variables = { filter: arg.filter };\n }\n break;\n case 'OBSERVE_QUERY':\n throw new Error('Internal error: Attempted to build variables for observeQuery. Please report this error.');\n break;\n default:\n const exhaustiveCheck = operation;\n throw new Error(`Unhandled operation case: ${exhaustiveCheck}`);\n }\n return variables;\n}\nexports.buildGraphQLVariables = buildGraphQLVariables;\n/**\n * Iterates over mutation input values and resolves any model inputs to their corresponding join fields/values\n *\n * @example\n * ### Usage\n * ```ts\n * const result = normalizeMutationInput({ post: post }, model, modelDefinition);\n * ```\n * ### Result\n * ```ts\n * { postId: \"abc123\" }\n * ```\n *\n */\nfunction normalizeMutationInput(mutationInput, model, modelIntrospection) {\n const { fields } = model;\n const normalized = {};\n Object.entries(mutationInput).forEach(([inputFieldName, inputValue]) => {\n const fieldType = fields[inputFieldName]?.type;\n const relatedModelName = fieldType?.model;\n if (relatedModelName) {\n const association = fields[inputFieldName]?.association;\n const relatedModelDef = modelIntrospection.models[relatedModelName];\n const relatedModelPkInfo = relatedModelDef.primaryKeyInfo;\n if (association?.connectionType === connectionType.HAS_ONE) {\n const associationHasOne = association;\n associationHasOne.targetNames.forEach((targetName, idx) => {\n const associatedFieldName = associationHasOne.associatedWith[idx];\n normalized[targetName] = inputValue[associatedFieldName];\n });\n }\n if (association?.connectionType === connectionType.BELONGS_TO) {\n const associationBelongsTo = association;\n associationBelongsTo.targetNames.forEach((targetName, idx) => {\n if (idx === 0) {\n const associatedFieldName = relatedModelPkInfo.primaryKeyFieldName;\n normalized[targetName] = inputValue[associatedFieldName];\n }\n else {\n const associatedFieldName = relatedModelPkInfo.sortKeyFieldNames[idx - 1];\n normalized[targetName] = inputValue[associatedFieldName];\n }\n });\n }\n }\n else {\n normalized[inputFieldName] = inputValue;\n }\n });\n return normalized;\n}\nexports.normalizeMutationInput = normalizeMutationInput;\n/**\n * Produces a parameter object that can contains auth mode/token overrides\n * only if present in either `options` (first) or configured on the `client`\n * as a fallback.\n *\n * @param client Configured client from `generateClient`\n * @param options Args/Options obect from call site.\n * @returns\n */\nfunction authModeParams(client, options = {}) {\n return {\n authMode: options.authMode || client[types_1.__authMode],\n authToken: options.authToken || client[types_1.__authToken],\n };\n}\nexports.authModeParams = authModeParams;\n/**\n * Retrieves custom headers from either the client or request options.\n * @param {client} V6Client | V6ClientSSRRequest | V6ClientSSRCookies - for extracting client headers\n * @param {requestHeaders} [CustomHeaders] - request headers\n * @returns {CustomHeaders} - custom headers\n */\nfunction getCustomHeaders(client, requestHeaders) {\n let headers = client[types_1.__headers] || {};\n // Individual request headers will take precedence over client headers.\n // We intentionally do *not* merge client and request headers.\n if (requestHeaders) {\n headers = requestHeaders;\n }\n return headers;\n}\nexports.getCustomHeaders = getCustomHeaders;\n"],"names":[],"mappings":";;AACA,MAAM,CAAC,cAAc,CAAC,OAAO,EAAE,YAAY,EAAE,EAAE,KAAK,EAAE,IAAI,EAAE,CAAC,CAAC;AAC9D,OAAO,CAAC,gBAAgB,GAAG,OAAO,CAAC,cAAc,GAAG,OAAO,CAAC,sBAAsB,GAAG,OAAO,CAAC,qBAAqB,GAAG,OAAO,CAAC,uBAAuB,GAAG,OAAO,CAAC,oBAAoB,GAAG,OAAO,CAAC,sBAAsB,GAAG,OAAO,CAAC,sBAAsB,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CAAC,OAAO,CAAC,WAAW,CAAC;AACnE,KAAK,CAAC;AACN,CAAC;AACD,OAAO,CAAC,cAAc,GAAG,cAAc,CAAC;AACxC;AACA;AACA;AACA;AACA;AACA;AACA,SAAS,gBAAgB,CAAC,MAAM,EAAE,cAAc,EAAE;AAClD,IAAI,IAAI,OAAO,GAAG,MAAM,CAAC,OAAO,CAAC,SAAS,CAAC,IAAI,EAAE,CAAC;AAClD;AACA;AACA,IAAI,IAAI,cAAc,EAAE;AACxB,QAAQ,OAAO,GAAG,cAAc,CAAC;AACjC,KAAK;AACL,IAAI,OAAO,OAAO,CAAC;AACnB,CAAC;AACD,OAAO,CAAC,gBAAgB,GAAG,gBAAgB;;"}
|
|
1
|
+
{"version":3,"file":"APIClient.js","sources":["../../../src/internals/APIClient.ts"],"sourcesContent":["\"use strict\";\nObject.defineProperty(exports, \"__esModule\", { value: true });\nexports.getCustomHeaders = exports.authModeParams = exports.normalizeMutationInput = exports.buildGraphQLVariables = exports.generateGraphQLDocument = exports.generateSelectionSet = exports.selectionSetIRToString = exports.customSelectionSetToIR = exports.defaultSelectionSetForNonModelWithIR = exports.graphQLOperationsInfo = exports.initializeModel = exports.flattenItems = void 0;\nconst types_1 = require(\"../types\");\nconst resolveOwnerFields_1 = require(\"../utils/resolveOwnerFields\");\nconst connectionType = {\n HAS_ONE: 'HAS_ONE',\n HAS_MANY: 'HAS_MANY',\n BELONGS_TO: 'BELONGS_TO',\n};\n/**\n *\n * @param GraphQL response object\n * @returns response object with `items` properties flattened\n */\nconst flattenItems = (obj) => {\n const res = {};\n Object.entries(obj).forEach(([prop, value]) => {\n if (typeof value === 'object' && !Array.isArray(value) && value !== null) {\n if (value.items !== undefined) {\n res[prop] = value.items.map((item) => (0, exports.flattenItems)(item));\n return;\n }\n res[prop] = (0, exports.flattenItems)(value);\n return;\n }\n res[prop] = value;\n });\n return res;\n};\nexports.flattenItems = flattenItems;\n// TODO: this should accept single result to support CRUD methods; create helper for array/list\nfunction initializeModel(client, modelName, result, modelIntrospection, authMode, authToken, context = false) {\n const introModel = modelIntrospection.models[modelName];\n const introModelFields = introModel.fields;\n const modelFields = Object.entries(introModelFields)\n .filter(([_, field]) => field?.type?.model !== undefined)\n .map(([fieldName]) => fieldName);\n return result.map(record => {\n const initializedRelationalFields = {};\n for (const fieldName of modelFields) {\n const modelField = introModelFields[fieldName];\n const modelFieldType = modelField?.type;\n const relatedModelName = modelFieldType.model;\n const relatedModel = modelIntrospection.models[relatedModelName];\n const relatedModelPKFieldName = relatedModel.primaryKeyInfo.primaryKeyFieldName;\n const relatedModelSKFieldNames = relatedModel.primaryKeyInfo.sortKeyFieldNames;\n const relationType = modelField.association?.connectionType;\n let connectionFields = [];\n if (modelField.association &&\n 'associatedWith' in modelField.association) {\n connectionFields = modelField.association.associatedWith;\n }\n const targetNames = [];\n if (modelField.association && 'targetNames' in modelField.association) {\n targetNames.push(...modelField.association.targetNames);\n }\n switch (relationType) {\n case connectionType.HAS_ONE:\n case connectionType.BELONGS_TO: {\n const sortKeyValues = relatedModelSKFieldNames.reduce(\n // TODO(Eslint): is this implementation correct?\n // eslint-disable-next-line array-callback-return\n (acc, curVal) => {\n if (record[curVal]) {\n return (acc[curVal] = record[curVal]);\n }\n }, {});\n if (context) {\n initializedRelationalFields[fieldName] = (contextSpec, options) => {\n if (record[targetNames[0]]) {\n return client.models[relatedModelName].get(contextSpec, {\n [relatedModelPKFieldName]: record[targetNames[0]],\n ...sortKeyValues,\n }, {\n authMode: options?.authMode || authMode,\n authToken: options?.authToken || authToken,\n });\n }\n return undefined;\n };\n }\n else {\n initializedRelationalFields[fieldName] = (options) => {\n if (record[targetNames[0]]) {\n return client.models[relatedModelName].get({\n [relatedModelPKFieldName]: record[targetNames[0]],\n ...sortKeyValues,\n }, {\n authMode: options?.authMode || authMode,\n authToken: options?.authToken || authToken,\n });\n }\n return undefined;\n };\n }\n break;\n }\n case connectionType.HAS_MANY: {\n const parentPk = introModel.primaryKeyInfo.primaryKeyFieldName;\n const parentSK = introModel.primaryKeyInfo.sortKeyFieldNames;\n // M:N check - TODO: refactor\n const relatedModelField = relatedModel.fields[connectionFields[0]];\n const relatedModelFieldType = relatedModelField.type;\n if (relatedModelFieldType.model) {\n let relatedTargetNames = [];\n if (relatedModelField.association &&\n 'targetNames' in relatedModelField.association) {\n relatedTargetNames = relatedModelField.association?.targetNames;\n }\n const hasManyFilter = relatedTargetNames.map((field, idx) => {\n if (idx === 0) {\n return { [field]: { eq: record[parentPk] } };\n }\n return { [field]: { eq: record[parentSK[idx - 1]] } };\n });\n if (context) {\n initializedRelationalFields[fieldName] = (contextSpec, options) => {\n if (record[parentPk]) {\n return client.models[relatedModelName].list(contextSpec, {\n filter: { and: hasManyFilter },\n limit: options?.limit,\n nextToken: options?.nextToken,\n authMode: options?.authMode || authMode,\n authToken: options?.authToken || authToken,\n });\n }\n return [];\n };\n }\n else {\n initializedRelationalFields[fieldName] = (options) => {\n if (record[parentPk]) {\n return client.models[relatedModelName].list({\n filter: { and: hasManyFilter },\n limit: options?.limit,\n nextToken: options?.nextToken,\n authMode: options?.authMode || authMode,\n authToken: options?.authToken || authToken,\n });\n }\n return [];\n };\n }\n break;\n }\n const hasManyFilter = connectionFields.map((field, idx) => {\n if (idx === 0) {\n return { [field]: { eq: record[parentPk] } };\n }\n return { [field]: { eq: record[parentSK[idx - 1]] } };\n });\n if (context) {\n initializedRelationalFields[fieldName] = (contextSpec, options) => {\n if (record[parentPk]) {\n return client.models[relatedModelName].list(contextSpec, {\n filter: { and: hasManyFilter },\n limit: options?.limit,\n nextToken: options?.nextToken,\n authMode: options?.authMode || authMode,\n authToken: options?.authToken || authToken,\n });\n }\n return [];\n };\n }\n else {\n initializedRelationalFields[fieldName] = (options) => {\n if (record[parentPk]) {\n return client.models[relatedModelName].list({\n filter: { and: hasManyFilter },\n limit: options?.limit,\n nextToken: options?.nextToken,\n authMode: options?.authMode || authMode,\n authToken: options?.authToken || authToken,\n });\n }\n return [];\n };\n }\n break;\n }\n default:\n break;\n }\n }\n return { ...record, ...initializedRelationalFields };\n });\n}\nexports.initializeModel = initializeModel;\nexports.graphQLOperationsInfo = {\n CREATE: { operationPrefix: 'create', usePlural: false },\n READ: { operationPrefix: 'get', usePlural: false },\n UPDATE: { operationPrefix: 'update', usePlural: false },\n DELETE: { operationPrefix: 'delete', usePlural: false },\n LIST: { operationPrefix: 'list', usePlural: true },\n INDEX_QUERY: { operationPrefix: '', usePlural: false },\n ONCREATE: { operationPrefix: 'onCreate', usePlural: false },\n ONUPDATE: { operationPrefix: 'onUpdate', usePlural: false },\n ONDELETE: { operationPrefix: 'onDelete', usePlural: false },\n OBSERVE_QUERY: { operationPrefix: 'observeQuery', usePlural: false },\n};\nconst SELECTION_SET_WILDCARD = '*';\nfunction defaultSelectionSetForNonModelWithIR(nonModelDefinition, modelIntrospection) {\n const { fields } = nonModelDefinition;\n const mappedFields = Object.values(fields)\n .map(({ type, name }) => {\n if (typeof type.enum === 'string') {\n return [name, FIELD_IR];\n }\n if (typeof type.nonModel === 'string') {\n return [\n name,\n defaultSelectionSetForNonModelWithIR(modelIntrospection.nonModels[type.nonModel], modelIntrospection),\n ];\n }\n if (typeof type === 'string') {\n return [name, FIELD_IR];\n }\n return undefined;\n })\n .filter((pair) => pair !== undefined);\n return Object.fromEntries(mappedFields);\n}\nexports.defaultSelectionSetForNonModelWithIR = defaultSelectionSetForNonModelWithIR;\nfunction defaultSelectionSetForModel(modelDefinition) {\n // fields that are explicitly part of the graphql schema; not\n // inferred from owner auth rules.\n const { fields } = modelDefinition;\n const explicitFields = Object.values(fields)\n // Default selection set omits model fields\n .map(({ type, name }) => {\n if (typeof type === 'string')\n return name;\n if (typeof type === 'object') {\n if (typeof type?.enum === 'string') {\n return name;\n }\n else if (typeof type?.nonModel === 'string') {\n return `${name}.${SELECTION_SET_WILDCARD}`;\n }\n }\n return undefined;\n })\n .filter(Boolean);\n // fields used for owner auth rules that may or may not also\n // be explicit on the model.\n const ownerFields = (0, resolveOwnerFields_1.resolveOwnerFields)(modelDefinition);\n return Array.from(new Set(explicitFields.concat(ownerFields)));\n}\nconst FIELD_IR = '';\n/**\n * Generates nested Custom Selection Set IR from path\n *\n * @param modelDefinitions\n * @param modelName\n * @param selectionSet - array of object paths\n * @example\n * ### Given\n * `selectionSet = ['id', 'comments.post.id']`\n * ### Returns\n * ```ts\n * {\n * id: '',\n * comments: {\n * items: { post: { id: '' } }\n * }\n * }\n * ```\n */\nfunction customSelectionSetToIR(modelIntrospection, modelName, selectionSet) {\n const dotNotationToObject = (path, modelOrNonModelName) => {\n const [fieldName, ...rest] = path.split('.');\n const nested = rest[0];\n const modelOrNonModelDefinition = modelIntrospection.models[modelOrNonModelName] ??\n modelIntrospection.nonModels[modelOrNonModelName];\n const modelOrNonModelFields = modelOrNonModelDefinition?.fields;\n const relatedModel = modelOrNonModelFields?.[fieldName]?.type?.model;\n const relatedModelDefinition = modelIntrospection.models[relatedModel];\n const relatedNonModel = modelOrNonModelFields?.[fieldName]?.type?.nonModel;\n const relatedNonModelDefinition = modelIntrospection.nonModels[relatedNonModel];\n const isModelOrNonModelOrFieldType = relatedModelDefinition\n ? 'model'\n : relatedNonModelDefinition\n ? 'nonModel'\n : 'field';\n if (isModelOrNonModelOrFieldType === 'nonModel') {\n let result = {};\n if (!nested) {\n throw Error(`${fieldName} must declare a wildcard (*) or a field of custom type ${relatedNonModel}`);\n }\n if (nested === SELECTION_SET_WILDCARD) {\n result = {\n [fieldName]: defaultSelectionSetForNonModelWithIR(relatedNonModelDefinition, modelIntrospection),\n };\n }\n else {\n result = {\n [fieldName]: dotNotationToObject(rest.join('.'), relatedNonModel),\n };\n }\n return result;\n }\n else if (isModelOrNonModelOrFieldType === 'model') {\n let result = {};\n if (!nested) {\n throw Error(`${fieldName} must declare a wildcard (*) or a field of model ${relatedModel}`);\n }\n if (nested === SELECTION_SET_WILDCARD) {\n const nestedRelatedModelDefinition = modelIntrospection.models[relatedModel];\n result = {\n [fieldName]: modelsDefaultSelectionSetIR(nestedRelatedModelDefinition),\n };\n }\n else {\n result = {\n [fieldName]: dotNotationToObject(rest.join('.'), relatedModel),\n };\n }\n if (modelOrNonModelFields[fieldName]?.isArray) {\n result = {\n [fieldName]: {\n items: result[fieldName],\n },\n };\n }\n return result;\n }\n else {\n const modelField = modelOrNonModelFields?.[fieldName];\n const nonModelDefinition = modelIntrospection.nonModels[modelOrNonModelName];\n const nonModelField = nonModelDefinition?.fields?.[fieldName];\n if (!nonModelDefinition) {\n const isOwnerField = (0, resolveOwnerFields_1.resolveOwnerFields)(modelOrNonModelDefinition).includes(fieldName);\n if (!modelField && !isOwnerField) {\n throw Error(`${fieldName} is not a field of model ${modelOrNonModelName}`);\n }\n }\n else {\n if (!nonModelField) {\n throw Error(`${fieldName} is not a field of custom type ${modelOrNonModelName}`);\n }\n }\n return { [fieldName]: FIELD_IR };\n }\n };\n return selectionSet.reduce((resultObj, path) => deepMergeSelectionSetObjects(dotNotationToObject(path, modelName), resultObj), {});\n}\nexports.customSelectionSetToIR = customSelectionSetToIR;\nconst modelsDefaultSelectionSetIR = (relatedModelDefinition) => {\n const defaultSelectionSet = defaultSelectionSetForModel(relatedModelDefinition);\n const reduced = defaultSelectionSet.reduce((acc, curVal) => {\n acc[curVal] = FIELD_IR;\n return acc;\n }, {});\n return reduced;\n};\n/**\n * Stringifies selection set IR\n * * @example\n * ### Given\n * ```ts\n * {\n * id: '',\n * comments: {\n * items: { post: { id: '' } }\n * }\n * }\n * ```\n * ### Returns\n * `'id comments { items { post { id } } }'`\n */\nfunction selectionSetIRToString(obj) {\n const res = [];\n Object.entries(obj).forEach(([fieldName, value]) => {\n if (value === FIELD_IR) {\n res.push(fieldName);\n }\n else if (typeof value === 'object' && value !== null) {\n if (value?.items) {\n res.push(fieldName, '{', 'items', '{', selectionSetIRToString(value.items), '}', '}');\n }\n else {\n res.push(fieldName, '{', selectionSetIRToString(value), '}');\n }\n }\n });\n return res.join(' ');\n}\nexports.selectionSetIRToString = selectionSetIRToString;\n/**\n * Recursively merges selection set objects from `source` onto `target`.\n *\n * `target` will be updated. `source` will be left alone.\n *\n * @param source The object to merge into target.\n * @param target The object to be mutated.\n */\nfunction deepMergeSelectionSetObjects(source, target) {\n const isObject = (obj) => obj && typeof obj === 'object';\n for (const key in source) {\n // This verification avoids 'Prototype Pollution' issue\n if (!Object.prototype.hasOwnProperty.call(source, key))\n continue;\n if (Object.prototype.hasOwnProperty.call(target, key) &&\n isObject(target[key])) {\n deepMergeSelectionSetObjects(source[key], target[key]);\n }\n else {\n target[key] = source[key];\n }\n }\n return target;\n}\nfunction generateSelectionSet(modelIntrospection, modelName, selectionSet) {\n const modelDefinition = modelIntrospection.models[modelName];\n const selSetIr = customSelectionSetToIR(modelIntrospection, modelName, selectionSet ?? defaultSelectionSetForModel(modelDefinition));\n const selSetString = selectionSetIRToString(selSetIr);\n return selSetString;\n}\nexports.generateSelectionSet = generateSelectionSet;\nfunction generateGraphQLDocument(modelIntrospection, modelName, modelOperation, listArgs, indexMeta) {\n const modelDefinition = modelIntrospection.models[modelName];\n const { name, pluralName, fields, primaryKeyInfo: { isCustomPrimaryKey, primaryKeyFieldName, sortKeyFieldNames, }, } = modelDefinition;\n const { operationPrefix, usePlural } = exports.graphQLOperationsInfo[modelOperation];\n const { selectionSet } = listArgs || {};\n let graphQLFieldName;\n let indexQueryArgs;\n if (operationPrefix) {\n graphQLFieldName = `${operationPrefix}${usePlural ? pluralName : name}`;\n }\n else if (indexMeta) {\n const { queryField, pk, sk = [] } = indexMeta;\n graphQLFieldName = queryField;\n const skQueryArgs = sk.reduce((acc, fieldName) => {\n const fieldType = fields[fieldName].type;\n acc[fieldName] = `Model${fieldType}KeyConditionInput`;\n return acc;\n }, {});\n indexQueryArgs = {\n [pk]: `${fields[pk].type}!`,\n ...skQueryArgs,\n };\n }\n else {\n throw new Error('Error generating GraphQL Document - invalid operation name');\n }\n let graphQLOperationType;\n let graphQLSelectionSet;\n let graphQLArguments;\n const selectionSetFields = generateSelectionSet(modelIntrospection, modelName, selectionSet);\n switch (modelOperation) {\n case 'CREATE':\n case 'UPDATE':\n case 'DELETE':\n graphQLArguments ??\n (graphQLArguments = {\n input: `${operationPrefix.charAt(0).toLocaleUpperCase() +\n operationPrefix.slice(1)}${name}Input!`,\n });\n graphQLOperationType ?? (graphQLOperationType = 'mutation');\n // TODO(Eslint): this this case clause correct without the break statement?\n // eslint-disable-next-line no-fallthrough\n case 'READ':\n graphQLArguments ??\n (graphQLArguments = isCustomPrimaryKey\n ? [primaryKeyFieldName, ...sortKeyFieldNames].reduce((acc, fieldName) => {\n acc[fieldName] = `${fields[fieldName].type}!`;\n return acc;\n }, {})\n : {\n [primaryKeyFieldName]: `${fields[primaryKeyFieldName].type}!`,\n });\n graphQLSelectionSet ?? (graphQLSelectionSet = selectionSetFields);\n // TODO(Eslint): this this case clause correct without the break statement?\n // eslint-disable-next-line no-fallthrough\n case 'LIST':\n graphQLArguments ??\n (graphQLArguments = {\n filter: `Model${name}FilterInput`,\n ...(sortKeyFieldNames.length > 0\n ? [primaryKeyFieldName, ...sortKeyFieldNames].reduce((acc, fieldName) => {\n acc[fieldName] = `${fields[fieldName].type}`;\n return acc;\n }, { sortDirection: 'ModelSortDirection' })\n : []),\n limit: 'Int',\n nextToken: 'String',\n });\n graphQLOperationType ?? (graphQLOperationType = 'query');\n graphQLSelectionSet ??\n (graphQLSelectionSet = `items { ${selectionSetFields} } nextToken __typename`);\n // TODO(Eslint): this this case clause correct without the break statement?\n // eslint-disable-next-line no-fallthrough\n case 'INDEX_QUERY':\n graphQLArguments ??\n (graphQLArguments = {\n ...indexQueryArgs,\n filter: `Model${name}FilterInput`,\n sortDirection: 'ModelSortDirection',\n limit: 'Int',\n nextToken: 'String',\n });\n graphQLOperationType ?? (graphQLOperationType = 'query');\n graphQLSelectionSet ??\n (graphQLSelectionSet = `items { ${selectionSetFields} } nextToken __typename`);\n // TODO(Eslint): this this case clause correct without the break statement?\n // eslint-disable-next-line no-fallthrough\n case 'ONCREATE':\n case 'ONUPDATE':\n case 'ONDELETE':\n graphQLArguments ??\n (graphQLArguments = {\n filter: `ModelSubscription${name}FilterInput`,\n });\n graphQLOperationType ?? (graphQLOperationType = 'subscription');\n graphQLSelectionSet ?? (graphQLSelectionSet = selectionSetFields);\n break;\n case 'OBSERVE_QUERY':\n default:\n throw new Error('Internal error: Attempted to generate graphql document for observeQuery. Please report this error.');\n }\n const graphQLDocument = `${graphQLOperationType}${graphQLArguments\n ? `(${Object.entries(graphQLArguments).map(([fieldName, type]) => `$${fieldName}: ${type}`)})`\n : ''} { ${graphQLFieldName}${graphQLArguments\n ? `(${Object.keys(graphQLArguments).map(fieldName => `${fieldName}: $${fieldName}`)})`\n : ''} { ${graphQLSelectionSet} } }`;\n return graphQLDocument;\n}\nexports.generateGraphQLDocument = generateGraphQLDocument;\nfunction buildGraphQLVariables(modelDefinition, operation, arg, modelIntrospection, indexMeta) {\n const { fields, primaryKeyInfo: { isCustomPrimaryKey, primaryKeyFieldName, sortKeyFieldNames, }, } = modelDefinition;\n let variables = {};\n // TODO: process input\n switch (operation) {\n case 'CREATE':\n variables = {\n input: arg\n ? normalizeMutationInput(arg, modelDefinition, modelIntrospection)\n : {},\n };\n break;\n case 'UPDATE':\n // readonly fields are not updated\n variables = {\n input: arg\n ? Object.fromEntries(Object.entries(normalizeMutationInput(arg, modelDefinition, modelIntrospection)).filter(([fieldName]) => {\n const { isReadOnly } = fields[fieldName];\n return !isReadOnly;\n }))\n : {},\n };\n break;\n case 'READ':\n case 'DELETE':\n // only identifiers are sent\n if (arg) {\n variables = isCustomPrimaryKey\n ? [primaryKeyFieldName, ...sortKeyFieldNames].reduce((acc, fieldName) => {\n acc[fieldName] = arg[fieldName];\n return acc;\n }, {})\n : { [primaryKeyFieldName]: arg[primaryKeyFieldName] };\n }\n if (operation === 'DELETE') {\n variables = { input: variables };\n }\n break;\n case 'LIST':\n if (arg?.filter) {\n variables.filter = arg.filter;\n }\n if (arg?.sortDirection) {\n variables.sortDirection = arg.sortDirection;\n variables[primaryKeyFieldName] = arg[primaryKeyFieldName];\n }\n if (arg?.nextToken) {\n variables.nextToken = arg.nextToken;\n }\n if (arg?.limit) {\n variables.limit = arg.limit;\n }\n break;\n case 'INDEX_QUERY': {\n const { pk, sk = [] } = indexMeta;\n variables[pk] = arg[pk];\n for (const skField of sk) {\n variables[skField] = arg[skField];\n }\n if (arg?.filter) {\n variables.filter = arg.filter;\n }\n if (arg?.sortDirection) {\n variables.sortDirection = arg.sortDirection;\n }\n if (arg?.nextToken) {\n variables.nextToken = arg.nextToken;\n }\n if (arg?.limit) {\n variables.limit = arg.limit;\n }\n break;\n }\n case 'ONCREATE':\n case 'ONUPDATE':\n case 'ONDELETE':\n if (arg?.filter) {\n variables = { filter: arg.filter };\n }\n break;\n case 'OBSERVE_QUERY':\n throw new Error('Internal error: Attempted to build variables for observeQuery. Please report this error.');\n break;\n default: {\n const exhaustiveCheck = operation;\n throw new Error(`Unhandled operation case: ${exhaustiveCheck}`);\n }\n }\n return variables;\n}\nexports.buildGraphQLVariables = buildGraphQLVariables;\n/**\n * Iterates over mutation input values and resolves any model inputs to their corresponding join fields/values\n *\n * @example\n * ### Usage\n * ```ts\n * const result = normalizeMutationInput({ post: post }, model, modelDefinition);\n * ```\n * ### Result\n * ```ts\n * { postId: \"abc123\" }\n * ```\n *\n */\nfunction normalizeMutationInput(mutationInput, model, modelIntrospection) {\n const { fields } = model;\n const normalized = {};\n Object.entries(mutationInput).forEach(([inputFieldName, inputValue]) => {\n const fieldType = fields[inputFieldName]?.type;\n const relatedModelName = fieldType?.model;\n if (relatedModelName) {\n const association = fields[inputFieldName]?.association;\n const relatedModelDef = modelIntrospection.models[relatedModelName];\n const relatedModelPkInfo = relatedModelDef.primaryKeyInfo;\n if (association?.connectionType === connectionType.HAS_ONE) {\n const associationHasOne = association;\n associationHasOne.targetNames.forEach((targetName, idx) => {\n const associatedFieldName = associationHasOne.associatedWith[idx];\n normalized[targetName] = inputValue[associatedFieldName];\n });\n }\n if (association?.connectionType === connectionType.BELONGS_TO) {\n const associationBelongsTo = association;\n associationBelongsTo.targetNames.forEach((targetName, idx) => {\n if (idx === 0) {\n const associatedFieldName = relatedModelPkInfo.primaryKeyFieldName;\n normalized[targetName] = inputValue[associatedFieldName];\n }\n else {\n const associatedFieldName = relatedModelPkInfo.sortKeyFieldNames[idx - 1];\n normalized[targetName] = inputValue[associatedFieldName];\n }\n });\n }\n }\n else {\n normalized[inputFieldName] = inputValue;\n }\n });\n return normalized;\n}\nexports.normalizeMutationInput = normalizeMutationInput;\n/**\n * Produces a parameter object that can contains auth mode/token overrides\n * only if present in either `options` (first) or configured on the `client`\n * as a fallback.\n *\n * @param client Configured client from `generateClient`\n * @param options Args/Options object from call site.\n * @returns\n */\nfunction authModeParams(client, options = {}) {\n return {\n authMode: options.authMode || client[types_1.__authMode],\n authToken: options.authToken || client[types_1.__authToken],\n };\n}\nexports.authModeParams = authModeParams;\n/**\n * Retrieves custom headers from either the client or request options.\n * @param client V6Client | V6ClientSSRRequest | V6ClientSSRCookies - for extracting client headers\n * @param requestHeaders {@link CustomHeaders} - request headers\n * @returns custom headers as {@link CustomHeaders}\n */\nfunction getCustomHeaders(client, requestHeaders) {\n let headers = client[types_1.__headers] || {};\n // Individual request headers will take precedence over client headers.\n // We intentionally do *not* merge client and request headers.\n if (requestHeaders) {\n headers = requestHeaders;\n }\n return headers;\n}\nexports.getCustomHeaders = getCustomHeaders;\n"],"names":[],"mappings":";;AACA,MAAM,CAAC,cAAc,CAAC,OAAO,EAAE,YAAY,EAAE,EAAE,KAAK,EAAE,IAAI,EAAE,CAAC,CAAC;AAC9D,OAAO,CAAC,gBAAgB,GAAG,OAAO,CAAC,cAAc,GAAG,OAAO,CAAC,sBAAsB,GAAG,OAAO,CAAC,qBAAqB,GAAG,OAAO,CAAC,uBAAuB,GAAG,OAAO,CAAC,oBAAoB,GAAG,OAAO,CAAC,sBAAsB,GAAG,OAAO,CAAC,sBAAsB,GAAG,OAAO,CAAC,oCAAoC,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