@aws-amplify/api-graphql 4.0.1-api-v6-models.bc74e14.0 → 4.0.1-api-v6-models.13c9b49.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/{lib → dist/cjs}/GraphQLAPI.js +5 -3
- package/dist/cjs/GraphQLAPI.js.map +1 -0
- package/{lib → dist/cjs}/Providers/AWSAppSyncRealTimeProvider/index.js +3 -1
- package/dist/cjs/Providers/AWSAppSyncRealTimeProvider/index.js.map +1 -0
- package/{lib → dist/cjs}/Providers/constants.js +6 -7
- package/dist/cjs/Providers/constants.js.map +1 -0
- package/{lib → dist/cjs}/index.js +3 -1
- package/dist/cjs/index.js.map +1 -0
- package/{lib → dist/cjs}/internals/APIClient.js +3 -4
- package/dist/cjs/internals/APIClient.js.map +1 -0
- package/{lib → dist/cjs}/internals/InternalGraphQLAPI.js +4 -6
- package/dist/cjs/internals/InternalGraphQLAPI.js.map +1 -0
- package/{lib → dist/cjs}/internals/generateClient.js +3 -1
- package/dist/cjs/internals/generateClient.js.map +1 -0
- package/{lib → dist/cjs}/internals/generateModelsProperty.js +3 -1
- package/dist/cjs/internals/generateModelsProperty.js.map +1 -0
- package/{lib → dist/cjs}/internals/index.js +3 -1
- package/dist/cjs/internals/index.js.map +1 -0
- package/{lib → dist/cjs}/internals/operations/get.js +3 -1
- package/dist/cjs/internals/operations/get.js.map +1 -0
- package/{lib → dist/cjs}/internals/operations/list.js +3 -1
- package/dist/cjs/internals/operations/list.js.map +1 -0
- package/{lib → dist/cjs}/internals/operations/observeQuery.js +3 -1
- package/dist/cjs/internals/operations/observeQuery.js.map +1 -0
- package/{lib → dist/cjs}/internals/operations/subscription.js +3 -1
- package/dist/cjs/internals/operations/subscription.js.map +1 -0
- package/{lib → dist/cjs}/internals/server/generateClient.js +3 -1
- package/dist/cjs/internals/server/generateClient.js.map +1 -0
- package/{lib → dist/cjs}/internals/server/generateModelsProperty.js +3 -1
- package/dist/cjs/internals/server/generateModelsProperty.js.map +1 -0
- package/{lib → dist/cjs}/internals/server/index.js +3 -1
- package/dist/cjs/internals/server/index.js.map +1 -0
- package/{lib → dist/cjs}/internals/types.js +3 -1
- package/dist/cjs/internals/types.js.map +1 -0
- package/{lib → dist/cjs}/internals/v6.js +3 -1
- package/dist/cjs/internals/v6.js.map +1 -0
- package/{lib → dist/cjs}/types/PubSub.js +5 -6
- package/dist/cjs/types/PubSub.js.map +1 -0
- package/{lib → dist/cjs}/types/index.js +4 -3
- package/dist/cjs/types/index.js.map +1 -0
- package/{lib → dist/cjs}/utils/ConnectionStateMonitor.js +3 -1
- package/dist/cjs/utils/ConnectionStateMonitor.js.map +1 -0
- package/{lib → dist/cjs}/utils/ReachabilityMonitor/index.js +3 -1
- package/dist/cjs/utils/ReachabilityMonitor/index.js.map +1 -0
- package/{lib → dist/cjs}/utils/ReachabilityMonitor/index.native.js +3 -1
- package/dist/cjs/utils/ReachabilityMonitor/index.native.js.map +1 -0
- package/{lib → dist/cjs}/utils/ReconnectionMonitor.js +4 -2
- package/dist/cjs/utils/ReconnectionMonitor.js.map +1 -0
- package/{lib → dist/cjs}/utils/errors/APIError.js +3 -1
- package/dist/cjs/utils/errors/APIError.js.map +1 -0
- package/{lib → dist/cjs}/utils/errors/assertValidationError.js +3 -1
- package/dist/cjs/utils/errors/assertValidationError.js.map +1 -0
- package/{lib → dist/cjs}/utils/errors/index.js +3 -1
- package/dist/cjs/utils/errors/index.js.map +1 -0
- package/{lib → dist/cjs}/utils/errors/validation.js +4 -2
- package/dist/cjs/utils/errors/validation.js.map +1 -0
- package/{lib → dist/cjs}/utils/findIndexByFields.js +3 -1
- package/dist/cjs/utils/findIndexByFields.js.map +1 -0
- package/{lib → dist/cjs}/utils/index.js +3 -1
- package/dist/cjs/utils/index.js.map +1 -0
- package/{lib → dist/cjs}/utils/resolveConfig.js +3 -1
- package/dist/cjs/utils/resolveConfig.js.map +1 -0
- package/{lib → dist/cjs}/utils/resolveLibraryOptions.js +3 -1
- package/dist/cjs/utils/resolveLibraryOptions.js.map +1 -0
- package/{lib → dist/cjs}/utils/resolveOwnerFields.js +3 -1
- package/dist/cjs/utils/resolveOwnerFields.js.map +1 -0
- package/{lib → dist/cjs}/utils/resolvePKFields.js +3 -1
- package/dist/cjs/utils/resolvePKFields.js.map +1 -0
- package/{lib-esm → dist/esm}/GraphQLAPI.d.ts +1 -1
- package/{lib-esm/GraphQLAPI.js → dist/esm/GraphQLAPI.mjs} +8 -4
- package/dist/esm/GraphQLAPI.mjs.map +1 -0
- package/{lib-esm/Providers/AWSAppSyncRealTimeProvider/index.js → dist/esm/Providers/AWSAppSyncRealTimeProvider/index.mjs} +13 -9
- 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-esm/internals/APIClient.js → dist/esm/internals/APIClient.mjs} +16 -15
- package/dist/esm/internals/APIClient.mjs.map +1 -0
- package/{lib-esm/internals/InternalGraphQLAPI.js → dist/esm/internals/InternalGraphQLAPI.mjs} +19 -18
- package/dist/esm/internals/InternalGraphQLAPI.mjs.map +1 -0
- package/{lib-esm/internals/generateClient.js → dist/esm/internals/generateClient.mjs} +8 -4
- package/dist/esm/internals/generateClient.mjs.map +1 -0
- package/{lib-esm/internals/generateModelsProperty.js → dist/esm/internals/generateModelsProperty.mjs} +10 -6
- package/dist/esm/internals/generateModelsProperty.mjs.map +1 -0
- package/dist/esm/internals/index.mjs +4 -0
- package/dist/esm/internals/index.mjs.map +1 -0
- package/{lib-esm/internals/operations/get.js → dist/esm/internals/operations/get.mjs} +6 -2
- package/dist/esm/internals/operations/get.mjs.map +1 -0
- package/{lib-esm/internals/operations/list.js → dist/esm/internals/operations/list.mjs} +6 -2
- package/dist/esm/internals/operations/list.mjs.map +1 -0
- package/{lib-esm/internals/operations/observeQuery.js → dist/esm/internals/operations/observeQuery.mjs} +10 -3
- package/dist/esm/internals/operations/observeQuery.mjs.map +1 -0
- package/{lib-esm/internals/operations/subscription.js → dist/esm/internals/operations/subscription.mjs} +7 -3
- package/dist/esm/internals/operations/subscription.mjs.map +1 -0
- package/{lib-esm/internals/server/generateClient.js → dist/esm/internals/server/generateClient.mjs} +12 -4
- package/dist/esm/internals/server/generateClient.mjs.map +1 -0
- package/{lib-esm/internals/server/generateModelsProperty.js → dist/esm/internals/server/generateModelsProperty.mjs} +8 -4
- package/dist/esm/internals/server/generateModelsProperty.mjs.map +1 -0
- package/dist/esm/internals/server/index.mjs +2 -0
- package/dist/esm/internals/server/index.mjs.map +1 -0
- package/dist/esm/internals/types.mjs +2 -0
- package/dist/esm/internals/types.mjs.map +1 -0
- package/{lib-esm/internals/v6.js → dist/esm/internals/v6.mjs} +9 -5
- package/dist/esm/internals/v6.mjs.map +1 -0
- 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/types/index.js → dist/esm/types/index.mjs} +9 -5
- package/dist/esm/types/index.mjs.map +1 -0
- package/{lib-esm/utils/ConnectionStateMonitor.js → dist/esm/utils/ConnectionStateMonitor.mjs} +9 -5
- 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} +7 -3
- package/dist/esm/utils/ReconnectionMonitor.mjs.map +1 -0
- package/{lib-esm/utils/errors/APIError.js → dist/esm/utils/errors/APIError.mjs} +6 -2
- package/dist/esm/utils/errors/APIError.mjs.map +1 -0
- package/{lib-esm/utils/errors/assertValidationError.js → dist/esm/utils/errors/assertValidationError.mjs} +7 -3
- 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} +5 -2
- package/dist/esm/utils/errors/validation.mjs.map +1 -0
- package/{lib-esm/utils/findIndexByFields.js → dist/esm/utils/findIndexByFields.mjs} +4 -1
- package/dist/esm/utils/findIndexByFields.mjs.map +1 -0
- package/dist/esm/utils/index.mjs +5 -0
- package/dist/esm/utils/index.mjs.map +1 -0
- package/{lib-esm → dist/esm}/utils/resolveConfig.d.ts +1 -1
- package/{lib-esm/utils/resolveConfig.js → dist/esm/utils/resolveConfig.mjs} +8 -2
- package/dist/esm/utils/resolveConfig.mjs.map +1 -0
- package/{lib → dist/esm}/utils/resolveLibraryOptions.d.ts +2 -2
- package/{lib-esm/utils/resolveLibraryOptions.js → dist/esm/utils/resolveLibraryOptions.mjs} +4 -1
- package/dist/esm/utils/resolveLibraryOptions.mjs.map +1 -0
- package/{lib-esm/utils/resolveOwnerFields.js → dist/esm/utils/resolveOwnerFields.mjs} +4 -1
- package/dist/esm/utils/resolveOwnerFields.mjs.map +1 -0
- package/{lib-esm/utils/resolvePKFields.js → dist/esm/utils/resolvePKFields.mjs} +4 -1
- package/dist/esm/utils/resolvePKFields.mjs.map +1 -0
- package/internals/package.json +4 -4
- package/internals/server/package.json +4 -4
- package/package.json +51 -25
- package/src/GraphQLAPI.ts +1 -1
- package/lib/GraphQLAPI.d.ts +0 -38
- package/lib/Providers/AWSAppSyncRealTimeProvider/index.d.ts +0 -64
- package/lib/Providers/constants.d.ts +0 -95
- package/lib/index.d.ts +0 -3
- package/lib/internals/APIClient.d.ts +0 -121
- package/lib/internals/InternalGraphQLAPI.d.ts +0 -58
- package/lib/internals/generateClient.d.ts +0 -12
- package/lib/internals/generateModelsProperty.d.ts +0 -4
- package/lib/internals/index.d.ts +0 -3
- package/lib/internals/operations/get.d.ts +0 -2
- package/lib/internals/operations/list.d.ts +0 -2
- package/lib/internals/operations/observeQuery.d.ts +0 -2
- package/lib/internals/operations/subscription.d.ts +0 -1
- package/lib/internals/server/generateClient.d.ts +0 -11
- package/lib/internals/server/generateModelsProperty.d.ts +0 -3
- package/lib/internals/server/index.d.ts +0 -1
- package/lib/internals/types.d.ts +0 -17
- package/lib/internals/v6.d.ts +0 -101
- package/lib/tsconfig.tsbuildinfo +0 -1
- package/lib/types/PubSub.d.ts +0 -27
- package/lib/types/index.d.ts +0 -329
- package/lib/utils/ConnectionStateMonitor.d.ts +0 -41
- package/lib/utils/ReachabilityMonitor/index.d.ts +0 -1
- package/lib/utils/ReachabilityMonitor/index.native.d.ts +0 -1
- package/lib/utils/ReconnectionMonitor.d.ts +0 -29
- package/lib/utils/errors/APIError.d.ts +0 -7
- package/lib/utils/errors/assertValidationError.d.ts +0 -5
- package/lib/utils/errors/index.d.ts +0 -3
- package/lib/utils/errors/validation.d.ts +0 -7
- package/lib/utils/findIndexByFields.d.ts +0 -9
- package/lib/utils/index.d.ts +0 -4
- package/lib/utils/resolveConfig.d.ts +0 -12
- package/lib/utils/resolveOwnerFields.d.ts +0 -12
- package/lib/utils/resolvePKFields.d.ts +0 -13
- package/lib-esm/index.js +0 -5
- package/lib-esm/internals/index.js +0 -5
- package/lib-esm/internals/server/index.js +0 -3
- package/lib-esm/internals/types.js +0 -1
- package/lib-esm/tsconfig.tsbuildinfo +0 -1
- 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 -5
- package/lib-esm/utils/errors/index.js +0 -5
- package/lib-esm/utils/index.js +0 -6
- package/lib-esm/utils/resolveLibraryOptions.d.ts +0 -11
- /package/{lib-esm → dist/esm}/Providers/AWSAppSyncRealTimeProvider/index.d.ts +0 -0
- /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/APIClient.d.ts +0 -0
- /package/{lib-esm → dist/esm}/internals/InternalGraphQLAPI.d.ts +0 -0
- /package/{lib-esm → dist/esm}/internals/generateClient.d.ts +0 -0
- /package/{lib-esm → dist/esm}/internals/generateModelsProperty.d.ts +0 -0
- /package/{lib-esm → dist/esm}/internals/index.d.ts +0 -0
- /package/{lib-esm → dist/esm}/internals/operations/get.d.ts +0 -0
- /package/{lib-esm → dist/esm}/internals/operations/list.d.ts +0 -0
- /package/{lib-esm → dist/esm}/internals/operations/observeQuery.d.ts +0 -0
- /package/{lib-esm → dist/esm}/internals/operations/subscription.d.ts +0 -0
- /package/{lib-esm → dist/esm}/internals/server/generateClient.d.ts +0 -0
- /package/{lib-esm → dist/esm}/internals/server/generateModelsProperty.d.ts +0 -0
- /package/{lib-esm → dist/esm}/internals/server/index.d.ts +0 -0
- /package/{lib-esm → dist/esm}/internals/types.d.ts +0 -0
- /package/{lib-esm → dist/esm}/internals/v6.d.ts +0 -0
- /package/{lib-esm → dist/esm}/types/PubSub.d.ts +0 -0
- /package/{lib-esm → dist/esm}/types/index.d.ts +0 -0
- /package/{lib-esm → dist/esm}/utils/ConnectionStateMonitor.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/findIndexByFields.d.ts +0 -0
- /package/{lib-esm → dist/esm}/utils/index.d.ts +0 -0
- /package/{lib-esm → dist/esm}/utils/resolveOwnerFields.d.ts +0 -0
- /package/{lib-esm → dist/esm}/utils/resolvePKFields.d.ts +0 -0
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"list.js","sources":["../../../../src/internals/operations/list.ts"],"sourcesContent":["\"use strict\";\nObject.defineProperty(exports, \"__esModule\", { value: true });\nexports.listFactory = void 0;\nconst APIClient_1 = require(\"../APIClient\");\nfunction listFactory(client, modelIntrospection, model, context = false) {\n const listWithContext = async (contextSpec, args) => {\n return _list(client, modelIntrospection, model, args, contextSpec);\n };\n const list = async (args) => {\n return _list(client, modelIntrospection, model, args, context);\n };\n return context ? listWithContext : list;\n}\nexports.listFactory = listFactory;\nasync function _list(client, modelIntrospection, model, args, context) {\n const { name } = model;\n const query = (0, APIClient_1.generateGraphQLDocument)(modelIntrospection.models, name, 'LIST', args);\n const variables = (0, APIClient_1.buildGraphQLVariables)(model, 'LIST', args, modelIntrospection);\n try {\n const auth = (0, APIClient_1.authModeParams)(client, args);\n const { data, extensions } = context\n ? (await client.graphql(context, {\n ...auth,\n query,\n variables,\n }))\n : (await client.graphql({\n ...auth,\n query,\n variables,\n }));\n // flatten response\n if (data !== undefined) {\n const [key] = Object.keys(data);\n if (data[key].items) {\n const flattenedResult = (0, APIClient_1.flattenItems)(data)[key];\n // don't init if custom selection set\n if (args?.selectionSet) {\n return {\n data: flattenedResult,\n nextToken: data[key].nextToken,\n extensions,\n };\n }\n else {\n const initialized = (0, APIClient_1.initializeModel)(client, name, flattenedResult, modelIntrospection, auth.authMode, auth.authToken, context);\n return {\n data: initialized,\n nextToken: data[key].nextToken,\n extensions,\n };\n }\n }\n return {\n data: data[key],\n nextToken: data[key].nextToken,\n extensions,\n };\n }\n }\n catch (error) {\n if (error.errors) {\n // graphql errors pass through\n return error;\n }\n else {\n // non-graphql errors re re-thrown\n throw error;\n }\n }\n}\n"],"names":[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AwB,UAAU;AAClC,qBAAqB,CAAC;AACtB,iBAAiB;AACjB,aAAa;AACb,YAAY,OAAO;AACnB,gBAAgB,IAAI,EAAE,IAAI,CAAC,GAAG,CAAC;AAC/B,gBAAgB,SAAS,EAAE,IAAI,CAAC,GAAG,CAAC,CAAC,SAAS;AAC9C,gBAAgB,UAAU;AAC1B,aAAa,CAAC;AACd,SAAS;AACT,KAAK;AACL,IAAI,OAAO,KAAK,EAAE;AAClB,QAAQ,IAAI,KAAK,CAAC,MAAM,EAAE;AAC1B;AACA,YAAY,OAAO,KAAK,CAAC;AACzB,SAAS;AACT,aAAa;AACb;AACA,YAAY,MAAM,KAAK,CAAC;AACxB,SAAS;AACT,KAAK;AACL;;"}
|
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
2
3
|
// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
|
|
3
4
|
// SPDX-License-Identifier: Apache-2.0
|
|
4
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
@@ -117,3 +118,4 @@ function observeQueryFactory(models, model) {
|
|
|
117
118
|
return observeQuery;
|
|
118
119
|
}
|
|
119
120
|
exports.observeQueryFactory = observeQueryFactory;
|
|
121
|
+
//# sourceMappingURL=observeQuery.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"observeQuery.js","sources":["../../../../src/internals/operations/observeQuery.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.observeQueryFactory = void 0;\nconst rxjs_1 = require(\"rxjs\");\nconst utils_1 = require(\"../../utils\");\nfunction observeQueryFactory(models, model) {\n const { name } = model;\n const observeQuery = (arg) => new rxjs_1.Observable(subscriber => {\n // what we'll be sending to our subscribers\n const items = [];\n // To enqueue subscription messages while we collect our initial\n // result set.\n const messageQueue = [];\n // operation to take when message(s) arrive.\n // this operation will be swapped out once initial \"sync\" is complete\n // to immediately ingest messsages.\n let receiveMessages = (...messages) => {\n return messageQueue.push(...messages);\n };\n // start subscriptions\n const onCreateSub = models[name].onCreate(arg).subscribe({\n next(item) {\n receiveMessages({ item, type: 'create' });\n },\n error(error) {\n subscriber.error({ type: 'onCreate', error });\n },\n });\n const onUpdateSub = models[name].onUpdate(arg).subscribe({\n next(item) {\n receiveMessages({ item, type: 'update' });\n },\n error(error) {\n subscriber.error({ type: 'onUpdate', error });\n },\n });\n const onDeleteSub = models[name].onDelete(arg).subscribe({\n next(item) {\n receiveMessages({ item, type: 'delete' });\n },\n error(error) {\n subscriber.error({ type: 'onDelete', error });\n },\n });\n // consumes a list of messages and sends a snapshot\n function ingestMessages(messages) {\n for (const message of messages) {\n const idx = (0, utils_1.findIndexByFields)(message.item, items, pkFields);\n switch (message.type) {\n case 'create':\n if (idx < 0)\n items.push(message.item);\n break;\n case 'update':\n if (idx >= 0)\n items[idx] = message.item;\n break;\n case 'delete':\n if (idx >= 0)\n items.splice(idx, 1);\n break;\n default:\n console.error('Unrecognized message in observeQuery.', message);\n }\n }\n subscriber.next({\n items,\n isSynced: true,\n });\n }\n const pkFields = (0, utils_1.resolvePKFields)(model);\n // initial results\n (async () => {\n let firstPage = true;\n let nextToken = null;\n while (!subscriber.closed && (firstPage || nextToken)) {\n firstPage = false;\n const { data: page, errors, nextToken: _nextToken, } = await models[name].list({ ...arg, nextToken });\n nextToken = _nextToken;\n items.push(...page);\n // if there are no more pages and no items we already know about\n // that need to be merged in from sub, we're \"synced\"\n const isSynced = messageQueue.length === 0 &&\n (nextToken === null || nextToken === undefined);\n subscriber.next({\n items,\n isSynced,\n });\n if (Array.isArray(errors)) {\n for (const error of errors) {\n subscriber.error(error);\n }\n }\n }\n // play through the queue\n if (messageQueue.length > 0) {\n ingestMessages(messageQueue);\n }\n // switch the queue to write directly to the items collection\n receiveMessages = (...messages) => {\n ingestMessages(messages);\n return items.length;\n };\n })();\n // when subscriber unsubscribes, tear down internal subs\n return () => {\n // 1. tear down internal subs\n onCreateSub.unsubscribe();\n onUpdateSub.unsubscribe();\n onDeleteSub.unsubscribe();\n // 2. there is no need to explicitly stop paging. instead, we\n // just check `subscriber.closed` above before fetching each page.\n };\n });\n return observeQuery;\n}\nexports.observeQueryFactory = observeQueryFactory;\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,OAAO,GAAG,OAAO,CAAC,aAAa,CAAC,CAAC;AACvC,SAAS,mBAAmB,CAAC,MAAM,EAAE,KAAK,EAAE;AAC5C,IAAI,MAAM,EAAE,IAAI,EAAE,GAAG,KAAK,CAAC;AAC3B,IAAI,MAAM,YAAY,GAAG,CAAC,GAAG,KAAK,IAAI,MAAM,CAAC,UAAU,CAAC,UAAU,IAAI;AACtE;AACA,QAAQ,MAAM,KAAK,GAAG,EAAE,CAAC;AACzB;AACA;AACA,QAAQ,MAAM,YAAY,GAAG,EAAE,CAAC;AAChC;AACA;AACA;AACA,QAAQ,IAAI,eAAe,GAAG,CAAC,GAAG,QAAQ,KAAK;AAC/C,YAAY,OAAO,YAAY,CAAC,IAAI,CAAC,GAAG,QAAQ,CAAC,CAAC;AAClD,SAAS,CAAC;AACV;AACA,QAAQ,MAAM,WAAW,GAAG,MAAM,CAAC,IAAI,CAAC,CAAC,QAAQ,CAAC,GAAG,CAAC,CAAC,SAAS,CAAC;AACjE,YAAY,IAAI,CAAC,IAAI,EAAE;AACvB,gBAAgB,eAAe,CAAC,EAAE,IAAI,EAAE,IAAI,EAAE,QAAQ,EAAE,CAAC,CAAC;AAC1D,aAAa;AACb,YAAY,KAAK,CAAC,KAAK,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SPDX-License-Identifier: Apache-2.0
|
|
4
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
@@ -25,3 +26,4 @@ function subscriptionFactory(client, modelIntrospection, model, operation) {
|
|
|
25
26
|
return subscription;
|
|
26
27
|
}
|
|
27
28
|
exports.subscriptionFactory = subscriptionFactory;
|
|
29
|
+
//# 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 [initialized] = (0, APIClient_1.initializeModel)(client, name, [value.data[key]], 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,CA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1
|
-
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
2
3
|
// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
|
|
3
4
|
// SPDX-License-Identifier: Apache-2.0
|
|
4
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
@@ -28,3 +29,4 @@ function generateClient(params) {
|
|
|
28
29
|
return client;
|
|
29
30
|
}
|
|
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;;"}
|
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
2
3
|
// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
|
|
3
4
|
// SPDX-License-Identifier: Apache-2.0
|
|
4
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
@@ -43,3 +44,4 @@ function generateModelsProperty(client, params) {
|
|
|
43
44
|
return models;
|
|
44
45
|
}
|
|
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\";\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.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 // TODO: improve\n throw new Error('generateModelsProperty cannot retrieve Amplify config');\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;AACA;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,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E,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;;"}
|
|
@@ -1,7 +1,9 @@
|
|
|
1
|
-
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
2
3
|
// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
|
|
3
4
|
// SPDX-License-Identifier: Apache-2.0
|
|
4
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
5
6
|
exports.generateClient = void 0;
|
|
6
7
|
var generateClient_1 = require("./generateClient");
|
|
7
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 @@
|
|
|
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,4 +1,5 @@
|
|
|
1
|
-
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
2
3
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
4
|
exports.isCancelError = exports.cancel = exports.graphql = void 0;
|
|
4
5
|
// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
|
|
@@ -117,3 +118,4 @@ function isCancelError(error) {
|
|
|
117
118
|
return GraphQLAPI_1.GraphQLAPI.isCancelError(error);
|
|
118
119
|
}
|
|
119
120
|
exports.isCancelError = isCancelError;
|
|
121
|
+
//# sourceMappingURL=v6.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"v6.js","sources":["../../../src/internals/v6.ts"],"sourcesContent":["\"use strict\";\nObject.defineProperty(exports, \"__esModule\", { value: true });\nexports.isCancelError = exports.cancel = exports.graphql = void 0;\n// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\nconst GraphQLAPI_1 = require(\"../GraphQLAPI\");\nconst types_1 = require(\"../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 */\nfunction 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_1.GraphQLAPI.graphql(this[types_1.__amplify], options, additionalHeaders);\n return result;\n}\nexports.graphql = graphql;\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 */\nfunction cancel(promise, message) {\n return GraphQLAPI_1.GraphQLAPI.cancel(promise, message);\n}\nexports.cancel = cancel;\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 */\nfunction isCancelError(error) {\n return GraphQLAPI_1.GraphQLAPI.isCancelError(error);\n}\nexports.isCancelError = isCancelError;\n"],"names":[],"mappings":";;AACA,MAAM,CAAC,cAAc,CAAC,OAAO,EAAE,YAAY,EAAE,EAAE,KAAK,EAAE,IAAI,EAAE,CAAC,CAAC;AAC9D,OAAO,CAAC,aAAa,GAAG,OAAO,CAAC,MAAM,GAAG,OAAO,CAAC,OAAO,GAAG,KAAK,CAAC,CAAC;AAClE;AACA;AACA,MAAM,YAAY,GAAG,OAAO,CAAC,eAAe,CAAC,CAAC;AAC9C,MAAM,OAAO,GAAG,OAAO,CAAC,UAAU,CAAC,CAAC;AACpC;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;AACA,SAAS,OAAO,CAAC,OAAO,EAAE,iBAAiB,EAAE;AAC7C;AACA;AACA;AACA;AACA;AACA,IAAI,MAAM,MAAM,GAAG,YAAY,CAAC,UAAU,CAAC,OAAO,CAAC,IAAI,CAAC,OAAO,CAAC,SAAS,CAAC,EAAE,OAAO,EAAE,iBAAiB,CAAC,CAAC;AACxG,IAAI,OAAO,MAAM,CAAC;AAClB,CAAC;AACD,OAAO,CAAC,OAAO,GAAG,OAAO,CAAC;AAC1B;AACA;AACA;AACA;AACA;AACA,SAAS,MAAM,CAAC,OAAO,EAAE,OAAO,EAAE;AAClC,IAAI,OAAO,YAAY,CAAC,UAAU,CAAC,MAAM,CAAC,OAAO,EAAE,OAAO,CAAC,CAAC;AAC5D,CAAC;AACD,OAAO,CAAC,MAAM,GAAG,MAAM,CAAC;AACxB;AACA;AACA;AACA;AACA;AACA,SAAS,aAAa,CAAC,KAAK,EAAE;AAC9B,IAAI,OAAO,YAAY,CAAC,UAAU,CAAC,aAAa,CAAC,KAAK,CAAC,CAAC;AACxD,CAAC;AACD,OAAO,CAAC,aAAa,GAAG,aAAa;;"}
|
|
@@ -1,16 +1,14 @@
|
|
|
1
|
-
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
2
3
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
4
|
exports.ConnectionState = exports.CONTROL_MSG = void 0;
|
|
4
|
-
var CONTROL_MSG;
|
|
5
5
|
(function (CONTROL_MSG) {
|
|
6
6
|
CONTROL_MSG["CONNECTION_CLOSED"] = "Connection closed";
|
|
7
7
|
CONTROL_MSG["CONNECTION_FAILED"] = "Connection failed";
|
|
8
8
|
CONTROL_MSG["REALTIME_SUBSCRIPTION_INIT_ERROR"] = "AppSync Realtime subscription init error";
|
|
9
9
|
CONTROL_MSG["SUBSCRIPTION_ACK"] = "Subscription ack";
|
|
10
10
|
CONTROL_MSG["TIMEOUT_DISCONNECT"] = "Timeout disconnect";
|
|
11
|
-
})(CONTROL_MSG || (exports.CONTROL_MSG =
|
|
12
|
-
/** @enum {string} */
|
|
13
|
-
var ConnectionState;
|
|
11
|
+
})(exports.CONTROL_MSG || (exports.CONTROL_MSG = {}));
|
|
14
12
|
(function (ConnectionState) {
|
|
15
13
|
/*
|
|
16
14
|
* The connection is alive and healthy
|
|
@@ -44,4 +42,5 @@ var ConnectionState;
|
|
|
44
42
|
* The connection is alive, but a keep alive message has been missed
|
|
45
43
|
*/
|
|
46
44
|
ConnectionState["ConnectedPendingKeepAlive"] = "ConnectedPendingKeepAlive";
|
|
47
|
-
})(ConnectionState || (exports.ConnectionState =
|
|
45
|
+
})(exports.ConnectionState || (exports.ConnectionState = {}));
|
|
46
|
+
//# sourceMappingURL=PubSub.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"PubSub.js","sources":["../../../src/types/PubSub.ts"],"sourcesContent":["\"use strict\";\nObject.defineProperty(exports, \"__esModule\", { value: true });\nexports.ConnectionState = exports.CONTROL_MSG = void 0;\nvar 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 = exports.CONTROL_MSG || (exports.CONTROL_MSG = {}));\n/** @enum {string} */\nvar 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 = exports.ConnectionState || (exports.ConnectionState = {}));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AAoB,OAAO,CAAC,eAAe,KAAK,OAAO,CAAC,eAAe,GAAG,EAAE,CAAC,CAAC;;"}
|
|
@@ -1,17 +1,18 @@
|
|
|
1
|
-
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
2
3
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
4
|
exports.__authToken = exports.__authMode = exports.__amplify = exports.GraphQLAuthError = exports.ConnectionState = exports.CONTROL_MSG = void 0;
|
|
4
5
|
var PubSub_1 = require("./PubSub");
|
|
5
6
|
Object.defineProperty(exports, "CONTROL_MSG", { enumerable: true, get: function () { return PubSub_1.CONTROL_MSG; } });
|
|
6
7
|
Object.defineProperty(exports, "ConnectionState", { enumerable: true, get: function () { return PubSub_1.ConnectionState; } });
|
|
7
|
-
var GraphQLAuthError;
|
|
8
8
|
(function (GraphQLAuthError) {
|
|
9
9
|
GraphQLAuthError["NO_API_KEY"] = "No api-key configured";
|
|
10
10
|
GraphQLAuthError["NO_CURRENT_USER"] = "No current user";
|
|
11
11
|
GraphQLAuthError["NO_CREDENTIALS"] = "No credentials";
|
|
12
12
|
GraphQLAuthError["NO_FEDERATED_JWT"] = "No federated jwt";
|
|
13
13
|
GraphQLAuthError["NO_AUTH_TOKEN"] = "No auth token specified";
|
|
14
|
-
})(GraphQLAuthError || (exports.GraphQLAuthError =
|
|
14
|
+
})(exports.GraphQLAuthError || (exports.GraphQLAuthError = {}));
|
|
15
15
|
exports.__amplify = Symbol('amplify');
|
|
16
16
|
exports.__authMode = Symbol('authMode');
|
|
17
17
|
exports.__authToken = Symbol('authToken');
|
|
18
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
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;;"}
|
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
2
3
|
// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
|
|
3
4
|
// SPDX-License-Identifier: Apache-2.0
|
|
4
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
@@ -130,3 +131,4 @@ class ConnectionStateMonitor {
|
|
|
130
131
|
}
|
|
131
132
|
}
|
|
132
133
|
exports.ConnectionStateMonitor = ConnectionStateMonitor;
|
|
134
|
+
//# sourceMappingURL=ConnectionStateMonitor.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ConnectionStateMonitor.js","sources":["../../../src/utils/ConnectionStateMonitor.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.ConnectionStateMonitor = exports.CONNECTION_CHANGE = void 0;\nconst rxjs_1 = require(\"rxjs\");\nconst PubSub_1 = require(\"../types/PubSub\");\nconst ReachabilityMonitor_1 = require(\"./ReachabilityMonitor\");\nexports.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};\nclass 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 = (0, ReachabilityMonitor_1.ReachabilityMonitor)().subscribe(({ online }) => {\n this.record(online ? exports.CONNECTION_CHANGE.ONLINE : exports.CONNECTION_CHANGE.OFFLINE);\n this._initialNetworkStateSubscription?.unsubscribe();\n });\n this._linkedConnectionStateObservable =\n new rxjs_1.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 = (0, ReachabilityMonitor_1.ReachabilityMonitor)().subscribe(({ online }) => {\n this.record(online ? exports.CONNECTION_CHANGE.ONLINE : exports.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((0, rxjs_1.map)(value => {\n return this.connectionStatesTranslator(value);\n }))\n .pipe((0, rxjs_1.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 PubSub_1.ConnectionState.ConnectedPendingNetwork;\n if (connectionState === 'connected' &&\n intendedConnectionState === 'disconnected')\n return PubSub_1.ConnectionState.ConnectedPendingDisconnect;\n if (connectionState === 'disconnected' &&\n intendedConnectionState === 'connected' &&\n networkState === 'disconnected')\n return PubSub_1.ConnectionState.ConnectionDisruptedPendingNetwork;\n if (connectionState === 'disconnected' &&\n intendedConnectionState === 'connected')\n return PubSub_1.ConnectionState.ConnectionDisrupted;\n if (connectionState === 'connected' && keepAliveState === 'unhealthy')\n return PubSub_1.ConnectionState.ConnectedPendingKeepAlive;\n // All remaining states directly correspond to the connection state\n if (connectionState === 'connecting')\n return PubSub_1.ConnectionState.Connecting;\n if (connectionState === 'disconnected')\n return PubSub_1.ConnectionState.Disconnected;\n return PubSub_1.ConnectionState.Connected;\n }\n}\nexports.ConnectionStateMonitor = ConnectionStateMonitor;\n"],"names":[],"mappings":";;AACA;AACA;AACA,MAAM,CAAC,cAAc,CAAC,OAAO,EAAE,YAAY,EAAE,EAAE,KAAK,EAAE,IAAI,EAAE,CAAC,CAAC;AAC9D,OAAO,CAAC,sBAAsB,GAAG,OAAO,CAAC,iBAAiB,GAAG,KAAK,CAAC,CAAC;AACpE,MAAM,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC,CAAC;AAC/B,MAAM,QAAQ,GAAG,OAAO,CAAC,iBAAiB,CAAC,CAAC;AAC5C,MAAM,qBAAqB,GAAG,OAAO,CAAC,uBAAuB,CAAC,CAAC;AAC/D,OAAO,CAAC,iBAAiB,GAAG;AAC5B,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;AACvC,KAAK;AACL,IAAI,kBAAkB,EAAE,EAAE,uBAAuB,EAAE,cAAc,EAAE;AACnE,IAAI,kBAAkB,EAAE;AACxB,QAAQ,uBAAuB,EAAE,WAAW;AAC5C,QAAQ,eAAe,EAAE,YAAY;AACrC,KAAK;AACL,IAAI,MAAM,EAAE,EAAE,eAAe,EAAE,cAAc,EAAE;AAC/C,IAAI,MAAM,EAAE,EAAE,YAAY,EAAE,WAAW,EAAE;AACzC,IAAI,OAAO,EAAE,EAAE,YAAY,EAAE,cAAc,EAAE;AAC7C,CAAC,CAAC;AACF,MAAM,sBAAsB,CAAC;AAC7B,IAAI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|
-
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
2
3
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
4
|
exports.ReachabilityMonitor = void 0;
|
|
4
5
|
// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
|
|
@@ -6,3 +7,4 @@ exports.ReachabilityMonitor = void 0;
|
|
|
6
7
|
const utils_1 = require("@aws-amplify/core/internals/utils");
|
|
7
8
|
const ReachabilityMonitor = () => new utils_1.Reachability().networkMonitor();
|
|
8
9
|
exports.ReachabilityMonitor = ReachabilityMonitor;
|
|
10
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sources":["../../../../src/utils/ReachabilityMonitor/index.ts"],"sourcesContent":["\"use strict\";\nObject.defineProperty(exports, \"__esModule\", { value: true });\nexports.ReachabilityMonitor = void 0;\n// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\nconst utils_1 = require(\"@aws-amplify/core/internals/utils\");\nconst ReachabilityMonitor = () => new utils_1.Reachability().networkMonitor();\nexports.ReachabilityMonitor = ReachabilityMonitor;\n"],"names":[],"mappings":";;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;AACA;AACA,MAAM,OAAO,GAAG,OAAO,CAAC,mCAAmC,CAAC,CAAC;AAC7D,MAAM,mBAAmB,GAAG,MAAM,IAAI,OAAO,CAAC,YAAY,EAAE,CAAC,cAAc,EAAE,CAAC;AAC9E,OAAO,CAAC,mBAAmB,GAAG,mBAAmB;;"}
|
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
2
3
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
4
|
exports.ReachabilityMonitor = void 0;
|
|
4
5
|
const tslib_1 = require("tslib");
|
|
@@ -8,3 +9,4 @@ const utils_1 = require("@aws-amplify/core/internals/utils");
|
|
|
8
9
|
const netinfo_1 = tslib_1.__importDefault(require("@react-native-community/netinfo"));
|
|
9
10
|
const ReachabilityMonitor = () => new utils_1.Reachability().networkMonitor(netinfo_1.default);
|
|
10
11
|
exports.ReachabilityMonitor = ReachabilityMonitor;
|
|
12
|
+
//# sourceMappingURL=index.native.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.native.js","sources":["../../../../src/utils/ReachabilityMonitor/index.native.ts"],"sourcesContent":["\"use strict\";\nObject.defineProperty(exports, \"__esModule\", { value: true });\nexports.ReachabilityMonitor = void 0;\nconst tslib_1 = require(\"tslib\");\n// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\nconst utils_1 = require(\"@aws-amplify/core/internals/utils\");\nconst netinfo_1 = tslib_1.__importDefault(require(\"@react-native-community/netinfo\"));\nconst ReachabilityMonitor = () => new utils_1.Reachability().networkMonitor(netinfo_1.default);\nexports.ReachabilityMonitor = ReachabilityMonitor;\n"],"names":[],"mappings":";;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,OAAO,GAAG,OAAO,CAAC,OAAO,CAAC,CAAC;AACjC;AACA;AACA,MAAM,OAAO,GAAG,OAAO,CAAC,mCAAmC,CAAC,CAAC;AAC7D,MAAM,SAAS,GAAG,OAAO,CAAC,eAAe,CAAC,OAAO,CAAC,iCAAiC,CAAC,CAAC,CAAC;AACtF,MAAM,mBAAmB,GAAG,MAAM,IAAI,OAAO,CAAC,YAAY,EAAE,CAAC,cAAc,CAAC,SAAS,CAAC,OAAO,CAAC,CAAC;AAC/F,OAAO,CAAC,mBAAmB,GAAG,mBAAmB;;"}
|
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
2
3
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
4
|
exports.ReconnectionMonitor = exports.ReconnectEvent = void 0;
|
|
4
5
|
const constants_1 = require("../Providers/constants");
|
|
@@ -6,7 +7,7 @@ var ReconnectEvent;
|
|
|
6
7
|
(function (ReconnectEvent) {
|
|
7
8
|
ReconnectEvent["START_RECONNECT"] = "START_RECONNECT";
|
|
8
9
|
ReconnectEvent["HALT_RECONNECT"] = "HALT_RECONNECT";
|
|
9
|
-
})(ReconnectEvent
|
|
10
|
+
})(ReconnectEvent = exports.ReconnectEvent || (exports.ReconnectEvent = {}));
|
|
10
11
|
/**
|
|
11
12
|
* Captures the reconnect event logic used to determine when to reconnect to PubSub providers.
|
|
12
13
|
* Reconnnect attempts are delayed by 5 seconds to let the interface settle.
|
|
@@ -67,3 +68,4 @@ class ReconnectionMonitor {
|
|
|
67
68
|
}
|
|
68
69
|
}
|
|
69
70
|
exports.ReconnectionMonitor = ReconnectionMonitor;
|
|
71
|
+
//# sourceMappingURL=ReconnectionMonitor.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ReconnectionMonitor.js","sources":["../../../src/utils/ReconnectionMonitor.ts"],"sourcesContent":["\"use strict\";\nObject.defineProperty(exports, \"__esModule\", { value: true });\nexports.ReconnectionMonitor = exports.ReconnectEvent = void 0;\nconst constants_1 = require(\"../Providers/constants\");\nvar ReconnectEvent;\n(function (ReconnectEvent) {\n ReconnectEvent[\"START_RECONNECT\"] = \"START_RECONNECT\";\n ReconnectEvent[\"HALT_RECONNECT\"] = \"HALT_RECONNECT\";\n})(ReconnectEvent = exports.ReconnectEvent || (exports.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 */\nclass 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 }, constants_1.RECONNECT_INTERVAL);\n }, constants_1.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}\nexports.ReconnectionMonitor = ReconnectionMonitor;\n"],"names":[],"mappings":";;AACA,MAAM,CAAC,cAAc,CAAC,OAAO,EAAE,YAAY,EAAE,EAAE,KAAK,EAAE,IAAI,EAAE,CAAC,CAAC;AAC9D,OAAO,CAAC,mBAAmB,GAAG,OAAO,CAAC,cAAc,GAAG,KAAK,CAAC,CAAC;AAC9D,MAAM,WAAW,GAAG,OAAO,CAAC,wBAAwB,CAAC,CAAC;AACtD,IAAI,cAAc,CAAC;AACnB,CAAC,UAAU,cAAc,EAAE;AAC3B,IAAI,cAAc,CAAC,iBAAiB,C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SAAS,CAAC;AACrD,aAAa;AACb,YAAY,IAAI,IAAI,CAAC,qBAAqB,EAAE;AAC5C,gBAAgB,YAAY,CAAC,IAAI,CAAC,qBAAqB,CAAC,CAAC;AACzD,gBAAgB,IAAI,CAAC,qBAAqB,GAAG,SAAS,CAAC;AACvD,aAAa;AACb,SAAS;AACT,KAAK;AACL;AACA;AACA;AACA,IAAI,KAAK,GAAG;AACZ,QAAQ,IAAI,CAAC,kBAAkB,CAAC,OAAO,CAAC,iBAAiB,IAAI;AAC7D,YAAY,iBAAiB,CAAC,QAAQ,IAAI,CAAC;AAC3C,SAAS,CAAC,CAAC;AACX,KAAK;AACL,IAAI,iBAAiB,GAAG;AACxB,QAAQ,IAAI,CAAC,kBAAkB,CAAC,OAAO,CAAC,iBAAiB,IAAI;AAC7D,YAAY,iBAAiB,CAAC,IAAI,IAAI,CAAC;AACvC,SAAS,CAAC,CAAC;AACX,KAAK;AACL,CAAC;AACD,OAAO,CAAC,mBAAmB,GAAG,mBAAmB;;"}
|
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
2
3
|
// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
|
|
3
4
|
// SPDX-License-Identifier: Apache-2.0
|
|
4
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
@@ -17,3 +18,4 @@ class APIError extends utils_1.AmplifyError {
|
|
|
17
18
|
}
|
|
18
19
|
}
|
|
19
20
|
exports.APIError = APIError;
|
|
21
|
+
//# sourceMappingURL=APIError.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"APIError.js","sources":["../../../../src/utils/errors/APIError.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.APIError = void 0;\nconst utils_1 = require(\"@aws-amplify/core/internals/utils\");\n/**\n * @internal\n */\nclass APIError extends utils_1.AmplifyError {\n constructor(params) {\n super(params);\n // Hack for making the custom error class work when transpiled to es5\n // TODO: Delete the following 2 lines after we change the build target to >= es2015\n this.constructor = APIError;\n Object.setPrototypeOf(this, APIError.prototype);\n }\n}\nexports.APIError = APIError;\n"],"names":[],"mappings":";;AACA;AACA;AACA,MAAM,CAAC,cAAc,CAAC,OAAO,EAAE,YAAY,EAAE,EAAE,KAAK,EAAE,IAAI,EAAE,CAAC,CAAC;AAC9D,OAAO,CAAC,QAAQ,GAAG,KAAK,CAAC,CAAC;AAC1B,MAAM,OAAO,GAAG,OAAO,CAAC,mCAAmC,CAAC,CAAC;AAC7D;AACA;AACA;AACA,MAAM,QAAQ,SAAS,OAAO,CAAC,YAAY,CAAC;AAC5C,IAAI,WAAW,CAAC,MAAM,EAAE;AACxB,QAAQ,KAAK,CAAC,MAAM,CAAC,CAAC;AACtB;AACA;AACA,QAAQ,IAAI,CAAC,WAAW,GAAG,QAAQ,CAAC;AACpC,QAAQ,MAAM,CAAC,cAAc,CAAC,IAAI,EAAE,QAAQ,CAAC,SAAS,CAAC,CAAC;AACxD,KAAK;AACL,CAAC;AACD,OAAO,CAAC,QAAQ,GAAG,QAAQ;;"}
|
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
2
3
|
// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
|
|
3
4
|
// SPDX-License-Identifier: Apache-2.0
|
|
4
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
@@ -15,3 +16,4 @@ function assertValidationError(assertion, name) {
|
|
|
15
16
|
}
|
|
16
17
|
}
|
|
17
18
|
exports.assertValidationError = assertValidationError;
|
|
19
|
+
//# sourceMappingURL=assertValidationError.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"assertValidationError.js","sources":["../../../../src/utils/errors/assertValidationError.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.assertValidationError = void 0;\nconst APIError_1 = require(\"./APIError\");\nconst validation_1 = require(\"./validation\");\n/**\n * @internal\n */\nfunction assertValidationError(assertion, name) {\n const { message, recoverySuggestion } = validation_1.validationErrorMap[name];\n if (!assertion) {\n throw new APIError_1.APIError({ name, message, recoverySuggestion });\n }\n}\nexports.assertValidationError = assertValidationError;\n"],"names":[],"mappings":";;AACA;AACA;AACA,MAAM,CAAC,cAAc,CAAC,OAAO,EAAE,YAAY,EAAE,EAAE,KAAK,EAAE,IAAI,EAAE,CAAC,CAAC;AAC9D,OAAO,CAAC,qBAAqB,GAAG,KAAK,CAAC,CAAC;AACvC,MAAM,UAAU,GAAG,OAAO,CAAC,YAAY,CAAC,CAAC;AACzC,MAAM,YAAY,GAAG,OAAO,CAAC,cAAc,CAAC,CAAC;AAC7C;AACA;AACA;AACA,SAAS,qBAAqB,CAAC,SAAS,EAAE,IAAI,EAAE;AAChD,IAAI,MAAM,EAAE,OAAO,EAAE,kBAAkB,EAAE,GAAG,YAAY,CAAC,kBAAkB,CAAC,IAAI,CAAC,CAAC;AAClF,IAAI,IAAI,CAAC,SAAS,EAAE;AACpB,QAAQ,MAAM,IAAI,UAAU,CAAC,QAAQ,CAAC,EAAE,IAAI,EAAE,OAAO,EAAE,kBAAkB,EAAE,CAAC,CAAC;AAC7E,KAAK;AACL,CAAC;AACD,OAAO,CAAC,qBAAqB,GAAG,qBAAqB;;"}
|
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
2
3
|
// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
|
|
3
4
|
// SPDX-License-Identifier: Apache-2.0
|
|
4
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
@@ -10,3 +11,4 @@ Object.defineProperty(exports, "assertValidationError", { enumerable: true, get:
|
|
|
10
11
|
var validation_1 = require("./validation");
|
|
11
12
|
Object.defineProperty(exports, "APIValidationErrorCode", { enumerable: true, get: function () { return validation_1.APIValidationErrorCode; } });
|
|
12
13
|
Object.defineProperty(exports, "validationErrorMap", { enumerable: true, get: function () { return validation_1.validationErrorMap; } });
|
|
14
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sources":["../../../../src/utils/errors/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.validationErrorMap = exports.APIValidationErrorCode = exports.assertValidationError = exports.APIError = void 0;\nvar APIError_1 = require(\"./APIError\");\nObject.defineProperty(exports, \"APIError\", { enumerable: true, get: function () { return APIError_1.APIError; } });\nvar assertValidationError_1 = require(\"./assertValidationError\");\nObject.defineProperty(exports, \"assertValidationError\", { enumerable: true, get: function () { return assertValidationError_1.assertValidationError; } });\nvar validation_1 = require(\"./validation\");\nObject.defineProperty(exports, \"APIValidationErrorCode\", { enumerable: true, get: function () { return validation_1.APIValidationErrorCode; } });\nObject.defineProperty(exports, \"validationErrorMap\", { enumerable: true, get: function () { return validation_1.validationErrorMap; } });\n"],"names":[],"mappings":";;AACA;AACA;AACA,MAAM,CAAC,cAAc,CAAC,OAAO,EAAE,YAAY,EAAE,EAAE,KAAK,EAAE,IAAI,EAAE,CAAC,CAAC;AAC9D,OAAO,CAAC,kBAAkB,GAAG,OAAO,CAAC,sBAAsB,GAAG,OAAO,CAAC,qBAAqB,GAAG,OAAO,CAAC,QAAQ,GAAG,KAAK,CAAC,CAAC;AACxH,IAAI,UAAU,GAAG,OAAO,CAAC,YAAY,CAAC,CAAC;AACvC,MAAM,CAAC,cAAc,CAAC,OAAO,EAAE,UAAU,EAAE,EAAE,UAAU,EAAE,IAAI,EAAE,GAAG,EAAE,YAAY,EAAE,OAAO,UAAU,CAAC,QAAQ,CAAC,EAAE,EAAE,CAAC,CAAC;AACnH,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,YAAY,GAAG,OAAO,CAAC,cAAc,CAAC,CAAC;AAC3C,MAAM,CAAC,cAAc,CAAC,OAAO,EAAE,wBAAwB,EAAE,EAAE,UAAU,EAAE,IAAI,EAAE,GAAG,EAAE,YAAY,EAAE,OAAO,YAAY,CAAC,sBAAsB,CAAC,EAAE,EAAE,CAAC,CAAC;AACjJ,MAAM,CAAC,cAAc,CAAC,OAAO,EAAE,oBAAoB,EAAE,EAAE,UAAU,EAAE,IAAI,EAAE,GAAG,EAAE,YAAY,EAAE,OAAO,YAAY,CAAC,kBAAkB,CAAC,EAAE,EAAE,CAAC;;"}
|
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
2
3
|
// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
|
|
3
4
|
// SPDX-License-Identifier: Apache-2.0
|
|
4
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
@@ -8,7 +9,7 @@ var APIValidationErrorCode;
|
|
|
8
9
|
APIValidationErrorCode["NoAuthSession"] = "NoAuthSession";
|
|
9
10
|
APIValidationErrorCode["NoRegion"] = "NoRegion";
|
|
10
11
|
APIValidationErrorCode["NoCustomEndpoint"] = "NoCustomEndpoint";
|
|
11
|
-
})(APIValidationErrorCode
|
|
12
|
+
})(APIValidationErrorCode = exports.APIValidationErrorCode || (exports.APIValidationErrorCode = {}));
|
|
12
13
|
exports.validationErrorMap = {
|
|
13
14
|
[APIValidationErrorCode.NoAuthSession]: {
|
|
14
15
|
message: 'Auth session should not be empty.',
|
|
@@ -24,3 +25,4 @@ exports.validationErrorMap = {
|
|
|
24
25
|
message: 'Custom endpoint region is present without custom endpoint.',
|
|
25
26
|
},
|
|
26
27
|
};
|
|
28
|
+
//# sourceMappingURL=validation.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"validation.js","sources":["../../../../src/utils/errors/validation.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.validationErrorMap = exports.APIValidationErrorCode = void 0;\nvar APIValidationErrorCode;\n(function (APIValidationErrorCode) {\n APIValidationErrorCode[\"NoAuthSession\"] = \"NoAuthSession\";\n APIValidationErrorCode[\"NoRegion\"] = \"NoRegion\";\n APIValidationErrorCode[\"NoCustomEndpoint\"] = \"NoCustomEndpoint\";\n})(APIValidationErrorCode = exports.APIValidationErrorCode || (exports.APIValidationErrorCode = {}));\nexports.validationErrorMap = {\n [APIValidationErrorCode.NoAuthSession]: {\n message: 'Auth session should not be empty.',\n },\n // TODO: re-enable when working in all test environments:\n // [APIValidationErrorCode.NoEndpoint]: {\n // \tmessage: 'Missing endpoint',\n // },\n [APIValidationErrorCode.NoRegion]: {\n message: 'Missing region.',\n },\n [APIValidationErrorCode.NoCustomEndpoint]: {\n message: 'Custom endpoint region is present without custom endpoint.',\n },\n};\n"],"names":[],"mappings":";;AACA;AACA;AACA,MAAM,CAAC,cAAc,CAAC,OAAO,EAAE,YAAY,EAAE,EAAE,KAAK,EAAE,IAAI,EAAE,CAAC,CAAC;AAC9D,OAAO,CAAC,kBAAkB,GAAG,OAAO,CAAC,sBAAsB,GAAG,KAAK,CAAC,CAAC;AACrE,IAAI,sBAAsB,CAAC;AAC3B,CAAC,UAAU,sBAAsB,EAAE;AACnC,IAAI,sBAAsB,CAAC,eAAe,CAAC,GAAG,eAAe,CAAC;AAC9D,IAAI,sBAAsB,CAAC,UAAU,CAAC,GAAG,UAAU,CAAC;AACpD,IAAI,sBAAsB,CAAC,kBAAkB,CAAC,GAAG,kBAAkB,CAAC;AACpE,CAAC,EAAE,sBAAsB,GAAG,OAAO,CAAC,sBAAsB,KAAK,OAAO,CAAC,sBAAsB,GAAG,EAAE,CAAC,CAAC,CAAC;AACrG,OAAO,CAAC,kBAAkB,GAAG;AAC7B,IAAI,CAAC,sBAAsB,CAAC,aAAa,GAAG;AAC5C,QAAQ,OAAO,EAAE,mCAAmC;AACpD,KAAK;AACL;AACA;AACA;AACA;AACA,IAAI,CAAC,sBAAsB,CAAC,QAAQ,GAAG;AACvC,QAAQ,OAAO,EAAE,iBAAiB;AAClC,KAAK;AACL,IAAI,CAAC,sBAAsB,CAAC,gBAAgB,GAAG;AAC/C,QAAQ,OAAO,EAAE,4DAA4D;AAC7E,KAAK;AACL,CAAC;;"}
|
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
2
3
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
4
|
exports.findIndexByFields = void 0;
|
|
4
5
|
// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
|
|
@@ -21,3 +22,4 @@ function findIndexByFields(needle, haystack, keyFields) {
|
|
|
21
22
|
return -1;
|
|
22
23
|
}
|
|
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;;"}
|
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
2
3
|
// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
|
|
3
4
|
// SPDX-License-Identifier: Apache-2.0
|
|
4
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
@@ -11,3 +12,4 @@ var resolvePKFields_1 = require("./resolvePKFields");
|
|
|
11
12
|
Object.defineProperty(exports, "resolvePKFields", { enumerable: true, get: function () { return resolvePKFields_1.resolvePKFields; } });
|
|
12
13
|
var findIndexByFields_1 = require("./findIndexByFields");
|
|
13
14
|
Object.defineProperty(exports, "findIndexByFields", { enumerable: true, get: function () { return findIndexByFields_1.findIndexByFields; } });
|
|
15
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +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.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;;"}
|
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
2
3
|
// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
|
|
3
4
|
// SPDX-License-Identifier: Apache-2.0
|
|
4
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
@@ -22,3 +23,4 @@ const resolveConfig = (amplify) => {
|
|
|
22
23
|
};
|
|
23
24
|
};
|
|
24
25
|
exports.resolveConfig = resolveConfig;
|
|
26
|
+
//# sourceMappingURL=resolveConfig.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"resolveConfig.js","sources":["../../../src/utils/resolveConfig.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.resolveConfig = void 0;\nconst errors_1 = require(\"./errors\");\n/**\n * @internal\n */\nconst resolveConfig = (amplify) => {\n const { apiKey, customEndpoint, customEndpointRegion, defaultAuthMode, endpoint, region, } = amplify.getConfig().API?.GraphQL ?? {};\n // TODO: re-enable when working in all test environments:\n // assertValidationError(!!endpoint, APIValidationErrorCode.NoEndpoint);\n (0, errors_1.assertValidationError)(!(!customEndpoint && customEndpointRegion), errors_1.APIValidationErrorCode.NoCustomEndpoint);\n return {\n apiKey,\n customEndpoint,\n customEndpointRegion,\n defaultAuthMode,\n endpoint,\n region,\n };\n};\nexports.resolveConfig = resolveConfig;\n"],"names":[],"mappings":";;AACA;AACA;AACA,MAAM,CAAC,cAAc,CAAC,OAAO,EAAE,YAAY,EAAE,EAAE,KAAK,EAAE,IAAI,EAAE,CAAC,CAAC;AAC9D,OAAO,CAAC,aAAa,GAAG,KAAK,CAAC,CAAC;AAC/B,MAAM,QAAQ,GAAG,OAAO,CAAC,UAAU,CAAC,CAAC;AACrC;AACA;AACA;AACA,MAAM,aAAa,GAAG,CAAC,OAAO,KAAK;AACnC,IAAI,MAAM,EAAE,MAAM,EAAE,cAAc,EAAE,oBAAoB,EAAE,eAAe,EAAE,QAAQ,EAAE,MAAM,GAAG,GAAG,OAAO,CAAC,SAAS,EAAE,CAAC,GAAG,EAAE,OAAO,IAAI,EAAE,CAAC;AACxI;AACA;AACA,IAAI,IAAI,QAAQ,CAAC,qBAAqB,EAAE,EAAE,CAAC,cAAc,IAAI,oBAAoB,CAAC,EAAE,QAAQ,CAAC,sBAAsB,CAAC,gBAAgB,CAAC,CAAC;AACtI,IAAI,OAAO;AACX,QAAQ,MAAM;AACd,QAAQ,cAAc;AACtB,QAAQ,oBAAoB;AAC5B,QAAQ,eAAe;AACvB,QAAQ,QAAQ;AAChB,QAAQ,MAAM;AACd,KAAK,CAAC;AACN,CAAC,CAAC;AACF,OAAO,CAAC,aAAa,GAAG,aAAa;;"}
|
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
2
3
|
// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
|
|
3
4
|
// SPDX-License-Identifier: Apache-2.0
|
|
4
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
@@ -12,3 +13,4 @@ const resolveLibraryOptions = (amplify) => {
|
|
|
12
13
|
return { headers, withCredentials };
|
|
13
14
|
};
|
|
14
15
|
exports.resolveLibraryOptions = resolveLibraryOptions;
|
|
16
|
+
//# sourceMappingURL=resolveLibraryOptions.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"resolveLibraryOptions.js","sources":["../../../src/utils/resolveLibraryOptions.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 = void 0;\n/**\n * @internal\n */\nconst resolveLibraryOptions = (amplify) => {\n const headers = amplify.libraryOptions?.API?.GraphQL?.headers;\n const withCredentials = amplify.libraryOptions?.API?.GraphQL?.withCredentials;\n return { headers, withCredentials };\n};\nexports.resolveLibraryOptions = 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,KAAK,CAAC,CAAC;AACvC;AACA;AACA;AACA,MAAM,qBAAqB,GAAG,CAAC,OAAO,KAAK;AAC3C,IAAI,MAAM,OAAO,GAAG,OAAO,CAAC,cAAc,EAAE,GAAG,EAAE,OAAO,EAAE,OAAO,CAAC;AAClE,IAAI,MAAM,eAAe,GAAG,OAAO,CAAC,cAAc,EAAE,GAAG,EAAE,OAAO,EAAE,eAAe,CAAC;AAClF,IAAI,OAAO,EAAE,OAAO,EAAE,eAAe,EAAE,CAAC;AACxC,CAAC,CAAC;AACF,OAAO,CAAC,qBAAqB,GAAG,qBAAqB;;"}
|
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
2
3
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
4
|
exports.resolveOwnerFields = void 0;
|
|
4
5
|
/**
|
|
@@ -38,3 +39,4 @@ function isAuthAttribute(attribute) {
|
|
|
38
39
|
}
|
|
39
40
|
return false;
|
|
40
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;;"}
|
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
2
3
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
4
|
exports.resolvePKFields = void 0;
|
|
4
5
|
/**
|
|
@@ -13,3 +14,4 @@ function resolvePKFields(model) {
|
|
|
13
14
|
return [primaryKeyFieldName, ...sortKeyFieldNames];
|
|
14
15
|
}
|
|
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;;"}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { AmplifyClassV6 } from '@aws-amplify/core';
|
|
2
2
|
import { GraphQLOptions, GraphQLResult } from './types';
|
|
3
|
-
import { InternalGraphQLAPIClass } from './internals';
|
|
3
|
+
import { InternalGraphQLAPIClass } from './internals/InternalGraphQLAPI';
|
|
4
4
|
import { Observable } from 'rxjs';
|
|
5
5
|
export declare const graphqlOperation: (query: any, variables?: {}, authToken?: string) => {
|
|
6
6
|
query: any;
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { Category, ApiAction } from '@aws-amplify/core/internals/utils';
|
|
2
|
-
import { InternalGraphQLAPIClass } from './internals';
|
|
3
|
-
|
|
2
|
+
import { InternalGraphQLAPIClass } from './internals/InternalGraphQLAPI.mjs';
|
|
3
|
+
|
|
4
|
+
const graphqlOperation = (query, variables = {}, authToken) => ({
|
|
4
5
|
query,
|
|
5
6
|
variables,
|
|
6
7
|
authToken,
|
|
@@ -8,7 +9,7 @@ export const graphqlOperation = (query, variables = {}, authToken) => ({
|
|
|
8
9
|
/**
|
|
9
10
|
* Export Cloud Logic APIs
|
|
10
11
|
*/
|
|
11
|
-
|
|
12
|
+
class GraphQLAPIClass extends InternalGraphQLAPIClass {
|
|
12
13
|
getModuleName() {
|
|
13
14
|
return 'GraphQLAPI';
|
|
14
15
|
}
|
|
@@ -42,4 +43,7 @@ export class GraphQLAPIClass extends InternalGraphQLAPIClass {
|
|
|
42
43
|
return super.cancel(request, message);
|
|
43
44
|
}
|
|
44
45
|
}
|
|
45
|
-
|
|
46
|
+
const GraphQLAPI = new GraphQLAPIClass(null);
|
|
47
|
+
|
|
48
|
+
export { GraphQLAPI, GraphQLAPIClass, graphqlOperation };
|
|
49
|
+
//# sourceMappingURL=GraphQLAPI.mjs.map
|