@aws-amplify/api 0.0.0-changesets-preid-f620002-20260129130740
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/README.md +3 -0
- package/dist/cjs/API.js +19 -0
- package/dist/cjs/API.js.map +1 -0
- package/dist/cjs/index.js +25 -0
- package/dist/cjs/index.js.map +1 -0
- package/dist/cjs/internals/InternalAPI.js +50 -0
- package/dist/cjs/internals/InternalAPI.js.map +1 -0
- package/dist/cjs/internals/index.js +12 -0
- package/dist/cjs/internals/index.js.map +1 -0
- package/dist/cjs/server.js +17 -0
- package/dist/cjs/server.js.map +1 -0
- package/dist/cjs/types/index.js +15 -0
- package/dist/cjs/types/index.js.map +1 -0
- package/dist/esm/API.d.ts +9 -0
- package/dist/esm/API.mjs +18 -0
- package/dist/esm/API.mjs.map +1 -0
- package/dist/esm/index.d.ts +10 -0
- package/dist/esm/index.mjs +5 -0
- package/dist/esm/index.mjs.map +1 -0
- package/dist/esm/internals/InternalAPI.d.ts +43 -0
- package/dist/esm/internals/InternalAPI.mjs +48 -0
- package/dist/esm/internals/InternalAPI.mjs.map +1 -0
- package/dist/esm/internals/index.d.ts +4 -0
- package/dist/esm/internals/index.mjs +3 -0
- package/dist/esm/internals/index.mjs.map +1 -0
- package/dist/esm/server.d.ts +2 -0
- package/dist/esm/server.mjs +3 -0
- package/dist/esm/server.mjs.map +1 -0
- package/dist/esm/types/index.d.ts +6 -0
- package/dist/esm/types/index.mjs +2 -0
- package/dist/esm/types/index.mjs.map +1 -0
- package/internals/package.json +8 -0
- package/package.json +92 -0
- package/server/package.json +7 -0
- package/src/API.ts +25 -0
- package/src/index.ts +39 -0
- package/src/internals/InternalAPI.ts +100 -0
- package/src/internals/index.ts +12 -0
- package/src/server.ts +13 -0
- package/src/types/index.ts +16 -0
package/README.md
ADDED
package/dist/cjs/API.js
ADDED
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
4
|
+
exports.generateClient = generateClient;
|
|
5
|
+
const internals_1 = require("@aws-amplify/api-graphql/internals");
|
|
6
|
+
const core_1 = require("@aws-amplify/core");
|
|
7
|
+
/**
|
|
8
|
+
* Generates an API client that can work with models or raw GraphQL
|
|
9
|
+
*
|
|
10
|
+
* @returns {@link V6Client}
|
|
11
|
+
* @throws {@link Error} - Throws error when client cannot be generated due to configuration issues.
|
|
12
|
+
*/
|
|
13
|
+
function generateClient(options) {
|
|
14
|
+
return (0, internals_1.generateClient)({
|
|
15
|
+
...(options || {}),
|
|
16
|
+
amplify: core_1.Amplify,
|
|
17
|
+
});
|
|
18
|
+
}
|
|
19
|
+
//# sourceMappingURL=API.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"API.js","sources":["../../src/API.ts"],"sourcesContent":["\"use strict\";\nObject.defineProperty(exports, \"__esModule\", { value: true });\nexports.generateClient = generateClient;\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 *\n * @returns {@link V6Client}\n * @throws {@link Error} - Throws error when client cannot be generated due to configuration issues.\n */\nfunction generateClient(options) {\n return (0, internals_1.generateClient)({\n ...(options || {}),\n amplify: core_1.Amplify,\n });\n}\n"],"names":[],"mappings":";;AACA,MAAM,CAAC,cAAc,CAAC,OAAO,EAAE,YAAY,EAAE,EAAE,KAAK,EAAE,IAAI,EAAE,CAAC;AAC7D,OAAO,CAAC,cAAc,GAAG,cAAc;AACvC,MAAM,WAAW,GAAG,OAAO,CAAC,oCAAoC,CAAC;AACjE,MAAM,MAAM,GAAG,OAAO,CAAC,mBAAmB,CAAC;AAC3C;AACA;AACA;AACA;AACA;AACA;AACA,SAAS,cAAc,CAAC,OAAO,EAAE;AACjC,IAAI,OAAO,IAAI,WAAW,CAAC,cAAc,EAAE;AAC3C,QAAQ,IAAI,OAAO,IAAI,EAAE,CAAC;AAC1B,QAAQ,OAAO,EAAE,MAAM,CAAC,OAAO;AAC/B,KAAK,CAAC;AACN;;"}
|
|
@@ -0,0 +1,25 @@
|
|
|
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.ApiError = exports.isCancelError = exports.patch = exports.head = exports.del = exports.post = exports.put = exports.get = exports.events = exports.CONNECTION_STATE_CHANGE = exports.ConnectionState = exports.GraphQLAuthError = exports.generateClient = void 0;
|
|
7
|
+
var API_1 = require("./API");
|
|
8
|
+
Object.defineProperty(exports, "generateClient", { enumerable: true, get: function () { return API_1.generateClient; } });
|
|
9
|
+
var api_graphql_1 = require("@aws-amplify/api-graphql");
|
|
10
|
+
Object.defineProperty(exports, "GraphQLAuthError", { enumerable: true, get: function () { return api_graphql_1.GraphQLAuthError; } });
|
|
11
|
+
Object.defineProperty(exports, "ConnectionState", { enumerable: true, get: function () { return api_graphql_1.ConnectionState; } });
|
|
12
|
+
var api_graphql_2 = require("@aws-amplify/api-graphql");
|
|
13
|
+
Object.defineProperty(exports, "CONNECTION_STATE_CHANGE", { enumerable: true, get: function () { return api_graphql_2.CONNECTION_STATE_CHANGE; } });
|
|
14
|
+
Object.defineProperty(exports, "events", { enumerable: true, get: function () { return api_graphql_2.events; } });
|
|
15
|
+
var api_rest_1 = require("@aws-amplify/api-rest");
|
|
16
|
+
Object.defineProperty(exports, "get", { enumerable: true, get: function () { return api_rest_1.get; } });
|
|
17
|
+
Object.defineProperty(exports, "put", { enumerable: true, get: function () { return api_rest_1.put; } });
|
|
18
|
+
Object.defineProperty(exports, "post", { enumerable: true, get: function () { return api_rest_1.post; } });
|
|
19
|
+
Object.defineProperty(exports, "del", { enumerable: true, get: function () { return api_rest_1.del; } });
|
|
20
|
+
Object.defineProperty(exports, "head", { enumerable: true, get: function () { return api_rest_1.head; } });
|
|
21
|
+
Object.defineProperty(exports, "patch", { enumerable: true, get: function () { return api_rest_1.patch; } });
|
|
22
|
+
Object.defineProperty(exports, "isCancelError", { enumerable: true, get: function () { return api_rest_1.isCancelError; } });
|
|
23
|
+
var utils_1 = require("@aws-amplify/core/internals/utils");
|
|
24
|
+
Object.defineProperty(exports, "ApiError", { enumerable: true, get: function () { return utils_1.ApiError; } });
|
|
25
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sources":["../../src/index.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.ApiError = exports.isCancelError = exports.patch = exports.head = exports.del = exports.post = exports.put = exports.get = exports.events = exports.CONNECTION_STATE_CHANGE = exports.ConnectionState = exports.GraphQLAuthError = exports.generateClient = void 0;\nvar API_1 = require(\"./API\");\nObject.defineProperty(exports, \"generateClient\", { enumerable: true, get: function () { return API_1.generateClient; } });\nvar api_graphql_1 = require(\"@aws-amplify/api-graphql\");\nObject.defineProperty(exports, \"GraphQLAuthError\", { enumerable: true, get: function () { return api_graphql_1.GraphQLAuthError; } });\nObject.defineProperty(exports, \"ConnectionState\", { enumerable: true, get: function () { return api_graphql_1.ConnectionState; } });\nvar api_graphql_2 = require(\"@aws-amplify/api-graphql\");\nObject.defineProperty(exports, \"CONNECTION_STATE_CHANGE\", { enumerable: true, get: function () { return api_graphql_2.CONNECTION_STATE_CHANGE; } });\nObject.defineProperty(exports, \"events\", { enumerable: true, get: function () { return api_graphql_2.events; } });\nvar api_rest_1 = require(\"@aws-amplify/api-rest\");\nObject.defineProperty(exports, \"get\", { enumerable: true, get: function () { return api_rest_1.get; } });\nObject.defineProperty(exports, \"put\", { enumerable: true, get: function () { return api_rest_1.put; } });\nObject.defineProperty(exports, \"post\", { enumerable: true, get: function () { return api_rest_1.post; } });\nObject.defineProperty(exports, \"del\", { enumerable: true, get: function () { return api_rest_1.del; } });\nObject.defineProperty(exports, \"head\", { enumerable: true, get: function () { return api_rest_1.head; } });\nObject.defineProperty(exports, \"patch\", { enumerable: true, get: function () { return api_rest_1.patch; } });\nObject.defineProperty(exports, \"isCancelError\", { enumerable: true, get: function () { return api_rest_1.isCancelError; } });\nvar utils_1 = require(\"@aws-amplify/core/internals/utils\");\nObject.defineProperty(exports, \"ApiError\", { enumerable: true, get: function () { return utils_1.ApiError; } });\n"],"names":[],"mappings":"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"}
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
4
|
+
exports.InternalAPI = exports.InternalAPIClass = void 0;
|
|
5
|
+
const internals_1 = require("@aws-amplify/api-graphql/internals");
|
|
6
|
+
const core_1 = require("@aws-amplify/core");
|
|
7
|
+
const utils_1 = require("@aws-amplify/core/internals/utils");
|
|
8
|
+
/**
|
|
9
|
+
* NOTE!
|
|
10
|
+
*
|
|
11
|
+
* This is used only by DataStore.
|
|
12
|
+
*
|
|
13
|
+
* This can probably be pruned and/or removed. Just leaving it as much of the same
|
|
14
|
+
* state as possible for V6 to reduce number of potentially impactful changes to DataStore.
|
|
15
|
+
*/
|
|
16
|
+
/**
|
|
17
|
+
* @deprecated
|
|
18
|
+
* Use RestApi or GraphQLAPI to reduce your application bundle size
|
|
19
|
+
* Export Cloud Logic APIs
|
|
20
|
+
*/
|
|
21
|
+
class InternalAPIClass {
|
|
22
|
+
/**
|
|
23
|
+
* Initialize API
|
|
24
|
+
*/
|
|
25
|
+
constructor() {
|
|
26
|
+
this.Cache = core_1.Cache;
|
|
27
|
+
this._graphqlApi = new internals_1.InternalGraphQLAPIClass();
|
|
28
|
+
}
|
|
29
|
+
getModuleName() {
|
|
30
|
+
return 'InternalAPI';
|
|
31
|
+
}
|
|
32
|
+
/**
|
|
33
|
+
* to get the operation type
|
|
34
|
+
* @param operation
|
|
35
|
+
*/
|
|
36
|
+
getGraphqlOperationType(operation) {
|
|
37
|
+
return this._graphqlApi.getGraphqlOperationType(operation);
|
|
38
|
+
}
|
|
39
|
+
graphql(options, additionalHeaders, customUserAgentDetails) {
|
|
40
|
+
const apiUserAgentDetails = {
|
|
41
|
+
category: utils_1.Category.API,
|
|
42
|
+
action: utils_1.ApiAction.GraphQl,
|
|
43
|
+
...customUserAgentDetails,
|
|
44
|
+
};
|
|
45
|
+
return this._graphqlApi.graphql(core_1.Amplify, options, additionalHeaders, apiUserAgentDetails);
|
|
46
|
+
}
|
|
47
|
+
}
|
|
48
|
+
exports.InternalAPIClass = InternalAPIClass;
|
|
49
|
+
exports.InternalAPI = new InternalAPIClass();
|
|
50
|
+
//# sourceMappingURL=InternalAPI.js.map
|
|
@@ -0,0 +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 */\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;AAC7D,OAAO,CAAC,WAAW,GAAG,OAAO,CAAC,gBAAgB,GAAG,MAAM;AACvD,MAAM,WAAW,GAAG,OAAO,CAAC,oCAAoC,CAAC;AACjE,MAAM,MAAM,GAAG,OAAO,CAAC,mBAAmB,CAAC;AAC3C,MAAM,OAAO,GAAG,OAAO,CAAC,mCAAmC,CAAC;AAC5D;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,MAAM,gBAAgB,CAAC;AACvB;AACA;AACA;AACA,IAAI,WAAW,GAAG;AAClB,QAAQ,IAAI,CAAC,KAAK,GAAG,MAAM,CAAC,KAAK;AACjC,QAAQ,IAAI,CAAC,WAAW,GAAG,IAAI,WAAW,CAAC,uBAAuB,EAAE;AACpE,IAAI;AACJ,IAAI,aAAa,GAAG;AACpB,QAAQ,OAAO,aAAa;AAC5B,IAAI;AACJ;AACA;AACA;AACA;AACA,IAAI,uBAAuB,CAAC,SAAS,EAAE;AACvC,QAAQ,OAAO,IAAI,CAAC,WAAW,CAAC,uBAAuB,CAAC,SAAS,CAAC;AAClE,IAAI;AACJ,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;AACT,QAAQ,OAAO,IAAI,CAAC,WAAW,CAAC,OAAO,CAAC,MAAM,CAAC,OAAO,EAAE,OAAO,EAAE,iBAAiB,EAAE,mBAAmB,CAAC;AACxG,IAAI;AACJ;AACA,OAAO,CAAC,gBAAgB,GAAG,gBAAgB;AAC3C,OAAO,CAAC,WAAW,GAAG,IAAI,gBAAgB,EAAE;;"}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
4
|
+
exports.generateClientWithAmplifyInstance = exports.InternalAPIClass = exports.InternalAPI = void 0;
|
|
5
|
+
// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
|
|
6
|
+
// SPDX-License-Identifier: Apache-2.0
|
|
7
|
+
var InternalAPI_1 = require("./InternalAPI");
|
|
8
|
+
Object.defineProperty(exports, "InternalAPI", { enumerable: true, get: function () { return InternalAPI_1.InternalAPI; } });
|
|
9
|
+
Object.defineProperty(exports, "InternalAPIClass", { enumerable: true, get: function () { return InternalAPI_1.InternalAPIClass; } });
|
|
10
|
+
var server_1 = require("@aws-amplify/api-graphql/internals/server");
|
|
11
|
+
Object.defineProperty(exports, "generateClientWithAmplifyInstance", { enumerable: true, get: function () { return server_1.generateClientWithAmplifyInstance; } });
|
|
12
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sources":["../../../src/internals/index.ts"],"sourcesContent":["\"use strict\";\nObject.defineProperty(exports, \"__esModule\", { value: true });\nexports.generateClientWithAmplifyInstance = 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, \"generateClientWithAmplifyInstance\", { enumerable: true, get: function () { return server_1.generateClientWithAmplifyInstance; } });\n"],"names":[],"mappings":";;AACA,MAAM,CAAC,cAAc,CAAC,OAAO,EAAE,YAAY,EAAE,EAAE,KAAK,EAAE,IAAI,EAAE,CAAC;AAC7D,OAAO,CAAC,iCAAiC,GAAG,OAAO,CAAC,gBAAgB,GAAG,OAAO,CAAC,WAAW,GAAG,MAAM;AACnG;AACA;AACA,IAAI,aAAa,GAAG,OAAO,CAAC,eAAe,CAAC;AAC5C,MAAM,CAAC,cAAc,CAAC,OAAO,EAAE,aAAa,EAAE,EAAE,UAAU,EAAE,IAAI,EAAE,GAAG,EAAE,YAAY,EAAE,OAAO,aAAa,CAAC,WAAW,CAAC,CAAC,CAAC,EAAE,CAAC;AAC3H,MAAM,CAAC,cAAc,CAAC,OAAO,EAAE,kBAAkB,EAAE,EAAE,UAAU,EAAE,IAAI,EAAE,GAAG,EAAE,YAAY,EAAE,OAAO,aAAa,CAAC,gBAAgB,CAAC,CAAC,CAAC,EAAE,CAAC;AACrI,IAAI,QAAQ,GAAG,OAAO,CAAC,2CAA2C,CAAC;AACnE,MAAM,CAAC,cAAc,CAAC,OAAO,EAAE,mCAAmC,EAAE,EAAE,UAAU,EAAE,IAAI,EAAE,GAAG,EAAE,YAAY,EAAE,OAAO,QAAQ,CAAC,iCAAiC,CAAC,CAAC,CAAC,EAAE,CAAC;;"}
|
|
@@ -0,0 +1,17 @@
|
|
|
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.generateClient = exports.isCancelError = exports.patch = exports.head = exports.del = exports.post = exports.put = exports.get = void 0;
|
|
7
|
+
var server_1 = require("@aws-amplify/api-rest/server");
|
|
8
|
+
Object.defineProperty(exports, "get", { enumerable: true, get: function () { return server_1.get; } });
|
|
9
|
+
Object.defineProperty(exports, "put", { enumerable: true, get: function () { return server_1.put; } });
|
|
10
|
+
Object.defineProperty(exports, "post", { enumerable: true, get: function () { return server_1.post; } });
|
|
11
|
+
Object.defineProperty(exports, "del", { enumerable: true, get: function () { return server_1.del; } });
|
|
12
|
+
Object.defineProperty(exports, "head", { enumerable: true, get: function () { return server_1.head; } });
|
|
13
|
+
Object.defineProperty(exports, "patch", { enumerable: true, get: function () { return server_1.patch; } });
|
|
14
|
+
Object.defineProperty(exports, "isCancelError", { enumerable: true, get: function () { return server_1.isCancelError; } });
|
|
15
|
+
var server_2 = require("@aws-amplify/api-graphql/server");
|
|
16
|
+
Object.defineProperty(exports, "generateClient", { enumerable: true, get: function () { return server_2.generateClient; } });
|
|
17
|
+
//# sourceMappingURL=server.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"server.js","sources":["../../src/server.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.generateClient = exports.isCancelError = exports.patch = exports.head = exports.del = exports.post = exports.put = exports.get = void 0;\nvar server_1 = require(\"@aws-amplify/api-rest/server\");\nObject.defineProperty(exports, \"get\", { enumerable: true, get: function () { return server_1.get; } });\nObject.defineProperty(exports, \"put\", { enumerable: true, get: function () { return server_1.put; } });\nObject.defineProperty(exports, \"post\", { enumerable: true, get: function () { return server_1.post; } });\nObject.defineProperty(exports, \"del\", { enumerable: true, get: function () { return server_1.del; } });\nObject.defineProperty(exports, \"head\", { enumerable: true, get: function () { return server_1.head; } });\nObject.defineProperty(exports, \"patch\", { enumerable: true, get: function () { return server_1.patch; } });\nObject.defineProperty(exports, \"isCancelError\", { enumerable: true, get: function () { return server_1.isCancelError; } });\nvar server_2 = require(\"@aws-amplify/api-graphql/server\");\nObject.defineProperty(exports, \"generateClient\", { enumerable: true, get: function () { return server_2.generateClient; } });\n"],"names":[],"mappings":";;AACA;AACA;AACA,MAAM,CAAC,cAAc,CAAC,OAAO,EAAE,YAAY,EAAE,EAAE,KAAK,EAAE,IAAI,EAAE,CAAC;AAC7D,OAAO,CAAC,cAAc,GAAG,OAAO,CAAC,aAAa,GAAG,OAAO,CAAC,KAAK,GAAG,OAAO,CAAC,IAAI,GAAG,OAAO,CAAC,GAAG,GAAG,OAAO,CAAC,IAAI,GAAG,OAAO,CAAC,GAAG,GAAG,OAAO,CAAC,GAAG,GAAG,MAAM;AAC/I,IAAI,QAAQ,GAAG,OAAO,CAAC,8BAA8B,CAAC;AACtD,MAAM,CAAC,cAAc,CAAC,OAAO,EAAE,KAAK,EAAE,EAAE,UAAU,EAAE,IAAI,EAAE,GAAG,EAAE,YAAY,EAAE,OAAO,QAAQ,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,CAAC;AACtG,MAAM,CAAC,cAAc,CAAC,OAAO,EAAE,KAAK,EAAE,EAAE,UAAU,EAAE,IAAI,EAAE,GAAG,EAAE,YAAY,EAAE,OAAO,QAAQ,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,CAAC;AACtG,MAAM,CAAC,cAAc,CAAC,OAAO,EAAE,MAAM,EAAE,EAAE,UAAU,EAAE,IAAI,EAAE,GAAG,EAAE,YAAY,EAAE,OAAO,QAAQ,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,CAAC;AACxG,MAAM,CAAC,cAAc,CAAC,OAAO,EAAE,KAAK,EAAE,EAAE,UAAU,EAAE,IAAI,EAAE,GAAG,EAAE,YAAY,EAAE,OAAO,QAAQ,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,CAAC;AACtG,MAAM,CAAC,cAAc,CAAC,OAAO,EAAE,MAAM,EAAE,EAAE,UAAU,EAAE,IAAI,EAAE,GAAG,EAAE,YAAY,EAAE,OAAO,QAAQ,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,CAAC;AACxG,MAAM,CAAC,cAAc,CAAC,OAAO,EAAE,OAAO,EAAE,EAAE,UAAU,EAAE,IAAI,EAAE,GAAG,EAAE,YAAY,EAAE,OAAO,QAAQ,CAAC,KAAK,CAAC,CAAC,CAAC,EAAE,CAAC;AAC1G,MAAM,CAAC,cAAc,CAAC,OAAO,EAAE,eAAe,EAAE,EAAE,UAAU,EAAE,IAAI,EAAE,GAAG,EAAE,YAAY,EAAE,OAAO,QAAQ,CAAC,aAAa,CAAC,CAAC,CAAC,EAAE,CAAC;AAC1H,IAAI,QAAQ,GAAG,OAAO,CAAC,iCAAiC,CAAC;AACzD,MAAM,CAAC,cAAc,CAAC,OAAO,EAAE,gBAAgB,EAAE,EAAE,UAAU,EAAE,IAAI,EAAE,GAAG,EAAE,YAAY,EAAE,OAAO,QAAQ,CAAC,cAAc,CAAC,CAAC,CAAC,EAAE,CAAC;;"}
|
|
@@ -0,0 +1,15 @@
|
|
|
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.GraphQLAuthError = exports.graphqlOperation = void 0;
|
|
7
|
+
/**
|
|
8
|
+
* This exports from the types directory is a temporary workaround, since Amplify CLI currently
|
|
9
|
+
* generates code that relies on this import path https://github.com/aws-amplify/amplify-cli/issues/3863
|
|
10
|
+
* This will be removed in future release when CLI and customers moves to recommeneded import styles.
|
|
11
|
+
*/
|
|
12
|
+
var api_graphql_1 = require("@aws-amplify/api-graphql");
|
|
13
|
+
Object.defineProperty(exports, "graphqlOperation", { enumerable: true, get: function () { return api_graphql_1.graphqlOperation; } });
|
|
14
|
+
Object.defineProperty(exports, "GraphQLAuthError", { enumerable: true, get: function () { return api_graphql_1.GraphQLAuthError; } });
|
|
15
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sources":["../../../src/types/index.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.GraphQLAuthError = exports.graphqlOperation = void 0;\n/**\n * This exports from the types directory is a temporary workaround, since Amplify CLI currently\n * generates code that relies on this import path https://github.com/aws-amplify/amplify-cli/issues/3863\n * This will be removed in future release when CLI and customers moves to recommeneded import styles.\n */\nvar api_graphql_1 = require(\"@aws-amplify/api-graphql\");\nObject.defineProperty(exports, \"graphqlOperation\", { enumerable: true, get: function () { return api_graphql_1.graphqlOperation; } });\nObject.defineProperty(exports, \"GraphQLAuthError\", { enumerable: true, get: function () { return api_graphql_1.GraphQLAuthError; } });\n"],"names":[],"mappings":";;AACA;AACA;AACA,MAAM,CAAC,cAAc,CAAC,OAAO,EAAE,YAAY,EAAE,EAAE,KAAK,EAAE,IAAI,EAAE,CAAC;AAC7D,OAAO,CAAC,gBAAgB,GAAG,OAAO,CAAC,gBAAgB,GAAG,MAAM;AAC5D;AACA;AACA;AACA;AACA;AACA,IAAI,aAAa,GAAG,OAAO,CAAC,0BAA0B,CAAC;AACvD,MAAM,CAAC,cAAc,CAAC,OAAO,EAAE,kBAAkB,EAAE,EAAE,UAAU,EAAE,IAAI,EAAE,GAAG,EAAE,YAAY,EAAE,OAAO,aAAa,CAAC,gBAAgB,CAAC,CAAC,CAAC,EAAE,CAAC;AACrI,MAAM,CAAC,cAAc,CAAC,OAAO,EAAE,kBAAkB,EAAE,EAAE,UAAU,EAAE,IAAI,EAAE,GAAG,EAAE,YAAY,EAAE,OAAO,aAAa,CAAC,gBAAgB,CAAC,CAAC,CAAC,EAAE,CAAC;;"}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { V6Client } from '@aws-amplify/api-graphql';
|
|
2
|
+
import { CommonPublicClientOptions, DefaultCommonClientOptions } from '@aws-amplify/api-graphql/internals';
|
|
3
|
+
/**
|
|
4
|
+
* Generates an API client that can work with models or raw GraphQL
|
|
5
|
+
*
|
|
6
|
+
* @returns {@link V6Client}
|
|
7
|
+
* @throws {@link Error} - Throws error when client cannot be generated due to configuration issues.
|
|
8
|
+
*/
|
|
9
|
+
export declare function generateClient<T extends Record<any, any> = never, Options extends CommonPublicClientOptions = DefaultCommonClientOptions>(options?: Options): V6Client<T, Options>;
|
package/dist/esm/API.mjs
ADDED
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { generateClient as generateClient$1 } from '@aws-amplify/api-graphql/internals';
|
|
2
|
+
import { Amplify } from '@aws-amplify/core';
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
* Generates an API client that can work with models or raw GraphQL
|
|
6
|
+
*
|
|
7
|
+
* @returns {@link V6Client}
|
|
8
|
+
* @throws {@link Error} - Throws error when client cannot be generated due to configuration issues.
|
|
9
|
+
*/
|
|
10
|
+
function generateClient(options) {
|
|
11
|
+
return generateClient$1({
|
|
12
|
+
...(options || {}),
|
|
13
|
+
amplify: Amplify,
|
|
14
|
+
});
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
export { generateClient };
|
|
18
|
+
//# sourceMappingURL=API.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
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 *\n * @returns {@link V6Client}\n * @throws {@link Error} - Throws error when client cannot be generated due to configuration issues.\n */\nexport function generateClient(options) {\n return internalGenerateClient({\n ...(options || {}),\n amplify: Amplify,\n });\n}\n"],"names":["internalGenerateClient"],"mappings":";;;AAEA;AACA;AACA;AACA;AACA;AACA;AACO,SAAS,cAAc,CAAC,OAAO,EAAE;AACxC,IAAI,OAAOA,gBAAsB,CAAC;AAClC,QAAQ,IAAI,OAAO,IAAI,EAAE,CAAC;AAC1B,QAAQ,OAAO,EAAE,OAAO;AACxB,KAAK,CAAC;AACN;;;;"}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import type { V6Client } from '@aws-amplify/api-graphql';
|
|
2
|
+
export { GraphQLQuery, GraphQLSubscription, SelectionSet } from './types';
|
|
3
|
+
export { generateClient } from './API';
|
|
4
|
+
export { GraphQLAuthError, ConnectionState, EventsChannel, EventsOptions, } from '@aws-amplify/api-graphql';
|
|
5
|
+
export type { GraphQLResult, GraphQLReturnType, } from '@aws-amplify/api-graphql';
|
|
6
|
+
export { CONNECTION_STATE_CHANGE, events } from '@aws-amplify/api-graphql';
|
|
7
|
+
type Client<T extends Record<any, any> = never> = V6Client<T>;
|
|
8
|
+
export { Client };
|
|
9
|
+
export { get, put, post, del, head, patch, isCancelError, } from '@aws-amplify/api-rest';
|
|
10
|
+
export { ApiError } from '@aws-amplify/core/internals/utils';
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
export { generateClient } from './API.mjs';
|
|
2
|
+
export { CONNECTION_STATE_CHANGE, ConnectionState, GraphQLAuthError, events } from '@aws-amplify/api-graphql';
|
|
3
|
+
export { del, get, head, isCancelError, patch, post, put } from '@aws-amplify/api-rest';
|
|
4
|
+
export { ApiError } from '@aws-amplify/core/internals/utils';
|
|
5
|
+
//# sourceMappingURL=index.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.mjs","sources":[],"sourcesContent":[],"names":[],"mappings":";;;"}
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
import { AWSAppSyncRealTimeProvider, GraphQLOperation, GraphQLOptions, GraphQLQuery, GraphQLResult, GraphQLSubscription, OperationTypeNode } from '@aws-amplify/api-graphql';
|
|
2
|
+
import { CustomUserAgentDetails } from '@aws-amplify/core/internals/utils';
|
|
3
|
+
import { Observable } from 'rxjs';
|
|
4
|
+
import { CustomHeaders } from '@aws-amplify/data-schema/runtime';
|
|
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
|
+
*/
|
|
13
|
+
/**
|
|
14
|
+
* @deprecated
|
|
15
|
+
* Use RestApi or GraphQLAPI to reduce your application bundle size
|
|
16
|
+
* Export Cloud Logic APIs
|
|
17
|
+
*/
|
|
18
|
+
export declare class InternalAPIClass {
|
|
19
|
+
private _graphqlApi;
|
|
20
|
+
Cache: import("@aws-amplify/core/dist/esm/Cache/StorageCache").StorageCache;
|
|
21
|
+
/**
|
|
22
|
+
* Initialize API
|
|
23
|
+
*/
|
|
24
|
+
constructor();
|
|
25
|
+
getModuleName(): string;
|
|
26
|
+
/**
|
|
27
|
+
* to get the operation type
|
|
28
|
+
* @param operation
|
|
29
|
+
*/
|
|
30
|
+
getGraphqlOperationType(operation: GraphQLOperation): OperationTypeNode;
|
|
31
|
+
/**
|
|
32
|
+
* Executes a GraphQL operation
|
|
33
|
+
*
|
|
34
|
+
* @param options - GraphQL Options
|
|
35
|
+
* @param [additionalHeaders] - headers to merge in after any `libraryConfigHeaders` set in the config
|
|
36
|
+
* @returns An Observable if queryType is 'subscription', else a promise of the graphql result from the query.
|
|
37
|
+
*/
|
|
38
|
+
graphql<T>(options: GraphQLOptions, additionalHeaders?: CustomHeaders, customUserAgentDetails?: CustomUserAgentDetails): T extends GraphQLQuery<T> ? Promise<GraphQLResult<T>> : T extends GraphQLSubscription<T> ? Observable<{
|
|
39
|
+
provider: AWSAppSyncRealTimeProvider;
|
|
40
|
+
value: GraphQLResult<T>;
|
|
41
|
+
}> : Promise<GraphQLResult<any>> | Observable<object>;
|
|
42
|
+
}
|
|
43
|
+
export declare const InternalAPI: InternalAPIClass;
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
import { InternalGraphQLAPIClass } from '@aws-amplify/api-graphql/internals';
|
|
2
|
+
import { Cache, Amplify } from '@aws-amplify/core';
|
|
3
|
+
import { ApiAction, Category } from '@aws-amplify/core/internals/utils';
|
|
4
|
+
|
|
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
|
+
*/
|
|
13
|
+
/**
|
|
14
|
+
* @deprecated
|
|
15
|
+
* Use RestApi or GraphQLAPI to reduce your application bundle size
|
|
16
|
+
* Export Cloud Logic APIs
|
|
17
|
+
*/
|
|
18
|
+
class InternalAPIClass {
|
|
19
|
+
/**
|
|
20
|
+
* Initialize API
|
|
21
|
+
*/
|
|
22
|
+
constructor() {
|
|
23
|
+
this.Cache = Cache;
|
|
24
|
+
this._graphqlApi = new InternalGraphQLAPIClass();
|
|
25
|
+
}
|
|
26
|
+
getModuleName() {
|
|
27
|
+
return 'InternalAPI';
|
|
28
|
+
}
|
|
29
|
+
/**
|
|
30
|
+
* to get the operation type
|
|
31
|
+
* @param operation
|
|
32
|
+
*/
|
|
33
|
+
getGraphqlOperationType(operation) {
|
|
34
|
+
return this._graphqlApi.getGraphqlOperationType(operation);
|
|
35
|
+
}
|
|
36
|
+
graphql(options, additionalHeaders, customUserAgentDetails) {
|
|
37
|
+
const apiUserAgentDetails = {
|
|
38
|
+
category: Category.API,
|
|
39
|
+
action: ApiAction.GraphQl,
|
|
40
|
+
...customUserAgentDetails,
|
|
41
|
+
};
|
|
42
|
+
return this._graphqlApi.graphql(Amplify, options, additionalHeaders, apiUserAgentDetails);
|
|
43
|
+
}
|
|
44
|
+
}
|
|
45
|
+
const InternalAPI = new InternalAPIClass();
|
|
46
|
+
|
|
47
|
+
export { InternalAPI, InternalAPIClass };
|
|
48
|
+
//# sourceMappingURL=InternalAPI.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"InternalAPI.mjs","sources":["../../../src/internals/InternalAPI.ts"],"sourcesContent":["import { InternalGraphQLAPIClass } from '@aws-amplify/api-graphql/internals';\nimport { Amplify, Cache } 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 */\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;AACA;AACA;AACA;AACA;AACA;AACO,MAAM,gBAAgB,CAAC;AAC9B;AACA;AACA;AACA,IAAI,WAAW,GAAG;AAClB,QAAQ,IAAI,CAAC,KAAK,GAAG,KAAK;AAC1B,QAAQ,IAAI,CAAC,WAAW,GAAG,IAAI,uBAAuB,EAAE;AACxD,IAAI;AACJ,IAAI,aAAa,GAAG;AACpB,QAAQ,OAAO,aAAa;AAC5B,IAAI;AACJ;AACA;AACA;AACA;AACA,IAAI,uBAAuB,CAAC,SAAS,EAAE;AACvC,QAAQ,OAAO,IAAI,CAAC,WAAW,CAAC,uBAAuB,CAAC,SAAS,CAAC;AAClE,IAAI;AACJ,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;AACT,QAAQ,OAAO,IAAI,CAAC,WAAW,CAAC,OAAO,CAAC,OAAO,EAAE,OAAO,EAAE,iBAAiB,EAAE,mBAAmB,CAAC;AACjG,IAAI;AACJ;AACY,MAAC,WAAW,GAAG,IAAI,gBAAgB;;;;"}
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
export { InternalAPI, InternalAPIClass } from './InternalAPI';
|
|
2
|
+
export { generateClientWithAmplifyInstance } from '@aws-amplify/api-graphql/internals/server';
|
|
3
|
+
export { V6ClientSSRCookies, V6ClientSSRRequest, } from '@aws-amplify/api-graphql';
|
|
4
|
+
export { CommonPublicClientOptions, DefaultCommonClientOptions, } from '@aws-amplify/api-graphql/internals';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.mjs","sources":[],"sourcesContent":[],"names":[],"mappings":";"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"server.mjs","sources":[],"sourcesContent":[],"names":[],"mappings":";"}
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* This exports from the types directory is a temporary workaround, since Amplify CLI currently
|
|
3
|
+
* generates code that relies on this import path https://github.com/aws-amplify/amplify-cli/issues/3863
|
|
4
|
+
* This will be removed in future release when CLI and customers moves to recommeneded import styles.
|
|
5
|
+
*/
|
|
6
|
+
export { graphqlOperation, GraphQLAuthError, GraphQLResult, GraphQLQuery, GraphQLSubscription, SelectionSet, } from '@aws-amplify/api-graphql';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.mjs","sources":[],"sourcesContent":[],"names":[],"mappings":""}
|
package/package.json
ADDED
|
@@ -0,0 +1,92 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@aws-amplify/api",
|
|
3
|
+
"version": "0.0.0-changesets-preid-f620002-20260129130740",
|
|
4
|
+
"description": "Api category of aws-amplify",
|
|
5
|
+
"main": "./dist/cjs/index.js",
|
|
6
|
+
"module": "./dist/esm/index.mjs",
|
|
7
|
+
"typings": "./dist/esm/index.d.ts",
|
|
8
|
+
"react-native": "./dist/cjs/index.js",
|
|
9
|
+
"sideEffects": [
|
|
10
|
+
"./dist/cjs/API.js",
|
|
11
|
+
"./dist/esm/API.mjs"
|
|
12
|
+
],
|
|
13
|
+
"publishConfig": {
|
|
14
|
+
"access": "public"
|
|
15
|
+
},
|
|
16
|
+
"scripts": {
|
|
17
|
+
"test": "npm run lint && jest -w 1 --coverage --logHeapUsage",
|
|
18
|
+
"build-with-test": "npm test && npm run build",
|
|
19
|
+
"build:umd": "webpack && webpack --config ./webpack.config.dev.js",
|
|
20
|
+
"build:esm-cjs": "rollup --forceExit -c rollup.config.mjs",
|
|
21
|
+
"build:watch": "npm run build:esm-cjs -- --watch",
|
|
22
|
+
"build": "npm run clean && npm run build:esm-cjs && npm run build:umd",
|
|
23
|
+
"clean": "npm run clean:size && rimraf dist lib lib-esm",
|
|
24
|
+
"clean:size": "rimraf dual-publish-tmp tmp*",
|
|
25
|
+
"format": "echo \"Not implemented\"",
|
|
26
|
+
"lint": "eslint '**/*.{ts,tsx}' && npm run ts-coverage",
|
|
27
|
+
"lint:fix": "eslint '**/*.{ts,tsx}' --fix",
|
|
28
|
+
"ts-coverage": "typescript-coverage-report -p ./tsconfig.build.json -t 88"
|
|
29
|
+
},
|
|
30
|
+
"exports": {
|
|
31
|
+
".": {
|
|
32
|
+
"react-native": "./dist/cjs/index.js",
|
|
33
|
+
"types": "./dist/esm/index.d.ts",
|
|
34
|
+
"import": "./dist/esm/index.mjs",
|
|
35
|
+
"require": "./dist/cjs/index.js"
|
|
36
|
+
},
|
|
37
|
+
"./internals": {
|
|
38
|
+
"react-native": "./dist/cjs/internals/index.js",
|
|
39
|
+
"types": "./dist/esm/internals/index.d.ts",
|
|
40
|
+
"import": "./dist/esm/internals/index.mjs",
|
|
41
|
+
"require": "./dist/cjs/internals/index.js"
|
|
42
|
+
},
|
|
43
|
+
"./server": {
|
|
44
|
+
"types": "./dist/esm/server.d.ts",
|
|
45
|
+
"import": "./dist/esm/server.mjs",
|
|
46
|
+
"require": "./dist/cjs/server.js"
|
|
47
|
+
},
|
|
48
|
+
"./package.json": "./package.json"
|
|
49
|
+
},
|
|
50
|
+
"typesVersions": {
|
|
51
|
+
">=4.2": {
|
|
52
|
+
"internals": [
|
|
53
|
+
"./dist/esm/internals/index.d.ts"
|
|
54
|
+
],
|
|
55
|
+
"server": [
|
|
56
|
+
"./dist/esm/server.d.ts"
|
|
57
|
+
]
|
|
58
|
+
}
|
|
59
|
+
},
|
|
60
|
+
"repository": {
|
|
61
|
+
"type": "git",
|
|
62
|
+
"url": "https://github.com/aws-amplify/amplify-js.git"
|
|
63
|
+
},
|
|
64
|
+
"author": "Amazon Web Services",
|
|
65
|
+
"license": "Apache-2.0",
|
|
66
|
+
"bugs": {
|
|
67
|
+
"url": "https://github.com/aws/aws-amplify/issues"
|
|
68
|
+
},
|
|
69
|
+
"homepage": "https://aws-amplify.github.io/",
|
|
70
|
+
"devDependencies": {
|
|
71
|
+
"@aws-amplify/core": "0.0.0-changesets-preid-f620002-20260129130740",
|
|
72
|
+
"jest-fetch-mock": "3.0.3"
|
|
73
|
+
},
|
|
74
|
+
"files": [
|
|
75
|
+
"dist/cjs",
|
|
76
|
+
"dist/esm",
|
|
77
|
+
"src",
|
|
78
|
+
"index.*.d.ts",
|
|
79
|
+
"internals",
|
|
80
|
+
"server"
|
|
81
|
+
],
|
|
82
|
+
"dependencies": {
|
|
83
|
+
"@aws-amplify/api-graphql": "0.0.0-changesets-preid-f620002-20260129130740",
|
|
84
|
+
"@aws-amplify/api-rest": "0.0.0-changesets-preid-f620002-20260129130740",
|
|
85
|
+
"@aws-amplify/data-schema": "^1.7.0",
|
|
86
|
+
"rxjs": "^7.8.1",
|
|
87
|
+
"tslib": "^2.5.0"
|
|
88
|
+
},
|
|
89
|
+
"peerDependencies": {
|
|
90
|
+
"@aws-amplify/core": "0.0.0-changesets-preid-f620002-20260129130740"
|
|
91
|
+
}
|
|
92
|
+
}
|
package/src/API.ts
ADDED
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
|
|
2
|
+
// SPDX-License-Identifier: Apache-2.0
|
|
3
|
+
import { V6Client } from '@aws-amplify/api-graphql';
|
|
4
|
+
import {
|
|
5
|
+
CommonPublicClientOptions,
|
|
6
|
+
DefaultCommonClientOptions,
|
|
7
|
+
generateClient as internalGenerateClient,
|
|
8
|
+
} from '@aws-amplify/api-graphql/internals';
|
|
9
|
+
import { Amplify } from '@aws-amplify/core';
|
|
10
|
+
|
|
11
|
+
/**
|
|
12
|
+
* Generates an API client that can work with models or raw GraphQL
|
|
13
|
+
*
|
|
14
|
+
* @returns {@link V6Client}
|
|
15
|
+
* @throws {@link Error} - Throws error when client cannot be generated due to configuration issues.
|
|
16
|
+
*/
|
|
17
|
+
export function generateClient<
|
|
18
|
+
T extends Record<any, any> = never,
|
|
19
|
+
Options extends CommonPublicClientOptions = DefaultCommonClientOptions,
|
|
20
|
+
>(options?: Options): V6Client<T, Options> {
|
|
21
|
+
return internalGenerateClient({
|
|
22
|
+
...(options || ({} as any)),
|
|
23
|
+
amplify: Amplify,
|
|
24
|
+
}) as unknown as V6Client<T, Options>;
|
|
25
|
+
}
|
package/src/index.ts
ADDED
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
|
|
2
|
+
// SPDX-License-Identifier: Apache-2.0
|
|
3
|
+
|
|
4
|
+
import type { V6Client } from '@aws-amplify/api-graphql';
|
|
5
|
+
|
|
6
|
+
export { GraphQLQuery, GraphQLSubscription, SelectionSet } from './types';
|
|
7
|
+
export { generateClient } from './API';
|
|
8
|
+
|
|
9
|
+
export {
|
|
10
|
+
GraphQLAuthError,
|
|
11
|
+
ConnectionState,
|
|
12
|
+
EventsChannel,
|
|
13
|
+
EventsOptions,
|
|
14
|
+
} from '@aws-amplify/api-graphql';
|
|
15
|
+
|
|
16
|
+
export type {
|
|
17
|
+
GraphQLResult,
|
|
18
|
+
GraphQLReturnType,
|
|
19
|
+
} from '@aws-amplify/api-graphql';
|
|
20
|
+
|
|
21
|
+
export { CONNECTION_STATE_CHANGE, events } from '@aws-amplify/api-graphql';
|
|
22
|
+
|
|
23
|
+
// explicitly defaulting to `never` here resolves
|
|
24
|
+
// TS2589: Type instantiation is excessively deep and possibly infinite.
|
|
25
|
+
// When this type is used without a generic type arg, i.e. `let client: Client`
|
|
26
|
+
type Client<T extends Record<any, any> = never> = V6Client<T>;
|
|
27
|
+
export { Client };
|
|
28
|
+
|
|
29
|
+
export {
|
|
30
|
+
get,
|
|
31
|
+
put,
|
|
32
|
+
post,
|
|
33
|
+
del,
|
|
34
|
+
head,
|
|
35
|
+
patch,
|
|
36
|
+
isCancelError,
|
|
37
|
+
} from '@aws-amplify/api-rest';
|
|
38
|
+
|
|
39
|
+
export { ApiError } from '@aws-amplify/core/internals/utils';
|
|
@@ -0,0 +1,100 @@
|
|
|
1
|
+
// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
|
|
2
|
+
// SPDX-License-Identifier: Apache-2.0
|
|
3
|
+
import {
|
|
4
|
+
AWSAppSyncRealTimeProvider,
|
|
5
|
+
GraphQLOperation,
|
|
6
|
+
GraphQLOptions,
|
|
7
|
+
GraphQLQuery,
|
|
8
|
+
GraphQLResult,
|
|
9
|
+
GraphQLSubscription,
|
|
10
|
+
OperationTypeNode,
|
|
11
|
+
} from '@aws-amplify/api-graphql';
|
|
12
|
+
import { InternalGraphQLAPIClass } from '@aws-amplify/api-graphql/internals';
|
|
13
|
+
import { Amplify, Cache } from '@aws-amplify/core';
|
|
14
|
+
import {
|
|
15
|
+
ApiAction,
|
|
16
|
+
Category,
|
|
17
|
+
CustomUserAgentDetails,
|
|
18
|
+
} from '@aws-amplify/core/internals/utils';
|
|
19
|
+
import { Observable } from 'rxjs';
|
|
20
|
+
import { CustomHeaders } from '@aws-amplify/data-schema/runtime';
|
|
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
|
+
|
|
31
|
+
/**
|
|
32
|
+
* @deprecated
|
|
33
|
+
* Use RestApi or GraphQLAPI to reduce your application bundle size
|
|
34
|
+
* Export Cloud Logic APIs
|
|
35
|
+
*/
|
|
36
|
+
export class InternalAPIClass {
|
|
37
|
+
private _graphqlApi: InternalGraphQLAPIClass;
|
|
38
|
+
|
|
39
|
+
Cache = Cache;
|
|
40
|
+
|
|
41
|
+
/**
|
|
42
|
+
* Initialize API
|
|
43
|
+
*/
|
|
44
|
+
constructor() {
|
|
45
|
+
this._graphqlApi = new InternalGraphQLAPIClass();
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
public getModuleName() {
|
|
49
|
+
return 'InternalAPI';
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
/**
|
|
53
|
+
* to get the operation type
|
|
54
|
+
* @param operation
|
|
55
|
+
*/
|
|
56
|
+
getGraphqlOperationType(operation: GraphQLOperation): OperationTypeNode {
|
|
57
|
+
return this._graphqlApi.getGraphqlOperationType(operation);
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
/**
|
|
61
|
+
* Executes a GraphQL operation
|
|
62
|
+
*
|
|
63
|
+
* @param options - GraphQL Options
|
|
64
|
+
* @param [additionalHeaders] - headers to merge in after any `libraryConfigHeaders` set in the config
|
|
65
|
+
* @returns An Observable if queryType is 'subscription', else a promise of the graphql result from the query.
|
|
66
|
+
*/
|
|
67
|
+
graphql<T>(
|
|
68
|
+
options: GraphQLOptions,
|
|
69
|
+
additionalHeaders?: CustomHeaders,
|
|
70
|
+
customUserAgentDetails?: CustomUserAgentDetails,
|
|
71
|
+
): T extends GraphQLQuery<T>
|
|
72
|
+
? Promise<GraphQLResult<T>>
|
|
73
|
+
: T extends GraphQLSubscription<T>
|
|
74
|
+
? Observable<{
|
|
75
|
+
provider: AWSAppSyncRealTimeProvider;
|
|
76
|
+
value: GraphQLResult<T>;
|
|
77
|
+
}>
|
|
78
|
+
: Promise<GraphQLResult<any>> | Observable<object>;
|
|
79
|
+
|
|
80
|
+
graphql<_ = any>(
|
|
81
|
+
options: GraphQLOptions,
|
|
82
|
+
additionalHeaders?: CustomHeaders,
|
|
83
|
+
customUserAgentDetails?: CustomUserAgentDetails,
|
|
84
|
+
): Promise<GraphQLResult<any>> | Observable<object> {
|
|
85
|
+
const apiUserAgentDetails: CustomUserAgentDetails = {
|
|
86
|
+
category: Category.API,
|
|
87
|
+
action: ApiAction.GraphQl,
|
|
88
|
+
...customUserAgentDetails,
|
|
89
|
+
};
|
|
90
|
+
|
|
91
|
+
return this._graphqlApi.graphql(
|
|
92
|
+
Amplify,
|
|
93
|
+
options,
|
|
94
|
+
additionalHeaders,
|
|
95
|
+
apiUserAgentDetails,
|
|
96
|
+
);
|
|
97
|
+
}
|
|
98
|
+
}
|
|
99
|
+
|
|
100
|
+
export const InternalAPI = new InternalAPIClass();
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
|
|
2
|
+
// SPDX-License-Identifier: Apache-2.0
|
|
3
|
+
export { InternalAPI, InternalAPIClass } from './InternalAPI';
|
|
4
|
+
export { generateClientWithAmplifyInstance } from '@aws-amplify/api-graphql/internals/server';
|
|
5
|
+
export {
|
|
6
|
+
V6ClientSSRCookies,
|
|
7
|
+
V6ClientSSRRequest,
|
|
8
|
+
} from '@aws-amplify/api-graphql';
|
|
9
|
+
export {
|
|
10
|
+
CommonPublicClientOptions,
|
|
11
|
+
DefaultCommonClientOptions,
|
|
12
|
+
} from '@aws-amplify/api-graphql/internals';
|
package/src/server.ts
ADDED
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
|
|
2
|
+
// SPDX-License-Identifier: Apache-2.0
|
|
3
|
+
|
|
4
|
+
export {
|
|
5
|
+
get,
|
|
6
|
+
put,
|
|
7
|
+
post,
|
|
8
|
+
del,
|
|
9
|
+
head,
|
|
10
|
+
patch,
|
|
11
|
+
isCancelError,
|
|
12
|
+
} from '@aws-amplify/api-rest/server';
|
|
13
|
+
export { generateClient } from '@aws-amplify/api-graphql/server';
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
|
|
2
|
+
// SPDX-License-Identifier: Apache-2.0
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
* This exports from the types directory is a temporary workaround, since Amplify CLI currently
|
|
6
|
+
* generates code that relies on this import path https://github.com/aws-amplify/amplify-cli/issues/3863
|
|
7
|
+
* This will be removed in future release when CLI and customers moves to recommeneded import styles.
|
|
8
|
+
*/
|
|
9
|
+
export {
|
|
10
|
+
graphqlOperation,
|
|
11
|
+
GraphQLAuthError,
|
|
12
|
+
GraphQLResult,
|
|
13
|
+
GraphQLQuery,
|
|
14
|
+
GraphQLSubscription,
|
|
15
|
+
SelectionSet,
|
|
16
|
+
} from '@aws-amplify/api-graphql';
|