@aws-amplify/api-graphql 4.0.2-unstable.ff4e8d7.0 → 4.0.2

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 (122) hide show
  1. package/dist/cjs/GraphQLAPI.js +1 -1
  2. package/dist/cjs/GraphQLAPI.js.map +1 -1
  3. package/dist/cjs/Providers/AWSAppSyncRealTimeProvider/index.js +1 -1
  4. package/dist/cjs/Providers/AWSAppSyncRealTimeProvider/index.js.map +1 -1
  5. package/dist/cjs/internals/APIClient.js +528 -0
  6. package/dist/cjs/internals/APIClient.js.map +1 -0
  7. package/dist/cjs/internals/InternalGraphQLAPI.js +14 -23
  8. package/dist/cjs/internals/InternalGraphQLAPI.js.map +1 -1
  9. package/dist/cjs/internals/generateClient.js +33 -0
  10. package/dist/cjs/internals/generateClient.js.map +1 -0
  11. package/dist/cjs/internals/generateModelsProperty.js +43 -0
  12. package/dist/cjs/internals/generateModelsProperty.js.map +1 -0
  13. package/dist/cjs/internals/index.js +3 -1
  14. package/dist/cjs/internals/index.js.map +1 -1
  15. package/dist/cjs/internals/operations/get.js +61 -0
  16. package/dist/cjs/internals/operations/get.js.map +1 -0
  17. package/dist/cjs/internals/operations/list.js +73 -0
  18. package/dist/cjs/internals/operations/list.js.map +1 -0
  19. package/dist/cjs/internals/operations/observeQuery.js +121 -0
  20. package/dist/cjs/internals/operations/observeQuery.js.map +1 -0
  21. package/dist/cjs/internals/operations/subscription.js +30 -0
  22. package/dist/cjs/internals/operations/subscription.js.map +1 -0
  23. package/dist/cjs/internals/server/generateClient.js +32 -0
  24. package/dist/cjs/internals/server/generateClient.js.map +1 -0
  25. package/dist/cjs/internals/server/generateModelsProperty.js +47 -0
  26. package/dist/cjs/internals/server/generateModelsProperty.js.map +1 -0
  27. package/dist/cjs/internals/server/index.js +9 -0
  28. package/dist/cjs/internals/server/index.js.map +1 -0
  29. package/dist/cjs/internals/types.js +4 -0
  30. package/dist/cjs/internals/types.js.map +1 -0
  31. package/dist/cjs/types/index.js +3 -1
  32. package/dist/cjs/types/index.js.map +1 -1
  33. package/dist/cjs/utils/findIndexByFields.js +25 -0
  34. package/dist/cjs/utils/findIndexByFields.js.map +1 -0
  35. package/dist/cjs/utils/index.js +5 -1
  36. package/dist/cjs/utils/index.js.map +1 -1
  37. package/dist/cjs/utils/resolveOwnerFields.js +42 -0
  38. package/dist/cjs/utils/resolveOwnerFields.js.map +1 -0
  39. package/dist/cjs/utils/resolvePKFields.js +17 -0
  40. package/dist/cjs/utils/resolvePKFields.js.map +1 -0
  41. package/dist/esm/GraphQLAPI.mjs +1 -1
  42. package/dist/esm/GraphQLAPI.mjs.map +1 -1
  43. package/dist/esm/Providers/AWSAppSyncRealTimeProvider/index.mjs +1 -1
  44. package/dist/esm/Providers/AWSAppSyncRealTimeProvider/index.mjs.map +1 -1
  45. package/dist/esm/index.mjs +1 -1
  46. package/dist/esm/internals/APIClient.d.ts +112 -0
  47. package/dist/esm/internals/APIClient.mjs +518 -0
  48. package/dist/esm/internals/APIClient.mjs.map +1 -0
  49. package/dist/esm/internals/InternalGraphQLAPI.d.ts +0 -11
  50. package/dist/esm/internals/InternalGraphQLAPI.mjs +14 -22
  51. package/dist/esm/internals/InternalGraphQLAPI.mjs.map +1 -1
  52. package/dist/esm/internals/generateClient.d.ts +12 -0
  53. package/dist/esm/internals/generateClient.mjs +31 -0
  54. package/dist/esm/internals/generateClient.mjs.map +1 -0
  55. package/dist/esm/internals/generateModelsProperty.d.ts +4 -0
  56. package/dist/esm/internals/generateModelsProperty.mjs +41 -0
  57. package/dist/esm/internals/generateModelsProperty.mjs.map +1 -0
  58. package/dist/esm/internals/index.d.ts +1 -0
  59. package/dist/esm/internals/index.mjs +1 -0
  60. package/dist/esm/internals/index.mjs.map +1 -1
  61. package/dist/esm/internals/operations/get.d.ts +5 -0
  62. package/dist/esm/internals/operations/get.mjs +59 -0
  63. package/dist/esm/internals/operations/get.mjs.map +1 -0
  64. package/dist/esm/internals/operations/list.d.ts +4 -0
  65. package/dist/esm/internals/operations/list.mjs +71 -0
  66. package/dist/esm/internals/operations/list.mjs.map +1 -0
  67. package/dist/esm/internals/operations/observeQuery.d.ts +3 -0
  68. package/dist/esm/internals/operations/observeQuery.mjs +122 -0
  69. package/dist/esm/internals/operations/observeQuery.mjs.map +1 -0
  70. package/dist/esm/internals/operations/subscription.d.ts +3 -0
  71. package/dist/esm/internals/operations/subscription.mjs +28 -0
  72. package/dist/esm/internals/operations/subscription.mjs.map +1 -0
  73. package/dist/esm/internals/server/generateClient.d.ts +11 -0
  74. package/dist/esm/internals/server/generateClient.mjs +34 -0
  75. package/dist/esm/internals/server/generateClient.mjs.map +1 -0
  76. package/dist/esm/internals/server/generateModelsProperty.d.ts +3 -0
  77. package/dist/esm/internals/server/generateModelsProperty.mjs +45 -0
  78. package/dist/esm/internals/server/generateModelsProperty.mjs.map +1 -0
  79. package/dist/esm/internals/server/index.d.ts +1 -0
  80. package/dist/esm/internals/server/index.mjs +2 -0
  81. package/dist/esm/internals/server/index.mjs.map +1 -0
  82. package/dist/esm/internals/types.d.ts +17 -0
  83. package/dist/esm/internals/types.mjs +2 -0
  84. package/dist/esm/internals/types.mjs.map +1 -0
  85. package/dist/esm/types/index.d.ts +32 -2
  86. package/dist/esm/types/index.mjs +3 -1
  87. package/dist/esm/types/index.mjs.map +1 -1
  88. package/dist/esm/utils/findIndexByFields.d.ts +9 -0
  89. package/dist/esm/utils/findIndexByFields.mjs +22 -0
  90. package/dist/esm/utils/findIndexByFields.mjs.map +1 -0
  91. package/dist/esm/utils/index.d.ts +2 -0
  92. package/dist/esm/utils/index.mjs +2 -0
  93. package/dist/esm/utils/index.mjs.map +1 -1
  94. package/dist/esm/utils/resolveOwnerFields.d.ts +12 -0
  95. package/dist/esm/utils/resolveOwnerFields.mjs +39 -0
  96. package/dist/esm/utils/resolveOwnerFields.mjs.map +1 -0
  97. package/dist/esm/utils/resolvePKFields.d.ts +13 -0
  98. package/dist/esm/utils/resolvePKFields.mjs +14 -0
  99. package/dist/esm/utils/resolvePKFields.mjs.map +1 -0
  100. package/internals/server/package.json +8 -0
  101. package/package.json +148 -146
  102. package/src/GraphQLAPI.ts +2 -2
  103. package/src/Providers/AWSAppSyncRealTimeProvider/index.ts +9 -4
  104. package/src/internals/APIClient.ts +780 -0
  105. package/src/internals/InternalGraphQLAPI.ts +21 -31
  106. package/src/internals/generateClient.ts +33 -0
  107. package/src/internals/generateModelsProperty.ts +73 -0
  108. package/src/internals/index.ts +1 -0
  109. package/src/internals/operations/get.ts +131 -0
  110. package/src/internals/operations/list.ts +132 -0
  111. package/src/internals/operations/observeQuery.ts +144 -0
  112. package/src/internals/operations/subscription.ts +65 -0
  113. package/src/internals/server/generateClient.ts +45 -0
  114. package/src/internals/server/generateModelsProperty.ts +80 -0
  115. package/src/internals/server/index.ts +4 -0
  116. package/src/internals/types.ts +21 -0
  117. package/src/types/index.ts +42 -2
  118. package/src/utils/ConnectionStateMonitor.ts +3 -1
  119. package/src/utils/findIndexByFields.ts +31 -0
  120. package/src/utils/index.ts +2 -0
  121. package/src/utils/resolveOwnerFields.ts +65 -0
  122. package/src/utils/resolvePKFields.ts +22 -0
@@ -0,0 +1,30 @@
1
+ 'use strict';
2
+
3
+ // Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
4
+ // SPDX-License-Identifier: Apache-2.0
5
+ Object.defineProperty(exports, "__esModule", { value: true });
6
+ exports.subscriptionFactory = void 0;
7
+ const rxjs_1 = require("rxjs");
8
+ const APIClient_1 = require("../APIClient");
9
+ function subscriptionFactory(client, modelIntrospection, model, operation) {
10
+ const { name } = model;
11
+ const subscription = (args) => {
12
+ const query = (0, APIClient_1.generateGraphQLDocument)(modelIntrospection.models, name, operation);
13
+ const variables = (0, APIClient_1.buildGraphQLVariables)(model, operation, args, modelIntrospection);
14
+ const auth = (0, APIClient_1.authModeParams)(client, args);
15
+ const observable = client.graphql({
16
+ ...auth,
17
+ query,
18
+ variables,
19
+ });
20
+ return observable.pipe((0, rxjs_1.map)(value => {
21
+ const [key] = Object.keys(value.data);
22
+ const data = value.data[key];
23
+ const [initialized] = (0, APIClient_1.initializeModel)(client, name, [data], modelIntrospection, auth.authMode, auth.authToken);
24
+ return initialized;
25
+ }));
26
+ };
27
+ return subscription;
28
+ }
29
+ exports.subscriptionFactory = subscriptionFactory;
30
+ //# sourceMappingURL=subscription.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"subscription.js","sources":["../../../../src/internals/operations/subscription.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.subscriptionFactory = void 0;\nconst rxjs_1 = require(\"rxjs\");\nconst APIClient_1 = require(\"../APIClient\");\nfunction subscriptionFactory(client, modelIntrospection, model, operation) {\n const { name } = model;\n const subscription = (args) => {\n const query = (0, APIClient_1.generateGraphQLDocument)(modelIntrospection.models, name, operation);\n const variables = (0, APIClient_1.buildGraphQLVariables)(model, operation, args, modelIntrospection);\n const auth = (0, APIClient_1.authModeParams)(client, args);\n const observable = client.graphql({\n ...auth,\n query,\n variables,\n });\n return observable.pipe((0, rxjs_1.map)(value => {\n const [key] = Object.keys(value.data);\n const data = value.data[key];\n const [initialized] = (0, APIClient_1.initializeModel)(client, name, [data], modelIntrospection, auth.authMode, auth.authToken);\n return initialized;\n }));\n };\n return subscription;\n}\nexports.subscriptionFactory = subscriptionFactory;\n"],"names":[],"mappings":";;AACA;AACA;AACA,MAAM,CAAC,cAAc,CAAC,OAAO,EAAE,YAAY,EAAE,EAAE,KAAK,EAAE,IAAI,EAAE,CAAC,CAAC;AAC9D,OAAO,CAAC,mBAAmB,GAAG,KAAK,CAAC,CAAC;AACrC,MAAM,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC,CAAC;AAC/B,MAAM,WAAW,GAAG,OAAO,CAAC,cAAc,CAAC,CAAC;AAC5C,SAAS,mBAAmB,CAAC,MAAM,EAAE,kBAAkB,EAAE,KAAK,EAAE,SAAS,EAAE;AAC3E,IAAI,MAAM,EAAE,IAAI,EAAE,GAAG,KAAK,CAAC;AAC3B,IAAI,MAAM,YAAY,GAAG,CAAC,IAAI,KAAK;AACnC,QAAQ,MAAM,KAAK,GAAG,IAAI,WAAW,CAAC,uBAAuB,EAAE,kBAAkB,CAAC,MAAM,EAAE,IAAI,EAAE,SAAS,CAAC,CAAC;AAC3G,QAAQ,MAAM,SAAS,GAAG,IAAI,WAAW,CAAC,qBAAqB,EAAE,KAAK,EAAE,SAAS,EAAE,IAAI,EAAE,kBAAkB,CAAC,CAAC;AAC7G,QAAQ,MAAM,IAAI,GAAG,IAAI,WAAW,CAAC,cAAc,EAAE,MAAM,EAAE,IAAI,CAAC,CAAC;AACnE,QAAQ,MAAM,UAAU,GAAG,MAAM,CAAC,OAAO,CAAC;AAC1C,YAAY,GAAG,IAAI;AACnB,YAAY,KAAK;AACjB,YAAY,SAAS;AACrB,SAAS,CAAC,CAAC;AACX,QAAQ,OAAO,UAAU,CAAC,IAAI,CAAC,IAAI,MAAM,CAAC,GAAG,EAAE,KAAK,IAAI;AACxD,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,IAAI,WAAW,CAAC,eAAe,EAAE,MAAM,EAAE,IAAI,EAAE,CAAC,IAAI,CAAC,EAAE,kBAAkB,EAAE,IAAI,CAAC,QAAQ,EAAE,IAAI,CAAC,SAAS,CAAC,CAAC;AAC5I,YAAY,OAAO,WAAW,CAAC;AAC/B,SAAS,CAAC,CAAC,CAAC;AACZ,KAAK,CAAC;AACN,IAAI,OAAO,YAAY,CAAC;AACxB,CAAC;AACD,OAAO,CAAC,mBAAmB,GAAG,mBAAmB;;"}
@@ -0,0 +1,32 @@
1
+ 'use strict';
2
+
3
+ // Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
4
+ // SPDX-License-Identifier: Apache-2.0
5
+ Object.defineProperty(exports, "__esModule", { value: true });
6
+ exports.generateClient = void 0;
7
+ const __1 = require("../");
8
+ const generateModelsProperty_1 = require("./generateModelsProperty");
9
+ const types_1 = require("../../types");
10
+ /**
11
+ * @private
12
+ *
13
+ * Creates a client that can be used to make GraphQL requests, using a provided `AmplifyClassV6`
14
+ * compatible context object for config and auth fetching.
15
+ *
16
+ * @param params
17
+ * @returns
18
+ */
19
+ function generateClient(params) {
20
+ const client = {
21
+ [types_1.__amplify]: params.amplify,
22
+ [types_1.__authMode]: params.authMode,
23
+ [types_1.__authToken]: params.authToken,
24
+ graphql: __1.graphql,
25
+ cancel: __1.cancel,
26
+ isCancelError: __1.isCancelError,
27
+ };
28
+ client.models = (0, generateModelsProperty_1.generateModelsProperty)(client, params);
29
+ return client;
30
+ }
31
+ exports.generateClient = generateClient;
32
+ //# sourceMappingURL=generateClient.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"generateClient.js","sources":["../../../../src/internals/server/generateClient.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.generateClient = void 0;\nconst __1 = require(\"../\");\nconst generateModelsProperty_1 = require(\"./generateModelsProperty\");\nconst types_1 = require(\"../../types\");\n/**\n * @private\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 */\nfunction generateClient(params) {\n const client = {\n [types_1.__amplify]: params.amplify,\n [types_1.__authMode]: params.authMode,\n [types_1.__authToken]: params.authToken,\n graphql: __1.graphql,\n cancel: __1.cancel,\n isCancelError: __1.isCancelError,\n };\n client.models = (0, generateModelsProperty_1.generateModelsProperty)(client, params);\n return client;\n}\nexports.generateClient = generateClient;\n"],"names":[],"mappings":";;AACA;AACA;AACA,MAAM,CAAC,cAAc,CAAC,OAAO,EAAE,YAAY,EAAE,EAAE,KAAK,EAAE,IAAI,EAAE,CAAC,CAAC;AAC9D,OAAO,CAAC,cAAc,GAAG,KAAK,CAAC,CAAC;AAChC,MAAM,GAAG,GAAG,OAAO,CAAC,KAAK,CAAC,CAAC;AAC3B,MAAM,wBAAwB,GAAG,OAAO,CAAC,0BAA0B,CAAC,CAAC;AACrE,MAAM,OAAO,GAAG,OAAO,CAAC,aAAa,CAAC,CAAC;AACvC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAAS,cAAc,CAAC,MAAM,EAAE;AAChC,IAAI,MAAM,MAAM,GAAG;AACnB,QAAQ,CAAC,OAAO,CAAC,SAAS,GAAG,MAAM,CAAC,OAAO;AAC3C,QAAQ,CAAC,OAAO,CAAC,UAAU,GAAG,MAAM,CAAC,QAAQ;AAC7C,QAAQ,CAAC,OAAO,CAAC,WAAW,GAAG,MAAM,CAAC,SAAS;AAC/C,QAAQ,OAAO,EAAE,GAAG,CAAC,OAAO;AAC5B,QAAQ,MAAM,EAAE,GAAG,CAAC,MAAM;AAC1B,QAAQ,aAAa,EAAE,GAAG,CAAC,aAAa;AACxC,KAAK,CAAC;AACN,IAAI,MAAM,CAAC,MAAM,GAAG,IAAI,wBAAwB,CAAC,sBAAsB,EAAE,MAAM,EAAE,MAAM,CAAC,CAAC;AACzF,IAAI,OAAO,MAAM,CAAC;AAClB,CAAC;AACD,OAAO,CAAC,cAAc,GAAG,cAAc;;"}
@@ -0,0 +1,47 @@
1
+ 'use strict';
2
+
3
+ Object.defineProperty(exports, "__esModule", { value: true });
4
+ exports.generateModelsProperty = void 0;
5
+ const APIClient_1 = require("../APIClient");
6
+ const list_1 = require("../operations/list");
7
+ const get_1 = require("../operations/get");
8
+ function generateModelsProperty(client, params) {
9
+ const models = {};
10
+ const config = params.config;
11
+ const useContext = client === null;
12
+ if (!config) {
13
+ throw new Error('generateModelsProperty cannot retrieve Amplify config');
14
+ }
15
+ if (!config.API?.GraphQL) {
16
+ throw new Error('The API configuration is missing. This is likely due to Amplify.configure() not being called prior to generateClient().');
17
+ }
18
+ const modelIntrospection = config.API.GraphQL.modelIntrospection;
19
+ if (!modelIntrospection) {
20
+ return {};
21
+ }
22
+ const SSR_UNSUPORTED_OPS = [
23
+ 'ONCREATE',
24
+ 'ONUPDATE',
25
+ 'ONDELETE',
26
+ 'OBSERVE_QUERY',
27
+ ];
28
+ for (const model of Object.values(modelIntrospection.models)) {
29
+ const { name } = model;
30
+ models[name] = {};
31
+ Object.entries(APIClient_1.graphQLOperationsInfo).forEach(([key, { operationPrefix }]) => {
32
+ const operation = key;
33
+ // subscriptions are not supported in SSR
34
+ if (SSR_UNSUPORTED_OPS.includes(operation))
35
+ return;
36
+ if (operation === 'LIST') {
37
+ models[name][operationPrefix] = (0, list_1.listFactory)(client, modelIntrospection, model, useContext);
38
+ }
39
+ else {
40
+ models[name][operationPrefix] = (0, get_1.getFactory)(client, modelIntrospection, model, operation, useContext);
41
+ }
42
+ });
43
+ }
44
+ return models;
45
+ }
46
+ exports.generateModelsProperty = generateModelsProperty;
47
+ //# sourceMappingURL=generateModelsProperty.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"generateModelsProperty.js","sources":["../../../../src/internals/server/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 get_1 = require(\"../operations/get\");\nfunction generateModelsProperty(client, params) {\n const models = {};\n const config = params.config;\n const useContext = client === null;\n if (!config) {\n throw new Error('generateModelsProperty cannot retrieve Amplify config');\n }\n if (!config.API?.GraphQL) {\n throw new Error('The API configuration is missing. This is likely due to Amplify.configure() not being called prior to generateClient().');\n }\n const modelIntrospection = config.API.GraphQL.modelIntrospection;\n if (!modelIntrospection) {\n return {};\n }\n const SSR_UNSUPORTED_OPS = [\n 'ONCREATE',\n 'ONUPDATE',\n 'ONDELETE',\n 'OBSERVE_QUERY',\n ];\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 // subscriptions are not supported in SSR\n if (SSR_UNSUPORTED_OPS.includes(operation))\n return;\n if (operation === 'LIST') {\n models[name][operationPrefix] = (0, list_1.listFactory)(client, modelIntrospection, model, useContext);\n }\n else {\n models[name][operationPrefix] = (0, get_1.getFactory)(client, modelIntrospection, model, operation, useContext);\n }\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,KAAK,GAAG,OAAO,CAAC,mBAAmB,CAAC,CAAC;AAC3C,SAAS,sBAAsB,CAAC,MAAM,EAAE,MAAM,EAAE;AAChD,IAAI,MAAM,MAAM,GAAG,EAAE,CAAC;AACtB,IAAI,MAAM,MAAM,GAAG,MAAM,CAAC,MAAM,CAAC;AACjC,IAAI,MAAM,UAAU,GAAG,MAAM,KAAK,IAAI,CAAC;AACvC,IAAI,IAAI,CAAC,MAAM,EAAE;AACjB,QAAQ,MAAM,IAAI,KAAK,CAAC,uDAAuD,CAAC,CAAC;AACjF,KAAK;AACL,IAAI,IAAI,CAAC,MAAM,CAAC,GAAG,EAAE,OAAO,EAAE;AAC9B,QAAQ,MAAM,IAAI,KAAK,CAAC,yHAAyH,CAAC,CAAC;AACnJ,KAAK;AACL,IAAI,MAAM,kBAAkB,GAAG,MAAM,CAAC,GAAG,CAAC,OAAO,CAAC,kBAAkB,CAAC;AACrE,IAAI,IAAI,CAAC,kBAAkB,EAAE;AAC7B,QAAQ,OAAO,EAAE,CAAC;AAClB,KAAK;AACL,IAAI,MAAM,kBAAkB,GAAG;AAC/B,QAAQ,UAAU;AAClB,QAAQ,UAAU;AAClB,QAAQ,UAAU;AAClB,QAAQ,eAAe;AACvB,KAAK,CAAC;AACN,IAAI,KAAK,MAAM,KAAK,IAAI,MAAM,CAAC,MAAM,CAAC,kBAAkB,CAAC,MAAM,CAAC,EAAE;AAClE,QAAQ,MAAM,EAAE,IAAI,EAAE,GAAG,KAAK,CAAC;AAC/B,QAAQ,MAAM,CAAC,IAAI,CAAC,GAAG,EAAE,CAAC;AAC1B,QAAQ,MAAM,CAAC,OAAO,CAAC,WAAW,CAAC,qBAAqB,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,GAAG,EAAE,EAAE,eAAe,EAAE,CAAC,KAAK;AAClG,YAAY,MAAM,SAAS,GAAG,GAAG,CAAC;AAClC;AACA,YAAY,IAAI,kBAAkB,CAAC,QAAQ,CAAC,SAAS,CAAC;AACtD,gBAAgB,OAAO;AACvB,YAAY,IAAI,SAAS,KAAK,MAAM,EAAE;AACtC,gBAAgB,MAAM,CAAC,IAAI,CAAC,CAAC,eAAe,CAAC,GAAG,IAAI,MAAM,CAAC,WAAW,EAAE,MAAM,EAAE,kBAAkB,EAAE,KAAK,EAAE,UAAU,CAAC,CAAC;AACvH,aAAa;AACb,iBAAiB;AACjB,gBAAgB,MAAM,CAAC,IAAI,CAAC,CAAC,eAAe,CAAC,GAAG,IAAI,KAAK,CAAC,UAAU,EAAE,MAAM,EAAE,kBAAkB,EAAE,KAAK,EAAE,SAAS,EAAE,UAAU,CAAC,CAAC;AAChI,aAAa;AACb,SAAS,CAAC,CAAC;AACX,KAAK;AACL,IAAI,OAAO,MAAM,CAAC;AAClB,CAAC;AACD,OAAO,CAAC,sBAAsB,GAAG,sBAAsB;;"}
@@ -0,0 +1,9 @@
1
+ 'use strict';
2
+
3
+ // Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
4
+ // SPDX-License-Identifier: Apache-2.0
5
+ Object.defineProperty(exports, "__esModule", { value: true });
6
+ exports.generateClient = void 0;
7
+ var generateClient_1 = require("./generateClient");
8
+ Object.defineProperty(exports, "generateClient", { enumerable: true, get: function () { return generateClient_1.generateClient; } });
9
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sources":["../../../../src/internals/server/index.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.generateClient = void 0;\nvar generateClient_1 = require(\"./generateClient\");\nObject.defineProperty(exports, \"generateClient\", { enumerable: true, get: function () { return generateClient_1.generateClient; } });\n"],"names":[],"mappings":";;AACA;AACA;AACA,MAAM,CAAC,cAAc,CAAC,OAAO,EAAE,YAAY,EAAE,EAAE,KAAK,EAAE,IAAI,EAAE,CAAC,CAAC;AAC9D,OAAO,CAAC,cAAc,GAAG,KAAK,CAAC,CAAC;AAChC,IAAI,gBAAgB,GAAG,OAAO,CAAC,kBAAkB,CAAC,CAAC;AACnD,MAAM,CAAC,cAAc,CAAC,OAAO,EAAE,gBAAgB,EAAE,EAAE,UAAU,EAAE,IAAI,EAAE,GAAG,EAAE,YAAY,EAAE,OAAO,gBAAgB,CAAC,cAAc,CAAC,EAAE,EAAE,CAAC;;"}
@@ -0,0 +1,4 @@
1
+ 'use strict';
2
+
3
+ Object.defineProperty(exports, "__esModule", { value: true });
4
+ //# sourceMappingURL=types.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"types.js","sources":["../../../src/internals/types.ts"],"sourcesContent":["\"use strict\";\nObject.defineProperty(exports, \"__esModule\", { value: true });\n"],"names":[],"mappings":";;AACA,MAAM,CAAC,cAAc,CAAC,OAAO,EAAE,YAAY,EAAE,EAAE,KAAK,EAAE,IAAI,EAAE,CAAC;;"}
@@ -1,7 +1,7 @@
1
1
  'use strict';
2
2
 
3
3
  Object.defineProperty(exports, "__esModule", { value: true });
4
- exports.__amplify = exports.GraphQLAuthError = exports.ConnectionState = exports.CONTROL_MSG = void 0;
4
+ exports.__authToken = exports.__authMode = exports.__amplify = exports.GraphQLAuthError = exports.ConnectionState = exports.CONTROL_MSG = void 0;
5
5
  var PubSub_1 = require("./PubSub");
6
6
  Object.defineProperty(exports, "CONTROL_MSG", { enumerable: true, get: function () { return PubSub_1.CONTROL_MSG; } });
7
7
  Object.defineProperty(exports, "ConnectionState", { enumerable: true, get: function () { return PubSub_1.ConnectionState; } });
@@ -13,4 +13,6 @@ Object.defineProperty(exports, "ConnectionState", { enumerable: true, get: funct
13
13
  GraphQLAuthError["NO_AUTH_TOKEN"] = "No auth token specified";
14
14
  })(exports.GraphQLAuthError || (exports.GraphQLAuthError = {}));
15
15
  exports.__amplify = Symbol('amplify');
16
+ exports.__authMode = Symbol('authMode');
17
+ exports.__authToken = Symbol('authToken');
16
18
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sources":["../../../src/types/index.ts"],"sourcesContent":["\"use strict\";\nObject.defineProperty(exports, \"__esModule\", { value: true });\nexports.__amplify = exports.GraphQLAuthError = exports.ConnectionState = exports.CONTROL_MSG = void 0;\nvar PubSub_1 = require(\"./PubSub\");\nObject.defineProperty(exports, \"CONTROL_MSG\", { enumerable: true, get: function () { return PubSub_1.CONTROL_MSG; } });\nObject.defineProperty(exports, \"ConnectionState\", { enumerable: true, get: function () { return PubSub_1.ConnectionState; } });\nvar GraphQLAuthError;\n(function (GraphQLAuthError) {\n GraphQLAuthError[\"NO_API_KEY\"] = \"No api-key configured\";\n GraphQLAuthError[\"NO_CURRENT_USER\"] = \"No current user\";\n GraphQLAuthError[\"NO_CREDENTIALS\"] = \"No credentials\";\n GraphQLAuthError[\"NO_FEDERATED_JWT\"] = \"No federated jwt\";\n GraphQLAuthError[\"NO_AUTH_TOKEN\"] = \"No auth token specified\";\n})(GraphQLAuthError = exports.GraphQLAuthError || (exports.GraphQLAuthError = {}));\nexports.__amplify = Symbol('amplify');\n"],"names":[],"mappings":";;AACA,MAAM,CAAC,cAAc,CAAC,OAAO,EAAE,YAAY,EAAE,EAAE,KAAK,EAAE,IAAI,EAAE,CAAC,CAAC;AAC9D,OAAO,CAAC,SAAS,GAAG,OAAO,CAAC,gBAAgB,GAAG,OAAO,CAAC,eAAe,GAAG,OAAO,CAAC,WAAW,GAAG,KAAK,CAAC,CAAC;AACtG,IAAI,QAAQ,GAAG,OAAO,CAAC,UAAU,CAAC,CAAC;AACnC,MAAM,CAAC,cAAc,CAAC,OAAO,EAAE,aAAa,EAAE,EAAE,UAAU,EAAE,IAAI,EAAE,GAAG,EAAE,YAAY,EAAE,OAAO,QAAQ,CAAC,WAAW,CAAC,EAAE,EAAE,CAAC,CAAC;AACvH,MAAM,CAAC,cAAc,CAAC,OAAO,EAAE,iBAAiB,EAAE,EAAE,UAAU,EAAE,IAAI,EAAE,GAAG,EAAE,YAAY,EAAE,OAAO,QAAQ,CAAC,eAAe,CAAC,EAAE,EAAE,CAAC,CAAC;AAE/H,CAAC,UAAU,gBAAgB,EAAE;AAC7B,IAAI,gBAAgB,CAAC,YAAY,CAAC,GAAG,uBAAuB,CAAC;AAC7D,IAAI,gBAAgB,CAAC,iBAAiB,CAAC,GAAG,iBAAiB,CAAC;AAC5D,IAAI,gBAAgB,CAAC,gBAAgB,CAAC,GAAG,gBAAgB,CAAC;AAC1D,IAAI,gBAAgB,CAAC,kBAAkB,CAAC,GAAG,kBAAkB,CAAC;AAC9D,IAAI,gBAAgB,CAAC,eAAe,CAAC,GAAG,yBAAyB,CAAC;AAClE,CAAC,EAAqB,OAAO,CAAC,gBAAgB,KAAK,OAAO,CAAC,gBAAgB,GAAG,EAAE,CAAC,CAAC,CAAC;AACnF,OAAO,CAAC,SAAS,GAAG,MAAM,CAAC,SAAS,CAAC;;"}
1
+ {"version":3,"file":"index.js","sources":["../../../src/types/index.ts"],"sourcesContent":["\"use strict\";\nObject.defineProperty(exports, \"__esModule\", { value: true });\nexports.__authToken = exports.__authMode = exports.__amplify = exports.GraphQLAuthError = exports.ConnectionState = exports.CONTROL_MSG = void 0;\nvar PubSub_1 = require(\"./PubSub\");\nObject.defineProperty(exports, \"CONTROL_MSG\", { enumerable: true, get: function () { return PubSub_1.CONTROL_MSG; } });\nObject.defineProperty(exports, \"ConnectionState\", { enumerable: true, get: function () { return PubSub_1.ConnectionState; } });\nvar GraphQLAuthError;\n(function (GraphQLAuthError) {\n GraphQLAuthError[\"NO_API_KEY\"] = \"No api-key configured\";\n GraphQLAuthError[\"NO_CURRENT_USER\"] = \"No current user\";\n GraphQLAuthError[\"NO_CREDENTIALS\"] = \"No credentials\";\n GraphQLAuthError[\"NO_FEDERATED_JWT\"] = \"No federated jwt\";\n GraphQLAuthError[\"NO_AUTH_TOKEN\"] = \"No auth token specified\";\n})(GraphQLAuthError = exports.GraphQLAuthError || (exports.GraphQLAuthError = {}));\nexports.__amplify = Symbol('amplify');\nexports.__authMode = Symbol('authMode');\nexports.__authToken = Symbol('authToken');\n"],"names":[],"mappings":";;AACA,MAAM,CAAC,cAAc,CAAC,OAAO,EAAE,YAAY,EAAE,EAAE,KAAK,EAAE,IAAI,EAAE,CAAC,CAAC;AAC9D,OAAO,CAAC,WAAW,GAAG,OAAO,CAAC,UAAU,GAAG,OAAO,CAAC,SAAS,GAAG,OAAO,CAAC,gBAAgB,GAAG,OAAO,CAAC,eAAe,GAAG,OAAO,CAAC,WAAW,GAAG,KAAK,CAAC,CAAC;AACjJ,IAAI,QAAQ,GAAG,OAAO,CAAC,UAAU,CAAC,CAAC;AACnC,MAAM,CAAC,cAAc,CAAC,OAAO,EAAE,aAAa,EAAE,EAAE,UAAU,EAAE,IAAI,EAAE,GAAG,EAAE,YAAY,EAAE,OAAO,QAAQ,CAAC,WAAW,CAAC,EAAE,EAAE,CAAC,CAAC;AACvH,MAAM,CAAC,cAAc,CAAC,OAAO,EAAE,iBAAiB,EAAE,EAAE,UAAU,EAAE,IAAI,EAAE,GAAG,EAAE,YAAY,EAAE,OAAO,QAAQ,CAAC,eAAe,CAAC,EAAE,EAAE,CAAC,CAAC;AAE/H,CAAC,UAAU,gBAAgB,EAAE;AAC7B,IAAI,gBAAgB,CAAC,YAAY,CAAC,GAAG,uBAAuB,CAAC;AAC7D,IAAI,gBAAgB,CAAC,iBAAiB,CAAC,GAAG,iBAAiB,CAAC;AAC5D,IAAI,gBAAgB,CAAC,gBAAgB,CAAC,GAAG,gBAAgB,CAAC;AAC1D,IAAI,gBAAgB,CAAC,kBAAkB,CAAC,GAAG,kBAAkB,CAAC;AAC9D,IAAI,gBAAgB,CAAC,eAAe,CAAC,GAAG,yBAAyB,CAAC;AAClE,CAAC,EAAqB,OAAO,CAAC,gBAAgB,KAAK,OAAO,CAAC,gBAAgB,GAAG,EAAE,CAAC,CAAC,CAAC;AACnF,OAAO,CAAC,SAAS,GAAG,MAAM,CAAC,SAAS,CAAC,CAAC;AACtC,OAAO,CAAC,UAAU,GAAG,MAAM,CAAC,UAAU,CAAC,CAAC;AACxC,OAAO,CAAC,WAAW,GAAG,MAAM,CAAC,WAAW,CAAC;;"}
@@ -0,0 +1,25 @@
1
+ 'use strict';
2
+
3
+ Object.defineProperty(exports, "__esModule", { value: true });
4
+ exports.findIndexByFields = void 0;
5
+ // Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
6
+ // SPDX-License-Identifier: Apache-2.0
7
+ /**
8
+ * Iterates through a collection to find a matching item and returns the index.
9
+ *
10
+ * @param needle The item to search for
11
+ * @param haystack The collection to search
12
+ * @param keyFields The fields used to indicate a match
13
+ * @returns Index of `needle` in `haystack`, otherwise -1 if not found.
14
+ */
15
+ function findIndexByFields(needle, haystack, keyFields) {
16
+ const searchObject = Object.fromEntries(keyFields.map(fieldName => [fieldName, needle[fieldName]]));
17
+ for (let i = 0; i < haystack.length; i++) {
18
+ if (Object.keys(searchObject).every(k => searchObject[k] === haystack[i][k])) {
19
+ return i;
20
+ }
21
+ }
22
+ return -1;
23
+ }
24
+ exports.findIndexByFields = findIndexByFields;
25
+ //# sourceMappingURL=findIndexByFields.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"findIndexByFields.js","sources":["../../../src/utils/findIndexByFields.ts"],"sourcesContent":["\"use strict\";\nObject.defineProperty(exports, \"__esModule\", { value: true });\nexports.findIndexByFields = void 0;\n// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\n/**\n * Iterates through a collection to find a matching item and returns the index.\n *\n * @param needle The item to search for\n * @param haystack The collection to search\n * @param keyFields The fields used to indicate a match\n * @returns Index of `needle` in `haystack`, otherwise -1 if not found.\n */\nfunction findIndexByFields(needle, haystack, keyFields) {\n const searchObject = Object.fromEntries(keyFields.map(fieldName => [fieldName, needle[fieldName]]));\n for (let i = 0; i < haystack.length; i++) {\n if (Object.keys(searchObject).every(k => searchObject[k] === haystack[i][k])) {\n return i;\n }\n }\n return -1;\n}\nexports.findIndexByFields = findIndexByFields;\n"],"names":[],"mappings":";;AACA,MAAM,CAAC,cAAc,CAAC,OAAO,EAAE,YAAY,EAAE,EAAE,KAAK,EAAE,IAAI,EAAE,CAAC,CAAC;AAC9D,OAAO,CAAC,iBAAiB,GAAG,KAAK,CAAC,CAAC;AACnC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAAS,iBAAiB,CAAC,MAAM,EAAE,QAAQ,EAAE,SAAS,EAAE;AACxD,IAAI,MAAM,YAAY,GAAG,MAAM,CAAC,WAAW,CAAC,SAAS,CAAC,GAAG,CAAC,SAAS,IAAI,CAAC,SAAS,EAAE,MAAM,CAAC,SAAS,CAAC,CAAC,CAAC,CAAC,CAAC;AACxG,IAAI,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,QAAQ,CAAC,MAAM,EAAE,CAAC,EAAE,EAAE;AAC9C,QAAQ,IAAI,MAAM,CAAC,IAAI,CAAC,YAAY,CAAC,CAAC,KAAK,CAAC,CAAC,IAAI,YAAY,CAAC,CAAC,CAAC,KAAK,QAAQ,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,EAAE;AACtF,YAAY,OAAO,CAAC,CAAC;AACrB,SAAS;AACT,KAAK;AACL,IAAI,OAAO,CAAC,CAAC,CAAC;AACd,CAAC;AACD,OAAO,CAAC,iBAAiB,GAAG,iBAAiB;;"}
@@ -3,9 +3,13 @@
3
3
  // Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
4
4
  // SPDX-License-Identifier: Apache-2.0
5
5
  Object.defineProperty(exports, "__esModule", { value: true });
6
- exports.resolveLibraryOptions = exports.resolveConfig = void 0;
6
+ exports.findIndexByFields = exports.resolvePKFields = exports.resolveLibraryOptions = exports.resolveConfig = void 0;
7
7
  var resolveConfig_1 = require("./resolveConfig");
8
8
  Object.defineProperty(exports, "resolveConfig", { enumerable: true, get: function () { return resolveConfig_1.resolveConfig; } });
9
9
  var resolveLibraryOptions_1 = require("./resolveLibraryOptions");
10
10
  Object.defineProperty(exports, "resolveLibraryOptions", { enumerable: true, get: function () { return resolveLibraryOptions_1.resolveLibraryOptions; } });
11
+ var resolvePKFields_1 = require("./resolvePKFields");
12
+ Object.defineProperty(exports, "resolvePKFields", { enumerable: true, get: function () { return resolvePKFields_1.resolvePKFields; } });
13
+ var findIndexByFields_1 = require("./findIndexByFields");
14
+ Object.defineProperty(exports, "findIndexByFields", { enumerable: true, get: function () { return findIndexByFields_1.findIndexByFields; } });
11
15
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sources":["../../../src/utils/index.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.resolveLibraryOptions = exports.resolveConfig = void 0;\nvar resolveConfig_1 = require(\"./resolveConfig\");\nObject.defineProperty(exports, \"resolveConfig\", { enumerable: true, get: function () { return resolveConfig_1.resolveConfig; } });\nvar resolveLibraryOptions_1 = require(\"./resolveLibraryOptions\");\nObject.defineProperty(exports, \"resolveLibraryOptions\", { enumerable: true, get: function () { return resolveLibraryOptions_1.resolveLibraryOptions; } });\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,OAAO,CAAC,aAAa,GAAG,KAAK,CAAC,CAAC;AAC/D,IAAI,eAAe,GAAG,OAAO,CAAC,iBAAiB,CAAC,CAAC;AACjD,MAAM,CAAC,cAAc,CAAC,OAAO,EAAE,eAAe,EAAE,EAAE,UAAU,EAAE,IAAI,EAAE,GAAG,EAAE,YAAY,EAAE,OAAO,eAAe,CAAC,aAAa,CAAC,EAAE,EAAE,CAAC,CAAC;AAClI,IAAI,uBAAuB,GAAG,OAAO,CAAC,yBAAyB,CAAC,CAAC;AACjE,MAAM,CAAC,cAAc,CAAC,OAAO,EAAE,uBAAuB,EAAE,EAAE,UAAU,EAAE,IAAI,EAAE,GAAG,EAAE,YAAY,EAAE,OAAO,uBAAuB,CAAC,qBAAqB,CAAC,EAAE,EAAE,CAAC;;"}
1
+ {"version":3,"file":"index.js","sources":["../../../src/utils/index.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.findIndexByFields = exports.resolvePKFields = exports.resolveLibraryOptions = exports.resolveConfig = void 0;\nvar resolveConfig_1 = require(\"./resolveConfig\");\nObject.defineProperty(exports, \"resolveConfig\", { enumerable: true, get: function () { return resolveConfig_1.resolveConfig; } });\nvar resolveLibraryOptions_1 = require(\"./resolveLibraryOptions\");\nObject.defineProperty(exports, \"resolveLibraryOptions\", { enumerable: true, get: function () { return resolveLibraryOptions_1.resolveLibraryOptions; } });\nvar resolvePKFields_1 = require(\"./resolvePKFields\");\nObject.defineProperty(exports, \"resolvePKFields\", { enumerable: true, get: function () { return resolvePKFields_1.resolvePKFields; } });\nvar findIndexByFields_1 = require(\"./findIndexByFields\");\nObject.defineProperty(exports, \"findIndexByFields\", { enumerable: true, get: function () { return findIndexByFields_1.findIndexByFields; } });\n"],"names":[],"mappings":";;AACA;AACA;AACA,MAAM,CAAC,cAAc,CAAC,OAAO,EAAE,YAAY,EAAE,EAAE,KAAK,EAAE,IAAI,EAAE,CAAC,CAAC;AAC9D,OAAO,CAAC,iBAAiB,GAAG,OAAO,CAAC,eAAe,GAAG,OAAO,CAAC,qBAAqB,GAAG,OAAO,CAAC,aAAa,GAAG,KAAK,CAAC,CAAC;AACrH,IAAI,eAAe,GAAG,OAAO,CAAC,iBAAiB,CAAC,CAAC;AACjD,MAAM,CAAC,cAAc,CAAC,OAAO,EAAE,eAAe,EAAE,EAAE,UAAU,EAAE,IAAI,EAAE,GAAG,EAAE,YAAY,EAAE,OAAO,eAAe,CAAC,aAAa,CAAC,EAAE,EAAE,CAAC,CAAC;AAClI,IAAI,uBAAuB,GAAG,OAAO,CAAC,yBAAyB,CAAC,CAAC;AACjE,MAAM,CAAC,cAAc,CAAC,OAAO,EAAE,uBAAuB,EAAE,EAAE,UAAU,EAAE,IAAI,EAAE,GAAG,EAAE,YAAY,EAAE,OAAO,uBAAuB,CAAC,qBAAqB,CAAC,EAAE,EAAE,CAAC,CAAC;AAC1J,IAAI,iBAAiB,GAAG,OAAO,CAAC,mBAAmB,CAAC,CAAC;AACrD,MAAM,CAAC,cAAc,CAAC,OAAO,EAAE,iBAAiB,EAAE,EAAE,UAAU,EAAE,IAAI,EAAE,GAAG,EAAE,YAAY,EAAE,OAAO,iBAAiB,CAAC,eAAe,CAAC,EAAE,EAAE,CAAC,CAAC;AACxI,IAAI,mBAAmB,GAAG,OAAO,CAAC,qBAAqB,CAAC,CAAC;AACzD,MAAM,CAAC,cAAc,CAAC,OAAO,EAAE,mBAAmB,EAAE,EAAE,UAAU,EAAE,IAAI,EAAE,GAAG,EAAE,YAAY,EAAE,OAAO,mBAAmB,CAAC,iBAAiB,CAAC,EAAE,EAAE,CAAC;;"}
@@ -0,0 +1,42 @@
1
+ 'use strict';
2
+
3
+ Object.defineProperty(exports, "__esModule", { value: true });
4
+ exports.resolveOwnerFields = void 0;
5
+ /**
6
+ * Given an introspection schema model, returns all owner fields.
7
+ *
8
+ * @param model Model from an introspection schema
9
+ * @returns List of owner field names
10
+ */
11
+ function resolveOwnerFields(model) {
12
+ const ownerFields = new Set();
13
+ for (const attr of model.attributes || []) {
14
+ if (isAuthAttribute(attr)) {
15
+ for (const rule of attr.properties.rules) {
16
+ if (rule.allow === 'owner') {
17
+ ownerFields.add(rule.ownerField || 'owner');
18
+ }
19
+ }
20
+ }
21
+ }
22
+ return Array.from(ownerFields);
23
+ }
24
+ exports.resolveOwnerFields = resolveOwnerFields;
25
+ /**
26
+ * Type guard that identifies an auth attribute with an attached rules list that
27
+ * specifies an `allow` attribute at a minimum.
28
+ *
29
+ * @param attribute Any object. Ideally a model introspection schema model attribute
30
+ * @returns True if given object is an auth attribute
31
+ */
32
+ function isAuthAttribute(attribute) {
33
+ if (attribute?.type === 'auth') {
34
+ if (typeof attribute?.properties === 'object') {
35
+ if (Array.isArray(attribute?.properties?.rules)) {
36
+ return (attribute?.properties?.rules).every(rule => !!rule.allow);
37
+ }
38
+ }
39
+ }
40
+ return false;
41
+ }
42
+ //# sourceMappingURL=resolveOwnerFields.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"resolveOwnerFields.js","sources":["../../../src/utils/resolveOwnerFields.ts"],"sourcesContent":["\"use strict\";\nObject.defineProperty(exports, \"__esModule\", { value: true });\nexports.resolveOwnerFields = void 0;\n/**\n * Given an introspection schema model, returns all owner fields.\n *\n * @param model Model from an introspection schema\n * @returns List of owner field names\n */\nfunction resolveOwnerFields(model) {\n const ownerFields = new Set();\n for (const attr of model.attributes || []) {\n if (isAuthAttribute(attr)) {\n for (const rule of attr.properties.rules) {\n if (rule.allow === 'owner') {\n ownerFields.add(rule.ownerField || 'owner');\n }\n }\n }\n }\n return Array.from(ownerFields);\n}\nexports.resolveOwnerFields = resolveOwnerFields;\n/**\n * Type guard that identifies an auth attribute with an attached rules list that\n * specifies an `allow` attribute at a minimum.\n *\n * @param attribute Any object. Ideally a model introspection schema model attribute\n * @returns True if given object is an auth attribute\n */\nfunction isAuthAttribute(attribute) {\n if (attribute?.type === 'auth') {\n if (typeof attribute?.properties === 'object') {\n if (Array.isArray(attribute?.properties?.rules)) {\n return (attribute?.properties?.rules).every(rule => !!rule.allow);\n }\n }\n }\n return false;\n}\n"],"names":[],"mappings":";;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;AACA;AACA;AACA;AACA;AACA;AACA,SAAS,kBAAkB,CAAC,KAAK,EAAE;AACnC,IAAI,MAAM,WAAW,GAAG,IAAI,GAAG,EAAE,CAAC;AAClC,IAAI,KAAK,MAAM,IAAI,IAAI,KAAK,CAAC,UAAU,IAAI,EAAE,EAAE;AAC/C,QAAQ,IAAI,eAAe,CAAC,IAAI,CAAC,EAAE;AACnC,YAAY,KAAK,MAAM,IAAI,IAAI,IAAI,CAAC,UAAU,CAAC,KAAK,EAAE;AACtD,gBAAgB,IAAI,IAAI,CAAC,KAAK,KAAK,OAAO,EAAE;AAC5C,oBAAoB,WAAW,CAAC,GAAG,CAAC,IAAI,CAAC,UAAU,IAAI,OAAO,CAAC,CAAC;AAChE,iBAAiB;AACjB,aAAa;AACb,SAAS;AACT,KAAK;AACL,IAAI,OAAO,KAAK,CAAC,IAAI,CAAC,WAAW,CAAC,CAAC;AACnC,CAAC;AACD,OAAO,CAAC,kBAAkB,GAAG,kBAAkB,CAAC;AAChD;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAAS,eAAe,CAAC,SAAS,EAAE;AACpC,IAAI,IAAI,SAAS,EAAE,IAAI,KAAK,MAAM,EAAE;AACpC,QAAQ,IAAI,OAAO,SAAS,EAAE,UAAU,KAAK,QAAQ,EAAE;AACvD,YAAY,IAAI,KAAK,CAAC,OAAO,CAAC,SAAS,EAAE,UAAU,EAAE,KAAK,CAAC,EAAE;AAC7D,gBAAgB,OAAO,CAAC,SAAS,EAAE,UAAU,EAAE,KAAK,EAAE,KAAK,CAAC,IAAI,IAAI,CAAC,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC;AAClF,aAAa;AACb,SAAS;AACT,KAAK;AACL,IAAI,OAAO,KAAK,CAAC;AACjB;;"}
@@ -0,0 +1,17 @@
1
+ 'use strict';
2
+
3
+ Object.defineProperty(exports, "__esModule", { value: true });
4
+ exports.resolvePKFields = void 0;
5
+ /**
6
+ * Given a SchemaModel from a ModelIntrospectionSchema, returns the primary key
7
+ * as an array of field names.
8
+ *
9
+ * @param model The model object
10
+ * @returns Array of field names
11
+ */
12
+ function resolvePKFields(model) {
13
+ const { primaryKeyFieldName, sortKeyFieldNames } = model.primaryKeyInfo;
14
+ return [primaryKeyFieldName, ...sortKeyFieldNames];
15
+ }
16
+ exports.resolvePKFields = resolvePKFields;
17
+ //# sourceMappingURL=resolvePKFields.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"resolvePKFields.js","sources":["../../../src/utils/resolvePKFields.ts"],"sourcesContent":["\"use strict\";\nObject.defineProperty(exports, \"__esModule\", { value: true });\nexports.resolvePKFields = void 0;\n/**\n * Given a SchemaModel from a ModelIntrospectionSchema, returns the primary key\n * as an array of field names.\n *\n * @param model The model object\n * @returns Array of field names\n */\nfunction resolvePKFields(model) {\n const { primaryKeyFieldName, sortKeyFieldNames } = model.primaryKeyInfo;\n return [primaryKeyFieldName, ...sortKeyFieldNames];\n}\nexports.resolvePKFields = resolvePKFields;\n"],"names":[],"mappings":";;AACA,MAAM,CAAC,cAAc,CAAC,OAAO,EAAE,YAAY,EAAE,EAAE,KAAK,EAAE,IAAI,EAAE,CAAC,CAAC;AAC9D,OAAO,CAAC,eAAe,GAAG,KAAK,CAAC,CAAC;AACjC;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAAS,eAAe,CAAC,KAAK,EAAE;AAChC,IAAI,MAAM,EAAE,mBAAmB,EAAE,iBAAiB,EAAE,GAAG,KAAK,CAAC,cAAc,CAAC;AAC5E,IAAI,OAAO,CAAC,mBAAmB,EAAE,GAAG,iBAAiB,CAAC,CAAC;AACvD,CAAC;AACD,OAAO,CAAC,eAAe,GAAG,eAAe;;"}
@@ -43,7 +43,7 @@ class GraphQLAPIClass extends InternalGraphQLAPIClass {
43
43
  return super.cancel(request, message);
44
44
  }
45
45
  }
46
- const GraphQLAPI = new GraphQLAPIClass(null);
46
+ const GraphQLAPI = new GraphQLAPIClass();
47
47
 
48
48
  export { GraphQLAPI, GraphQLAPIClass, graphqlOperation };
49
49
  //# sourceMappingURL=GraphQLAPI.mjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"GraphQLAPI.mjs","sources":["../../src/GraphQLAPI.ts"],"sourcesContent":["import { Category, ApiAction } from '@aws-amplify/core/internals/utils';\nimport { InternalGraphQLAPIClass } from './internals/InternalGraphQLAPI';\nexport const graphqlOperation = (query, variables = {}, authToken) => ({\n query,\n variables,\n authToken,\n});\n/**\n * Export Cloud Logic APIs\n */\nexport class GraphQLAPIClass extends InternalGraphQLAPIClass {\n getModuleName() {\n return 'GraphQLAPI';\n }\n /**\n * Executes a GraphQL operation\n *\n * @param options - GraphQL Options\n * @param [additionalHeaders] - headers to merge in after any `graphql_headers` set in the config\n * @returns An Observable if the query is a subscription query, else a promise of the graphql result.\n */\n graphql(amplify, options, additionalHeaders) {\n return super.graphql(amplify, options, additionalHeaders, {\n category: Category.API,\n action: ApiAction.GraphQl,\n });\n }\n /**\n * Checks to see if an error thrown is from an api request cancellation\n * @param error - Any error\n * @returns A boolean indicating if the error was from an api request cancellation\n */\n isCancelError(error) {\n return super.isCancelError(error);\n }\n /**\n * Cancels an inflight request. Only applicable for graphql queries and mutations\n * @param {any} request - request to cancel\n * @returns A boolean indicating if the request was cancelled\n */\n cancel(request, message) {\n return super.cancel(request, message);\n }\n}\nexport const GraphQLAPI = new GraphQLAPIClass(null);\n"],"names":[],"mappings":";;;AAEY,MAAC,gBAAgB,GAAG,CAAC,KAAK,EAAE,SAAS,GAAG,EAAE,EAAE,SAAS,MAAM;AACvE,IAAI,KAAK;AACT,IAAI,SAAS;AACb,IAAI,SAAS;AACb,CAAC,EAAE;AACH;AACA;AACA;AACO,MAAM,eAAe,SAAS,uBAAuB,CAAC;AAC7D,IAAI,aAAa,GAAG;AACpB,QAAQ,OAAO,YAAY,CAAC;AAC5B,KAAK;AACL;AACA;AACA;AACA;AACA;AACA;AACA;AACA,IAAI,OAAO,CAAC,OAAO,EAAE,OAAO,EAAE,iBAAiB,EAAE;AACjD,QAAQ,OAAO,KAAK,CAAC,OAAO,CAAC,OAAO,EAAE,OAAO,EAAE,iBAAiB,EAAE;AAClE,YAAY,QAAQ,EAAE,QAAQ,CAAC,GAAG;AAClC,YAAY,MAAM,EAAE,SAAS,CAAC,OAAO;AACrC,SAAS,CAAC,CAAC;AACX,KAAK;AACL;AACA;AACA;AACA;AACA;AACA,IAAI,aAAa,CAAC,KAAK,EAAE;AACzB,QAAQ,OAAO,KAAK,CAAC,aAAa,CAAC,KAAK,CAAC,CAAC;AAC1C,KAAK;AACL;AACA;AACA;AACA;AACA;AACA,IAAI,MAAM,CAAC,OAAO,EAAE,OAAO,EAAE;AAC7B,QAAQ,OAAO,KAAK,CAAC,MAAM,CAAC,OAAO,EAAE,OAAO,CAAC,CAAC;AAC9C,KAAK;AACL,CAAC;AACW,MAAC,UAAU,GAAG,IAAI,eAAe,CAAC,IAAI;;;;"}
1
+ {"version":3,"file":"GraphQLAPI.mjs","sources":["../../src/GraphQLAPI.ts"],"sourcesContent":["import { Category, ApiAction } from '@aws-amplify/core/internals/utils';\nimport { InternalGraphQLAPIClass } from './internals/InternalGraphQLAPI';\nexport const graphqlOperation = (query, variables = {}, authToken) => ({\n query,\n variables,\n authToken,\n});\n/**\n * Export Cloud Logic APIs\n */\nexport class GraphQLAPIClass extends InternalGraphQLAPIClass {\n getModuleName() {\n return 'GraphQLAPI';\n }\n /**\n * Executes a GraphQL operation\n *\n * @param options - GraphQL Options\n * @param [additionalHeaders] - headers to merge in after any `graphql_headers` set in the config\n * @returns An Observable if the query is a subscription query, else a promise of the graphql result.\n */\n graphql(amplify, options, additionalHeaders) {\n return super.graphql(amplify, options, additionalHeaders, {\n category: Category.API,\n action: ApiAction.GraphQl,\n });\n }\n /**\n * Checks to see if an error thrown is from an api request cancellation\n * @param error - Any error\n * @returns A boolean indicating if the error was from an api request cancellation\n */\n isCancelError(error) {\n return super.isCancelError(error);\n }\n /**\n * Cancels an inflight request. Only applicable for graphql queries and mutations\n * @param {any} request - request to cancel\n * @returns A boolean indicating if the request was cancelled\n */\n cancel(request, message) {\n return super.cancel(request, message);\n }\n}\nexport const GraphQLAPI = new GraphQLAPIClass();\n"],"names":[],"mappings":";;;AAEY,MAAC,gBAAgB,GAAG,CAAC,KAAK,EAAE,SAAS,GAAG,EAAE,EAAE,SAAS,MAAM;AACvE,IAAI,KAAK;AACT,IAAI,SAAS;AACb,IAAI,SAAS;AACb,CAAC,EAAE;AACH;AACA;AACA;AACO,MAAM,eAAe,SAAS,uBAAuB,CAAC;AAC7D,IAAI,aAAa,GAAG;AACpB,QAAQ,OAAO,YAAY,CAAC;AAC5B,KAAK;AACL;AACA;AACA;AACA;AACA;AACA;AACA;AACA,IAAI,OAAO,CAAC,OAAO,EAAE,OAAO,EAAE,iBAAiB,EAAE;AACjD,QAAQ,OAAO,KAAK,CAAC,OAAO,CAAC,OAAO,EAAE,OAAO,EAAE,iBAAiB,EAAE;AAClE,YAAY,QAAQ,EAAE,QAAQ,CAAC,GAAG;AAClC,YAAY,MAAM,EAAE,SAAS,CAAC,OAAO;AACrC,SAAS,CAAC,CAAC;AACX,KAAK;AACL;AACA;AACA;AACA;AACA;AACA,IAAI,aAAa,CAAC,KAAK,EAAE;AACzB,QAAQ,OAAO,KAAK,CAAC,aAAa,CAAC,KAAK,CAAC,CAAC;AAC1C,KAAK;AACL;AACA;AACA;AACA;AACA;AACA,IAAI,MAAM,CAAC,OAAO,EAAE,OAAO,EAAE;AAC7B,QAAQ,OAAO,KAAK,CAAC,MAAM,CAAC,OAAO,EAAE,OAAO,CAAC,CAAC;AAC9C,KAAK;AACL,CAAC;AACW,MAAC,UAAU,GAAG,IAAI,eAAe;;;;"}
@@ -11,7 +11,7 @@ import { ReconnectionMonitor, ReconnectEvent } from '../../utils/ReconnectionMon
11
11
  // Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
12
12
  // SPDX-License-Identifier: Apache-2.0
13
13
  const logger = new ConsoleLogger('AWSAppSyncRealTimeProvider');
14
- const dispatchApiEvent = payload => {
14
+ const dispatchApiEvent = (payload) => {
15
15
  Hub.dispatch('api', payload, 'PubSub', AMPLIFY_SYMBOL);
16
16
  };
17
17
  const standardDomainPattern = /^https:\/\/\w{26}\.appsync\-api\.\w{2}(?:(?:\-\w{2,})+)\-\d\.amazonaws.com(?:\.cn)?\/graphql$/i;