@aws-amplify/graphql-api-construct 1.18.7 → 1.18.8
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/.jsii +83 -43
- package/CHANGELOG.md +6 -0
- package/lib/amplify-dynamodb-table-wrapper.js +1 -1
- package/lib/amplify-graphql-api.js +4 -2
- package/lib/amplify-graphql-definition.js +1 -1
- package/lib/sql-model-datasource-strategy.js +1 -1
- package/node_modules/@aws-amplify/ai-constructs/lib/conversation/conversation_handler_construct.d.ts +13 -0
- package/node_modules/@aws-amplify/ai-constructs/lib/conversation/conversation_handler_construct.js +17 -4
- package/node_modules/@aws-amplify/ai-constructs/lib/conversation/runtime/bedrock_converse_adapter.js +89 -71
- package/node_modules/@aws-amplify/ai-constructs/lib/conversation/runtime/types.d.ts +1 -0
- package/node_modules/@aws-amplify/ai-constructs/lib/conversation/runtime/types.js +1 -1
- package/node_modules/@aws-amplify/ai-constructs/node_modules/@aws-amplify/platform-core/README.md +9 -0
- package/node_modules/@aws-amplify/ai-constructs/node_modules/@aws-amplify/platform-core/lib/backend_entry_point_locator.d.ts +14 -0
- package/node_modules/@aws-amplify/ai-constructs/node_modules/@aws-amplify/platform-core/lib/backend_entry_point_locator.js +37 -0
- package/node_modules/@aws-amplify/ai-constructs/node_modules/@aws-amplify/platform-core/lib/backend_identifier_conversions.d.ts +22 -0
- package/node_modules/@aws-amplify/ai-constructs/node_modules/@aws-amplify/platform-core/lib/backend_identifier_conversions.js +90 -0
- package/node_modules/@aws-amplify/ai-constructs/node_modules/@aws-amplify/platform-core/lib/caller_directory_extractor.d.ts +14 -0
- package/node_modules/@aws-amplify/ai-constructs/node_modules/@aws-amplify/platform-core/lib/caller_directory_extractor.js +70 -0
- package/node_modules/@aws-amplify/ai-constructs/node_modules/@aws-amplify/platform-core/lib/cdk/enum_converters.d.ts +18 -0
- package/node_modules/@aws-amplify/ai-constructs/node_modules/@aws-amplify/platform-core/lib/cdk/enum_converters.js +116 -0
- package/node_modules/@aws-amplify/ai-constructs/node_modules/@aws-amplify/platform-core/lib/cdk/index.d.ts +3 -0
- package/node_modules/@aws-amplify/ai-constructs/node_modules/@aws-amplify/platform-core/lib/cdk/index.js +7 -0
- package/node_modules/@aws-amplify/ai-constructs/node_modules/@aws-amplify/platform-core/lib/cdk_context_key.d.ts +12 -0
- package/node_modules/@aws-amplify/ai-constructs/node_modules/@aws-amplify/platform-core/lib/cdk_context_key.js +16 -0
- package/node_modules/@aws-amplify/ai-constructs/node_modules/@aws-amplify/platform-core/lib/config/local_configuration_controller.d.ts +45 -0
- package/node_modules/@aws-amplify/ai-constructs/node_modules/@aws-amplify/platform-core/lib/config/local_configuration_controller.js +125 -0
- package/node_modules/@aws-amplify/ai-constructs/node_modules/@aws-amplify/platform-core/lib/config/local_configuration_controller_factory.d.ts +23 -0
- package/node_modules/@aws-amplify/ai-constructs/node_modules/@aws-amplify/platform-core/lib/config/local_configuration_controller_factory.js +29 -0
- package/node_modules/@aws-amplify/ai-constructs/node_modules/@aws-amplify/platform-core/lib/errors/amplify_error.d.ts +64 -0
- package/node_modules/@aws-amplify/ai-constructs/node_modules/@aws-amplify/platform-core/lib/errors/amplify_error.js +267 -0
- package/node_modules/@aws-amplify/ai-constructs/node_modules/@aws-amplify/platform-core/lib/errors/amplify_library_fault.d.ts +21 -0
- package/node_modules/@aws-amplify/ai-constructs/node_modules/@aws-amplify/platform-core/lib/errors/amplify_library_fault.js +27 -0
- package/node_modules/@aws-amplify/ai-constructs/node_modules/@aws-amplify/platform-core/lib/errors/amplify_user_error.d.ts +21 -0
- package/node_modules/@aws-amplify/ai-constructs/node_modules/@aws-amplify/platform-core/lib/errors/amplify_user_error.js +27 -0
- package/node_modules/@aws-amplify/ai-constructs/node_modules/@aws-amplify/platform-core/lib/errors/index.d.ts +4 -0
- package/node_modules/@aws-amplify/ai-constructs/node_modules/@aws-amplify/platform-core/lib/errors/index.js +20 -0
- package/node_modules/@aws-amplify/ai-constructs/node_modules/@aws-amplify/platform-core/lib/extract_file_path_from_stack_trace_line.d.ts +13 -0
- package/node_modules/@aws-amplify/ai-constructs/node_modules/@aws-amplify/platform-core/lib/extract_file_path_from_stack_trace_line.js +61 -0
- package/node_modules/@aws-amplify/ai-constructs/node_modules/@aws-amplify/platform-core/lib/index.d.ts +15 -0
- package/node_modules/@aws-amplify/ai-constructs/node_modules/@aws-amplify/platform-core/lib/index.internal.d.ts +4 -0
- package/node_modules/@aws-amplify/ai-constructs/node_modules/@aws-amplify/platform-core/lib/index.internal.js +35 -0
- package/node_modules/@aws-amplify/ai-constructs/node_modules/@aws-amplify/platform-core/lib/index.js +35 -0
- package/node_modules/@aws-amplify/ai-constructs/node_modules/@aws-amplify/platform-core/lib/naming_convention_conversions.d.ts +13 -0
- package/node_modules/@aws-amplify/ai-constructs/node_modules/@aws-amplify/platform-core/lib/naming_convention_conversions.js +23 -0
- package/node_modules/@aws-amplify/ai-constructs/node_modules/@aws-amplify/platform-core/lib/object_accumulator.d.ts +45 -0
- package/node_modules/@aws-amplify/ai-constructs/node_modules/@aws-amplify/platform-core/lib/object_accumulator.js +99 -0
- package/node_modules/@aws-amplify/ai-constructs/node_modules/@aws-amplify/platform-core/lib/package_json_reader.d.ts +33 -0
- package/node_modules/@aws-amplify/ai-constructs/node_modules/@aws-amplify/platform-core/lib/package_json_reader.js +56 -0
- package/node_modules/@aws-amplify/ai-constructs/node_modules/@aws-amplify/platform-core/lib/parameter_path_conversions.d.ts +19 -0
- package/node_modules/@aws-amplify/ai-constructs/node_modules/@aws-amplify/platform-core/lib/parameter_path_conversions.js +79 -0
- package/node_modules/@aws-amplify/ai-constructs/node_modules/@aws-amplify/platform-core/lib/tag_name.d.ts +4 -0
- package/node_modules/@aws-amplify/ai-constructs/node_modules/@aws-amplify/platform-core/lib/tag_name.js +8 -0
- package/node_modules/@aws-amplify/ai-constructs/node_modules/@aws-amplify/platform-core/lib/usage-data/account_id_fetcher.d.ts +14 -0
- package/node_modules/@aws-amplify/ai-constructs/node_modules/@aws-amplify/platform-core/lib/usage-data/account_id_fetcher.js +38 -0
- package/node_modules/@aws-amplify/ai-constructs/node_modules/@aws-amplify/platform-core/lib/usage-data/constants.d.ts +13 -0
- package/node_modules/@aws-amplify/ai-constructs/node_modules/@aws-amplify/platform-core/lib/usage-data/constants.js +16 -0
- package/node_modules/@aws-amplify/ai-constructs/node_modules/@aws-amplify/platform-core/lib/usage-data/get_installation_id.d.ts +5 -0
- package/node_modules/@aws-amplify/ai-constructs/node_modules/@aws-amplify/platform-core/lib/usage-data/get_installation_id.js +15 -0
- package/node_modules/@aws-amplify/ai-constructs/node_modules/@aws-amplify/platform-core/lib/usage-data/get_usage_data_url.d.ts +6 -0
- package/node_modules/@aws-amplify/ai-constructs/node_modules/@aws-amplify/platform-core/lib/usage-data/get_usage_data_url.js +24 -0
- package/node_modules/@aws-amplify/ai-constructs/node_modules/@aws-amplify/platform-core/lib/usage-data/noop_usage_data_emitter.d.ts +15 -0
- package/node_modules/@aws-amplify/ai-constructs/node_modules/@aws-amplify/platform-core/lib/usage-data/noop_usage_data_emitter.js +24 -0
- package/node_modules/@aws-amplify/ai-constructs/node_modules/@aws-amplify/platform-core/lib/usage-data/serializable_error.d.ts +27 -0
- package/node_modules/@aws-amplify/ai-constructs/node_modules/@aws-amplify/platform-core/lib/usage-data/serializable_error.js +70 -0
- package/node_modules/@aws-amplify/ai-constructs/node_modules/@aws-amplify/platform-core/lib/usage-data/usage_data.d.ts +29 -0
- package/node_modules/@aws-amplify/ai-constructs/node_modules/@aws-amplify/platform-core/lib/usage-data/usage_data.js +3 -0
- package/node_modules/@aws-amplify/ai-constructs/node_modules/@aws-amplify/platform-core/lib/usage-data/usage_data_emitter.d.ts +27 -0
- package/node_modules/@aws-amplify/ai-constructs/node_modules/@aws-amplify/platform-core/lib/usage-data/usage_data_emitter.js +146 -0
- package/node_modules/@aws-amplify/ai-constructs/node_modules/@aws-amplify/platform-core/lib/usage-data/usage_data_emitter_factory.d.ts +16 -0
- package/node_modules/@aws-amplify/ai-constructs/node_modules/@aws-amplify/platform-core/lib/usage-data/usage_data_emitter_factory.js +27 -0
- package/node_modules/@aws-amplify/ai-constructs/node_modules/@aws-amplify/platform-core/package.json +45 -0
- package/node_modules/@aws-amplify/ai-constructs/node_modules/@aws-amplify/plugin-types/README.md +9 -0
- package/node_modules/@aws-amplify/ai-constructs/node_modules/@aws-amplify/plugin-types/lib/amplify_function.d.ts +4 -0
- package/node_modules/@aws-amplify/ai-constructs/node_modules/@aws-amplify/plugin-types/lib/amplify_function.js +3 -0
- package/node_modules/@aws-amplify/ai-constructs/node_modules/@aws-amplify/plugin-types/lib/amplify_resource_group_name.d.ts +7 -0
- package/node_modules/@aws-amplify/ai-constructs/node_modules/@aws-amplify/plugin-types/lib/amplify_resource_group_name.js +3 -0
- package/node_modules/@aws-amplify/ai-constructs/node_modules/@aws-amplify/plugin-types/lib/auth_resources.d.ts +106 -0
- package/node_modules/@aws-amplify/ai-constructs/node_modules/@aws-amplify/plugin-types/lib/auth_resources.js +3 -0
- package/node_modules/@aws-amplify/ai-constructs/node_modules/@aws-amplify/plugin-types/lib/aws_client_provider.d.ts +5 -0
- package/node_modules/@aws-amplify/ai-constructs/node_modules/@aws-amplify/plugin-types/lib/aws_client_provider.js +3 -0
- package/node_modules/@aws-amplify/ai-constructs/node_modules/@aws-amplify/plugin-types/lib/backend_identifier.d.ts +56 -0
- package/node_modules/@aws-amplify/ai-constructs/node_modules/@aws-amplify/plugin-types/lib/backend_identifier.js +3 -0
- package/node_modules/@aws-amplify/ai-constructs/node_modules/@aws-amplify/plugin-types/lib/backend_output.d.ts +6 -0
- package/node_modules/@aws-amplify/ai-constructs/node_modules/@aws-amplify/plugin-types/lib/backend_output.js +3 -0
- package/node_modules/@aws-amplify/ai-constructs/node_modules/@aws-amplify/plugin-types/lib/backend_secret_resolver.d.ts +22 -0
- package/node_modules/@aws-amplify/ai-constructs/node_modules/@aws-amplify/plugin-types/lib/backend_secret_resolver.js +3 -0
- package/node_modules/@aws-amplify/ai-constructs/node_modules/@aws-amplify/plugin-types/lib/backend_stack_creator.d.ts +8 -0
- package/node_modules/@aws-amplify/ai-constructs/node_modules/@aws-amplify/plugin-types/lib/backend_stack_creator.js +3 -0
- package/node_modules/@aws-amplify/ai-constructs/node_modules/@aws-amplify/plugin-types/lib/backend_stack_resolver.d.ts +7 -0
- package/node_modules/@aws-amplify/ai-constructs/node_modules/@aws-amplify/plugin-types/lib/backend_stack_resolver.js +3 -0
- package/node_modules/@aws-amplify/ai-constructs/node_modules/@aws-amplify/plugin-types/lib/construct_container.d.ts +35 -0
- package/node_modules/@aws-amplify/ai-constructs/node_modules/@aws-amplify/plugin-types/lib/construct_container.js +3 -0
- package/node_modules/@aws-amplify/ai-constructs/node_modules/@aws-amplify/plugin-types/lib/construct_factory.d.ts +24 -0
- package/node_modules/@aws-amplify/ai-constructs/node_modules/@aws-amplify/plugin-types/lib/construct_factory.js +3 -0
- package/node_modules/@aws-amplify/ai-constructs/node_modules/@aws-amplify/plugin-types/lib/deep_partial.d.ts +17 -0
- package/node_modules/@aws-amplify/ai-constructs/node_modules/@aws-amplify/plugin-types/lib/deep_partial.js +3 -0
- package/node_modules/@aws-amplify/ai-constructs/node_modules/@aws-amplify/plugin-types/lib/deployment_type.d.ts +8 -0
- package/node_modules/@aws-amplify/ai-constructs/node_modules/@aws-amplify/plugin-types/lib/deployment_type.js +3 -0
- package/node_modules/@aws-amplify/ai-constructs/node_modules/@aws-amplify/plugin-types/lib/function_resources.d.ts +8 -0
- package/node_modules/@aws-amplify/ai-constructs/node_modules/@aws-amplify/plugin-types/lib/function_resources.js +3 -0
- package/node_modules/@aws-amplify/ai-constructs/node_modules/@aws-amplify/plugin-types/lib/import_path_verifier.d.ts +14 -0
- package/node_modules/@aws-amplify/ai-constructs/node_modules/@aws-amplify/plugin-types/lib/import_path_verifier.js +3 -0
- package/node_modules/@aws-amplify/ai-constructs/node_modules/@aws-amplify/plugin-types/lib/index.d.ts +27 -0
- package/node_modules/@aws-amplify/ai-constructs/node_modules/@aws-amplify/plugin-types/lib/index.js +43 -0
- package/node_modules/@aws-amplify/ai-constructs/node_modules/@aws-amplify/plugin-types/lib/log_level.d.ts +2 -0
- package/node_modules/@aws-amplify/ai-constructs/node_modules/@aws-amplify/plugin-types/lib/log_level.js +3 -0
- package/node_modules/@aws-amplify/ai-constructs/node_modules/@aws-amplify/plugin-types/lib/log_retention.d.ts +2 -0
- package/node_modules/@aws-amplify/ai-constructs/node_modules/@aws-amplify/plugin-types/lib/log_retention.js +3 -0
- package/node_modules/@aws-amplify/ai-constructs/node_modules/@aws-amplify/plugin-types/lib/output_retrieval_strategy.d.ts +11 -0
- package/node_modules/@aws-amplify/ai-constructs/node_modules/@aws-amplify/plugin-types/lib/output_retrieval_strategy.js +3 -0
- package/node_modules/@aws-amplify/ai-constructs/node_modules/@aws-amplify/plugin-types/lib/output_storage_strategy.d.ts +10 -0
- package/node_modules/@aws-amplify/ai-constructs/node_modules/@aws-amplify/plugin-types/lib/output_storage_strategy.js +3 -0
- package/node_modules/@aws-amplify/ai-constructs/node_modules/@aws-amplify/plugin-types/lib/package_manager_controller.d.ts +30 -0
- package/node_modules/@aws-amplify/ai-constructs/node_modules/@aws-amplify/plugin-types/lib/package_manager_controller.js +3 -0
- package/node_modules/@aws-amplify/ai-constructs/node_modules/@aws-amplify/plugin-types/lib/resource_access_acceptor.d.ts +27 -0
- package/node_modules/@aws-amplify/ai-constructs/node_modules/@aws-amplify/plugin-types/lib/resource_access_acceptor.js +3 -0
- package/node_modules/@aws-amplify/ai-constructs/node_modules/@aws-amplify/plugin-types/lib/resource_name_validator.d.ts +10 -0
- package/node_modules/@aws-amplify/ai-constructs/node_modules/@aws-amplify/plugin-types/lib/resource_name_validator.js +3 -0
- package/node_modules/@aws-amplify/ai-constructs/node_modules/@aws-amplify/plugin-types/lib/resource_provider.d.ts +10 -0
- package/node_modules/@aws-amplify/ai-constructs/node_modules/@aws-amplify/plugin-types/lib/resource_provider.js +3 -0
- package/node_modules/@aws-amplify/ai-constructs/node_modules/@aws-amplify/plugin-types/lib/ssm_environment_entries_generator.d.ts +5 -0
- package/node_modules/@aws-amplify/ai-constructs/node_modules/@aws-amplify/plugin-types/lib/ssm_environment_entries_generator.js +3 -0
- package/node_modules/@aws-amplify/ai-constructs/node_modules/@aws-amplify/plugin-types/lib/stable_backend_identifiers.d.ts +4 -0
- package/node_modules/@aws-amplify/ai-constructs/node_modules/@aws-amplify/plugin-types/lib/stable_backend_identifiers.js +3 -0
- package/node_modules/@aws-amplify/ai-constructs/node_modules/@aws-amplify/plugin-types/lib/stack_provider.d.ts +5 -0
- package/node_modules/@aws-amplify/ai-constructs/node_modules/@aws-amplify/plugin-types/lib/stack_provider.js +3 -0
- package/node_modules/@aws-amplify/ai-constructs/node_modules/@aws-amplify/plugin-types/package.json +21 -0
- package/node_modules/@aws-amplify/ai-constructs/package.json +5 -5
- package/node_modules/@aws-amplify/graphql-auth-transformer/CHANGELOG.md +4 -0
- package/node_modules/@aws-amplify/graphql-auth-transformer/package.json +12 -12
- package/node_modules/@aws-amplify/graphql-conversation-transformer/CHANGELOG.md +6 -0
- package/node_modules/@aws-amplify/graphql-conversation-transformer/package.json +10 -10
- package/node_modules/@aws-amplify/graphql-default-value-transformer/CHANGELOG.md +4 -0
- package/node_modules/@aws-amplify/graphql-default-value-transformer/package.json +6 -6
- package/node_modules/@aws-amplify/graphql-function-transformer/CHANGELOG.md +4 -0
- package/node_modules/@aws-amplify/graphql-function-transformer/package.json +6 -6
- package/node_modules/@aws-amplify/graphql-generation-transformer/CHANGELOG.md +4 -0
- package/node_modules/@aws-amplify/graphql-generation-transformer/package.json +6 -6
- package/node_modules/@aws-amplify/graphql-http-transformer/CHANGELOG.md +4 -0
- package/node_modules/@aws-amplify/graphql-http-transformer/package.json +6 -6
- package/node_modules/@aws-amplify/graphql-index-transformer/CHANGELOG.md +4 -0
- package/node_modules/@aws-amplify/graphql-index-transformer/package.json +7 -7
- package/node_modules/@aws-amplify/graphql-maps-to-transformer/CHANGELOG.md +4 -0
- package/node_modules/@aws-amplify/graphql-maps-to-transformer/lib/assets/mapping-lambda.zip +0 -0
- package/node_modules/@aws-amplify/graphql-maps-to-transformer/package.json +10 -10
- package/node_modules/@aws-amplify/graphql-model-transformer/CHANGELOG.md +7 -0
- package/node_modules/@aws-amplify/graphql-model-transformer/lib/rds-lambda.zip +0 -0
- package/node_modules/@aws-amplify/graphql-model-transformer/lib/rds-notification-lambda.zip +0 -0
- package/node_modules/@aws-amplify/graphql-model-transformer/lib/rds-patching-lambda.zip +0 -0
- package/node_modules/@aws-amplify/graphql-model-transformer/lib/resources/amplify-dynamodb-table/amplify-table-manager-lambda/import-table.d.ts +1 -0
- package/node_modules/@aws-amplify/graphql-model-transformer/lib/resources/amplify-dynamodb-table/amplify-table-manager-lambda/import-table.d.ts.map +1 -1
- package/node_modules/@aws-amplify/graphql-model-transformer/lib/resources/amplify-dynamodb-table/amplify-table-manager-lambda/import-table.js +24 -4
- package/node_modules/@aws-amplify/graphql-model-transformer/lib/resources/amplify-dynamodb-table/amplify-table-manager-lambda/import-table.js.map +1 -1
- package/node_modules/@aws-amplify/graphql-model-transformer/package.json +6 -6
- package/node_modules/@aws-amplify/graphql-predictions-transformer/CHANGELOG.md +4 -0
- package/node_modules/@aws-amplify/graphql-predictions-transformer/lib/predictionsLambdaFunction.zip +0 -0
- package/node_modules/@aws-amplify/graphql-predictions-transformer/package.json +6 -6
- package/node_modules/@aws-amplify/graphql-relational-transformer/CHANGELOG.md +4 -0
- package/node_modules/@aws-amplify/graphql-relational-transformer/package.json +8 -8
- package/node_modules/@aws-amplify/graphql-searchable-transformer/CHANGELOG.md +4 -0
- package/node_modules/@aws-amplify/graphql-searchable-transformer/lib/streaming-lambda.zip +0 -0
- package/node_modules/@aws-amplify/graphql-searchable-transformer/package.json +7 -7
- package/node_modules/@aws-amplify/graphql-sql-transformer/CHANGELOG.md +4 -0
- package/node_modules/@aws-amplify/graphql-sql-transformer/package.json +7 -7
- package/node_modules/@aws-amplify/graphql-transformer/CHANGELOG.md +4 -0
- package/node_modules/@aws-amplify/graphql-transformer/package.json +19 -19
- package/node_modules/@aws-amplify/graphql-transformer-core/CHANGELOG.md +4 -0
- package/node_modules/@aws-amplify/graphql-transformer-core/package.json +4 -4
- package/node_modules/@aws-amplify/graphql-transformer-interfaces/CHANGELOG.md +4 -0
- package/node_modules/@aws-amplify/graphql-transformer-interfaces/package.json +3 -3
- package/node_modules/@aws-amplify/graphql-transformer-interfaces/tsconfig.tsbuildinfo +1 -1
- package/node_modules/lodash.snakecase/LICENSE +47 -0
- package/node_modules/lodash.snakecase/README.md +18 -0
- package/node_modules/lodash.snakecase/index.js +435 -0
- package/node_modules/lodash.snakecase/package.json +17 -0
- package/package.json +24 -22
- package/src/amplify-graphql-api.ts +7 -1
@@ -0,0 +1,35 @@
|
|
1
|
+
"use strict";
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
3
|
+
if (k2 === undefined) k2 = k;
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
7
|
+
}
|
8
|
+
Object.defineProperty(o, k2, desc);
|
9
|
+
}) : (function(o, m, k, k2) {
|
10
|
+
if (k2 === undefined) k2 = k;
|
11
|
+
o[k2] = m[k];
|
12
|
+
}));
|
13
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
14
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
15
|
+
}) : function(o, v) {
|
16
|
+
o["default"] = v;
|
17
|
+
});
|
18
|
+
var __importStar = (this && this.__importStar) || function (mod) {
|
19
|
+
if (mod && mod.__esModule) return mod;
|
20
|
+
var result = {};
|
21
|
+
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
22
|
+
__setModuleDefault(result, mod);
|
23
|
+
return result;
|
24
|
+
};
|
25
|
+
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
26
|
+
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
27
|
+
};
|
28
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
29
|
+
exports.__export__cdk = void 0;
|
30
|
+
// Suppressing to allow special prefix __export__ that is recognized by API checks.
|
31
|
+
// eslint-disable-next-line @typescript-eslint/naming-convention
|
32
|
+
const __export__cdk = __importStar(require("./cdk/index.js"));
|
33
|
+
exports.__export__cdk = __export__cdk;
|
34
|
+
__exportStar(require("./index.js"), exports);
|
35
|
+
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiaW5kZXguaW50ZXJuYWwuanMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyIuLi9zcmMvaW5kZXguaW50ZXJuYWwudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6Ijs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7QUFBQSxtRkFBbUY7QUFDbkYsZ0VBQWdFO0FBQ2hFLDhEQUFnRDtBQVN2QyxzQ0FBYTtBQVB0Qiw2Q0FBMkIiLCJzb3VyY2VzQ29udGVudCI6WyIvLyBTdXBwcmVzc2luZyB0byBhbGxvdyBzcGVjaWFsIHByZWZpeCBfX2V4cG9ydF9fIHRoYXQgaXMgcmVjb2duaXplZCBieSBBUEkgY2hlY2tzLlxuLy8gZXNsaW50LWRpc2FibGUtbmV4dC1saW5lIEB0eXBlc2NyaXB0LWVzbGludC9uYW1pbmctY29udmVudGlvblxuaW1wb3J0ICogYXMgX19leHBvcnRfX2NkayBmcm9tICcuL2Nkay9pbmRleC5qcyc7XG5cbmV4cG9ydCAqIGZyb20gJy4vaW5kZXguanMnO1xuXG4vKlxuIEFwaS1leHRyYWN0b3IgZG9lcyBub3QgKFt5ZXRdKGh0dHBzOi8vZ2l0aHViLmNvbS9taWNyb3NvZnQvcnVzaHN0YWNrL2lzc3Vlcy8xNTk2KSkgc3VwcG9ydCBtdWx0aXBsZSBwYWNrYWdlIGVudHJ5IHBvaW50c1xuIEJlY2F1c2UgdGhpcyBwYWNrYWdlIGhhcyBhIHN1Ym1vZHVsZSBleHBvcnQsIHdlIGFyZSB3b3JraW5nIGFyb3VuZCB0aGlzIGlzc3VlIGJ5IGluY2x1ZGluZyB0aGF0IGV4cG9ydCBoZXJlIGFuZCBkaXJlY3RpbmcgYXBpLWV4dHJhY3QgdG8gdGhpcyBlbnRyeSBwb2ludCBpbnN0ZWFkXG4gVGhpcyBhbGxvd3MgYXBpLWV4dHJhY3RvciB0byBwaWNrIHVwIHRoZSBzdWJtb2R1bGUgZXhwb3J0cyBpbiBpdHMgYW5hbHlzaXNcbiAqL1xuZXhwb3J0IHsgX19leHBvcnRfX2NkayB9O1xuIl19
|
package/node_modules/@aws-amplify/ai-constructs/node_modules/@aws-amplify/platform-core/lib/index.js
ADDED
@@ -0,0 +1,35 @@
|
|
1
|
+
"use strict";
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
3
|
+
if (k2 === undefined) k2 = k;
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
7
|
+
}
|
8
|
+
Object.defineProperty(o, k2, desc);
|
9
|
+
}) : (function(o, m, k, k2) {
|
10
|
+
if (k2 === undefined) k2 = k;
|
11
|
+
o[k2] = m[k];
|
12
|
+
}));
|
13
|
+
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
14
|
+
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
15
|
+
};
|
16
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
17
|
+
exports.TagName = exports.CDKContextKey = exports.USAGE_DATA_TRACKING_ENABLED = void 0;
|
18
|
+
__exportStar(require("./backend_identifier_conversions.js"), exports);
|
19
|
+
__exportStar(require("./backend_entry_point_locator.js"), exports);
|
20
|
+
__exportStar(require("./caller_directory_extractor.js"), exports);
|
21
|
+
__exportStar(require("./extract_file_path_from_stack_trace_line.js"), exports);
|
22
|
+
__exportStar(require("./package_json_reader.js"), exports);
|
23
|
+
__exportStar(require("./usage-data/usage_data_emitter_factory.js"), exports);
|
24
|
+
__exportStar(require("./config/local_configuration_controller_factory.js"), exports);
|
25
|
+
__exportStar(require("./errors"), exports);
|
26
|
+
var constants_js_1 = require("./usage-data/constants.js");
|
27
|
+
Object.defineProperty(exports, "USAGE_DATA_TRACKING_ENABLED", { enumerable: true, get: function () { return constants_js_1.USAGE_DATA_TRACKING_ENABLED; } });
|
28
|
+
var cdk_context_key_js_1 = require("./cdk_context_key.js");
|
29
|
+
Object.defineProperty(exports, "CDKContextKey", { enumerable: true, get: function () { return cdk_context_key_js_1.CDKContextKey; } });
|
30
|
+
__exportStar(require("./parameter_path_conversions.js"), exports);
|
31
|
+
__exportStar(require("./object_accumulator.js"), exports);
|
32
|
+
var tag_name_js_1 = require("./tag_name.js");
|
33
|
+
Object.defineProperty(exports, "TagName", { enumerable: true, get: function () { return tag_name_js_1.TagName; } });
|
34
|
+
__exportStar(require("./naming_convention_conversions.js"), exports);
|
35
|
+
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiaW5kZXguanMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyIuLi9zcmMvaW5kZXgudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6Ijs7Ozs7Ozs7Ozs7Ozs7Ozs7QUFBQSxzRUFBb0Q7QUFDcEQsbUVBQWlEO0FBQ2pELGtFQUFnRDtBQUNoRCwrRUFBNkQ7QUFDN0QsMkRBQXlDO0FB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BvcnQgKiBmcm9tICcuL29iamVjdF9hY2N1bXVsYXRvci5qcyc7XG5leHBvcnQgeyBUYWdOYW1lIH0gZnJvbSAnLi90YWdfbmFtZS5qcyc7XG5leHBvcnQgKiBmcm9tICcuL25hbWluZ19jb252ZW50aW9uX2NvbnZlcnNpb25zLmpzJztcbiJdfQ==
|
@@ -0,0 +1,13 @@
|
|
1
|
+
/**
|
2
|
+
* Naming Converter
|
3
|
+
* @example
|
4
|
+
* new NamingConverter().toScreamingSnakeCase('myInputString')
|
5
|
+
*/
|
6
|
+
export declare class NamingConverter {
|
7
|
+
/**
|
8
|
+
* Converts input string to SCREAMING_SNAKE_CASE
|
9
|
+
* @param input Input string to convert
|
10
|
+
*/
|
11
|
+
toScreamingSnakeCase(input: string): string;
|
12
|
+
}
|
13
|
+
//# sourceMappingURL=naming_convention_conversions.d.ts.map
|
@@ -0,0 +1,23 @@
|
|
1
|
+
"use strict";
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
4
|
+
};
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
6
|
+
exports.NamingConverter = void 0;
|
7
|
+
const lodash_snakecase_1 = __importDefault(require("lodash.snakecase"));
|
8
|
+
/**
|
9
|
+
* Naming Converter
|
10
|
+
* @example
|
11
|
+
* new NamingConverter().toScreamingSnakeCase('myInputString')
|
12
|
+
*/
|
13
|
+
class NamingConverter {
|
14
|
+
/**
|
15
|
+
* Converts input string to SCREAMING_SNAKE_CASE
|
16
|
+
* @param input Input string to convert
|
17
|
+
*/
|
18
|
+
toScreamingSnakeCase(input) {
|
19
|
+
return (0, lodash_snakecase_1.default)(input).toUpperCase();
|
20
|
+
}
|
21
|
+
}
|
22
|
+
exports.NamingConverter = NamingConverter;
|
23
|
+
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoibmFtaW5nX2NvbnZlbnRpb25fY29udmVyc2lvbnMuanMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyIuLi9zcmMvbmFtaW5nX2NvbnZlbnRpb25fY29udmVyc2lvbnMudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6Ijs7Ozs7O0FBQUEsd0VBQXlDO0FBRXpDOzs7O0dBSUc7QUFDSCxNQUFhLGVBQWU7SUFDMUI7OztPQUdHO0lBQ0ksb0JBQW9CLENBQUMsS0FBYTtRQUN2QyxPQUFPLElBQUEsMEJBQVMsRUFBQyxLQUFLLENBQUMsQ0FBQyxXQUFXLEVBQUUsQ0FBQztJQUN4QyxDQUFDO0NBQ0Y7QUFSRCwwQ0FRQyIsInNvdXJjZXNDb250ZW50IjpbImltcG9ydCBzbmFrZUNhc2UgZnJvbSAnbG9kYXNoLnNuYWtlY2FzZSc7XG5cbi8qKlxuICogTmFtaW5nIENvbnZlcnRlclxuICogQGV4YW1wbGVcbiAqIG5ldyBOYW1pbmdDb252ZXJ0ZXIoKS50b1NjcmVhbWluZ1NuYWtlQ2FzZSgnbXlJbnB1dFN0cmluZycpXG4gKi9cbmV4cG9ydCBjbGFzcyBOYW1pbmdDb252ZXJ0ZXIge1xuICAvKipcbiAgICogQ29udmVydHMgaW5wdXQgc3RyaW5nIHRvIFNDUkVBTUlOR19TTkFLRV9DQVNFXG4gICAqIEBwYXJhbSBpbnB1dCBJbnB1dCBzdHJpbmcgdG8gY29udmVydFxuICAgKi9cbiAgcHVibGljIHRvU2NyZWFtaW5nU25ha2VDYXNlKGlucHV0OiBzdHJpbmcpOiBzdHJpbmcge1xuICAgIHJldHVybiBzbmFrZUNhc2UoaW5wdXQpLnRvVXBwZXJDYXNlKCk7XG4gIH1cbn1cbiJdfQ==
|
@@ -0,0 +1,45 @@
|
|
1
|
+
import { DeepPartialAmplifyGeneratedConfigs } from '@aws-amplify/plugin-types';
|
2
|
+
/**
|
3
|
+
* This error is thrown when there's a collision in the object keys
|
4
|
+
*/
|
5
|
+
export declare class ObjectAccumulatorPropertyAlreadyExistsError extends Error {
|
6
|
+
readonly key: string;
|
7
|
+
readonly existingValue: unknown;
|
8
|
+
readonly incomingValue: unknown;
|
9
|
+
/**
|
10
|
+
* Creates property already exists error.
|
11
|
+
*/
|
12
|
+
constructor(key: string, existingValue: unknown, incomingValue: unknown);
|
13
|
+
}
|
14
|
+
/**
|
15
|
+
* This error is thrown when partial objects with different versions are being accumulated
|
16
|
+
*/
|
17
|
+
export declare class ObjectAccumulatorVersionMismatchError extends Error {
|
18
|
+
readonly existingVersion: string;
|
19
|
+
readonly newVersion: string;
|
20
|
+
/**
|
21
|
+
* Creates property already exists error.
|
22
|
+
*/
|
23
|
+
constructor(existingVersion: string, newVersion: string);
|
24
|
+
}
|
25
|
+
/**
|
26
|
+
* A class that can accumulate (squash merge) objects into single instance.
|
27
|
+
*/
|
28
|
+
export declare class ObjectAccumulator<T> {
|
29
|
+
private readonly accumulator;
|
30
|
+
private readonly versionKey;
|
31
|
+
/**
|
32
|
+
* creates object accumulator.
|
33
|
+
*/
|
34
|
+
constructor(accumulator: DeepPartialAmplifyGeneratedConfigs<T>, versionKey?: string);
|
35
|
+
/**
|
36
|
+
* Accumulate a new object part with accumulator.
|
37
|
+
* This method throws if there is any intersection between the object parts
|
38
|
+
* except for the versionKey, which should be the same across all object parts (nested objects included)
|
39
|
+
* @param part a new object part to accumulate
|
40
|
+
* @returns the accumulator object for easy chaining
|
41
|
+
*/
|
42
|
+
accumulate: (part: DeepPartialAmplifyGeneratedConfigs<T>) => ObjectAccumulator<T>;
|
43
|
+
getAccumulatedObject: () => DeepPartialAmplifyGeneratedConfigs<T>;
|
44
|
+
}
|
45
|
+
//# sourceMappingURL=object_accumulator.d.ts.map
|
@@ -0,0 +1,99 @@
|
|
1
|
+
"use strict";
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
4
|
+
};
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
6
|
+
exports.ObjectAccumulator = exports.ObjectAccumulatorVersionMismatchError = exports.ObjectAccumulatorPropertyAlreadyExistsError = void 0;
|
7
|
+
const lodash_mergewith_1 = __importDefault(require("lodash.mergewith"));
|
8
|
+
const semver_1 = __importDefault(require("semver"));
|
9
|
+
/**
|
10
|
+
* This error is thrown when there's a collision in the object keys
|
11
|
+
*/
|
12
|
+
class ObjectAccumulatorPropertyAlreadyExistsError extends Error {
|
13
|
+
key;
|
14
|
+
existingValue;
|
15
|
+
incomingValue;
|
16
|
+
/**
|
17
|
+
* Creates property already exists error.
|
18
|
+
*/
|
19
|
+
constructor(key, existingValue, incomingValue) {
|
20
|
+
super(`Property ${key} already exists`);
|
21
|
+
this.key = key;
|
22
|
+
this.existingValue = existingValue;
|
23
|
+
this.incomingValue = incomingValue;
|
24
|
+
}
|
25
|
+
}
|
26
|
+
exports.ObjectAccumulatorPropertyAlreadyExistsError = ObjectAccumulatorPropertyAlreadyExistsError;
|
27
|
+
/**
|
28
|
+
* This error is thrown when partial objects with different versions are being accumulated
|
29
|
+
*/
|
30
|
+
class ObjectAccumulatorVersionMismatchError extends Error {
|
31
|
+
existingVersion;
|
32
|
+
newVersion;
|
33
|
+
/**
|
34
|
+
* Creates property already exists error.
|
35
|
+
*/
|
36
|
+
constructor(existingVersion, newVersion) {
|
37
|
+
super(`Version mismatch: Cannot accumulate new objects with version ${newVersion} with existing accumulated object with version ${existingVersion}`);
|
38
|
+
this.existingVersion = existingVersion;
|
39
|
+
this.newVersion = newVersion;
|
40
|
+
}
|
41
|
+
}
|
42
|
+
exports.ObjectAccumulatorVersionMismatchError = ObjectAccumulatorVersionMismatchError;
|
43
|
+
/**
|
44
|
+
* A class that can accumulate (squash merge) objects into single instance.
|
45
|
+
*/
|
46
|
+
class ObjectAccumulator {
|
47
|
+
accumulator;
|
48
|
+
versionKey;
|
49
|
+
/**
|
50
|
+
* creates object accumulator.
|
51
|
+
*/
|
52
|
+
constructor(accumulator, versionKey = 'version') {
|
53
|
+
this.accumulator = accumulator;
|
54
|
+
this.versionKey = versionKey;
|
55
|
+
}
|
56
|
+
/**
|
57
|
+
* Accumulate a new object part with accumulator.
|
58
|
+
* This method throws if there is any intersection between the object parts
|
59
|
+
* except for the versionKey, which should be the same across all object parts (nested objects included)
|
60
|
+
* @param part a new object part to accumulate
|
61
|
+
* @returns the accumulator object for easy chaining
|
62
|
+
*/
|
63
|
+
accumulate = (part) => {
|
64
|
+
(0, lodash_mergewith_1.default)(this.accumulator, part, (existingValue, incomingValue, key) => {
|
65
|
+
if (Array.isArray(existingValue)) {
|
66
|
+
return existingValue.concat(incomingValue);
|
67
|
+
}
|
68
|
+
if (existingValue && typeof existingValue !== 'object') {
|
69
|
+
if (key === this.versionKey) {
|
70
|
+
const incomingVersion = semver_1.default.coerce(incomingValue);
|
71
|
+
const existingVersion = semver_1.default.coerce(existingValue);
|
72
|
+
if (incomingVersion && existingVersion) {
|
73
|
+
// Only throw if the major version is not equal
|
74
|
+
if (incomingVersion.major !== existingVersion.major) {
|
75
|
+
throw new ObjectAccumulatorVersionMismatchError(existingValue, incomingValue);
|
76
|
+
}
|
77
|
+
else {
|
78
|
+
// We always get the max version to persist in the accumulated object
|
79
|
+
return semver_1.default.gte(incomingVersion, existingVersion)
|
80
|
+
? incomingValue
|
81
|
+
: existingValue;
|
82
|
+
}
|
83
|
+
}
|
84
|
+
}
|
85
|
+
else if (key !== this.versionKey) {
|
86
|
+
throw new ObjectAccumulatorPropertyAlreadyExistsError(key, existingValue, incomingValue);
|
87
|
+
}
|
88
|
+
}
|
89
|
+
// returning undefined falls back to default merge algorithm
|
90
|
+
return undefined;
|
91
|
+
});
|
92
|
+
return this;
|
93
|
+
};
|
94
|
+
getAccumulatedObject = () => {
|
95
|
+
return this.accumulator;
|
96
|
+
};
|
97
|
+
}
|
98
|
+
exports.ObjectAccumulator = ObjectAccumulator;
|
99
|
+
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoib2JqZWN0X2F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mNlKGluY29taW5nVmFsdWUpO1xuICAgICAgICAgIGNvbnN0IGV4aXN0aW5nVmVyc2lvbiA9IHNlbXZlci5jb2VyY2UoZXhpc3RpbmdWYWx1ZSk7XG4gICAgICAgICAgaWYgKGluY29taW5nVmVyc2lvbiAmJiBleGlzdGluZ1ZlcnNpb24pIHtcbiAgICAgICAgICAgIC8vIE9ubHkgdGhyb3cgaWYgdGhlIG1ham9yIHZlcnNpb24gaXMgbm90IGVxdWFsXG4gICAgICAgICAgICBpZiAoaW5jb21pbmdWZXJzaW9uLm1ham9yICE9PSBleGlzdGluZ1ZlcnNpb24ubWFqb3IpIHtcbiAgICAgICAgICAgICAgdGhyb3cgbmV3IE9iamVjdEFjY3VtdWxhdG9yVmVyc2lvbk1pc21hdGNoRXJyb3IoXG4gICAgICAgICAgICAgICAgZXhpc3RpbmdWYWx1ZSxcbiAgICAgICAgICAgICAgICBpbmNvbWluZ1ZhbHVlXG4gICAgICAgICAgICAgICk7XG4gICAgICAgICAgICB9IGVsc2Uge1xuICAgICAgICAgICAgICAvLyBXZSBhbHdheXMgZ2V0IHRoZSBtYXggdmVyc2lvbiB0byBwZXJzaXN0IGluIHRoZSBhY2N1bXVsYXRlZCBvYmplY3RcbiAgICAgICAgICAgICAgcmV0dXJuIHNlbXZlci5ndGUoaW5jb21pbmdWZXJzaW9uLCBleGlzdGluZ1ZlcnNpb24pXG4gICAgICAgICAgICAgICAgPyBpbmNvbWluZ1ZhbHVlXG4gICAgICAgICAgICAgICAgOiBleGlzdGluZ1ZhbHVlO1xuICAgICAgICAgICAgfVxuICAgICAgICAgIH1cbiAgICAgICAgfSBlbHNlIGlmIChrZXkgIT09IHRoaXMudmVyc2lvbktleSkge1xuICAgICAgICAgIHRocm93IG5ldyBPYmplY3RBY2N1bXVsYXRvclByb3BlcnR5QWxyZWFkeUV4aXN0c0Vycm9yKFxuICAgICAgICAgICAga2V5LFxuICAgICAgICAgICAgZXhpc3RpbmdWYWx1ZSxcbiAgICAgICAgICAgIGluY29taW5nVmFsdWVcbiAgICAgICAgICApO1xuICAgICAgICB9XG4gICAgICB9XG5cbiAgICAgIC8vIHJldHVybmluZyB1bmRlZmluZWQgZmFsbHMgYmFjayB0byBkZWZhdWx0IG1lcmdlIGFsZ29yaXRobVxuICAgICAgcmV0dXJuIHVuZGVmaW5lZDtcbiAgICB9KTtcbiAgICByZXR1cm4gdGhpcztcbiAgfTtcblxuICBnZXRBY2N1bXVsYXRlZE9iamVjdCA9ICgpID0+IHtcbiAgICByZXR1cm4gdGhpcy5hY2N1bXVsYXRvcjtcbiAgfTtcbn1cbiJdfQ==
|
@@ -0,0 +1,33 @@
|
|
1
|
+
import z from 'zod';
|
2
|
+
/**
|
3
|
+
* return the package json
|
4
|
+
*/
|
5
|
+
export declare class PackageJsonReader {
|
6
|
+
read: (absolutePackageJsonPath: string) => PackageJson;
|
7
|
+
/**
|
8
|
+
* Returns the contents of the package.json file in process.cwd()
|
9
|
+
*
|
10
|
+
* If no package.json file exists, or the content does not pass validation, an error is thrown
|
11
|
+
*/
|
12
|
+
readFromCwd: () => PackageJson;
|
13
|
+
}
|
14
|
+
/**
|
15
|
+
* Type for package.json content.
|
16
|
+
*
|
17
|
+
* Add additional validation if there are other fields we need to read
|
18
|
+
*/
|
19
|
+
export declare const packageJsonSchema: z.ZodObject<{
|
20
|
+
name: z.ZodOptional<z.ZodString>;
|
21
|
+
version: z.ZodOptional<z.ZodString>;
|
22
|
+
type: z.ZodOptional<z.ZodUnion<[z.ZodLiteral<"module">, z.ZodLiteral<"commonjs">]>>;
|
23
|
+
}, "strip", z.ZodTypeAny, {
|
24
|
+
name?: string | undefined;
|
25
|
+
type?: "module" | "commonjs" | undefined;
|
26
|
+
version?: string | undefined;
|
27
|
+
}, {
|
28
|
+
name?: string | undefined;
|
29
|
+
type?: "module" | "commonjs" | undefined;
|
30
|
+
version?: string | undefined;
|
31
|
+
}>;
|
32
|
+
export type PackageJson = z.infer<typeof packageJsonSchema>;
|
33
|
+
//# sourceMappingURL=package_json_reader.d.ts.map
|
@@ -0,0 +1,56 @@
|
|
1
|
+
"use strict";
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
4
|
+
};
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
6
|
+
exports.packageJsonSchema = exports.PackageJsonReader = void 0;
|
7
|
+
const fs_1 = __importDefault(require("fs"));
|
8
|
+
const path_1 = __importDefault(require("path"));
|
9
|
+
const zod_1 = __importDefault(require("zod"));
|
10
|
+
const errors_1 = require("./errors");
|
11
|
+
/**
|
12
|
+
* return the package json
|
13
|
+
*/
|
14
|
+
class PackageJsonReader {
|
15
|
+
read = (absolutePackageJsonPath) => {
|
16
|
+
if (!fs_1.default.existsSync(absolutePackageJsonPath)) {
|
17
|
+
throw new errors_1.AmplifyUserError('InvalidPackageJsonError', {
|
18
|
+
message: `Could not find a package.json file at ${absolutePackageJsonPath}`,
|
19
|
+
resolution: `Ensure that ${absolutePackageJsonPath} exists and is a valid JSON file`,
|
20
|
+
});
|
21
|
+
}
|
22
|
+
let jsonParsedValue;
|
23
|
+
try {
|
24
|
+
jsonParsedValue = JSON.parse(
|
25
|
+
// we have to use sync fs methods here because this is also used during cdk synth
|
26
|
+
fs_1.default.readFileSync(absolutePackageJsonPath, 'utf-8'));
|
27
|
+
}
|
28
|
+
catch (err) {
|
29
|
+
throw new errors_1.AmplifyUserError('InvalidPackageJsonError', {
|
30
|
+
message: `Could not parse the contents of ${absolutePackageJsonPath}`,
|
31
|
+
resolution: `Ensure that ${absolutePackageJsonPath} exists and is a valid JSON file`,
|
32
|
+
}, err);
|
33
|
+
}
|
34
|
+
return exports.packageJsonSchema.parse(jsonParsedValue);
|
35
|
+
};
|
36
|
+
/**
|
37
|
+
* Returns the contents of the package.json file in process.cwd()
|
38
|
+
*
|
39
|
+
* If no package.json file exists, or the content does not pass validation, an error is thrown
|
40
|
+
*/
|
41
|
+
readFromCwd = () => {
|
42
|
+
return this.read(path_1.default.resolve(process.cwd(), 'package.json'));
|
43
|
+
};
|
44
|
+
}
|
45
|
+
exports.PackageJsonReader = PackageJsonReader;
|
46
|
+
/**
|
47
|
+
* Type for package.json content.
|
48
|
+
*
|
49
|
+
* Add additional validation if there are other fields we need to read
|
50
|
+
*/
|
51
|
+
exports.packageJsonSchema = zod_1.default.object({
|
52
|
+
name: zod_1.default.string().optional(),
|
53
|
+
version: zod_1.default.string().optional(),
|
54
|
+
type: zod_1.default.union([zod_1.default.literal('module'), zod_1.default.literal('commonjs')]).optional(),
|
55
|
+
});
|
56
|
+
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoicGFja2FnZV9qc29uX3JlYWRlci5qcyIsInNvdXJjZVJvb3QiOiIiLCJzb3VyY2VzIjpbIi4uL3NyYy9wYWNrYWdlX2pzb25fcmVhZGVyLnRzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiI7Ozs7OztBQUFBLDRDQUFvQjtBQUNwQixnREFBd0I7QUFDeEIsOENBQW9CO0FBQ3BCLHFDQUE0QztBQUU1Qzs7R0FFRztBQUNILE1BQWEsaUJBQWlCO0lBQzVCLElBQUksR0FBRyxDQUFDLHVCQUErQixFQUFlLEVBQUU7UUFDdEQsSUFBSSxDQUFDLFlBQUUsQ0FBQyxVQUFVLENBQUMsdUJBQXVCLENBQUMsRUFBRTtZQUMzQyxNQUFNLElBQUkseUJBQWdCLENBQUMseUJBQXlCLEVBQUU7Z0JBQ3BELE9BQU8sRUFBRSx5Q0FBeUMsdUJBQXVCLEVBQUU7Z0JBQzNFLFVBQVUsRUFBRSxlQUFlLHVCQUF1QixrQ0FBa0M7YUFDckYsQ0FBQyxDQUFDO1NBQ0o7UUFDRCxJQUFJLGVBQXdDLENBQUM7UUFDN0MsSUFBSTtZQUNGLGVBQWUsR0FBRyxJQUFJLENBQUMsS0FBSztZQUMxQixpRkFBaUY7WUFDakYsWUFBRSxDQUFDLFlB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YWNrYWdlSnNvblNjaGVtYSA9IHoub2JqZWN0KHtcbiAgbmFtZTogei5zdHJpbmcoKS5vcHRpb25hbCgpLFxuICB2ZXJzaW9uOiB6LnN0cmluZygpLm9wdGlvbmFsKCksXG4gIHR5cGU6IHoudW5pb24oW3oubGl0ZXJhbCgnbW9kdWxlJyksIHoubGl0ZXJhbCgnY29tbW9uanMnKV0pLm9wdGlvbmFsKCksXG59KTtcblxuZXhwb3J0IHR5cGUgUGFja2FnZUpzb24gPSB6LmluZmVyPHR5cGVvZiBwYWNrYWdlSnNvblNjaGVtYT47XG4iXX0=
|
@@ -0,0 +1,19 @@
|
|
1
|
+
import { AppId, BackendIdentifier } from '@aws-amplify/plugin-types';
|
2
|
+
/**
|
3
|
+
* Provides static methods for converting BackendIdentifier to parameter path strings
|
4
|
+
*/
|
5
|
+
export declare class ParameterPathConversions {
|
6
|
+
/**
|
7
|
+
* Convert a BackendIdentifier to a parameter prefix.
|
8
|
+
*/
|
9
|
+
static toParameterPrefix(backendId: BackendIdentifier | AppId): string;
|
10
|
+
/**
|
11
|
+
* Convert a BackendIdentifier to a parameter full path.
|
12
|
+
*/
|
13
|
+
static toParameterFullPath(backendId: BackendIdentifier | AppId, parameterName: string): string;
|
14
|
+
/**
|
15
|
+
* Generate an SSM path for references to other backend resources
|
16
|
+
*/
|
17
|
+
static toResourceReferenceFullPath(backendId: BackendIdentifier, referenceName: string): string;
|
18
|
+
}
|
19
|
+
//# sourceMappingURL=parameter_path_conversions.d.ts.map
|
@@ -0,0 +1,79 @@
|
|
1
|
+
"use strict";
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
3
|
+
exports.ParameterPathConversions = void 0;
|
4
|
+
const backend_identifier_conversions_js_1 = require("./backend_identifier_conversions.js");
|
5
|
+
const errors_1 = require("./errors");
|
6
|
+
const SHARED_SECRET = 'shared';
|
7
|
+
const RESOURCE_REFERENCE = 'resource_reference';
|
8
|
+
/**
|
9
|
+
* Provides static methods for converting BackendIdentifier to parameter path strings
|
10
|
+
*/
|
11
|
+
class ParameterPathConversions {
|
12
|
+
/**
|
13
|
+
* Convert a BackendIdentifier to a parameter prefix.
|
14
|
+
*/
|
15
|
+
// It's fine to ignore the rule here because the anti-static rule is to ban the static function which should use constructor
|
16
|
+
// eslint-disable-next-line no-restricted-syntax
|
17
|
+
static toParameterPrefix(backendId) {
|
18
|
+
if (typeof backendId === 'object') {
|
19
|
+
return getBackendParameterPrefix(backendId);
|
20
|
+
}
|
21
|
+
return getSharedParameterPrefix(backendId);
|
22
|
+
}
|
23
|
+
/**
|
24
|
+
* Convert a BackendIdentifier to a parameter full path.
|
25
|
+
*/
|
26
|
+
// It's fine to ignore the rule here because the anti-static rule is to ban the static function which should use constructor
|
27
|
+
// eslint-disable-next-line no-restricted-syntax
|
28
|
+
static toParameterFullPath(backendId, parameterName) {
|
29
|
+
if (typeof backendId === 'object') {
|
30
|
+
return getBackendParameterFullPath(backendId, parameterName);
|
31
|
+
}
|
32
|
+
return getSharedParameterFullPath(backendId, parameterName);
|
33
|
+
}
|
34
|
+
/**
|
35
|
+
* Generate an SSM path for references to other backend resources
|
36
|
+
*/
|
37
|
+
// It's fine to ignore the rule here because the anti-static rule is to ban the static function which should use constructor
|
38
|
+
// eslint-disable-next-line no-restricted-syntax
|
39
|
+
static toResourceReferenceFullPath(backendId, referenceName) {
|
40
|
+
return `/amplify/${RESOURCE_REFERENCE}/${getBackendIdentifierPathPart(backendId)}/${referenceName}`;
|
41
|
+
}
|
42
|
+
}
|
43
|
+
exports.ParameterPathConversions = ParameterPathConversions;
|
44
|
+
const getBackendParameterPrefix = (parts) => {
|
45
|
+
return `/amplify/${getBackendIdentifierPathPart(parts)}`;
|
46
|
+
};
|
47
|
+
/**
|
48
|
+
* Get a branch-specific parameter prefix.
|
49
|
+
*/
|
50
|
+
const getBackendIdentifierPathPart = (parts) => {
|
51
|
+
// round trip the backend id through the stack name conversion to ensure we are applying the same sanitization to SSM paths
|
52
|
+
const sanitizedBackendId = backend_identifier_conversions_js_1.BackendIdentifierConversions.fromStackName(backend_identifier_conversions_js_1.BackendIdentifierConversions.toStackName(parts));
|
53
|
+
if (!sanitizedBackendId || !sanitizedBackendId.hash) {
|
54
|
+
// this *should* never happen
|
55
|
+
throw new errors_1.AmplifyFault('BackendIdConversionFault', {
|
56
|
+
message: `Could not sanitize the backendId to construct the parameter path`,
|
57
|
+
});
|
58
|
+
}
|
59
|
+
return `${sanitizedBackendId.namespace}/${sanitizedBackendId.name}-${sanitizedBackendId.type}-${sanitizedBackendId.hash}`;
|
60
|
+
};
|
61
|
+
/**
|
62
|
+
* Get a branch-specific parameter full path.
|
63
|
+
*/
|
64
|
+
const getBackendParameterFullPath = (backendIdentifier, parameterName) => {
|
65
|
+
return `${getBackendParameterPrefix(backendIdentifier)}/${parameterName}`;
|
66
|
+
};
|
67
|
+
/**
|
68
|
+
* Get a shared parameter prefix.
|
69
|
+
*/
|
70
|
+
const getSharedParameterPrefix = (appId) => {
|
71
|
+
return `/amplify/${SHARED_SECRET}/${appId}`;
|
72
|
+
};
|
73
|
+
/**
|
74
|
+
* Get a shared parameter full path.
|
75
|
+
*/
|
76
|
+
const getSharedParameterFullPath = (appId, parameterName) => {
|
77
|
+
return `${getSharedParameterPrefix(appId)}/${parameterName}`;
|
78
|
+
};
|
79
|
+
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoicGFyYW1ldGVyX3BhdGhfY29udmVyc2lvbnMuanMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyIuLi9zcmMvcGFyYW1ldGVyX3BhdGhfY29udmVyc2lvbnMudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6Ijs7O0FBQ0EsMkZBQW1GO0FBQ25GLHFDQUF3QztBQUV4QyxNQUFNLGFBQWEsR0FBRyxRQUFRLENBQUM7QUFDL0IsTUFBTSxrQkFBa0IsR0FBRyxvQkFBb0IsQ0FBQztBQUVoRDs7R0FFRztBQUNILE1BQWE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ElkOiBBcHBJZCk6IHN0cmluZyA9PiB7XG4gIHJldHVybiBgL2FtcGxpZnkvJHtTSEFSRURfU0VDUkVUfS8ke2FwcElkfWA7XG59O1xuXG4vKipcbiAqIEdldCBhIHNoYXJlZCBwYXJhbWV0ZXIgZnVsbCBwYXRoLlxuICovXG5jb25zdCBnZXRTaGFyZWRQYXJhbWV0ZXJGdWxsUGF0aCA9IChcbiAgYXBwSWQ6IEFwcElkLFxuICBwYXJhbWV0ZXJOYW1lOiBzdHJpbmdcbik6IHN0cmluZyA9PiB7XG4gIHJldHVybiBgJHtnZXRTaGFyZWRQYXJhbWV0ZXJQcmVmaXgoYXBwSWQpfS8ke3BhcmFtZXRlck5hbWV9YDtcbn07XG4iXX0=
|
@@ -0,0 +1,8 @@
|
|
1
|
+
"use strict";
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
3
|
+
exports.TagName = void 0;
|
4
|
+
var TagName;
|
5
|
+
(function (TagName) {
|
6
|
+
TagName["FRIENDLY_NAME"] = "amplify:friendly-name";
|
7
|
+
})(TagName || (exports.TagName = TagName = {}));
|
8
|
+
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoidGFnX25hbWUuanMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyIuLi9zcmMvdGFnX25hbWUudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6Ijs7O0FBQUEsSUFBWSxPQUVYO0FBRkQsV0FBWSxPQUFPO0lBQ2pCLGtEQUF1QyxDQUFBO0FBQ3pDLENBQUMsRUFGVyxPQUFPLHVCQUFQLE9BQU8sUUFFbEIiLCJzb3VyY2VzQ29udGVudCI6WyJleHBvcnQgZW51bSBUYWdOYW1lIHtcbiAgRlJJRU5ETFlfTkFNRSA9ICdhbXBsaWZ5OmZyaWVuZGx5LW5hbWUnLFxufVxuIl19
|
@@ -0,0 +1,14 @@
|
|
1
|
+
import { STSClient } from '@aws-sdk/client-sts';
|
2
|
+
/**
|
3
|
+
* Retrieves the account ID of the user
|
4
|
+
*/
|
5
|
+
export declare class AccountIdFetcher {
|
6
|
+
private readonly stsClient;
|
7
|
+
private accountId;
|
8
|
+
/**
|
9
|
+
* constructor for AccountIdFetcher
|
10
|
+
*/
|
11
|
+
constructor(stsClient?: STSClient);
|
12
|
+
fetch: () => Promise<string>;
|
13
|
+
}
|
14
|
+
//# sourceMappingURL=account_id_fetcher.d.ts.map
|
@@ -0,0 +1,38 @@
|
|
1
|
+
"use strict";
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
3
|
+
exports.AccountIdFetcher = void 0;
|
4
|
+
const client_sts_1 = require("@aws-sdk/client-sts");
|
5
|
+
const NO_ACCOUNT_ID = 'NO_ACCOUNT_ID';
|
6
|
+
/**
|
7
|
+
* Retrieves the account ID of the user
|
8
|
+
*/
|
9
|
+
class AccountIdFetcher {
|
10
|
+
stsClient;
|
11
|
+
accountId;
|
12
|
+
/**
|
13
|
+
* constructor for AccountIdFetcher
|
14
|
+
*/
|
15
|
+
constructor(stsClient = new client_sts_1.STSClient()) {
|
16
|
+
this.stsClient = stsClient;
|
17
|
+
}
|
18
|
+
fetch = async () => {
|
19
|
+
if (this.accountId) {
|
20
|
+
return this.accountId;
|
21
|
+
}
|
22
|
+
try {
|
23
|
+
const stsResponse = await this.stsClient.send(new client_sts_1.GetCallerIdentityCommand({}));
|
24
|
+
if (stsResponse && stsResponse.Account) {
|
25
|
+
this.accountId = stsResponse.Account;
|
26
|
+
return this.accountId;
|
27
|
+
}
|
28
|
+
// We failed to get the account Id. Most likely the user doesn't have credentials
|
29
|
+
return NO_ACCOUNT_ID;
|
30
|
+
}
|
31
|
+
catch (error) {
|
32
|
+
// We failed to get the account Id. Most likely the user doesn't have credentials
|
33
|
+
return NO_ACCOUNT_ID;
|
34
|
+
}
|
35
|
+
};
|
36
|
+
}
|
37
|
+
exports.AccountIdFetcher = AccountIdFetcher;
|
38
|
+
//# sourceMappingURL=data:application/json;base64,eyJ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X0FDQ09VTlRfSUQ7XG4gICAgfSBjYXRjaCAoZXJyb3IpIHtcbiAgICAgIC8vIFdlIGZhaWxlZCB0byBnZXQgdGhlIGFjY291bnQgSWQuIE1vc3QgbGlrZWx5IHRoZSB1c2VyIGRvZXNuJ3QgaGF2ZSBjcmVkZW50aWFsc1xuICAgICAgcmV0dXJuIE5PX0FDQ09VTlRfSUQ7XG4gICAgfVxuICB9O1xufVxuIl19
|
@@ -0,0 +1,13 @@
|
|
1
|
+
/**
|
2
|
+
* current API version
|
3
|
+
*/
|
4
|
+
export declare const latestApiVersion = "v1.0";
|
5
|
+
/**
|
6
|
+
* returns the latest available payload version
|
7
|
+
*/
|
8
|
+
export declare const latestPayloadVersion = "1.1.0";
|
9
|
+
/**
|
10
|
+
* Key to access whether user opted-in status of usage data tracking preference.
|
11
|
+
*/
|
12
|
+
export declare const USAGE_DATA_TRACKING_ENABLED = "telemetry.enabled";
|
13
|
+
//# sourceMappingURL=constants.d.ts.map
|
@@ -0,0 +1,16 @@
|
|
1
|
+
"use strict";
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
3
|
+
exports.USAGE_DATA_TRACKING_ENABLED = exports.latestPayloadVersion = exports.latestApiVersion = void 0;
|
4
|
+
/**
|
5
|
+
* current API version
|
6
|
+
*/
|
7
|
+
exports.latestApiVersion = 'v1.0';
|
8
|
+
/**
|
9
|
+
* returns the latest available payload version
|
10
|
+
*/
|
11
|
+
exports.latestPayloadVersion = '1.1.0';
|
12
|
+
/**
|
13
|
+
* Key to access whether user opted-in status of usage data tracking preference.
|
14
|
+
*/
|
15
|
+
exports.USAGE_DATA_TRACKING_ENABLED = 'telemetry.enabled';
|
16
|
+
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiY29uc3RhbnRzLmpzIiwic291cmNlUm9vdCI6IiIsInNvdXJjZXMiOlsiLi4vLi4vc3JjL3VzYWdlLWRhdGEvY29uc3RhbnRzLnRzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiI7OztBQUFBOztHQUVHO0FBQ1UsUUFBQSxnQkFBZ0IsR0FBRyxNQUFNLENBQUM7QUFFdkM7O0dBRUc7QUFDVSxRQUFBLG9CQUFvQixHQUFHLE9BQU8sQ0FBQztBQUU1Qzs7R0FFRztBQUNVLFFBQUEsMkJBQTJCLEdBQUcsbUJBQW1CLENBQUMiLCJzb3VyY2VzQ29udGVudCI6WyIvKipcbiAqIGN1cnJlbnQgQVBJIHZlcnNpb25cbiAqL1xuZXhwb3J0IGNvbnN0IGxhdGVzdEFwaVZlcnNpb24gPSAndjEuMCc7XG5cbi8qKlxuICogcmV0dXJucyB0aGUgbGF0ZXN0IGF2YWlsYWJsZSBwYXlsb2FkIHZlcnNpb25cbiAqL1xuZXhwb3J0IGNvbnN0IGxhdGVzdFBheWxvYWRWZXJzaW9uID0gJzEuMS4wJztcblxuLyoqXG4gKiBLZXkgdG8gYWNjZXNzIHdoZXRoZXIgdXNlciBvcHRlZC1pbiBzdGF0dXMgb2YgdXNhZ2UgZGF0YSB0cmFja2luZyBwcmVmZXJlbmNlLlxuICovXG5leHBvcnQgY29uc3QgVVNBR0VfREFUQV9UUkFDS0lOR19FTkFCTEVEID0gJ3RlbGVtZXRyeS5lbmFibGVkJztcbiJdfQ==
|
@@ -0,0 +1,15 @@
|
|
1
|
+
"use strict";
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
3
|
+
exports.getInstallationUuid = void 0;
|
4
|
+
const uuid_1 = require("uuid");
|
5
|
+
const os_1 = require("os");
|
6
|
+
// eslint-disable-next-line spellcheck/spell-checker
|
7
|
+
const AMPLIFY_CLI_UUID_NAMESPACE = 'e7368840-2eb6-4042-99b4-9d6c2a9370e6'; // A random v4 UUID
|
8
|
+
/**
|
9
|
+
* Generates a consistent installation Uuid from the library installation path + machine's host name
|
10
|
+
*/
|
11
|
+
const getInstallationUuid = (namespace = AMPLIFY_CLI_UUID_NAMESPACE) => {
|
12
|
+
return (0, uuid_1.v5)(__dirname + (0, os_1.hostname)(), namespace);
|
13
|
+
};
|
14
|
+
exports.getInstallationUuid = getInstallationUuid;
|
15
|
+
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiZ2V0X2luc3RhbGxhdGlvbl9pZC5qcyIsInNvdXJjZVJvb3QiOiIiLCJzb3VyY2VzIjpbIi4uLy4uL3NyYy91c2FnZS1kYXRhL2dldF9pbnN0YWxsYXRpb25faWQudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6Ijs7O0FBQUEsK0JBQW9DO0FBQ3BDLDJCQUE4QjtBQUU5QixvREFBb0Q7QUFDcEQsTUFBTSwwQkFBMEIsR0FBRyxzQ0FBc0MsQ0FBQyxDQUFDLG1CQUFtQjtBQUM5Rjs7R0FFRztBQUNJLE1BQU0sbUJBQW1CLEdBQUcsQ0FDakMsWUFBb0IsMEJBQTBCLEVBQzlDLEVBQUU7SUFDRixPQUFPLElBQUEsU0FBTSxFQUFDLFNBQVMsR0FBRyxJQUFBLGFBQVEsR0FBRSxFQUFFLFNBQVMsQ0FBQyxDQUFDO0FBQ25ELENBQUMsQ0FBQztBQUpXLFFBQUEsbUJBQW1CLHVCQUk5QiIsInNvdXJjZXNDb250ZW50IjpbImltcG9ydCB7IHY1IGFzIHV1aWRWNSB9IGZyb20gJ3V1aWQnO1xuaW1wb3J0IHsgaG9zdG5hbWUgfSBmcm9tICdvcyc7XG5cbi8vIGVzbGludC1kaXNhYmxlLW5leHQtbGluZSBzcGVsbGNoZWNrL3NwZWxsLWNoZWNrZXJcbmNvbnN0IEFNUExJRllfQ0xJX1VVSURfTkFNRVNQQUNFID0gJ2U3MzY4ODQwLTJlYjYtNDA0Mi05OWI0LTlkNmMyYTkzNzBlNic7IC8vIEEgcmFuZG9tIHY0IFVVSURcbi8qKlxuICogR2VuZXJhdGVzIGEgY29uc2lzdGVudCBpbnN0YWxsYXRpb24gVXVpZCBmcm9tIHRoZSBsaWJyYXJ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