@aws-amplify/api-graphql 4.0.18-unstable.b758843.0 → 4.0.18

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (51) hide show
  1. package/dist/cjs/internals/APIClient.js +95 -34
  2. package/dist/cjs/internals/APIClient.js.map +1 -1
  3. package/dist/cjs/internals/generateClient.js +7 -0
  4. package/dist/cjs/internals/generateClient.js.map +1 -1
  5. package/dist/cjs/internals/generateCustomOperationsProperty.js +45 -0
  6. package/dist/cjs/internals/generateCustomOperationsProperty.js.map +1 -0
  7. package/dist/cjs/internals/operations/custom.js +289 -0
  8. package/dist/cjs/internals/operations/custom.js.map +1 -0
  9. package/dist/cjs/internals/operations/get.js +1 -1
  10. package/dist/cjs/internals/operations/get.js.map +1 -1
  11. package/dist/cjs/internals/operations/indexQuery.js +1 -1
  12. package/dist/cjs/internals/operations/indexQuery.js.map +1 -1
  13. package/dist/cjs/internals/operations/list.js +1 -1
  14. package/dist/cjs/internals/operations/list.js.map +1 -1
  15. package/dist/cjs/internals/operations/subscription.js +1 -1
  16. package/dist/cjs/internals/operations/subscription.js.map +1 -1
  17. package/dist/cjs/internals/server/generateClientWithAmplifyInstance.js +11 -1
  18. package/dist/cjs/internals/server/generateClientWithAmplifyInstance.js.map +1 -1
  19. package/dist/esm/internals/APIClient.d.ts +4 -4
  20. package/dist/esm/internals/APIClient.mjs +95 -34
  21. package/dist/esm/internals/APIClient.mjs.map +1 -1
  22. package/dist/esm/internals/generateClient.mjs +7 -0
  23. package/dist/esm/internals/generateClient.mjs.map +1 -1
  24. package/dist/esm/internals/generateCustomOperationsProperty.d.ts +8 -0
  25. package/dist/esm/internals/generateCustomOperationsProperty.mjs +41 -0
  26. package/dist/esm/internals/generateCustomOperationsProperty.mjs.map +1 -0
  27. package/dist/esm/internals/operations/custom.d.ts +60 -0
  28. package/dist/esm/internals/operations/custom.mjs +287 -0
  29. package/dist/esm/internals/operations/custom.mjs.map +1 -0
  30. package/dist/esm/internals/operations/get.mjs +1 -1
  31. package/dist/esm/internals/operations/get.mjs.map +1 -1
  32. package/dist/esm/internals/operations/indexQuery.mjs +1 -1
  33. package/dist/esm/internals/operations/indexQuery.mjs.map +1 -1
  34. package/dist/esm/internals/operations/list.mjs +1 -1
  35. package/dist/esm/internals/operations/list.mjs.map +1 -1
  36. package/dist/esm/internals/operations/subscription.mjs +1 -1
  37. package/dist/esm/internals/operations/subscription.mjs.map +1 -1
  38. package/dist/esm/internals/server/generateClientWithAmplifyInstance.mjs +12 -2
  39. package/dist/esm/internals/server/generateClientWithAmplifyInstance.mjs.map +1 -1
  40. package/dist/esm/types/index.d.ts +9 -1
  41. package/package.json +6 -6
  42. package/src/internals/APIClient.ts +138 -44
  43. package/src/internals/generateClient.ts +25 -1
  44. package/src/internals/generateCustomOperationsProperty.ts +89 -0
  45. package/src/internals/operations/custom.ts +382 -0
  46. package/src/internals/operations/get.ts +1 -1
  47. package/src/internals/operations/indexQuery.ts +1 -1
  48. package/src/internals/operations/list.ts +1 -1
  49. package/src/internals/operations/subscription.ts +3 -1
  50. package/src/internals/server/generateClientWithAmplifyInstance.ts +20 -1
  51. package/src/types/index.ts +11 -1
@@ -0,0 +1,287 @@
1
+ import { authModeParams, getCustomHeaders, flattenItems, initializeModel } from '../APIClient.mjs';
2
+
3
+ /**
4
+ * Builds an operation function, embedded with all client and context data, that
5
+ * can be attached to a client as a custom query or mutation.
6
+ *
7
+ * If we have this source schema:
8
+ *
9
+ * ```typescript
10
+ * a.schema({
11
+ * echo: a.query()
12
+ * .arguments({input: a.string().required()})
13
+ * .returns(a.string())
14
+ * })
15
+ * ```
16
+ *
17
+ * Our model intro schema will contain an entry like this:
18
+ *
19
+ * ```ts
20
+ * {
21
+ * queries: {
22
+ * echo: {
23
+ * name: "echo",
24
+ * isArray: false,
25
+ * type: 'String',
26
+ * isRequired: false,
27
+ * arguments: {
28
+ * input: {
29
+ * name: 'input',
30
+ * isArray: false,
31
+ * type: String,
32
+ * isRequired: true
33
+ * }
34
+ * }
35
+ * }
36
+ * }
37
+ * }
38
+ * ```
39
+ *
40
+ * The `echo` object is used to build the `echo' method that goes here:
41
+ *
42
+ * ```typescript
43
+ * const client = generateClent()
44
+ * const { data } = await client.queries.echo({input: 'a string'});
45
+ * // ^
46
+ * // |
47
+ * // +-- This one right here.
48
+ * //
49
+ * ```
50
+ *
51
+ *
52
+ * @param client The client to run graphql queries through.
53
+ * @param modelIntrospection The model introspection schema the op comes from.
54
+ * @param operationType The broad category of graphql operation.
55
+ * @param operation The operation definition from the introspection schema.
56
+ * @param useContext Whether the function needs to accept an SSR context.
57
+ * @returns The operation function to attach to query, mutations, etc.
58
+ */
59
+ function customOpFactory(client, modelIntrospection, operationType, operation, useContext) {
60
+ const opWithContext = async (contextSpec, arg, options) => {
61
+ return _op(client, modelIntrospection, operationType, operation, arg, options, contextSpec);
62
+ };
63
+ const op = async (arg, options) => {
64
+ return _op(client, modelIntrospection, operationType, operation, arg, options);
65
+ };
66
+ return useContext ? opWithContext : op;
67
+ }
68
+ /**
69
+ * Runtime test and type guard to check whether `o[field]` is a `String`.
70
+ *
71
+ * ```typescript
72
+ * if (hasStringField(o, 'prop')) {
73
+ * const s = o.prop;
74
+ * // ^? const s: string
75
+ * }
76
+ * ```
77
+ *
78
+ * @param o Object to inspect
79
+ * @param field Field to look for
80
+ * @returns Boolean: `true` if the `o[field]` is a `string`
81
+ */
82
+ function hasStringField(o, field) {
83
+ return typeof o[field] === 'string';
84
+ }
85
+ /**
86
+ * Generates "outer" arguments string for a custom operation. For example,
87
+ * in this operation:
88
+ *
89
+ * ```graphql
90
+ * query MyQuery(InputString: String!) {
91
+ * echoString(InputString: $InputString)
92
+ * }
93
+ * ```
94
+ *
95
+ * This function returns the top/outer level arguments as a string:
96
+ *
97
+ * ```json
98
+ * "InputString: String!"
99
+ * ```
100
+ *
101
+ * @param operation Operation object from model introspection schema.
102
+ * @returns "outer" arguments string
103
+ */
104
+ function outerArguments(operation) {
105
+ const args = Object.entries(operation.arguments)
106
+ .map(([k, v]) => {
107
+ const baseType = v.type + (v.isRequired ? '!' : '');
108
+ const finalType = v.isArray
109
+ ? `[${baseType}]${v.isArrayNullable ? '' : '!'}`
110
+ : baseType;
111
+ return `$${k}: ${finalType}`;
112
+ })
113
+ .join(', ');
114
+ return args.length > 0 ? `(${args})` : '';
115
+ }
116
+ /**
117
+ * Generates "inner" arguments string for a custom operation. For example,
118
+ * in this operation:
119
+ *
120
+ * ```graphql
121
+ * query MyQuery(InputString: String!) {
122
+ * echoString(InputString: $InputString)
123
+ * }
124
+ * ```
125
+ *
126
+ * This function returns the inner arguments as a string:
127
+ *
128
+ * ```json
129
+ * "InputString: $InputString"
130
+ * ```
131
+ *
132
+ * @param operation Operation object from model introspection schema.
133
+ * @returns "outer" arguments string
134
+ */
135
+ function innerArguments(operation) {
136
+ const args = Object.entries(operation.arguments)
137
+ .map(([k, v]) => `${k}: $${k}`)
138
+ .join(', ');
139
+ return args.length > 0 ? `(${args})` : '';
140
+ }
141
+ /**
142
+ * Accepts a Model or NonModel from generated introspection schema and
143
+ * generates the selection set string.
144
+ *
145
+ * @param nonModel Model or nonModel object from introspection schema.
146
+ * @returns String selection set.
147
+ */
148
+ function modelishTypeSelectionSet(nonModel) {
149
+ return Object.values(nonModel.fields)
150
+ .filter(field => hasStringField(field, 'type') ||
151
+ hasStringField(field.type, 'nonModel') ||
152
+ hasStringField(field.type, 'enum'))
153
+ .map(field => field.name)
154
+ .join(' ');
155
+ }
156
+ /**
157
+ * Generates the selection set string for a custom operation. This is slightly
158
+ * different than the selection set generation for models. If the custom op returns
159
+ * a primitive or enum types, it doen't require a selection set at all.
160
+ *
161
+ * E.g., the graphql might look like this:
162
+ *
163
+ * ```graphql
164
+ * query MyQuery {
165
+ * echoString(inputString: "whatever")
166
+ * }
167
+ * # ^
168
+ * # |
169
+ * # +-- no selection set
170
+ * ```
171
+ *
172
+ * Non-primitive return type selection set generation will be similar to other
173
+ * model operations.
174
+ *
175
+ * @param modelIntrospection The full code-generated introspection schema.
176
+ * @param operation The operation object from the schema.
177
+ * @returns The selection set as a string.
178
+ */
179
+ function operationSelectionSet(modelIntrospection, operation) {
180
+ if (hasStringField(operation, 'type') ||
181
+ hasStringField(operation.type, 'enum')) {
182
+ return '';
183
+ }
184
+ else if (hasStringField(operation.type, 'nonModel')) {
185
+ const model = modelIntrospection.nonModels[operation.type.nonModel];
186
+ return `{${modelishTypeSelectionSet(model)}}`;
187
+ }
188
+ else if (hasStringField(operation.type, 'model')) {
189
+ const nonModel = modelIntrospection.models[operation.type.model];
190
+ return `{${modelishTypeSelectionSet(nonModel)}}`;
191
+ }
192
+ else {
193
+ return '';
194
+ }
195
+ }
196
+ /**
197
+ * Maps an arguments objec to graphql variables, removing superfluous args and
198
+ * screaming loudly when required args are missing.
199
+ *
200
+ * @param operation The operation to construct graphql request variables for.
201
+ * @param args The arguments to map variables from.
202
+ * @returns The graphql variables object.
203
+ */
204
+ function operationVariables(operation, args = {}) {
205
+ const variables = {};
206
+ for (const argDef of Object.values(operation.arguments)) {
207
+ if (typeof args[argDef.name] !== 'undefined') {
208
+ variables[argDef.name] = args[argDef.name];
209
+ }
210
+ else if (argDef.isRequired) {
211
+ // At this point, the variable is both required and missing: We don't need
212
+ // to continue. The operation is expected to fail.
213
+ throw new Error(`${operation.name} requires arguments '${argDef.name}'`);
214
+ }
215
+ }
216
+ return variables;
217
+ }
218
+ /**
219
+ * Executes an operation from the given model intro schema against a client, returning
220
+ * a fully instantiated model when relevant.
221
+ *
222
+ * @param client The client to operate `graphql()` calls through.
223
+ * @param modelIntrospection The model intro schema to construct requests from.
224
+ * @param operationType The high level graphql operation type.
225
+ * @param operation The specific operation name, args, return type details.
226
+ * @param args The arguments to provide to the operation as variables.
227
+ * @param options Request options like headers, etc.
228
+ * @param context SSR context if relevant.
229
+ * @returns Result from the graphql request, model-instantiated when relevant.
230
+ */
231
+ async function _op(client, modelIntrospection, operationType, operation, args, options, context) {
232
+ const { name: operationName } = operation;
233
+ const auth = authModeParams(client, options);
234
+ const headers = getCustomHeaders(client, options?.headers);
235
+ const outerArgsString = outerArguments(operation);
236
+ const innerArgsString = innerArguments(operation);
237
+ const selectionSet = operationSelectionSet(modelIntrospection, operation);
238
+ const returnTypeModelName = hasStringField(operation.type, 'model')
239
+ ? operation.type.model
240
+ : undefined;
241
+ const query = `
242
+ ${operationType.toLocaleLowerCase()}${outerArgsString} {
243
+ ${operationName}${innerArgsString} ${selectionSet}
244
+ }
245
+ `;
246
+ const variables = operationVariables(operation, args);
247
+ try {
248
+ const { data, extensions } = context
249
+ ? (await client.graphql(context, {
250
+ ...auth,
251
+ query,
252
+ variables,
253
+ }, headers))
254
+ : (await client.graphql({
255
+ ...auth,
256
+ query,
257
+ variables,
258
+ }, headers));
259
+ // flatten response
260
+ if (data) {
261
+ const [key] = Object.keys(data);
262
+ const flattenedResult = flattenItems(data)[key];
263
+ // TODO: custom selection set. current selection set is default selection set only
264
+ // custom selection set requires data-schema-type + runtime updates above.
265
+ const [initialized] = returnTypeModelName
266
+ ? initializeModel(client, returnTypeModelName, [flattenedResult], modelIntrospection, auth.authMode, auth.authToken, !!context)
267
+ : [flattenedResult];
268
+ return { data: initialized, extensions };
269
+ }
270
+ else {
271
+ return { data: null, extensions };
272
+ }
273
+ }
274
+ catch (error) {
275
+ if (error.errors) {
276
+ // graphql errors pass through
277
+ return error;
278
+ }
279
+ else {
280
+ // non-graphql errors re re-thrown
281
+ throw error;
282
+ }
283
+ }
284
+ }
285
+
286
+ export { customOpFactory };
287
+ //# sourceMappingURL=custom.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"custom.mjs","sources":["../../../../src/internals/operations/custom.ts"],"sourcesContent":["import { initializeModel, flattenItems, authModeParams, getCustomHeaders, } from '../APIClient';\n/**\n * Builds an operation function, embedded with all client and context data, that\n * can be attached to a client as a custom query or mutation.\n *\n * If we have this source schema:\n *\n * ```typescript\n * a.schema({\n * echo: a.query()\n * .arguments({input: a.string().required()})\n * .returns(a.string())\n * })\n * ```\n *\n * Our model intro schema will contain an entry like this:\n *\n * ```ts\n * {\n * queries: {\n * echo: {\n * name: \"echo\",\n * isArray: false,\n * type: 'String',\n * isRequired: false,\n * arguments: {\n * input: {\n * name: 'input',\n * isArray: false,\n * type: String,\n * isRequired: true\n * }\n * }\n * }\n * }\n * }\n * ```\n *\n * The `echo` object is used to build the `echo' method that goes here:\n *\n * ```typescript\n * const client = generateClent()\n * const { data } = await client.queries.echo({input: 'a string'});\n * // ^\n * // |\n * // +-- This one right here.\n * //\n * ```\n *\n *\n * @param client The client to run graphql queries through.\n * @param modelIntrospection The model introspection schema the op comes from.\n * @param operationType The broad category of graphql operation.\n * @param operation The operation definition from the introspection schema.\n * @param useContext Whether the function needs to accept an SSR context.\n * @returns The operation function to attach to query, mutations, etc.\n */\nexport function customOpFactory(client, modelIntrospection, operationType, operation, useContext) {\n const opWithContext = async (contextSpec, arg, options) => {\n return _op(client, modelIntrospection, operationType, operation, arg, options, contextSpec);\n };\n const op = async (arg, options) => {\n return _op(client, modelIntrospection, operationType, operation, arg, options);\n };\n return useContext ? opWithContext : op;\n}\n/**\n * Runtime test and type guard to check whether `o[field]` is a `String`.\n *\n * ```typescript\n * if (hasStringField(o, 'prop')) {\n * const s = o.prop;\n * // ^? const s: string\n * }\n * ```\n *\n * @param o Object to inspect\n * @param field Field to look for\n * @returns Boolean: `true` if the `o[field]` is a `string`\n */\nfunction hasStringField(o, field) {\n return typeof o[field] === 'string';\n}\n/**\n * Generates \"outer\" arguments string for a custom operation. For example,\n * in this operation:\n *\n * ```graphql\n * query MyQuery(InputString: String!) {\n * echoString(InputString: $InputString)\n * }\n * ```\n *\n * This function returns the top/outer level arguments as a string:\n *\n * ```json\n * \"InputString: String!\"\n * ```\n *\n * @param operation Operation object from model introspection schema.\n * @returns \"outer\" arguments string\n */\nfunction outerArguments(operation) {\n const args = Object.entries(operation.arguments)\n .map(([k, v]) => {\n const baseType = v.type + (v.isRequired ? '!' : '');\n const finalType = v.isArray\n ? `[${baseType}]${v.isArrayNullable ? '' : '!'}`\n : baseType;\n return `$${k}: ${finalType}`;\n })\n .join(', ');\n return args.length > 0 ? `(${args})` : '';\n}\n/**\n * Generates \"inner\" arguments string for a custom operation. For example,\n * in this operation:\n *\n * ```graphql\n * query MyQuery(InputString: String!) {\n * echoString(InputString: $InputString)\n * }\n * ```\n *\n * This function returns the inner arguments as a string:\n *\n * ```json\n * \"InputString: $InputString\"\n * ```\n *\n * @param operation Operation object from model introspection schema.\n * @returns \"outer\" arguments string\n */\nfunction innerArguments(operation) {\n const args = Object.entries(operation.arguments)\n .map(([k, v]) => `${k}: $${k}`)\n .join(', ');\n return args.length > 0 ? `(${args})` : '';\n}\n/**\n * Accepts a Model or NonModel from generated introspection schema and\n * generates the selection set string.\n *\n * @param nonModel Model or nonModel object from introspection schema.\n * @returns String selection set.\n */\nfunction modelishTypeSelectionSet(nonModel) {\n return Object.values(nonModel.fields)\n .filter(field => hasStringField(field, 'type') ||\n hasStringField(field.type, 'nonModel') ||\n hasStringField(field.type, 'enum'))\n .map(field => field.name)\n .join(' ');\n}\n/**\n * Generates the selection set string for a custom operation. This is slightly\n * different than the selection set generation for models. If the custom op returns\n * a primitive or enum types, it doen't require a selection set at all.\n *\n * E.g., the graphql might look like this:\n *\n * ```graphql\n * query MyQuery {\n * echoString(inputString: \"whatever\")\n * }\n * # ^\n * # |\n * # +-- no selection set\n * ```\n *\n * Non-primitive return type selection set generation will be similar to other\n * model operations.\n *\n * @param modelIntrospection The full code-generated introspection schema.\n * @param operation The operation object from the schema.\n * @returns The selection set as a string.\n */\nfunction operationSelectionSet(modelIntrospection, operation) {\n if (hasStringField(operation, 'type') ||\n hasStringField(operation.type, 'enum')) {\n return '';\n }\n else if (hasStringField(operation.type, 'nonModel')) {\n const model = modelIntrospection.nonModels[operation.type.nonModel];\n return `{${modelishTypeSelectionSet(model)}}`;\n }\n else if (hasStringField(operation.type, 'model')) {\n const nonModel = modelIntrospection.models[operation.type.model];\n return `{${modelishTypeSelectionSet(nonModel)}}`;\n }\n else {\n return '';\n }\n}\n/**\n * Maps an arguments objec to graphql variables, removing superfluous args and\n * screaming loudly when required args are missing.\n *\n * @param operation The operation to construct graphql request variables for.\n * @param args The arguments to map variables from.\n * @returns The graphql variables object.\n */\nfunction operationVariables(operation, args = {}) {\n const variables = {};\n for (const argDef of Object.values(operation.arguments)) {\n if (typeof args[argDef.name] !== 'undefined') {\n variables[argDef.name] = args[argDef.name];\n }\n else if (argDef.isRequired) {\n // At this point, the variable is both required and missing: We don't need\n // to continue. The operation is expected to fail.\n throw new Error(`${operation.name} requires arguments '${argDef.name}'`);\n }\n }\n return variables;\n}\n/**\n * Executes an operation from the given model intro schema against a client, returning\n * a fully instantiated model when relevant.\n *\n * @param client The client to operate `graphql()` calls through.\n * @param modelIntrospection The model intro schema to construct requests from.\n * @param operationType The high level graphql operation type.\n * @param operation The specific operation name, args, return type details.\n * @param args The arguments to provide to the operation as variables.\n * @param options Request options like headers, etc.\n * @param context SSR context if relevant.\n * @returns Result from the graphql request, model-instantiated when relevant.\n */\nasync function _op(client, modelIntrospection, operationType, operation, args, options, context) {\n const { name: operationName } = operation;\n const auth = authModeParams(client, options);\n const headers = getCustomHeaders(client, options?.headers);\n const outerArgsString = outerArguments(operation);\n const innerArgsString = innerArguments(operation);\n const selectionSet = operationSelectionSet(modelIntrospection, operation);\n const returnTypeModelName = hasStringField(operation.type, 'model')\n ? operation.type.model\n : undefined;\n const query = `\n\t\t${operationType.toLocaleLowerCase()}${outerArgsString} {\n\t\t\t${operationName}${innerArgsString} ${selectionSet}\n\t\t}\n\t`;\n const variables = operationVariables(operation, args);\n try {\n const { data, extensions } = context\n ? (await client.graphql(context, {\n ...auth,\n query,\n variables,\n }, headers))\n : (await client.graphql({\n ...auth,\n query,\n variables,\n }, headers));\n // flatten response\n if (data) {\n const [key] = Object.keys(data);\n const flattenedResult = flattenItems(data)[key];\n // TODO: custom selection set. current selection set is default selection set only\n // custom selection set requires data-schema-type + runtime updates above.\n const [initialized] = returnTypeModelName\n ? initializeModel(client, returnTypeModelName, [flattenedResult], modelIntrospection, auth.authMode, auth.authToken, !!context)\n : [flattenedResult];\n return { data: initialized, extensions };\n }\n else {\n return { data: null, extensions };\n }\n }\n catch (error) {\n if (error.errors) {\n // graphql errors pass through\n return error;\n }\n else {\n // non-graphql errors re re-thrown\n throw error;\n }\n }\n}\n"],"names":[],"mappings":";;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACO,SAAS,eAAe,CAAC,MAAM,EAAE,kBAAkB,EAAE,aAAa,EAAE,SAAS,EAAE,UAAU,EAAE;AAClG,IAAI,MAAM,aAAa,GAAG,OAAO,WAAW,EAAE,GAAG,EAAE,OAAO,KAAK;AAC/D,QAAQ,OAAO,GAAG,CAAC,MAAM,EAAE,kBAAkB,EAAE,aAAa,EAAE,SAAS,EAAE,GAAG,EAAE,OAAO,EAAE,WAAW,CAAC,CAAC;AACpG,KAAK,CAAC;AACN,IAAI,MAAM,EAAE,GAAG,OAAO,GAAG,EAAE,OAAO,KAAK;AACvC,QAAQ,OAAO,GAAG,CAAC,MAAM,EAAE,kBAAkB,EAAE,aAAa,EAAE,SAAS,EAAE,GAAG,EAAE,OAAO,CAAC,CAAC;AACvF,KAAK,CAAC;AACN,IAAI,OAAO,UAAU,GAAG,aAAa,GAAG,EAAE,CAAC;AAC3C,CAAC;AACD;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAAS,cAAc,CAAC,CAAC,EAAE,KAAK,EAAE;AAClC,IAAI,O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AY,MAAM,CAAC,GAAG,CAAC,GAAG,MAAM,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;AAC5C,YAAY,MAAM,eAAe,GAAG,YAAY,CAAC,IAAI,CAAC,CAAC,GAAG,CAAC,CAAC;AAC5D;AACA;AACA,YAAY,MAAM,CAAC,WAAW,CAAC,GAAG,mBAAmB;AACrD,kBAAkB,eAAe,CAAC,MAAM,EAAE,mBAAmB,EAAE,CAAC,eAAe,CAAC,EAAE,kBAAkB,EAAE,IAAI,CAAC,QAAQ,EAAE,IAAI,CAAC,SAAS,EAAE,CAAC,CAAC,OAAO,CAAC;AAC/I,kBAAkB,CAAC,eAAe,CAAC,CAAC;AACpC,YAAY,OAAO,EAAE,IAAI,EAAE,WAAW,EAAE,UAAU,EAAE,CAAC;AACrD,SAAS;AACT,aAAa;AACb,YAAY,OAAO,EAAE,IAAI,EAAE,IAAI,EAAE,UAAU,EAAE,CAAC;AAC9C,SAAS;AACT,KAAK;AACL,IAAI,OAAO,KAAK,EAAE;AAClB,QAAQ,IAAI,KAAK,CAAC,MAAM,EAAE;AAC1B;AACA,YAAY,OAAO,KAAK,CAAC;AACzB,SAAS;AACT,aAAa;AACb;AACA,YAAY,MAAM,KAAK,CAAC;AACxB,SAAS;AACT,KAAK;AACL;;;;"}
@@ -11,7 +11,7 @@ function getFactory(client, modelIntrospection, model, operation, useContext = f
11
11
  }
12
12
  async function _get(client, modelIntrospection, model, arg, options, operation, context) {
13
13
  const { name } = model;
14
- const query = generateGraphQLDocument(modelIntrospection.models, name, operation, options);
14
+ const query = generateGraphQLDocument(modelIntrospection, name, operation, options);
15
15
  const variables = buildGraphQLVariables(model, operation, arg, modelIntrospection);
16
16
  try {
17
17
  const auth = authModeParams(client, options);
@@ -1 +1 @@
1
- {"version":3,"file":"get.mjs","sources":["../../../../src/internals/operations/get.ts"],"sourcesContent":["import { initializeModel, generateGraphQLDocument, buildGraphQLVariables, flattenItems, authModeParams, getCustomHeaders, } from '../APIClient';\nexport function getFactory(client, modelIntrospection, model, operation, useContext = false) {\n const getWithContext = async (contextSpec, arg, options) => {\n return _get(client, modelIntrospection, model, arg, options, operation, contextSpec);\n };\n const get = async (arg, options) => {\n return _get(client, modelIntrospection, model, arg, options, operation);\n };\n return useContext ? getWithContext : get;\n}\nasync function _get(client, modelIntrospection, model, arg, options, operation, context) {\n const { name } = model;\n const query = generateGraphQLDocument(modelIntrospection.models, name, operation, options);\n const variables = buildGraphQLVariables(model, operation, arg, modelIntrospection);\n try {\n const auth = authModeParams(client, options);\n const headers = getCustomHeaders(client, options?.headers);\n const { data, extensions } = context\n ? (await client.graphql(context, {\n ...auth,\n query,\n variables,\n }, headers))\n : (await client.graphql({\n ...auth,\n query,\n variables,\n }, headers));\n // flatten response\n if (data) {\n const [key] = Object.keys(data);\n const flattenedResult = flattenItems(data)[key];\n if (options?.selectionSet) {\n return { data: flattenedResult, extensions };\n }\n else {\n // TODO: refactor to avoid destructuring here\n const [initialized] = initializeModel(client, name, [flattenedResult], modelIntrospection, auth.authMode, auth.authToken, !!context);\n return { data: initialized, extensions };\n }\n }\n else {\n return { data: null, extensions };\n }\n }\n catch (error) {\n if (error.errors) {\n // graphql errors pass through\n return error;\n }\n else {\n // non-graphql errors re re-thrown\n throw error;\n }\n }\n}\n"],"names":[],"mappings":";;AACO,SAAS,UAAU,CAAC,MAAM,EAAE,kBAAkB,EAAE,KAAK,EAAE,SAAS,EAAE,UAAU,GAAG,KAAK,EAAE;AAC7F,IAAI,MAAM,cAAc,GAAG,OAAO,WAAW,EAAE,GAAG,EAAE,OAAO,KAAK;AAChE,QAAQ,OAAO,IAAI,CAAC,MAAM,EAAE,kBAAkB,EAAE,KAAK,EAAE,GAAG,EAAE,OAAO,EAAE,SAAS,EAAE,WAAW,CAAC,CAAC;AAC7F,KAAK,CAAC;AACN,IAAI,MAAM,GAAG,GAAG,OAAO,GAAG,EAAE,OAAO,KAAK;AACxC,QAAQ,OAAO,IAAI,CAAC,MAAM,EAAE,kBAAkB,EA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AAI,CAAC,CAAC,GAAG,CAAC,CAAC;AAC5D,YAAY,IAAI,OAAO,EAAE,YAAY,EAAE;AACvC,gBAAgB,OAAO,EAAE,IAAI,EAAE,eAAe,EAAE,UAAU,EAAE,CAAC;AAC7D,aAAa;AACb,iBAAiB;AACjB;AACA,gBAAgB,MAAM,CAAC,WAAW,CAAC,GAAG,eAAe,CAAC,MAAM,EAAE,IAAI,EAAE,CAAC,eAAe,CAAC,EAAE,kBAAkB,EAAE,IAAI,CAAC,QAAQ,EAAE,IAAI,CAAC,SAAS,EAAE,CAAC,CAAC,OAAO,CAAC,CAAC;AACrJ,gBAAgB,OAAO,EAAE,IAAI,EAAE,WAAW,EAAE,UAAU,EAAE,CAAC;AACzD,aAAa;AACb,SAAS;AACT,aAAa;AACb,YAAY,OAAO,EAAE,IAAI,EAAE,IAAI,EAAE,UAAU,EAAE,CAAC;AAC9C,SAAS;AACT,KAAK;AACL,IAAI,OAAO,KAAK,EAAE;AAClB,QAAQ,IAAI,KAAK,CAAC,MAAM,EAAE;AAC1B;AACA,YAAY,OAAO,KAAK,CAAC;AACzB,SAAS;AACT,aAAa;AACb;AACA,YAAY,MAAM,KAAK,CAAC;AACxB,SAAS;AACT,KAAK;AACL;;;;"}
1
+ {"version":3,"file":"get.mjs","sources":["../../../../src/internals/operations/get.ts"],"sourcesContent":["import { initializeModel, generateGraphQLDocument, buildGraphQLVariables, flattenItems, authModeParams, getCustomHeaders, } from '../APIClient';\nexport function getFactory(client, modelIntrospection, model, operation, useContext = false) {\n const getWithContext = async (contextSpec, arg, options) => {\n return _get(client, modelIntrospection, model, arg, options, operation, contextSpec);\n };\n const get = async (arg, options) => {\n return _get(client, modelIntrospection, model, arg, options, operation);\n };\n return useContext ? getWithContext : get;\n}\nasync function _get(client, modelIntrospection, model, arg, options, operation, context) {\n const { name } = model;\n const query = generateGraphQLDocument(modelIntrospection, name, operation, options);\n const variables = buildGraphQLVariables(model, operation, arg, modelIntrospection);\n try {\n const auth = authModeParams(client, options);\n const headers = getCustomHeaders(client, options?.headers);\n const { data, extensions } = context\n ? (await client.graphql(context, {\n ...auth,\n query,\n variables,\n }, headers))\n : (await client.graphql({\n ...auth,\n query,\n variables,\n }, headers));\n // flatten response\n if (data) {\n const [key] = Object.keys(data);\n const flattenedResult = flattenItems(data)[key];\n if (options?.selectionSet) {\n return { data: flattenedResult, extensions };\n }\n else {\n // TODO: refactor to avoid destructuring here\n const [initialized] = initializeModel(client, name, [flattenedResult], modelIntrospection, auth.authMode, auth.authToken, !!context);\n return { data: initialized, extensions };\n }\n }\n else {\n return { data: null, extensions };\n }\n }\n catch (error) {\n if (error.errors) {\n // graphql errors pass through\n return error;\n }\n else {\n // non-graphql errors re re-thrown\n throw error;\n }\n }\n}\n"],"names":[],"mappings":";;AACO,SAAS,UAAU,CAAC,MAAM,EAAE,kBAAkB,EAAE,KAAK,EAAE,SAAS,EAAE,UAAU,GAAG,KAAK,EAAE;AAC7F,IAAI,MAAM,cAAc,GAAG,OAAO,WAAW,EAAE,GAAG,EAAE,OAAO,KAAK;AAChE,QAAQ,OAAO,IAAI,CAAC,MAAM,EAAE,kBAAkB,EAAE,KAAK,EAAE,GAAG,EAAE,OAAO,EAAE,SAAS,EAAE,WAAW,CAAC,CAAC;AAC7F,KAAK,CAAC;AACN,IAAI,MAAM,GAAG,GAAG,OAAO,GAAG,EAAE,OAAO,KAAK;AACxC,QAAQ,OAAO,IAAI,CAAC,MAAM,EAAE,kBAAkB,EAAE,KAAK,EAAE,GAAG,EAAE,OAAO,EAAE,SAAS,CAAC,CAAC;AAChF,KAAK,CAAC;AACN,IAAI,OAAO,UAAU,GAAG,cAAc,GAAG,GAAG,CAAC;AAC7C,CAAC;AACD,eAAe,IAAI,CAAC,MAAM,EAAE,kBAAkB,EAAE,KAAK,EAAE,GAAG,EAAE,OAAO,EAAE,SAAS,EAAE,OAAO,EAAE;AACzF,IAAI,MAAM,EAAE,IAAI,EAAE,GAAG,KAAK,CAAC;AAC3B,IAAI,MAAM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AS,EAAE,CAAC,CAAC,OAAO,CAAC,CAAC;AACrJ,gBAAgB,OAAO,EAAE,IAAI,EAAE,WAAW,EAAE,UAAU,EAAE,CAAC;AACzD,aAAa;AACb,SAAS;AACT,aAAa;AACb,YAAY,OAAO,EAAE,IAAI,EAAE,IAAI,EAAE,UAAU,EAAE,CAAC;AAC9C,SAAS;AACT,KAAK;AACL,IAAI,OAAO,KAAK,EAAE;AAClB,QAAQ,IAAI,KAAK,CAAC,MAAM,EAAE;AAC1B;AACA,YAAY,OAAO,KAAK,CAAC;AACzB,SAAS;AACT,aAAa;AACb;AACA,YAAY,MAAM,KAAK,CAAC;AACxB,SAAS;AACT,KAAK;AACL;;;;"}
@@ -44,7 +44,7 @@ function handleGraphQlError(error) {
44
44
  }
45
45
  async function _indexQuery(client, modelIntrospection, model, indexMeta, args, contextSpec) {
46
46
  const { name } = model;
47
- const query = generateGraphQLDocument(modelIntrospection.models, name, 'INDEX_QUERY', args, indexMeta);
47
+ const query = generateGraphQLDocument(modelIntrospection, name, 'INDEX_QUERY', args, indexMeta);
48
48
  const variables = buildGraphQLVariables(model, 'INDEX_QUERY', args, modelIntrospection, indexMeta);
49
49
  const auth = authModeParams(client, args);
50
50
  const modelInitializer = (flattenedResult) => initializeModel(client, name, flattenedResult, modelIntrospection, auth.authMode, auth.authToken, !!contextSpec);
@@ -1 +1 @@
1
- {"version":3,"file":"indexQuery.mjs","sources":["../../../../src/internals/operations/indexQuery.ts"],"sourcesContent":["import { initializeModel, generateGraphQLDocument, buildGraphQLVariables, flattenItems, authModeParams, getCustomHeaders, } from '../APIClient';\nexport function indexQueryFactory(client, modelIntrospection, model, indexMeta, context = false) {\n const indexQueryWithContext = async (contextSpec, args, options) => {\n return _indexQuery(client, modelIntrospection, model, indexMeta, {\n ...args,\n ...options,\n }, contextSpec);\n };\n const indexQuery = async (args, options) => {\n return _indexQuery(client, modelIntrospection, model, indexMeta, {\n ...args,\n ...options,\n });\n };\n return context ? indexQueryWithContext : indexQuery;\n}\nfunction processGraphQlResponse(result, selectionSet, modelInitializer) {\n const { data, extensions } = result;\n const [key] = Object.keys(data);\n if (data[key].items) {\n const flattenedResult = flattenItems(data)[key];\n return {\n data: selectionSet ? flattenedResult : modelInitializer(flattenedResult),\n nextToken: data[key].nextToken,\n extensions,\n };\n }\n return {\n data: data[key],\n nextToken: data[key].nextToken,\n extensions,\n };\n}\nfunction handleGraphQlError(error) {\n if (error.errors) {\n // graphql errors pass through\n return error;\n }\n else {\n // non-graphql errors re re-thrown\n throw error;\n }\n}\nasync function _indexQuery(client, modelIntrospection, model, indexMeta, args, contextSpec) {\n const { name } = model;\n const query = generateGraphQLDocument(modelIntrospection.models, name, 'INDEX_QUERY', args, indexMeta);\n const variables = buildGraphQLVariables(model, 'INDEX_QUERY', args, modelIntrospection, indexMeta);\n const auth = authModeParams(client, args);\n const modelInitializer = (flattenedResult) => initializeModel(client, name, flattenedResult, modelIntrospection, auth.authMode, auth.authToken, !!contextSpec);\n try {\n const headers = getCustomHeaders(client, args?.headers);\n const graphQlParams = {\n ...auth,\n query,\n variables,\n };\n const requestArgs = [graphQlParams, headers];\n if (contextSpec !== undefined) {\n requestArgs.unshift(contextSpec);\n }\n const response = (await client.graphql(...requestArgs));\n if (response.data !== undefined) {\n return processGraphQlResponse(response, args?.selectionSet, modelInitializer);\n }\n }\n catch (error) {\n return handleGraphQlError(error);\n }\n}\n"],"names":[],"mappings":";;AACO,SAAS,iBAAiB,CAAC,MAAM,EAAE,kBAAkB,EAAE,KAAK,EAAE,SAAS,EAAE,OAAO,GAAG,KAAK,EAAE;AACjG,IAAI,MAAM,qBAAqB,GAAG,OAAO,WAAW,EAAE,IAAI,EAAE,OAAO,KAAK;AACxE,QAAQ,OAAO,WAAW,CAAC,MAAM,EAAE,kBAAkB,EAAE,KAAK,EAAE,SAAS,EAAE;AACzE,YAAY,GAAG,IAAI;AACnB,YAAY,GAAG,OAAO;AACtB,SAAS,EAAE,WAAW,CAAC,CAAC;AACxB,KAAK,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Q,EAAE,IAAI,EAAE,YAAY,EAAE,gBAAgB,CAAC,CAAC;AAC1F,SAAS;AACT,KAAK;AACL,IAAI,OAAO,KAAK,EAAE;AAClB,QAAQ,OAAO,kBAAkB,CAAC,KAAK,CAAC,CAAC;AACzC,KAAK;AACL;;;;"}
1
+ {"version":3,"file":"indexQuery.mjs","sources":["../../../../src/internals/operations/indexQuery.ts"],"sourcesContent":["import { initializeModel, generateGraphQLDocument, buildGraphQLVariables, flattenItems, authModeParams, getCustomHeaders, } from '../APIClient';\nexport function indexQueryFactory(client, modelIntrospection, model, indexMeta, context = false) {\n const indexQueryWithContext = async (contextSpec, args, options) => {\n return _indexQuery(client, modelIntrospection, model, indexMeta, {\n ...args,\n ...options,\n }, contextSpec);\n };\n const indexQuery = async (args, options) => {\n return _indexQuery(client, modelIntrospection, model, indexMeta, {\n ...args,\n ...options,\n });\n };\n return context ? indexQueryWithContext : indexQuery;\n}\nfunction processGraphQlResponse(result, selectionSet, modelInitializer) {\n const { data, extensions } = result;\n const [key] = Object.keys(data);\n if (data[key].items) {\n const flattenedResult = flattenItems(data)[key];\n return {\n data: selectionSet ? flattenedResult : modelInitializer(flattenedResult),\n nextToken: data[key].nextToken,\n extensions,\n };\n }\n return {\n data: data[key],\n nextToken: data[key].nextToken,\n extensions,\n };\n}\nfunction handleGraphQlError(error) {\n if (error.errors) {\n // graphql errors pass through\n return error;\n }\n else {\n // non-graphql errors re re-thrown\n throw error;\n }\n}\nasync function _indexQuery(client, modelIntrospection, model, indexMeta, args, contextSpec) {\n const { name } = model;\n const query = generateGraphQLDocument(modelIntrospection, name, 'INDEX_QUERY', args, indexMeta);\n const variables = buildGraphQLVariables(model, 'INDEX_QUERY', args, modelIntrospection, indexMeta);\n const auth = authModeParams(client, args);\n const modelInitializer = (flattenedResult) => initializeModel(client, name, flattenedResult, modelIntrospection, auth.authMode, auth.authToken, !!contextSpec);\n try {\n const headers = getCustomHeaders(client, args?.headers);\n const graphQlParams = {\n ...auth,\n query,\n variables,\n };\n const requestArgs = [graphQlParams, headers];\n if (contextSpec !== undefined) {\n requestArgs.unshift(contextSpec);\n }\n const response = (await client.graphql(...requestArgs));\n if (response.data !== undefined) {\n return processGraphQlResponse(response, args?.selectionSet, modelInitializer);\n }\n }\n catch (error) {\n return handleGraphQlError(error);\n }\n}\n"],"names":[],"mappings":";;AACO,SAAS,iBAAiB,CAAC,MAAM,EAAE,kBAAkB,EAAE,KAAK,EAAE,SAAS,EAAE,OAAO,GAAG,KAAK,EAAE;AACjG,IAAI,MAAM,qBAAqB,GAAG,OAAO,WAAW,EAAE,IAAI,EAAE,OAAO,KAAK;AACxE,QAAQ,OAAO,WAAW,CAAC,MAAM,EAAE,kBAAkB,EAAE,KAAK,EAAE,SAAS,EAAE;AACzE,YAAY,GAAG,IAAI;AACnB,YAAY,GAAG,OAAO;AACtB,SAAS,EAAE,WAAW,CAAC,CAAC;AACxB,KAAK,CAAC;AACN,IAAI,MAAM,UAAU,GAAG,OAAO,IAAI,EAAE,OAAO,KAAK;AAChD,QAAQ,OAAO,WAAW,CAAC,MAAM,EAAE,kBAAkB,EAAE,KAAK,EAAE,SAAS,EAAE;AACzE,YAAY,GAAG,IAAI;AACnB,YAAY,GAAG,OAAO;AACtB,SAAS,CAAC,CAAC;AACX,KAAK,CAAC;AACN,IAAI,OAAO,OAAO,GAAG,qBAAqB,GAAG,UAAU,CAAC;AACxD,CAAC;AACD,SAAS,sBAAsB,CAAC,MAAM,EAAE,YAAY,EAAE,gBAAgB,EAAE;AACxE,IAAI,MAAM,EAAE,IAAI,EAAE,UAAU,EAAE,GAAG,MAAM,CAAC;AACxC,IAAI,MAAM,CAAC,GAAG,CAAC,GAAG,MAAM,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;AACpC,IAAI,IAAI,IAAI,CAAC,GAAG,CAAC,CAAC,KAAK,EAAE;AACzB,QAAQ,MAAM,eAAe,GAAG,YAAY,CAAC,IAAI,CAAC,CAAC,GAAG,CAAC,CAAC;AACxD,Q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,QAAQ,MAAM,OAAO,GAAG,gBAAgB,CAAC,MAAM,EAAE,IAAI,EAAE,OAAO,CAAC,CAAC;AAChE,QAAQ,MAAM,aAAa,GAAG;AAC9B,YAAY,GAAG,IAAI;AACnB,YAAY,KAAK;AACjB,YAAY,SAAS;AACrB,SAAS,CAAC;AACV,QAAQ,MAAM,WAAW,GAAG,CAAC,aAAa,EAAE,OAAO,CAAC,CAAC;AACrD,QAAQ,IAAI,WAAW,KAAK,SAAS,EAAE;AACvC,YAAY,WAAW,CAAC,OAAO,CAAC,WAAW,CAAC,CAAC;AAC7C,SAAS;AACT,QAAQ,MAAM,QAAQ,IAAI,MAAM,MAAM,CAAC,OAAO,CAAC,GAAG,WAAW,CAAC,CAAC,CAAC;AAChE,QAAQ,IAAI,QAAQ,CAAC,IAAI,KAAK,SAAS,EAAE;AACzC,YAAY,OAAO,sBAAsB,CAAC,QAAQ,EAAE,IAAI,EAAE,YAAY,EAAE,gBAAgB,CAAC,CAAC;AAC1F,SAAS;AACT,KAAK;AACL,IAAI,OAAO,KAAK,EAAE;AAClB,QAAQ,OAAO,kBAAkB,CAAC,KAAK,CAAC,CAAC;AACzC,KAAK;AACL;;;;"}
@@ -11,7 +11,7 @@ function listFactory(client, modelIntrospection, model, context = false) {
11
11
  }
12
12
  async function _list(client, modelIntrospection, model, args, contextSpec) {
13
13
  const { name } = model;
14
- const query = generateGraphQLDocument(modelIntrospection.models, name, 'LIST', args);
14
+ const query = generateGraphQLDocument(modelIntrospection, name, 'LIST', args);
15
15
  const variables = buildGraphQLVariables(model, 'LIST', args, modelIntrospection);
16
16
  try {
17
17
  const auth = authModeParams(client, args);
@@ -1 +1 @@
1
- {"version":3,"file":"list.mjs","sources":["../../../../src/internals/operations/list.ts"],"sourcesContent":["import { initializeModel, generateGraphQLDocument, buildGraphQLVariables, flattenItems, authModeParams, getCustomHeaders, } from '../APIClient';\nexport function listFactory(client, modelIntrospection, model, context = false) {\n const listWithContext = async (contextSpec, args) => {\n return _list(client, modelIntrospection, model, args, contextSpec);\n };\n const list = async (args) => {\n return _list(client, modelIntrospection, model, args);\n };\n return context ? listWithContext : list;\n}\nasync function _list(client, modelIntrospection, model, args, contextSpec) {\n const { name } = model;\n const query = generateGraphQLDocument(modelIntrospection.models, name, 'LIST', args);\n const variables = buildGraphQLVariables(model, 'LIST', args, modelIntrospection);\n try {\n const auth = authModeParams(client, args);\n const headers = getCustomHeaders(client, args?.headers);\n const { data, extensions } = !!contextSpec\n ? (await client.graphql(contextSpec, {\n ...auth,\n query,\n variables,\n }, headers))\n : (await client.graphql({\n ...auth,\n query,\n variables,\n }, headers));\n // flatten response\n if (data !== undefined) {\n const [key] = Object.keys(data);\n if (data[key].items) {\n const flattenedResult = flattenItems(data)[key];\n // don't init if custom selection set\n if (args?.selectionSet) {\n return {\n data: flattenedResult,\n nextToken: data[key].nextToken,\n extensions,\n };\n }\n else {\n const initialized = initializeModel(client, name, flattenedResult, modelIntrospection, auth.authMode, auth.authToken, !!contextSpec);\n return {\n data: initialized,\n nextToken: data[key].nextToken,\n extensions,\n };\n }\n }\n return {\n data: data[key],\n nextToken: data[key].nextToken,\n extensions,\n };\n }\n }\n catch (error) {\n if (error.errors) {\n // graphql errors pass through\n return error;\n }\n else {\n // non-graphql errors re re-thrown\n throw error;\n }\n }\n}\n"],"names":[],"mappings":";;AACO,SAAS,WAAW,CAAC,MAAM,EAAE,kBAAkB,EAAE,KAAK,EAAE,OAAO,GAAG,KAAK,EAAE;AAChF,IAAI,MAAM,eAAe,GAAG,OAAO,WAAW,EAAE,IAAI,KAAK;AACzD,QAAQ,OAAO,KAAK,CAAC,MAAM,EAAE,kBAAkB,EAAE,KAAK,EAAE,IAAI,EAAE,WAAW,CAAC,CAAC;AAC3E,KAAK,CAAC;AACN,IAAI,MAAM,IAAI,GAAG,OAAO,IAAI,KAAK;AACjC,QAAQ,OAAO,KAAK,CAAC,MAAM,EAAE,kBAAkB,EAAE,KAAK,EAAE,IAAI,CAAC,CAAC;AAC9D,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,CAAC,CAAC,GAAG,CAAC,CAAC;AAChE;AACA,gBAAgB,IAAI,IAAI,EAAE,YAAY,EAAE;AACxC,oBAAoB,OAAO;AAC3B,wBAAwB,IAAI,EAAE,eAAe;AAC7C,wBAAwB,SAAS,EAAE,IAAI,CAAC,GAAG,CAAC,CAAC,SAAS;AACtD,wBAAwB,UAAU;AAClC,qBAAqB,CAAC;AACtB,iBAAiB;AACjB,qBAAqB;AACrB,oBAAoB,MAAM,WAAW,GAAG,eAAe,CAAC,MAAM,EAAE,IAAI,EAAE,eAAe,EAAE,kBAAkB,EAAE,IAAI,CAAC,QAAQ,EAAE,IAAI,CAAC,SAAS,EAAE,CAAC,CAAC,WAAW,CAAC,CAAC;AACzJ,oBAAoB,OAAO;AAC3B,wBAAwB,IAAI,EAAE,WAAW;AACzC,wBAAwB,SAAS,EAAE,IAAI,CAAC,GAAG,CAAC,CAAC,SAAS;AACtD,wBAAwB,UAAU;AAClC,qBAAqB,CAAC;AACtB,iBAAiB;AACjB,aAAa;AACb,YAAY,OAAO;AACnB,gBAAgB,IAAI,EAAE,IAAI,CAAC,GAAG,CAAC;AAC/B,gBAAgB,SAAS,EAAE,IAAI,CAAC,GAAG,CAAC,CAAC,SAAS;AAC9C,gBAAgB,UAAU;AAC1B,aAAa,CAAC;AACd,SAAS;AACT,KAAK;AACL,IAAI,OAAO,KAAK,EAAE;AAClB,QAAQ,IAAI,KAAK,CAAC,MAAM,EAAE;AAC1B;AACA,YAAY,OAAO,KAAK,CAAC;AACzB,SAAS;AACT,aAAa;AACb;AACA,YAAY,MAAM,KAAK,CAAC;AACxB,SAAS;AACT,KAAK;AACL;;;;"}
1
+ {"version":3,"file":"list.mjs","sources":["../../../../src/internals/operations/list.ts"],"sourcesContent":["import { initializeModel, generateGraphQLDocument, buildGraphQLVariables, flattenItems, authModeParams, getCustomHeaders, } from '../APIClient';\nexport function listFactory(client, modelIntrospection, model, context = false) {\n const listWithContext = async (contextSpec, args) => {\n return _list(client, modelIntrospection, model, args, contextSpec);\n };\n const list = async (args) => {\n return _list(client, modelIntrospection, model, args);\n };\n return context ? listWithContext : list;\n}\nasync function _list(client, modelIntrospection, model, args, contextSpec) {\n const { name } = model;\n const query = generateGraphQLDocument(modelIntrospection, name, 'LIST', args);\n const variables = buildGraphQLVariables(model, 'LIST', args, modelIntrospection);\n try {\n const auth = authModeParams(client, args);\n const headers = getCustomHeaders(client, args?.headers);\n const { data, extensions } = !!contextSpec\n ? (await client.graphql(contextSpec, {\n ...auth,\n query,\n variables,\n }, headers))\n : (await client.graphql({\n ...auth,\n query,\n variables,\n }, headers));\n // flatten response\n if (data !== undefined) {\n const [key] = Object.keys(data);\n if (data[key].items) {\n const flattenedResult = flattenItems(data)[key];\n // don't init if custom selection set\n if (args?.selectionSet) {\n return {\n data: flattenedResult,\n nextToken: data[key].nextToken,\n extensions,\n };\n }\n else {\n const initialized = initializeModel(client, name, flattenedResult, modelIntrospection, auth.authMode, auth.authToken, !!contextSpec);\n return {\n data: initialized,\n nextToken: data[key].nextToken,\n extensions,\n };\n }\n }\n return {\n data: data[key],\n nextToken: data[key].nextToken,\n extensions,\n };\n }\n }\n catch (error) {\n if (error.errors) {\n // graphql errors pass through\n return error;\n }\n else {\n // non-graphql errors re re-thrown\n throw error;\n }\n }\n}\n"],"names":[],"mappings":";;AACO,SAAS,WAAW,CAAC,MAAM,EAAE,kBAAkB,EAAE,KAAK,EAAE,OAAO,GAAG,KAAK,EAAE;AAChF,IAAI,MAAM,eAAe,GAAG,OAAO,WAAW,EAAE,IAAI,KAAK;AACzD,QAAQ,OAAO,KAAK,CAAC,MAAM,EAAE,kBAAkB,EAAE,KAAK,EAAE,IAAI,EAAE,WAAW,CAAC,CAAC;AAC3E,KAAK,CAAC;AACN,IAAI,MAAM,IAAI,GAAG,OAAO,IAAI,KAAK;AACjC,QAAQ,OAAO,KAAK,CAAC,MAAM,EAAE,kBAAkB,EAAE,KAAK,EAAE,IAAI,CAAC,CAAC;AAC9D,KAAK,CAAC;A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CAAC;AAChE;AACA,gBAAgB,IAAI,IAAI,EAAE,YAAY,EAAE;AACxC,oBAAoB,OAAO;AAC3B,wBAAwB,IAAI,EAAE,eAAe;AAC7C,wBAAwB,SAAS,EAAE,IAAI,CAAC,GAAG,CAAC,CAAC,SAAS;AACtD,wBAAwB,UAAU;AAClC,qBAAqB,CAAC;AACtB,iBAAiB;AACjB,qBAAqB;AACrB,oBAAoB,MAAM,WAAW,GAAG,eAAe,CAAC,MAAM,EAAE,IAAI,EAAE,eAAe,EAAE,kBAAkB,EAAE,IAAI,CAAC,QAAQ,EAAE,IAAI,CAAC,SAAS,EAAE,CAAC,CAAC,WAAW,CAAC,CAAC;AACzJ,oBAAoB,OAAO;AAC3B,wBAAwB,IAAI,EAAE,WAAW;AACzC,wBAAwB,SAAS,EAAE,IAAI,CAAC,GAAG,CAAC,CAAC,SAAS;AACtD,wBAAwB,UAAU;AAClC,qBAAqB,CAAC;AACtB,iBAAiB;AACjB,aAAa;AACb,YAAY,OAAO;AACnB,gBAAgB,IAAI,EAAE,IAAI,CAAC,GAAG,CAAC;AAC/B,gBAAgB,SAAS,EAAE,IAAI,CAAC,GAAG,CAAC,CAAC,SAAS;AAC9C,gBAAgB,UAAU;AAC1B,aAAa,CAAC;AACd,SAAS;AACT,KAAK;AACL,IAAI,OAAO,KAAK,EAAE;AAClB,QAAQ,IAAI,KAAK,CAAC,MAAM,EAAE;AAC1B;AACA,YAAY,OAAO,KAAK,CAAC;AACzB,SAAS;AACT,aAAa;AACb;AACA,YAAY,MAAM,KAAK,CAAC;AACxB,SAAS;AACT,KAAK;AACL;;;;"}
@@ -6,7 +6,7 @@ import { generateGraphQLDocument, buildGraphQLVariables, authModeParams, getCust
6
6
  function subscriptionFactory(client, modelIntrospection, model, operation) {
7
7
  const { name } = model;
8
8
  const subscription = (args) => {
9
- const query = generateGraphQLDocument(modelIntrospection.models, name, operation);
9
+ const query = generateGraphQLDocument(modelIntrospection, name, operation, args);
10
10
  const variables = buildGraphQLVariables(model, operation, args, modelIntrospection);
11
11
  const auth = authModeParams(client, args);
12
12
  const headers = getCustomHeaders(client, args?.headers);
@@ -1 +1 @@
1
- {"version":3,"file":"subscription.mjs","sources":["../../../../src/internals/operations/subscription.ts"],"sourcesContent":["// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\nimport { map } from 'rxjs';\nimport { initializeModel, generateGraphQLDocument, buildGraphQLVariables, authModeParams, getCustomHeaders, } from '../APIClient';\nexport function subscriptionFactory(client, modelIntrospection, model, operation) {\n const { name } = model;\n const subscription = (args) => {\n const query = generateGraphQLDocument(modelIntrospection.models, name, operation);\n const variables = buildGraphQLVariables(model, operation, args, modelIntrospection);\n const auth = authModeParams(client, args);\n const headers = getCustomHeaders(client, args?.headers);\n const observable = client.graphql({\n ...auth,\n query,\n variables,\n }, headers);\n return observable.pipe(map(value => {\n const [key] = Object.keys(value.data);\n const data = value.data[key];\n const [initialized] = initializeModel(client, name, [data], modelIntrospection, auth.authMode, auth.authToken);\n return initialized;\n }));\n };\n return subscription;\n}\n"],"names":[],"mappings":";;;AAAA;AACA;AAGO,SAAS,mBAAmB,CAAC,MAAM,EAAE,kBAAkB,EAAE,KAAK,EAAE,SAAS,EAAE;AAClF,IAAI,MAAM,EAAE,IAAI,EAAE,GAAG,KAAK,CAAC;AAC3B,IAAI,MAAM,YAAY,GAAG,CAAC,IAAI,KAAK;AACnC,QAAQ,MAAM,KAAK,GAAG,uBAAuB,CAAC,kBAAkB,CAAC,MAAM,EAAE,IAAI,EAAE,SAAS,CAAC,CAAC;AAC1F,QAAQ,MAAM,SAAS,GAAG,qBAAqB,CAAC,KAAK,EAAE,SAAS,EAAE,IAAI,EAAE,kBAAkB,CAAC,CAAC;AAC5F,QAAQ,MAAM,IAAI,GAAG,cAAc,CAAC,MAAM,EAAE,IAAI,CAAC,CAAC;AAClD,QAAQ,MAAM,OAAO,GAAG,gBAAgB,CAAC,MAAM,EAAE,IAAI,EAAE,OAAO,CAAC,CAAC;AAChE,QAAQ,MAAM,UAAU,GAAG,MAAM,CAAC,OAAO,CAAC;AAC1C,YAAY,GAAG,IAAI;AACnB,YAAY,KAAK;AACjB,YAAY,SAAS;AACrB,SAAS,EAAE,OAAO,CAAC,CAAC;AACpB,QAAQ,OAAO,UAAU,CAAC,IAAI,CAAC,GAAG,CAAC,KAAK,IAAI;AAC5C,YAAY,MAAM,CAAC,GAAG,CAAC,GAAG,MAAM,CAAC,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC;AAClD,YAAY,MAAM,IAAI,GAAG,KAAK,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;AACzC,YAAY,MAAM,CAAC,WAAW,CAAC,GAAG,eAAe,CAAC,MAAM,EAAE,IAAI,EAAE,CAAC,IAAI,CAAC,EAAE,kBAAkB,EAAE,IAAI,CAAC,QAAQ,EAAE,IAAI,CAAC,SAAS,CAAC,CAAC;AAC3H,YAAY,OAAO,WAAW,CAAC;AAC/B,SAAS,CAAC,CAAC,CAAC;AACZ,KAAK,CAAC;AACN,IAAI,OAAO,YAAY,CAAC;AACxB;;;;"}
1
+ {"version":3,"file":"subscription.mjs","sources":["../../../../src/internals/operations/subscription.ts"],"sourcesContent":["// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\nimport { map } from 'rxjs';\nimport { initializeModel, generateGraphQLDocument, buildGraphQLVariables, authModeParams, getCustomHeaders, } from '../APIClient';\nexport function subscriptionFactory(client, modelIntrospection, model, operation) {\n const { name } = model;\n const subscription = (args) => {\n const query = generateGraphQLDocument(modelIntrospection, name, operation, args);\n const variables = buildGraphQLVariables(model, operation, args, modelIntrospection);\n const auth = authModeParams(client, args);\n const headers = getCustomHeaders(client, args?.headers);\n const observable = client.graphql({\n ...auth,\n query,\n variables,\n }, headers);\n return observable.pipe(map(value => {\n const [key] = Object.keys(value.data);\n const data = value.data[key];\n const [initialized] = initializeModel(client, name, [data], modelIntrospection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CAAC,CAAC,CAAC;AACZ,KAAK,CAAC;AACN,IAAI,OAAO,YAAY,CAAC;AACxB;;;;"}
@@ -2,7 +2,10 @@ import '../InternalGraphQLAPI.mjs';
2
2
  import { graphql, cancel, isCancelError } from '../v6.mjs';
3
3
  import '../generateClient.mjs';
4
4
  import { generateModelsProperty } from './generateModelsProperty.mjs';
5
- import { __amplify, __authMode, __authToken } from '../../types/index.mjs';
5
+ import { __amplify, __authMode, __authToken, __headers } from '../../types/index.mjs';
6
+ import { isApiGraphQLConfig } from '../utils/isApiGraphQLProviderConfig.mjs';
7
+ import { generateEnumsProperty } from '../utils/generateEnumsProperty.mjs';
8
+ import { generateCustomQueriesProperty, generateCustomMutationsProperty } from '../generateCustomOperationsProperty.mjs';
6
9
 
7
10
  // Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
8
11
  // SPDX-License-Identifier: Apache-2.0
@@ -22,11 +25,18 @@ function generateClientWithAmplifyInstance(params) {
22
25
  [__amplify]: params.amplify,
23
26
  [__authMode]: params.authMode,
24
27
  [__authToken]: params.authToken,
28
+ [__headers]: params.headers,
25
29
  graphql,
26
30
  cancel,
27
31
  isCancelError,
28
32
  };
29
- client.models = generateModelsProperty(client, params);
33
+ const apiGraphqlConfig = params.config?.API?.GraphQL;
34
+ if (isApiGraphQLConfig(apiGraphqlConfig)) {
35
+ client.models = generateModelsProperty(client, params);
36
+ client.enums = generateEnumsProperty(apiGraphqlConfig);
37
+ client.queries = generateCustomQueriesProperty(client, apiGraphqlConfig);
38
+ client.mutations = generateCustomMutationsProperty(client, apiGraphqlConfig);
39
+ }
30
40
  return client;
31
41
  }
32
42
 
@@ -1 +1 @@
1
- {"version":3,"file":"generateClientWithAmplifyInstance.mjs","sources":["../../../../src/internals/server/generateClientWithAmplifyInstance.ts"],"sourcesContent":["// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\nimport { graphql, cancel, isCancelError } from '..';\nimport { generateModelsProperty } from './generateModelsProperty';\nimport { __amplify, __authMode, __authToken, } from '../../types';\n/**\n * @private\n *\n * Used internally by `adapter-nextjs` package.\n *\n * Creates a client that can be used to make GraphQL requests, using a provided `AmplifyClassV6`\n * compatible context object for config and auth fetching.\n *\n * @param params\n * @returns\n */\nexport function generateClientWithAmplifyInstance(params) {\n const client = {\n [__amplify]: params.amplify,\n [__authMode]: params.authMode,\n [__authToken]: params.authToken,\n graphql,\n cancel,\n isCancelError,\n };\n client.models = generateModelsProperty(client, params);\n return client;\n}\n"],"names":[],"mappings":";;;;;;AAAA;AACA;AAIA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACO,SAAS,iCAAiC,CAAC,MAAM,EAAE;AAC1D,IAAI,MAAM,MAAM,GAAG;AACnB,QAAQ,CAAC,SAAS,GAAG,MAAM,CAAC,OAAO;AACnC,QAAQ,CAAC,UAAU,GAAG,MAAM,CAAC,QAAQ;AACrC,QAAQ,CAAC,WAAW,GAAG,MAAM,CAAC,SAAS;AACvC,QAAQ,OAAO;AACf,QAAQ,MAAM;AACd,QAAQ,aAAa;AACrB,KAAK,CAAC;AACN,IAAI,MAAM,CAAC,MAAM,GAAG,sBAAsB,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;AAC3D,IAAI,OAAO,MAAM,CAAC;AAClB;;;;"}
1
+ {"version":3,"file":"generateClientWithAmplifyInstance.mjs","sources":["../../../../src/internals/server/generateClientWithAmplifyInstance.ts"],"sourcesContent":["// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\nimport { graphql, cancel, isCancelError } from '..';\nimport { generateModelsProperty } from './generateModelsProperty';\nimport { __amplify, __authMode, __authToken, __headers, } from '../../types';\nimport { isApiGraphQLConfig } from '../utils/isApiGraphQLProviderConfig';\nimport { generateEnumsProperty } from '../utils/generateEnumsProperty';\nimport { generateCustomMutationsProperty, generateCustomQueriesProperty, } from '../generateCustomOperationsProperty';\n/**\n * @private\n *\n * Used internally by `adapter-nextjs` package.\n *\n * Creates a client that can be used to make GraphQL requests, using a provided `AmplifyClassV6`\n * compatible context object for config and auth fetching.\n *\n * @param params\n * @returns\n */\nexport function generateClientWithAmplifyInstance(params) {\n const client = {\n [__amplify]: params.amplify,\n [__authMode]: params.authMode,\n [__authToken]: params.authToken,\n [__headers]: params.headers,\n graphql,\n cancel,\n isCancelError,\n };\n const apiGraphqlConfig = params.config?.API?.GraphQL;\n if (isApiGraphQLConfig(apiGraphqlConfig)) {\n client.models = generateModelsProperty(client, params);\n client.enums = generateEnumsProperty(apiGraphqlConfig);\n client.queries = generateCustomQueriesProperty(client, apiGraphqlConfig);\n client.mutations = generateCustomMutationsProperty(client, apiGraphqlConfig);\n }\n return client;\n}\n"],"names":[],"mappings":";;;;;;;;;AAAA;AACA;AAOA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACO,SAAS,iCAAiC,CAAC,MAAM,EAAE;AAC1D,IAAI,MAAM,MAAM,GAAG;AACnB,QAAQ,CAAC,SAAS,GAAG,MAAM,CAAC,OAAO;AACnC,QAAQ,CAAC,UAAU,GAAG,MAAM,CAAC,QAAQ;AACrC,QAAQ,CAAC,WAAW,GAAG,MAAM,CAAC,SAAS;AACvC,QAAQ,CAAC,SAAS,GAAG,MAAM,CAAC,OAAO;AACnC,QAAQ,OAAO;AACf,QAAQ,MAAM;AACd,QAAQ,aAAa;AACrB,KAAK,CAAC;AACN,IAAI,MAAM,gBAAgB,GAAG,MAAM,CAAC,MAAM,EAAE,GAAG,EAAE,OAAO,CAAC;AACzD,IAAI,IAAI,kBAAkB,CAAC,gBAAgB,CAAC,EAAE;AAC9C,QAAQ,MAAM,CAAC,MAAM,GAAG,sBAAsB,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;AAC/D,QAAQ,MAAM,CAAC,KAAK,GAAG,qBAAqB,CAAC,gBAAgB,CAAC,CAAC;AAC/D,QAAQ,MAAM,CAAC,OAAO,GAAG,6BAA6B,CAAC,MAAM,EAAE,gBAAgB,CAAC,CAAC;AACjF,QAAQ,MAAM,CAAC,SAAS,GAAG,+BAA+B,CAAC,MAAM,EAAE,gBAAgB,CAAC,CAAC;AACrF,KAAK;AACL,IAAI,OAAO,MAAM,CAAC;AAClB;;;;"}
@@ -1,5 +1,5 @@
1
1
  import { AmplifyClassV6, ResourcesConfig } from '@aws-amplify/core';
2
- import { ModelTypes, CustomHeaders, EnumTypes } from '@aws-amplify/data-schema-types';
2
+ import { EnumTypes, ModelTypes, CustomHeaders, CustomQueries, CustomMutations } from '@aws-amplify/data-schema-types';
3
3
  import { Source, DocumentNode, GraphQLError } from 'graphql';
4
4
  export { OperationTypeNode } from 'graphql';
5
5
  import { Observable } from 'rxjs';
@@ -295,6 +295,8 @@ export type V6Client<T extends Record<any, any> = never> = ExcludeNeverFields<{
295
295
  isCancelError: (error: any) => boolean;
296
296
  models: ModelTypes<T>;
297
297
  enums: EnumTypes<T>;
298
+ queries: CustomQueries<T>;
299
+ mutations: CustomMutations<T>;
298
300
  }>;
299
301
  export type V6ClientSSRRequest<T extends Record<any, any> = never> = ExcludeNeverFields<{
300
302
  [__amplify]: AmplifyClassV6;
@@ -305,6 +307,9 @@ export type V6ClientSSRRequest<T extends Record<any, any> = never> = ExcludeNeve
305
307
  cancel: (promise: Promise<any>, message?: string) => boolean;
306
308
  isCancelError: (error: any) => boolean;
307
309
  models: ModelTypes<T, 'REQUEST'>;
310
+ enums: EnumTypes<T>;
311
+ queries: CustomQueries<T, 'REQUEST'>;
312
+ mutations: CustomMutations<T, 'REQUEST'>;
308
313
  }>;
309
314
  export type V6ClientSSRCookies<T extends Record<any, any> = never> = ExcludeNeverFields<{
310
315
  [__amplify]: AmplifyClassV6;
@@ -315,6 +320,9 @@ export type V6ClientSSRCookies<T extends Record<any, any> = never> = ExcludeNeve
315
320
  cancel: (promise: Promise<any>, message?: string) => boolean;
316
321
  isCancelError: (error: any) => boolean;
317
322
  models: ModelTypes<T, 'COOKIES'>;
323
+ enums: EnumTypes<T>;
324
+ queries: CustomQueries<T, 'COOKIES'>;
325
+ mutations: CustomMutations<T, 'COOKIES'>;
318
326
  }>;
319
327
  export type GraphQLMethod = <FALLBACK_TYPES = unknown, TYPED_GQL_STRING extends string = string>(options: GraphQLOptionsV6<FALLBACK_TYPES, TYPED_GQL_STRING>, additionalHeaders?: CustomHeaders | undefined) => GraphQLResponseV6<FALLBACK_TYPES, TYPED_GQL_STRING>;
320
328
  export type GraphQLMethodSSR = <FALLBACK_TYPES = unknown, TYPED_GQL_STRING extends string = string>(contextSpec: AmplifyServer.ContextSpec, options: GraphQLOptionsV6<FALLBACK_TYPES, TYPED_GQL_STRING>, additionalHeaders?: CustomHeaders | undefined) => GraphQLResponseV6<FALLBACK_TYPES, TYPED_GQL_STRING>;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@aws-amplify/api-graphql",
3
- "version": "4.0.18-unstable.b758843.0+b758843",
3
+ "version": "4.0.18",
4
4
  "description": "Api-graphql category of aws-amplify",
5
5
  "main": "./dist/cjs/index.js",
6
6
  "module": "./dist/esm/index.mjs",
@@ -71,7 +71,7 @@
71
71
  },
72
72
  "homepage": "https://aws-amplify.github.io/",
73
73
  "devDependencies": {
74
- "@aws-amplify/data-schema": "^0.13.2",
74
+ "@aws-amplify/data-schema": "^0.13.6",
75
75
  "@rollup/plugin-typescript": "11.1.5",
76
76
  "rollup": "^4.9.6",
77
77
  "typescript": "5.0.2"
@@ -84,9 +84,9 @@
84
84
  "server"
85
85
  ],
86
86
  "dependencies": {
87
- "@aws-amplify/api-rest": "4.0.18-unstable.b758843.0+b758843",
88
- "@aws-amplify/core": "6.0.18-unstable.b758843.0+b758843",
89
- "@aws-amplify/data-schema-types": "^0.7.2",
87
+ "@aws-amplify/api-rest": "4.0.18",
88
+ "@aws-amplify/core": "6.0.18",
89
+ "@aws-amplify/data-schema-types": "^0.7.5",
90
90
  "@aws-sdk/types": "3.387.0",
91
91
  "graphql": "15.8.0",
92
92
  "rxjs": "^7.8.1",
@@ -101,5 +101,5 @@
101
101
  "limit": "91.7 kB"
102
102
  }
103
103
  ],
104
- "gitHead": "b758843635c9abeb6348723e48852c3a58af569e"
104
+ "gitHead": "27ee4e14d5ba091a827ca49e9e04f15e26bb1445"
105
105
  }