@aws-amplify/core 6.5.1-storage-browser-integrity.c12f2e0.0 → 6.5.1-storage-browser-integrity.405b2cc.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cjs/Platform/version.js +1 -1
- package/dist/cjs/Platform/version.js.map +1 -1
- package/dist/cjs/clients/internal/composeServiceApi.js +38 -2
- package/dist/cjs/clients/internal/composeServiceApi.js.map +1 -1
- package/dist/esm/Platform/version.d.ts +1 -1
- package/dist/esm/Platform/version.mjs +1 -1
- package/dist/esm/Platform/version.mjs.map +1 -1
- package/dist/esm/clients/internal/composeServiceApi.d.ts +62 -2
- package/dist/esm/clients/internal/composeServiceApi.mjs +38 -2
- package/dist/esm/clients/internal/composeServiceApi.mjs.map +1 -1
- package/package.json +3 -3
- package/src/Platform/version.ts +1 -1
- package/src/clients/internal/composeServiceApi.ts +66 -6
|
@@ -3,5 +3,5 @@
|
|
|
3
3
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
4
4
|
exports.version = void 0;
|
|
5
5
|
// generated by genversion
|
|
6
|
-
exports.version = '6.7.1-storage-browser-integrity.
|
|
6
|
+
exports.version = '6.7.1-storage-browser-integrity.405b2cc.0+405b2cc';
|
|
7
7
|
//# sourceMappingURL=version.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"version.js","sources":["../../../src/Platform/version.ts"],"sourcesContent":["\"use strict\";\nObject.defineProperty(exports, \"__esModule\", { value: true });\nexports.version = void 0;\n// generated by genversion\nexports.version = '6.7.1-storage-browser-integrity.
|
|
1
|
+
{"version":3,"file":"version.js","sources":["../../../src/Platform/version.ts"],"sourcesContent":["\"use strict\";\nObject.defineProperty(exports, \"__esModule\", { value: true });\nexports.version = void 0;\n// generated by genversion\nexports.version = '6.7.1-storage-browser-integrity.405b2cc.0+405b2cc';\n"],"names":[],"mappings":";;AACA,MAAM,CAAC,cAAc,CAAC,OAAO,EAAE,YAAY,EAAE,EAAE,KAAK,EAAE,IAAI,EAAE,CAAC,CAAC;AAC9D,OAAO,CAAC,OAAO,GAAG,KAAK,CAAC,CAAC;AACzB;AACA,OAAO,CAAC,OAAO,GAAG,mDAAmD;;"}
|
|
@@ -4,14 +4,50 @@
|
|
|
4
4
|
// SPDX-License-Identifier: Apache-2.0
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
6
|
exports.composeServiceApi = void 0;
|
|
7
|
+
/**
|
|
8
|
+
* Compose a service API handler that accepts input as defined shape and responds conforming to defined output shape.
|
|
9
|
+
* A service API handler is composed with:
|
|
10
|
+
* * A transfer handler
|
|
11
|
+
* * A serializer function
|
|
12
|
+
* * A deserializer function
|
|
13
|
+
* * A default config object
|
|
14
|
+
*
|
|
15
|
+
* The returned service API handler, when called, will trigger the following workflow:
|
|
16
|
+
* 1. When calling the service API handler function, the default config object is merged into the input config
|
|
17
|
+
* object to assign the default values of some omitted configs, resulting to a resolved config object.
|
|
18
|
+
* 2. The `endpointResolver` function from the default config object will be invoked with the resolved config object and
|
|
19
|
+
* API input object resulting to an endpoint instance.
|
|
20
|
+
* 3. The serializer function is invoked with API input object and the endpoint instance resulting to an HTTP request
|
|
21
|
+
* instance.
|
|
22
|
+
* 4. The HTTP request instance and the resolved config object is passed to the transfer handler function.
|
|
23
|
+
* 5. The transfer handler function resolves to an HTTP response instance(can be either successful or failed status code).
|
|
24
|
+
* 6. The deserializer function is invoked with the HTTP response instance resulting to the API output object, and
|
|
25
|
+
* return to the caller.
|
|
26
|
+
*
|
|
27
|
+
*
|
|
28
|
+
* @param transferHandler Async function for dispatching HTTP requests and returning HTTP response.
|
|
29
|
+
* @param serializer Async function for converting object in defined input shape into HTTP request targeting a given
|
|
30
|
+
* endpoint.
|
|
31
|
+
* @param deserializer Async function for converting HTTP response into output object in defined output shape, or error
|
|
32
|
+
* shape.
|
|
33
|
+
* @param defaultConfig object containing default options to be consumed by transfer handler, serializer and
|
|
34
|
+
* deserializer.
|
|
35
|
+
* @returns a async service API handler function that accepts a config object and input object in defined shape, returns
|
|
36
|
+
* an output object in defined shape. It may also throw error instance in defined shape in deserializer. The config
|
|
37
|
+
* object type is composed with options type of transferHandler, endpointResolver function as well as endpointResolver
|
|
38
|
+
* function's input options type, region string. The config object property will be marked as optional if it's also
|
|
39
|
+
* defined in defaultConfig.
|
|
40
|
+
*
|
|
41
|
+
* @internal
|
|
42
|
+
*/
|
|
7
43
|
const composeServiceApi = (transferHandler, serializer, deserializer, defaultConfig) => {
|
|
8
44
|
return async (config, input) => {
|
|
9
45
|
const resolvedConfig = {
|
|
10
46
|
...defaultConfig,
|
|
11
47
|
...config,
|
|
12
48
|
};
|
|
13
|
-
// We
|
|
14
|
-
//
|
|
49
|
+
// We need to allow different endpoints based on both given config(other than region) and input.
|
|
50
|
+
// However for most of non-S3 services, region is the only input for endpoint resolver.
|
|
15
51
|
const endpoint = await resolvedConfig.endpointResolver(resolvedConfig, input);
|
|
16
52
|
// Unlike AWS SDK clients, a serializer should NOT populate the `host` or `content-length` headers.
|
|
17
53
|
// Both of these headers are prohibited per Spec(https://developer.mozilla.org/en-US/docs/Glossary/Forbidden_header_name).
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"composeServiceApi.js","sources":["../../../../src/clients/internal/composeServiceApi.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.composeServiceApi = void 0;\nconst composeServiceApi = (transferHandler, serializer, deserializer, defaultConfig) => {\n return async (config, input) => {\n const resolvedConfig = {\n ...defaultConfig,\n ...config,\n };\n // We
|
|
1
|
+
{"version":3,"file":"composeServiceApi.js","sources":["../../../../src/clients/internal/composeServiceApi.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.composeServiceApi = void 0;\n/**\n * Compose a service API handler that accepts input as defined shape and responds conforming to defined output shape.\n * A service API handler is composed with:\n * * A transfer handler\n * * A serializer function\n * * A deserializer function\n * * A default config object\n *\n * The returned service API handler, when called, will trigger the following workflow:\n * 1. When calling the service API handler function, the default config object is merged into the input config\n * object to assign the default values of some omitted configs, resulting to a resolved config object.\n * 2. The `endpointResolver` function from the default config object will be invoked with the resolved config object and\n * API input object resulting to an endpoint instance.\n * 3. The serializer function is invoked with API input object and the endpoint instance resulting to an HTTP request\n * instance.\n * 4. The HTTP request instance and the resolved config object is passed to the transfer handler function.\n * 5. The transfer handler function resolves to an HTTP response instance(can be either successful or failed status code).\n * 6. The deserializer function is invoked with the HTTP response instance resulting to the API output object, and\n * return to the caller.\n *\n *\n * @param transferHandler Async function for dispatching HTTP requests and returning HTTP response.\n * @param serializer Async function for converting object in defined input shape into HTTP request targeting a given\n * \tendpoint.\n * @param deserializer Async function for converting HTTP response into output object in defined output shape, or error\n * \tshape.\n * @param defaultConfig object containing default options to be consumed by transfer handler, serializer and\n * deserializer.\n * @returns a async service API handler function that accepts a config object and input object in defined shape, returns\n * \tan output object in defined shape. It may also throw error instance in defined shape in deserializer. The config\n * object type is composed with options type of transferHandler, endpointResolver function as well as endpointResolver\n * function's input options type, region string. The config object property will be marked as optional if it's also\n * \tdefined in defaultConfig.\n *\n * @internal\n */\nconst composeServiceApi = (transferHandler, serializer, deserializer, defaultConfig) => {\n return async (config, input) => {\n const resolvedConfig = {\n ...defaultConfig,\n ...config,\n };\n // We need to allow different endpoints based on both given config(other than region) and input.\n // However for most of non-S3 services, region is the only input for endpoint resolver.\n const endpoint = await resolvedConfig.endpointResolver(resolvedConfig, input);\n // Unlike AWS SDK clients, a serializer should NOT populate the `host` or `content-length` headers.\n // Both of these headers are prohibited per Spec(https://developer.mozilla.org/en-US/docs/Glossary/Forbidden_header_name).\n // They will be populated automatically by browser, or node-fetch polyfill.\n const request = await serializer(input, endpoint);\n const response = await transferHandler(request, {\n ...resolvedConfig,\n });\n return deserializer(response);\n };\n};\nexports.composeServiceApi = composeServiceApi;\n"],"names":[],"mappings":";;AACA;AACA;AACA,MAAM,CAAC,cAAc,CAAC,OAAO,EAAE,YAAY,EAAE,EAAE,KAAK,EAAE,IAAI,EAAE,CAAC,CAAC;AAC9D,OAAO,CAAC,iBAAiB,GAAG,KAAK,CAAC,CAAC;AACnC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;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,iBAAiB,GAAG,CAAC,eAAe,EAAE,UAAU,EAAE,YAAY,EAAE,aAAa,KAAK;AACxF,IAAI,OAAO,OAAO,MAAM,EAAE,KAAK,KAAK;AACpC,QAAQ,MAAM,cAAc,GAAG;AAC/B,YAAY,GAAG,aAAa;AAC5B,YAAY,GAAG,MAAM;AACrB,SAAS,CAAC;AACV;AACA;AACA,QAAQ,MAAM,QAAQ,GAAG,MAAM,cAAc,CAAC,gBAAgB,CAAC,cAAc,EAAE,KAAK,CAAC,CAAC;AACtF;AACA;AACA;AACA,QAAQ,MAAM,OAAO,GAAG,MAAM,UAAU,CAAC,KAAK,EAAE,QAAQ,CAAC,CAAC;AAC1D,QAAQ,MAAM,QAAQ,GAAG,MAAM,eAAe,CAAC,OAAO,EAAE;AACxD,YAAY,GAAG,cAAc;AAC7B,SAAS,CAAC,CAAC;AACX,QAAQ,OAAO,YAAY,CAAC,QAAQ,CAAC,CAAC;AACtC,KAAK,CAAC;AACN,CAAC,CAAC;AACF,OAAO,CAAC,iBAAiB,GAAG,iBAAiB;;"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export declare const version = "6.7.1-storage-browser-integrity.
|
|
1
|
+
export declare const version = "6.7.1-storage-browser-integrity.405b2cc.0+405b2cc";
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"version.mjs","sources":["../../../src/Platform/version.ts"],"sourcesContent":["// generated by genversion\nexport const version = '6.7.1-storage-browser-integrity.
|
|
1
|
+
{"version":3,"file":"version.mjs","sources":["../../../src/Platform/version.ts"],"sourcesContent":["// generated by genversion\nexport const version = '6.7.1-storage-browser-integrity.405b2cc.0+405b2cc';\n"],"names":[],"mappings":"AAAA;AACY,MAAC,OAAO,GAAG;;;;"}
|
|
@@ -1,13 +1,73 @@
|
|
|
1
1
|
import { ServiceClientOptions } from '../types/aws';
|
|
2
2
|
import { Endpoint, TransferHandler } from '../types/core';
|
|
3
3
|
import { HttpRequest, HttpResponse } from '../types/http';
|
|
4
|
-
|
|
4
|
+
/**
|
|
5
|
+
* Compose a service API handler that accepts input as defined shape and responds conforming to defined output shape.
|
|
6
|
+
* A service API handler is composed with:
|
|
7
|
+
* * A transfer handler
|
|
8
|
+
* * A serializer function
|
|
9
|
+
* * A deserializer function
|
|
10
|
+
* * A default config object
|
|
11
|
+
*
|
|
12
|
+
* The returned service API handler, when called, will trigger the following workflow:
|
|
13
|
+
* 1. When calling the service API handler function, the default config object is merged into the input config
|
|
14
|
+
* object to assign the default values of some omitted configs, resulting to a resolved config object.
|
|
15
|
+
* 2. The `endpointResolver` function from the default config object will be invoked with the resolved config object and
|
|
16
|
+
* API input object resulting to an endpoint instance.
|
|
17
|
+
* 3. The serializer function is invoked with API input object and the endpoint instance resulting to an HTTP request
|
|
18
|
+
* instance.
|
|
19
|
+
* 4. The HTTP request instance and the resolved config object is passed to the transfer handler function.
|
|
20
|
+
* 5. The transfer handler function resolves to an HTTP response instance(can be either successful or failed status code).
|
|
21
|
+
* 6. The deserializer function is invoked with the HTTP response instance resulting to the API output object, and
|
|
22
|
+
* return to the caller.
|
|
23
|
+
*
|
|
24
|
+
*
|
|
25
|
+
* @param transferHandler Async function for dispatching HTTP requests and returning HTTP response.
|
|
26
|
+
* @param serializer Async function for converting object in defined input shape into HTTP request targeting a given
|
|
27
|
+
* endpoint.
|
|
28
|
+
* @param deserializer Async function for converting HTTP response into output object in defined output shape, or error
|
|
29
|
+
* shape.
|
|
30
|
+
* @param defaultConfig object containing default options to be consumed by transfer handler, serializer and
|
|
31
|
+
* deserializer.
|
|
32
|
+
* @returns a async service API handler function that accepts a config object and input object in defined shape, returns
|
|
33
|
+
* an output object in defined shape. It may also throw error instance in defined shape in deserializer. The config
|
|
34
|
+
* object type is composed with options type of transferHandler, endpointResolver function as well as endpointResolver
|
|
35
|
+
* function's input options type, region string. The config object property will be marked as optional if it's also
|
|
36
|
+
* defined in defaultConfig.
|
|
37
|
+
*
|
|
38
|
+
* @internal
|
|
39
|
+
*/
|
|
40
|
+
export declare const composeServiceApi: <TransferHandlerOptions, Input, Output, DefaultConfig>(transferHandler: TransferHandler<HttpRequest, HttpResponse, TransferHandlerOptions>, serializer: (input: Input, endpoint: Endpoint) => Promise<HttpRequest> | HttpRequest, deserializer: (output: HttpResponse) => Promise<Output>, defaultConfig: Partial<DefaultConfig>) => (config: OptionalizeKey<TransferHandlerOptions & ServiceClientOptions & InferEndpointResolverOptionType<DefaultConfig> & Partial<DefaultConfig>, DefaultConfig>, input: Input) => Promise<Output>;
|
|
41
|
+
/**
|
|
42
|
+
* Type helper to make a given key optional in a given type. For all the keys in the `InputDefaultsType`, if its value
|
|
43
|
+
* is assignable to the value of the same key in `InputType`, we will mark the key in `InputType` is optional. If
|
|
44
|
+
* the `InputType` and `InputDefaultsType` has the same key but un-assignable types, the resulting type is `never` to
|
|
45
|
+
* trigger a type error down the line.
|
|
46
|
+
*
|
|
47
|
+
* @example
|
|
48
|
+
* type InputType = {
|
|
49
|
+
* a: string;
|
|
50
|
+
* b: number;
|
|
51
|
+
* c: string;
|
|
52
|
+
* };
|
|
53
|
+
* type InputDefaultsType = {
|
|
54
|
+
* a: string;
|
|
55
|
+
* b: number;
|
|
56
|
+
* };
|
|
57
|
+
* type OutputType = OptionalizeKey<InputType, InputDefaultsType>;
|
|
58
|
+
* OutputType equals to:
|
|
59
|
+
* {
|
|
60
|
+
* a?: string;
|
|
61
|
+
* b?: number;
|
|
62
|
+
* c: string;
|
|
63
|
+
* }
|
|
64
|
+
*/
|
|
5
65
|
type OptionalizeKey<InputType, InputDefaultsType> = {
|
|
6
66
|
[KeyWithDefaultValue in keyof InputDefaultsType]?: KeyWithDefaultValue extends keyof InputType ? InputType[KeyWithDefaultValue] : never;
|
|
7
67
|
} & {
|
|
8
68
|
[KeyWithoutDefaultValue in keyof Omit<InputType, keyof InputDefaultsType>]: InputType[KeyWithoutDefaultValue];
|
|
9
69
|
};
|
|
10
70
|
type InferEndpointResolverOptionType<T> = T extends {
|
|
11
|
-
endpointResolver(options: infer EndpointOptions): any;
|
|
71
|
+
endpointResolver(options: infer EndpointOptions, input: any): any;
|
|
12
72
|
} ? EndpointOptions : never;
|
|
13
73
|
export {};
|
|
@@ -1,13 +1,49 @@
|
|
|
1
1
|
// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
|
|
2
2
|
// SPDX-License-Identifier: Apache-2.0
|
|
3
|
+
/**
|
|
4
|
+
* Compose a service API handler that accepts input as defined shape and responds conforming to defined output shape.
|
|
5
|
+
* A service API handler is composed with:
|
|
6
|
+
* * A transfer handler
|
|
7
|
+
* * A serializer function
|
|
8
|
+
* * A deserializer function
|
|
9
|
+
* * A default config object
|
|
10
|
+
*
|
|
11
|
+
* The returned service API handler, when called, will trigger the following workflow:
|
|
12
|
+
* 1. When calling the service API handler function, the default config object is merged into the input config
|
|
13
|
+
* object to assign the default values of some omitted configs, resulting to a resolved config object.
|
|
14
|
+
* 2. The `endpointResolver` function from the default config object will be invoked with the resolved config object and
|
|
15
|
+
* API input object resulting to an endpoint instance.
|
|
16
|
+
* 3. The serializer function is invoked with API input object and the endpoint instance resulting to an HTTP request
|
|
17
|
+
* instance.
|
|
18
|
+
* 4. The HTTP request instance and the resolved config object is passed to the transfer handler function.
|
|
19
|
+
* 5. The transfer handler function resolves to an HTTP response instance(can be either successful or failed status code).
|
|
20
|
+
* 6. The deserializer function is invoked with the HTTP response instance resulting to the API output object, and
|
|
21
|
+
* return to the caller.
|
|
22
|
+
*
|
|
23
|
+
*
|
|
24
|
+
* @param transferHandler Async function for dispatching HTTP requests and returning HTTP response.
|
|
25
|
+
* @param serializer Async function for converting object in defined input shape into HTTP request targeting a given
|
|
26
|
+
* endpoint.
|
|
27
|
+
* @param deserializer Async function for converting HTTP response into output object in defined output shape, or error
|
|
28
|
+
* shape.
|
|
29
|
+
* @param defaultConfig object containing default options to be consumed by transfer handler, serializer and
|
|
30
|
+
* deserializer.
|
|
31
|
+
* @returns a async service API handler function that accepts a config object and input object in defined shape, returns
|
|
32
|
+
* an output object in defined shape. It may also throw error instance in defined shape in deserializer. The config
|
|
33
|
+
* object type is composed with options type of transferHandler, endpointResolver function as well as endpointResolver
|
|
34
|
+
* function's input options type, region string. The config object property will be marked as optional if it's also
|
|
35
|
+
* defined in defaultConfig.
|
|
36
|
+
*
|
|
37
|
+
* @internal
|
|
38
|
+
*/
|
|
3
39
|
const composeServiceApi = (transferHandler, serializer, deserializer, defaultConfig) => {
|
|
4
40
|
return async (config, input) => {
|
|
5
41
|
const resolvedConfig = {
|
|
6
42
|
...defaultConfig,
|
|
7
43
|
...config,
|
|
8
44
|
};
|
|
9
|
-
// We
|
|
10
|
-
//
|
|
45
|
+
// We need to allow different endpoints based on both given config(other than region) and input.
|
|
46
|
+
// However for most of non-S3 services, region is the only input for endpoint resolver.
|
|
11
47
|
const endpoint = await resolvedConfig.endpointResolver(resolvedConfig, input);
|
|
12
48
|
// Unlike AWS SDK clients, a serializer should NOT populate the `host` or `content-length` headers.
|
|
13
49
|
// Both of these headers are prohibited per Spec(https://developer.mozilla.org/en-US/docs/Glossary/Forbidden_header_name).
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"composeServiceApi.mjs","sources":["../../../../src/clients/internal/composeServiceApi.ts"],"sourcesContent":["// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\nexport const composeServiceApi = (transferHandler, serializer, deserializer, defaultConfig) => {\n return async (config, input) => {\n const resolvedConfig = {\n ...defaultConfig,\n ...config,\n };\n // We
|
|
1
|
+
{"version":3,"file":"composeServiceApi.mjs","sources":["../../../../src/clients/internal/composeServiceApi.ts"],"sourcesContent":["// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\n/**\n * Compose a service API handler that accepts input as defined shape and responds conforming to defined output shape.\n * A service API handler is composed with:\n * * A transfer handler\n * * A serializer function\n * * A deserializer function\n * * A default config object\n *\n * The returned service API handler, when called, will trigger the following workflow:\n * 1. When calling the service API handler function, the default config object is merged into the input config\n * object to assign the default values of some omitted configs, resulting to a resolved config object.\n * 2. The `endpointResolver` function from the default config object will be invoked with the resolved config object and\n * API input object resulting to an endpoint instance.\n * 3. The serializer function is invoked with API input object and the endpoint instance resulting to an HTTP request\n * instance.\n * 4. The HTTP request instance and the resolved config object is passed to the transfer handler function.\n * 5. The transfer handler function resolves to an HTTP response instance(can be either successful or failed status code).\n * 6. The deserializer function is invoked with the HTTP response instance resulting to the API output object, and\n * return to the caller.\n *\n *\n * @param transferHandler Async function for dispatching HTTP requests and returning HTTP response.\n * @param serializer Async function for converting object in defined input shape into HTTP request targeting a given\n * \tendpoint.\n * @param deserializer Async function for converting HTTP response into output object in defined output shape, or error\n * \tshape.\n * @param defaultConfig object containing default options to be consumed by transfer handler, serializer and\n * deserializer.\n * @returns a async service API handler function that accepts a config object and input object in defined shape, returns\n * \tan output object in defined shape. It may also throw error instance in defined shape in deserializer. The config\n * object type is composed with options type of transferHandler, endpointResolver function as well as endpointResolver\n * function's input options type, region string. The config object property will be marked as optional if it's also\n * \tdefined in defaultConfig.\n *\n * @internal\n */\nexport const composeServiceApi = (transferHandler, serializer, deserializer, defaultConfig) => {\n return async (config, input) => {\n const resolvedConfig = {\n ...defaultConfig,\n ...config,\n };\n // We need to allow different endpoints based on both given config(other than region) and input.\n // However for most of non-S3 services, region is the only input for endpoint resolver.\n const endpoint = await resolvedConfig.endpointResolver(resolvedConfig, input);\n // Unlike AWS SDK clients, a serializer should NOT populate the `host` or `content-length` headers.\n // Both of these headers are prohibited per Spec(https://developer.mozilla.org/en-US/docs/Glossary/Forbidden_header_name).\n // They will be populated automatically by browser, or node-fetch polyfill.\n const request = await serializer(input, endpoint);\n const response = await transferHandler(request, {\n ...resolvedConfig,\n });\n return deserializer(response);\n };\n};\n"],"names":[],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACY,MAAC,iBAAiB,GAAG,CAAC,eAAe,EAAE,UAAU,EAAE,YAAY,EAAE,aAAa,KAAK;AAC/F,IAAI,OAAO,OAAO,MAAM,EAAE,KAAK,KAAK;AACpC,QAAQ,MAAM,cAAc,GAAG;AAC/B,YAAY,GAAG,aAAa;AAC5B,YAAY,GAAG,MAAM;AACrB,SAAS,CAAC;AACV;AACA;AACA,QAAQ,MAAM,QAAQ,GAAG,MAAM,cAAc,CAAC,gBAAgB,CAAC,cAAc,EAAE,KAAK,CAAC,CAAC;AACtF;AACA;AACA;AACA,QAAQ,MAAM,OAAO,GAAG,MAAM,UAAU,CAAC,KAAK,EAAE,QAAQ,CAAC,CAAC;AAC1D,QAAQ,MAAM,QAAQ,GAAG,MAAM,eAAe,CAAC,OAAO,EAAE;AACxD,YAAY,GAAG,cAAc;AAC7B,SAAS,CAAC,CAAC;AACX,QAAQ,OAAO,YAAY,CAAC,QAAQ,CAAC,CAAC;AACtC,KAAK,CAAC;AACN;;;;"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@aws-amplify/core",
|
|
3
|
-
"version": "6.5.1-storage-browser-integrity.
|
|
3
|
+
"version": "6.5.1-storage-browser-integrity.405b2cc.0+405b2cc",
|
|
4
4
|
"description": "Core category of aws-amplify",
|
|
5
5
|
"main": "./dist/cjs/index.js",
|
|
6
6
|
"module": "./dist/esm/index.mjs",
|
|
@@ -60,7 +60,7 @@
|
|
|
60
60
|
"uuid": "^9.0.0"
|
|
61
61
|
},
|
|
62
62
|
"devDependencies": {
|
|
63
|
-
"@aws-amplify/react-native": "1.1.7-storage-browser-integrity.
|
|
63
|
+
"@aws-amplify/react-native": "1.1.7-storage-browser-integrity.405b2cc.0+405b2cc",
|
|
64
64
|
"@types/js-cookie": "3.0.2",
|
|
65
65
|
"genversion": "^2.2.0",
|
|
66
66
|
"typescript": "5.0.2"
|
|
@@ -192,5 +192,5 @@
|
|
|
192
192
|
]
|
|
193
193
|
}
|
|
194
194
|
},
|
|
195
|
-
"gitHead": "
|
|
195
|
+
"gitHead": "405b2cc66dc630dbfd36e8dc4a7c897dae99d87c"
|
|
196
196
|
}
|
package/src/Platform/version.ts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
// generated by genversion
|
|
2
|
-
export const version = '6.7.1-storage-browser-integrity.
|
|
2
|
+
export const version = '6.7.1-storage-browser-integrity.405b2cc.0+405b2cc';
|
|
@@ -5,6 +5,42 @@ import { ServiceClientOptions } from '../types/aws';
|
|
|
5
5
|
import { Endpoint, TransferHandler } from '../types/core';
|
|
6
6
|
import { HttpRequest, HttpResponse } from '../types/http';
|
|
7
7
|
|
|
8
|
+
/**
|
|
9
|
+
* Compose a service API handler that accepts input as defined shape and responds conforming to defined output shape.
|
|
10
|
+
* A service API handler is composed with:
|
|
11
|
+
* * A transfer handler
|
|
12
|
+
* * A serializer function
|
|
13
|
+
* * A deserializer function
|
|
14
|
+
* * A default config object
|
|
15
|
+
*
|
|
16
|
+
* The returned service API handler, when called, will trigger the following workflow:
|
|
17
|
+
* 1. When calling the service API handler function, the default config object is merged into the input config
|
|
18
|
+
* object to assign the default values of some omitted configs, resulting to a resolved config object.
|
|
19
|
+
* 2. The `endpointResolver` function from the default config object will be invoked with the resolved config object and
|
|
20
|
+
* API input object resulting to an endpoint instance.
|
|
21
|
+
* 3. The serializer function is invoked with API input object and the endpoint instance resulting to an HTTP request
|
|
22
|
+
* instance.
|
|
23
|
+
* 4. The HTTP request instance and the resolved config object is passed to the transfer handler function.
|
|
24
|
+
* 5. The transfer handler function resolves to an HTTP response instance(can be either successful or failed status code).
|
|
25
|
+
* 6. The deserializer function is invoked with the HTTP response instance resulting to the API output object, and
|
|
26
|
+
* return to the caller.
|
|
27
|
+
*
|
|
28
|
+
*
|
|
29
|
+
* @param transferHandler Async function for dispatching HTTP requests and returning HTTP response.
|
|
30
|
+
* @param serializer Async function for converting object in defined input shape into HTTP request targeting a given
|
|
31
|
+
* endpoint.
|
|
32
|
+
* @param deserializer Async function for converting HTTP response into output object in defined output shape, or error
|
|
33
|
+
* shape.
|
|
34
|
+
* @param defaultConfig object containing default options to be consumed by transfer handler, serializer and
|
|
35
|
+
* deserializer.
|
|
36
|
+
* @returns a async service API handler function that accepts a config object and input object in defined shape, returns
|
|
37
|
+
* an output object in defined shape. It may also throw error instance in defined shape in deserializer. The config
|
|
38
|
+
* object type is composed with options type of transferHandler, endpointResolver function as well as endpointResolver
|
|
39
|
+
* function's input options type, region string. The config object property will be marked as optional if it's also
|
|
40
|
+
* defined in defaultConfig.
|
|
41
|
+
*
|
|
42
|
+
* @internal
|
|
43
|
+
*/
|
|
8
44
|
export const composeServiceApi = <
|
|
9
45
|
TransferHandlerOptions,
|
|
10
46
|
Input,
|
|
@@ -26,9 +62,9 @@ export const composeServiceApi = <
|
|
|
26
62
|
return async (
|
|
27
63
|
config: OptionalizeKey<
|
|
28
64
|
TransferHandlerOptions &
|
|
29
|
-
ServiceClientOptions &
|
|
30
|
-
|
|
31
|
-
|
|
65
|
+
ServiceClientOptions & // Required configs(e.g. endpointResolver, region) to serialize input shapes into requests
|
|
66
|
+
InferEndpointResolverOptionType<DefaultConfig> & // Required inputs for endpointResolver
|
|
67
|
+
Partial<DefaultConfig>, // Properties defined in default configs, we need to allow overwriting them when invoking the service API handler
|
|
32
68
|
DefaultConfig
|
|
33
69
|
>,
|
|
34
70
|
input: Input,
|
|
@@ -37,8 +73,8 @@ export const composeServiceApi = <
|
|
|
37
73
|
...defaultConfig,
|
|
38
74
|
...config,
|
|
39
75
|
} as unknown as TransferHandlerOptions & ServiceClientOptions;
|
|
40
|
-
// We
|
|
41
|
-
//
|
|
76
|
+
// We need to allow different endpoints based on both given config(other than region) and input.
|
|
77
|
+
// However for most of non-S3 services, region is the only input for endpoint resolver.
|
|
42
78
|
const endpoint = await resolvedConfig.endpointResolver(
|
|
43
79
|
resolvedConfig,
|
|
44
80
|
input,
|
|
@@ -55,6 +91,30 @@ export const composeServiceApi = <
|
|
|
55
91
|
};
|
|
56
92
|
};
|
|
57
93
|
|
|
94
|
+
/**
|
|
95
|
+
* Type helper to make a given key optional in a given type. For all the keys in the `InputDefaultsType`, if its value
|
|
96
|
+
* is assignable to the value of the same key in `InputType`, we will mark the key in `InputType` is optional. If
|
|
97
|
+
* the `InputType` and `InputDefaultsType` has the same key but un-assignable types, the resulting type is `never` to
|
|
98
|
+
* trigger a type error down the line.
|
|
99
|
+
*
|
|
100
|
+
* @example
|
|
101
|
+
* type InputType = {
|
|
102
|
+
* a: string;
|
|
103
|
+
* b: number;
|
|
104
|
+
* c: string;
|
|
105
|
+
* };
|
|
106
|
+
* type InputDefaultsType = {
|
|
107
|
+
* a: string;
|
|
108
|
+
* b: number;
|
|
109
|
+
* };
|
|
110
|
+
* type OutputType = OptionalizeKey<InputType, InputDefaultsType>;
|
|
111
|
+
* OutputType equals to:
|
|
112
|
+
* {
|
|
113
|
+
* a?: string;
|
|
114
|
+
* b?: number;
|
|
115
|
+
* c: string;
|
|
116
|
+
* }
|
|
117
|
+
*/
|
|
58
118
|
type OptionalizeKey<InputType, InputDefaultsType> = {
|
|
59
119
|
[KeyWithDefaultValue in keyof InputDefaultsType]?: KeyWithDefaultValue extends keyof InputType
|
|
60
120
|
? InputType[KeyWithDefaultValue]
|
|
@@ -67,7 +127,7 @@ type OptionalizeKey<InputType, InputDefaultsType> = {
|
|
|
67
127
|
};
|
|
68
128
|
|
|
69
129
|
type InferEndpointResolverOptionType<T> = T extends {
|
|
70
|
-
endpointResolver(options: infer EndpointOptions): any;
|
|
130
|
+
endpointResolver(options: infer EndpointOptions, input: any): any;
|
|
71
131
|
}
|
|
72
132
|
? EndpointOptions
|
|
73
133
|
: never;
|