@aws-amplify/api-graphql 3.4.4-api-v6.23 → 3.4.4-api-v6.25

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.
@@ -3,6 +3,7 @@ export { OperationTypeNode } from 'graphql';
3
3
  import { GRAPHQL_AUTH_MODE } from '@aws-amplify/auth';
4
4
  export { GRAPHQL_AUTH_MODE };
5
5
  import { Observable } from 'zen-observable-ts';
6
+ import { AWSAppSyncRealTimeProvider } from '@aws-amplify/pubsub';
6
7
  /**
7
8
  * Loose/Unknown options for raw GraphQLAPICategory `graphql()`.
8
9
  */
@@ -23,6 +24,13 @@ export interface GraphQLResult<T = object> {
23
24
  [key: string]: any;
24
25
  };
25
26
  }
27
+ declare const queryType: unique symbol;
28
+ export declare type GraphQLQuery<T> = T & {
29
+ readonly [queryType]: 'query';
30
+ };
31
+ export declare type GraphQLSubscription<T> = T & {
32
+ readonly [queryType]: 'subscription';
33
+ };
26
34
  /**
27
35
  * The return value from a `graphql({query})` call when `query` is a subscription.
28
36
  *
@@ -61,9 +69,9 @@ export declare type GraphqlSubscriptionResult<T> = Observable<GraphqlSubscriptio
61
69
  * ```
62
70
  */
63
71
  export declare type GraphqlSubscriptionMessage<T> = {
64
- provider: any;
72
+ provider: AWSAppSyncRealTimeProvider;
65
73
  value: {
66
- data: T;
74
+ data?: T;
67
75
  };
68
76
  };
69
77
  export declare enum GraphQLAuthError {
@@ -109,7 +117,7 @@ export declare type GraphQLVariablesV6<FALLBACK_TYPES = unknown, TYPED_GQL_STRIN
109
117
  * The expected return type with respect to the given `FALLBACK_TYPE`
110
118
  * and `TYPED_GQL_STRING`.
111
119
  */
112
- export declare type GraphQLResponseV6<FALLBACK_TYPE = UnknownGraphQLResponse, TYPED_GQL_STRING extends string = string> = TYPED_GQL_STRING extends GeneratedQuery<any, infer QUERY_OUT> ? Promise<GraphQLResult<QUERY_OUT>> : TYPED_GQL_STRING extends GeneratedMutation<any, infer MUTATION_OUT> ? Promise<GraphQLResult<MUTATION_OUT>> : TYPED_GQL_STRING extends GeneratedSubscription<any, infer SUB_OUT> ? GraphqlSubscriptionResult<SUB_OUT> : FALLBACK_TYPE extends GraphQLOperationType<any, infer CUSTOM_OUT> ? CUSTOM_OUT : FALLBACK_TYPE extends {} ? FALLBACK_TYPE : UnknownGraphQLResponse;
120
+ export declare type GraphQLResponseV6<FALLBACK_TYPE = unknown, TYPED_GQL_STRING extends string = string> = TYPED_GQL_STRING extends GeneratedQuery<infer IN, infer QUERY_OUT> ? Promise<GraphQLResult<QUERY_OUT>> : TYPED_GQL_STRING extends GeneratedMutation<infer IN, infer MUTATION_OUT> ? Promise<GraphQLResult<MUTATION_OUT>> : TYPED_GQL_STRING extends GeneratedSubscription<infer IN, infer SUB_OUT> ? GraphqlSubscriptionResult<SUB_OUT> : FALLBACK_TYPE extends GraphQLQuery<infer T> ? Promise<GraphQLResult<FALLBACK_TYPE>> : FALLBACK_TYPE extends GraphQLSubscription<infer T> ? GraphqlSubscriptionResult<FALLBACK_TYPE> : FALLBACK_TYPE extends GraphQLOperationType<infer IN, infer CUSTOM_OUT> ? CUSTOM_OUT : UnknownGraphQLResponse;
113
121
  /**
114
122
  * The shape customers can use to provide `T` to `graphql<T>()` to specify both
115
123
  * `IN` and `OUT` types (the type of `variables` and the return type, respectively).
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/types/index.ts"],"names":[],"mappings":";;AAIA,0CAAsD;AAC7C,4BADA,wBAAiB,CACA;AAsE1B,IAAY,gBAMX;AAND,WAAY,gBAAgB;IAC3B,wDAAoC,CAAA;IACpC,uDAAmC,CAAA;IACnC,qDAAiC,CAAA;IACjC,yDAAqC,CAAA;IACrC,6DAAyC,CAAA;AAC1C,CAAC,EANW,gBAAgB,GAAhB,wBAAgB,KAAhB,wBAAgB,QAM3B"}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/types/index.ts"],"names":[],"mappings":";;AAIA,0CAAsD;AAC7C,4BADA,wBAAiB,CACA;AA+E1B,IAAY,gBAMX;AAND,WAAY,gBAAgB;IAC3B,wDAAoC,CAAA;IACpC,uDAAmC,CAAA;IACnC,qDAAiC,CAAA;IACjC,yDAAqC,CAAA;IACrC,6DAAyC,CAAA;AAC1C,CAAC,EANW,gBAAgB,GAAhB,wBAAgB,KAAhB,wBAAgB,QAM3B"}
@@ -3,6 +3,7 @@ export { OperationTypeNode } from 'graphql';
3
3
  import { GRAPHQL_AUTH_MODE } from '@aws-amplify/auth';
4
4
  export { GRAPHQL_AUTH_MODE };
5
5
  import { Observable } from 'zen-observable-ts';
6
+ import { AWSAppSyncRealTimeProvider } from '@aws-amplify/pubsub';
6
7
  /**
7
8
  * Loose/Unknown options for raw GraphQLAPICategory `graphql()`.
8
9
  */
@@ -23,6 +24,13 @@ export interface GraphQLResult<T = object> {
23
24
  [key: string]: any;
24
25
  };
25
26
  }
27
+ declare const queryType: unique symbol;
28
+ export declare type GraphQLQuery<T> = T & {
29
+ readonly [queryType]: 'query';
30
+ };
31
+ export declare type GraphQLSubscription<T> = T & {
32
+ readonly [queryType]: 'subscription';
33
+ };
26
34
  /**
27
35
  * The return value from a `graphql({query})` call when `query` is a subscription.
28
36
  *
@@ -61,9 +69,9 @@ export declare type GraphqlSubscriptionResult<T> = Observable<GraphqlSubscriptio
61
69
  * ```
62
70
  */
63
71
  export declare type GraphqlSubscriptionMessage<T> = {
64
- provider: any;
72
+ provider: AWSAppSyncRealTimeProvider;
65
73
  value: {
66
- data: T;
74
+ data?: T;
67
75
  };
68
76
  };
69
77
  export declare enum GraphQLAuthError {
@@ -109,7 +117,7 @@ export declare type GraphQLVariablesV6<FALLBACK_TYPES = unknown, TYPED_GQL_STRIN
109
117
  * The expected return type with respect to the given `FALLBACK_TYPE`
110
118
  * and `TYPED_GQL_STRING`.
111
119
  */
112
- export declare type GraphQLResponseV6<FALLBACK_TYPE = UnknownGraphQLResponse, TYPED_GQL_STRING extends string = string> = TYPED_GQL_STRING extends GeneratedQuery<any, infer QUERY_OUT> ? Promise<GraphQLResult<QUERY_OUT>> : TYPED_GQL_STRING extends GeneratedMutation<any, infer MUTATION_OUT> ? Promise<GraphQLResult<MUTATION_OUT>> : TYPED_GQL_STRING extends GeneratedSubscription<any, infer SUB_OUT> ? GraphqlSubscriptionResult<SUB_OUT> : FALLBACK_TYPE extends GraphQLOperationType<any, infer CUSTOM_OUT> ? CUSTOM_OUT : FALLBACK_TYPE extends {} ? FALLBACK_TYPE : UnknownGraphQLResponse;
120
+ export declare type GraphQLResponseV6<FALLBACK_TYPE = unknown, TYPED_GQL_STRING extends string = string> = TYPED_GQL_STRING extends GeneratedQuery<infer IN, infer QUERY_OUT> ? Promise<GraphQLResult<QUERY_OUT>> : TYPED_GQL_STRING extends GeneratedMutation<infer IN, infer MUTATION_OUT> ? Promise<GraphQLResult<MUTATION_OUT>> : TYPED_GQL_STRING extends GeneratedSubscription<infer IN, infer SUB_OUT> ? GraphqlSubscriptionResult<SUB_OUT> : FALLBACK_TYPE extends GraphQLQuery<infer T> ? Promise<GraphQLResult<FALLBACK_TYPE>> : FALLBACK_TYPE extends GraphQLSubscription<infer T> ? GraphqlSubscriptionResult<FALLBACK_TYPE> : FALLBACK_TYPE extends GraphQLOperationType<infer IN, infer CUSTOM_OUT> ? CUSTOM_OUT : UnknownGraphQLResponse;
113
121
  /**
114
122
  * The shape customers can use to provide `T` to `graphql<T>()` to specify both
115
123
  * `IN` and `OUT` types (the type of `variables` and the return type, respectively).
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/types/index.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,iBAAiB,EAAE,MAAM,mBAAmB,CAAC;AACtD,OAAO,EAAE,iBAAiB,EAAE,CAAC;AAsE7B,MAAM,CAAN,IAAY,gBAMX;AAND,WAAY,gBAAgB;IAC3B,wDAAoC,CAAA;IACpC,uDAAmC,CAAA;IACnC,qDAAiC,CAAA;IACjC,yDAAqC,CAAA;IACrC,6DAAyC,CAAA;AAC1C,CAAC,EANW,gBAAgB,KAAhB,gBAAgB,QAM3B"}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/types/index.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,iBAAiB,EAAE,MAAM,mBAAmB,CAAC;AACtD,OAAO,EAAE,iBAAiB,EAAE,CAAC;AA+E7B,MAAM,CAAN,IAAY,gBAMX;AAND,WAAY,gBAAgB;IAC3B,wDAAoC,CAAA;IACpC,uDAAmC,CAAA;IACnC,qDAAiC,CAAA;IACjC,yDAAqC,CAAA;IACrC,6DAAyC,CAAA;AAC1C,CAAC,EANW,gBAAgB,KAAhB,gBAAgB,QAM3B"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@aws-amplify/api-graphql",
3
- "version": "3.4.4-api-v6.23+6a0182db2",
3
+ "version": "3.4.4-api-v6.25+6e3f5010b",
4
4
  "description": "Api-graphql category of aws-amplify",
5
5
  "main": "./lib/index.js",
6
6
  "module": "./lib-esm/index.js",
@@ -50,11 +50,11 @@
50
50
  "internals"
51
51
  ],
52
52
  "dependencies": {
53
- "@aws-amplify/api-rest": "3.3.3-api-v6.23+6a0182db2",
54
- "@aws-amplify/auth": "5.5.4-api-v6.23+6a0182db2",
55
- "@aws-amplify/cache": "5.1.4-api-v6.23+6a0182db2",
56
- "@aws-amplify/core": "5.5.3-api-v6.23+6a0182db2",
57
- "@aws-amplify/pubsub": "5.3.4-api-v6.23+6a0182db2",
53
+ "@aws-amplify/api-rest": "3.3.3-api-v6.25+6e3f5010b",
54
+ "@aws-amplify/auth": "5.5.4-api-v6.25+6e3f5010b",
55
+ "@aws-amplify/cache": "5.1.4-api-v6.25+6e3f5010b",
56
+ "@aws-amplify/core": "5.5.3-api-v6.25+6e3f5010b",
57
+ "@aws-amplify/pubsub": "5.3.4-api-v6.25+6e3f5010b",
58
58
  "graphql": "15.8.0",
59
59
  "tslib": "^1.8.0",
60
60
  "uuid": "^3.2.1",
@@ -116,5 +116,5 @@
116
116
  "lib-esm"
117
117
  ]
118
118
  },
119
- "gitHead": "6a0182db2a02dd45a2fd2d0c5cf69ffeaf452cc1"
119
+ "gitHead": "6e3f5010b235d1b12d81e410ee5652365294a615"
120
120
  }
@@ -5,6 +5,7 @@ export { OperationTypeNode } from 'graphql';
5
5
  import { GRAPHQL_AUTH_MODE } from '@aws-amplify/auth';
6
6
  export { GRAPHQL_AUTH_MODE };
7
7
  import { Observable } from 'zen-observable-ts';
8
+ import { AWSAppSyncRealTimeProvider } from '@aws-amplify/pubsub';
8
9
 
9
10
  /**
10
11
  * Loose/Unknown options for raw GraphQLAPICategory `graphql()`.
@@ -28,6 +29,14 @@ export interface GraphQLResult<T = object> {
28
29
  };
29
30
  }
30
31
 
32
+ // Opaque type used for determining the graphql query type
33
+ declare const queryType: unique symbol;
34
+
35
+ export type GraphQLQuery<T> = T & { readonly [queryType]: 'query' };
36
+ export type GraphQLSubscription<T> = T & {
37
+ readonly [queryType]: 'subscription';
38
+ };
39
+
31
40
  /**
32
41
  * The return value from a `graphql({query})` call when `query` is a subscription.
33
42
  *
@@ -69,8 +78,8 @@ export type GraphqlSubscriptionResult<T> = Observable<
69
78
  * ```
70
79
  */
71
80
  export type GraphqlSubscriptionMessage<T> = {
72
- provider: any;
73
- value: { data: T };
81
+ provider: AWSAppSyncRealTimeProvider;
82
+ value: { data?: T };
74
83
  };
75
84
 
76
85
  export enum GraphQLAuthError {
@@ -138,18 +147,20 @@ export type GraphQLVariablesV6<
138
147
  * and `TYPED_GQL_STRING`.
139
148
  */
140
149
  export type GraphQLResponseV6<
141
- FALLBACK_TYPE = UnknownGraphQLResponse,
150
+ FALLBACK_TYPE = unknown,
142
151
  TYPED_GQL_STRING extends string = string
143
- > = TYPED_GQL_STRING extends GeneratedQuery<any, infer QUERY_OUT>
152
+ > = TYPED_GQL_STRING extends GeneratedQuery<infer IN, infer QUERY_OUT>
144
153
  ? Promise<GraphQLResult<QUERY_OUT>>
145
- : TYPED_GQL_STRING extends GeneratedMutation<any, infer MUTATION_OUT>
154
+ : TYPED_GQL_STRING extends GeneratedMutation<infer IN, infer MUTATION_OUT>
146
155
  ? Promise<GraphQLResult<MUTATION_OUT>>
147
- : TYPED_GQL_STRING extends GeneratedSubscription<any, infer SUB_OUT>
156
+ : TYPED_GQL_STRING extends GeneratedSubscription<infer IN, infer SUB_OUT>
148
157
  ? GraphqlSubscriptionResult<SUB_OUT>
149
- : FALLBACK_TYPE extends GraphQLOperationType<any, infer CUSTOM_OUT>
158
+ : FALLBACK_TYPE extends GraphQLQuery<infer T>
159
+ ? Promise<GraphQLResult<FALLBACK_TYPE>>
160
+ : FALLBACK_TYPE extends GraphQLSubscription<infer T>
161
+ ? GraphqlSubscriptionResult<FALLBACK_TYPE>
162
+ : FALLBACK_TYPE extends GraphQLOperationType<infer IN, infer CUSTOM_OUT>
150
163
  ? CUSTOM_OUT
151
- : FALLBACK_TYPE extends {}
152
- ? FALLBACK_TYPE
153
164
  : UnknownGraphQLResponse;
154
165
 
155
166
  /**