@aws-amplify/api-graphql 4.0.1-server-generate-client.1e317a1.0 → 4.0.1-ssr-api.df60e41.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/GraphQLAPI.d.ts +1 -1
- package/lib/GraphQLAPI.js +25 -30
- package/lib/Providers/AWSAppSyncRealTimeProvider/index.d.ts +1 -1
- package/lib/Providers/AWSAppSyncRealTimeProvider/index.js +468 -584
- package/lib/Providers/constants.js +4 -5
- package/lib/index.js +5 -6
- package/lib/internals/InternalGraphQLAPI.d.ts +1 -1
- package/lib/internals/InternalGraphQLAPI.js +203 -263
- package/lib/internals/index.d.ts +0 -1
- package/lib/internals/index.js +5 -8
- package/lib/internals/v6.js +3 -4
- package/lib/tsconfig.tsbuildinfo +6798 -1
- package/lib/types/PubSub.d.ts +2 -2
- package/lib/types/PubSub.js +2 -3
- package/lib/types/index.d.ts +39 -28
- package/lib/types/index.js +3 -4
- package/lib/utils/ConnectionStateMonitor.d.ts +3 -3
- package/lib/utils/ConnectionStateMonitor.js +51 -65
- package/lib/utils/ReachabilityMonitor/index.d.ts +1 -1
- package/lib/utils/ReachabilityMonitor/index.js +2 -4
- package/lib/utils/ReachabilityMonitor/index.native.d.ts +1 -1
- package/lib/utils/ReachabilityMonitor/index.native.js +4 -8
- package/lib/utils/ReconnectionMonitor.js +21 -26
- package/lib/utils/errors/APIError.js +7 -12
- package/lib/utils/errors/assertValidationError.js +4 -5
- package/lib/utils/errors/index.js +4 -5
- package/lib/utils/errors/validation.js +6 -8
- package/lib/utils/index.js +2 -3
- package/lib/utils/resolveConfig.d.ts +1 -1
- package/lib/utils/resolveConfig.js +10 -13
- package/lib/utils/resolveLibraryOptions.d.ts +1 -1
- package/lib/utils/resolveLibraryOptions.js +4 -7
- package/lib-esm/GraphQLAPI.d.ts +1 -1
- package/lib-esm/GraphQLAPI.js +25 -29
- package/lib-esm/Providers/AWSAppSyncRealTimeProvider/index.d.ts +1 -1
- package/lib-esm/Providers/AWSAppSyncRealTimeProvider/index.js +459 -575
- package/lib-esm/Providers/constants.js +10 -10
- package/lib-esm/internals/InternalGraphQLAPI.d.ts +1 -1
- package/lib-esm/internals/InternalGraphQLAPI.js +197 -256
- package/lib-esm/internals/index.d.ts +0 -1
- package/lib-esm/internals/index.js +0 -1
- package/lib-esm/internals/v6.js +1 -1
- package/lib-esm/tsconfig.tsbuildinfo +6798 -1
- package/lib-esm/types/PubSub.d.ts +2 -2
- package/lib-esm/types/index.d.ts +39 -28
- package/lib-esm/types/index.js +1 -1
- package/lib-esm/utils/ConnectionStateMonitor.d.ts +3 -3
- package/lib-esm/utils/ConnectionStateMonitor.js +49 -63
- package/lib-esm/utils/ReachabilityMonitor/index.d.ts +1 -1
- package/lib-esm/utils/ReachabilityMonitor/index.js +1 -1
- package/lib-esm/utils/ReachabilityMonitor/index.native.d.ts +1 -1
- package/lib-esm/utils/ReachabilityMonitor/index.native.js +1 -3
- package/lib-esm/utils/ReconnectionMonitor.js +19 -24
- package/lib-esm/utils/errors/APIError.js +6 -11
- package/lib-esm/utils/errors/assertValidationError.js +2 -2
- package/lib-esm/utils/errors/validation.js +5 -6
- package/lib-esm/utils/resolveConfig.d.ts +1 -1
- package/lib-esm/utils/resolveConfig.js +8 -9
- package/lib-esm/utils/resolveLibraryOptions.d.ts +1 -1
- package/lib-esm/utils/resolveLibraryOptions.js +4 -5
- package/package.json +6 -12
- package/src/GraphQLAPI.ts +6 -1
- package/src/Providers/AWSAppSyncRealTimeProvider/index.ts +6 -5
- package/src/internals/InternalGraphQLAPI.ts +7 -8
- package/src/internals/index.ts +0 -1
- package/src/types/index.ts +39 -15
- package/lib/internals/APIClient.d.ts +0 -101
- package/lib/internals/APIClient.js +0 -443
- package/lib/internals/generateClient.d.ts +0 -12
- package/lib/internals/generateClient.js +0 -30
- package/lib/internals/generateModelsProperty.d.ts +0 -4
- package/lib/internals/generateModelsProperty.js +0 -169
- package/lib/internals/types.d.ts +0 -10
- package/lib/internals/types.js +0 -2
- package/lib/utils/resolveOwnerFields.d.ts +0 -12
- package/lib/utils/resolveOwnerFields.js +0 -63
- package/lib-esm/internals/APIClient.d.ts +0 -101
- package/lib-esm/internals/APIClient.js +0 -432
- package/lib-esm/internals/generateClient.d.ts +0 -12
- package/lib-esm/internals/generateClient.js +0 -26
- package/lib-esm/internals/generateModelsProperty.d.ts +0 -4
- package/lib-esm/internals/generateModelsProperty.js +0 -165
- package/lib-esm/internals/types.d.ts +0 -10
- package/lib-esm/internals/types.js +0 -1
- package/lib-esm/utils/resolveOwnerFields.d.ts +0 -12
- package/lib-esm/utils/resolveOwnerFields.js +0 -59
- package/src/internals/APIClient.ts +0 -583
- package/src/internals/generateClient.ts +0 -30
- package/src/internals/generateModelsProperty.ts +0 -192
- package/src/internals/types.ts +0 -15
- package/src/utils/resolveOwnerFields.ts +0 -65
|
@@ -1,27 +1,25 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
|
|
3
3
|
// SPDX-License-Identifier: Apache-2.0
|
|
4
|
-
var _a;
|
|
5
4
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
exports.validationErrorMap = exports.APIValidationErrorCode = void 0;
|
|
7
5
|
var APIValidationErrorCode;
|
|
8
6
|
(function (APIValidationErrorCode) {
|
|
9
7
|
APIValidationErrorCode["NoAuthSession"] = "NoAuthSession";
|
|
10
8
|
APIValidationErrorCode["NoRegion"] = "NoRegion";
|
|
11
9
|
APIValidationErrorCode["NoCustomEndpoint"] = "NoCustomEndpoint";
|
|
12
|
-
})(APIValidationErrorCode
|
|
13
|
-
exports.validationErrorMap =
|
|
14
|
-
|
|
10
|
+
})(APIValidationErrorCode = exports.APIValidationErrorCode || (exports.APIValidationErrorCode = {}));
|
|
11
|
+
exports.validationErrorMap = {
|
|
12
|
+
[APIValidationErrorCode.NoAuthSession]: {
|
|
15
13
|
message: 'Auth session should not be empty.',
|
|
16
14
|
},
|
|
17
15
|
// TODO: re-enable when working in all test environments:
|
|
18
16
|
// [APIValidationErrorCode.NoEndpoint]: {
|
|
19
17
|
// message: 'Missing endpoint',
|
|
20
18
|
// },
|
|
21
|
-
|
|
19
|
+
[APIValidationErrorCode.NoRegion]: {
|
|
22
20
|
message: 'Missing region.',
|
|
23
21
|
},
|
|
24
|
-
|
|
22
|
+
[APIValidationErrorCode.NoCustomEndpoint]: {
|
|
25
23
|
message: 'Custom endpoint region is present without custom endpoint.',
|
|
26
24
|
},
|
|
27
|
-
|
|
25
|
+
};
|
package/lib/utils/index.js
CHANGED
|
@@ -2,8 +2,7 @@
|
|
|
2
2
|
// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
|
|
3
3
|
// SPDX-License-Identifier: Apache-2.0
|
|
4
4
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
5
|
-
exports.resolveLibraryOptions = exports.resolveConfig = void 0;
|
|
6
5
|
var resolveConfig_1 = require("./resolveConfig");
|
|
7
|
-
|
|
6
|
+
exports.resolveConfig = resolveConfig_1.resolveConfig;
|
|
8
7
|
var resolveLibraryOptions_1 = require("./resolveLibraryOptions");
|
|
9
|
-
|
|
8
|
+
exports.resolveLibraryOptions = resolveLibraryOptions_1.resolveLibraryOptions;
|
|
@@ -6,7 +6,7 @@ export declare const resolveConfig: (amplify: AmplifyClassV6) => {
|
|
|
6
6
|
apiKey: string | undefined;
|
|
7
7
|
customEndpoint: string | undefined;
|
|
8
8
|
customEndpointRegion: string | undefined;
|
|
9
|
-
defaultAuthMode:
|
|
9
|
+
defaultAuthMode: "apiKey" | "oidc" | "userPool" | "iam" | "lambda" | "none" | undefined;
|
|
10
10
|
endpoint: string | undefined;
|
|
11
11
|
region: string | undefined;
|
|
12
12
|
};
|
|
@@ -2,24 +2,21 @@
|
|
|
2
2
|
// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
|
|
3
3
|
// SPDX-License-Identifier: Apache-2.0
|
|
4
4
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
5
|
-
|
|
6
|
-
var errors_1 = require("./errors");
|
|
5
|
+
const errors_1 = require("./errors");
|
|
7
6
|
/**
|
|
8
7
|
* @internal
|
|
9
8
|
*/
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
var _c = (_b = (_a = amplify.getConfig().API) === null || _a === void 0 ? void 0 : _a.GraphQL) !== null && _b !== void 0 ? _b : {}, apiKey = _c.apiKey, customEndpoint = _c.customEndpoint, customEndpointRegion = _c.customEndpointRegion, defaultAuthMode = _c.defaultAuthMode, endpoint = _c.endpoint, region = _c.region;
|
|
9
|
+
exports.resolveConfig = (amplify) => {
|
|
10
|
+
const { apiKey, customEndpoint, customEndpointRegion, defaultAuthMode, endpoint, region, } = amplify.getConfig().API?.GraphQL ?? {};
|
|
13
11
|
// TODO: re-enable when working in all test environments:
|
|
14
12
|
// assertValidationError(!!endpoint, APIValidationErrorCode.NoEndpoint);
|
|
15
|
-
|
|
13
|
+
errors_1.assertValidationError(!(!customEndpoint && customEndpointRegion), errors_1.APIValidationErrorCode.NoCustomEndpoint);
|
|
16
14
|
return {
|
|
17
|
-
apiKey
|
|
18
|
-
customEndpoint
|
|
19
|
-
customEndpointRegion
|
|
20
|
-
defaultAuthMode
|
|
21
|
-
endpoint
|
|
22
|
-
region
|
|
15
|
+
apiKey,
|
|
16
|
+
customEndpoint,
|
|
17
|
+
customEndpointRegion,
|
|
18
|
+
defaultAuthMode,
|
|
19
|
+
endpoint,
|
|
20
|
+
region,
|
|
23
21
|
};
|
|
24
22
|
};
|
|
25
|
-
exports.resolveConfig = resolveConfig;
|
|
@@ -6,6 +6,6 @@ export declare const resolveLibraryOptions: (amplify: AmplifyClassV6) => {
|
|
|
6
6
|
headers: ((options: {
|
|
7
7
|
query: string;
|
|
8
8
|
variables?: Record<string, import("@aws-amplify/core/lib-esm/libraryUtils").DocumentType> | undefined;
|
|
9
|
-
}) => Promise<
|
|
9
|
+
}) => Promise<Record<string, string>>) | undefined;
|
|
10
10
|
withCredentials: boolean | undefined;
|
|
11
11
|
};
|
|
@@ -2,14 +2,11 @@
|
|
|
2
2
|
// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
|
|
3
3
|
// SPDX-License-Identifier: Apache-2.0
|
|
4
4
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
5
|
-
exports.resolveLibraryOptions = void 0;
|
|
6
5
|
/**
|
|
7
6
|
* @internal
|
|
8
7
|
*/
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
return { headers: headers, withCredentials: withCredentials };
|
|
8
|
+
exports.resolveLibraryOptions = (amplify) => {
|
|
9
|
+
const headers = amplify.libraryOptions?.API?.GraphQL?.headers;
|
|
10
|
+
const withCredentials = amplify.libraryOptions?.API?.GraphQL?.withCredentials;
|
|
11
|
+
return { headers, withCredentials };
|
|
14
12
|
};
|
|
15
|
-
exports.resolveLibraryOptions = resolveLibraryOptions;
|
package/lib-esm/GraphQLAPI.d.ts
CHANGED
|
@@ -2,7 +2,7 @@ import { AmplifyClassV6 } from '@aws-amplify/core';
|
|
|
2
2
|
import { GraphQLOptions, GraphQLResult } from './types';
|
|
3
3
|
import { InternalGraphQLAPIClass } from './internals';
|
|
4
4
|
import { Observable } from 'rxjs';
|
|
5
|
-
export declare const graphqlOperation: (query: any, variables?: {}, authToken?: string) => {
|
|
5
|
+
export declare const graphqlOperation: (query: any, variables?: {}, authToken?: string | undefined) => {
|
|
6
6
|
query: any;
|
|
7
7
|
variables: {};
|
|
8
8
|
authToken: string | undefined;
|
package/lib-esm/GraphQLAPI.js
CHANGED
|
@@ -1,24 +1,17 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { Category, ApiAction } from '@aws-amplify/core/internals/utils';
|
|
2
2
|
import { InternalGraphQLAPIClass } from './internals';
|
|
3
|
-
export
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
authToken: authToken,
|
|
9
|
-
});
|
|
10
|
-
};
|
|
3
|
+
export const graphqlOperation = (query, variables = {}, authToken) => ({
|
|
4
|
+
query,
|
|
5
|
+
variables,
|
|
6
|
+
authToken,
|
|
7
|
+
});
|
|
11
8
|
/**
|
|
12
9
|
* Export Cloud Logic APIs
|
|
13
10
|
*/
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
function GraphQLAPIClass() {
|
|
17
|
-
return _super !== null && _super.apply(this, arguments) || this;
|
|
18
|
-
}
|
|
19
|
-
GraphQLAPIClass.prototype.getModuleName = function () {
|
|
11
|
+
export class GraphQLAPIClass extends InternalGraphQLAPIClass {
|
|
12
|
+
getModuleName() {
|
|
20
13
|
return 'GraphQLAPI';
|
|
21
|
-
}
|
|
14
|
+
}
|
|
22
15
|
/**
|
|
23
16
|
* Executes a GraphQL operation
|
|
24
17
|
*
|
|
@@ -26,26 +19,29 @@ var GraphQLAPIClass = /** @class */ (function (_super) {
|
|
|
26
19
|
* @param [additionalHeaders] - headers to merge in after any `graphql_headers` set in the config
|
|
27
20
|
* @returns An Observable if the query is a subscription query, else a promise of the graphql result.
|
|
28
21
|
*/
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
22
|
+
graphql(amplify,
|
|
23
|
+
// amplify: AmplifyClassV6 | (() => Promise<AmplifyClassV6>),
|
|
24
|
+
options, additionalHeaders) {
|
|
25
|
+
return super.graphql(amplify, options, additionalHeaders, {
|
|
26
|
+
category: Category.API,
|
|
27
|
+
action: ApiAction.GraphQl,
|
|
28
|
+
});
|
|
29
|
+
}
|
|
32
30
|
/**
|
|
33
31
|
* Checks to see if an error thrown is from an api request cancellation
|
|
34
32
|
* @param error - Any error
|
|
35
33
|
* @returns A boolean indicating if the error was from an api request cancellation
|
|
36
34
|
*/
|
|
37
|
-
|
|
38
|
-
return
|
|
39
|
-
}
|
|
35
|
+
isCancelError(error) {
|
|
36
|
+
return super.isCancelError(error);
|
|
37
|
+
}
|
|
40
38
|
/**
|
|
41
39
|
* Cancels an inflight request. Only applicable for graphql queries and mutations
|
|
42
40
|
* @param {any} request - request to cancel
|
|
43
41
|
* @returns A boolean indicating if the request was cancelled
|
|
44
42
|
*/
|
|
45
|
-
|
|
46
|
-
return
|
|
47
|
-
}
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
export { GraphQLAPIClass };
|
|
51
|
-
export var GraphQLAPI = new GraphQLAPIClass(null);
|
|
43
|
+
cancel(request, message) {
|
|
44
|
+
return super.cancel(request, message);
|
|
45
|
+
}
|
|
46
|
+
}
|
|
47
|
+
export const GraphQLAPI = new GraphQLAPIClass(null);
|
|
@@ -2,7 +2,7 @@ import { Observable } from 'rxjs';
|
|
|
2
2
|
import { GraphQLAuthMode, CustomUserAgentDetails, DocumentType } from '@aws-amplify/core/internals/utils';
|
|
3
3
|
import { PubSubContentObserver } from '../../types/PubSub';
|
|
4
4
|
import { SUBSCRIPTION_STATUS } from '../constants';
|
|
5
|
-
export type ObserverQuery = {
|
|
5
|
+
export declare type ObserverQuery = {
|
|
6
6
|
observer: PubSubContentObserver;
|
|
7
7
|
query: string;
|
|
8
8
|
variables: Record<string, DocumentType>;
|