@aws-amplify/api-graphql 4.0.19 → 4.0.20-api-graphql-eslint.dd94c10.0

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 (127) hide show
  1. package/dist/cjs/Providers/AWSAppSyncRealTimeProvider/index.js +40 -31
  2. package/dist/cjs/Providers/AWSAppSyncRealTimeProvider/index.js.map +1 -1
  3. package/dist/cjs/internals/APIClient.js +36 -20
  4. package/dist/cjs/internals/APIClient.js.map +1 -1
  5. package/dist/cjs/internals/InternalGraphQLAPI.js +10 -9
  6. package/dist/cjs/internals/InternalGraphQLAPI.js.map +1 -1
  7. package/dist/cjs/internals/generateClient.js +5 -5
  8. package/dist/cjs/internals/generateClient.js.map +1 -1
  9. package/dist/cjs/internals/operations/custom.js +4 -20
  10. package/dist/cjs/internals/operations/custom.js.map +1 -1
  11. package/dist/cjs/internals/operations/list.js +1 -1
  12. package/dist/cjs/internals/operations/list.js.map +1 -1
  13. package/dist/cjs/internals/server/generateClientWithAmplifyInstance.js +3 -3
  14. package/dist/cjs/internals/server/generateClientWithAmplifyInstance.js.map +1 -1
  15. package/dist/cjs/internals/server/generateModelsProperty.js +1 -1
  16. package/dist/cjs/internals/server/generateModelsProperty.js.map +1 -1
  17. package/dist/cjs/internals/utils/clientProperties/generateEnumsProperty.js.map +1 -0
  18. package/dist/cjs/internals/utils/{generateModelsProperty.js → clientProperties/generateModelsProperty.js} +7 -7
  19. package/dist/cjs/internals/utils/clientProperties/generateModelsProperty.js.map +1 -0
  20. package/dist/cjs/internals/utils/runtimeTypeGuards/isApiGraphQLProviderConfig.js.map +1 -0
  21. package/dist/cjs/internals/utils/runtimeTypeGuards/isConfigureEventWithResourceConfig.js.map +1 -0
  22. package/dist/cjs/internals/v6.js +0 -2
  23. package/dist/cjs/internals/v6.js.map +1 -1
  24. package/dist/cjs/utils/errors/repackageAuthError.js +1 -1
  25. package/dist/cjs/utils/errors/repackageAuthError.js.map +1 -1
  26. package/dist/esm/GraphQLAPI.d.ts +2 -2
  27. package/dist/esm/GraphQLAPI.mjs.map +1 -1
  28. package/dist/esm/Providers/AWSAppSyncRealTimeProvider/index.d.ts +8 -8
  29. package/dist/esm/Providers/AWSAppSyncRealTimeProvider/index.mjs +40 -31
  30. package/dist/esm/Providers/AWSAppSyncRealTimeProvider/index.mjs.map +1 -1
  31. package/dist/esm/internals/APIClient.d.ts +6 -5
  32. package/dist/esm/internals/APIClient.mjs +35 -20
  33. package/dist/esm/internals/APIClient.mjs.map +1 -1
  34. package/dist/esm/internals/InternalGraphQLAPI.d.ts +1 -1
  35. package/dist/esm/internals/InternalGraphQLAPI.mjs +10 -9
  36. package/dist/esm/internals/InternalGraphQLAPI.mjs.map +1 -1
  37. package/dist/esm/internals/generateClient.mjs +5 -5
  38. package/dist/esm/internals/generateClient.mjs.map +1 -1
  39. package/dist/esm/internals/generateCustomOperationsProperty.d.ts +2 -2
  40. package/dist/esm/internals/operations/custom.d.ts +1 -1
  41. package/dist/esm/internals/operations/custom.mjs +5 -21
  42. package/dist/esm/internals/operations/custom.mjs.map +1 -1
  43. package/dist/esm/internals/operations/get.d.ts +1 -1
  44. package/dist/esm/internals/operations/get.mjs.map +1 -1
  45. package/dist/esm/internals/operations/indexQuery.d.ts +3 -3
  46. package/dist/esm/internals/operations/indexQuery.mjs.map +1 -1
  47. package/dist/esm/internals/operations/list.d.ts +1 -1
  48. package/dist/esm/internals/operations/list.mjs +1 -1
  49. package/dist/esm/internals/operations/list.mjs.map +1 -1
  50. package/dist/esm/internals/operations/subscription.d.ts +1 -1
  51. package/dist/esm/internals/operations/subscription.mjs.map +1 -1
  52. package/dist/esm/internals/server/generateClientWithAmplifyInstance.d.ts +1 -1
  53. package/dist/esm/internals/server/generateClientWithAmplifyInstance.mjs +3 -3
  54. package/dist/esm/internals/server/generateClientWithAmplifyInstance.mjs.map +1 -1
  55. package/dist/esm/internals/server/generateModelsProperty.d.ts +1 -2
  56. package/dist/esm/internals/server/generateModelsProperty.mjs +1 -1
  57. package/dist/esm/internals/server/generateModelsProperty.mjs.map +1 -1
  58. package/dist/esm/internals/types.d.ts +2 -2
  59. package/dist/esm/internals/utils/clientProperties/generateEnumsProperty.mjs.map +1 -0
  60. package/dist/esm/internals/utils/{generateModelsProperty.d.ts → clientProperties/generateModelsProperty.d.ts} +1 -1
  61. package/dist/esm/internals/utils/{generateModelsProperty.mjs → clientProperties/generateModelsProperty.mjs} +7 -7
  62. package/dist/esm/internals/utils/clientProperties/generateModelsProperty.mjs.map +1 -0
  63. package/dist/esm/internals/utils/runtimeTypeGuards/isApiGraphQLProviderConfig.mjs.map +1 -0
  64. package/dist/esm/internals/utils/runtimeTypeGuards/isConfigureEventWithResourceConfig.mjs.map +1 -0
  65. package/dist/esm/internals/v6.d.ts +1 -1
  66. package/dist/esm/internals/v6.mjs +0 -2
  67. package/dist/esm/internals/v6.mjs.map +1 -1
  68. package/dist/esm/types/index.d.ts +33 -35
  69. package/dist/esm/utils/ConnectionStateMonitor.d.ts +2 -2
  70. package/dist/esm/utils/ConnectionStateMonitor.mjs.map +1 -1
  71. package/dist/esm/utils/ReachabilityMonitor/index.native.mjs.map +1 -1
  72. package/dist/esm/utils/errors/repackageAuthError.d.ts +2 -2
  73. package/dist/esm/utils/errors/repackageAuthError.mjs +1 -1
  74. package/dist/esm/utils/errors/repackageAuthError.mjs.map +1 -1
  75. package/dist/esm/utils/findIndexByFields.d.ts +1 -1
  76. package/package.json +8 -7
  77. package/src/GraphQLAPI.ts +4 -3
  78. package/src/Providers/AWSAppSyncRealTimeProvider/index.ts +84 -64
  79. package/src/internals/APIClient.ts +60 -28
  80. package/src/internals/InternalGraphQLAPI.ts +26 -30
  81. package/src/internals/clientUtils.ts +1 -1
  82. package/src/internals/generateClient.ts +13 -11
  83. package/src/internals/generateCustomOperationsProperty.ts +7 -6
  84. package/src/internals/operations/custom.ts +21 -35
  85. package/src/internals/operations/get.ts +9 -8
  86. package/src/internals/operations/indexQuery.ts +12 -11
  87. package/src/internals/operations/list.ts +11 -15
  88. package/src/internals/operations/observeQuery.ts +3 -1
  89. package/src/internals/operations/subscription.ts +12 -10
  90. package/src/internals/server/generateClientWithAmplifyInstance.ts +9 -9
  91. package/src/internals/server/generateModelsProperty.ts +7 -4
  92. package/src/internals/types.ts +2 -2
  93. package/src/internals/utils/{generateEnumsProperty.ts → clientProperties/generateEnumsProperty.ts} +7 -6
  94. package/src/internals/utils/{generateModelsProperty.ts → clientProperties/generateModelsProperty.ts} +10 -9
  95. package/src/internals/v6.ts +6 -4
  96. package/src/server/generateClient.ts +4 -1
  97. package/src/types/PubSub.ts +1 -0
  98. package/src/types/index.ts +51 -47
  99. package/src/utils/ConnectionStateMonitor.ts +8 -3
  100. package/src/utils/ReachabilityMonitor/index.native.ts +1 -1
  101. package/src/utils/ReachabilityMonitor/index.ts +1 -0
  102. package/src/utils/ReconnectionMonitor.ts +1 -0
  103. package/src/utils/errors/repackageAuthError.ts +6 -7
  104. package/src/utils/findIndexByFields.ts +1 -1
  105. package/src/utils/resolveConfig.ts +1 -0
  106. package/src/utils/resolveLibraryOptions.ts +1 -0
  107. package/src/utils/resolveOwnerFields.ts +7 -5
  108. package/src/utils/resolvePKFields.ts +1 -0
  109. package/dist/cjs/internals/utils/generateEnumsProperty.js.map +0 -1
  110. package/dist/cjs/internals/utils/generateModelsProperty.js.map +0 -1
  111. package/dist/cjs/internals/utils/isApiGraphQLProviderConfig.js.map +0 -1
  112. package/dist/cjs/internals/utils/isConfigureEventWithResourceConfig.js.map +0 -1
  113. package/dist/esm/internals/utils/generateEnumsProperty.mjs.map +0 -1
  114. package/dist/esm/internals/utils/generateModelsProperty.mjs.map +0 -1
  115. package/dist/esm/internals/utils/isApiGraphQLProviderConfig.mjs.map +0 -1
  116. package/dist/esm/internals/utils/isConfigureEventWithResourceConfig.mjs.map +0 -1
  117. /package/dist/cjs/internals/utils/{generateEnumsProperty.js → clientProperties/generateEnumsProperty.js} +0 -0
  118. /package/dist/cjs/internals/utils/{isApiGraphQLProviderConfig.js → runtimeTypeGuards/isApiGraphQLProviderConfig.js} +0 -0
  119. /package/dist/cjs/internals/utils/{isConfigureEventWithResourceConfig.js → runtimeTypeGuards/isConfigureEventWithResourceConfig.js} +0 -0
  120. /package/dist/esm/internals/utils/{generateEnumsProperty.d.ts → clientProperties/generateEnumsProperty.d.ts} +0 -0
  121. /package/dist/esm/internals/utils/{generateEnumsProperty.mjs → clientProperties/generateEnumsProperty.mjs} +0 -0
  122. /package/dist/esm/internals/utils/{isApiGraphQLProviderConfig.d.ts → runtimeTypeGuards/isApiGraphQLProviderConfig.d.ts} +0 -0
  123. /package/dist/esm/internals/utils/{isApiGraphQLProviderConfig.mjs → runtimeTypeGuards/isApiGraphQLProviderConfig.mjs} +0 -0
  124. /package/dist/esm/internals/utils/{isConfigureEventWithResourceConfig.d.ts → runtimeTypeGuards/isConfigureEventWithResourceConfig.d.ts} +0 -0
  125. /package/dist/esm/internals/utils/{isConfigureEventWithResourceConfig.mjs → runtimeTypeGuards/isConfigureEventWithResourceConfig.mjs} +0 -0
  126. /package/src/internals/utils/{isApiGraphQLProviderConfig.ts → runtimeTypeGuards/isApiGraphQLProviderConfig.ts} +0 -0
  127. /package/src/internals/utils/{isConfigureEventWithResourceConfig.ts → runtimeTypeGuards/isConfigureEventWithResourceConfig.ts} +0 -0
@@ -1,14 +1,11 @@
1
1
  // Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
2
2
  // SPDX-License-Identifier: Apache-2.0
3
3
 
4
- import {
5
- AmplifyErrorParams,
6
- GraphQLAuthMode,
7
- } from '@aws-amplify/core/internals/utils';
4
+ import { AmplifyErrorParams } from '@aws-amplify/core/internals/utils';
8
5
 
9
- type ErrorObject = {
6
+ interface ErrorObject {
10
7
  errors: AmplifyErrorParams[];
11
- };
8
+ }
12
9
 
13
10
  /**
14
11
  * Checks to see if the given response or subscription message contains an
@@ -27,12 +24,13 @@ export function repackageUnauthError<T extends ErrorObject>(content: T): T {
27
24
  }
28
25
  });
29
26
  }
27
+
30
28
  return content;
31
29
  }
32
30
 
33
31
  function isUnauthError(error: any): boolean {
34
32
  // Error pattern corresponding to appsync calls
35
- if (error?.['originalError']?.['name']?.startsWith('UnauthorizedException')) {
33
+ if (error?.originalError?.name?.startsWith('UnauthorizedException')) {
36
34
  return true;
37
35
  }
38
36
  // Error pattern corresponding to appsync subscriptions
@@ -42,5 +40,6 @@ function isUnauthError(error: any): boolean {
42
40
  ) {
43
41
  return true;
44
42
  }
43
+
45
44
  return false;
46
45
  }
@@ -11,7 +11,7 @@
11
11
  export function findIndexByFields<T>(
12
12
  needle: T,
13
13
  haystack: T[],
14
- keyFields: Array<keyof T>,
14
+ keyFields: (keyof T)[],
15
15
  ): number {
16
16
  const searchObject = Object.fromEntries(
17
17
  keyFields.map(fieldName => [fieldName, needle[fieldName]]),
@@ -2,6 +2,7 @@
2
2
  // SPDX-License-Identifier: Apache-2.0
3
3
 
4
4
  import { AmplifyClassV6, ConsoleLogger } from '@aws-amplify/core';
5
+
5
6
  import { APIValidationErrorCode, assertValidationError } from './errors';
6
7
 
7
8
  const logger = new ConsoleLogger('GraphQLAPI resolveConfig');
@@ -9,5 +9,6 @@ import { AmplifyClassV6 } from '@aws-amplify/core';
9
9
  export const resolveLibraryOptions = (amplify: AmplifyClassV6) => {
10
10
  const headers = amplify.libraryOptions?.API?.GraphQL?.headers;
11
11
  const withCredentials = amplify.libraryOptions?.API?.GraphQL?.withCredentials;
12
+
12
13
  return { headers, withCredentials };
13
14
  };
@@ -9,20 +9,20 @@ type ModelIntrospectionSchema = Exclude<
9
9
  >;
10
10
  type Model = ModelIntrospectionSchema['models'][string];
11
11
 
12
- type AuthAttribute = {
12
+ interface AuthAttribute {
13
13
  type: 'auth';
14
14
  properties: {
15
15
  rules: AuthRule[];
16
16
  };
17
- };
17
+ }
18
18
 
19
19
  /**
20
20
  * Only the portions of an Auth rule we care about.
21
21
  */
22
- type AuthRule = {
22
+ interface AuthRule {
23
23
  allow: string;
24
24
  ownerField?: string;
25
- };
25
+ }
26
26
 
27
27
  /**
28
28
  * Given an introspection schema model, returns all owner fields.
@@ -41,6 +41,7 @@ export function resolveOwnerFields(model: Model): string[] {
41
41
  }
42
42
  }
43
43
  }
44
+
44
45
  return Array.from(ownerFields);
45
46
  }
46
47
 
@@ -55,11 +56,12 @@ function isAuthAttribute(attribute: any): attribute is AuthAttribute {
55
56
  if (attribute?.type === 'auth') {
56
57
  if (typeof attribute?.properties === 'object') {
57
58
  if (Array.isArray(attribute?.properties?.rules)) {
58
- return (attribute?.properties?.rules as Array<any>).every(
59
+ return (attribute?.properties?.rules as any[]).every(
59
60
  rule => !!rule.allow,
60
61
  );
61
62
  }
62
63
  }
63
64
  }
65
+
64
66
  return false;
65
67
  }
@@ -18,5 +18,6 @@ type SchemaModel = ModelIntrospectionSchema['models'][string];
18
18
  */
19
19
  export function resolvePKFields(model: SchemaModel) {
20
20
  const { primaryKeyFieldName, sortKeyFieldNames } = model.primaryKeyInfo;
21
+
21
22
  return [primaryKeyFieldName, ...sortKeyFieldNames];
22
23
  }
@@ -1 +0,0 @@
1
- {"version":3,"file":"generateEnumsProperty.js","sources":["../../../../src/internals/utils/generateEnumsProperty.ts"],"sourcesContent":["\"use strict\";\n// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\nObject.defineProperty(exports, \"__esModule\", { value: true });\nexports.generateEnumsProperty = void 0;\nconst generateEnumsProperty = (graphqlConfig) => {\n const modelIntrospection = graphqlConfig.modelIntrospection;\n if (!modelIntrospection) {\n return {};\n }\n const enums = {};\n for (const [_, enumData] of Object.entries(modelIntrospection.enums)) {\n enums[enumData.name] = {\n values: () => enumData.values,\n };\n }\n return enums;\n};\nexports.generateEnumsProperty = generateEnumsProperty;\n"],"names":[],"mappings":";;AACA;AACA;AACA,MAAM,CAAC,cAAc,CAAC,OAAO,EAAE,YAAY,EAAE,EAAE,KAAK,EAAE,IAAI,EAAE,CAAC,CAAC;AAC9D,OAAO,CAAC,qBAAqB,GAAG,KAAK,CAAC,CAAC;AACvC,MAAM,qBAAqB,GAAG,CAAC,aAAa,KAAK;AACjD,IAAI,MAAM,kBAAkB,GAAG,aAAa,CAAC,kBAAkB,CAAC;AAChE,IAAI,IAAI,CAAC,kBAAkB,EAAE;AAC7B,QAAQ,OAAO,EAAE,CAAC;AAClB,KAAK;AACL,IAAI,MAAM,KAAK,GAAG,EAAE,CAAC;AACrB,IAAI,KAAK,MAAM,CAAC,CAAC,EAAE,QAAQ,CAAC,IAAI,MAAM,CAAC,OAAO,CAAC,kBAAkB,CAAC,KAAK,CAAC,EAAE;AAC1E,QAAQ,KAAK,CAAC,QAAQ,CAAC,IAAI,CAAC,GAAG;AAC/B,YAAY,MAAM,EAAE,MAAM,QAAQ,CAAC,MAAM;AACzC,SAAS,CAAC;AACV,KAAK;AACL,IAAI,OAAO,KAAK,CAAC;AACjB,CAAC,CAAC;AACF,OAAO,CAAC,qBAAqB,GAAG,qBAAqB;;"}
@@ -1 +0,0 @@
1
- {"version":3,"file":"generateModelsProperty.js","sources":["../../../../src/internals/utils/generateModelsProperty.ts"],"sourcesContent":["\"use strict\";\nObject.defineProperty(exports, \"__esModule\", { value: true });\nexports.generateModelsProperty = void 0;\nconst APIClient_1 = require(\"../APIClient\");\nconst list_1 = require(\"../operations/list\");\nconst indexQuery_1 = require(\"../operations/indexQuery\");\nconst get_1 = require(\"../operations/get\");\nconst subscription_1 = require(\"../operations/subscription\");\nconst observeQuery_1 = require(\"../operations/observeQuery\");\nconst clientUtils_1 = require(\"../clientUtils\");\nfunction generateModelsProperty(client, apiGraphQLConfig) {\n const models = {};\n const modelIntrospection = apiGraphQLConfig.modelIntrospection;\n if (!modelIntrospection) {\n return {};\n }\n const SUBSCRIPTION_OPS = ['ONCREATE', 'ONUPDATE', 'ONDELETE'];\n for (const model of Object.values(modelIntrospection.models)) {\n const { name } = model;\n models[name] = {};\n Object.entries(APIClient_1.graphQLOperationsInfo).forEach(([key, { operationPrefix }]) => {\n const operation = key;\n if (operation === 'LIST') {\n models[name][operationPrefix] = (0, list_1.listFactory)(client, modelIntrospection, model);\n }\n else if (SUBSCRIPTION_OPS.includes(operation)) {\n models[name][operationPrefix] = (0, subscription_1.subscriptionFactory)(client, modelIntrospection, model, operation);\n }\n else if (operation === 'OBSERVE_QUERY') {\n models[name][operationPrefix] = (0, observeQuery_1.observeQueryFactory)(models, model);\n }\n else {\n models[name][operationPrefix] = (0, get_1.getFactory)(client, modelIntrospection, model, operation);\n }\n });\n const secondaryIdxs = (0, clientUtils_1.getSecondaryIndexesFromSchemaModel)(model);\n for (const idx of secondaryIdxs) {\n models[name][idx.queryField] = (0, indexQuery_1.indexQueryFactory)(client, modelIntrospection, model, idx);\n }\n }\n return models;\n}\nexports.generateModelsProperty = generateModelsProperty;\n"],"names":[],"mappings":";;AACA,MAAM,CAAC,cAAc,CAAC,OAAO,EAAE,YAAY,EAAE,EAAE,KAAK,EAAE,IAAI,EAAE,CAAC,CAAC;AAC9D,OAAO,CAAC,sBAAsB,GAAG,KAAK,CAAC,CAAC;AACxC,MAAM,WAAW,GAAG,OAAO,CAAC,cAAc,CAAC,CAAC;AAC5C,MAAM,MAAM,GAAG,OAAO,CAAC,oBAAoB,CAAC,CAAC;AAC7C,MAAM,YAAY,GAAG,OAAO,CAAC,0BAA0B,CAAC,CAAC;AACzD,MAAM,KAAK,GAAG,OAAO,CAAC,mBAAmB,CAAC,CAAC;AAC3C,MAAM,cAAc,GAAG,OAAO,CAAC,4BAA4B,CAAC,CAAC;AAC7D,MAAM,cAAc,GAAG,OAAO,CAAC,4BAA4B,CAAC,CAAC;AAC7D,MAAM,aAAa,GAAG,OAAO,CAAC,gBAAgB,CAAC,CAAC;AAChD,SAAS,sBAAsB,CAAC,MAAM,EAAE,gBAAgB,EAAE;AAC1D,IAAI,MAAM,MAAM,GAAG,EAAE,CAAC;AACtB,IAAI,MAAM,kBAAkB,GAAG,gBAAgB,CAAC,kBAAkB,CAAC;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AAK,CAAC,UAAU,EAAE,MAAM,EAAE,kBAAkB,EAAE,KAAK,EAAE,SAAS,CAAC,CAAC;AACpH,aAAa;AACb,SAAS,CAAC,CAAC;AACX,QAAQ,MAAM,aAAa,GAAG,IAAI,aAAa,CAAC,kCAAkC,EAAE,KAAK,CAAC,CAAC;AAC3F,QAAQ,KAAK,MAAM,GAAG,IAAI,aAAa,EAAE;AACzC,YAAY,MAAM,CAAC,IAAI,CAAC,CAAC,GAAG,CAAC,UAAU,CAAC,GAAG,IAAI,YAAY,CAAC,iBAAiB,EAAE,MAAM,EAAE,kBAAkB,EAAE,KAAK,EAAE,GAAG,CAAC,CAAC;AACvH,SAAS;AACT,KAAK;AACL,IAAI,OAAO,MAAM,CAAC;AAClB,CAAC;AACD,OAAO,CAAC,sBAAsB,GAAG,sBAAsB;;"}
@@ -1 +0,0 @@
1
- {"version":3,"file":"isApiGraphQLProviderConfig.js","sources":["../../../../src/internals/utils/isApiGraphQLProviderConfig.ts"],"sourcesContent":["\"use strict\";\n// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\nObject.defineProperty(exports, \"__esModule\", { value: true });\nexports.isApiGraphQLConfig = void 0;\nfunction isApiGraphQLConfig(apiGraphQLConfig) {\n return apiGraphQLConfig !== undefined;\n}\nexports.isApiGraphQLConfig = isApiGraphQLConfig;\n"],"names":[],"mappings":";;AACA;AACA;AACA,MAAM,CAAC,cAAc,CAAC,OAAO,EAAE,YAAY,EAAE,EAAE,KAAK,EAAE,IAAI,EAAE,CAAC,CAAC;AAC9D,OAAO,CAAC,kBAAkB,GAAG,KAAK,CAAC,CAAC;AACpC,SAAS,kBAAkB,CAAC,gBAAgB,EAAE;AAC9C,IAAI,OAAO,gBAAgB,KAAK,SAAS,CAAC;AAC1C,CAAC;AACD,OAAO,CAAC,kBAAkB,GAAG,kBAAkB;;"}
@@ -1 +0,0 @@
1
- {"version":3,"file":"isConfigureEventWithResourceConfig.js","sources":["../../../../src/internals/utils/isConfigureEventWithResourceConfig.ts"],"sourcesContent":["\"use strict\";\n// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\nObject.defineProperty(exports, \"__esModule\", { value: true });\nexports.isConfigureEventWithResourceConfig = void 0;\nfunction isConfigureEventWithResourceConfig(payload) {\n return payload.event === 'configure';\n}\nexports.isConfigureEventWithResourceConfig = isConfigureEventWithResourceConfig;\n"],"names":[],"mappings":";;AACA;AACA;AACA,MAAM,CAAC,cAAc,CAAC,OAAO,EAAE,YAAY,EAAE,EAAE,KAAK,EAAE,IAAI,EAAE,CAAC,CAAC;AAC9D,OAAO,CAAC,kCAAkC,GAAG,KAAK,CAAC,CAAC;AACpD,SAAS,kCAAkC,CAAC,OAAO,EAAE;AACrD,IAAI,OAAO,OAAO,CAAC,KAAK,KAAK,WAAW,CAAC;AACzC,CAAC;AACD,OAAO,CAAC,kCAAkC,GAAG,kCAAkC;;"}
@@ -1 +0,0 @@
1
- {"version":3,"file":"generateEnumsProperty.mjs","sources":["../../../../src/internals/utils/generateEnumsProperty.ts"],"sourcesContent":["// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\nexport const generateEnumsProperty = (graphqlConfig) => {\n const modelIntrospection = graphqlConfig.modelIntrospection;\n if (!modelIntrospection) {\n return {};\n }\n const enums = {};\n for (const [_, enumData] of Object.entries(modelIntrospection.enums)) {\n enums[enumData.name] = {\n values: () => enumData.values,\n };\n }\n return enums;\n};\n"],"names":[],"mappings":"AAAA;AACA;AACY,MAAC,qBAAqB,GAAG,CAAC,aAAa,KAAK;AACxD,IAAI,MAAM,kBAAkB,GAAG,aAAa,CAAC,kBAAkB,CAAC;AAChE,IAAI,IAAI,CAAC,kBAAkB,EAAE;AAC7B,QAAQ,OAAO,EAAE,CAAC;AAClB,KAAK;AACL,IAAI,MAAM,KAAK,GAAG,EAAE,CAAC;AACrB,IAAI,KAAK,MAAM,CAAC,CAAC,EAAE,QAAQ,CAAC,IAAI,MAAM,CAAC,OAAO,CAAC,kBAAkB,CAAC,KAAK,CAAC,EAAE;AAC1E,QAAQ,KAAK,CAAC,QAAQ,CAAC,IAAI,CAAC,GAAG;AAC/B,YAAY,MAAM,EAAE,MAAM,QAAQ,CAAC,MAAM;AACzC,SAAS,CAAC;AACV,KAAK;AACL,IAAI,OAAO,KAAK,CAAC;AACjB;;;;"}
@@ -1 +0,0 @@
1
- {"version":3,"file":"generateModelsProperty.mjs","sources":["../../../../src/internals/utils/generateModelsProperty.ts"],"sourcesContent":["import { graphQLOperationsInfo } from '../APIClient';\nimport { listFactory } from '../operations/list';\nimport { indexQueryFactory } from '../operations/indexQuery';\nimport { getFactory } from '../operations/get';\nimport { subscriptionFactory } from '../operations/subscription';\nimport { observeQueryFactory } from '../operations/observeQuery';\nimport { getSecondaryIndexesFromSchemaModel } from '../clientUtils';\nexport function generateModelsProperty(client, apiGraphQLConfig) {\n const models = {};\n const modelIntrospection = apiGraphQLConfig.modelIntrospection;\n if (!modelIntrospection) {\n return {};\n }\n const SUBSCRIPTION_OPS = ['ONCREATE', 'ONUPDATE', 'ONDELETE'];\n for (const model of Object.values(modelIntrospection.models)) {\n const { name } = model;\n models[name] = {};\n Object.entries(graphQLOperationsInfo).forEach(([key, { operationPrefix }]) => {\n const operation = key;\n if (operation === 'LIST') {\n models[name][operationPrefix] = listFactory(client, modelIntrospection, model);\n }\n else if (SUBSCRIPTION_OPS.includes(operation)) {\n models[name][operationPrefix] = subscriptionFactory(client, modelIntrospection, model, operation);\n }\n else if (operation === 'OBSERVE_QUERY') {\n models[name][operationPrefix] = observeQueryFactory(models, model);\n }\n else {\n models[name][operationPrefix] = getFactory(client, modelIntrospection, model, operation);\n }\n });\n const secondaryIdxs = getSecondaryIndexesFromSchemaModel(model);\n for (const idx of secondaryIdxs) {\n models[name][idx.queryField] = indexQueryFactory(client, modelIntrospection, model, idx);\n }\n }\n return models;\n}\n"],"names":[],"mappings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CAAC;AACnF,aAAa;AACb,iBAAiB;AACjB,gBAAgB,MAAM,CAAC,IAAI,CAAC,CAAC,eAAe,CAAC,GAAG,UAAU,CAAC,MAAM,EAAE,kBAAkB,EAAE,KAAK,EAAE,SAAS,CAAC,CAAC;AACzG,aAAa;AACb,SAAS,CAAC,CAAC;AACX,QAAQ,MAAM,aAAa,GAAG,kCAAkC,CAAC,KAAK,CAAC,CAAC;AACxE,QAAQ,KAAK,MAAM,GAAG,IAAI,aAAa,EAAE;AACzC,YAAY,MAAM,CAAC,IAAI,CAAC,CAAC,GAAG,CAAC,UAAU,CAAC,GAAG,iBAAiB,CAAC,MAAM,EAAE,kBAAkB,EAAE,KAAK,EAAE,GAAG,CAAC,CAAC;AACrG,SAAS;AACT,KAAK;AACL,IAAI,OAAO,MAAM,CAAC;AAClB;;;;"}
@@ -1 +0,0 @@
1
- {"version":3,"file":"isApiGraphQLProviderConfig.mjs","sources":["../../../../src/internals/utils/isApiGraphQLProviderConfig.ts"],"sourcesContent":["// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\nexport function isApiGraphQLConfig(apiGraphQLConfig) {\n return apiGraphQLConfig !== undefined;\n}\n"],"names":[],"mappings":"AAAA;AACA;AACO,SAAS,kBAAkB,CAAC,gBAAgB,EAAE;AACrD,IAAI,OAAO,gBAAgB,KAAK,SAAS,CAAC;AAC1C;;;;"}
@@ -1 +0,0 @@
1
- {"version":3,"file":"isConfigureEventWithResourceConfig.mjs","sources":["../../../../src/internals/utils/isConfigureEventWithResourceConfig.ts"],"sourcesContent":["// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\nexport function isConfigureEventWithResourceConfig(payload) {\n return payload.event === 'configure';\n}\n"],"names":[],"mappings":"AAAA;AACA;AACO,SAAS,kCAAkC,CAAC,OAAO,EAAE;AAC5D,IAAI,OAAO,OAAO,CAAC,KAAK,KAAK,WAAW,CAAC;AACzC;;;;"}