@aws-amplify/api-rest 0.0.0-unstable-1ca644b-20260128091132
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/apis/common/baseHandlers/authenticatedHandler.js +17 -0
- package/dist/cjs/apis/common/baseHandlers/authenticatedHandler.js.map +1 -0
- package/dist/cjs/apis/common/baseHandlers/unauthenticatedHandler.js +13 -0
- package/dist/cjs/apis/common/baseHandlers/unauthenticatedHandler.js.map +1 -0
- package/dist/cjs/apis/common/internalPost.js +98 -0
- package/dist/cjs/apis/common/internalPost.js.map +1 -0
- package/dist/cjs/apis/common/publicApis.js +57 -0
- package/dist/cjs/apis/common/publicApis.js.map +1 -0
- package/dist/cjs/apis/common/transferHandler.js +92 -0
- package/dist/cjs/apis/common/transferHandler.js.map +1 -0
- package/dist/cjs/apis/index.js +217 -0
- package/dist/cjs/apis/index.js.map +1 -0
- package/dist/cjs/apis/server.js +163 -0
- package/dist/cjs/apis/server.js.map +1 -0
- package/dist/cjs/errors/CanceledError.js +37 -0
- package/dist/cjs/errors/CanceledError.js.map +1 -0
- package/dist/cjs/errors/RestApiError.js +17 -0
- package/dist/cjs/errors/RestApiError.js.map +1 -0
- package/dist/cjs/errors/assertValidatonError.js +18 -0
- package/dist/cjs/errors/assertValidatonError.js.map +1 -0
- package/dist/cjs/errors/index.js +17 -0
- package/dist/cjs/errors/index.js.map +1 -0
- package/dist/cjs/errors/validation.js +17 -0
- package/dist/cjs/errors/validation.js.map +1 -0
- package/dist/cjs/index.js +16 -0
- package/dist/cjs/index.js.map +1 -0
- package/dist/cjs/internals/index.js +12 -0
- package/dist/cjs/internals/index.js.map +1 -0
- package/dist/cjs/internals/server.js +32 -0
- package/dist/cjs/internals/server.js.map +1 -0
- package/dist/cjs/server.js +16 -0
- package/dist/cjs/server.js.map +1 -0
- package/dist/cjs/types/index.js +4 -0
- package/dist/cjs/types/index.js.map +1 -0
- package/dist/cjs/utils/constants.js +15 -0
- package/dist/cjs/utils/constants.js.map +1 -0
- package/dist/cjs/utils/createCancellableOperation.js +76 -0
- package/dist/cjs/utils/createCancellableOperation.js.map +1 -0
- package/dist/cjs/utils/index.js +19 -0
- package/dist/cjs/utils/index.js.map +1 -0
- package/dist/cjs/utils/isIamAuthApplicable.js +39 -0
- package/dist/cjs/utils/isIamAuthApplicable.js.map +1 -0
- package/dist/cjs/utils/logger.js +9 -0
- package/dist/cjs/utils/logger.js.map +1 -0
- package/dist/cjs/utils/parseSigningInfo.js +43 -0
- package/dist/cjs/utils/parseSigningInfo.js.map +1 -0
- package/dist/cjs/utils/resolveApiUrl.js +48 -0
- package/dist/cjs/utils/resolveApiUrl.js.map +1 -0
- package/dist/cjs/utils/resolveHeaders.js +34 -0
- package/dist/cjs/utils/resolveHeaders.js.map +1 -0
- package/dist/cjs/utils/resolveLibraryOptions.js +16 -0
- package/dist/cjs/utils/resolveLibraryOptions.js.map +1 -0
- package/dist/cjs/utils/serviceError.js +98 -0
- package/dist/cjs/utils/serviceError.js.map +1 -0
- package/dist/esm/apis/common/baseHandlers/authenticatedHandler.d.ts +5 -0
- package/dist/esm/apis/common/baseHandlers/authenticatedHandler.mjs +16 -0
- package/dist/esm/apis/common/baseHandlers/authenticatedHandler.mjs.map +1 -0
- package/dist/esm/apis/common/baseHandlers/unauthenticatedHandler.d.ts +5 -0
- package/dist/esm/apis/common/baseHandlers/unauthenticatedHandler.mjs +12 -0
- package/dist/esm/apis/common/baseHandlers/unauthenticatedHandler.mjs.map +1 -0
- package/dist/esm/apis/common/internalPost.d.ts +43 -0
- package/dist/esm/apis/common/internalPost.mjs +98 -0
- package/dist/esm/apis/common/internalPost.mjs.map +1 -0
- package/dist/esm/apis/common/publicApis.d.ts +8 -0
- package/dist/esm/apis/common/publicApis.mjs +56 -0
- package/dist/esm/apis/common/publicApis.mjs.map +1 -0
- package/dist/esm/apis/common/transferHandler.d.ts +26 -0
- package/dist/esm/apis/common/transferHandler.mjs +95 -0
- package/dist/esm/apis/common/transferHandler.mjs.map +1 -0
- package/dist/esm/apis/index.d.ts +203 -0
- package/dist/esm/apis/index.mjs +210 -0
- package/dist/esm/apis/index.mjs.map +1 -0
- package/dist/esm/apis/server.d.ts +150 -0
- package/dist/esm/apis/server.mjs +156 -0
- package/dist/esm/apis/server.mjs.map +1 -0
- package/dist/esm/errors/CanceledError.d.ts +20 -0
- package/dist/esm/errors/CanceledError.mjs +34 -0
- package/dist/esm/errors/CanceledError.mjs.map +1 -0
- package/dist/esm/errors/RestApiError.d.ts +4 -0
- package/dist/esm/errors/RestApiError.mjs +15 -0
- package/dist/esm/errors/RestApiError.mjs.map +1 -0
- package/dist/esm/errors/assertValidatonError.d.ts +5 -0
- package/dist/esm/errors/assertValidatonError.mjs +17 -0
- package/dist/esm/errors/assertValidatonError.mjs.map +1 -0
- package/dist/esm/errors/index.d.ts +4 -0
- package/dist/esm/errors/index.mjs +5 -0
- package/dist/esm/errors/index.mjs.map +1 -0
- package/dist/esm/errors/validation.d.ts +5 -0
- package/dist/esm/errors/validation.mjs +15 -0
- package/dist/esm/errors/validation.mjs.map +1 -0
- package/dist/esm/index.d.ts +2 -0
- package/dist/esm/index.mjs +3 -0
- package/dist/esm/index.mjs.map +1 -0
- package/dist/esm/internals/index.d.ts +2 -0
- package/dist/esm/internals/index.mjs +2 -0
- package/dist/esm/internals/index.mjs.map +1 -0
- package/dist/esm/internals/server.d.ts +20 -0
- package/dist/esm/internals/server.mjs +28 -0
- package/dist/esm/internals/server.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 +122 -0
- package/dist/esm/types/index.mjs +2 -0
- package/dist/esm/types/index.mjs.map +1 -0
- package/dist/esm/utils/constants.d.ts +8 -0
- package/dist/esm/utils/constants.mjs +13 -0
- package/dist/esm/utils/constants.mjs.map +1 -0
- package/dist/esm/utils/createCancellableOperation.d.ts +12 -0
- package/dist/esm/utils/createCancellableOperation.mjs +77 -0
- package/dist/esm/utils/createCancellableOperation.mjs.map +1 -0
- package/dist/esm/utils/index.d.ts +6 -0
- package/dist/esm/utils/index.mjs +7 -0
- package/dist/esm/utils/index.mjs.map +1 -0
- package/dist/esm/utils/isIamAuthApplicable.d.ts +32 -0
- package/dist/esm/utils/isIamAuthApplicable.mjs +35 -0
- package/dist/esm/utils/isIamAuthApplicable.mjs.map +1 -0
- package/dist/esm/utils/logger.d.ts +2 -0
- package/dist/esm/utils/logger.mjs +8 -0
- package/dist/esm/utils/logger.mjs.map +1 -0
- package/dist/esm/utils/parseSigningInfo.d.ts +14 -0
- package/dist/esm/utils/parseSigningInfo.mjs +41 -0
- package/dist/esm/utils/parseSigningInfo.mjs.map +1 -0
- package/dist/esm/utils/resolveApiUrl.d.ts +12 -0
- package/dist/esm/utils/resolveApiUrl.mjs +48 -0
- package/dist/esm/utils/resolveApiUrl.mjs.map +1 -0
- package/dist/esm/utils/resolveHeaders.d.ts +1 -0
- package/dist/esm/utils/resolveHeaders.mjs +31 -0
- package/dist/esm/utils/resolveHeaders.mjs.map +1 -0
- package/dist/esm/utils/resolveLibraryOptions.d.ts +8 -0
- package/dist/esm/utils/resolveLibraryOptions.mjs +13 -0
- package/dist/esm/utils/resolveLibraryOptions.mjs.map +1 -0
- package/dist/esm/utils/serviceError.d.ts +13 -0
- package/dist/esm/utils/serviceError.mjs +97 -0
- package/dist/esm/utils/serviceError.mjs.map +1 -0
- package/internals/package.json +8 -0
- package/internals/server/package.json +7 -0
- package/package.json +94 -0
- package/server/package.json +7 -0
- package/src/apis/common/baseHandlers/authenticatedHandler.ts +28 -0
- package/src/apis/common/baseHandlers/unauthenticatedHandler.ts +22 -0
- package/src/apis/common/internalPost.ts +123 -0
- package/src/apis/common/publicApis.ts +118 -0
- package/src/apis/common/transferHandler.ts +154 -0
- package/src/apis/index.ts +241 -0
- package/src/apis/server.ts +210 -0
- package/src/errors/CanceledError.ts +37 -0
- package/src/errors/RestApiError.ts +14 -0
- package/src/errors/assertValidatonError.ts +19 -0
- package/src/errors/index.ts +7 -0
- package/src/errors/validation.ts +16 -0
- package/src/index.ts +5 -0
- package/src/internals/index.ts +8 -0
- package/src/internals/server.ts +37 -0
- package/src/server.ts +5 -0
- package/src/types/index.ts +138 -0
- package/src/utils/constants.ts +15 -0
- package/src/utils/createCancellableOperation.ts +108 -0
- package/src/utils/index.ts +9 -0
- package/src/utils/isIamAuthApplicable.ts +44 -0
- package/src/utils/logger.ts +6 -0
- package/src/utils/parseSigningInfo.ts +53 -0
- package/src/utils/resolveApiUrl.ts +59 -0
- package/src/utils/resolveHeaders.ts +36 -0
- package/src/utils/resolveLibraryOptions.ts +14 -0
- package/src/utils/serviceError.ts +109 -0
|
@@ -0,0 +1,163 @@
|
|
|
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.patch = exports.head = exports.del = exports.put = exports.post = exports.get = void 0;
|
|
7
|
+
const adapter_core_1 = require("@aws-amplify/core/internals/adapter-core");
|
|
8
|
+
const publicApis_1 = require("./common/publicApis");
|
|
9
|
+
/**
|
|
10
|
+
* GET HTTP request (server-side)
|
|
11
|
+
* @param {AmplifyServer.ContextSpec} contextSpec - The context spec used to get the Amplify server context.
|
|
12
|
+
* @param {GetInput} input - Input for GET operation.
|
|
13
|
+
* @throws - {@link RestApiError}
|
|
14
|
+
* @example
|
|
15
|
+
* Send a GET request
|
|
16
|
+
* ```js
|
|
17
|
+
* import { get } from 'aws-amplify/api/server';
|
|
18
|
+
* //...
|
|
19
|
+
* const restApiResponse = await runWithAmplifyServerContext({
|
|
20
|
+
* nextServerContext: { request, response },
|
|
21
|
+
* operation: async (contextSpec) => {
|
|
22
|
+
* try {
|
|
23
|
+
* const { body } = await get(contextSpec, input).response;
|
|
24
|
+
* return await body.json();
|
|
25
|
+
* } catch (error) {
|
|
26
|
+
* console.log(error);
|
|
27
|
+
* return false;
|
|
28
|
+
* }
|
|
29
|
+
* },
|
|
30
|
+
* });
|
|
31
|
+
* ```
|
|
32
|
+
*/
|
|
33
|
+
const get = (contextSpec, input) => (0, publicApis_1.get)((0, adapter_core_1.getAmplifyServerContext)(contextSpec).amplify, input);
|
|
34
|
+
exports.get = get;
|
|
35
|
+
/**
|
|
36
|
+
* POST HTTP request (server-side)
|
|
37
|
+
* @param {AmplifyServer.ContextSpec} contextSpec - The context spec used to get the Amplify server context.
|
|
38
|
+
* @param {PostInput} input - Input for POST operation.
|
|
39
|
+
* @throws - {@link RestApiError}
|
|
40
|
+
* @example
|
|
41
|
+
* Send a POST request
|
|
42
|
+
* ```js
|
|
43
|
+
* import { post } from 'aws-amplify/api/server';
|
|
44
|
+
* //...
|
|
45
|
+
* const restApiResponse = await runWithAmplifyServerContext({
|
|
46
|
+
* nextServerContext: { request, response },
|
|
47
|
+
* operation: async (contextSpec) => {
|
|
48
|
+
* try {
|
|
49
|
+
* const { body } = await post(contextSpec, input).response;
|
|
50
|
+
* return await body.json();
|
|
51
|
+
* } catch (error) {
|
|
52
|
+
* console.log(error);
|
|
53
|
+
* return false;
|
|
54
|
+
* }
|
|
55
|
+
* },
|
|
56
|
+
* });
|
|
57
|
+
* ```
|
|
58
|
+
*/
|
|
59
|
+
const post = (contextSpec, input) => (0, publicApis_1.post)((0, adapter_core_1.getAmplifyServerContext)(contextSpec).amplify, input);
|
|
60
|
+
exports.post = post;
|
|
61
|
+
/**
|
|
62
|
+
* PUT HTTP request (server-side)
|
|
63
|
+
* @param {AmplifyServer.ContextSpec} contextSpec - The context spec used to get the Amplify server context.
|
|
64
|
+
* @param {PutInput} input - Input for PUT operation.
|
|
65
|
+
* @throws - {@link RestApiError}
|
|
66
|
+
* @example
|
|
67
|
+
* Send a PUT request
|
|
68
|
+
* ```js
|
|
69
|
+
* import { put } from 'aws-amplify/api/server';
|
|
70
|
+
* //...
|
|
71
|
+
* const restApiResponse = await runWithAmplifyServerContext({
|
|
72
|
+
* nextServerContext: { request, response },
|
|
73
|
+
* operation: async (contextSpec) => {
|
|
74
|
+
* try {
|
|
75
|
+
* const { body } = await put(contextSpec, input).response;
|
|
76
|
+
* return await body.json();
|
|
77
|
+
* } catch (error) {
|
|
78
|
+
* console.log(error);
|
|
79
|
+
* return false;
|
|
80
|
+
* }
|
|
81
|
+
* },
|
|
82
|
+
* });
|
|
83
|
+
* ```
|
|
84
|
+
*/
|
|
85
|
+
const put = (contextSpec, input) => (0, publicApis_1.put)((0, adapter_core_1.getAmplifyServerContext)(contextSpec).amplify, input);
|
|
86
|
+
exports.put = put;
|
|
87
|
+
/**
|
|
88
|
+
* DELETE HTTP request (server-side)
|
|
89
|
+
* @param {AmplifyServer.ContextSpec} contextSpec - The context spec used to get the Amplify server context.
|
|
90
|
+
* @param {DeleteInput} input - Input for DELETE operation.
|
|
91
|
+
* @throws - {@link RestApiError}
|
|
92
|
+
* @example
|
|
93
|
+
* Send a DELETE request
|
|
94
|
+
* ```js
|
|
95
|
+
* import { del } from 'aws-amplify/api/server';
|
|
96
|
+
* //...
|
|
97
|
+
* const restApiResponse = await runWithAmplifyServerContext({
|
|
98
|
+
* nextServerContext: { request, response },
|
|
99
|
+
* operation: async (contextSpec) => {
|
|
100
|
+
* try {
|
|
101
|
+
* const { headers } = await del(contextSpec, input).response;
|
|
102
|
+
* } catch (error) {
|
|
103
|
+
* console.log(error);
|
|
104
|
+
* return false;
|
|
105
|
+
* }
|
|
106
|
+
* },
|
|
107
|
+
* });
|
|
108
|
+
* ```
|
|
109
|
+
*/
|
|
110
|
+
const del = (contextSpec, input) => (0, publicApis_1.del)((0, adapter_core_1.getAmplifyServerContext)(contextSpec).amplify, input);
|
|
111
|
+
exports.del = del;
|
|
112
|
+
/**
|
|
113
|
+
* HEAD HTTP request (server-side)
|
|
114
|
+
* @param {AmplifyServer.ContextSpec} contextSpec - The context spec used to get the Amplify server context.
|
|
115
|
+
* @param {HeadInput} input - Input for HEAD operation.
|
|
116
|
+
* @throws - {@link RestApiError}
|
|
117
|
+
* @example
|
|
118
|
+
* Send a HEAD request
|
|
119
|
+
* ```js
|
|
120
|
+
* import { head } from 'aws-amplify/api/server';
|
|
121
|
+
* //...
|
|
122
|
+
* const restApiResponse = await runWithAmplifyServerContext({
|
|
123
|
+
* nextServerContext: { request, response },
|
|
124
|
+
* operation: async (contextSpec) => {
|
|
125
|
+
* try {
|
|
126
|
+
* const { headers } = await head(contextSpec, input).response;
|
|
127
|
+
* } catch (error) {
|
|
128
|
+
* console.log(error);
|
|
129
|
+
* return false;
|
|
130
|
+
* }
|
|
131
|
+
* },
|
|
132
|
+
* });
|
|
133
|
+
* ```
|
|
134
|
+
*/
|
|
135
|
+
const head = (contextSpec, input) => (0, publicApis_1.head)((0, adapter_core_1.getAmplifyServerContext)(contextSpec).amplify, input);
|
|
136
|
+
exports.head = head;
|
|
137
|
+
/**
|
|
138
|
+
* PATCH HTTP request (server-side)
|
|
139
|
+
* @param {AmplifyServer.ContextSpec} contextSpec - The context spec used to get the Amplify server context.
|
|
140
|
+
* @param {PatchInput} input - Input for PATCH operation.
|
|
141
|
+
* @throws - {@link RestApiError}
|
|
142
|
+
* @example
|
|
143
|
+
* Send a PATCH request
|
|
144
|
+
* ```js
|
|
145
|
+
* import { patch } from 'aws-amplify/api/server';
|
|
146
|
+
* //...
|
|
147
|
+
* const restApiResponse = await runWithAmplifyServerContext({
|
|
148
|
+
* nextServerContext: { request, response },
|
|
149
|
+
* operation: async (contextSpec) => {
|
|
150
|
+
* try {
|
|
151
|
+
* const { body } = await patch(contextSpec, input).response;
|
|
152
|
+
* return await body.json();
|
|
153
|
+
* } catch (error) {
|
|
154
|
+
* console.log(error);
|
|
155
|
+
* return false;
|
|
156
|
+
* }
|
|
157
|
+
* },
|
|
158
|
+
* });
|
|
159
|
+
* ```
|
|
160
|
+
*/
|
|
161
|
+
const patch = (contextSpec, input) => (0, publicApis_1.patch)((0, adapter_core_1.getAmplifyServerContext)(contextSpec).amplify, input);
|
|
162
|
+
exports.patch = patch;
|
|
163
|
+
//# sourceMappingURL=server.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"server.js","sources":["../../../src/apis/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.patch = exports.head = exports.del = exports.put = exports.post = exports.get = void 0;\nconst adapter_core_1 = require(\"@aws-amplify/core/internals/adapter-core\");\nconst publicApis_1 = require(\"./common/publicApis\");\n/**\n * GET HTTP request (server-side)\n * @param {AmplifyServer.ContextSpec} contextSpec - The context spec used to get the Amplify server context.\n * @param {GetInput} input - Input for GET operation.\n * @throws - {@link RestApiError}\n * @example\n * Send a GET request\n * ```js\n * import { get } from 'aws-amplify/api/server';\n * //...\n * const restApiResponse = await runWithAmplifyServerContext({\n * nextServerContext: { request, response },\n * operation: async (contextSpec) => {\n * try {\n * const { body } = await get(contextSpec, input).response;\n * return await body.json();\n * } catch (error) {\n * console.log(error);\n * return false;\n * }\n * },\n * });\n * ```\n */\nconst get = (contextSpec, input) => (0, publicApis_1.get)((0, adapter_core_1.getAmplifyServerContext)(contextSpec).amplify, input);\nexports.get = get;\n/**\n * POST HTTP request (server-side)\n * @param {AmplifyServer.ContextSpec} contextSpec - The context spec used to get the Amplify server context.\n * @param {PostInput} input - Input for POST operation.\n * @throws - {@link RestApiError}\n * @example\n * Send a POST request\n * ```js\n * import { post } from 'aws-amplify/api/server';\n * //...\n * const restApiResponse = await runWithAmplifyServerContext({\n * nextServerContext: { request, response },\n * operation: async (contextSpec) => {\n * try {\n * const { body } = await post(contextSpec, input).response;\n * return await body.json();\n * } catch (error) {\n * console.log(error);\n * return false;\n * }\n * },\n * });\n * ```\n */\nconst post = (contextSpec, input) => (0, publicApis_1.post)((0, adapter_core_1.getAmplifyServerContext)(contextSpec).amplify, input);\nexports.post = post;\n/**\n * PUT HTTP request (server-side)\n * @param {AmplifyServer.ContextSpec} contextSpec - The context spec used to get the Amplify server context.\n * @param {PutInput} input - Input for PUT operation.\n * @throws - {@link RestApiError}\n * @example\n * Send a PUT request\n * ```js\n * import { put } from 'aws-amplify/api/server';\n * //...\n * const restApiResponse = await runWithAmplifyServerContext({\n * nextServerContext: { request, response },\n * operation: async (contextSpec) => {\n * try {\n * const { body } = await put(contextSpec, input).response;\n * return await body.json();\n * } catch (error) {\n * console.log(error);\n * return false;\n * }\n * },\n * });\n * ```\n */\nconst put = (contextSpec, input) => (0, publicApis_1.put)((0, adapter_core_1.getAmplifyServerContext)(contextSpec).amplify, input);\nexports.put = put;\n/**\n * DELETE HTTP request (server-side)\n * @param {AmplifyServer.ContextSpec} contextSpec - The context spec used to get the Amplify server context.\n * @param {DeleteInput} input - Input for DELETE operation.\n * @throws - {@link RestApiError}\n * @example\n * Send a DELETE request\n * ```js\n * import { del } from 'aws-amplify/api/server';\n * //...\n * const restApiResponse = await runWithAmplifyServerContext({\n * nextServerContext: { request, response },\n * operation: async (contextSpec) => {\n * try {\n * const { headers } = await del(contextSpec, input).response;\n * } catch (error) {\n * console.log(error);\n * return false;\n * }\n * },\n * });\n * ```\n */\nconst del = (contextSpec, input) => (0, publicApis_1.del)((0, adapter_core_1.getAmplifyServerContext)(contextSpec).amplify, input);\nexports.del = del;\n/**\n * HEAD HTTP request (server-side)\n * @param {AmplifyServer.ContextSpec} contextSpec - The context spec used to get the Amplify server context.\n * @param {HeadInput} input - Input for HEAD operation.\n * @throws - {@link RestApiError}\n * @example\n * Send a HEAD request\n * ```js\n * import { head } from 'aws-amplify/api/server';\n * //...\n * const restApiResponse = await runWithAmplifyServerContext({\n * nextServerContext: { request, response },\n * operation: async (contextSpec) => {\n * try {\n * const { headers } = await head(contextSpec, input).response;\n * } catch (error) {\n * console.log(error);\n * return false;\n * }\n * },\n * });\n * ```\n */\nconst head = (contextSpec, input) => (0, publicApis_1.head)((0, adapter_core_1.getAmplifyServerContext)(contextSpec).amplify, input);\nexports.head = head;\n/**\n * PATCH HTTP request (server-side)\n * @param {AmplifyServer.ContextSpec} contextSpec - The context spec used to get the Amplify server context.\n * @param {PatchInput} input - Input for PATCH operation.\n * @throws - {@link RestApiError}\n * @example\n * Send a PATCH request\n * ```js\n * import { patch } from 'aws-amplify/api/server';\n * //...\n * const restApiResponse = await runWithAmplifyServerContext({\n * nextServerContext: { request, response },\n * operation: async (contextSpec) => {\n * try {\n * const { body } = await patch(contextSpec, input).response;\n * return await body.json();\n * } catch (error) {\n * console.log(error);\n * return false;\n * }\n * },\n * });\n * ```\n */\nconst patch = (contextSpec, input) => (0, publicApis_1.patch)((0, adapter_core_1.getAmplifyServerContext)(contextSpec).amplify, input);\nexports.patch = patch;\n"],"names":[],"mappings":";;AACA;AACA;AACA,MAAM,CAAC,cAAc,CAAC,OAAO,EAAE,YAAY,EAAE,EAAE,KAAK,EAAE,IAAI,EAAE,CAAC;AAC7D,OAAO,CAAC,KAAK,GAAG,OAAO,CAAC,IAAI,GAAG,OAAO,CAAC,GAAG,GAAG,OAAO,CAAC,GAAG,GAAG,OAAO,CAAC,IAAI,GAAG,OAAO,CAAC,GAAG,GAAG,MAAM;AAC9F,MAAM,cAAc,GAAG,OAAO,CAAC,0CAA0C,CAAC;AAC1E,MAAM,YAAY,GAAG,OAAO,CAAC,qBAAqB,CAAC;AACnD;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,MAAM,GAAG,GAAG,CAAC,WAAW,EAAE,KAAK,KAAK,IAAI,YAAY,CAAC,GAAG,EAAE,IAAI,cAAc,CAAC,uBAAuB,EAAE,WAAW,CAAC,CAAC,OAAO,EAAE,KAAK,CAAC;AAClI,OAAO,CAAC,GAAG,GAAG,GAAG;AACjB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,MAAM,IAAI,GAAG,CAAC,WAAW,EAAE,KAAK,KAAK,IAAI,YAAY,CAAC,IAAI,EAAE,IAAI,cAAc,CAAC,uBAAuB,EAAE,WAAW,CAAC,CAAC,OAAO,EAAE,KAAK,CAAC;AACpI,OAAO,CAAC,IAAI,GAAG,IAAI;AACnB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,MAAM,GAAG,GAAG,CAAC,WAAW,EAAE,KAAK,KAAK,IAAI,YAAY,CAAC,GAAG,EAAE,IAAI,cAAc,CAAC,uBAAuB,EAAE,WAAW,CAAC,CAAC,OAAO,EAAE,KAAK,CAAC;AAClI,OAAO,CAAC,GAAG,GAAG,GAAG;AACjB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,MAAM,GAAG,GAAG,CAAC,WAAW,EAAE,KAAK,KAAK,IAAI,YAAY,CAAC,GAAG,EAAE,IAAI,cAAc,CAAC,uBAAuB,EAAE,WAAW,CAAC,CAAC,OAAO,EAAE,KAAK,CAAC;AAClI,OAAO,CAAC,GAAG,GAAG,GAAG;AACjB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,MAAM,IAAI,GAAG,CAAC,WAAW,EAAE,KAAK,KAAK,IAAI,YAAY,CAAC,IAAI,EAAE,IAAI,cAAc,CAAC,uBAAuB,EAAE,WAAW,CAAC,CAAC,OAAO,EAAE,KAAK,CAAC;AACpI,OAAO,CAAC,IAAI,GAAG,IAAI;AACnB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,MAAM,KAAK,GAAG,CAAC,WAAW,EAAE,KAAK,KAAK,IAAI,YAAY,CAAC,KAAK,EAAE,IAAI,cAAc,CAAC,uBAAuB,EAAE,WAAW,CAAC,CAAC,OAAO,EAAE,KAAK,CAAC;AACtI,OAAO,CAAC,KAAK,GAAG,KAAK;;"}
|
|
@@ -0,0 +1,37 @@
|
|
|
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.isCancelError = exports.CanceledError = void 0;
|
|
7
|
+
const RestApiError_1 = require("./RestApiError");
|
|
8
|
+
/**
|
|
9
|
+
* Internal-only class for CanceledError.
|
|
10
|
+
*
|
|
11
|
+
* @internal
|
|
12
|
+
*/
|
|
13
|
+
class CanceledError extends RestApiError_1.RestApiError {
|
|
14
|
+
constructor(params = {}) {
|
|
15
|
+
super({
|
|
16
|
+
name: 'CanceledError',
|
|
17
|
+
message: 'Request is canceled by user',
|
|
18
|
+
...params,
|
|
19
|
+
});
|
|
20
|
+
// TODO: Delete the following 2 lines after we change the build target to >= es2015
|
|
21
|
+
this.constructor = CanceledError;
|
|
22
|
+
Object.setPrototypeOf(this, CanceledError.prototype);
|
|
23
|
+
}
|
|
24
|
+
}
|
|
25
|
+
exports.CanceledError = CanceledError;
|
|
26
|
+
/**
|
|
27
|
+
* Check if an error is caused by user calling `cancel()` in REST API.
|
|
28
|
+
*
|
|
29
|
+
* @note This function works **ONLY** for errors thrown by REST API. For GraphQL APIs, use `client.isCancelError(error)`
|
|
30
|
+
* instead. `client` is generated from `generateClient()` API from `aws-amplify/api`.
|
|
31
|
+
*
|
|
32
|
+
* @param {unknown} error The unknown exception to be checked.
|
|
33
|
+
* @returns - A boolean indicating if the error was from an upload cancellation
|
|
34
|
+
*/
|
|
35
|
+
const isCancelError = (error) => !!error && error instanceof CanceledError;
|
|
36
|
+
exports.isCancelError = isCancelError;
|
|
37
|
+
//# sourceMappingURL=CanceledError.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"CanceledError.js","sources":["../../../src/errors/CanceledError.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.isCancelError = exports.CanceledError = void 0;\nconst RestApiError_1 = require(\"./RestApiError\");\n/**\n * Internal-only class for CanceledError.\n *\n * @internal\n */\nclass CanceledError extends RestApiError_1.RestApiError {\n constructor(params = {}) {\n super({\n name: 'CanceledError',\n message: 'Request is canceled by user',\n ...params,\n });\n // TODO: Delete the following 2 lines after we change the build target to >= es2015\n this.constructor = CanceledError;\n Object.setPrototypeOf(this, CanceledError.prototype);\n }\n}\nexports.CanceledError = CanceledError;\n/**\n * Check if an error is caused by user calling `cancel()` in REST API.\n *\n * @note This function works **ONLY** for errors thrown by REST API. For GraphQL APIs, use `client.isCancelError(error)`\n * instead. `client` is generated from `generateClient()` API from `aws-amplify/api`.\n *\n * @param {unknown} error The unknown exception to be checked.\n * @returns - A boolean indicating if the error was from an upload cancellation\n */\nconst isCancelError = (error) => !!error && error instanceof CanceledError;\nexports.isCancelError = isCancelError;\n"],"names":[],"mappings":";;AACA;AACA;AACA,MAAM,CAAC,cAAc,CAAC,OAAO,EAAE,YAAY,EAAE,EAAE,KAAK,EAAE,IAAI,EAAE,CAAC;AAC7D,OAAO,CAAC,aAAa,GAAG,OAAO,CAAC,aAAa,GAAG,MAAM;AACtD,MAAM,cAAc,GAAG,OAAO,CAAC,gBAAgB,CAAC;AAChD;AACA;AACA;AACA;AACA;AACA,MAAM,aAAa,SAAS,cAAc,CAAC,YAAY,CAAC;AACxD,IAAI,WAAW,CAAC,MAAM,GAAG,EAAE,EAAE;AAC7B,QAAQ,KAAK,CAAC;AACd,YAAY,IAAI,EAAE,eAAe;AACjC,YAAY,OAAO,EAAE,6BAA6B;AAClD,YAAY,GAAG,MAAM;AACrB,SAAS,CAAC;AACV;AACA,QAAQ,IAAI,CAAC,WAAW,GAAG,aAAa;AACxC,QAAQ,MAAM,CAAC,cAAc,CAAC,IAAI,EAAE,aAAa,CAAC,SAAS,CAAC;AAC5D,IAAI;AACJ;AACA,OAAO,CAAC,aAAa,GAAG,aAAa;AACrC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,MAAM,aAAa,GAAG,CAAC,KAAK,KAAK,CAAC,CAAC,KAAK,IAAI,KAAK,YAAY,aAAa;AAC1E,OAAO,CAAC,aAAa,GAAG,aAAa;;"}
|
|
@@ -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.RestApiError = void 0;
|
|
7
|
+
const utils_1 = require("@aws-amplify/core/internals/utils");
|
|
8
|
+
class RestApiError extends utils_1.ApiError {
|
|
9
|
+
constructor(params) {
|
|
10
|
+
super(params);
|
|
11
|
+
// TODO: Delete the following 2 lines after we change the build target to >= es2015
|
|
12
|
+
this.constructor = RestApiError;
|
|
13
|
+
Object.setPrototypeOf(this, RestApiError.prototype);
|
|
14
|
+
}
|
|
15
|
+
}
|
|
16
|
+
exports.RestApiError = RestApiError;
|
|
17
|
+
//# sourceMappingURL=RestApiError.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"RestApiError.js","sources":["../../../src/errors/RestApiError.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.RestApiError = void 0;\nconst utils_1 = require(\"@aws-amplify/core/internals/utils\");\nclass RestApiError extends utils_1.ApiError {\n constructor(params) {\n super(params);\n // TODO: Delete the following 2 lines after we change the build target to >= es2015\n this.constructor = RestApiError;\n Object.setPrototypeOf(this, RestApiError.prototype);\n }\n}\nexports.RestApiError = RestApiError;\n"],"names":[],"mappings":";;AACA;AACA;AACA,MAAM,CAAC,cAAc,CAAC,OAAO,EAAE,YAAY,EAAE,EAAE,KAAK,EAAE,IAAI,EAAE,CAAC;AAC7D,OAAO,CAAC,YAAY,GAAG,MAAM;AAC7B,MAAM,OAAO,GAAG,OAAO,CAAC,mCAAmC,CAAC;AAC5D,MAAM,YAAY,SAAS,OAAO,CAAC,QAAQ,CAAC;AAC5C,IAAI,WAAW,CAAC,MAAM,EAAE;AACxB,QAAQ,KAAK,CAAC,MAAM,CAAC;AACrB;AACA,QAAQ,IAAI,CAAC,WAAW,GAAG,YAAY;AACvC,QAAQ,MAAM,CAAC,cAAc,CAAC,IAAI,EAAE,YAAY,CAAC,SAAS,CAAC;AAC3D,IAAI;AACJ;AACA,OAAO,CAAC,YAAY,GAAG,YAAY;;"}
|
|
@@ -0,0 +1,18 @@
|
|
|
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.assertValidationError = assertValidationError;
|
|
7
|
+
const RestApiError_1 = require("./RestApiError");
|
|
8
|
+
const validation_1 = require("./validation");
|
|
9
|
+
/**
|
|
10
|
+
* @internal
|
|
11
|
+
*/
|
|
12
|
+
function assertValidationError(assertion, name) {
|
|
13
|
+
const { message, recoverySuggestion } = validation_1.validationErrorMap[name];
|
|
14
|
+
if (!assertion) {
|
|
15
|
+
throw new RestApiError_1.RestApiError({ name, message, recoverySuggestion });
|
|
16
|
+
}
|
|
17
|
+
}
|
|
18
|
+
//# sourceMappingURL=assertValidatonError.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"assertValidatonError.js","sources":["../../../src/errors/assertValidatonError.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.assertValidationError = assertValidationError;\nconst RestApiError_1 = require(\"./RestApiError\");\nconst validation_1 = require(\"./validation\");\n/**\n * @internal\n */\nfunction assertValidationError(assertion, name) {\n const { message, recoverySuggestion } = validation_1.validationErrorMap[name];\n if (!assertion) {\n throw new RestApiError_1.RestApiError({ name, message, recoverySuggestion });\n }\n}\n"],"names":[],"mappings":";;AACA;AACA;AACA,MAAM,CAAC,cAAc,CAAC,OAAO,EAAE,YAAY,EAAE,EAAE,KAAK,EAAE,IAAI,EAAE,CAAC;AAC7D,OAAO,CAAC,qBAAqB,GAAG,qBAAqB;AACrD,MAAM,cAAc,GAAG,OAAO,CAAC,gBAAgB,CAAC;AAChD,MAAM,YAAY,GAAG,OAAO,CAAC,cAAc,CAAC;AAC5C;AACA;AACA;AACA,SAAS,qBAAqB,CAAC,SAAS,EAAE,IAAI,EAAE;AAChD,IAAI,MAAM,EAAE,OAAO,EAAE,kBAAkB,EAAE,GAAG,YAAY,CAAC,kBAAkB,CAAC,IAAI,CAAC;AACjF,IAAI,IAAI,CAAC,SAAS,EAAE;AACpB,QAAQ,MAAM,IAAI,cAAc,CAAC,YAAY,CAAC,EAAE,IAAI,EAAE,OAAO,EAAE,kBAAkB,EAAE,CAAC;AACpF,IAAI;AACJ;;"}
|
|
@@ -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.validationErrorMap = exports.RestApiValidationErrorCode = exports.assertValidationError = exports.RestApiError = exports.isCancelError = exports.CanceledError = void 0;
|
|
7
|
+
var CanceledError_1 = require("./CanceledError");
|
|
8
|
+
Object.defineProperty(exports, "CanceledError", { enumerable: true, get: function () { return CanceledError_1.CanceledError; } });
|
|
9
|
+
Object.defineProperty(exports, "isCancelError", { enumerable: true, get: function () { return CanceledError_1.isCancelError; } });
|
|
10
|
+
var RestApiError_1 = require("./RestApiError");
|
|
11
|
+
Object.defineProperty(exports, "RestApiError", { enumerable: true, get: function () { return RestApiError_1.RestApiError; } });
|
|
12
|
+
var assertValidatonError_1 = require("./assertValidatonError");
|
|
13
|
+
Object.defineProperty(exports, "assertValidationError", { enumerable: true, get: function () { return assertValidatonError_1.assertValidationError; } });
|
|
14
|
+
var validation_1 = require("./validation");
|
|
15
|
+
Object.defineProperty(exports, "RestApiValidationErrorCode", { enumerable: true, get: function () { return validation_1.RestApiValidationErrorCode; } });
|
|
16
|
+
Object.defineProperty(exports, "validationErrorMap", { enumerable: true, get: function () { return validation_1.validationErrorMap; } });
|
|
17
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sources":["../../../src/errors/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.validationErrorMap = exports.RestApiValidationErrorCode = exports.assertValidationError = exports.RestApiError = exports.isCancelError = exports.CanceledError = void 0;\nvar CanceledError_1 = require(\"./CanceledError\");\nObject.defineProperty(exports, \"CanceledError\", { enumerable: true, get: function () { return CanceledError_1.CanceledError; } });\nObject.defineProperty(exports, \"isCancelError\", { enumerable: true, get: function () { return CanceledError_1.isCancelError; } });\nvar RestApiError_1 = require(\"./RestApiError\");\nObject.defineProperty(exports, \"RestApiError\", { enumerable: true, get: function () { return RestApiError_1.RestApiError; } });\nvar assertValidatonError_1 = require(\"./assertValidatonError\");\nObject.defineProperty(exports, \"assertValidationError\", { enumerable: true, get: function () { return assertValidatonError_1.assertValidationError; } });\nvar validation_1 = require(\"./validation\");\nObject.defineProperty(exports, \"RestApiValidationErrorCode\", { enumerable: true, get: function () { return validation_1.RestApiValidationErrorCode; } });\nObject.defineProperty(exports, \"validationErrorMap\", { enumerable: true, get: function () { return validation_1.validationErrorMap; } });\n"],"names":[],"mappings":";;AACA;AACA;AACA,MAAM,CAAC,cAAc,CAAC,OAAO,EAAE,YAAY,EAAE,EAAE,KAAK,EAAE,IAAI,EAAE,CAAC;AAC7D,OAAO,CAAC,kBAAkB,GAAG,OAAO,CAAC,0BAA0B,GAAG,OAAO,CAAC,qBAAqB,GAAG,OAAO,CAAC,YAAY,GAAG,OAAO,CAAC,aAAa,GAAG,OAAO,CAAC,aAAa,GAAG,MAAM;AAC/K,IAAI,eAAe,GAAG,OAAO,CAAC,iBAAiB,CAAC;AAChD,MAAM,CAAC,cAAc,CAAC,OAAO,EAAE,eAAe,EAAE,EAAE,UAAU,EAAE,IAAI,EAAE,GAAG,EAAE,YAAY,EAAE,OAAO,eAAe,CAAC,aAAa,CAAC,CAAC,CAAC,EAAE,CAAC;AACjI,MAAM,CAAC,cAAc,CAAC,OAAO,EAAE,eAAe,EAAE,EAAE,UAAU,EAAE,IAAI,EAAE,GAAG,EAAE,YAAY,EAAE,OAAO,eAAe,CAAC,aAAa,CAAC,CAAC,CAAC,EAAE,CAAC;AACjI,IAAI,cAAc,GAAG,OAAO,CAAC,gBAAgB,CAAC;AAC9C,MAAM,CAAC,cAAc,CAAC,OAAO,EAAE,cAAc,EAAE,EAAE,UAAU,EAAE,IAAI,EAAE,GAAG,EAAE,YAAY,EAAE,OAAO,cAAc,CAAC,YAAY,CAAC,CAAC,CAAC,EAAE,CAAC;AAC9H,IAAI,sBAAsB,GAAG,OAAO,CAAC,wBAAwB,CAAC;AAC9D,MAAM,CAAC,cAAc,CAAC,OAAO,EAAE,uBAAuB,EAAE,EAAE,UAAU,EAAE,IAAI,EAAE,GAAG,EAAE,YAAY,EAAE,OAAO,sBAAsB,CAAC,qBAAqB,CAAC,CAAC,CAAC,EAAE,CAAC;AACxJ,IAAI,YAAY,GAAG,OAAO,CAAC,cAAc,CAAC;AAC1C,MAAM,CAAC,cAAc,CAAC,OAAO,EAAE,4BAA4B,EAAE,EAAE,UAAU,EAAE,IAAI,EAAE,GAAG,EAAE,YAAY,EAAE,OAAO,YAAY,CAAC,0BAA0B,CAAC,CAAC,CAAC,EAAE,CAAC;AACxJ,MAAM,CAAC,cAAc,CAAC,OAAO,EAAE,oBAAoB,EAAE,EAAE,UAAU,EAAE,IAAI,EAAE,GAAG,EAAE,YAAY,EAAE,OAAO,YAAY,CAAC,kBAAkB,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.validationErrorMap = exports.RestApiValidationErrorCode = void 0;
|
|
7
|
+
var RestApiValidationErrorCode;
|
|
8
|
+
(function (RestApiValidationErrorCode) {
|
|
9
|
+
RestApiValidationErrorCode["InvalidApiName"] = "InvalidApiName";
|
|
10
|
+
})(RestApiValidationErrorCode || (exports.RestApiValidationErrorCode = RestApiValidationErrorCode = {}));
|
|
11
|
+
exports.validationErrorMap = {
|
|
12
|
+
[RestApiValidationErrorCode.InvalidApiName]: {
|
|
13
|
+
message: 'API name is invalid.',
|
|
14
|
+
recoverySuggestion: 'Check if the API name matches the one in your configuration or `aws-exports.js`',
|
|
15
|
+
},
|
|
16
|
+
};
|
|
17
|
+
//# sourceMappingURL=validation.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"validation.js","sources":["../../../src/errors/validation.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.validationErrorMap = exports.RestApiValidationErrorCode = void 0;\nvar RestApiValidationErrorCode;\n(function (RestApiValidationErrorCode) {\n RestApiValidationErrorCode[\"InvalidApiName\"] = \"InvalidApiName\";\n})(RestApiValidationErrorCode || (exports.RestApiValidationErrorCode = RestApiValidationErrorCode = {}));\nexports.validationErrorMap = {\n [RestApiValidationErrorCode.InvalidApiName]: {\n message: 'API name is invalid.',\n recoverySuggestion: 'Check if the API name matches the one in your configuration or `aws-exports.js`',\n },\n};\n"],"names":[],"mappings":";;AACA;AACA;AACA,MAAM,CAAC,cAAc,CAAC,OAAO,EAAE,YAAY,EAAE,EAAE,KAAK,EAAE,IAAI,EAAE,CAAC;AAC7D,OAAO,CAAC,kBAAkB,GAAG,OAAO,CAAC,0BAA0B,GAAG,MAAM;AACxE,IAAI,0BAA0B;AAC9B,CAAC,UAAU,0BAA0B,EAAE;AACvC,IAAI,0BAA0B,CAAC,gBAAgB,CAAC,GAAG,gBAAgB;AACnE,CAAC,EAAE,0BAA0B,KAAK,OAAO,CAAC,0BAA0B,GAAG,0BAA0B,GAAG,EAAE,CAAC,CAAC;AACxG,OAAO,CAAC,kBAAkB,GAAG;AAC7B,IAAI,CAAC,0BAA0B,CAAC,cAAc,GAAG;AACjD,QAAQ,OAAO,EAAE,sBAAsB;AACvC,QAAQ,kBAAkB,EAAE,iFAAiF;AAC7G,KAAK;AACL,CAAC;;"}
|
|
@@ -0,0 +1,16 @@
|
|
|
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.patch = exports.head = exports.del = exports.put = exports.post = exports.get = exports.isCancelError = void 0;
|
|
7
|
+
var CanceledError_1 = require("./errors/CanceledError");
|
|
8
|
+
Object.defineProperty(exports, "isCancelError", { enumerable: true, get: function () { return CanceledError_1.isCancelError; } });
|
|
9
|
+
var apis_1 = require("./apis");
|
|
10
|
+
Object.defineProperty(exports, "get", { enumerable: true, get: function () { return apis_1.get; } });
|
|
11
|
+
Object.defineProperty(exports, "post", { enumerable: true, get: function () { return apis_1.post; } });
|
|
12
|
+
Object.defineProperty(exports, "put", { enumerable: true, get: function () { return apis_1.put; } });
|
|
13
|
+
Object.defineProperty(exports, "del", { enumerable: true, get: function () { return apis_1.del; } });
|
|
14
|
+
Object.defineProperty(exports, "head", { enumerable: true, get: function () { return apis_1.head; } });
|
|
15
|
+
Object.defineProperty(exports, "patch", { enumerable: true, get: function () { return apis_1.patch; } });
|
|
16
|
+
//# 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.patch = exports.head = exports.del = exports.put = exports.post = exports.get = exports.isCancelError = void 0;\nvar CanceledError_1 = require(\"./errors/CanceledError\");\nObject.defineProperty(exports, \"isCancelError\", { enumerable: true, get: function () { return CanceledError_1.isCancelError; } });\nvar apis_1 = require(\"./apis\");\nObject.defineProperty(exports, \"get\", { enumerable: true, get: function () { return apis_1.get; } });\nObject.defineProperty(exports, \"post\", { enumerable: true, get: function () { return apis_1.post; } });\nObject.defineProperty(exports, \"put\", { enumerable: true, get: function () { return apis_1.put; } });\nObject.defineProperty(exports, \"del\", { enumerable: true, get: function () { return apis_1.del; } });\nObject.defineProperty(exports, \"head\", { enumerable: true, get: function () { return apis_1.head; } });\nObject.defineProperty(exports, \"patch\", { enumerable: true, get: function () { return apis_1.patch; } });\n"],"names":[],"mappings":";;AACA;AACA;AACA,MAAM,CAAC,cAAc,CAAC,OAAO,EAAE,YAAY,EAAE,EAAE,KAAK,EAAE,IAAI,EAAE,CAAC;AAC7D,OAAO,CAAC,KAAK,GAAG,OAAO,CAAC,IAAI,GAAG,OAAO,CAAC,GAAG,GAAG,OAAO,CAAC,GAAG,GAAG,OAAO,CAAC,IAAI,GAAG,OAAO,CAAC,GAAG,GAAG,OAAO,CAAC,aAAa,GAAG,MAAM;AACtH,IAAI,eAAe,GAAG,OAAO,CAAC,wBAAwB,CAAC;AACvD,MAAM,CAAC,cAAc,CAAC,OAAO,EAAE,eAAe,EAAE,EAAE,UAAU,EAAE,IAAI,EAAE,GAAG,EAAE,YAAY,EAAE,OAAO,eAAe,CAAC,aAAa,CAAC,CAAC,CAAC,EAAE,CAAC;AACjI,IAAI,MAAM,GAAG,OAAO,CAAC,QAAQ,CAAC;AAC9B,MAAM,CAAC,cAAc,CAAC,OAAO,EAAE,KAAK,EAAE,EAAE,UAAU,EAAE,IAAI,EAAE,GAAG,EAAE,YAAY,EAAE,OAAO,MAAM,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,CAAC;AACpG,MAAM,CAAC,cAAc,CAAC,OAAO,EAAE,MAAM,EAAE,EAAE,UAAU,EAAE,IAAI,EAAE,GAAG,EAAE,YAAY,EAAE,OAAO,MAAM,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,CAAC;AACtG,MAAM,CAAC,cAAc,CAAC,OAAO,EAAE,KAAK,EAAE,EAAE,UAAU,EAAE,IAAI,EAAE,GAAG,EAAE,YAAY,EAAE,OAAO,MAAM,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,CAAC;AACpG,MAAM,CAAC,cAAc,CAAC,OAAO,EAAE,KAAK,EAAE,EAAE,UAAU,EAAE,IAAI,EAAE,GAAG,EAAE,YAAY,EAAE,OAAO,MAAM,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,CAAC;AACpG,MAAM,CAAC,cAAc,CAAC,OAAO,EAAE,MAAM,EAAE,EAAE,UAAU,EAAE,IAAI,EAAE,GAAG,EAAE,YAAY,EAAE,OAAO,MAAM,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,CAAC;AACtG,MAAM,CAAC,cAAc,CAAC,OAAO,EAAE,OAAO,EAAE,EAAE,UAAU,EAAE,IAAI,EAAE,GAAG,EAAE,YAAY,EAAE,OAAO,MAAM,CAAC,KAAK,CAAC,CAAC,CAAC,EAAE,CAAC;;"}
|
|
@@ -0,0 +1,12 @@
|
|
|
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.updateRequestToBeCancellable = exports.cancel = exports.post = void 0;
|
|
7
|
+
var internalPost_1 = require("../apis/common/internalPost");
|
|
8
|
+
Object.defineProperty(exports, "post", { enumerable: true, get: function () { return internalPost_1.post; } });
|
|
9
|
+
var internalPost_2 = require("../apis/common/internalPost");
|
|
10
|
+
Object.defineProperty(exports, "cancel", { enumerable: true, get: function () { return internalPost_2.cancel; } });
|
|
11
|
+
Object.defineProperty(exports, "updateRequestToBeCancellable", { enumerable: true, get: function () { return internalPost_2.updateRequestToBeCancellable; } });
|
|
12
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sources":["../../../src/internals/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.updateRequestToBeCancellable = exports.cancel = exports.post = void 0;\nvar internalPost_1 = require(\"../apis/common/internalPost\");\nObject.defineProperty(exports, \"post\", { enumerable: true, get: function () { return internalPost_1.post; } });\nvar internalPost_2 = require(\"../apis/common/internalPost\");\nObject.defineProperty(exports, \"cancel\", { enumerable: true, get: function () { return internalPost_2.cancel; } });\nObject.defineProperty(exports, \"updateRequestToBeCancellable\", { enumerable: true, get: function () { return internalPost_2.updateRequestToBeCancellable; } });\n"],"names":[],"mappings":";;AACA;AACA;AACA,MAAM,CAAC,cAAc,CAAC,OAAO,EAAE,YAAY,EAAE,EAAE,KAAK,EAAE,IAAI,EAAE,CAAC;AAC7D,OAAO,CAAC,4BAA4B,GAAG,OAAO,CAAC,MAAM,GAAG,OAAO,CAAC,IAAI,GAAG,MAAM;AAC7E,IAAI,cAAc,GAAG,OAAO,CAAC,6BAA6B,CAAC;AAC3D,MAAM,CAAC,cAAc,CAAC,OAAO,EAAE,MAAM,EAAE,EAAE,UAAU,EAAE,IAAI,EAAE,GAAG,EAAE,YAAY,EAAE,OAAO,cAAc,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,CAAC;AAC9G,IAAI,cAAc,GAAG,OAAO,CAAC,6BAA6B,CAAC;AAC3D,MAAM,CAAC,cAAc,CAAC,OAAO,EAAE,QAAQ,EAAE,EAAE,UAAU,EAAE,IAAI,EAAE,GAAG,EAAE,YAAY,EAAE,OAAO,cAAc,CAAC,MAAM,CAAC,CAAC,CAAC,EAAE,CAAC;AAClH,MAAM,CAAC,cAAc,CAAC,OAAO,EAAE,8BAA8B,EAAE,EAAE,UAAU,EAAE,IAAI,EAAE,GAAG,EAAE,YAAY,EAAE,OAAO,cAAc,CAAC,4BAA4B,CAAC,CAAC,CAAC,EAAE,CAAC;;"}
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
4
|
+
exports.updateRequestToBeCancellable = exports.cancel = exports.post = void 0;
|
|
5
|
+
// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
|
|
6
|
+
// SPDX-License-Identifier: Apache-2.0
|
|
7
|
+
const adapter_core_1 = require("@aws-amplify/core/internals/adapter-core");
|
|
8
|
+
const internalPost_1 = require("../apis/common/internalPost");
|
|
9
|
+
/**
|
|
10
|
+
* Internal-only REST POST handler to send GraphQL request to given endpoint. By default, it will use IAM to authorize
|
|
11
|
+
* the request. In some auth modes, the IAM auth has to be disabled. Here's how to set up the request auth correctly:
|
|
12
|
+
* * If auth mode is 'iam', you MUST NOT set 'authorization' header and 'x-api-key' header, since it would disable IAM
|
|
13
|
+
* auth. You MUST also set 'input.options.signingServiceInfo' option.
|
|
14
|
+
* * The including 'input.options.signingServiceInfo.service' and 'input.options.signingServiceInfo.region' are
|
|
15
|
+
* optional. If omitted, the signing service and region will be inferred from url.
|
|
16
|
+
* * If auth mode is 'none', you MUST NOT set 'options.signingServiceInfo' option.
|
|
17
|
+
* * If auth mode is 'apiKey', you MUST set 'x-api-key' custom header.
|
|
18
|
+
* * If auth mode is 'oidc' or 'lambda' or 'userPool', you MUST set 'authorization' header.
|
|
19
|
+
*
|
|
20
|
+
* To make the internal post cancellable, you must also call `updateRequestToBeCancellable()` with the promise from
|
|
21
|
+
* internal post call and the abort controller supplied to the internal post call.
|
|
22
|
+
*
|
|
23
|
+
* @internal
|
|
24
|
+
*/
|
|
25
|
+
const post = (contextSpec, input) => {
|
|
26
|
+
return (0, internalPost_1.post)((0, adapter_core_1.getAmplifyServerContext)(contextSpec).amplify, input);
|
|
27
|
+
};
|
|
28
|
+
exports.post = post;
|
|
29
|
+
var internalPost_2 = require("../apis/common/internalPost");
|
|
30
|
+
Object.defineProperty(exports, "cancel", { enumerable: true, get: function () { return internalPost_2.cancel; } });
|
|
31
|
+
Object.defineProperty(exports, "updateRequestToBeCancellable", { enumerable: true, get: function () { return internalPost_2.updateRequestToBeCancellable; } });
|
|
32
|
+
//# sourceMappingURL=server.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"server.js","sources":["../../../src/internals/server.ts"],"sourcesContent":["\"use strict\";\nObject.defineProperty(exports, \"__esModule\", { value: true });\nexports.updateRequestToBeCancellable = exports.cancel = exports.post = void 0;\n// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\nconst adapter_core_1 = require(\"@aws-amplify/core/internals/adapter-core\");\nconst internalPost_1 = require(\"../apis/common/internalPost\");\n/**\n * Internal-only REST POST handler to send GraphQL request to given endpoint. By default, it will use IAM to authorize\n * the request. In some auth modes, the IAM auth has to be disabled. Here's how to set up the request auth correctly:\n * * If auth mode is 'iam', you MUST NOT set 'authorization' header and 'x-api-key' header, since it would disable IAM\n * auth. You MUST also set 'input.options.signingServiceInfo' option.\n * * The including 'input.options.signingServiceInfo.service' and 'input.options.signingServiceInfo.region' are\n * optional. If omitted, the signing service and region will be inferred from url.\n * * If auth mode is 'none', you MUST NOT set 'options.signingServiceInfo' option.\n * * If auth mode is 'apiKey', you MUST set 'x-api-key' custom header.\n * * If auth mode is 'oidc' or 'lambda' or 'userPool', you MUST set 'authorization' header.\n *\n * To make the internal post cancellable, you must also call `updateRequestToBeCancellable()` with the promise from\n * internal post call and the abort controller supplied to the internal post call.\n *\n * @internal\n */\nconst post = (contextSpec, input) => {\n return (0, internalPost_1.post)((0, adapter_core_1.getAmplifyServerContext)(contextSpec).amplify, input);\n};\nexports.post = post;\nvar internalPost_2 = require(\"../apis/common/internalPost\");\nObject.defineProperty(exports, \"cancel\", { enumerable: true, get: function () { return internalPost_2.cancel; } });\nObject.defineProperty(exports, \"updateRequestToBeCancellable\", { enumerable: true, get: function () { return internalPost_2.updateRequestToBeCancellable; } });\n"],"names":[],"mappings":";;AACA,MAAM,CAAC,cAAc,CAAC,OAAO,EAAE,YAAY,EAAE,EAAE,KAAK,EAAE,IAAI,EAAE,CAAC;AAC7D,OAAO,CAAC,4BAA4B,GAAG,OAAO,CAAC,MAAM,GAAG,OAAO,CAAC,IAAI,GAAG,MAAM;AAC7E;AACA;AACA,MAAM,cAAc,GAAG,OAAO,CAAC,0CAA0C,CAAC;AAC1E,MAAM,cAAc,GAAG,OAAO,CAAC,6BAA6B,CAAC;AAC7D;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,MAAM,IAAI,GAAG,CAAC,WAAW,EAAE,KAAK,KAAK;AACrC,IAAI,OAAO,IAAI,cAAc,CAAC,IAAI,EAAE,IAAI,cAAc,CAAC,uBAAuB,EAAE,WAAW,CAAC,CAAC,OAAO,EAAE,KAAK,CAAC;AAC5G,CAAC;AACD,OAAO,CAAC,IAAI,GAAG,IAAI;AACnB,IAAI,cAAc,GAAG,OAAO,CAAC,6BAA6B,CAAC;AAC3D,MAAM,CAAC,cAAc,CAAC,OAAO,EAAE,QAAQ,EAAE,EAAE,UAAU,EAAE,IAAI,EAAE,GAAG,EAAE,YAAY,EAAE,OAAO,cAAc,CAAC,MAAM,CAAC,CAAC,CAAC,EAAE,CAAC;AAClH,MAAM,CAAC,cAAc,CAAC,OAAO,EAAE,8BAA8B,EAAE,EAAE,UAAU,EAAE,IAAI,EAAE,GAAG,EAAE,YAAY,EAAE,OAAO,cAAc,CAAC,4BAA4B,CAAC,CAAC,CAAC,EAAE,CAAC;;"}
|
|
@@ -0,0 +1,16 @@
|
|
|
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.patch = exports.head = exports.del = exports.put = exports.post = exports.get = exports.isCancelError = void 0;
|
|
7
|
+
var CanceledError_1 = require("./errors/CanceledError");
|
|
8
|
+
Object.defineProperty(exports, "isCancelError", { enumerable: true, get: function () { return CanceledError_1.isCancelError; } });
|
|
9
|
+
var server_1 = require("./apis/server");
|
|
10
|
+
Object.defineProperty(exports, "get", { enumerable: true, get: function () { return server_1.get; } });
|
|
11
|
+
Object.defineProperty(exports, "post", { enumerable: true, get: function () { return server_1.post; } });
|
|
12
|
+
Object.defineProperty(exports, "put", { enumerable: true, get: function () { return server_1.put; } });
|
|
13
|
+
Object.defineProperty(exports, "del", { enumerable: true, get: function () { return server_1.del; } });
|
|
14
|
+
Object.defineProperty(exports, "head", { enumerable: true, get: function () { return server_1.head; } });
|
|
15
|
+
Object.defineProperty(exports, "patch", { enumerable: true, get: function () { return server_1.patch; } });
|
|
16
|
+
//# 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.patch = exports.head = exports.del = exports.put = exports.post = exports.get = exports.isCancelError = void 0;\nvar CanceledError_1 = require(\"./errors/CanceledError\");\nObject.defineProperty(exports, \"isCancelError\", { enumerable: true, get: function () { return CanceledError_1.isCancelError; } });\nvar server_1 = require(\"./apis/server\");\nObject.defineProperty(exports, \"get\", { enumerable: true, get: function () { return server_1.get; } });\nObject.defineProperty(exports, \"post\", { enumerable: true, get: function () { return server_1.post; } });\nObject.defineProperty(exports, \"put\", { enumerable: true, get: function () { return server_1.put; } });\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; } });\n"],"names":[],"mappings":";;AACA;AACA;AACA,MAAM,CAAC,cAAc,CAAC,OAAO,EAAE,YAAY,EAAE,EAAE,KAAK,EAAE,IAAI,EAAE,CAAC;AAC7D,OAAO,CAAC,KAAK,GAAG,OAAO,CAAC,IAAI,GAAG,OAAO,CAAC,GAAG,GAAG,OAAO,CAAC,GAAG,GAAG,OAAO,CAAC,IAAI,GAAG,OAAO,CAAC,GAAG,GAAG,OAAO,CAAC,aAAa,GAAG,MAAM;AACtH,IAAI,eAAe,GAAG,OAAO,CAAC,wBAAwB,CAAC;AACvD,MAAM,CAAC,cAAc,CAAC,OAAO,EAAE,eAAe,EAAE,EAAE,UAAU,EAAE,IAAI,EAAE,GAAG,EAAE,YAAY,EAAE,OAAO,eAAe,CAAC,aAAa,CAAC,CAAC,CAAC,EAAE,CAAC;AACjI,IAAI,QAAQ,GAAG,OAAO,CAAC,eAAe,CAAC;AACvC,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,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;;"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sources":["../../../src/types/index.ts"],"sourcesContent":["\"use strict\";\nObject.defineProperty(exports, \"__esModule\", { value: true });\n"],"names":[],"mappings":";;AACA,MAAM,CAAC,cAAc,CAAC,OAAO,EAAE,YAAY,EAAE,EAAE,KAAK,EAAE,IAAI,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.APIG_HOSTNAME_PATTERN = exports.DEFAULT_IAM_SIGNING_REGION = exports.DEFAULT_APPSYNC_API_SERVICE = exports.DEFAULT_REST_IAM_SIGNING_SERVICE = void 0;
|
|
7
|
+
exports.DEFAULT_REST_IAM_SIGNING_SERVICE = 'execute-api';
|
|
8
|
+
exports.DEFAULT_APPSYNC_API_SERVICE = 'appsync-api';
|
|
9
|
+
exports.DEFAULT_IAM_SIGNING_REGION = 'us-east-1';
|
|
10
|
+
/**
|
|
11
|
+
* The REST endpoints generated by API Gateway
|
|
12
|
+
* @see {@link https://docs.aws.amazon.com/general/latest/gr/apigateway.html#apigateway_region_data_plane}
|
|
13
|
+
*/
|
|
14
|
+
exports.APIG_HOSTNAME_PATTERN = /^.+\.([a-z0-9-]+)\.([a-z0-9-]+)\.amazonaws\.com/;
|
|
15
|
+
//# sourceMappingURL=constants.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"constants.js","sources":["../../../src/utils/constants.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.APIG_HOSTNAME_PATTERN = exports.DEFAULT_IAM_SIGNING_REGION = exports.DEFAULT_APPSYNC_API_SERVICE = exports.DEFAULT_REST_IAM_SIGNING_SERVICE = void 0;\nexports.DEFAULT_REST_IAM_SIGNING_SERVICE = 'execute-api';\nexports.DEFAULT_APPSYNC_API_SERVICE = 'appsync-api';\nexports.DEFAULT_IAM_SIGNING_REGION = 'us-east-1';\n/**\n * The REST endpoints generated by API Gateway\n * @see {@link https://docs.aws.amazon.com/general/latest/gr/apigateway.html#apigateway_region_data_plane}\n */\nexports.APIG_HOSTNAME_PATTERN = /^.+\\.([a-z0-9-]+)\\.([a-z0-9-]+)\\.amazonaws\\.com/;\n"],"names":[],"mappings":";;AACA;AACA;AACA,MAAM,CAAC,cAAc,CAAC,OAAO,EAAE,YAAY,EAAE,EAAE,KAAK,EAAE,IAAI,EAAE,CAAC;AAC7D,OAAO,CAAC,qBAAqB,GAAG,OAAO,CAAC,0BAA0B,GAAG,OAAO,CAAC,2BAA2B,GAAG,OAAO,CAAC,gCAAgC,GAAG,MAAM;AAC5J,OAAO,CAAC,gCAAgC,GAAG,aAAa;AACxD,OAAO,CAAC,2BAA2B,GAAG,aAAa;AACnD,OAAO,CAAC,0BAA0B,GAAG,WAAW;AAChD;AACA;AACA;AACA;AACA,OAAO,CAAC,qBAAqB,GAAG,iDAAiD;;"}
|
|
@@ -0,0 +1,76 @@
|
|
|
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.createCancellableOperation = createCancellableOperation;
|
|
7
|
+
const errors_1 = require("../errors");
|
|
8
|
+
const serviceError_1 = require("./serviceError");
|
|
9
|
+
const logger_1 = require("./logger");
|
|
10
|
+
/**
|
|
11
|
+
* @internal
|
|
12
|
+
*/
|
|
13
|
+
function createCancellableOperation(handler, abortController, operationType, timeout) {
|
|
14
|
+
const abortSignal = abortController.signal;
|
|
15
|
+
let abortReason;
|
|
16
|
+
if (timeout != null) {
|
|
17
|
+
if (timeout < 0) {
|
|
18
|
+
throw new Error('Timeout must be a non-negative number');
|
|
19
|
+
}
|
|
20
|
+
setTimeout(() => {
|
|
21
|
+
abortReason = 'TimeoutError';
|
|
22
|
+
abortController.abort(abortReason);
|
|
23
|
+
}, timeout);
|
|
24
|
+
}
|
|
25
|
+
const job = async () => {
|
|
26
|
+
try {
|
|
27
|
+
const response = await handler();
|
|
28
|
+
if (response.statusCode >= 300) {
|
|
29
|
+
throw await (0, serviceError_1.parseRestApiServiceError)(response);
|
|
30
|
+
}
|
|
31
|
+
return response;
|
|
32
|
+
}
|
|
33
|
+
catch (error) {
|
|
34
|
+
if (error.name === 'AbortError' || abortSignal?.aborted === true) {
|
|
35
|
+
// Check if timeout caused the abort
|
|
36
|
+
const isTimeout = abortReason && abortReason === 'TimeoutError';
|
|
37
|
+
if (isTimeout) {
|
|
38
|
+
const timeoutError = new Error(`Request timeout after ${timeout}ms`);
|
|
39
|
+
timeoutError.name = 'TimeoutError';
|
|
40
|
+
logger_1.logger.debug(timeoutError);
|
|
41
|
+
throw timeoutError;
|
|
42
|
+
}
|
|
43
|
+
else {
|
|
44
|
+
const message = abortReason ?? abortSignal.reason;
|
|
45
|
+
const canceledError = new errors_1.CanceledError({
|
|
46
|
+
...(message && { message }),
|
|
47
|
+
underlyingError: error,
|
|
48
|
+
recoverySuggestion: 'The API request was explicitly canceled. If this is not intended, validate if you called the `cancel()` function on the API request erroneously.',
|
|
49
|
+
});
|
|
50
|
+
logger_1.logger.debug(canceledError);
|
|
51
|
+
throw canceledError;
|
|
52
|
+
}
|
|
53
|
+
}
|
|
54
|
+
logger_1.logger.debug(error);
|
|
55
|
+
throw error;
|
|
56
|
+
}
|
|
57
|
+
};
|
|
58
|
+
if (operationType === 'internal') {
|
|
59
|
+
return job();
|
|
60
|
+
}
|
|
61
|
+
else {
|
|
62
|
+
const cancel = (abortMessage) => {
|
|
63
|
+
if (abortSignal.aborted === true) {
|
|
64
|
+
return;
|
|
65
|
+
}
|
|
66
|
+
abortController.abort(abortMessage);
|
|
67
|
+
// If abort reason is not supported, set a scoped reasons instead. The reason property inside an
|
|
68
|
+
// AbortSignal is a readonly property and trying to set it would throw an error.
|
|
69
|
+
if (abortMessage && abortSignal.reason !== abortMessage) {
|
|
70
|
+
abortReason = abortMessage;
|
|
71
|
+
}
|
|
72
|
+
};
|
|
73
|
+
return { response: job(), cancel };
|
|
74
|
+
}
|
|
75
|
+
}
|
|
76
|
+
//# sourceMappingURL=createCancellableOperation.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"createCancellableOperation.js","sources":["../../../src/utils/createCancellableOperation.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.createCancellableOperation = createCancellableOperation;\nconst errors_1 = require(\"../errors\");\nconst serviceError_1 = require(\"./serviceError\");\nconst logger_1 = require(\"./logger\");\n/**\n * @internal\n */\nfunction createCancellableOperation(handler, abortController, operationType, timeout) {\n const abortSignal = abortController.signal;\n let abortReason;\n if (timeout != null) {\n if (timeout < 0) {\n throw new Error('Timeout must be a non-negative number');\n }\n setTimeout(() => {\n abortReason = 'TimeoutError';\n abortController.abort(abortReason);\n }, timeout);\n }\n const job = async () => {\n try {\n const response = await handler();\n if (response.statusCode >= 300) {\n throw await (0, serviceError_1.parseRestApiServiceError)(response);\n }\n return response;\n }\n catch (error) {\n if (error.name === 'AbortError' || abortSignal?.aborted === true) {\n // Check if timeout caused the abort\n const isTimeout = abortReason && abortReason === 'TimeoutError';\n if (isTimeout) {\n const timeoutError = new Error(`Request timeout after ${timeout}ms`);\n timeoutError.name = 'TimeoutError';\n logger_1.logger.debug(timeoutError);\n throw timeoutError;\n }\n else {\n const message = abortReason ?? abortSignal.reason;\n const canceledError = new errors_1.CanceledError({\n ...(message && { message }),\n underlyingError: error,\n recoverySuggestion: 'The API request was explicitly canceled. If this is not intended, validate if you called the `cancel()` function on the API request erroneously.',\n });\n logger_1.logger.debug(canceledError);\n throw canceledError;\n }\n }\n logger_1.logger.debug(error);\n throw error;\n }\n };\n if (operationType === 'internal') {\n return job();\n }\n else {\n const cancel = (abortMessage) => {\n if (abortSignal.aborted === true) {\n return;\n }\n abortController.abort(abortMessage);\n // If abort reason is not supported, set a scoped reasons instead. The reason property inside an\n // AbortSignal is a readonly property and trying to set it would throw an error.\n if (abortMessage && abortSignal.reason !== abortMessage) {\n abortReason = abortMessage;\n }\n };\n return { response: job(), cancel };\n }\n}\n"],"names":[],"mappings":";;AACA;AACA;AACA,MAAM,CAAC,cAAc,CAAC,OAAO,EAAE,YAAY,EAAE,EAAE,KAAK,EAAE,IAAI,EAAE,CAAC;AAC7D,OAAO,CAAC,0BAA0B,GAAG,0BAA0B;AAC/D,MAAM,QAAQ,GAAG,OAAO,CAAC,WAAW,CAAC;AACrC,MAAM,cAAc,GAAG,OAAO,CAAC,gBAAgB,CAAC;AAChD,MAAM,QAAQ,GAAG,OAAO,CAAC,UAAU,CAAC;AACpC;AACA;AACA;AACA,SAAS,0BAA0B,CAAC,OAAO,EAAE,eAAe,EAAE,aAAa,EAAE,OAAO,EAAE;AACtF,IAAI,MAAM,WAAW,GAAG,eAAe,CAAC,MAAM;AAC9C,IAAI,IAAI,WAAW;AACnB,IAAI,IAAI,OAAO,IAAI,IAAI,EAAE;AACzB,QAAQ,IAAI,OAAO,GAAG,CAAC,EAAE;AACzB,YAAY,MAAM,IAAI,KAAK,CAAC,uCAAuC,CAAC;AACpE,QAAQ;AACR,QAAQ,UAAU,CAAC,MAAM;AACzB,YAAY,WAAW,GAAG,cAAc;AACxC,YAAY,eAAe,CAAC,KAAK,CAAC,WAAW,CAAC;AAC9C,QAAQ,CAAC,EAAE,OAAO,CAAC;AACnB,IAAI;AACJ,IAAI,MAAM,GAAG,GAAG,YAAY;AAC5B,QAAQ,IAAI;AACZ,YAAY,MAAM,QAAQ,GAAG,MAAM,OAAO,EAAE;AAC5C,YAAY,IAAI,QAAQ,CAAC,UAAU,IAAI,GAAG,EAAE;AAC5C,gBAAgB,MAAM,MAAM,CAAC,CAAC,EAAE,cAAc,CAAC,wBAAwB,EAAE,QAAQ,CAAC;AAClF,YAAY;AACZ,YAAY,OAAO,QAAQ;AAC3B,QAAQ;AACR,QAAQ,OAAO,KAAK,EAAE;AACtB,YAAY,IAAI,KAAK,CAAC,IAAI,KAAK,YAAY,IAAI,WAAW,EAAE,OAAO,KAAK,IAAI,EAAE;AAC9E;AACA,gBAAgB,MAAM,SAAS,GAAG,WAAW,IAAI,WAAW,KAAK,cAAc;AAC/E,gBAAgB,IAAI,SAAS,EAAE;AAC/B,oBAAoB,MAAM,YAAY,GAAG,IAAI,KAAK,CAAC,CAAC,sBAAsB,EAAE,OAAO,CAAC,EAAE,CAAC,CAAC;AACxF,oBAAoB,YAAY,CAAC,IAAI,GAAG,cAAc;AACtD,oBAAoB,QAAQ,CAAC,MAAM,CAAC,KAAK,CAAC,YAAY,CAAC;AACvD,oBAAoB,MAAM,YAAY;AACtC,gBAAgB;AAChB,qBAAqB;AACrB,oBAAoB,MAAM,OAAO,GAAG,WAAW,IAAI,WAAW,CAAC,MAAM;AACrE,oBAAoB,MAAM,aAAa,GAAG,IAAI,QAAQ,CAAC,aAAa,CAAC;AACrE,wBAAwB,IAAI,OAAO,IAAI,EAAE,OAAO,EAAE,CAAC;AACnD,wBAAwB,eAAe,EAAE,KAAK;AAC9C,wBAAwB,kBAAkB,EAAE,kJAAkJ;AAC9L,qBAAqB,CAAC;AACtB,oBAAoB,QAAQ,CAAC,MAAM,CAAC,KAAK,CAAC,aAAa,CAAC;AACxD,oBAAoB,MAAM,aAAa;AACvC,gBAAgB;AAChB,YAAY;AACZ,YAAY,QAAQ,CAAC,MAAM,CAAC,KAAK,CAAC,KAAK,CAAC;AACxC,YAAY,MAAM,KAAK;AACvB,QAAQ;AACR,IAAI,CAAC;AACL,IAAI,IAAI,aAAa,KAAK,UAAU,EAAE;AACtC,QAAQ,OAAO,GAAG,EAAE;AACpB,IAAI;AACJ,SAAS;AACT,QAAQ,MAAM,MAAM,GAAG,CAAC,YAAY,KAAK;AACzC,YAAY,IAAI,WAAW,CAAC,OAAO,KAAK,IAAI,EAAE;AAC9C,gBAAgB;AAChB,YAAY;AACZ,YAAY,eAAe,CAAC,KAAK,CAAC,YAAY,CAAC;AAC/C;AACA;AACA,YAAY,IAAI,YAAY,IAAI,WAAW,CAAC,MAAM,KAAK,YAAY,EAAE;AACrE,gBAAgB,WAAW,GAAG,YAAY;AAC1C,YAAY;AACZ,QAAQ,CAAC;AACT,QAAQ,OAAO,EAAE,QAAQ,EAAE,GAAG,EAAE,EAAE,MAAM,EAAE;AAC1C,IAAI;AACJ;;"}
|
|
@@ -0,0 +1,19 @@
|
|
|
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.logger = exports.resolveLibraryOptions = exports.resolveApiUrl = exports.parseRestApiServiceError = exports.parseSigningInfo = exports.createCancellableOperation = void 0;
|
|
7
|
+
var createCancellableOperation_1 = require("./createCancellableOperation");
|
|
8
|
+
Object.defineProperty(exports, "createCancellableOperation", { enumerable: true, get: function () { return createCancellableOperation_1.createCancellableOperation; } });
|
|
9
|
+
var parseSigningInfo_1 = require("./parseSigningInfo");
|
|
10
|
+
Object.defineProperty(exports, "parseSigningInfo", { enumerable: true, get: function () { return parseSigningInfo_1.parseSigningInfo; } });
|
|
11
|
+
var serviceError_1 = require("./serviceError");
|
|
12
|
+
Object.defineProperty(exports, "parseRestApiServiceError", { enumerable: true, get: function () { return serviceError_1.parseRestApiServiceError; } });
|
|
13
|
+
var resolveApiUrl_1 = require("./resolveApiUrl");
|
|
14
|
+
Object.defineProperty(exports, "resolveApiUrl", { enumerable: true, get: function () { return resolveApiUrl_1.resolveApiUrl; } });
|
|
15
|
+
var resolveLibraryOptions_1 = require("./resolveLibraryOptions");
|
|
16
|
+
Object.defineProperty(exports, "resolveLibraryOptions", { enumerable: true, get: function () { return resolveLibraryOptions_1.resolveLibraryOptions; } });
|
|
17
|
+
var logger_1 = require("./logger");
|
|
18
|
+
Object.defineProperty(exports, "logger", { enumerable: true, get: function () { return logger_1.logger; } });
|
|
19
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sources":["../../../src/utils/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.logger = exports.resolveLibraryOptions = exports.resolveApiUrl = exports.parseRestApiServiceError = exports.parseSigningInfo = exports.createCancellableOperation = void 0;\nvar createCancellableOperation_1 = require(\"./createCancellableOperation\");\nObject.defineProperty(exports, \"createCancellableOperation\", { enumerable: true, get: function () { return createCancellableOperation_1.createCancellableOperation; } });\nvar parseSigningInfo_1 = require(\"./parseSigningInfo\");\nObject.defineProperty(exports, \"parseSigningInfo\", { enumerable: true, get: function () { return parseSigningInfo_1.parseSigningInfo; } });\nvar serviceError_1 = require(\"./serviceError\");\nObject.defineProperty(exports, \"parseRestApiServiceError\", { enumerable: true, get: function () { return serviceError_1.parseRestApiServiceError; } });\nvar resolveApiUrl_1 = require(\"./resolveApiUrl\");\nObject.defineProperty(exports, \"resolveApiUrl\", { enumerable: true, get: function () { return resolveApiUrl_1.resolveApiUrl; } });\nvar resolveLibraryOptions_1 = require(\"./resolveLibraryOptions\");\nObject.defineProperty(exports, \"resolveLibraryOptions\", { enumerable: true, get: function () { return resolveLibraryOptions_1.resolveLibraryOptions; } });\nvar logger_1 = require(\"./logger\");\nObject.defineProperty(exports, \"logger\", { enumerable: true, get: function () { return logger_1.logger; } });\n"],"names":[],"mappings":";;AACA;AACA;AACA,MAAM,CAAC,cAAc,CAAC,OAAO,EAAE,YAAY,EAAE,EAAE,KAAK,EAAE,IAAI,EAAE,CAAC;AAC7D,OAAO,CAAC,MAAM,GAAG,OAAO,CAAC,qBAAqB,GAAG,OAAO,CAAC,aAAa,GAAG,OAAO,CAAC,wBAAwB,GAAG,OAAO,CAAC,gBAAgB,GAAG,OAAO,CAAC,0BAA0B,GAAG,MAAM;AAClL,IAAI,4BAA4B,GAAG,OAAO,CAAC,8BAA8B,CAAC;AAC1E,MAAM,CAAC,cAAc,CAAC,OAAO,EAAE,4BAA4B,EAAE,EAAE,UAAU,EAAE,IAAI,EAAE,GAAG,EAAE,YAAY,EAAE,OAAO,4BAA4B,CAAC,0BAA0B,CAAC,CAAC,CAAC,EAAE,CAAC;AACxK,IAAI,kBAAkB,GAAG,OAAO,CAAC,oBAAoB,CAAC;AACtD,MAAM,CAAC,cAAc,CAAC,OAAO,EAAE,kBAAkB,EAAE,EAAE,UAAU,EAAE,IAAI,EAAE,GAAG,EAAE,YAAY,EAAE,OAAO,kBAAkB,CAAC,gBAAgB,CAAC,CAAC,CAAC,EAAE,CAAC;AAC1I,IAAI,cAAc,GAAG,OAAO,CAAC,gBAAgB,CAAC;AAC9C,MAAM,CAAC,cAAc,CAAC,OAAO,EAAE,0BAA0B,EAAE,EAAE,UAAU,EAAE,IAAI,EAAE,GAAG,EAAE,YAAY,EAAE,OAAO,cAAc,CAAC,wBAAwB,CAAC,CAAC,CAAC,EAAE,CAAC;AACtJ,IAAI,eAAe,GAAG,OAAO,CAAC,iBAAiB,CAAC;AAChD,MAAM,CAAC,cAAc,CAAC,OAAO,EAAE,eAAe,EAAE,EAAE,UAAU,EAAE,IAAI,EAAE,GAAG,EAAE,YAAY,EAAE,OAAO,eAAe,CAAC,aAAa,CAAC,CAAC,CAAC,EAAE,CAAC;AACjI,IAAI,uBAAuB,GAAG,OAAO,CAAC,yBAAyB,CAAC;AAChE,MAAM,CAAC,cAAc,CAAC,OAAO,EAAE,uBAAuB,EAAE,EAAE,UAAU,EAAE,IAAI,EAAE,GAAG,EAAE,YAAY,EAAE,OAAO,uBAAuB,CAAC,qBAAqB,CAAC,CAAC,CAAC,EAAE,CAAC;AACzJ,IAAI,QAAQ,GAAG,OAAO,CAAC,UAAU,CAAC;AAClC,MAAM,CAAC,cAAc,CAAC,OAAO,EAAE,QAAQ,EAAE,EAAE,UAAU,EAAE,IAAI,EAAE,GAAG,EAAE,YAAY,EAAE,OAAO,QAAQ,CAAC,MAAM,CAAC,CAAC,CAAC,EAAE,CAAC;;"}
|