Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[pull] main from awslabs:main #203

Merged
merged 3 commits into from
Oct 6, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions packages/config-resolver/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,12 @@
# Change Log

## 2.0.13

### Patch Changes

- Updated dependencies [7b568c39]
- @smithy/node-config-provider@2.1.0

## 2.0.12

### Patch Changes
Expand Down
2 changes: 1 addition & 1 deletion packages/config-resolver/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@smithy/config-resolver",
"version": "2.0.12",
"version": "2.0.13",
"scripts": {
"build": "concurrently 'yarn:build:cjs' 'yarn:build:es' 'yarn:build:types && yarn build:types:downlevel'",
"build:cjs": "yarn g:tsc -p tsconfig.cjs.json",
Expand Down
7 changes: 7 additions & 0 deletions packages/credential-provider-imds/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,12 @@
# Change Log

## 2.0.15

### Patch Changes

- Updated dependencies [7b568c39]
- @smithy/node-config-provider@2.1.0

## 2.0.14

### Patch Changes
Expand Down
2 changes: 1 addition & 1 deletion packages/credential-provider-imds/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@smithy/credential-provider-imds",
"version": "2.0.14",
"version": "2.0.15",
"description": "AWS credential provider that sources credentials from the EC2 instance metadata service and ECS container metadata service",
"main": "./dist-cjs/index.js",
"module": "./dist-es/index.js",
Expand Down
6 changes: 6 additions & 0 deletions packages/experimental-identity-and-auth/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,11 @@
# Change Log

## 0.0.13

### Patch Changes

- @smithy/middleware-retry@2.0.15

## 0.0.12

### Patch Changes
Expand Down
2 changes: 1 addition & 1 deletion packages/experimental-identity-and-auth/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@smithy/experimental-identity-and-auth",
"version": "0.0.12",
"version": "0.0.13",
"scripts": {
"build": "concurrently 'yarn:build:cjs' 'yarn:build:es' 'yarn:build:types && yarn build:types:downlevel'",
"build:cjs": "yarn g:tsc -p tsconfig.cjs.json",
Expand Down
7 changes: 7 additions & 0 deletions packages/middleware-retry/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,12 @@
# Change Log

## 2.0.15

### Patch Changes

- Updated dependencies [7b568c39]
- @smithy/node-config-provider@2.1.0

## 2.0.14

### Patch Changes
Expand Down
2 changes: 1 addition & 1 deletion packages/middleware-retry/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@smithy/middleware-retry",
"version": "2.0.14",
"version": "2.0.15",
"scripts": {
"build": "concurrently 'yarn:build:cjs' 'yarn:build:es' 'yarn:build:types && yarn build:types:downlevel'",
"build:cjs": "yarn g:tsc -p tsconfig.cjs.json",
Expand Down
11 changes: 11 additions & 0 deletions packages/node-config-provider/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,16 @@
# Change Log

## 2.1.0

### Minor Changes

- 7b568c39: Pass configuration file as second parameter to configSelector

### Patch Changes

- Updated dependencies [aa86b3fe]
- @smithy/shared-ini-file-loader@2.1.0

## 2.0.14

### Patch Changes
Expand Down
2 changes: 1 addition & 1 deletion packages/node-config-provider/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@smithy/node-config-provider",
"version": "2.0.14",
"version": "2.1.0",
"description": "Load config default values from ini config files and environmental variable",
"scripts": {
"build": "concurrently 'yarn:build:cjs' 'yarn:build:es' 'yarn:build:types && yarn build:types:downlevel'",
Expand Down
7 changes: 4 additions & 3 deletions packages/node-config-provider/src/fromSharedConfigFiles.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { CredentialsProviderError } from "@smithy/property-provider";
import { getProfileName, loadSharedConfigFiles, SourceProfileInit } from "@smithy/shared-ini-file-loader";
import { Profile, Provider } from "@smithy/types";
import { ParsedIniData, Profile, Provider } from "@smithy/types";

export interface SharedConfigInit extends SourceProfileInit {
/**
Expand All @@ -11,7 +11,7 @@ export interface SharedConfigInit extends SourceProfileInit {
preferredFile?: "config" | "credentials";
}

export type GetterFromConfig<T> = (profile: Profile) => T | undefined;
export type GetterFromConfig<T> = (profile: Profile, configFile?: ParsedIniData) => T | undefined;

/**
* Get config value from the shared config files with inferred profile name.
Expand All @@ -31,7 +31,8 @@ export const fromSharedConfigFiles = <T = string>(
: { ...profileFromConfig, ...profileFromCredentials };

try {
const configValue = configSelector(mergedProfile);
const cfgFile = preferredFile === "config" ? configFile : credentialsFile;
const configValue = configSelector(mergedProfile, cfgFile);
if (configValue === undefined) {
throw new Error();
}
Expand Down
6 changes: 6 additions & 0 deletions packages/shared-ini-file-loader/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,11 @@
# Change Log

## 2.1.0

### Minor Changes

- aa86b3fe: Populate subsection using dot separator in section key when parsing INI files

## 2.0.13

### Patch Changes
Expand Down
2 changes: 1 addition & 1 deletion packages/shared-ini-file-loader/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@smithy/shared-ini-file-loader",
"version": "2.0.13",
"version": "2.1.0",
"dependencies": {
"@smithy/types": "workspace:^",
"tslib": "^2.5.0"
Expand Down
27 changes: 20 additions & 7 deletions packages/shared-ini-file-loader/src/parseIni.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -91,20 +91,33 @@ describe(parseIni.name, () => {
});

it("returns data from main section, and not subsection", () => {
const mockMainSettings = { key: "value1" };
const mockProfileDataWithSubSettings = { ...mockMainSettings, "sub-settings-name": { key: "subValue1" } };
const mockProfileDataWithSubSettings = {
key: "value",
subSection: { subKey: "subValue" },
};
const mockInput = getMockProfileContent(mockProfileName, mockProfileDataWithSubSettings);
expect(parseIni(mockInput)).toStrictEqual({
[mockProfileName]: mockMainSettings,
[mockProfileName]: {
key: "value",
"subSection.subKey": "subValue",
},
});

const mockProfileName2 = "mock_profile_name_2";
const mockMainSettings2 = { key: "value2" };
const mockProfileDataWithSubSettings2 = { ...mockMainSettings2, "sub-settings-name": { key: "subValue2" } };
const mockProfileDataWithSubSettings2 = {
key: "value2",
subSection: { subKey: "subValue2" },
};
const mockInput2 = getMockProfileContent(mockProfileName2, mockProfileDataWithSubSettings2);
expect(parseIni(`${mockInput}${mockInput2}`)).toStrictEqual({
[mockProfileName]: mockMainSettings,
[mockProfileName2]: mockMainSettings2,
[mockProfileName]: {
key: "value",
"subSection.subKey": "subValue",
},
[mockProfileName2]: {
key: "value2",
"subSection.subKey": "subValue2",
},
});
});
});
Expand Down
6 changes: 3 additions & 3 deletions packages/shared-ini-file-loader/src/parseIni.ts
Original file line number Diff line number Diff line change
Expand Up @@ -26,10 +26,10 @@ export const parseIni = (iniData: string): ParsedIniData => {
];
if (value === "") {
currentSubSection = name;
} else if (currentSubSection === undefined) {
// ToDo: populate subsection in future PR, when IniSection is updated to support subsections.
} else {
map[currentSection] = map[currentSection] || {};
map[currentSection][name] = value;
const key = currentSubSection ? `${currentSubSection}.${name}` : name;
map[currentSection][key] = value;
}
}
}
Expand Down
9 changes: 9 additions & 0 deletions packages/util-defaults-mode-node/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,14 @@
# Change Log

## 2.0.17

### Patch Changes

- Updated dependencies [7b568c39]
- @smithy/node-config-provider@2.1.0
- @smithy/config-resolver@2.0.13
- @smithy/credential-provider-imds@2.0.15

## 2.0.16

### Patch Changes
Expand Down
2 changes: 1 addition & 1 deletion packages/util-defaults-mode-node/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@smithy/util-defaults-mode-node",
"version": "2.0.16",
"version": "2.0.17",
"scripts": {
"build": "concurrently 'yarn:build:cjs' 'yarn:build:es' 'yarn:build:types && yarn build:types:downlevel'",
"build:cjs": "yarn g:tsc -p tsconfig.cjs.json",
Expand Down
Loading