@aws-amplify/api-graphql 4.0.1-console-preview.d745d43.0 → 4.0.1-mjs-test.20ead30.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.
- package/dist/cjs/GraphQLAPI.js +52 -0
- package/dist/cjs/GraphQLAPI.js.map +1 -0
- package/dist/cjs/Providers/AWSAppSyncRealTimeProvider/index.js +693 -0
- package/dist/cjs/Providers/AWSAppSyncRealTimeProvider/index.js.map +1 -0
- package/{lib → dist/cjs}/Providers/constants.js +8 -8
- package/dist/cjs/Providers/constants.js.map +1 -0
- package/dist/cjs/index.js +15 -0
- package/dist/cjs/index.js.map +1 -0
- package/dist/cjs/internals/InternalGraphQLAPI.js +274 -0
- package/dist/cjs/internals/InternalGraphQLAPI.js.map +1 -0
- package/dist/cjs/internals/index.js +14 -0
- package/dist/cjs/internals/index.js.map +1 -0
- package/{lib → dist/cjs}/internals/v6.js +7 -4
- package/dist/cjs/internals/v6.js.map +1 -0
- package/{lib → dist/cjs}/types/PubSub.js +6 -6
- package/dist/cjs/types/PubSub.js.map +1 -0
- package/{lib → dist/cjs}/types/index.js +7 -5
- package/dist/cjs/types/index.js.map +1 -0
- package/dist/cjs/utils/ConnectionStateMonitor.js +134 -0
- package/dist/cjs/utils/ConnectionStateMonitor.js.map +1 -0
- package/dist/cjs/utils/ReachabilityMonitor/index.js +10 -0
- package/dist/cjs/utils/ReachabilityMonitor/index.js.map +1 -0
- package/dist/cjs/utils/ReachabilityMonitor/index.native.js +12 -0
- package/dist/cjs/utils/ReachabilityMonitor/index.native.js.map +1 -0
- package/{lib → dist/cjs}/utils/ReconnectionMonitor.js +24 -25
- package/dist/cjs/utils/ReconnectionMonitor.js.map +1 -0
- package/dist/cjs/utils/errors/APIError.js +21 -0
- package/dist/cjs/utils/errors/APIError.js.map +1 -0
- package/dist/cjs/utils/errors/assertValidationError.js +19 -0
- package/dist/cjs/utils/errors/assertValidationError.js.map +1 -0
- package/dist/cjs/utils/errors/index.js +14 -0
- package/dist/cjs/utils/errors/index.js.map +1 -0
- package/{lib → dist/cjs}/utils/errors/validation.js +9 -7
- package/dist/cjs/utils/errors/validation.js.map +1 -0
- package/dist/cjs/utils/index.js +11 -0
- package/dist/cjs/utils/index.js.map +1 -0
- package/dist/cjs/utils/resolveConfig.js +26 -0
- package/dist/cjs/utils/resolveConfig.js.map +1 -0
- package/dist/cjs/utils/resolveLibraryOptions.js +16 -0
- package/dist/cjs/utils/resolveLibraryOptions.js.map +1 -0
- package/{lib-esm → dist/esm}/GraphQLAPI.d.ts +2 -2
- package/dist/esm/GraphQLAPI.mjs +50 -0
- package/dist/esm/GraphQLAPI.mjs.map +1 -0
- package/{lib → dist/esm}/Providers/AWSAppSyncRealTimeProvider/index.d.ts +1 -1
- package/dist/esm/Providers/AWSAppSyncRealTimeProvider/index.mjs +691 -0
- package/dist/esm/Providers/AWSAppSyncRealTimeProvider/index.mjs.map +1 -0
- package/{lib-esm/Providers/constants.js → dist/esm/Providers/constants.mjs} +18 -14
- package/dist/esm/Providers/constants.mjs.map +1 -0
- package/dist/esm/index.mjs +5 -0
- package/dist/esm/index.mjs.map +1 -0
- package/{lib → dist/esm}/internals/InternalGraphQLAPI.d.ts +2 -2
- package/dist/esm/internals/InternalGraphQLAPI.mjs +272 -0
- package/dist/esm/internals/InternalGraphQLAPI.mjs.map +1 -0
- package/dist/esm/internals/index.mjs +3 -0
- package/dist/esm/internals/index.mjs.map +1 -0
- package/{lib-esm/internals/v6.js → dist/esm/internals/v6.mjs} +10 -6
- package/dist/esm/internals/v6.mjs.map +1 -0
- package/{lib → dist/esm}/types/PubSub.d.ts +2 -2
- package/{lib-esm/types/PubSub.js → dist/esm/types/PubSub.mjs} +5 -2
- package/dist/esm/types/PubSub.mjs.map +1 -0
- package/{lib-esm → dist/esm}/types/index.d.ts +45 -25
- package/{lib-esm/types/index.js → dist/esm/types/index.mjs} +7 -3
- package/dist/esm/types/index.mjs.map +1 -0
- package/{lib-esm → dist/esm}/utils/ConnectionStateMonitor.d.ts +3 -3
- package/{lib-esm/utils/ConnectionStateMonitor.js → dist/esm/utils/ConnectionStateMonitor.mjs} +56 -66
- package/dist/esm/utils/ConnectionStateMonitor.mjs.map +1 -0
- package/dist/esm/utils/ReachabilityMonitor/index.d.ts +1 -0
- package/{lib-esm/utils/ReachabilityMonitor/index.js → dist/esm/utils/ReachabilityMonitor/index.mjs} +6 -2
- package/dist/esm/utils/ReachabilityMonitor/index.mjs.map +1 -0
- package/dist/esm/utils/ReachabilityMonitor/index.native.d.ts +1 -0
- package/dist/esm/utils/ReachabilityMonitor/index.native.mjs +9 -0
- package/dist/esm/utils/ReachabilityMonitor/index.native.mjs.map +1 -0
- package/{lib-esm/utils/ReconnectionMonitor.js → dist/esm/utils/ReconnectionMonitor.mjs} +25 -26
- package/dist/esm/utils/ReconnectionMonitor.mjs.map +1 -0
- package/dist/esm/utils/errors/APIError.mjs +19 -0
- package/dist/esm/utils/errors/APIError.mjs.map +1 -0
- package/dist/esm/utils/errors/assertValidationError.mjs +17 -0
- package/dist/esm/utils/errors/assertValidationError.mjs.map +1 -0
- package/dist/esm/utils/errors/index.mjs +4 -0
- package/dist/esm/utils/errors/index.mjs.map +1 -0
- package/{lib-esm/utils/errors/validation.js → dist/esm/utils/errors/validation.mjs} +9 -7
- package/dist/esm/utils/errors/validation.mjs.map +1 -0
- package/dist/esm/utils/index.mjs +3 -0
- package/dist/esm/utils/index.mjs.map +1 -0
- package/{lib → dist/esm}/utils/resolveConfig.d.ts +1 -1
- package/dist/esm/utils/resolveConfig.mjs +26 -0
- package/dist/esm/utils/resolveConfig.mjs.map +1 -0
- package/{lib-esm → dist/esm}/utils/resolveLibraryOptions.d.ts +2 -2
- package/dist/esm/utils/resolveLibraryOptions.mjs +13 -0
- package/dist/esm/utils/resolveLibraryOptions.mjs.map +1 -0
- package/internals/package.json +4 -4
- package/package.json +48 -26
- package/src/GraphQLAPI.ts +2 -2
- package/src/internals/InternalGraphQLAPI.ts +35 -10
- package/src/types/index.ts +51 -9
- package/lib/GraphQLAPI.d.ts +0 -38
- package/lib/GraphQLAPI.js +0 -57
- package/lib/Providers/AWSAppSyncRealTimeProvider/index.js +0 -805
- package/lib/Providers/constants.d.ts +0 -95
- package/lib/index.d.ts +0 -3
- package/lib/index.js +0 -12
- package/lib/internals/InternalGraphQLAPI.js +0 -316
- package/lib/internals/index.d.ts +0 -2
- package/lib/internals/index.js +0 -11
- package/lib/internals/v6.d.ts +0 -101
- package/lib/tsconfig.tsbuildinfo +0 -6638
- package/lib/types/index.d.ts +0 -289
- package/lib/utils/ConnectionStateMonitor.d.ts +0 -41
- package/lib/utils/ConnectionStateMonitor.js +0 -144
- package/lib/utils/ReachabilityMonitor/index.d.ts +0 -1
- package/lib/utils/ReachabilityMonitor/index.js +0 -6
- package/lib/utils/ReachabilityMonitor/index.native.d.ts +0 -1
- package/lib/utils/ReachabilityMonitor/index.native.js +0 -10
- package/lib/utils/ReconnectionMonitor.d.ts +0 -29
- package/lib/utils/errors/APIError.d.ts +0 -7
- package/lib/utils/errors/APIError.js +0 -22
- package/lib/utils/errors/assertValidationError.d.ts +0 -5
- package/lib/utils/errors/assertValidationError.js +0 -16
- package/lib/utils/errors/index.d.ts +0 -3
- package/lib/utils/errors/index.js +0 -11
- package/lib/utils/errors/validation.d.ts +0 -7
- package/lib/utils/index.d.ts +0 -2
- package/lib/utils/index.js +0 -8
- package/lib/utils/resolveConfig.js +0 -23
- package/lib/utils/resolveLibraryOptions.d.ts +0 -11
- package/lib/utils/resolveLibraryOptions.js +0 -13
- package/lib-esm/GraphQLAPI.js +0 -55
- package/lib-esm/Providers/AWSAppSyncRealTimeProvider/index.d.ts +0 -64
- package/lib-esm/Providers/AWSAppSyncRealTimeProvider/index.js +0 -803
- package/lib-esm/index.js +0 -5
- package/lib-esm/internals/InternalGraphQLAPI.d.ts +0 -58
- package/lib-esm/internals/InternalGraphQLAPI.js +0 -314
- package/lib-esm/internals/index.js +0 -4
- package/lib-esm/tsconfig.tsbuildinfo +0 -6638
- package/lib-esm/types/PubSub.d.ts +0 -27
- package/lib-esm/utils/ReachabilityMonitor/index.d.ts +0 -1
- package/lib-esm/utils/ReachabilityMonitor/index.native.d.ts +0 -1
- package/lib-esm/utils/ReachabilityMonitor/index.native.js +0 -7
- package/lib-esm/utils/errors/APIError.js +0 -20
- package/lib-esm/utils/errors/assertValidationError.js +0 -13
- package/lib-esm/utils/errors/index.js +0 -5
- package/lib-esm/utils/index.js +0 -4
- package/lib-esm/utils/resolveConfig.d.ts +0 -12
- package/lib-esm/utils/resolveConfig.js +0 -21
- package/lib-esm/utils/resolveLibraryOptions.js +0 -11
- /package/{lib-esm → dist/esm}/Providers/constants.d.ts +0 -0
- /package/{lib-esm → dist/esm}/index.d.ts +0 -0
- /package/{lib-esm → dist/esm}/internals/index.d.ts +0 -0
- /package/{lib-esm → dist/esm}/internals/v6.d.ts +0 -0
- /package/{lib-esm → dist/esm}/utils/ReconnectionMonitor.d.ts +0 -0
- /package/{lib-esm → dist/esm}/utils/errors/APIError.d.ts +0 -0
- /package/{lib-esm → dist/esm}/utils/errors/assertValidationError.d.ts +0 -0
- /package/{lib-esm → dist/esm}/utils/errors/index.d.ts +0 -0
- /package/{lib-esm → dist/esm}/utils/errors/validation.d.ts +0 -0
- /package/{lib-esm → dist/esm}/utils/index.d.ts +0 -0
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"v6.mjs","sources":["../../../src/internals/v6.ts"],"sourcesContent":["// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\nimport { GraphQLAPI } from '../GraphQLAPI';\nimport { __amplify, } from '../types';\n/**\n * Invokes graphql operations against a graphql service, providing correct input and\n * output types if Amplify-generated graphql from a recent version of the CLI/codegen\n * are used *or* correct typing is provided via the type argument.\n *\n * Amplify-generated \"branded\" graphql queries will look similar to this:\n *\n * ```ts\n * //\n * // |-- branding\n * // v\n * export const getModel = `...` as GeneratedQuery<\n * \tGetModelQueryVariables,\n * \tGetModelQuery\n * >;\n * ```\n *\n * If this branding is not in your generated graphql, update to a newer version of\n * CLI/codegen and regenerate your graphql using `amplify codegen`.\n *\n * ## Using Amplify-generated graphql\n *\n * ```ts\n * import * as queries from './graphql/queries';\n *\n * //\n * // |-- correctly typed graphql response containing a Widget\n * // v\n * const queryResult = await graphql({\n * \tquery: queries.getWidget,\n * \tvariables: {\n * \t\tid: \"abc\", // <-- type hinted/enforced\n * \t},\n * });\n *\n * //\n * // |-- a correctly typed Widget\n * // v\n * const fetchedWidget = queryResult.data?.getWidget!;\n * ```\n *\n * ## Custom input + result types\n *\n * To provide input types (`variables`) and result types:\n *\n * ```ts\n * type GetById_NameOnly = {\n * \tvariables: {\n * \t\tid: string\n * \t},\n * \tresult: Promise<{\n * \t\tdata: { getWidget: { name: string } }\n * \t}>\n * }\n *\n * //\n * // |-- type is GetById_NameOnly[\"result\"]\n * // v\n * const result = graphql<GetById_NameOnly>({\n * \tquery: \"...\",\n * \tvariables: { id: \"abc\" } // <-- type of GetById_NameOnly[\"variables\"]\n * });\n * ```\n *\n * ## Custom result type only\n *\n * To specify result types only, use a type that is *not* in the `{variables, result}` shape:\n *\n * ```ts\n * type MyResultType = Promise<{\n * \tdata: {\n * \t\tgetWidget: { name: string }\n * \t}\n * }>\n *\n * //\n * // |-- type is MyResultType\n * // v\n * const result = graphql<MyResultType>({query: \"...\"});\n * ```\n *\n * @param options\n * @param additionalHeaders\n */\nexport function graphql(options, additionalHeaders) {\n /**\n * The correctness of these typings depends on correct string branding or overrides.\n * Neither of these can actually be validated at runtime. Hence, we don't perform\n * any validation or type-guarding here.\n */\n const result = GraphQLAPI.graphql(this[__amplify], options, additionalHeaders);\n return result;\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 */\nexport function cancel(promise, message) {\n return GraphQLAPI.cancel(promise, message);\n}\n/**\n * Checks to see if an error thrown is from an api request cancellation\n * @param {any} error - Any error\n * @returns - A boolean indicating if the error was from an api request cancellation\n */\nexport function isCancelError(error) {\n return GraphQLAPI.isCancelError(error);\n}\n"],"names":[],"mappings":";;;AAAA;AACA;AAGA;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;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,OAAO,CAAC,OAAO,EAAE,iBAAiB,EAAE;AACpD;AACA;AACA;AACA;AACA;AACA,IAAI,MAAM,MAAM,GAAG,UAAU,CAAC,OAAO,CAAC,IAAI,CAAC,SAAS,CAAC,EAAE,OAAO,EAAE,iBAAiB,CAAC,CAAC;AACnF,IAAI,OAAO,MAAM,CAAC;AAClB,CAAC;AACD;AACA;AACA;AACA;AACA;AACO,SAAS,MAAM,CAAC,OAAO,EAAE,OAAO,EAAE;AACzC,IAAI,OAAO,UAAU,CAAC,MAAM,CAAC,OAAO,EAAE,OAAO,CAAC,CAAC;AAC/C,CAAC;AACD;AACA;AACA;AACA;AACA;AACO,SAAS,aAAa,CAAC,KAAK,EAAE;AACrC,IAAI,OAAO,UAAU,CAAC,aAAa,CAAC,KAAK,CAAC,CAAC;AAC3C;;;;"}
|
|
@@ -23,5 +23,5 @@ export declare enum ConnectionState {
|
|
|
23
23
|
Disconnected = "Disconnected",
|
|
24
24
|
ConnectedPendingKeepAlive = "ConnectedPendingKeepAlive"
|
|
25
25
|
}
|
|
26
|
-
export
|
|
27
|
-
export
|
|
26
|
+
export type PubSubContent = Record<string, unknown>;
|
|
27
|
+
export type PubSubContentObserver = Observer<PubSubContent>;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
|
|
1
|
+
var CONTROL_MSG;
|
|
2
2
|
(function (CONTROL_MSG) {
|
|
3
3
|
CONTROL_MSG["CONNECTION_CLOSED"] = "Connection closed";
|
|
4
4
|
CONTROL_MSG["CONNECTION_FAILED"] = "Connection failed";
|
|
@@ -7,7 +7,7 @@ export var CONTROL_MSG;
|
|
|
7
7
|
CONTROL_MSG["TIMEOUT_DISCONNECT"] = "Timeout disconnect";
|
|
8
8
|
})(CONTROL_MSG || (CONTROL_MSG = {}));
|
|
9
9
|
/** @enum {string} */
|
|
10
|
-
|
|
10
|
+
var ConnectionState;
|
|
11
11
|
(function (ConnectionState) {
|
|
12
12
|
/*
|
|
13
13
|
* The connection is alive and healthy
|
|
@@ -42,3 +42,6 @@ export var ConnectionState;
|
|
|
42
42
|
*/
|
|
43
43
|
ConnectionState["ConnectedPendingKeepAlive"] = "ConnectedPendingKeepAlive";
|
|
44
44
|
})(ConnectionState || (ConnectionState = {}));
|
|
45
|
+
|
|
46
|
+
export { CONTROL_MSG, ConnectionState };
|
|
47
|
+
//# sourceMappingURL=PubSub.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"PubSub.mjs","sources":["../../../src/types/PubSub.ts"],"sourcesContent":["export var CONTROL_MSG;\n(function (CONTROL_MSG) {\n CONTROL_MSG[\"CONNECTION_CLOSED\"] = \"Connection closed\";\n CONTROL_MSG[\"CONNECTION_FAILED\"] = \"Connection failed\";\n CONTROL_MSG[\"REALTIME_SUBSCRIPTION_INIT_ERROR\"] = \"AppSync Realtime subscription init error\";\n CONTROL_MSG[\"SUBSCRIPTION_ACK\"] = \"Subscription ack\";\n CONTROL_MSG[\"TIMEOUT_DISCONNECT\"] = \"Timeout disconnect\";\n})(CONTROL_MSG || (CONTROL_MSG = {}));\n/** @enum {string} */\nexport var ConnectionState;\n(function (ConnectionState) {\n /*\n * The connection is alive and healthy\n */\n ConnectionState[\"Connected\"] = \"Connected\";\n /*\n * The connection is alive, but the connection is offline\n */\n ConnectionState[\"ConnectedPendingNetwork\"] = \"ConnectedPendingNetwork\";\n /*\n * The connection has been disconnected while in use\n */\n ConnectionState[\"ConnectionDisrupted\"] = \"ConnectionDisrupted\";\n /*\n * The connection has been disconnected and the network is offline\n */\n ConnectionState[\"ConnectionDisruptedPendingNetwork\"] = \"ConnectionDisruptedPendingNetwork\";\n /*\n * The connection is in the process of connecting\n */\n ConnectionState[\"Connecting\"] = \"Connecting\";\n /*\n * The connection is not in use and is being disconnected\n */\n ConnectionState[\"ConnectedPendingDisconnect\"] = \"ConnectedPendingDisconnect\";\n /*\n * The connection is not in use and has been disconnected\n */\n ConnectionState[\"Disconnected\"] = \"Disconnected\";\n /*\n * The connection is alive, but a keep alive message has been missed\n */\n ConnectionState[\"ConnectedPendingKeepAlive\"] = \"ConnectedPendingKeepAlive\";\n})(ConnectionState || (ConnectionState = {}));\n"],"names":[],"mappings":"AAAU,IAAC,YAAY;AACvB,CAAC,UAAU,WAAW,EAAE;AACxB,IAAI,WAAW,CAAC,mBAAmB,CAAC,GAAG,mBAAmB,CAAC;AAC3D,IAAI,WAAW,CAAC,mBAAmB,CAAC,GAAG,mBAAmB,CAAC;AAC3D,IAAI,WAAW,CAAC,kCAAkC,CAAC,GAAG,0CAA0C,CAAC;AACjG,IAAI,WAAW,CAAC,kBAAkB,CAAC,GAAG,kBAAkB,CAAC;AACzD,IAAI,WAAW,CAAC,oBAAoB,CAAC,GAAG,oBAAoB,CAAC;AAC7D,CAAC,EAAE,WAAW,KAAK,WAAW,GAAG,EAAE,CAAC,CAAC,CAAC;AACtC;AACU,IAAC,gBAAgB;AAC3B,CAAC,UAAU,eAAe,EAAE;AAC5B;AACA;AACA;AACA,IAAI,eAAe,CAAC,WAAW,CAAC,GAAG,WAAW,CAAC;AAC/C;AACA;AACA;AACA,IAAI,eAAe,CAAC,yBAAyB,CAAC,GAAG,yBAAyB,CAAC;AAC3E;AACA;AACA;AACA,IAAI,eAAe,CAAC,qBAAqB,CAAC,GAAG,qBAAqB,CAAC;AACnE;AACA;AACA;AACA,IAAI,eAAe,CAAC,mCAAmC,CAAC,GAAG,mCAAmC,CAAC;AAC/F;AACA;AACA;AACA,IAAI,eAAe,CAAC,YAAY,CAAC,GAAG,YAAY,CAAC;AACjD;AACA;AACA;AACA,IAAI,eAAe,CAAC,4BAA4B,CAAC,GAAG,4BAA4B,CAAC;AACjF;AACA;AACA;AACA,IAAI,eAAe,CAAC,cAAc,CAAC,GAAG,cAAc,CAAC;AACrD;AACA;AACA;AACA,IAAI,eAAe,CAAC,2BAA2B,CAAC,GAAG,2BAA2B,CAAC;AAC/E,CAAC,EAAE,eAAe,KAAK,eAAe,GAAG,EAAE,CAAC,CAAC;;;;"}
|
|
@@ -1,8 +1,9 @@
|
|
|
1
|
-
import { AmplifyClassV6 } from '@aws-amplify/core';
|
|
1
|
+
import { AmplifyClassV6, ResourcesConfig } from '@aws-amplify/core';
|
|
2
2
|
import { Source, DocumentNode, GraphQLError } from 'graphql';
|
|
3
3
|
export { OperationTypeNode } from 'graphql';
|
|
4
4
|
import { Observable } from 'rxjs';
|
|
5
5
|
import { GraphQLAuthMode, DocumentType } from '@aws-amplify/core/internals/utils';
|
|
6
|
+
import { AmplifyServer } from '@aws-amplify/core/internals/adapter-core';
|
|
6
7
|
export { CONTROL_MSG, ConnectionState } from './PubSub';
|
|
7
8
|
/**
|
|
8
9
|
* Loose/Unknown options for raw GraphQLAPICategory `graphql()`.
|
|
@@ -25,10 +26,10 @@ export interface GraphQLResult<T = object> {
|
|
|
25
26
|
};
|
|
26
27
|
}
|
|
27
28
|
declare const queryType: unique symbol;
|
|
28
|
-
export
|
|
29
|
+
export type GraphQLQuery<T> = T & {
|
|
29
30
|
readonly [queryType]: 'query';
|
|
30
31
|
};
|
|
31
|
-
export
|
|
32
|
+
export type GraphQLSubscription<T> = T & {
|
|
32
33
|
readonly [queryType]: 'subscription';
|
|
33
34
|
};
|
|
34
35
|
/**
|
|
@@ -52,14 +53,14 @@ export declare type GraphQLSubscription<T> = T & {
|
|
|
52
53
|
*
|
|
53
54
|
* This util simply makes related model properties optional recursively.
|
|
54
55
|
*/
|
|
55
|
-
export
|
|
56
|
+
export type GraphQLReturnType<T> = T extends {} ? {
|
|
56
57
|
[K in keyof T]?: GraphQLReturnType<T[K]>;
|
|
57
58
|
} : T;
|
|
58
59
|
/**
|
|
59
60
|
* Describes a paged list result from AppSync, which can either
|
|
60
61
|
* live at the top query or property (e.g., related model) level.
|
|
61
62
|
*/
|
|
62
|
-
|
|
63
|
+
type PagedList<T, TYPENAME> = {
|
|
63
64
|
__typename: TYPENAME;
|
|
64
65
|
nextToken?: string | null | undefined;
|
|
65
66
|
items: Array<T>;
|
|
@@ -72,13 +73,13 @@ declare type PagedList<T, TYPENAME> = {
|
|
|
72
73
|
* array, this will only be the case when we also have errors,
|
|
73
74
|
* which will then be *thrown*.
|
|
74
75
|
*/
|
|
75
|
-
|
|
76
|
+
type WithListsFixed<T> = T extends PagedList<infer IT, infer NAME> ? PagedList<Exclude<IT, null | undefined>, NAME> : T extends {} ? {
|
|
76
77
|
[K in keyof T]: WithListsFixed<T[K]>;
|
|
77
78
|
} : T;
|
|
78
79
|
/**
|
|
79
80
|
* Returns an updated response type to always return a value.
|
|
80
81
|
*/
|
|
81
|
-
|
|
82
|
+
type NeverEmpty<T> = {
|
|
82
83
|
[K in keyof T]-?: Exclude<WithListsFixed<T[K]>, undefined | null>;
|
|
83
84
|
};
|
|
84
85
|
/**
|
|
@@ -88,7 +89,7 @@ declare type NeverEmpty<T> = {
|
|
|
88
89
|
* If empty members are present, there will also be errors present,
|
|
89
90
|
* and the response will instead be *thrown*.
|
|
90
91
|
*/
|
|
91
|
-
|
|
92
|
+
type FixedQueryResult<T> = Exclude<T[keyof T], null | undefined> extends PagedList<any, any> ? {
|
|
92
93
|
[K in keyof T]-?: WithListsFixed<Exclude<T[K], null | undefined>>;
|
|
93
94
|
} : T;
|
|
94
95
|
/**
|
|
@@ -111,7 +112,7 @@ declare type FixedQueryResult<T> = Exclude<T[keyof T], null | undefined> extends
|
|
|
111
112
|
* })
|
|
112
113
|
* ```
|
|
113
114
|
*/
|
|
114
|
-
export
|
|
115
|
+
export type GraphqlSubscriptionResult<T> = Observable<GraphqlSubscriptionMessage<T>>;
|
|
115
116
|
/**
|
|
116
117
|
* The shape of messages passed to `next()` from a graphql subscription. E.g.,
|
|
117
118
|
*
|
|
@@ -128,7 +129,7 @@ export declare type GraphqlSubscriptionResult<T> = Observable<GraphqlSubscriptio
|
|
|
128
129
|
* })
|
|
129
130
|
* ```
|
|
130
131
|
*/
|
|
131
|
-
export
|
|
132
|
+
export type GraphqlSubscriptionMessage<T> = {
|
|
132
133
|
data: T;
|
|
133
134
|
};
|
|
134
135
|
export interface AWSAppSyncRealTimeProviderOptions {
|
|
@@ -143,7 +144,7 @@ export interface AWSAppSyncRealTimeProviderOptions {
|
|
|
143
144
|
[key: string]: string;
|
|
144
145
|
};
|
|
145
146
|
}
|
|
146
|
-
export
|
|
147
|
+
export type AWSAppSyncRealTimeProvider = {
|
|
147
148
|
subscribe(options?: AWSAppSyncRealTimeProviderOptions): Observable<Record<string, unknown>>;
|
|
148
149
|
};
|
|
149
150
|
export declare enum GraphQLAuthError {
|
|
@@ -157,7 +158,7 @@ export declare enum GraphQLAuthError {
|
|
|
157
158
|
* GraphQLSource or string, the type of the parameter for calling graphql.parse
|
|
158
159
|
* @see: https://graphql.org/graphql-js/language/#parse
|
|
159
160
|
*/
|
|
160
|
-
export
|
|
161
|
+
export type GraphQLOperation = Source | string;
|
|
161
162
|
/**
|
|
162
163
|
* API V6 `graphql({options})` type that can leverage branded graphql `query`
|
|
163
164
|
* objects and fallback types.
|
|
@@ -179,17 +180,17 @@ export interface GraphQLOptionsV6<FALLBACK_TYPES = unknown, TYPED_GQL_STRING ext
|
|
|
179
180
|
* Invoking code should either cast the result or use `?` and `!` operators to
|
|
180
181
|
* navigate the result objects.
|
|
181
182
|
*/
|
|
182
|
-
export
|
|
183
|
+
export type UnknownGraphQLResponse = Promise<GraphQLResult<any>> | GraphqlSubscriptionResult<any>;
|
|
183
184
|
/**
|
|
184
185
|
* The expected type for `variables` in a V6 `graphql()` operation with
|
|
185
186
|
* respect to the given `FALLBACK_TYPES` and `TYPED_GQL_STRING`.
|
|
186
187
|
*/
|
|
187
|
-
export
|
|
188
|
+
export type GraphQLVariablesV6<FALLBACK_TYPES = unknown, TYPED_GQL_STRING extends string = string> = TYPED_GQL_STRING extends GeneratedQuery<infer IN, any> ? IN : TYPED_GQL_STRING extends GeneratedMutation<infer IN, any> ? IN : TYPED_GQL_STRING extends GeneratedSubscription<infer IN, any> ? IN : FALLBACK_TYPES extends GraphQLOperationType<infer IN, any> ? IN : any;
|
|
188
189
|
/**
|
|
189
190
|
* The expected return type with respect to the given `FALLBACK_TYPE`
|
|
190
191
|
* and `TYPED_GQL_STRING`.
|
|
191
192
|
*/
|
|
192
|
-
export
|
|
193
|
+
export type GraphQLResponseV6<FALLBACK_TYPE = unknown, TYPED_GQL_STRING extends string = string> = TYPED_GQL_STRING extends GeneratedQuery<infer IN, infer QUERY_OUT> ? Promise<GraphQLResult<FixedQueryResult<QUERY_OUT>>> : TYPED_GQL_STRING extends GeneratedMutation<infer IN, infer MUTATION_OUT> ? Promise<GraphQLResult<NeverEmpty<MUTATION_OUT>>> : TYPED_GQL_STRING extends GeneratedSubscription<infer IN, infer SUB_OUT> ? GraphqlSubscriptionResult<NeverEmpty<SUB_OUT>> : FALLBACK_TYPE extends GraphQLQuery<infer T> ? Promise<GraphQLResult<FALLBACK_TYPE>> : FALLBACK_TYPE extends GraphQLSubscription<infer T> ? GraphqlSubscriptionResult<FALLBACK_TYPE> : FALLBACK_TYPE extends GraphQLOperationType<infer IN, infer CUSTOM_OUT> ? CUSTOM_OUT : UnknownGraphQLResponse;
|
|
193
194
|
/**
|
|
194
195
|
* The shape customers can use to provide `T` to `graphql<T>()` to specify both
|
|
195
196
|
* `IN` and `OUT` types (the type of `variables` and the return type, respectively).
|
|
@@ -208,7 +209,7 @@ export declare type GraphQLResponseV6<FALLBACK_TYPE = unknown, TYPED_GQL_STRING
|
|
|
208
209
|
* })
|
|
209
210
|
* ```
|
|
210
211
|
*/
|
|
211
|
-
export
|
|
212
|
+
export type GraphQLOperationType<IN extends {}, OUT extends {}> = {
|
|
212
213
|
variables: IN;
|
|
213
214
|
result: OUT;
|
|
214
215
|
};
|
|
@@ -228,7 +229,7 @@ export declare type GraphQLOperationType<IN extends {}, OUT extends {}> = {
|
|
|
228
229
|
* This allows `graphql()` to extract `InputType` and `OutputType` to correctly
|
|
229
230
|
* assign types to the `variables` and result objects.
|
|
230
231
|
*/
|
|
231
|
-
export
|
|
232
|
+
export type GeneratedQuery<InputType, OutputType> = string & {
|
|
232
233
|
__generatedQueryInput: InputType;
|
|
233
234
|
__generatedQueryOutput: OutputType;
|
|
234
235
|
};
|
|
@@ -248,7 +249,7 @@ export declare type GeneratedQuery<InputType, OutputType> = string & {
|
|
|
248
249
|
* This allows `graphql()` to extract `InputType` and `OutputType` to correctly
|
|
249
250
|
* assign types to the `variables` and result objects.
|
|
250
251
|
*/
|
|
251
|
-
export
|
|
252
|
+
export type GeneratedMutation<InputType, OutputType> = string & {
|
|
252
253
|
__generatedMutationInput: InputType;
|
|
253
254
|
__generatedMutationOutput: OutputType;
|
|
254
255
|
};
|
|
@@ -268,22 +269,41 @@ export declare type GeneratedMutation<InputType, OutputType> = string & {
|
|
|
268
269
|
* This allows `graphql()` to extract `InputType` and `OutputType` to correctly
|
|
269
270
|
* assign types to the `variables` and result objects.
|
|
270
271
|
*/
|
|
271
|
-
export
|
|
272
|
+
export type GeneratedSubscription<InputType, OutputType> = string & {
|
|
272
273
|
__generatedSubscriptionInput: InputType;
|
|
273
274
|
__generatedSubscriptionOutput: OutputType;
|
|
274
275
|
};
|
|
275
|
-
|
|
276
|
+
type FilteredKeys<T> = {
|
|
276
277
|
[P in keyof T]: T[P] extends never ? never : P;
|
|
277
278
|
}[keyof T];
|
|
278
|
-
|
|
279
|
+
type ExcludeNeverFields<O> = {
|
|
279
280
|
[K in FilteredKeys<O>]: O[K];
|
|
280
281
|
};
|
|
281
282
|
export declare const __amplify: unique symbol;
|
|
282
|
-
export
|
|
283
|
+
export type V6Client<T extends Record<any, any> = never> = ExcludeNeverFields<{
|
|
283
284
|
[__amplify]: AmplifyClassV6;
|
|
284
|
-
graphql:
|
|
285
|
-
|
|
286
|
-
|
|
285
|
+
graphql: GraphQLMethod;
|
|
286
|
+
cancel: (promise: Promise<any>, message?: string) => boolean;
|
|
287
|
+
isCancelError: (error: any) => boolean;
|
|
288
|
+
}>;
|
|
289
|
+
export type V6ClientSSR<T extends Record<any, any> = never> = ExcludeNeverFields<{
|
|
290
|
+
[__amplify]: AmplifyClassV6;
|
|
291
|
+
graphql: GraphQLMethodSSR;
|
|
287
292
|
cancel: (promise: Promise<any>, message?: string) => boolean;
|
|
288
293
|
isCancelError: (error: any) => boolean;
|
|
289
294
|
}>;
|
|
295
|
+
export type GraphQLMethod = <FALLBACK_TYPES = unknown, TYPED_GQL_STRING extends string = string>(options: GraphQLOptionsV6<FALLBACK_TYPES, TYPED_GQL_STRING>, additionalHeaders?: {
|
|
296
|
+
[key: string]: string;
|
|
297
|
+
} | undefined) => GraphQLResponseV6<FALLBACK_TYPES, TYPED_GQL_STRING>;
|
|
298
|
+
export type GraphQLMethodSSR = <FALLBACK_TYPES = unknown, TYPED_GQL_STRING extends string = string>(contextSpec: AmplifyServer.ContextSpec, options: GraphQLOptionsV6<FALLBACK_TYPES, TYPED_GQL_STRING>, additionalHeaders?: {
|
|
299
|
+
[key: string]: string;
|
|
300
|
+
} | undefined) => GraphQLResponseV6<FALLBACK_TYPES, TYPED_GQL_STRING>;
|
|
301
|
+
/**
|
|
302
|
+
* @private
|
|
303
|
+
*
|
|
304
|
+
* The knobs available for configuring `server/generateClient` internally.
|
|
305
|
+
*/
|
|
306
|
+
export type ServerClientGenerationParams = {
|
|
307
|
+
amplify: null | ((fn: (amplify: any) => Promise<any>) => Promise<AmplifyClassV6>);
|
|
308
|
+
config: ResourcesConfig;
|
|
309
|
+
};
|
|
@@ -1,5 +1,6 @@
|
|
|
1
|
-
export { CONTROL_MSG, ConnectionState } from './PubSub';
|
|
2
|
-
|
|
1
|
+
export { CONTROL_MSG, ConnectionState } from './PubSub.mjs';
|
|
2
|
+
|
|
3
|
+
var GraphQLAuthError;
|
|
3
4
|
(function (GraphQLAuthError) {
|
|
4
5
|
GraphQLAuthError["NO_API_KEY"] = "No api-key configured";
|
|
5
6
|
GraphQLAuthError["NO_CURRENT_USER"] = "No current user";
|
|
@@ -7,4 +8,7 @@ export var GraphQLAuthError;
|
|
|
7
8
|
GraphQLAuthError["NO_FEDERATED_JWT"] = "No federated jwt";
|
|
8
9
|
GraphQLAuthError["NO_AUTH_TOKEN"] = "No auth token specified";
|
|
9
10
|
})(GraphQLAuthError || (GraphQLAuthError = {}));
|
|
10
|
-
|
|
11
|
+
const __amplify = Symbol('amplify');
|
|
12
|
+
|
|
13
|
+
export { GraphQLAuthError, __amplify };
|
|
14
|
+
//# sourceMappingURL=index.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.mjs","sources":["../../../src/types/index.ts"],"sourcesContent":["export { CONTROL_MSG, ConnectionState } from './PubSub';\nexport var 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 || (GraphQLAuthError = {}));\nexport const __amplify = Symbol('amplify');\n"],"names":[],"mappings":";;AACU,IAAC,iBAAiB;AAC5B,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,EAAE,gBAAgB,KAAK,gBAAgB,GAAG,EAAE,CAAC,CAAC,CAAC;AACpC,MAAC,SAAS,GAAG,MAAM,CAAC,SAAS;;;;"}
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { Observable } from 'rxjs';
|
|
2
2
|
import { ConnectionState } from '../types/PubSub';
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
3
|
+
type LinkedConnectionState = 'connected' | 'disconnected';
|
|
4
|
+
type LinkedHealthState = 'healthy' | 'unhealthy';
|
|
5
|
+
type LinkedConnectionStates = {
|
|
6
6
|
networkState: LinkedConnectionState;
|
|
7
7
|
connectionState: LinkedConnectionState | 'connecting';
|
|
8
8
|
intendedConnectionState: LinkedConnectionState;
|
package/{lib-esm/utils/ConnectionStateMonitor.js → dist/esm/utils/ConnectionStateMonitor.mjs}
RENAMED
|
@@ -1,10 +1,10 @@
|
|
|
1
|
+
import { Observable, map, filter } from 'rxjs';
|
|
2
|
+
import { ConnectionState } from '../types/PubSub.mjs';
|
|
3
|
+
import { ReachabilityMonitor } from './ReachabilityMonitor/index.mjs';
|
|
4
|
+
|
|
1
5
|
// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
|
|
2
6
|
// SPDX-License-Identifier: Apache-2.0
|
|
3
|
-
|
|
4
|
-
import { Observable, map, filter } from 'rxjs';
|
|
5
|
-
import { ConnectionState } from '../types/PubSub';
|
|
6
|
-
import { ReachabilityMonitor } from './ReachabilityMonitor';
|
|
7
|
-
export var CONNECTION_CHANGE = {
|
|
7
|
+
const CONNECTION_CHANGE = {
|
|
8
8
|
KEEP_ALIVE_MISSED: { keepAliveState: 'unhealthy' },
|
|
9
9
|
KEEP_ALIVE: { keepAliveState: 'healthy' },
|
|
10
10
|
CONNECTION_ESTABLISHED: { connectionState: 'connected' },
|
|
@@ -21,9 +21,8 @@ export var CONNECTION_CHANGE = {
|
|
|
21
21
|
ONLINE: { networkState: 'connected' },
|
|
22
22
|
OFFLINE: { networkState: 'disconnected' },
|
|
23
23
|
};
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
var _this = this;
|
|
24
|
+
class ConnectionStateMonitor {
|
|
25
|
+
constructor() {
|
|
27
26
|
this._networkMonitoringSubscription = undefined;
|
|
28
27
|
this._linkedConnectionState = {
|
|
29
28
|
networkState: 'connected',
|
|
@@ -32,73 +31,61 @@ var ConnectionStateMonitor = /** @class */ (function () {
|
|
|
32
31
|
keepAliveState: 'healthy',
|
|
33
32
|
};
|
|
34
33
|
// Attempt to update the state with the current actual network state
|
|
35
|
-
this._initialNetworkStateSubscription = ReachabilityMonitor().subscribe(
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
_this.record(online ? CONNECTION_CHANGE.ONLINE : CONNECTION_CHANGE.OFFLINE);
|
|
39
|
-
(_b = _this._initialNetworkStateSubscription) === null || _b === void 0 ? void 0 : _b.unsubscribe();
|
|
34
|
+
this._initialNetworkStateSubscription = ReachabilityMonitor().subscribe(({ online }) => {
|
|
35
|
+
this.record(online ? CONNECTION_CHANGE.ONLINE : CONNECTION_CHANGE.OFFLINE);
|
|
36
|
+
this._initialNetworkStateSubscription?.unsubscribe();
|
|
40
37
|
});
|
|
41
38
|
this._linkedConnectionStateObservable =
|
|
42
|
-
new Observable(
|
|
43
|
-
connectionStateObserver.next(
|
|
44
|
-
|
|
39
|
+
new Observable(connectionStateObserver => {
|
|
40
|
+
connectionStateObserver.next(this._linkedConnectionState);
|
|
41
|
+
this._linkedConnectionStateObserver = connectionStateObserver;
|
|
45
42
|
});
|
|
46
43
|
}
|
|
47
44
|
/**
|
|
48
45
|
* Turn network state monitoring on if it isn't on already
|
|
49
46
|
*/
|
|
50
|
-
|
|
51
|
-
var _this = this;
|
|
52
|
-
var _a;
|
|
47
|
+
enableNetworkMonitoring() {
|
|
53
48
|
// If no initial network state was discovered, stop trying
|
|
54
|
-
|
|
49
|
+
this._initialNetworkStateSubscription?.unsubscribe();
|
|
55
50
|
// Maintain the network state based on the reachability monitor
|
|
56
51
|
if (this._networkMonitoringSubscription === undefined) {
|
|
57
|
-
this._networkMonitoringSubscription = ReachabilityMonitor().subscribe(
|
|
58
|
-
|
|
59
|
-
_this.record(online ? CONNECTION_CHANGE.ONLINE : CONNECTION_CHANGE.OFFLINE);
|
|
52
|
+
this._networkMonitoringSubscription = ReachabilityMonitor().subscribe(({ online }) => {
|
|
53
|
+
this.record(online ? CONNECTION_CHANGE.ONLINE : CONNECTION_CHANGE.OFFLINE);
|
|
60
54
|
});
|
|
61
55
|
}
|
|
62
|
-
}
|
|
56
|
+
}
|
|
63
57
|
/**
|
|
64
58
|
* Turn network state monitoring off if it isn't off already
|
|
65
59
|
*/
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
(_a = this._networkMonitoringSubscription) === null || _a === void 0 ? void 0 : _a.unsubscribe();
|
|
60
|
+
disableNetworkMonitoring() {
|
|
61
|
+
this._networkMonitoringSubscription?.unsubscribe();
|
|
69
62
|
this._networkMonitoringSubscription = undefined;
|
|
70
|
-
}
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
return this.
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
}));
|
|
93
|
-
},
|
|
94
|
-
enumerable: true,
|
|
95
|
-
configurable: true
|
|
96
|
-
});
|
|
63
|
+
}
|
|
64
|
+
/**
|
|
65
|
+
* Get the observable that allows us to monitor the connection state
|
|
66
|
+
*
|
|
67
|
+
* @returns {Observable<ConnectionState>} - The observable that emits ConnectionState updates
|
|
68
|
+
*/
|
|
69
|
+
get connectionStateObservable() {
|
|
70
|
+
let previous;
|
|
71
|
+
// The linked state aggregates state changes to any of the network, connection,
|
|
72
|
+
// intendedConnection and keepAliveHealth. Some states will change these independent
|
|
73
|
+
// states without changing the overall connection state.
|
|
74
|
+
// After translating from linked states to ConnectionState, then remove any duplicates
|
|
75
|
+
return this._linkedConnectionStateObservable
|
|
76
|
+
.pipe(map(value => {
|
|
77
|
+
return this.connectionStatesTranslator(value);
|
|
78
|
+
}))
|
|
79
|
+
.pipe(filter(current => {
|
|
80
|
+
const toInclude = current !== previous;
|
|
81
|
+
previous = current;
|
|
82
|
+
return toInclude;
|
|
83
|
+
}));
|
|
84
|
+
}
|
|
97
85
|
/*
|
|
98
86
|
* Updates local connection state and emits the full state to the observer.
|
|
99
87
|
*/
|
|
100
|
-
|
|
101
|
-
var _a;
|
|
88
|
+
record(statusUpdates) {
|
|
102
89
|
// Maintain the network monitor
|
|
103
90
|
if (statusUpdates.intendedConnectionState === 'connected') {
|
|
104
91
|
this.enableNetworkMonitoring();
|
|
@@ -107,15 +94,17 @@ var ConnectionStateMonitor = /** @class */ (function () {
|
|
|
107
94
|
this.disableNetworkMonitoring();
|
|
108
95
|
}
|
|
109
96
|
// Maintain the socket state
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
97
|
+
const newSocketStatus = {
|
|
98
|
+
...this._linkedConnectionState,
|
|
99
|
+
...statusUpdates,
|
|
100
|
+
};
|
|
101
|
+
this._linkedConnectionState = { ...newSocketStatus };
|
|
102
|
+
this._linkedConnectionStateObserver?.next(this._linkedConnectionState);
|
|
103
|
+
}
|
|
114
104
|
/*
|
|
115
105
|
* Translate the ConnectionState structure into a specific ConnectionState string literal union
|
|
116
106
|
*/
|
|
117
|
-
|
|
118
|
-
var connectionState = _a.connectionState, networkState = _a.networkState, intendedConnectionState = _a.intendedConnectionState, keepAliveState = _a.keepAliveState;
|
|
107
|
+
connectionStatesTranslator({ connectionState, networkState, intendedConnectionState, keepAliveState, }) {
|
|
119
108
|
if (connectionState === 'connected' && networkState === 'disconnected')
|
|
120
109
|
return ConnectionState.ConnectedPendingNetwork;
|
|
121
110
|
if (connectionState === 'connected' &&
|
|
@@ -136,7 +125,8 @@ var ConnectionStateMonitor = /** @class */ (function () {
|
|
|
136
125
|
if (connectionState === 'disconnected')
|
|
137
126
|
return ConnectionState.Disconnected;
|
|
138
127
|
return ConnectionState.Connected;
|
|
139
|
-
}
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
export { ConnectionStateMonitor };
|
|
128
|
+
}
|
|
129
|
+
}
|
|
130
|
+
|
|
131
|
+
export { CONNECTION_CHANGE, ConnectionStateMonitor };
|
|
132
|
+
//# sourceMappingURL=ConnectionStateMonitor.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ConnectionStateMonitor.mjs","sources":["../../../src/utils/ConnectionStateMonitor.ts"],"sourcesContent":["// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\nimport { Observable, map, filter } from 'rxjs';\nimport { ConnectionState } from '../types/PubSub';\nimport { ReachabilityMonitor } from './ReachabilityMonitor';\nexport const CONNECTION_CHANGE = {\n KEEP_ALIVE_MISSED: { keepAliveState: 'unhealthy' },\n KEEP_ALIVE: { keepAliveState: 'healthy' },\n CONNECTION_ESTABLISHED: { connectionState: 'connected' },\n CONNECTION_FAILED: {\n intendedConnectionState: 'disconnected',\n connectionState: 'disconnected',\n },\n CLOSING_CONNECTION: { intendedConnectionState: 'disconnected' },\n OPENING_CONNECTION: {\n intendedConnectionState: 'connected',\n connectionState: 'connecting',\n },\n CLOSED: { connectionState: 'disconnected' },\n ONLINE: { networkState: 'connected' },\n OFFLINE: { networkState: 'disconnected' },\n};\nexport class ConnectionStateMonitor {\n constructor() {\n this._networkMonitoringSubscription = undefined;\n this._linkedConnectionState = {\n networkState: 'connected',\n connectionState: 'disconnected',\n intendedConnectionState: 'disconnected',\n keepAliveState: 'healthy',\n };\n // Attempt to update the state with the current actual network state\n this._initialNetworkStateSubscription = ReachabilityMonitor().subscribe(({ online }) => {\n this.record(online ? CONNECTION_CHANGE.ONLINE : CONNECTION_CHANGE.OFFLINE);\n this._initialNetworkStateSubscription?.unsubscribe();\n });\n this._linkedConnectionStateObservable =\n new Observable(connectionStateObserver => {\n connectionStateObserver.next(this._linkedConnectionState);\n this._linkedConnectionStateObserver = connectionStateObserver;\n });\n }\n /**\n * Turn network state monitoring on if it isn't on already\n */\n enableNetworkMonitoring() {\n // If no initial network state was discovered, stop trying\n this._initialNetworkStateSubscription?.unsubscribe();\n // Maintain the network state based on the reachability monitor\n if (this._networkMonitoringSubscription === undefined) {\n this._networkMonitoringSubscription = ReachabilityMonitor().subscribe(({ online }) => {\n this.record(online ? CONNECTION_CHANGE.ONLINE : CONNECTION_CHANGE.OFFLINE);\n });\n }\n }\n /**\n * Turn network state monitoring off if it isn't off already\n */\n disableNetworkMonitoring() {\n this._networkMonitoringSubscription?.unsubscribe();\n this._networkMonitoringSubscription = undefined;\n }\n /**\n * Get the observable that allows us to monitor the connection state\n *\n * @returns {Observable<ConnectionState>} - The observable that emits ConnectionState updates\n */\n get connectionStateObservable() {\n let previous;\n // The linked state aggregates state changes to any of the network, connection,\n // intendedConnection and keepAliveHealth. Some states will change these independent\n // states without changing the overall connection state.\n // After translating from linked states to ConnectionState, then remove any duplicates\n return this._linkedConnectionStateObservable\n .pipe(map(value => {\n return this.connectionStatesTranslator(value);\n }))\n .pipe(filter(current => {\n const toInclude = current !== previous;\n previous = current;\n return toInclude;\n }));\n }\n /*\n * Updates local connection state and emits the full state to the observer.\n */\n record(statusUpdates) {\n // Maintain the network monitor\n if (statusUpdates.intendedConnectionState === 'connected') {\n this.enableNetworkMonitoring();\n }\n else if (statusUpdates.intendedConnectionState === 'disconnected') {\n this.disableNetworkMonitoring();\n }\n // Maintain the socket state\n const newSocketStatus = {\n ...this._linkedConnectionState,\n ...statusUpdates,\n };\n this._linkedConnectionState = { ...newSocketStatus };\n this._linkedConnectionStateObserver?.next(this._linkedConnectionState);\n }\n /*\n * Translate the ConnectionState structure into a specific ConnectionState string literal union\n */\n connectionStatesTranslator({ connectionState, networkState, intendedConnectionState, keepAliveState, }) {\n if (connectionState === 'connected' && networkState === 'disconnected')\n return ConnectionState.ConnectedPendingNetwork;\n if (connectionState === 'connected' &&\n intendedConnectionState === 'disconnected')\n return ConnectionState.ConnectedPendingDisconnect;\n if (connectionState === 'disconnected' &&\n intendedConnectionState === 'connected' &&\n networkState === 'disconnected')\n return ConnectionState.ConnectionDisruptedPendingNetwork;\n if (connectionState === 'disconnected' &&\n intendedConnectionState === 'connected')\n return ConnectionState.ConnectionDisrupted;\n if (connectionState === 'connected' && keepAliveState === 'unhealthy')\n return ConnectionState.ConnectedPendingKeepAlive;\n // All remaining states directly correspond to the connection state\n if (connectionState === 'connecting')\n return ConnectionState.Connecting;\n if (connectionState === 'disconnected')\n return ConnectionState.Disconnected;\n return ConnectionState.Connected;\n }\n}\n"],"names":[],"mappings":";;;;AAAA;AACA;AAIY,MAAC,iBAAiB,GAAG;AACjC,IAAI,iBAAiB,EAAE,EAAE,cAAc,EAAE,WAAW,EAAE;AACtD,IAAI,UAAU,EAAE,EAAE,cAAc,EAAE,SAAS,EAAE;AAC7C,IAAI,sBAAsB,EAAE,EAAE,eAAe,EAAE,WAAW,EAAE;AAC5D,IAAI,iBAAiB,EAAE;AACvB,QAAQ,uBAAuB,EAAE,cAAc;AAC/C,QAAQ,eAAe,EAAE,cAAc;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AChD,QAAQ,OAAO,eAAe,CAAC,SAAS,CAAC;AACzC,KAAK;AACL;;;;"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const ReachabilityMonitor: () => import("rxjs").Observable<import("@aws-amplify/core/dist/esm/Reachability/types").NetworkStatus>;
|
package/{lib-esm/utils/ReachabilityMonitor/index.js → dist/esm/utils/ReachabilityMonitor/index.mjs}
RENAMED
|
@@ -1,4 +1,8 @@
|
|
|
1
|
+
import { Reachability } from '@aws-amplify/core/internals/utils';
|
|
2
|
+
|
|
1
3
|
// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
|
|
2
4
|
// SPDX-License-Identifier: Apache-2.0
|
|
3
|
-
|
|
4
|
-
|
|
5
|
+
const ReachabilityMonitor = () => new Reachability().networkMonitor();
|
|
6
|
+
|
|
7
|
+
export { ReachabilityMonitor };
|
|
8
|
+
//# sourceMappingURL=index.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.mjs","sources":["../../../../src/utils/ReachabilityMonitor/index.ts"],"sourcesContent":["// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\nimport { Reachability } from '@aws-amplify/core/internals/utils';\nexport const ReachabilityMonitor = () => new Reachability().networkMonitor();\n"],"names":[],"mappings":";;AAAA;AACA;AAEY,MAAC,mBAAmB,GAAG,MAAM,IAAI,YAAY,EAAE,CAAC,cAAc;;;;"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const ReachabilityMonitor: () => import("rxjs").Observable<import("@aws-amplify/core/dist/esm/Reachability/types").NetworkStatus>;
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { Reachability } from '@aws-amplify/core/internals/utils';
|
|
2
|
+
import NetInfo from '@react-native-community/netinfo';
|
|
3
|
+
|
|
4
|
+
// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
|
|
5
|
+
// SPDX-License-Identifier: Apache-2.0
|
|
6
|
+
const ReachabilityMonitor = () => new Reachability().networkMonitor(NetInfo);
|
|
7
|
+
|
|
8
|
+
export { ReachabilityMonitor };
|
|
9
|
+
//# sourceMappingURL=index.native.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.native.mjs","sources":["../../../../src/utils/ReachabilityMonitor/index.native.ts"],"sourcesContent":["// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\nimport { Reachability } from '@aws-amplify/core/internals/utils';\nimport { default as NetInfo } from '@react-native-community/netinfo';\nexport const ReachabilityMonitor = () => new Reachability().networkMonitor(NetInfo);\n"],"names":[],"mappings":";;;AAAA;AACA;AAGY,MAAC,mBAAmB,GAAG,MAAM,IAAI,YAAY,EAAE,CAAC,cAAc,CAAC,OAAO;;;;"}
|
|
@@ -1,5 +1,6 @@
|
|
|
1
|
-
import {
|
|
2
|
-
|
|
1
|
+
import { RECONNECT_INTERVAL, RECONNECT_DELAY } from '../Providers/constants.mjs';
|
|
2
|
+
|
|
3
|
+
var ReconnectEvent;
|
|
3
4
|
(function (ReconnectEvent) {
|
|
4
5
|
ReconnectEvent["START_RECONNECT"] = "START_RECONNECT";
|
|
5
6
|
ReconnectEvent["HALT_RECONNECT"] = "HALT_RECONNECT";
|
|
@@ -10,31 +11,30 @@ export var ReconnectEvent;
|
|
|
10
11
|
* Attempting to reconnect only once creates unrecoverable states when the network state isn't
|
|
11
12
|
* supported by the browser, so this keeps retrying every minute until halted.
|
|
12
13
|
*/
|
|
13
|
-
|
|
14
|
-
|
|
14
|
+
class ReconnectionMonitor {
|
|
15
|
+
constructor() {
|
|
15
16
|
this.reconnectObservers = [];
|
|
16
17
|
}
|
|
17
18
|
/**
|
|
18
19
|
* Add reconnect observer to the list of observers to alert on reconnect
|
|
19
20
|
*/
|
|
20
|
-
|
|
21
|
+
addObserver(reconnectObserver) {
|
|
21
22
|
this.reconnectObservers.push(reconnectObserver);
|
|
22
|
-
}
|
|
23
|
+
}
|
|
23
24
|
/**
|
|
24
25
|
* Given a reconnect event, start the appropriate behavior
|
|
25
26
|
*/
|
|
26
|
-
|
|
27
|
-
var _this = this;
|
|
27
|
+
record(event) {
|
|
28
28
|
if (event === ReconnectEvent.START_RECONNECT) {
|
|
29
29
|
// If the reconnection hasn't been started
|
|
30
30
|
if (this.reconnectSetTimeoutId === undefined &&
|
|
31
31
|
this.reconnectIntervalId === undefined) {
|
|
32
|
-
this.reconnectSetTimeoutId = setTimeout(
|
|
32
|
+
this.reconnectSetTimeoutId = setTimeout(() => {
|
|
33
33
|
// Reconnect now
|
|
34
|
-
|
|
34
|
+
this._triggerReconnect();
|
|
35
35
|
// Retry reconnect every periodically until it works
|
|
36
|
-
|
|
37
|
-
|
|
36
|
+
this.reconnectIntervalId = setInterval(() => {
|
|
37
|
+
this._triggerReconnect();
|
|
38
38
|
}, RECONNECT_INTERVAL);
|
|
39
39
|
}, RECONNECT_DELAY);
|
|
40
40
|
}
|
|
@@ -49,22 +49,21 @@ var ReconnectionMonitor = /** @class */ (function () {
|
|
|
49
49
|
this.reconnectSetTimeoutId = undefined;
|
|
50
50
|
}
|
|
51
51
|
}
|
|
52
|
-
}
|
|
52
|
+
}
|
|
53
53
|
/**
|
|
54
54
|
* Complete all reconnect observers
|
|
55
55
|
*/
|
|
56
|
-
|
|
57
|
-
this.reconnectObservers.forEach(
|
|
58
|
-
|
|
59
|
-
(_a = reconnectObserver.complete) === null || _a === void 0 ? void 0 : _a.call(reconnectObserver);
|
|
56
|
+
close() {
|
|
57
|
+
this.reconnectObservers.forEach(reconnectObserver => {
|
|
58
|
+
reconnectObserver.complete?.();
|
|
60
59
|
});
|
|
61
|
-
}
|
|
62
|
-
|
|
63
|
-
this.reconnectObservers.forEach(
|
|
64
|
-
|
|
65
|
-
(_a = reconnectObserver.next) === null || _a === void 0 ? void 0 : _a.call(reconnectObserver);
|
|
60
|
+
}
|
|
61
|
+
_triggerReconnect() {
|
|
62
|
+
this.reconnectObservers.forEach(reconnectObserver => {
|
|
63
|
+
reconnectObserver.next?.();
|
|
66
64
|
});
|
|
67
|
-
}
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
export { ReconnectionMonitor };
|
|
65
|
+
}
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
export { ReconnectEvent, ReconnectionMonitor };
|
|
69
|
+
//# sourceMappingURL=ReconnectionMonitor.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ReconnectionMonitor.mjs","sources":["../../../src/utils/ReconnectionMonitor.ts"],"sourcesContent":["import { RECONNECT_DELAY, RECONNECT_INTERVAL } from '../Providers/constants';\nexport var ReconnectEvent;\n(function (ReconnectEvent) {\n ReconnectEvent[\"START_RECONNECT\"] = \"START_RECONNECT\";\n ReconnectEvent[\"HALT_RECONNECT\"] = \"HALT_RECONNECT\";\n})(ReconnectEvent || (ReconnectEvent = {}));\n/**\n * Captures the reconnect event logic used to determine when to reconnect to PubSub providers.\n * Reconnnect attempts are delayed by 5 seconds to let the interface settle.\n * Attempting to reconnect only once creates unrecoverable states when the network state isn't\n * supported by the browser, so this keeps retrying every minute until halted.\n */\nexport class ReconnectionMonitor {\n constructor() {\n this.reconnectObservers = [];\n }\n /**\n * Add reconnect observer to the list of observers to alert on reconnect\n */\n addObserver(reconnectObserver) {\n this.reconnectObservers.push(reconnectObserver);\n }\n /**\n * Given a reconnect event, start the appropriate behavior\n */\n record(event) {\n if (event === ReconnectEvent.START_RECONNECT) {\n // If the reconnection hasn't been started\n if (this.reconnectSetTimeoutId === undefined &&\n this.reconnectIntervalId === undefined) {\n this.reconnectSetTimeoutId = setTimeout(() => {\n // Reconnect now\n this._triggerReconnect();\n // Retry reconnect every periodically until it works\n this.reconnectIntervalId = setInterval(() => {\n this._triggerReconnect();\n }, RECONNECT_INTERVAL);\n }, RECONNECT_DELAY);\n }\n }\n if (event === ReconnectEvent.HALT_RECONNECT) {\n if (this.reconnectIntervalId) {\n clearInterval(this.reconnectIntervalId);\n this.reconnectIntervalId = undefined;\n }\n if (this.reconnectSetTimeoutId) {\n clearTimeout(this.reconnectSetTimeoutId);\n this.reconnectSetTimeoutId = undefined;\n }\n }\n }\n /**\n * Complete all reconnect observers\n */\n close() {\n this.reconnectObservers.forEach(reconnectObserver => {\n reconnectObserver.complete?.();\n });\n }\n _triggerReconnect() {\n this.reconnectObservers.forEach(reconnectObserver => {\n reconnectObserver.next?.();\n });\n }\n}\n"],"names":[],"mappings":";;AACU,IAAC,eAAe;AAC1B,CAAC,UAAU,cAAc,EAAE;AAC3B,IAAI,cAAc,CAAC,iBAAiB,CAAC,GAAG,iBAAiB,CAAC;AAC1D,IAAI,cAAc,CAAC,gBAAgB,CAAC,GAAG,gBAAgB,CAAC;AACxD,CAAC,EAAE,cAAc,KAAK,cAAc,GAAG,EAAE,CAAC,CAAC,CAAC;AAC5C;AACA;AACA;AACA;AACA;AACA;AACO,MAAM,mBAAmB,CAAC;AACjC,IAAI,WAAW,GAAG;AAClB,QAAQ,IAAI,CAAC,kBAAkB,GAAG,EAAE,CAAC;AACrC,KAAK;AACL;AACA;AACA;AACA,IAAI,WAAW,CAAC,iBAAiB,EAAE;AACnC,QAAQ,IAAI,CAAC,kBAAkB,CAAC,IAAI,CAAC,iBAAiB,CAAC,CAAC;AACxD,KAAK;AACL;AACA;AACA;AACA,IAAI,MAAM,CAAC,KAAK,EAAE;AAClB,QAAQ,IAAI,KAAK,KAAK,cAAc,CAAC,eAAe,EAAE;AACtD;AACA,YAAY,IAAI,IAAI,CAAC,qBAAqB,KAAK,SAAS;AACxD,gBAAgB,IAAI,CAAC,mBAAmB,KAAK,SAAS,EAAE;AACxD,gBAAgB,IAAI,CAAC,qBAAqB,GAAG,UAAU,CAAC,MAAM;AAC9D;AACA,oBAAoB,IAAI,CAAC,iBAAiB,EAAE,CAAC;AAC7C;AACA,oBAAoB,IAAI,CAAC,mBAAmB,GAAG,WAAW,CAAC,MAAM;AACjE,wBAAwB,IAAI,CAA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