@aws-amplify/api 6.0.2-unstable.ff85fa5.0 → 6.0.2
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/dist/cjs/API.js +5 -10
- package/dist/cjs/API.js.map +1 -1
- package/dist/cjs/internals/InternalAPI.js +5 -8
- package/dist/cjs/internals/InternalAPI.js.map +1 -1
- package/dist/cjs/internals/index.js +2 -2
- package/dist/cjs/internals/index.js.map +1 -1
- package/dist/esm/API.d.ts +2 -2
- package/dist/esm/API.mjs +6 -11
- package/dist/esm/API.mjs.map +1 -1
- package/dist/esm/index.d.ts +1 -1
- package/dist/esm/internals/InternalAPI.d.ts +2 -8
- package/dist/esm/internals/InternalAPI.mjs +5 -8
- package/dist/esm/internals/InternalAPI.mjs.map +1 -1
- package/dist/esm/internals/index.d.ts +1 -1
- package/dist/esm/internals/index.mjs +1 -1
- package/dist/esm/types/index.d.ts +1 -1
- package/package.json +5 -5
- package/src/API.ts +9 -15
- package/src/index.ts +1 -3
- package/src/internals/InternalAPI.ts +4 -12
- package/src/internals/index.ts +1 -1
- package/src/types/index.ts +1 -0
- package/dist/cjs/internals/generateServerClient.js +0 -29
- package/dist/cjs/internals/generateServerClient.js.map +0 -1
- package/dist/esm/internals/generateServerClient.d.ts +0 -11
- package/dist/esm/internals/generateServerClient.mjs +0 -27
- package/dist/esm/internals/generateServerClient.mjs.map +0 -1
- package/src/internals/generateServerClient.ts +0 -38
package/dist/cjs/API.js
CHANGED
|
@@ -2,21 +2,16 @@
|
|
|
2
2
|
|
|
3
3
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
4
4
|
exports.generateClient = void 0;
|
|
5
|
-
// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
|
|
6
|
-
// SPDX-License-Identifier: Apache-2.0
|
|
7
|
-
const api_graphql_1 = require("@aws-amplify/api-graphql");
|
|
8
5
|
const internals_1 = require("@aws-amplify/api-graphql/internals");
|
|
9
6
|
const core_1 = require("@aws-amplify/core");
|
|
10
7
|
/**
|
|
11
8
|
* Generates an API client that can work with models or raw GraphQL
|
|
12
9
|
*/
|
|
13
|
-
function generateClient() {
|
|
14
|
-
return {
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
isCancelError: internals_1.isCancelError,
|
|
19
|
-
};
|
|
10
|
+
function generateClient(options = {}) {
|
|
11
|
+
return (0, internals_1.generateClient)({
|
|
12
|
+
...options,
|
|
13
|
+
amplify: core_1.Amplify,
|
|
14
|
+
});
|
|
20
15
|
}
|
|
21
16
|
exports.generateClient = generateClient;
|
|
22
17
|
//# sourceMappingURL=API.js.map
|
package/dist/cjs/API.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"API.js","sources":["../../src/API.ts"],"sourcesContent":["\"use strict\";\nObject.defineProperty(exports, \"__esModule\", { value: true });\nexports.generateClient = void 0;\
|
|
1
|
+
{"version":3,"file":"API.js","sources":["../../src/API.ts"],"sourcesContent":["\"use strict\";\nObject.defineProperty(exports, \"__esModule\", { value: true });\nexports.generateClient = void 0;\nconst internals_1 = require(\"@aws-amplify/api-graphql/internals\");\nconst core_1 = require(\"@aws-amplify/core\");\n/**\n * Generates an API client that can work with models or raw GraphQL\n */\nfunction generateClient(options = {}) {\n return (0, internals_1.generateClient)({\n ...options,\n amplify: core_1.Amplify,\n });\n}\nexports.generateClient = generateClient;\n"],"names":[],"mappings":";;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,WAAW,GAAG,OAAO,CAAC,oCAAoC,CAAC,CAAC;AAClE,MAAM,MAAM,GAAG,OAAO,CAAC,mBAAmB,CAAC,CAAC;AAC5C;AACA;AACA;AACA,SAAS,cAAc,CAAC,OAAO,GAAG,EAAE,EAAE;AACtC,IAAI,OAAO,IAAI,WAAW,CAAC,cAAc,EAAE;AAC3C,QAAQ,GAAG,OAAO;AAClB,QAAQ,OAAO,EAAE,MAAM,CAAC,OAAO;AAC/B,KAAK,CAAC,CAAC;AACP,CAAC;AACD,OAAO,CAAC,cAAc,GAAG,cAAc;;"}
|
|
@@ -13,7 +13,7 @@ const utils_1 = require("@aws-amplify/core/internals/utils");
|
|
|
13
13
|
* This can probably be pruned and/or removed. Just leaving it as much of the same
|
|
14
14
|
* state as possible for V6 to reduce number of potentially impactful changes to DataStore.
|
|
15
15
|
*/
|
|
16
|
-
|
|
16
|
+
new core_1.ConsoleLogger('API');
|
|
17
17
|
/**
|
|
18
18
|
* @deprecated
|
|
19
19
|
* Use RestApi or GraphQLAPI to reduce your application bundle size
|
|
@@ -21,14 +21,11 @@ const logger = new core_1.ConsoleLogger('API');
|
|
|
21
21
|
*/
|
|
22
22
|
class InternalAPIClass {
|
|
23
23
|
/**
|
|
24
|
-
* Initialize API
|
|
25
|
-
* @param {Object} options - Configuration object for API
|
|
24
|
+
* Initialize API
|
|
26
25
|
*/
|
|
27
|
-
constructor(
|
|
26
|
+
constructor() {
|
|
28
27
|
this.Cache = core_1.Cache;
|
|
29
|
-
this.
|
|
30
|
-
this._graphqlApi = new internals_1.InternalGraphQLAPIClass(options);
|
|
31
|
-
logger.debug('API Options', this._options);
|
|
28
|
+
this._graphqlApi = new internals_1.InternalGraphQLAPIClass();
|
|
32
29
|
}
|
|
33
30
|
getModuleName() {
|
|
34
31
|
return 'InternalAPI';
|
|
@@ -50,5 +47,5 @@ class InternalAPIClass {
|
|
|
50
47
|
}
|
|
51
48
|
}
|
|
52
49
|
exports.InternalAPIClass = InternalAPIClass;
|
|
53
|
-
exports.InternalAPI = new InternalAPIClass(
|
|
50
|
+
exports.InternalAPI = new InternalAPIClass();
|
|
54
51
|
//# sourceMappingURL=InternalAPI.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"InternalAPI.js","sources":["../../../src/internals/InternalAPI.ts"],"sourcesContent":["\"use strict\";\nObject.defineProperty(exports, \"__esModule\", { value: true });\nexports.InternalAPI = exports.InternalAPIClass = void 0;\nconst internals_1 = require(\"@aws-amplify/api-graphql/internals\");\nconst core_1 = require(\"@aws-amplify/core\");\nconst utils_1 = require(\"@aws-amplify/core/internals/utils\");\n/**\n * NOTE!\n *\n * This is used only by DataStore.\n *\n * This can probably be pruned and/or removed. Just leaving it as much of the same\n * state as possible for V6 to reduce number of potentially impactful changes to DataStore.\n */\nconst logger = new core_1.ConsoleLogger('API');\n/**\n * @deprecated\n * Use RestApi or GraphQLAPI to reduce your application bundle size\n * Export Cloud Logic APIs\n */\nclass InternalAPIClass {\n /**\n * Initialize API
|
|
1
|
+
{"version":3,"file":"InternalAPI.js","sources":["../../../src/internals/InternalAPI.ts"],"sourcesContent":["\"use strict\";\nObject.defineProperty(exports, \"__esModule\", { value: true });\nexports.InternalAPI = exports.InternalAPIClass = void 0;\nconst internals_1 = require(\"@aws-amplify/api-graphql/internals\");\nconst core_1 = require(\"@aws-amplify/core\");\nconst utils_1 = require(\"@aws-amplify/core/internals/utils\");\n/**\n * NOTE!\n *\n * This is used only by DataStore.\n *\n * This can probably be pruned and/or removed. Just leaving it as much of the same\n * state as possible for V6 to reduce number of potentially impactful changes to DataStore.\n */\nconst logger = new core_1.ConsoleLogger('API');\n/**\n * @deprecated\n * Use RestApi or GraphQLAPI to reduce your application bundle size\n * Export Cloud Logic APIs\n */\nclass InternalAPIClass {\n /**\n * Initialize API\n */\n constructor() {\n this.Cache = core_1.Cache;\n this._graphqlApi = new internals_1.InternalGraphQLAPIClass();\n }\n getModuleName() {\n return 'InternalAPI';\n }\n /**\n * to get the operation type\n * @param operation\n */\n getGraphqlOperationType(operation) {\n return this._graphqlApi.getGraphqlOperationType(operation);\n }\n graphql(options, additionalHeaders, customUserAgentDetails) {\n const apiUserAgentDetails = {\n category: utils_1.Category.API,\n action: utils_1.ApiAction.GraphQl,\n ...customUserAgentDetails,\n };\n return this._graphqlApi.graphql(core_1.Amplify, options, additionalHeaders, apiUserAgentDetails);\n }\n}\nexports.InternalAPIClass = InternalAPIClass;\nexports.InternalAPI = new InternalAPIClass();\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,gBAAgB,GAAG,KAAK,CAAC,CAAC;AACxD,MAAM,WAAW,GAAG,OAAO,CAAC,oCAAoC,CAAC,CAAC;AAClE,MAAM,MAAM,GAAG,OAAO,CAAC,mBAAmB,CAAC,CAAC;AAC5C,MAAM,OAAO,GAAG,OAAO,CAAC,mCAAmC,CAAC,CAAC;AAC7D;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACe,IAAI,MAAM,CAAC,aAAa,CAAC,KAAK,EAAE;AAC/C;AACA;AACA;AACA;AACA;AACA,MAAM,gBAAgB,CAAC;AACvB;AACA;AACA;AACA,IAAI,WAAW,GAAG;AAClB,QAAQ,IAAI,CAAC,KAAK,GAAG,MAAM,CAAC,KAAK,CAAC;AAClC,QAAQ,IAAI,CAAC,WAAW,GAAG,IAAI,WAAW,CAAC,uBAAuB,EAAE,CAAC;AACrE,KAAK;AACL,IAAI,aAAa,GAAG;AACpB,QAAQ,OAAO,aAAa,CAAC;AAC7B,KAAK;AACL;AACA;AACA;AACA;AACA,IAAI,uBAAuB,CAAC,SAAS,EAAE;AACvC,QAAQ,OAAO,IAAI,CAAC,WAAW,CAAC,uBAAuB,CAAC,SAAS,CAAC,CAAC;AACnE,KAAK;AACL,IAAI,OAAO,CAAC,OAAO,EAAE,iBAAiB,EAAE,sBAAsB,EAAE;AAChE,QAAQ,MAAM,mBAAmB,GAAG;AACpC,YAAY,QAAQ,EAAE,OAAO,CAAC,QAAQ,CAAC,GAAG;AAC1C,YAAY,MAAM,EAAE,OAAO,CAAC,SAAS,CAAC,OAAO;AAC7C,YAAY,GAAG,sBAAsB;AACrC,SAAS,CAAC;AACV,QAAQ,OAAO,IAAI,CAAC,WAAW,CAAC,OAAO,CAAC,MAAM,CAAC,OAAO,EAAE,OAAO,EAAE,iBAAiB,EAAE,mBAAmB,CAAC,CAAC;AACzG,KAAK;AACL,CAAC;AACD,OAAO,CAAC,gBAAgB,GAAG,gBAAgB,CAAC;AAC5C,OAAO,CAAC,WAAW,GAAG,IAAI,gBAAgB,EAAE;;"}
|
|
@@ -7,6 +7,6 @@ exports.generateServerClient = exports.InternalAPIClass = exports.InternalAPI =
|
|
|
7
7
|
var InternalAPI_1 = require("./InternalAPI");
|
|
8
8
|
Object.defineProperty(exports, "InternalAPI", { enumerable: true, get: function () { return InternalAPI_1.InternalAPI; } });
|
|
9
9
|
Object.defineProperty(exports, "InternalAPIClass", { enumerable: true, get: function () { return InternalAPI_1.InternalAPIClass; } });
|
|
10
|
-
var
|
|
11
|
-
Object.defineProperty(exports, "generateServerClient", { enumerable: true, get: function () { return
|
|
10
|
+
var server_1 = require("@aws-amplify/api-graphql/internals/server");
|
|
11
|
+
Object.defineProperty(exports, "generateServerClient", { enumerable: true, get: function () { return server_1.generateClient; } });
|
|
12
12
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sources":["../../../src/internals/index.ts"],"sourcesContent":["\"use strict\";\nObject.defineProperty(exports, \"__esModule\", { value: true });\nexports.generateServerClient = exports.InternalAPIClass = exports.InternalAPI = void 0;\n// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\nvar InternalAPI_1 = require(\"./InternalAPI\");\nObject.defineProperty(exports, \"InternalAPI\", { enumerable: true, get: function () { return InternalAPI_1.InternalAPI; } });\nObject.defineProperty(exports, \"InternalAPIClass\", { enumerable: true, get: function () { return InternalAPI_1.InternalAPIClass; } });\nvar
|
|
1
|
+
{"version":3,"file":"index.js","sources":["../../../src/internals/index.ts"],"sourcesContent":["\"use strict\";\nObject.defineProperty(exports, \"__esModule\", { value: true });\nexports.generateServerClient = exports.InternalAPIClass = exports.InternalAPI = void 0;\n// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\nvar InternalAPI_1 = require(\"./InternalAPI\");\nObject.defineProperty(exports, \"InternalAPI\", { enumerable: true, get: function () { return InternalAPI_1.InternalAPI; } });\nObject.defineProperty(exports, \"InternalAPIClass\", { enumerable: true, get: function () { return InternalAPI_1.InternalAPIClass; } });\nvar server_1 = require(\"@aws-amplify/api-graphql/internals/server\");\nObject.defineProperty(exports, \"generateServerClient\", { enumerable: true, get: function () { return server_1.generateClient; } });\n"],"names":[],"mappings":";;AACA,MAAM,CAAC,cAAc,CAAC,OAAO,EAAE,YAAY,EAAE,EAAE,KAAK,EAAE,IAAI,EAAE,CAAC,CAAC;AAC9D,OAAO,CAAC,oBAAoB,GAAG,OAAO,CAAC,gBAAgB,GAAG,OAAO,CAAC,WAAW,GAAG,KAAK,CAAC,CAAC;AACvF;AACA;AACA,IAAI,aAAa,GAAG,OAAO,CAAC,eAAe,CAAC,CAAC;AAC7C,MAAM,CAAC,cAAc,CAAC,OAAO,EAAE,aAAa,EAAE,EAAE,UAAU,EAAE,IAAI,EAAE,GAAG,EAAE,YAAY,EAAE,OAAO,aAAa,CAAC,WAAW,CAAC,EAAE,EAAE,CAAC,CAAC;AAC5H,MAAM,CAAC,cAAc,CAAC,OAAO,EAAE,kBAAkB,EAAE,EAAE,UAAU,EAAE,IAAI,EAAE,GAAG,EAAE,YAAY,EAAE,OAAO,aAAa,CAAC,gBAAgB,CAAC,EAAE,EAAE,CAAC,CAAC;AACtI,IAAI,QAAQ,GAAG,OAAO,CAAC,2CAA2C,CAAC,CAAC;AACpE,MAAM,CAAC,cAAc,CAAC,OAAO,EAAE,sBAAsB,EAAE,EAAE,UAAU,EAAE,IAAI,EAAE,GAAG,EAAE,YAAY,EAAE,OAAO,QAAQ,CAAC,cAAc,CAAC,EAAE,EAAE,CAAC;;"}
|
package/dist/esm/API.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { V6Client } from '@aws-amplify/api-graphql';
|
|
1
|
+
import { V6Client, CommonPublicClientOptions } from '@aws-amplify/api-graphql';
|
|
2
2
|
/**
|
|
3
3
|
* Generates an API client that can work with models or raw GraphQL
|
|
4
4
|
*/
|
|
5
|
-
export declare function generateClient<T extends Record<any, any> = never>(): V6Client<T>;
|
|
5
|
+
export declare function generateClient<T extends Record<any, any> = never>(options?: CommonPublicClientOptions): V6Client<T>;
|
package/dist/esm/API.mjs
CHANGED
|
@@ -1,19 +1,14 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { graphql, cancel, isCancelError } from '@aws-amplify/api-graphql/internals';
|
|
1
|
+
import { generateClient as generateClient$1 } from '@aws-amplify/api-graphql/internals';
|
|
3
2
|
import { Amplify } from '@aws-amplify/core';
|
|
4
3
|
|
|
5
|
-
// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
|
|
6
|
-
// SPDX-License-Identifier: Apache-2.0
|
|
7
4
|
/**
|
|
8
5
|
* Generates an API client that can work with models or raw GraphQL
|
|
9
6
|
*/
|
|
10
|
-
function generateClient() {
|
|
11
|
-
return {
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
isCancelError: isCancelError,
|
|
16
|
-
};
|
|
7
|
+
function generateClient(options = {}) {
|
|
8
|
+
return generateClient$1({
|
|
9
|
+
...options,
|
|
10
|
+
amplify: Amplify,
|
|
11
|
+
});
|
|
17
12
|
}
|
|
18
13
|
|
|
19
14
|
export { generateClient };
|
package/dist/esm/API.mjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"API.mjs","sources":["../../src/API.ts"],"sourcesContent":["
|
|
1
|
+
{"version":3,"file":"API.mjs","sources":["../../src/API.ts"],"sourcesContent":["import { generateClient as internalGenerateClient } from '@aws-amplify/api-graphql/internals';\nimport { Amplify } from '@aws-amplify/core';\n/**\n * Generates an API client that can work with models or raw GraphQL\n */\nexport function generateClient(options = {}) {\n return internalGenerateClient({\n ...options,\n amplify: Amplify,\n });\n}\n"],"names":["internalGenerateClient"],"mappings":";;;AAEA;AACA;AACA;AACO,SAAS,cAAc,CAAC,OAAO,GAAG,EAAE,EAAE;AAC7C,IAAI,OAAOA,gBAAsB,CAAC;AAClC,QAAQ,GAAG,OAAO;AAClB,QAAQ,OAAO,EAAE,OAAO;AACxB,KAAK,CAAC,CAAC;AACP;;;;"}
|
package/dist/esm/index.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export { GraphQLQuery, GraphQLSubscription } from './types';
|
|
1
|
+
export { GraphQLQuery, GraphQLSubscription, SelectionSet } from './types';
|
|
2
2
|
export { generateClient } from './API';
|
|
3
3
|
export { GraphQLAuthError, ConnectionState } from '@aws-amplify/api-graphql';
|
|
4
4
|
export type { GraphQLResult, GraphQLReturnType, CONNECTION_STATE_CHANGE, } from '@aws-amplify/api-graphql';
|
|
@@ -7,18 +7,12 @@ import { Observable } from 'rxjs';
|
|
|
7
7
|
* Export Cloud Logic APIs
|
|
8
8
|
*/
|
|
9
9
|
export declare class InternalAPIClass {
|
|
10
|
-
/**
|
|
11
|
-
* Initialize API with AWS configuration
|
|
12
|
-
* @param {Object} options - Configuration object for API
|
|
13
|
-
*/
|
|
14
|
-
private _options;
|
|
15
10
|
private _graphqlApi;
|
|
16
11
|
Cache: import("@aws-amplify/core/dist/esm/Cache/StorageCache").StorageCache;
|
|
17
12
|
/**
|
|
18
|
-
* Initialize API
|
|
19
|
-
* @param {Object} options - Configuration object for API
|
|
13
|
+
* Initialize API
|
|
20
14
|
*/
|
|
21
|
-
constructor(
|
|
15
|
+
constructor();
|
|
22
16
|
getModuleName(): string;
|
|
23
17
|
/**
|
|
24
18
|
* to get the operation type
|
|
@@ -10,7 +10,7 @@ import { Category, ApiAction } from '@aws-amplify/core/internals/utils';
|
|
|
10
10
|
* This can probably be pruned and/or removed. Just leaving it as much of the same
|
|
11
11
|
* state as possible for V6 to reduce number of potentially impactful changes to DataStore.
|
|
12
12
|
*/
|
|
13
|
-
|
|
13
|
+
new ConsoleLogger('API');
|
|
14
14
|
/**
|
|
15
15
|
* @deprecated
|
|
16
16
|
* Use RestApi or GraphQLAPI to reduce your application bundle size
|
|
@@ -18,14 +18,11 @@ const logger = new ConsoleLogger('API');
|
|
|
18
18
|
*/
|
|
19
19
|
class InternalAPIClass {
|
|
20
20
|
/**
|
|
21
|
-
* Initialize API
|
|
22
|
-
* @param {Object} options - Configuration object for API
|
|
21
|
+
* Initialize API
|
|
23
22
|
*/
|
|
24
|
-
constructor(
|
|
23
|
+
constructor() {
|
|
25
24
|
this.Cache = Cache;
|
|
26
|
-
this.
|
|
27
|
-
this._graphqlApi = new InternalGraphQLAPIClass(options);
|
|
28
|
-
logger.debug('API Options', this._options);
|
|
25
|
+
this._graphqlApi = new InternalGraphQLAPIClass();
|
|
29
26
|
}
|
|
30
27
|
getModuleName() {
|
|
31
28
|
return 'InternalAPI';
|
|
@@ -46,7 +43,7 @@ class InternalAPIClass {
|
|
|
46
43
|
return this._graphqlApi.graphql(Amplify, options, additionalHeaders, apiUserAgentDetails);
|
|
47
44
|
}
|
|
48
45
|
}
|
|
49
|
-
const InternalAPI = new InternalAPIClass(
|
|
46
|
+
const InternalAPI = new InternalAPIClass();
|
|
50
47
|
|
|
51
48
|
export { InternalAPI, InternalAPIClass };
|
|
52
49
|
//# sourceMappingURL=InternalAPI.mjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"InternalAPI.mjs","sources":["../../../src/internals/InternalAPI.ts"],"sourcesContent":["import { InternalGraphQLAPIClass } from '@aws-amplify/api-graphql/internals';\nimport { Amplify, Cache, ConsoleLogger } from '@aws-amplify/core';\nimport { ApiAction, Category, } from '@aws-amplify/core/internals/utils';\n/**\n * NOTE!\n *\n * This is used only by DataStore.\n *\n * This can probably be pruned and/or removed. Just leaving it as much of the same\n * state as possible for V6 to reduce number of potentially impactful changes to DataStore.\n */\nconst logger = new ConsoleLogger('API');\n/**\n * @deprecated\n * Use RestApi or GraphQLAPI to reduce your application bundle size\n * Export Cloud Logic APIs\n */\nexport class InternalAPIClass {\n /**\n * Initialize API
|
|
1
|
+
{"version":3,"file":"InternalAPI.mjs","sources":["../../../src/internals/InternalAPI.ts"],"sourcesContent":["import { InternalGraphQLAPIClass } from '@aws-amplify/api-graphql/internals';\nimport { Amplify, Cache, ConsoleLogger } from '@aws-amplify/core';\nimport { ApiAction, Category, } from '@aws-amplify/core/internals/utils';\n/**\n * NOTE!\n *\n * This is used only by DataStore.\n *\n * This can probably be pruned and/or removed. Just leaving it as much of the same\n * state as possible for V6 to reduce number of potentially impactful changes to DataStore.\n */\nconst logger = new ConsoleLogger('API');\n/**\n * @deprecated\n * Use RestApi or GraphQLAPI to reduce your application bundle size\n * Export Cloud Logic APIs\n */\nexport class InternalAPIClass {\n /**\n * Initialize API\n */\n constructor() {\n this.Cache = Cache;\n this._graphqlApi = new InternalGraphQLAPIClass();\n }\n getModuleName() {\n return 'InternalAPI';\n }\n /**\n * to get the operation type\n * @param operation\n */\n getGraphqlOperationType(operation) {\n return this._graphqlApi.getGraphqlOperationType(operation);\n }\n graphql(options, additionalHeaders, customUserAgentDetails) {\n const apiUserAgentDetails = {\n category: Category.API,\n action: ApiAction.GraphQl,\n ...customUserAgentDetails,\n };\n return this._graphqlApi.graphql(Amplify, options, additionalHeaders, apiUserAgentDetails);\n }\n}\nexport const InternalAPI = new InternalAPIClass();\n"],"names":[],"mappings":";;;;AAGA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACe,IAAI,aAAa,CAAC,KAAK,EAAE;AACxC;AACA;AACA;AACA;AACA;AACO,MAAM,gBAAgB,CAAC;AAC9B;AACA;AACA;AACA,IAAI,WAAW,GAAG;AAClB,QAAQ,IAAI,CAAC,KAAK,GAAG,KAAK,CAAC;AAC3B,QAAQ,IAAI,CAAC,WAAW,GAAG,IAAI,uBAAuB,EAAE,CAAC;AACzD,KAAK;AACL,IAAI,aAAa,GAAG;AACpB,QAAQ,OAAO,aAAa,CAAC;AAC7B,KAAK;AACL;AACA;AACA;AACA;AACA,IAAI,uBAAuB,CAAC,SAAS,EAAE;AACvC,QAAQ,OAAO,IAAI,CAAC,WAAW,CAAC,uBAAuB,CAAC,SAAS,CAAC,CAAC;AACnE,KAAK;AACL,IAAI,OAAO,CAAC,OAAO,EAAE,iBAAiB,EAAE,sBAAsB,EAAE;AAChE,QAAQ,MAAM,mBAAmB,GAAG;AACpC,YAAY,QAAQ,EAAE,QAAQ,CAAC,GAAG;AAClC,YAAY,MAAM,EAAE,SAAS,CAAC,OAAO;AACrC,YAAY,GAAG,sBAAsB;AACrC,SAAS,CAAC;AACV,QAAQ,OAAO,IAAI,CAAC,WAAW,CAAC,OAAO,CAAC,OAAO,EAAE,OAAO,EAAE,iBAAiB,EAAE,mBAAmB,CAAC,CAAC;AAClG,KAAK;AACL,CAAC;AACW,MAAC,WAAW,GAAG,IAAI,gBAAgB;;;;"}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
export { InternalAPI, InternalAPIClass } from './InternalAPI';
|
|
2
|
-
export { generateServerClient } from '
|
|
2
|
+
export { generateClient as generateServerClient } from '@aws-amplify/api-graphql/internals/server';
|
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
export { InternalAPI, InternalAPIClass } from './InternalAPI.mjs';
|
|
2
|
-
export { generateServerClient } from '
|
|
2
|
+
export { generateClient as generateServerClient } from '@aws-amplify/api-graphql/internals/server';
|
|
3
3
|
//# sourceMappingURL=index.mjs.map
|
|
@@ -3,4 +3,4 @@
|
|
|
3
3
|
* generates code that relies on this import path https://github.com/aws-amplify/amplify-cli/issues/3863
|
|
4
4
|
* This will be removed in future release when CLI and customers moves to recommeneded import styles.
|
|
5
5
|
*/
|
|
6
|
-
export { graphqlOperation, GraphQLAuthError, GraphQLResult, GraphQLQuery, GraphQLSubscription, } from '@aws-amplify/api-graphql';
|
|
6
|
+
export { graphqlOperation, GraphQLAuthError, GraphQLResult, GraphQLQuery, GraphQLSubscription, SelectionSet, } from '@aws-amplify/api-graphql';
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@aws-amplify/api",
|
|
3
|
-
"version": "6.0.2
|
|
3
|
+
"version": "6.0.2",
|
|
4
4
|
"description": "Api category of aws-amplify",
|
|
5
5
|
"main": "./dist/cjs/index.js",
|
|
6
6
|
"module": "./dist/esm/index.mjs",
|
|
@@ -70,7 +70,7 @@
|
|
|
70
70
|
"devDependencies": {
|
|
71
71
|
"@rollup/plugin-typescript": "11.1.5",
|
|
72
72
|
"rollup": "3.29.4",
|
|
73
|
-
"typescript": "5.
|
|
73
|
+
"typescript": "5.0.2"
|
|
74
74
|
},
|
|
75
75
|
"files": [
|
|
76
76
|
"dist/cjs",
|
|
@@ -81,8 +81,8 @@
|
|
|
81
81
|
"server"
|
|
82
82
|
],
|
|
83
83
|
"dependencies": {
|
|
84
|
-
"@aws-amplify/api-graphql": "4.0.2
|
|
85
|
-
"@aws-amplify/api-rest": "4.0.2
|
|
84
|
+
"@aws-amplify/api-graphql": "4.0.2",
|
|
85
|
+
"@aws-amplify/api-rest": "4.0.2",
|
|
86
86
|
"tslib": "^2.5.0"
|
|
87
87
|
},
|
|
88
88
|
"jest": {
|
|
@@ -135,5 +135,5 @@
|
|
|
135
135
|
"__tests__"
|
|
136
136
|
]
|
|
137
137
|
},
|
|
138
|
-
"gitHead": "
|
|
138
|
+
"gitHead": "e9c04a6d233f812b2888aa51a71b66a4040af8c0"
|
|
139
139
|
}
|
package/src/API.ts
CHANGED
|
@@ -1,23 +1,17 @@
|
|
|
1
1
|
// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
|
|
2
2
|
// SPDX-License-Identifier: Apache-2.0
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
graphql as v6graphql,
|
|
6
|
-
cancel as v6cancel,
|
|
7
|
-
isCancelError as v6isCancelError,
|
|
8
|
-
} from '@aws-amplify/api-graphql/internals';
|
|
3
|
+
import { V6Client, CommonPublicClientOptions } from '@aws-amplify/api-graphql';
|
|
4
|
+
import { generateClient as internalGenerateClient } from '@aws-amplify/api-graphql/internals';
|
|
9
5
|
import { Amplify } from '@aws-amplify/core';
|
|
10
6
|
|
|
11
7
|
/**
|
|
12
8
|
* Generates an API client that can work with models or raw GraphQL
|
|
13
9
|
*/
|
|
14
|
-
export function generateClient<
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
return {
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
isCancelError: v6isCancelError,
|
|
22
|
-
};
|
|
10
|
+
export function generateClient<T extends Record<any, any> = never>(
|
|
11
|
+
options: CommonPublicClientOptions = {}
|
|
12
|
+
): V6Client<T> {
|
|
13
|
+
return internalGenerateClient({
|
|
14
|
+
...options,
|
|
15
|
+
amplify: Amplify,
|
|
16
|
+
}) as unknown as V6Client<T>;
|
|
23
17
|
}
|
package/src/index.ts
CHANGED
|
@@ -1,9 +1,7 @@
|
|
|
1
1
|
// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
|
|
2
2
|
// SPDX-License-Identifier: Apache-2.0
|
|
3
3
|
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
export { GraphQLQuery, GraphQLSubscription } from './types';
|
|
4
|
+
export { GraphQLQuery, GraphQLSubscription, SelectionSet } from './types';
|
|
7
5
|
export { generateClient } from './API';
|
|
8
6
|
|
|
9
7
|
export { GraphQLAuthError, ConnectionState } from '@aws-amplify/api-graphql';
|
|
@@ -34,23 +34,15 @@ const logger = new ConsoleLogger('API');
|
|
|
34
34
|
* Export Cloud Logic APIs
|
|
35
35
|
*/
|
|
36
36
|
export class InternalAPIClass {
|
|
37
|
-
/**
|
|
38
|
-
* Initialize API with AWS configuration
|
|
39
|
-
* @param {Object} options - Configuration object for API
|
|
40
|
-
*/
|
|
41
|
-
private _options;
|
|
42
37
|
private _graphqlApi: InternalGraphQLAPIClass;
|
|
43
38
|
|
|
44
39
|
Cache = Cache;
|
|
45
40
|
|
|
46
41
|
/**
|
|
47
|
-
* Initialize API
|
|
48
|
-
* @param {Object} options - Configuration object for API
|
|
42
|
+
* Initialize API
|
|
49
43
|
*/
|
|
50
|
-
constructor(
|
|
51
|
-
this.
|
|
52
|
-
this._graphqlApi = new InternalGraphQLAPIClass(options);
|
|
53
|
-
logger.debug('API Options', this._options);
|
|
44
|
+
constructor() {
|
|
45
|
+
this._graphqlApi = new InternalGraphQLAPIClass();
|
|
54
46
|
}
|
|
55
47
|
|
|
56
48
|
public getModuleName() {
|
|
@@ -104,4 +96,4 @@ export class InternalAPIClass {
|
|
|
104
96
|
}
|
|
105
97
|
}
|
|
106
98
|
|
|
107
|
-
export const InternalAPI = new InternalAPIClass(
|
|
99
|
+
export const InternalAPI = new InternalAPIClass();
|
package/src/internals/index.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
|
|
2
2
|
// SPDX-License-Identifier: Apache-2.0
|
|
3
3
|
export { InternalAPI, InternalAPIClass } from './InternalAPI';
|
|
4
|
-
export { generateServerClient } from '
|
|
4
|
+
export { generateClient as generateServerClient } from '@aws-amplify/api-graphql/internals/server';
|
package/src/types/index.ts
CHANGED
|
@@ -1,29 +0,0 @@
|
|
|
1
|
-
'use strict';
|
|
2
|
-
|
|
3
|
-
// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
|
|
4
|
-
// SPDX-License-Identifier: Apache-2.0
|
|
5
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
exports.generateServerClient = void 0;
|
|
7
|
-
const api_graphql_1 = require("@aws-amplify/api-graphql");
|
|
8
|
-
const internals_1 = require("@aws-amplify/api-graphql/internals");
|
|
9
|
-
/**
|
|
10
|
-
* @private
|
|
11
|
-
*
|
|
12
|
-
* Creates a client that can be used to make GraphQL requests, using a provided `AmplifyClassV6`
|
|
13
|
-
* compatible context object for config and auth fetching.
|
|
14
|
-
*
|
|
15
|
-
* @param params
|
|
16
|
-
* @returns
|
|
17
|
-
*/
|
|
18
|
-
function generateServerClient(params) {
|
|
19
|
-
const client = {
|
|
20
|
-
[api_graphql_1.__amplify]: params.amplify,
|
|
21
|
-
graphql: internals_1.graphql,
|
|
22
|
-
cancel: internals_1.cancel,
|
|
23
|
-
isCancelError: internals_1.isCancelError,
|
|
24
|
-
models: {},
|
|
25
|
-
};
|
|
26
|
-
return client;
|
|
27
|
-
}
|
|
28
|
-
exports.generateServerClient = generateServerClient;
|
|
29
|
-
//# sourceMappingURL=generateServerClient.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"generateServerClient.js","sources":["../../../src/internals/generateServerClient.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.generateServerClient = void 0;\nconst api_graphql_1 = require(\"@aws-amplify/api-graphql\");\nconst internals_1 = require(\"@aws-amplify/api-graphql/internals\");\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 generateServerClient(params) {\n const client = {\n [api_graphql_1.__amplify]: params.amplify,\n graphql: internals_1.graphql,\n cancel: internals_1.cancel,\n isCancelError: internals_1.isCancelError,\n models: {},\n };\n return client;\n}\nexports.generateServerClient = generateServerClient;\n"],"names":[],"mappings":";;AACA;AACA;AACA,MAAM,CAAC,cAAc,CAAC,OAAO,EAAE,YAAY,EAAE,EAAE,KAAK,EAAE,IAAI,EAAE,CAAC,CAAC;AAC9D,OAAO,CAAC,oBAAoB,GAAG,KAAK,CAAC,CAAC;AACtC,MAAM,aAAa,GAAG,OAAO,CAAC,0BAA0B,CAAC,CAAC;AAC1D,MAAM,WAAW,GAAG,OAAO,CAAC,oCAAoC,CAAC,CAAC;AAClE;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAAS,oBAAoB,CAAC,MAAM,EAAE;AACtC,IAAI,MAAM,MAAM,GAAG;AACnB,QAAQ,CAAC,aAAa,CAAC,SAAS,GAAG,MAAM,CAAC,OAAO;AACjD,QAAQ,OAAO,EAAE,WAAW,CAAC,OAAO;AACpC,QAAQ,MAAM,EAAE,WAAW,CAAC,MAAM;AAClC,QAAQ,aAAa,EAAE,WAAW,CAAC,aAAa;AAChD,QAAQ,MAAM,EAAE,EAAE;AAClB,KAAK,CAAC;AACN,IAAI,OAAO,MAAM,CAAC;AAClB,CAAC;AACD,OAAO,CAAC,oBAAoB,GAAG,oBAAoB;;"}
|
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
import { ServerClientGenerationParams, V6Client, V6ClientSSR } from '@aws-amplify/api-graphql';
|
|
2
|
-
/**
|
|
3
|
-
* @private
|
|
4
|
-
*
|
|
5
|
-
* Creates a client that can be used to make GraphQL requests, using a provided `AmplifyClassV6`
|
|
6
|
-
* compatible context object for config and auth fetching.
|
|
7
|
-
*
|
|
8
|
-
* @param params
|
|
9
|
-
* @returns
|
|
10
|
-
*/
|
|
11
|
-
export declare function generateServerClient<T extends Record<any, any> = never, ClientType extends V6ClientSSR<T> | V6Client<T> = V6ClientSSR<T>>(params: ServerClientGenerationParams): ClientType;
|
|
@@ -1,27 +0,0 @@
|
|
|
1
|
-
import { __amplify } from '@aws-amplify/api-graphql';
|
|
2
|
-
import { graphql, cancel, isCancelError } from '@aws-amplify/api-graphql/internals';
|
|
3
|
-
|
|
4
|
-
// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
|
|
5
|
-
// SPDX-License-Identifier: Apache-2.0
|
|
6
|
-
/**
|
|
7
|
-
* @private
|
|
8
|
-
*
|
|
9
|
-
* Creates a client that can be used to make GraphQL requests, using a provided `AmplifyClassV6`
|
|
10
|
-
* compatible context object for config and auth fetching.
|
|
11
|
-
*
|
|
12
|
-
* @param params
|
|
13
|
-
* @returns
|
|
14
|
-
*/
|
|
15
|
-
function generateServerClient(params) {
|
|
16
|
-
const client = {
|
|
17
|
-
[__amplify]: params.amplify,
|
|
18
|
-
graphql,
|
|
19
|
-
cancel,
|
|
20
|
-
isCancelError,
|
|
21
|
-
models: {},
|
|
22
|
-
};
|
|
23
|
-
return client;
|
|
24
|
-
}
|
|
25
|
-
|
|
26
|
-
export { generateServerClient };
|
|
27
|
-
//# sourceMappingURL=generateServerClient.mjs.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"generateServerClient.mjs","sources":["../../../src/internals/generateServerClient.ts"],"sourcesContent":["// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\nimport { __amplify, } from '@aws-amplify/api-graphql';\nimport { graphql, cancel, isCancelError, } from '@aws-amplify/api-graphql/internals';\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 */\nexport function generateServerClient(params) {\n const client = {\n [__amplify]: params.amplify,\n graphql,\n cancel,\n isCancelError,\n models: {},\n };\n return client;\n}\n"],"names":[],"mappings":";;;AAAA;AACA;AAGA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACO,SAAS,oBAAoB,CAAC,MAAM,EAAE;AAC7C,IAAI,MAAM,MAAM,GAAG;AACnB,QAAQ,CAAC,SAAS,GAAG,MAAM,CAAC,OAAO;AACnC,QAAQ,OAAO;AACf,QAAQ,MAAM;AACd,QAAQ,aAAa;AACrB,QAAQ,MAAM,EAAE,EAAE;AAClB,KAAK,CAAC;AACN,IAAI,OAAO,MAAM,CAAC;AAClB;;;;"}
|
|
@@ -1,38 +0,0 @@
|
|
|
1
|
-
// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
|
|
2
|
-
// SPDX-License-Identifier: Apache-2.0
|
|
3
|
-
|
|
4
|
-
import {
|
|
5
|
-
ServerClientGenerationParams,
|
|
6
|
-
V6Client,
|
|
7
|
-
V6ClientSSR,
|
|
8
|
-
__amplify,
|
|
9
|
-
} from '@aws-amplify/api-graphql';
|
|
10
|
-
import {
|
|
11
|
-
graphql,
|
|
12
|
-
cancel,
|
|
13
|
-
isCancelError,
|
|
14
|
-
} from '@aws-amplify/api-graphql/internals';
|
|
15
|
-
|
|
16
|
-
/**
|
|
17
|
-
* @private
|
|
18
|
-
*
|
|
19
|
-
* Creates a client that can be used to make GraphQL requests, using a provided `AmplifyClassV6`
|
|
20
|
-
* compatible context object for config and auth fetching.
|
|
21
|
-
*
|
|
22
|
-
* @param params
|
|
23
|
-
* @returns
|
|
24
|
-
*/
|
|
25
|
-
export function generateServerClient<
|
|
26
|
-
T extends Record<any, any> = never,
|
|
27
|
-
ClientType extends V6ClientSSR<T> | V6Client<T> = V6ClientSSR<T>
|
|
28
|
-
>(params: ServerClientGenerationParams): ClientType {
|
|
29
|
-
const client = {
|
|
30
|
-
[__amplify]: params.amplify,
|
|
31
|
-
graphql,
|
|
32
|
-
cancel,
|
|
33
|
-
isCancelError,
|
|
34
|
-
models: {},
|
|
35
|
-
} as any;
|
|
36
|
-
|
|
37
|
-
return client as ClientType;
|
|
38
|
-
}
|