@aws-amplify/api-graphql 2.3.26-unstable.2 → 2.3.26

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.
@@ -1,81 +0,0 @@
1
- import { OperationTypeNode } from 'graphql';
2
- import Observable from 'zen-observable-ts';
3
- import { GraphQLOptions, GraphQLResult, GraphQLOperation } from './types';
4
- export declare const graphqlOperation: (query: any, variables?: {}, authToken?: string, userAgentSuffix?: string) => {
5
- query: any;
6
- variables: {};
7
- authToken: string;
8
- userAgentSuffix: string;
9
- };
10
- /**
11
- * Export Cloud Logic APIs
12
- */
13
- export declare class GraphQLAPIClass {
14
- /**
15
- * @private
16
- */
17
- private _options;
18
- private _api;
19
- Auth: import("@aws-amplify/auth/lib-esm/Auth").AuthClass;
20
- Cache: import("@aws-amplify/cache/lib-esm/types").ICache;
21
- Credentials: import("@aws-amplify/core").CredentialsClass;
22
- /**
23
- * Initialize GraphQL API with AWS configuration
24
- * @param {Object} options - Configuration object for API
25
- */
26
- constructor(options: any);
27
- getModuleName(): string;
28
- /**
29
- * Configure API
30
- * @param {Object} config - Configuration of the API
31
- * @return {Object} - The current configuration
32
- */
33
- configure(options: any): any;
34
- /**
35
- * Create an instance of API for the library
36
- * @return - A promise of true if Success
37
- */
38
- createInstance(): true | Promise<never>;
39
- private _headerBasedAuth;
40
- /**
41
- * to get the operation type
42
- * @param operation
43
- */
44
- getGraphqlOperationType(operation: GraphQLOperation): OperationTypeNode;
45
- /**
46
- * Executes a GraphQL operation
47
- *
48
- * @param options - GraphQL Options
49
- * @param [additionalHeaders] - headers to merge in after any `graphql_headers` set in the config
50
- * @returns An Observable if the query is a subscription query, else a promise of the graphql result.
51
- */
52
- graphql<T = any>({ query: paramQuery, variables, authMode, authToken, userAgentSuffix, }: GraphQLOptions, additionalHeaders?: {
53
- [key: string]: string;
54
- }): Observable<GraphQLResult<T>> | Promise<GraphQLResult<T>>;
55
- private _graphql;
56
- createInstanceIfNotCreated(): Promise<void>;
57
- /**
58
- * Checks to see if an error thrown is from an api request cancellation
59
- * @param {any} error - Any error
60
- * @return {boolean} - A boolean indicating if the error was from an api request cancellation
61
- */
62
- isCancel(error: any): any;
63
- /**
64
- * Cancels an inflight request. Only applicable for graphql queries and mutations
65
- * @param {any} request - request to cancel
66
- * @return {boolean} - A boolean indicating if the request was cancelled
67
- */
68
- cancel(request: Promise<any>, message?: string): any;
69
- /**
70
- * Check if the request has a corresponding cancel token in the WeakMap.
71
- * @params request - The request promise
72
- * @return if the request has a corresponding cancel token.
73
- */
74
- hasCancelToken(request: Promise<any>): any;
75
- private _graphqlSubscribe;
76
- /**
77
- * @private
78
- */
79
- _ensureCredentials(): any;
80
- }
81
- export declare const GraphQLAPI: GraphQLAPIClass;
package/lib/index.d.ts DELETED
@@ -1,5 +0,0 @@
1
- import { GraphQLAPI } from './GraphQLAPI';
2
- export { GraphQLResult, GraphQLAuthError, GRAPHQL_AUTH_MODE } from './types';
3
- export { GraphQLAPI, GraphQLAPIClass, graphqlOperation } from './GraphQLAPI';
4
- export * from './types';
5
- export default GraphQLAPI;
@@ -1,30 +0,0 @@
1
- import { Source, DocumentNode, GraphQLError } from 'graphql';
2
- export { OperationTypeNode } from 'graphql';
3
- import { GRAPHQL_AUTH_MODE } from '@aws-amplify/auth';
4
- export { GRAPHQL_AUTH_MODE };
5
- export interface GraphQLOptions {
6
- query: string | DocumentNode;
7
- variables?: object;
8
- authMode?: keyof typeof GRAPHQL_AUTH_MODE;
9
- authToken?: string;
10
- userAgentSuffix?: string;
11
- }
12
- export interface GraphQLResult<T = object> {
13
- data?: T;
14
- errors?: GraphQLError[];
15
- extensions?: {
16
- [key: string]: any;
17
- };
18
- }
19
- export declare enum GraphQLAuthError {
20
- NO_API_KEY = "No api-key configured",
21
- NO_CURRENT_USER = "No current user",
22
- NO_CREDENTIALS = "No credentials",
23
- NO_FEDERATED_JWT = "No federated jwt",
24
- NO_AUTH_TOKEN = "No auth token specified"
25
- }
26
- /**
27
- * GraphQLSource or string, the type of the parameter for calling graphql.parse
28
- * @see: https://graphql.org/graphql-js/language/#parse
29
- */
30
- export declare type GraphQLOperation = Source | string;