@aws-amplify/api-rest 4.0.1-console-preview.3d7f188.0 → 4.0.1-mjs-test.20ead30.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (174) hide show
  1. package/dist/cjs/apis/common/handler.js +75 -0
  2. package/dist/cjs/apis/common/handler.js.map +1 -0
  3. package/{lib → dist/cjs}/apis/common/internalPost.js +21 -19
  4. package/dist/cjs/apis/common/internalPost.js.map +1 -0
  5. package/dist/cjs/apis/common/publicApis.js +46 -0
  6. package/dist/cjs/apis/common/publicApis.js.map +1 -0
  7. package/{lib → dist/cjs}/apis/index.js +11 -17
  8. package/dist/cjs/apis/index.js.map +1 -0
  9. package/{lib → dist/cjs}/apis/server.js +11 -21
  10. package/dist/cjs/apis/server.js.map +1 -0
  11. package/{lib → dist/cjs}/errors/CanceledError.js +15 -16
  12. package/dist/cjs/errors/CanceledError.js.map +1 -0
  13. package/dist/cjs/errors/RestApiError.js +17 -0
  14. package/dist/cjs/errors/RestApiError.js.map +1 -0
  15. package/{lib → dist/cjs}/errors/assertValidatonError.js +7 -5
  16. package/dist/cjs/errors/assertValidatonError.js.map +1 -0
  17. package/{lib → dist/cjs}/errors/index.js +3 -1
  18. package/dist/cjs/errors/index.js.map +1 -0
  19. package/{lib → dist/cjs}/errors/validation.js +7 -6
  20. package/dist/cjs/errors/validation.js.map +1 -0
  21. package/{lib → dist/cjs}/index.js +3 -1
  22. package/dist/cjs/index.js.map +1 -0
  23. package/{lib → dist/cjs}/internals/index.js +6 -4
  24. package/dist/cjs/internals/index.js.map +1 -0
  25. package/{lib → dist/cjs}/internals/server.js +6 -4
  26. package/dist/cjs/internals/server.js.map +1 -0
  27. package/{lib → dist/cjs}/server.js +3 -1
  28. package/dist/cjs/server.js.map +1 -0
  29. package/{lib → dist/cjs}/types/index.js +3 -1
  30. package/dist/cjs/types/index.js.map +1 -0
  31. package/{lib → dist/cjs}/utils/constants.js +3 -1
  32. package/dist/cjs/utils/constants.js.map +1 -0
  33. package/dist/cjs/utils/createCancellableOperation.js +65 -0
  34. package/dist/cjs/utils/createCancellableOperation.js.map +1 -0
  35. package/{lib → dist/cjs}/utils/index.js +3 -1
  36. package/dist/cjs/utils/index.js.map +1 -0
  37. package/{lib → dist/cjs}/utils/logger.js +4 -2
  38. package/dist/cjs/utils/logger.js.map +1 -0
  39. package/{lib → dist/cjs}/utils/normalizeHeaders.js +6 -4
  40. package/dist/cjs/utils/normalizeHeaders.js.map +1 -0
  41. package/dist/cjs/utils/parseSigningInfo.js +43 -0
  42. package/dist/cjs/utils/parseSigningInfo.js.map +1 -0
  43. package/dist/cjs/utils/resolveApiUrl.js +42 -0
  44. package/dist/cjs/utils/resolveApiUrl.js.map +1 -0
  45. package/dist/cjs/utils/resolveCredentials.js +17 -0
  46. package/dist/cjs/utils/resolveCredentials.js.map +1 -0
  47. package/dist/cjs/utils/serviceError.js +32 -0
  48. package/dist/cjs/utils/serviceError.js.map +1 -0
  49. package/{lib-esm → dist/esm}/apis/common/handler.d.ts +1 -5
  50. package/dist/esm/apis/common/handler.mjs +78 -0
  51. package/dist/esm/apis/common/handler.mjs.map +1 -0
  52. package/{lib-esm/apis/common/internalPost.js → dist/esm/apis/common/internalPost.mjs} +26 -18
  53. package/dist/esm/apis/common/internalPost.mjs.map +1 -0
  54. package/dist/esm/apis/common/publicApis.mjs +45 -0
  55. package/dist/esm/apis/common/publicApis.mjs.map +1 -0
  56. package/{lib-esm/apis/index.js → dist/esm/apis/index.mjs} +12 -16
  57. package/dist/esm/apis/index.mjs.map +1 -0
  58. package/{lib-esm/apis/server.js → dist/esm/apis/server.mjs} +12 -20
  59. package/dist/esm/apis/server.mjs.map +1 -0
  60. package/dist/esm/errors/CanceledError.mjs +31 -0
  61. package/dist/esm/errors/CanceledError.mjs.map +1 -0
  62. package/dist/esm/errors/RestApiError.mjs +15 -0
  63. package/dist/esm/errors/RestApiError.mjs.map +1 -0
  64. package/dist/esm/errors/assertValidatonError.mjs +17 -0
  65. package/dist/esm/errors/assertValidatonError.mjs.map +1 -0
  66. package/dist/esm/errors/index.mjs +5 -0
  67. package/dist/esm/errors/index.mjs.map +1 -0
  68. package/{lib-esm/errors/validation.js → dist/esm/errors/validation.mjs} +8 -6
  69. package/dist/esm/errors/validation.mjs.map +1 -0
  70. package/dist/esm/index.mjs +3 -0
  71. package/dist/esm/index.mjs.map +1 -0
  72. package/{lib-esm/internals/index.js → dist/esm/internals/index.mjs} +9 -5
  73. package/dist/esm/internals/index.mjs.map +1 -0
  74. package/{lib-esm/internals/server.js → dist/esm/internals/server.mjs} +9 -5
  75. package/dist/esm/internals/server.mjs.map +1 -0
  76. package/dist/esm/server.mjs +3 -0
  77. package/dist/esm/server.mjs.map +1 -0
  78. package/dist/esm/types/index.mjs +2 -0
  79. package/dist/esm/types/index.mjs.map +1 -0
  80. package/dist/esm/utils/constants.mjs +13 -0
  81. package/dist/esm/utils/constants.mjs.map +1 -0
  82. package/dist/esm/utils/createCancellableOperation.mjs +65 -0
  83. package/dist/esm/utils/createCancellableOperation.mjs.map +1 -0
  84. package/dist/esm/utils/index.mjs +7 -0
  85. package/dist/esm/utils/index.mjs.map +1 -0
  86. package/{lib-esm/utils/logger.js → dist/esm/utils/logger.mjs} +6 -2
  87. package/dist/esm/utils/logger.mjs.map +1 -0
  88. package/{lib-esm/utils/normalizeHeaders.js → dist/esm/utils/normalizeHeaders.mjs} +6 -3
  89. package/dist/esm/utils/normalizeHeaders.mjs.map +1 -0
  90. package/dist/esm/utils/parseSigningInfo.mjs +41 -0
  91. package/dist/esm/utils/parseSigningInfo.mjs.map +1 -0
  92. package/dist/esm/utils/resolveApiUrl.mjs +42 -0
  93. package/dist/esm/utils/resolveApiUrl.mjs.map +1 -0
  94. package/{lib → dist/esm}/utils/resolveCredentials.d.ts +1 -1
  95. package/dist/esm/utils/resolveCredentials.mjs +17 -0
  96. package/dist/esm/utils/resolveCredentials.mjs.map +1 -0
  97. package/dist/esm/utils/serviceError.mjs +30 -0
  98. package/dist/esm/utils/serviceError.mjs.map +1 -0
  99. package/internals/package.json +4 -4
  100. package/internals/server/package.json +3 -4
  101. package/package.json +63 -26
  102. package/server/package.json +3 -4
  103. package/lib/apis/common/handler.d.ts +0 -31
  104. package/lib/apis/common/handler.js +0 -79
  105. package/lib/apis/common/internalPost.d.ts +0 -16
  106. package/lib/apis/common/publicApis.d.ts +0 -8
  107. package/lib/apis/common/publicApis.js +0 -50
  108. package/lib/apis/index.d.ts +0 -203
  109. package/lib/apis/server.d.ts +0 -151
  110. package/lib/errors/CanceledError.d.ts +0 -17
  111. package/lib/errors/RestApiError.d.ts +0 -4
  112. package/lib/errors/RestApiError.js +0 -19
  113. package/lib/errors/assertValidatonError.d.ts +0 -5
  114. package/lib/errors/index.d.ts +0 -4
  115. package/lib/errors/validation.d.ts +0 -6
  116. package/lib/index.d.ts +0 -2
  117. package/lib/internals/index.d.ts +0 -19
  118. package/lib/internals/server.d.ts +0 -20
  119. package/lib/server.d.ts +0 -2
  120. package/lib/tsconfig.tsbuildinfo +0 -1
  121. package/lib/types/index.d.ts +0 -103
  122. package/lib/utils/constants.d.ts +0 -8
  123. package/lib/utils/createCancellableOperation.d.ts +0 -12
  124. package/lib/utils/createCancellableOperation.js +0 -70
  125. package/lib/utils/index.d.ts +0 -6
  126. package/lib/utils/logger.d.ts +0 -2
  127. package/lib/utils/normalizeHeaders.d.ts +0 -1
  128. package/lib/utils/parseSigningInfo.d.ts +0 -14
  129. package/lib/utils/parseSigningInfo.js +0 -42
  130. package/lib/utils/resolveApiUrl.d.ts +0 -12
  131. package/lib/utils/resolveApiUrl.js +0 -39
  132. package/lib/utils/resolveCredentials.js +0 -23
  133. package/lib/utils/serviceError.d.ts +0 -10
  134. package/lib/utils/serviceError.js +0 -38
  135. package/lib-esm/apis/common/handler.js +0 -75
  136. package/lib-esm/apis/common/publicApis.js +0 -41
  137. package/lib-esm/errors/CanceledError.js +0 -31
  138. package/lib-esm/errors/RestApiError.js +0 -16
  139. package/lib-esm/errors/assertValidatonError.js +0 -13
  140. package/lib-esm/errors/index.js +0 -6
  141. package/lib-esm/index.js +0 -4
  142. package/lib-esm/server.js +0 -4
  143. package/lib-esm/tsconfig.tsbuildinfo +0 -1
  144. package/lib-esm/types/index.js +0 -1
  145. package/lib-esm/utils/constants.js +0 -10
  146. package/lib-esm/utils/createCancellableOperation.js +0 -66
  147. package/lib-esm/utils/index.js +0 -8
  148. package/lib-esm/utils/parseSigningInfo.js +0 -38
  149. package/lib-esm/utils/resolveApiUrl.js +0 -35
  150. package/lib-esm/utils/resolveCredentials.d.ts +0 -5
  151. package/lib-esm/utils/resolveCredentials.js +0 -19
  152. package/lib-esm/utils/serviceError.js +0 -33
  153. /package/{lib-esm → dist/esm}/apis/common/internalPost.d.ts +0 -0
  154. /package/{lib-esm → dist/esm}/apis/common/publicApis.d.ts +0 -0
  155. /package/{lib-esm → dist/esm}/apis/index.d.ts +0 -0
  156. /package/{lib-esm → dist/esm}/apis/server.d.ts +0 -0
  157. /package/{lib-esm → dist/esm}/errors/CanceledError.d.ts +0 -0
  158. /package/{lib-esm → dist/esm}/errors/RestApiError.d.ts +0 -0
  159. /package/{lib-esm → dist/esm}/errors/assertValidatonError.d.ts +0 -0
  160. /package/{lib-esm → dist/esm}/errors/index.d.ts +0 -0
  161. /package/{lib-esm → dist/esm}/errors/validation.d.ts +0 -0
  162. /package/{lib-esm → dist/esm}/index.d.ts +0 -0
  163. /package/{lib-esm → dist/esm}/internals/index.d.ts +0 -0
  164. /package/{lib-esm → dist/esm}/internals/server.d.ts +0 -0
  165. /package/{lib-esm → dist/esm}/server.d.ts +0 -0
  166. /package/{lib-esm → dist/esm}/types/index.d.ts +0 -0
  167. /package/{lib-esm → dist/esm}/utils/constants.d.ts +0 -0
  168. /package/{lib-esm → dist/esm}/utils/createCancellableOperation.d.ts +0 -0
  169. /package/{lib-esm → dist/esm}/utils/index.d.ts +0 -0
  170. /package/{lib-esm → dist/esm}/utils/logger.d.ts +0 -0
  171. /package/{lib-esm → dist/esm}/utils/normalizeHeaders.d.ts +0 -0
  172. /package/{lib-esm → dist/esm}/utils/parseSigningInfo.d.ts +0 -0
  173. /package/{lib-esm → dist/esm}/utils/resolveApiUrl.d.ts +0 -0
  174. /package/{lib-esm → dist/esm}/utils/serviceError.d.ts +0 -0
@@ -1,203 +0,0 @@
1
- import { DeleteInput, DeleteOperation, GetInput, GetOperation, HeadInput, HeadOperation, PatchInput, PatchOperation, PostInput, PostOperation, PutInput, PutOperation } from '../types';
2
- /**
3
- * GET HTTP request
4
- * @param {GetInput} input - Input for GET operation
5
- * @returns {GetOperation} Operation for GET request
6
- * @throws - {@link RestApiError}
7
- * @example
8
- * Send a GET request
9
- * ```js
10
- * import { get, isCancelError } from '@aws-amplify/api';
11
- *
12
- * const { body } = await get({
13
- * apiName,
14
- * path,
15
- * options: {
16
- * headers, // Optional, A map of custom header key/values
17
- * body, // Optional, JSON object or FormData
18
- * queryParams, // Optional, A map of query strings
19
- * }
20
- * }).response;
21
- * const data = await body.json();
22
- * ```
23
- * @example
24
- * Cancel a GET request
25
- *
26
- * ```js
27
- * import { get, isCancelError } from '@aws-amplify/api';
28
- *
29
- * const { response, cancel } = get({apiName, path, options});
30
- * cancel(message);
31
- * try {
32
- * await response;
33
- * } cache (e) {
34
- * if (isCancelError(e)) {
35
- * // handle request cancellation
36
- * }
37
- * //...
38
- * }
39
- * ```
40
- */
41
- export declare const get: (input: GetInput) => GetOperation;
42
- /**
43
- * POST HTTP request
44
- * @param {PostInput} input - Input for POST operation
45
- * @returns {PostOperation} Operation for POST request
46
- * @throws - {@link RestApiError}
47
- * @example
48
- * Send a POST request
49
- * ```js
50
- * import { post, isCancelError } from '@aws-amplify/api';
51
- *
52
- * const { body } = await post({
53
- * apiName,
54
- * path,
55
- * options: {
56
- * headers, // Optional, A map of custom header key/values
57
- * body, // Optional, JSON object or FormData
58
- * queryParams, // Optional, A map of query strings
59
- * }
60
- * }).response;
61
- * const data = await body.json();
62
- * ```
63
- * @example
64
- * Cancel a POST request
65
- *
66
- * ```js
67
- * import { post, isCancelError } from '@aws-amplify/api';
68
- *
69
- * const { response, cancel } = post({apiName, path, options});
70
- * cancel(message);
71
- * try {
72
- * await response;
73
- * } cache (e) {
74
- * if (isCancelError(e)) {
75
- * // handle request cancellation
76
- * }
77
- * //...
78
- * }
79
- * ```
80
- */
81
- export declare const post: (input: PostInput) => PostOperation;
82
- /**
83
- * PUT HTTP request
84
- * @param {PutInput} input - Input for PUT operation
85
- * @returns {PutOperation} Operation for PUT request
86
- * @throws - {@link RestApiError}
87
- * @example
88
- * Send a PUT request
89
- * ```js
90
- * import { put, isCancelError } from '@aws-amplify/api';
91
- *
92
- * const { body } = await put({
93
- * apiName,
94
- * path,
95
- * options: {
96
- * headers, // Optional, A map of custom header key/values
97
- * body, // Optional, JSON object or FormData
98
- * queryParams, // Optional, A map of query strings
99
- * }
100
- * }).response;
101
- * const data = await body.json();
102
- * ```
103
- * @example
104
- * Cancel a PUT request
105
- * ```js
106
- * import { put, isCancelError } from '@aws-amplify/api';
107
- *
108
- * const { response, cancel } = put({apiName, path, options});
109
- * cancel(message);
110
- * try {
111
- * await response;
112
- * } cache (e) {
113
- * if (isCancelError(e)) {
114
- * // handle request cancellation
115
- * }
116
- * //...
117
- * }
118
- * ```
119
- */
120
- export declare const put: (input: PutInput) => PutOperation;
121
- /**
122
- * DELETE HTTP request
123
- * @param {DeleteInput} input - Input for DELETE operation
124
- * @returns {DeleteOperation} Operation for DELETE request
125
- * @throws - {@link RestApiError}
126
- * @example
127
- * Send a DELETE request
128
- * ```js
129
- * import { del } from '@aws-amplify/api';
130
- *
131
- * const { statusCode } = await del({
132
- * apiName,
133
- * path,
134
- * options: {
135
- * headers, // Optional, A map of custom header key/values
136
- * queryParams, // Optional, A map of query strings
137
- * }
138
- * }).response;
139
- * ```
140
- */
141
- export declare const del: (input: DeleteInput) => DeleteOperation;
142
- /**
143
- * HEAD HTTP request
144
- * @param {HeadInput} input - Input for HEAD operation
145
- * @returns {HeadOperation} Operation for HEAD request
146
- * @throws - {@link RestApiError}
147
- * @example
148
- * Send a HEAD request
149
- * ```js
150
- * import { head, isCancelError } from '@aws-amplify/api';
151
- *
152
- * const { headers, statusCode } = await head({
153
- * apiName,
154
- * path,
155
- * options: {
156
- * headers, // Optional, A map of custom header key/values
157
- * queryParams, // Optional, A map of query strings
158
- * }
159
- * }),response;
160
- * ```
161
- *
162
- */
163
- export declare const head: (input: HeadInput) => HeadOperation;
164
- /**
165
- * PATCH HTTP request
166
- * @param {PatchInput} input - Input for PATCH operation
167
- * @returns {PatchOperation} Operation for PATCH request
168
- * @throws - {@link RestApiError}
169
- * @example
170
- * Send a PATCH request
171
- * ```js
172
- * import { patch } from '@aws-amplify/api';
173
- *
174
- * const { body } = await patch({
175
- * apiName,
176
- * path,
177
- * options: {
178
- * headers, // Optional, A map of custom header key/values
179
- * body, // Optional, JSON object or FormData
180
- * queryParams, // Optional, A map of query strings
181
- * }
182
- * }).response;
183
- * const data = await body.json();
184
- * ```
185
- *
186
- * @example
187
- * Cancel a PATCH request
188
- * ```js
189
- * import { patch, isCancelError } from '@aws-amplify/api';
190
- *
191
- * const { response, cancel } = patch({apiName, path, options});
192
- * cancel(message);
193
- * try {
194
- * await response;
195
- * } cache (e) {
196
- * if (isCancelError(e)) {
197
- * // handle request cancellation
198
- * }
199
- * //...
200
- * }
201
- * ```
202
- */
203
- export declare const patch: (input: PatchInput) => PatchOperation;
@@ -1,151 +0,0 @@
1
- import { AmplifyServer } from '@aws-amplify/core/internals/adapter-core';
2
- import { DeleteInput, DeleteOperation, GetInput, GetOperation, HeadInput, HeadOperation, PatchInput, PatchOperation, PostInput, PostOperation, PutInput, PutOperation } from '../types';
3
- /**
4
- * GET HTTP request (server-side)
5
- * @param {AmplifyServer.ContextSpec} contextSpec - The context spec used to get the Amplify server context.
6
- * @param {GetInput} input - Input for GET operation.
7
- * @throws - {@link RestApiError}
8
- * @example
9
- * Send a GET request
10
- * ```js
11
- * import { get } from 'aws-amplify/api/server';
12
- * //...
13
- * const restApiResponse = await runWithAmplifyServerContext({
14
- * nextServerContext: { request, response },
15
- * operation: async (contextSpec) => {
16
- * try {
17
- * const { body } = await get(contextSpec, input).response;
18
- * return await body.json();
19
- * } catch (error) {
20
- * console.log(error);
21
- * return false;
22
- * }
23
- * },
24
- * });
25
- * ```
26
- * @see {@link clientGet}
27
- */
28
- export declare const get: (contextSpec: AmplifyServer.ContextSpec, input: GetInput) => GetOperation;
29
- /**
30
- * POST HTTP request (server-side)
31
- * @param {AmplifyServer.ContextSpec} contextSpec - The context spec used to get the Amplify server context.
32
- * @param {PostInput} input - Input for POST operation.
33
- * @throws - {@link RestApiError}
34
- * @example
35
- * Send a POST request
36
- * ```js
37
- * import { post } from 'aws-amplify/api/server';
38
- * //...
39
- * const restApiResponse = await runWithAmplifyServerContext({
40
- * nextServerContext: { request, response },
41
- * operation: async (contextSpec) => {
42
- * try {
43
- * const { body } = await post(contextSpec, input).response;
44
- * return await body.json();
45
- * } catch (error) {
46
- * console.log(error);
47
- * return false;
48
- * }
49
- * },
50
- * });
51
- * ```
52
- */
53
- export declare const post: (contextSpec: AmplifyServer.ContextSpec, input: PostInput) => PostOperation;
54
- /**
55
- * PUT HTTP request (server-side)
56
- * @param {AmplifyServer.ContextSpec} contextSpec - The context spec used to get the Amplify server context.
57
- * @param {PutInput} input - Input for PUT operation.
58
- * @throws - {@link RestApiError}
59
- * @example
60
- * Send a PUT request
61
- * ```js
62
- * import { put } from 'aws-amplify/api/server';
63
- * //...
64
- * const restApiResponse = await runWithAmplifyServerContext({
65
- * nextServerContext: { request, response },
66
- * operation: async (contextSpec) => {
67
- * try {
68
- * const { body } = await put(contextSpec, input).response;
69
- * return await body.json();
70
- * } catch (error) {
71
- * console.log(error);
72
- * return false;
73
- * }
74
- * },
75
- * });
76
- * ```
77
- */
78
- export declare const put: (contextSpec: AmplifyServer.ContextSpec, input: PutInput) => PutOperation;
79
- /**
80
- * DELETE HTTP request (server-side)
81
- * @param {AmplifyServer.ContextSpec} contextSpec - The context spec used to get the Amplify server context.
82
- * @param {DeleteInput} input - Input for DELETE operation.
83
- * @throws - {@link RestApiError}
84
- * @example
85
- * Send a DELETE request
86
- * ```js
87
- * import { del } from 'aws-amplify/api/server';
88
- * //...
89
- * const restApiResponse = await runWithAmplifyServerContext({
90
- * nextServerContext: { request, response },
91
- * operation: async (contextSpec) => {
92
- * try {
93
- * const { headers } = await del(contextSpec, input).response;
94
- * } catch (error) {
95
- * console.log(error);
96
- * return false;
97
- * }
98
- * },
99
- * });
100
- * ```
101
- */
102
- export declare const del: (contextSpec: AmplifyServer.ContextSpec, input: DeleteInput) => DeleteOperation;
103
- /**
104
- * HEAD HTTP request (server-side)
105
- * @param {AmplifyServer.ContextSpec} contextSpec - The context spec used to get the Amplify server context.
106
- * @param {HeadInput} input - Input for HEAD operation.
107
- * @throws - {@link RestApiError}
108
- * @example
109
- * Send a HEAD request
110
- * ```js
111
- * import { head } from 'aws-amplify/api/server';
112
- * //...
113
- * const restApiResponse = await runWithAmplifyServerContext({
114
- * nextServerContext: { request, response },
115
- * operation: async (contextSpec) => {
116
- * try {
117
- * const { headers } = await head(contextSpec, input).response;
118
- * } catch (error) {
119
- * console.log(error);
120
- * return false;
121
- * }
122
- * },
123
- * });
124
- * ```
125
- */
126
- export declare const head: (contextSpec: AmplifyServer.ContextSpec, input: HeadInput) => HeadOperation;
127
- /**
128
- * PATCH HTTP request (server-side)
129
- * @param {AmplifyServer.ContextSpec} contextSpec - The context spec used to get the Amplify server context.
130
- * @param {PatchInput} input - Input for PATCH operation.
131
- * @throws - {@link RestApiError}
132
- * @example
133
- * Send a PATCH request
134
- * ```js
135
- * import { patch } from 'aws-amplify/api/server';
136
- * //...
137
- * const restApiResponse = await runWithAmplifyServerContext({
138
- * nextServerContext: { request, response },
139
- * operation: async (contextSpec) => {
140
- * try {
141
- * const { body } = await patch(contextSpec, input).response;
142
- * return await body.json();
143
- * } catch (error) {
144
- * console.log(error);
145
- * return false;
146
- * }
147
- * },
148
- * });
149
- * ```
150
- */
151
- export declare const patch: (contextSpec: AmplifyServer.ContextSpec, input: PatchInput) => PatchOperation;
@@ -1,17 +0,0 @@
1
- import { AmplifyErrorParams } from '@aws-amplify/core/internals/utils';
2
- import { RestApiError } from './RestApiError';
3
- /**
4
- * Internal-only class for CanceledError.
5
- *
6
- * @internal
7
- */
8
- export declare class CanceledError extends RestApiError {
9
- constructor(params?: Partial<AmplifyErrorParams>);
10
- }
11
- /**
12
- * Check if an error is caused by user calling `cancel()` in REST API.
13
- *
14
- * @note This function works **ONLY** for errors thrown by REST API. For GraphQL APIs, use `client.isCancelError(error)`
15
- * instead. `client` is generated from `generateClient()` API from `aws-amplify/api`.
16
- */
17
- export declare const isCancelError: (error: unknown) => error is CanceledError;
@@ -1,4 +0,0 @@
1
- import { AmplifyError, AmplifyErrorParams } from '@aws-amplify/core/internals/utils';
2
- export declare class RestApiError extends AmplifyError {
3
- constructor(params: AmplifyErrorParams);
4
- }
@@ -1,19 +0,0 @@
1
- "use strict";
2
- // Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
3
- // SPDX-License-Identifier: Apache-2.0
4
- Object.defineProperty(exports, "__esModule", { value: true });
5
- exports.RestApiError = void 0;
6
- var tslib_1 = require("tslib");
7
- var utils_1 = require("@aws-amplify/core/internals/utils");
8
- var RestApiError = /** @class */ (function (_super) {
9
- tslib_1.__extends(RestApiError, _super);
10
- function RestApiError(params) {
11
- var _this = _super.call(this, params) || this;
12
- // TODO: Delete the following 2 lines after we change the build target to >= es2015
13
- _this.constructor = RestApiError;
14
- Object.setPrototypeOf(_this, RestApiError.prototype);
15
- return _this;
16
- }
17
- return RestApiError;
18
- }(utils_1.AmplifyError));
19
- exports.RestApiError = RestApiError;
@@ -1,5 +0,0 @@
1
- import { RestApiValidationErrorCode } from './validation';
2
- /**
3
- * @internal
4
- */
5
- export declare function assertValidationError(assertion: boolean, name: RestApiValidationErrorCode): asserts assertion;
@@ -1,4 +0,0 @@
1
- export { CanceledError, isCancelError } from './CanceledError';
2
- export { RestApiError } from './RestApiError';
3
- export { assertValidationError } from './assertValidatonError';
4
- export { RestApiValidationErrorCode, validationErrorMap } from './validation';
@@ -1,6 +0,0 @@
1
- import { AmplifyErrorMap } from '@aws-amplify/core/internals/utils';
2
- export declare enum RestApiValidationErrorCode {
3
- NoCredentials = "NoCredentials",
4
- InvalidApiName = "InvalidApiName"
5
- }
6
- export declare const validationErrorMap: AmplifyErrorMap<RestApiValidationErrorCode>;
package/lib/index.d.ts DELETED
@@ -1,2 +0,0 @@
1
- export { isCancelError } from './errors/CanceledError';
2
- export { get, post, put, del, head, patch } from './apis';
@@ -1,19 +0,0 @@
1
- import { InternalPostInput } from '../types';
2
- /**
3
- * Internal-only REST POST handler to send GraphQL request to given endpoint. By default, it will use IAM to authorize
4
- * the request. In some auth modes, the IAM auth has to be disabled. Here's how to set up the request auth correctly:
5
- * * If auth mode is 'iam', you MUST NOT set 'authorization' header and 'x-api-key' header, since it would disable IAM
6
- * auth. You MUST also set 'input.options.signingServiceInfo' option.
7
- * * The including 'input.options.signingServiceInfo.service' and 'input.options.signingServiceInfo.region' are
8
- * optional. If omitted, the signing service and region will be inferred from url.
9
- * * If auth mode is 'none', you MUST NOT set 'options.signingServiceInfo' option.
10
- * * If auth mode is 'apiKey', you MUST set 'x-api-key' custom header.
11
- * * If auth mode is 'oidc' or 'lambda' or 'userPool', you MUST set 'authorization' header.
12
- *
13
- * To make the internal post cancellable, you must also call `updateRequestToBeCancellable()` with the promise from
14
- * internal post call and the abort controller supplied to the internal post call.
15
- *
16
- * @internal
17
- */
18
- export declare const post: (input: InternalPostInput) => Promise<import("../types").RestApiResponse>;
19
- export { cancel, updateRequestToBeCancellable, } from '../apis/common/internalPost';
@@ -1,20 +0,0 @@
1
- import { AmplifyServer } from '@aws-amplify/core/internals/adapter-core';
2
- import { InternalPostInput } from '../types';
3
- /**
4
- * Internal-only REST POST handler to send GraphQL request to given endpoint. By default, it will use IAM to authorize
5
- * the request. In some auth modes, the IAM auth has to be disabled. Here's how to set up the request auth correctly:
6
- * * If auth mode is 'iam', you MUST NOT set 'authorization' header and 'x-api-key' header, since it would disable IAM
7
- * auth. You MUST also set 'input.options.signingServiceInfo' option.
8
- * * The including 'input.options.signingServiceInfo.service' and 'input.options.signingServiceInfo.region' are
9
- * optional. If omitted, the signing service and region will be inferred from url.
10
- * * If auth mode is 'none', you MUST NOT set 'options.signingServiceInfo' option.
11
- * * If auth mode is 'apiKey', you MUST set 'x-api-key' custom header.
12
- * * If auth mode is 'oidc' or 'lambda' or 'userPool', you MUST set 'authorization' header.
13
- *
14
- * To make the internal post cancellable, you must also call `updateRequestToBeCancellable()` with the promise from
15
- * internal post call and the abort controller supplied to the internal post call.
16
- *
17
- * @internal
18
- */
19
- export declare const post: (contextSpec: AmplifyServer.ContextSpec, input: InternalPostInput) => Promise<import("../types").RestApiResponse>;
20
- export { cancel, updateRequestToBeCancellable, } from '../apis/common/internalPost';
package/lib/server.d.ts DELETED
@@ -1,2 +0,0 @@
1
- export { isCancelError } from './errors/CanceledError';
2
- export { get, post, put, del, head, patch } from './apis/server';