@aws-amplify/api 6.0.1-console-preview.d807e55.0 → 6.0.1-console-preview.5f040a2.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/API.d.ts +3 -40
- package/lib/API.js +15 -31
- package/lib/API.js.map +1 -1
- package/lib/index.d.ts +1 -6
- package/lib/index.js +1 -2
- package/lib/index.js.map +1 -1
- package/lib/internals/InternalAPI.js +9 -1
- package/lib/internals/InternalAPI.js.map +1 -1
- package/lib/server.d.ts +8 -0
- package/lib/server.js +16 -0
- package/lib/server.js.map +1 -1
- package/lib-esm/API.d.ts +3 -40
- package/lib-esm/API.js +14 -31
- package/lib-esm/API.js.map +1 -1
- package/lib-esm/index.d.ts +1 -6
- package/lib-esm/index.js +1 -3
- package/lib-esm/index.js.map +1 -1
- package/lib-esm/internals/InternalAPI.js +10 -2
- package/lib-esm/internals/InternalAPI.js.map +1 -1
- package/lib-esm/server.d.ts +8 -0
- package/lib-esm/server.js +15 -0
- package/lib-esm/server.js.map +1 -1
- package/package.json +4 -13
- package/src/API.ts +12 -70
- package/src/index.ts +1 -5
- package/src/internals/InternalAPI.ts +11 -1
- package/src/server.ts +32 -0
package/lib/API.d.ts
CHANGED
|
@@ -1,42 +1,5 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { graphql as v6graphql, cancel as v6cancel, isCancelError as v6isCancelError } from '@aws-amplify/api-graphql/internals';
|
|
3
|
-
import { Observable } from 'rxjs';
|
|
4
|
-
import { InternalAPIClass } from './internals/InternalAPI';
|
|
1
|
+
import { V6Client } from '@aws-amplify/api-graphql';
|
|
5
2
|
/**
|
|
6
|
-
*
|
|
7
|
-
* Use RestApi or GraphQLAPI to reduce your application bundle size
|
|
8
|
-
* Export Cloud Logic APIs
|
|
3
|
+
* Generates an API client that can work with models or raw GraphQL
|
|
9
4
|
*/
|
|
10
|
-
export declare
|
|
11
|
-
getModuleName(): string;
|
|
12
|
-
/**
|
|
13
|
-
* Executes a GraphQL operation
|
|
14
|
-
*
|
|
15
|
-
* @param options - GraphQL Options
|
|
16
|
-
* @param [additionalHeaders] - headers to merge in after any `graphql_headers` set in the config
|
|
17
|
-
* @returns An Observable if queryType is 'subscription', else a promise of the graphql result from the query.
|
|
18
|
-
*/
|
|
19
|
-
graphql<T>(options: GraphQLOptions, additionalHeaders?: {
|
|
20
|
-
[key: string]: string;
|
|
21
|
-
}): T extends GraphQLQuery<T> ? Promise<GraphQLResult<T>> : T extends GraphQLSubscription<T> ? Observable<{
|
|
22
|
-
provider: AWSAppSyncRealTimeProvider;
|
|
23
|
-
value: GraphQLResult<T>;
|
|
24
|
-
}> : Promise<GraphQLResult<any>> | Observable<object>;
|
|
25
|
-
/**
|
|
26
|
-
* Generates an API client that can work with models or raw GraphQL
|
|
27
|
-
*/
|
|
28
|
-
generateClient<T extends Record<any, any> = never>(): V6Client<T>;
|
|
29
|
-
}
|
|
30
|
-
declare type FilteredKeys<T> = {
|
|
31
|
-
[P in keyof T]: T[P] extends never ? never : P;
|
|
32
|
-
}[keyof T];
|
|
33
|
-
declare type ExcludeNeverFields<O> = {
|
|
34
|
-
[K in FilteredKeys<O>]: O[K];
|
|
35
|
-
};
|
|
36
|
-
declare type V6Client<T extends Record<any, any> = never> = ExcludeNeverFields<{
|
|
37
|
-
graphql: typeof v6graphql;
|
|
38
|
-
cancel: typeof v6cancel;
|
|
39
|
-
isCancelError: typeof v6isCancelError;
|
|
40
|
-
}>;
|
|
41
|
-
export declare const API: APIClass;
|
|
42
|
-
export {};
|
|
5
|
+
export declare function generateClient<T extends Record<any, any> = never>(): V6Client<T>;
|
package/lib/API.js
CHANGED
|
@@ -1,37 +1,21 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
|
|
3
|
+
// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
|
|
4
|
+
// SPDX-License-Identifier: Apache-2.0
|
|
5
|
+
var api_graphql_1 = require("@aws-amplify/api-graphql");
|
|
4
6
|
var internals_1 = require("@aws-amplify/api-graphql/internals");
|
|
5
|
-
var
|
|
7
|
+
var core_1 = require("@aws-amplify/core");
|
|
6
8
|
/**
|
|
7
|
-
*
|
|
8
|
-
* Use RestApi or GraphQLAPI to reduce your application bundle size
|
|
9
|
-
* Export Cloud Logic APIs
|
|
9
|
+
* Generates an API client that can work with models or raw GraphQL
|
|
10
10
|
*/
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
};
|
|
22
|
-
/**
|
|
23
|
-
* Generates an API client that can work with models or raw GraphQL
|
|
24
|
-
*/
|
|
25
|
-
APIClass.prototype.generateClient = function () {
|
|
26
|
-
var client = {
|
|
27
|
-
graphql: internals_1.graphql,
|
|
28
|
-
cancel: internals_1.cancel,
|
|
29
|
-
isCancelError: internals_1.isCancelError,
|
|
30
|
-
};
|
|
31
|
-
return client;
|
|
32
|
-
};
|
|
33
|
-
return APIClass;
|
|
34
|
-
}(InternalAPI_1.InternalAPIClass));
|
|
35
|
-
exports.APIClass = APIClass;
|
|
36
|
-
exports.API = new APIClass(null);
|
|
11
|
+
function generateClient() {
|
|
12
|
+
var _a;
|
|
13
|
+
return _a = {},
|
|
14
|
+
_a[api_graphql_1.__amplify] = core_1.Amplify,
|
|
15
|
+
_a.graphql = internals_1.graphql,
|
|
16
|
+
_a.cancel = internals_1.cancel,
|
|
17
|
+
_a.isCancelError = internals_1.isCancelError,
|
|
18
|
+
_a;
|
|
19
|
+
}
|
|
20
|
+
exports.generateClient = generateClient;
|
|
37
21
|
//# sourceMappingURL=API.js.map
|
package/lib/API.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"API.js","sourceRoot":"","sources":["../src/API.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"API.js","sourceRoot":"","sources":["../src/API.ts"],"names":[],"mappings":";;AAAA,qEAAqE;AACrE,sCAAsC;AACtC,wDAA+D;AAC/D,gEAI4C;AAC5C,0CAA4C;AAE5C;;GAEG;AACH,SAAgB,cAAc;;IAG7B;QACC,GAAC,uBAAS,IAAG,cAAO;QACpB,UAAO,GAAE,mBAAS;QAClB,SAAM,GAAE,kBAAQ;QAChB,gBAAa,GAAE,yBAAe;WAC7B;AACH,CAAC;AATD,wCASC"}
|
package/lib/index.d.ts
CHANGED
|
@@ -1,10 +1,5 @@
|
|
|
1
1
|
export { GraphQLQuery, GraphQLSubscription } from './types';
|
|
2
|
+
export { generateClient } from './API';
|
|
2
3
|
export { GraphQLAuthError } from '@aws-amplify/api-graphql';
|
|
3
4
|
export type { GraphQLResult, GraphQLReturnType, } from '@aws-amplify/api-graphql';
|
|
4
|
-
declare const generateClient: <T extends Record<any, any> = never>() => {
|
|
5
|
-
cancel: typeof import("@aws-amplify/api-graphql/lib-esm/internals").cancel;
|
|
6
|
-
graphql: typeof import("@aws-amplify/api-graphql/lib-esm/internals").graphql;
|
|
7
|
-
isCancelError: typeof import("@aws-amplify/api-graphql/lib-esm/internals").isCancelError;
|
|
8
|
-
};
|
|
9
|
-
export { generateClient };
|
|
10
5
|
export { get, put, post, del, head, patch, isCancelError, } from '@aws-amplify/api-rest';
|
package/lib/index.js
CHANGED
|
@@ -3,10 +3,9 @@
|
|
|
3
3
|
// SPDX-License-Identifier: Apache-2.0
|
|
4
4
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
5
5
|
var API_1 = require("./API");
|
|
6
|
+
exports.generateClient = API_1.generateClient;
|
|
6
7
|
var api_graphql_1 = require("@aws-amplify/api-graphql");
|
|
7
8
|
exports.GraphQLAuthError = api_graphql_1.GraphQLAuthError;
|
|
8
|
-
var generateClient = API_1.API.generateClient;
|
|
9
|
-
exports.generateClient = generateClient;
|
|
10
9
|
var api_rest_1 = require("@aws-amplify/api-rest");
|
|
11
10
|
exports.get = api_rest_1.get;
|
|
12
11
|
exports.put = api_rest_1.put;
|
package/lib/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";AAAA,qEAAqE;AACrE,sCAAsC;;AAKtC,
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";AAAA,qEAAqE;AACrE,sCAAsC;;AAKtC,6BAAuC;AAA9B,+BAAA,cAAc,CAAA;AAEvB,wDAA4D;AAAnD,yCAAA,gBAAgB,CAAA;AAOzB,kDAQ+B;AAP9B,yBAAA,GAAG,CAAA;AACH,yBAAA,GAAG,CAAA;AACH,0BAAA,IAAI,CAAA;AACJ,yBAAA,GAAG,CAAA;AACH,0BAAA,IAAI,CAAA;AACJ,2BAAA,KAAK,CAAA;AACL,mCAAA,aAAa,CAAA"}
|
|
@@ -4,6 +4,14 @@ var tslib_1 = require("tslib");
|
|
|
4
4
|
var internals_1 = require("@aws-amplify/api-graphql/internals");
|
|
5
5
|
var core_1 = require("@aws-amplify/core");
|
|
6
6
|
var utils_1 = require("@aws-amplify/core/internals/utils");
|
|
7
|
+
/**
|
|
8
|
+
* NOTE!
|
|
9
|
+
*
|
|
10
|
+
* This is used only by DataStore.
|
|
11
|
+
*
|
|
12
|
+
* This can probably be pruned and/or removed. Just leaving it as much of the same
|
|
13
|
+
* state as possible for V6 to reduce number of potentially impactful changes to DataStore.
|
|
14
|
+
*/
|
|
7
15
|
var logger = new utils_1.ConsoleLogger('API');
|
|
8
16
|
/**
|
|
9
17
|
* @deprecated
|
|
@@ -33,7 +41,7 @@ var InternalAPIClass = /** @class */ (function () {
|
|
|
33
41
|
};
|
|
34
42
|
InternalAPIClass.prototype.graphql = function (options, additionalHeaders, customUserAgentDetails) {
|
|
35
43
|
var apiUserAgentDetails = tslib_1.__assign({ category: utils_1.Category.API, action: utils_1.ApiAction.GraphQl }, customUserAgentDetails);
|
|
36
|
-
return this._graphqlApi.graphql(options, additionalHeaders, apiUserAgentDetails);
|
|
44
|
+
return this._graphqlApi.graphql(core_1.Amplify, options, additionalHeaders, apiUserAgentDetails);
|
|
37
45
|
};
|
|
38
46
|
return InternalAPIClass;
|
|
39
47
|
}());
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"InternalAPI.js","sourceRoot":"","sources":["../../src/internals/InternalAPI.ts"],"names":[],"mappings":";;;AAWA,gEAA6E;AAC7E,
|
|
1
|
+
{"version":3,"file":"InternalAPI.js","sourceRoot":"","sources":["../../src/internals/InternalAPI.ts"],"names":[],"mappings":";;;AAWA,gEAA6E;AAC7E,0CAAmD;AACnD,2DAK2C;AAG3C;;;;;;;GAOG;AAEH,IAAM,MAAM,GAAG,IAAI,qBAAM,CAAC,KAAK,CAAC,CAAC;AACjC;;;;GAIG;AACH;IAUC;;;OAGG;IACH,0BAAY,OAAO;QANnB,UAAK,GAAG,YAAK,CAAC;QAOb,IAAI,CAAC,QAAQ,GAAG,OAAO,CAAC;QACxB,IAAI,CAAC,WAAW,GAAG,IAAI,mCAAuB,CAAC,OAAO,CAAC,CAAC;QACxD,MAAM,CAAC,KAAK,CAAC,aAAa,EAAE,IAAI,CAAC,QAAQ,CAAC,CAAC;IAC5C,CAAC;IAEM,wCAAa,GAApB;QACC,OAAO,aAAa,CAAC;IACtB,CAAC;IAED;;;OAGG;IACH,kDAAuB,GAAvB,UAAwB,SAA2B;QAClD,OAAO,IAAI,CAAC,WAAW,CAAC,uBAAuB,CAAC,SAAS,CAAC,CAAC;IAC5D,CAAC;IAqBD,kCAAO,GAAP,UACC,OAAuB,EACvB,iBAA6C,EAC7C,sBAA+C;QAE/C,IAAM,mBAAmB,sBACxB,QAAQ,EAAE,gBAAQ,CAAC,GAAG,EACtB,MAAM,EAAE,iBAAS,CAAC,OAAO,IACtB,sBAAsB,CACzB,CAAC;QAEF,OAAO,IAAI,CAAC,WAAW,CAAC,OAAO,CAC9B,cAAO,EACP,OAAO,EACP,iBAAiB,EACjB,mBAAmB,CACnB,CAAC;IACH,CAAC;IACF,uBAAC;AAAD,CAAC,AArED,IAqEC;AArEY,4CAAgB;AAuEhB,QAAA,WAAW,GAAG,IAAI,gBAAgB,CAAC,IAAI,CAAC,CAAC"}
|
package/lib/server.d.ts
CHANGED
|
@@ -1 +1,9 @@
|
|
|
1
|
+
export { GraphQLQuery, GraphQLSubscription } from './types';
|
|
2
|
+
import { AmplifyServer } from '@aws-amplify/core/internals/adapter-core';
|
|
3
|
+
import { V6Client } from '@aws-amplify/api-graphql';
|
|
4
|
+
export type { GraphQLResult, GraphQLReturnType, } from '@aws-amplify/api-graphql';
|
|
5
|
+
/**
|
|
6
|
+
* Generates an API client that can work with models or raw GraphQL
|
|
7
|
+
*/
|
|
8
|
+
export declare function generateClient<T extends Record<any, any> = never>(contextSpec: AmplifyServer.ContextSpec): V6Client<T>;
|
|
1
9
|
export { get, put, post, del, head, patch, isCancelError, } from '@aws-amplify/api-rest/server';
|
package/lib/server.js
CHANGED
|
@@ -2,6 +2,22 @@
|
|
|
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
|
+
var internals_1 = require("@aws-amplify/api-graphql/internals");
|
|
6
|
+
var adapter_core_1 = require("@aws-amplify/core/internals/adapter-core");
|
|
7
|
+
var api_graphql_1 = require("@aws-amplify/api-graphql");
|
|
8
|
+
/**
|
|
9
|
+
* Generates an API client that can work with models or raw GraphQL
|
|
10
|
+
*/
|
|
11
|
+
function generateClient(contextSpec) {
|
|
12
|
+
var _a;
|
|
13
|
+
return _a = {},
|
|
14
|
+
_a[api_graphql_1.__amplify] = adapter_core_1.getAmplifyServerContext(contextSpec).amplify,
|
|
15
|
+
_a.graphql = internals_1.graphql,
|
|
16
|
+
_a.cancel = internals_1.cancel,
|
|
17
|
+
_a.isCancelError = internals_1.isCancelError,
|
|
18
|
+
_a;
|
|
19
|
+
}
|
|
20
|
+
exports.generateClient = generateClient;
|
|
5
21
|
var server_1 = require("@aws-amplify/api-rest/server");
|
|
6
22
|
exports.get = server_1.get;
|
|
7
23
|
exports.put = server_1.put;
|
package/lib/server.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"server.js","sourceRoot":"","sources":["../src/server.ts"],"names":[],"mappings":";AAAA,qEAAqE;AACrE,sCAAsC;;
|
|
1
|
+
{"version":3,"file":"server.js","sourceRoot":"","sources":["../src/server.ts"],"names":[],"mappings":";AAAA,qEAAqE;AACrE,sCAAsC;;AAGtC,gEAI4C;AAC5C,yEAGkD;AAElD,wDAA+D;AAO/D;;GAEG;AACH,SAAgB,cAAc,CAC7B,WAAsC;;IAEtC;QACC,GAAC,uBAAS,IAAG,sCAAuB,CAAC,WAAW,CAAC,CAAC,OAAO;QACzD,UAAO,sBAAA;QACP,SAAM,qBAAA;QACN,gBAAa,4BAAA;WACZ;AACH,CAAC;AATD,wCASC;AAED,uDAQsC;AAPrC,uBAAA,GAAG,CAAA;AACH,uBAAA,GAAG,CAAA;AACH,wBAAA,IAAI,CAAA;AACJ,uBAAA,GAAG,CAAA;AACH,wBAAA,IAAI,CAAA;AACJ,yBAAA,KAAK,CAAA;AACL,iCAAA,aAAa,CAAA"}
|
package/lib-esm/API.d.ts
CHANGED
|
@@ -1,42 +1,5 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { graphql as v6graphql, cancel as v6cancel, isCancelError as v6isCancelError } from '@aws-amplify/api-graphql/internals';
|
|
3
|
-
import { Observable } from 'rxjs';
|
|
4
|
-
import { InternalAPIClass } from './internals/InternalAPI';
|
|
1
|
+
import { V6Client } from '@aws-amplify/api-graphql';
|
|
5
2
|
/**
|
|
6
|
-
*
|
|
7
|
-
* Use RestApi or GraphQLAPI to reduce your application bundle size
|
|
8
|
-
* Export Cloud Logic APIs
|
|
3
|
+
* Generates an API client that can work with models or raw GraphQL
|
|
9
4
|
*/
|
|
10
|
-
export declare
|
|
11
|
-
getModuleName(): string;
|
|
12
|
-
/**
|
|
13
|
-
* Executes a GraphQL operation
|
|
14
|
-
*
|
|
15
|
-
* @param options - GraphQL Options
|
|
16
|
-
* @param [additionalHeaders] - headers to merge in after any `graphql_headers` set in the config
|
|
17
|
-
* @returns An Observable if queryType is 'subscription', else a promise of the graphql result from the query.
|
|
18
|
-
*/
|
|
19
|
-
graphql<T>(options: GraphQLOptions, additionalHeaders?: {
|
|
20
|
-
[key: string]: string;
|
|
21
|
-
}): T extends GraphQLQuery<T> ? Promise<GraphQLResult<T>> : T extends GraphQLSubscription<T> ? Observable<{
|
|
22
|
-
provider: AWSAppSyncRealTimeProvider;
|
|
23
|
-
value: GraphQLResult<T>;
|
|
24
|
-
}> : Promise<GraphQLResult<any>> | Observable<object>;
|
|
25
|
-
/**
|
|
26
|
-
* Generates an API client that can work with models or raw GraphQL
|
|
27
|
-
*/
|
|
28
|
-
generateClient<T extends Record<any, any> = never>(): V6Client<T>;
|
|
29
|
-
}
|
|
30
|
-
declare type FilteredKeys<T> = {
|
|
31
|
-
[P in keyof T]: T[P] extends never ? never : P;
|
|
32
|
-
}[keyof T];
|
|
33
|
-
declare type ExcludeNeverFields<O> = {
|
|
34
|
-
[K in FilteredKeys<O>]: O[K];
|
|
35
|
-
};
|
|
36
|
-
declare type V6Client<T extends Record<any, any> = never> = ExcludeNeverFields<{
|
|
37
|
-
graphql: typeof v6graphql;
|
|
38
|
-
cancel: typeof v6cancel;
|
|
39
|
-
isCancelError: typeof v6isCancelError;
|
|
40
|
-
}>;
|
|
41
|
-
export declare const API: APIClass;
|
|
42
|
-
export {};
|
|
5
|
+
export declare function generateClient<T extends Record<any, any> = never>(): V6Client<T>;
|
package/lib-esm/API.js
CHANGED
|
@@ -1,35 +1,18 @@
|
|
|
1
|
-
|
|
1
|
+
// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
|
|
2
|
+
// SPDX-License-Identifier: Apache-2.0
|
|
3
|
+
import { __amplify } from '@aws-amplify/api-graphql';
|
|
2
4
|
import { graphql as v6graphql, cancel as v6cancel, isCancelError as v6isCancelError, } from '@aws-amplify/api-graphql/internals';
|
|
3
|
-
import {
|
|
5
|
+
import { Amplify } from '@aws-amplify/core';
|
|
4
6
|
/**
|
|
5
|
-
*
|
|
6
|
-
* Use RestApi or GraphQLAPI to reduce your application bundle size
|
|
7
|
-
* Export Cloud Logic APIs
|
|
7
|
+
* Generates an API client that can work with models or raw GraphQL
|
|
8
8
|
*/
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
return _super.prototype.graphql.call(this, options, additionalHeaders);
|
|
19
|
-
};
|
|
20
|
-
/**
|
|
21
|
-
* Generates an API client that can work with models or raw GraphQL
|
|
22
|
-
*/
|
|
23
|
-
APIClass.prototype.generateClient = function () {
|
|
24
|
-
var client = {
|
|
25
|
-
graphql: v6graphql,
|
|
26
|
-
cancel: v6cancel,
|
|
27
|
-
isCancelError: v6isCancelError,
|
|
28
|
-
};
|
|
29
|
-
return client;
|
|
30
|
-
};
|
|
31
|
-
return APIClass;
|
|
32
|
-
}(InternalAPIClass));
|
|
33
|
-
export { APIClass };
|
|
34
|
-
export var API = new APIClass(null);
|
|
9
|
+
export function generateClient() {
|
|
10
|
+
var _a;
|
|
11
|
+
return _a = {},
|
|
12
|
+
_a[__amplify] = Amplify,
|
|
13
|
+
_a.graphql = v6graphql,
|
|
14
|
+
_a.cancel = v6cancel,
|
|
15
|
+
_a.isCancelError = v6isCancelError,
|
|
16
|
+
_a;
|
|
17
|
+
}
|
|
35
18
|
//# sourceMappingURL=API.js.map
|
package/lib-esm/API.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"API.js","sourceRoot":"","sources":["../src/API.ts"],"names":[],"mappings":";
|
|
1
|
+
{"version":3,"file":"API.js","sourceRoot":"","sources":["../src/API.ts"],"names":[],"mappings":"AAAA,qEAAqE;AACrE,sCAAsC;AACtC,OAAO,EAAE,SAAS,EAAY,MAAM,0BAA0B,CAAC;AAC/D,OAAO,EACN,OAAO,IAAI,SAAS,EACpB,MAAM,IAAI,QAAQ,EAClB,aAAa,IAAI,eAAe,GAChC,MAAM,oCAAoC,CAAC;AAC5C,OAAO,EAAE,OAAO,EAAE,MAAM,mBAAmB,CAAC;AAE5C;;GAEG;AACH,MAAM,UAAU,cAAc;;IAG7B;QACC,GAAC,SAAS,IAAG,OAAO;QACpB,UAAO,GAAE,SAAS;QAClB,SAAM,GAAE,QAAQ;QAChB,gBAAa,GAAE,eAAe;WAC7B;AACH,CAAC"}
|
package/lib-esm/index.d.ts
CHANGED
|
@@ -1,10 +1,5 @@
|
|
|
1
1
|
export { GraphQLQuery, GraphQLSubscription } from './types';
|
|
2
|
+
export { generateClient } from './API';
|
|
2
3
|
export { GraphQLAuthError } from '@aws-amplify/api-graphql';
|
|
3
4
|
export type { GraphQLResult, GraphQLReturnType, } from '@aws-amplify/api-graphql';
|
|
4
|
-
declare const generateClient: <T extends Record<any, any> = never>() => {
|
|
5
|
-
cancel: typeof import("@aws-amplify/api-graphql/lib-esm/internals").cancel;
|
|
6
|
-
graphql: typeof import("@aws-amplify/api-graphql/lib-esm/internals").graphql;
|
|
7
|
-
isCancelError: typeof import("@aws-amplify/api-graphql/lib-esm/internals").isCancelError;
|
|
8
|
-
};
|
|
9
|
-
export { generateClient };
|
|
10
5
|
export { get, put, post, del, head, patch, isCancelError, } from '@aws-amplify/api-rest';
|
package/lib-esm/index.js
CHANGED
|
@@ -1,8 +1,6 @@
|
|
|
1
1
|
// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
|
|
2
2
|
// SPDX-License-Identifier: Apache-2.0
|
|
3
|
-
|
|
3
|
+
export { generateClient } from './API';
|
|
4
4
|
export { GraphQLAuthError } from '@aws-amplify/api-graphql';
|
|
5
|
-
var generateClient = API.generateClient;
|
|
6
|
-
export { generateClient };
|
|
7
5
|
export { get, put, post, del, head, patch, isCancelError, } from '@aws-amplify/api-rest';
|
|
8
6
|
//# sourceMappingURL=index.js.map
|
package/lib-esm/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,qEAAqE;AACrE,sCAAsC;AAKtC,OAAO,EAAE,
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,qEAAqE;AACrE,sCAAsC;AAKtC,OAAO,EAAE,cAAc,EAAE,MAAM,OAAO,CAAC;AAEvC,OAAO,EAAE,gBAAgB,EAAE,MAAM,0BAA0B,CAAC;AAO5D,OAAO,EACN,GAAG,EACH,GAAG,EACH,IAAI,EACJ,GAAG,EACH,IAAI,EACJ,KAAK,EACL,aAAa,GACb,MAAM,uBAAuB,CAAC"}
|
|
@@ -1,7 +1,15 @@
|
|
|
1
1
|
import { __assign } from "tslib";
|
|
2
2
|
import { InternalGraphQLAPIClass } from '@aws-amplify/api-graphql/internals';
|
|
3
|
-
import { Cache } from '@aws-amplify/core';
|
|
3
|
+
import { Amplify, Cache } from '@aws-amplify/core';
|
|
4
4
|
import { ApiAction, Category, ConsoleLogger as Logger, } from '@aws-amplify/core/internals/utils';
|
|
5
|
+
/**
|
|
6
|
+
* NOTE!
|
|
7
|
+
*
|
|
8
|
+
* This is used only by DataStore.
|
|
9
|
+
*
|
|
10
|
+
* This can probably be pruned and/or removed. Just leaving it as much of the same
|
|
11
|
+
* state as possible for V6 to reduce number of potentially impactful changes to DataStore.
|
|
12
|
+
*/
|
|
5
13
|
var logger = new Logger('API');
|
|
6
14
|
/**
|
|
7
15
|
* @deprecated
|
|
@@ -31,7 +39,7 @@ var InternalAPIClass = /** @class */ (function () {
|
|
|
31
39
|
};
|
|
32
40
|
InternalAPIClass.prototype.graphql = function (options, additionalHeaders, customUserAgentDetails) {
|
|
33
41
|
var apiUserAgentDetails = __assign({ category: Category.API, action: ApiAction.GraphQl }, customUserAgentDetails);
|
|
34
|
-
return this._graphqlApi.graphql(options, additionalHeaders, apiUserAgentDetails);
|
|
42
|
+
return this._graphqlApi.graphql(Amplify, options, additionalHeaders, apiUserAgentDetails);
|
|
35
43
|
};
|
|
36
44
|
return InternalAPIClass;
|
|
37
45
|
}());
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"InternalAPI.js","sourceRoot":"","sources":["../../src/internals/InternalAPI.ts"],"names":[],"mappings":";AAWA,OAAO,EAAE,uBAAuB,EAAE,MAAM,oCAAoC,CAAC;AAC7E,OAAO,EAAE,KAAK,EAAE,MAAM,mBAAmB,CAAC;
|
|
1
|
+
{"version":3,"file":"InternalAPI.js","sourceRoot":"","sources":["../../src/internals/InternalAPI.ts"],"names":[],"mappings":";AAWA,OAAO,EAAE,uBAAuB,EAAE,MAAM,oCAAoC,CAAC;AAC7E,OAAO,EAAE,OAAO,EAAE,KAAK,EAAE,MAAM,mBAAmB,CAAC;AACnD,OAAO,EACN,SAAS,EACT,QAAQ,EACR,aAAa,IAAI,MAAM,GAEvB,MAAM,mCAAmC,CAAC;AAG3C;;;;;;;GAOG;AAEH,IAAM,MAAM,GAAG,IAAI,MAAM,CAAC,KAAK,CAAC,CAAC;AACjC;;;;GAIG;AACH;IAUC;;;OAGG;IACH,0BAAY,OAAO;QANnB,UAAK,GAAG,KAAK,CAAC;QAOb,IAAI,CAAC,QAAQ,GAAG,OAAO,CAAC;QACxB,IAAI,CAAC,WAAW,GAAG,IAAI,uBAAuB,CAAC,OAAO,CAAC,CAAC;QACxD,MAAM,CAAC,KAAK,CAAC,aAAa,EAAE,IAAI,CAAC,QAAQ,CAAC,CAAC;IAC5C,CAAC;IAEM,wCAAa,GAApB;QACC,OAAO,aAAa,CAAC;IACtB,CAAC;IAED;;;OAGG;IACH,kDAAuB,GAAvB,UAAwB,SAA2B;QAClD,OAAO,IAAI,CAAC,WAAW,CAAC,uBAAuB,CAAC,SAAS,CAAC,CAAC;IAC5D,CAAC;IAqBD,kCAAO,GAAP,UACC,OAAuB,EACvB,iBAA6C,EAC7C,sBAA+C;QAE/C,IAAM,mBAAmB,cACxB,QAAQ,EAAE,QAAQ,CAAC,GAAG,EACtB,MAAM,EAAE,SAAS,CAAC,OAAO,IACtB,sBAAsB,CACzB,CAAC;QAEF,OAAO,IAAI,CAAC,WAAW,CAAC,OAAO,CAC9B,OAAO,EACP,OAAO,EACP,iBAAiB,EACjB,mBAAmB,CACnB,CAAC;IACH,CAAC;IACF,uBAAC;AAAD,CAAC,AArED,IAqEC;;AAED,MAAM,CAAC,IAAM,WAAW,GAAG,IAAI,gBAAgB,CAAC,IAAI,CAAC,CAAC"}
|
package/lib-esm/server.d.ts
CHANGED
|
@@ -1 +1,9 @@
|
|
|
1
|
+
export { GraphQLQuery, GraphQLSubscription } from './types';
|
|
2
|
+
import { AmplifyServer } from '@aws-amplify/core/internals/adapter-core';
|
|
3
|
+
import { V6Client } from '@aws-amplify/api-graphql';
|
|
4
|
+
export type { GraphQLResult, GraphQLReturnType, } from '@aws-amplify/api-graphql';
|
|
5
|
+
/**
|
|
6
|
+
* Generates an API client that can work with models or raw GraphQL
|
|
7
|
+
*/
|
|
8
|
+
export declare function generateClient<T extends Record<any, any> = never>(contextSpec: AmplifyServer.ContextSpec): V6Client<T>;
|
|
1
9
|
export { get, put, post, del, head, patch, isCancelError, } from '@aws-amplify/api-rest/server';
|
package/lib-esm/server.js
CHANGED
|
@@ -1,4 +1,19 @@
|
|
|
1
1
|
// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
|
|
2
2
|
// SPDX-License-Identifier: Apache-2.0
|
|
3
|
+
import { graphql, cancel, isCancelError, } from '@aws-amplify/api-graphql/internals';
|
|
4
|
+
import { getAmplifyServerContext, } from '@aws-amplify/core/internals/adapter-core';
|
|
5
|
+
import { __amplify } from '@aws-amplify/api-graphql';
|
|
6
|
+
/**
|
|
7
|
+
* Generates an API client that can work with models or raw GraphQL
|
|
8
|
+
*/
|
|
9
|
+
export function generateClient(contextSpec) {
|
|
10
|
+
var _a;
|
|
11
|
+
return _a = {},
|
|
12
|
+
_a[__amplify] = getAmplifyServerContext(contextSpec).amplify,
|
|
13
|
+
_a.graphql = graphql,
|
|
14
|
+
_a.cancel = cancel,
|
|
15
|
+
_a.isCancelError = isCancelError,
|
|
16
|
+
_a;
|
|
17
|
+
}
|
|
3
18
|
export { get, put, post, del, head, patch, isCancelError, } from '@aws-amplify/api-rest/server';
|
|
4
19
|
//# sourceMappingURL=server.js.map
|
package/lib-esm/server.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"server.js","sourceRoot":"","sources":["../src/server.ts"],"names":[],"mappings":"AAAA,qEAAqE;AACrE,sCAAsC;
|
|
1
|
+
{"version":3,"file":"server.js","sourceRoot":"","sources":["../src/server.ts"],"names":[],"mappings":"AAAA,qEAAqE;AACrE,sCAAsC;AAGtC,OAAO,EACN,OAAO,EACP,MAAM,EACN,aAAa,GACb,MAAM,oCAAoC,CAAC;AAC5C,OAAO,EAEN,uBAAuB,GACvB,MAAM,0CAA0C,CAAC;AAElD,OAAO,EAAE,SAAS,EAAY,MAAM,0BAA0B,CAAC;AAO/D;;GAEG;AACH,MAAM,UAAU,cAAc,CAC7B,WAAsC;;IAEtC;QACC,GAAC,SAAS,IAAG,uBAAuB,CAAC,WAAW,CAAC,CAAC,OAAO;QACzD,UAAO,UAAA;QACP,SAAM,SAAA;QACN,gBAAa,gBAAA;WACZ;AACH,CAAC;AAED,OAAO,EACN,GAAG,EACH,GAAG,EACH,IAAI,EACJ,GAAG,EACH,IAAI,EACJ,KAAK,EACL,aAAa,GACb,MAAM,8BAA8B,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@aws-amplify/api",
|
|
3
|
-
"version": "6.0.1-console-preview.
|
|
3
|
+
"version": "6.0.1-console-preview.5f040a2.0+5f040a2",
|
|
4
4
|
"description": "Api category of aws-amplify",
|
|
5
5
|
"main": "./lib/index.js",
|
|
6
6
|
"module": "./lib-esm/index.js",
|
|
@@ -24,7 +24,6 @@
|
|
|
24
24
|
},
|
|
25
25
|
"scripts": {
|
|
26
26
|
"test": "npm run lint && jest -w 1 --coverage",
|
|
27
|
-
"test:size": "size-limit",
|
|
28
27
|
"build-with-test": "npm test && npm run build",
|
|
29
28
|
"build:cjs": "node ./build es5 && webpack && webpack --config ./webpack.config.dev.js",
|
|
30
29
|
"build:esm": "node ./build es6",
|
|
@@ -59,18 +58,10 @@
|
|
|
59
58
|
"server"
|
|
60
59
|
],
|
|
61
60
|
"dependencies": {
|
|
62
|
-
"@aws-amplify/api-graphql": "4.0.1-console-preview.
|
|
63
|
-
"@aws-amplify/api-rest": "4.0.1-console-preview.
|
|
61
|
+
"@aws-amplify/api-graphql": "4.0.1-console-preview.5f040a2.0+5f040a2",
|
|
62
|
+
"@aws-amplify/api-rest": "4.0.1-console-preview.5f040a2.0+5f040a2",
|
|
64
63
|
"tslib": "^2.6.1"
|
|
65
64
|
},
|
|
66
|
-
"size-limit": [
|
|
67
|
-
{
|
|
68
|
-
"name": "API (top-level class)",
|
|
69
|
-
"path": "./lib-esm/index.js",
|
|
70
|
-
"import": "{ Amplify, API }",
|
|
71
|
-
"limit": "93.82 kB"
|
|
72
|
-
}
|
|
73
|
-
],
|
|
74
65
|
"jest": {
|
|
75
66
|
"globals": {
|
|
76
67
|
"ts-jest": {
|
|
@@ -115,5 +106,5 @@
|
|
|
115
106
|
"lib-esm"
|
|
116
107
|
]
|
|
117
108
|
},
|
|
118
|
-
"gitHead": "
|
|
109
|
+
"gitHead": "5f040a29ecebf29374ae9b58abc661f45143ac4f"
|
|
119
110
|
}
|
package/src/API.ts
CHANGED
|
@@ -1,81 +1,23 @@
|
|
|
1
1
|
// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
|
|
2
2
|
// SPDX-License-Identifier: Apache-2.0
|
|
3
|
-
import {
|
|
4
|
-
AWSAppSyncRealTimeProvider,
|
|
5
|
-
GraphQLOptions,
|
|
6
|
-
GraphQLResult,
|
|
7
|
-
GraphQLQuery,
|
|
8
|
-
GraphQLSubscription,
|
|
9
|
-
} from '@aws-amplify/api-graphql';
|
|
3
|
+
import { __amplify, V6Client } from '@aws-amplify/api-graphql';
|
|
10
4
|
import {
|
|
11
5
|
graphql as v6graphql,
|
|
12
6
|
cancel as v6cancel,
|
|
13
7
|
isCancelError as v6isCancelError,
|
|
14
8
|
} from '@aws-amplify/api-graphql/internals';
|
|
15
|
-
import {
|
|
16
|
-
import { InternalAPIClass } from './internals/InternalAPI';
|
|
9
|
+
import { Amplify } from '@aws-amplify/core';
|
|
17
10
|
|
|
18
11
|
/**
|
|
19
|
-
*
|
|
20
|
-
* Use RestApi or GraphQLAPI to reduce your application bundle size
|
|
21
|
-
* Export Cloud Logic APIs
|
|
12
|
+
* Generates an API client that can work with models or raw GraphQL
|
|
22
13
|
*/
|
|
23
|
-
export
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
* @param [additionalHeaders] - headers to merge in after any `graphql_headers` set in the config
|
|
33
|
-
* @returns An Observable if queryType is 'subscription', else a promise of the graphql result from the query.
|
|
34
|
-
*/
|
|
35
|
-
graphql<T>(
|
|
36
|
-
options: GraphQLOptions,
|
|
37
|
-
additionalHeaders?: { [key: string]: string }
|
|
38
|
-
): T extends GraphQLQuery<T>
|
|
39
|
-
? Promise<GraphQLResult<T>>
|
|
40
|
-
: T extends GraphQLSubscription<T>
|
|
41
|
-
? Observable<{
|
|
42
|
-
provider: AWSAppSyncRealTimeProvider;
|
|
43
|
-
value: GraphQLResult<T>;
|
|
44
|
-
}>
|
|
45
|
-
: Promise<GraphQLResult<any>> | Observable<object>;
|
|
46
|
-
graphql<T = any>(
|
|
47
|
-
options: GraphQLOptions,
|
|
48
|
-
additionalHeaders?: { [key: string]: string }
|
|
49
|
-
): Promise<GraphQLResult<any>> | Observable<object> {
|
|
50
|
-
return super.graphql(options, additionalHeaders);
|
|
51
|
-
}
|
|
52
|
-
|
|
53
|
-
/**
|
|
54
|
-
* Generates an API client that can work with models or raw GraphQL
|
|
55
|
-
*/
|
|
56
|
-
generateClient<T extends Record<any, any> = never>(): V6Client<T> {
|
|
57
|
-
const client: V6Client<any> = {
|
|
58
|
-
graphql: v6graphql,
|
|
59
|
-
cancel: v6cancel,
|
|
60
|
-
isCancelError: v6isCancelError,
|
|
61
|
-
};
|
|
62
|
-
|
|
63
|
-
return client as V6Client<T>;
|
|
64
|
-
}
|
|
14
|
+
export function generateClient<
|
|
15
|
+
T extends Record<any, any> = never
|
|
16
|
+
>(): V6Client<T> {
|
|
17
|
+
return {
|
|
18
|
+
[__amplify]: Amplify,
|
|
19
|
+
graphql: v6graphql,
|
|
20
|
+
cancel: v6cancel,
|
|
21
|
+
isCancelError: v6isCancelError,
|
|
22
|
+
};
|
|
65
23
|
}
|
|
66
|
-
|
|
67
|
-
type FilteredKeys<T> = {
|
|
68
|
-
[P in keyof T]: T[P] extends never ? never : P;
|
|
69
|
-
}[keyof T];
|
|
70
|
-
type ExcludeNeverFields<O> = {
|
|
71
|
-
[K in FilteredKeys<O>]: O[K];
|
|
72
|
-
};
|
|
73
|
-
|
|
74
|
-
// If no T is passed, ExcludeNeverFields removes "models" from the client
|
|
75
|
-
declare type V6Client<T extends Record<any, any> = never> = ExcludeNeverFields<{
|
|
76
|
-
graphql: typeof v6graphql;
|
|
77
|
-
cancel: typeof v6cancel;
|
|
78
|
-
isCancelError: typeof v6isCancelError;
|
|
79
|
-
}>;
|
|
80
|
-
|
|
81
|
-
export const API = new APIClass(null);
|
package/src/index.ts
CHANGED
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
// TODO(v6): revisit exports
|
|
5
5
|
|
|
6
6
|
export { GraphQLQuery, GraphQLSubscription } from './types';
|
|
7
|
-
|
|
7
|
+
export { generateClient } from './API';
|
|
8
8
|
|
|
9
9
|
export { GraphQLAuthError } from '@aws-amplify/api-graphql';
|
|
10
10
|
|
|
@@ -13,10 +13,6 @@ export type {
|
|
|
13
13
|
GraphQLReturnType,
|
|
14
14
|
} from '@aws-amplify/api-graphql';
|
|
15
15
|
|
|
16
|
-
const generateClient = API.generateClient;
|
|
17
|
-
|
|
18
|
-
export { generateClient };
|
|
19
|
-
|
|
20
16
|
export {
|
|
21
17
|
get,
|
|
22
18
|
put,
|
|
@@ -10,7 +10,7 @@ import {
|
|
|
10
10
|
GraphQLSubscription,
|
|
11
11
|
} from '@aws-amplify/api-graphql';
|
|
12
12
|
import { InternalGraphQLAPIClass } from '@aws-amplify/api-graphql/internals';
|
|
13
|
-
import { Cache } from '@aws-amplify/core';
|
|
13
|
+
import { Amplify, Cache } from '@aws-amplify/core';
|
|
14
14
|
import {
|
|
15
15
|
ApiAction,
|
|
16
16
|
Category,
|
|
@@ -19,6 +19,15 @@ import {
|
|
|
19
19
|
} from '@aws-amplify/core/internals/utils';
|
|
20
20
|
import { Observable } from 'rxjs';
|
|
21
21
|
|
|
22
|
+
/**
|
|
23
|
+
* NOTE!
|
|
24
|
+
*
|
|
25
|
+
* This is used only by DataStore.
|
|
26
|
+
*
|
|
27
|
+
* This can probably be pruned and/or removed. Just leaving it as much of the same
|
|
28
|
+
* state as possible for V6 to reduce number of potentially impactful changes to DataStore.
|
|
29
|
+
*/
|
|
30
|
+
|
|
22
31
|
const logger = new Logger('API');
|
|
23
32
|
/**
|
|
24
33
|
* @deprecated
|
|
@@ -88,6 +97,7 @@ export class InternalAPIClass {
|
|
|
88
97
|
};
|
|
89
98
|
|
|
90
99
|
return this._graphqlApi.graphql(
|
|
100
|
+
Amplify,
|
|
91
101
|
options,
|
|
92
102
|
additionalHeaders,
|
|
93
103
|
apiUserAgentDetails
|
package/src/server.ts
CHANGED
|
@@ -1,6 +1,38 @@
|
|
|
1
1
|
// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
|
|
2
2
|
// SPDX-License-Identifier: Apache-2.0
|
|
3
3
|
|
|
4
|
+
export { GraphQLQuery, GraphQLSubscription } from './types';
|
|
5
|
+
import {
|
|
6
|
+
graphql,
|
|
7
|
+
cancel,
|
|
8
|
+
isCancelError,
|
|
9
|
+
} from '@aws-amplify/api-graphql/internals';
|
|
10
|
+
import {
|
|
11
|
+
AmplifyServer,
|
|
12
|
+
getAmplifyServerContext,
|
|
13
|
+
} from '@aws-amplify/core/internals/adapter-core';
|
|
14
|
+
|
|
15
|
+
import { __amplify, V6Client } from '@aws-amplify/api-graphql';
|
|
16
|
+
|
|
17
|
+
export type {
|
|
18
|
+
GraphQLResult,
|
|
19
|
+
GraphQLReturnType,
|
|
20
|
+
} from '@aws-amplify/api-graphql';
|
|
21
|
+
|
|
22
|
+
/**
|
|
23
|
+
* Generates an API client that can work with models or raw GraphQL
|
|
24
|
+
*/
|
|
25
|
+
export function generateClient<T extends Record<any, any> = never>(
|
|
26
|
+
contextSpec: AmplifyServer.ContextSpec
|
|
27
|
+
): V6Client<T> {
|
|
28
|
+
return {
|
|
29
|
+
[__amplify]: getAmplifyServerContext(contextSpec).amplify,
|
|
30
|
+
graphql,
|
|
31
|
+
cancel,
|
|
32
|
+
isCancelError,
|
|
33
|
+
};
|
|
34
|
+
}
|
|
35
|
+
|
|
4
36
|
export {
|
|
5
37
|
get,
|
|
6
38
|
put,
|