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

feat(clients): move source files to 'src' folder #2845

Merged
merged 11 commits into from
Sep 29, 2021
  •  
  •  
  •  
The diff you're trying to view is too large. We only load the first 3000 changed files.
2 changes: 1 addition & 1 deletion clients/client-accessanalyzer/.gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
/build/
/coverage/
/docs/
/dist/
/dist-*
*.tsbuildinfo
*.tgz
*.log
Expand Down
24 changes: 12 additions & 12 deletions clients/client-accessanalyzer/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,18 +11,12 @@
"clean": "yarn clean:dist && yarn clean:docs",
"clean:dist": "rimraf ./dist",
"clean:docs": "rimraf ./docs",
"downlevel-dts": "downlevel-dts dist/types dist/types/ts3.4",
"downlevel-dts": "downlevel-dts dist-types dist-types/ts3.4",
"test": "exit 0"
},
"main": "./dist/cjs/index.js",
"types": "./dist/types/index.d.ts",
"module": "./dist/es/index.js",
"browser": {
"./runtimeConfig": "./runtimeConfig.browser"
},
"react-native": {
"./runtimeConfig": "./runtimeConfig.native"
},
"main": "./dist-cjs/index.js",
"types": "./dist-types/index.d.ts",
"module": "./dist-es/index.js",
"sideEffects": false,
"dependencies": {
"@aws-crypto/sha256-browser": "^1.0.0",
Expand Down Expand Up @@ -74,8 +68,8 @@
},
"typesVersions": {
"<4.0": {
"dist/types/*": [
"dist/types/ts3.4/*"
"dist-types/*": [
"dist-types/ts3.4/*"
]
}
},
Expand All @@ -84,6 +78,12 @@
"url": "https://aws.amazon.com/javascript/"
},
"license": "Apache-2.0",
"browser": {
"./dist-es/runtimeConfig": "./dist-es/runtimeConfig.browser"
},
"react-native": {
"./dist-es/runtimeConfig": "./dist-es/runtimeConfig.native"
},
"homepage": "https://github.com/aws/aws-sdk-js-v3/tree/main/clients/client-accessanalyzer",
"repository": {
"type": "git",
Expand Down
40 changes: 0 additions & 40 deletions clients/client-accessanalyzer/runtimeConfig.browser.ts

This file was deleted.

45 changes: 0 additions & 45 deletions clients/client-accessanalyzer/runtimeConfig.ts

This file was deleted.

41 changes: 41 additions & 0 deletions clients/client-accessanalyzer/src/runtimeConfig.browser.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
// @ts-ignore: package.json will be imported from dist folders
import packageInfo from "../package.json";

import { Sha256 } from "@aws-crypto/sha256-browser";
import { FetchHttpHandler, streamCollector } from "@aws-sdk/fetch-http-handler";
import { invalidProvider } from "@aws-sdk/invalid-dependency";
import { DEFAULT_MAX_ATTEMPTS, DEFAULT_RETRY_MODE } from "@aws-sdk/middleware-retry";
import { fromBase64, toBase64 } from "@aws-sdk/util-base64-browser";
import { calculateBodyLength } from "@aws-sdk/util-body-length-browser";
import { defaultUserAgent } from "@aws-sdk/util-user-agent-browser";
import { fromUtf8, toUtf8 } from "@aws-sdk/util-utf8-browser";
import { AccessAnalyzerClientConfig } from "./AccessAnalyzerClient";
import { getRuntimeConfig as getSharedRuntimeConfig } from "./runtimeConfig.shared";

/**
* @internal
*/
export const getRuntimeConfig = (config: AccessAnalyzerClientConfig) => {
const clientSharedValues = getSharedRuntimeConfig(config);
return {
...clientSharedValues,
...config,
runtime: "browser",
base64Decoder: config?.base64Decoder ?? fromBase64,
base64Encoder: config?.base64Encoder ?? toBase64,
bodyLengthChecker: config?.bodyLengthChecker ?? calculateBodyLength,
credentialDefaultProvider:
config?.credentialDefaultProvider ?? ((_: unknown) => () => Promise.reject(new Error("Credential is missing"))),
defaultUserAgentProvider:
config?.defaultUserAgentProvider ??
defaultUserAgent({ serviceId: clientSharedValues.serviceId, clientVersion: packageInfo.version }),
maxAttempts: config?.maxAttempts ?? DEFAULT_MAX_ATTEMPTS,
region: config?.region ?? invalidProvider("Region is missing"),
requestHandler: config?.requestHandler ?? new FetchHttpHandler(),
retryMode: config?.retryMode ?? (() => Promise.resolve(DEFAULT_RETRY_MODE)),
sha256: config?.sha256 ?? Sha256,
streamCollector: config?.streamCollector ?? streamCollector,
utf8Decoder: config?.utf8Decoder ?? fromUtf8,
utf8Encoder: config?.utf8Encoder ?? toUtf8,
};
};
46 changes: 46 additions & 0 deletions clients/client-accessanalyzer/src/runtimeConfig.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
// @ts-ignore: package.json will be imported from dist folders
import packageInfo from "../package.json";

import { decorateDefaultCredentialProvider } from "@aws-sdk/client-sts";
import { NODE_REGION_CONFIG_FILE_OPTIONS, NODE_REGION_CONFIG_OPTIONS } from "@aws-sdk/config-resolver";
import { defaultProvider as credentialDefaultProvider } from "@aws-sdk/credential-provider-node";
import { Hash } from "@aws-sdk/hash-node";
import { NODE_MAX_ATTEMPT_CONFIG_OPTIONS, NODE_RETRY_MODE_CONFIG_OPTIONS } from "@aws-sdk/middleware-retry";
import { loadConfig as loadNodeConfig } from "@aws-sdk/node-config-provider";
import { NodeHttpHandler, streamCollector } from "@aws-sdk/node-http-handler";
import { fromBase64, toBase64 } from "@aws-sdk/util-base64-node";
import { calculateBodyLength } from "@aws-sdk/util-body-length-node";
import { defaultUserAgent } from "@aws-sdk/util-user-agent-node";
import { fromUtf8, toUtf8 } from "@aws-sdk/util-utf8-node";
import { AccessAnalyzerClientConfig } from "./AccessAnalyzerClient";
import { getRuntimeConfig as getSharedRuntimeConfig } from "./runtimeConfig.shared";
import { emitWarningIfUnsupportedVersion } from "@aws-sdk/smithy-client";

/**
* @internal
*/
export const getRuntimeConfig = (config: AccessAnalyzerClientConfig) => {
emitWarningIfUnsupportedVersion(process.version);
const clientSharedValues = getSharedRuntimeConfig(config);
return {
...clientSharedValues,
...config,
runtime: "node",
base64Decoder: config?.base64Decoder ?? fromBase64,
base64Encoder: config?.base64Encoder ?? toBase64,
bodyLengthChecker: config?.bodyLengthChecker ?? calculateBodyLength,
credentialDefaultProvider:
config?.credentialDefaultProvider ?? decorateDefaultCredentialProvider(credentialDefaultProvider),
defaultUserAgentProvider:
config?.defaultUserAgentProvider ??
defaultUserAgent({ serviceId: clientSharedValues.serviceId, clientVersion: packageInfo.version }),
maxAttempts: config?.maxAttempts ?? loadNodeConfig(NODE_MAX_ATTEMPT_CONFIG_OPTIONS),
region: config?.region ?? loadNodeConfig(NODE_REGION_CONFIG_OPTIONS, NODE_REGION_CONFIG_FILE_OPTIONS),
requestHandler: config?.requestHandler ?? new NodeHttpHandler(),
retryMode: config?.retryMode ?? loadNodeConfig(NODE_RETRY_MODE_CONFIG_OPTIONS),
sha256: config?.sha256 ?? Hash.bind(null, "sha256"),
streamCollector: config?.streamCollector ?? streamCollector,
utf8Decoder: config?.utf8Decoder ?? fromUtf8,
utf8Encoder: config?.utf8Encoder ?? toUtf8,
};
};
2 changes: 1 addition & 1 deletion clients/client-accessanalyzer/tsconfig.es.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,6 @@
"module": "esnext",
"moduleResolution": "node",
"lib": ["dom", "es5", "es2015.promise", "es2015.collection", "es2015.iterable", "es2015.symbol.wellknown"],
"outDir": "dist/es"
"outDir": "dist-es"
}
}
6 changes: 4 additions & 2 deletions clients/client-accessanalyzer/tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,8 @@
"incremental": true,
"resolveJsonModule": true,
"esModuleInterop": true,
"outDir": "dist/cjs",
"rootDir": "src",
"outDir": "dist-cjs",
"removeComments": true
},
"typedocOptions": {
Expand All @@ -27,5 +28,6 @@
"out": "docs",
"theme": "minimal",
"plugin": ["@aws-sdk/client-documentation-generator"]
}
},
"exclude": ["test/**/*"]
}
5 changes: 3 additions & 2 deletions clients/client-accessanalyzer/tsconfig.types.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
"compilerOptions": {
"removeComments": false,
"declaration": true,
"declarationDir": "dist/types"
}
"declarationDir": "dist-types"
},
"exclude": ["test/**/*", "dist-types/**/*"]
}
2 changes: 1 addition & 1 deletion clients/client-acm-pca/.gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
/build/
/coverage/
/docs/
/dist/
/dist-*
*.tsbuildinfo
*.tgz
*.log
Expand Down
24 changes: 12 additions & 12 deletions clients/client-acm-pca/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,18 +11,12 @@
"clean": "yarn clean:dist && yarn clean:docs",
"clean:dist": "rimraf ./dist",
"clean:docs": "rimraf ./docs",
"downlevel-dts": "downlevel-dts dist/types dist/types/ts3.4",
"downlevel-dts": "downlevel-dts dist-types dist-types/ts3.4",
"test": "exit 0"
},
"main": "./dist/cjs/index.js",
"types": "./dist/types/index.d.ts",
"module": "./dist/es/index.js",
"browser": {
"./runtimeConfig": "./runtimeConfig.browser"
},
"react-native": {
"./runtimeConfig": "./runtimeConfig.native"
},
"main": "./dist-cjs/index.js",
"types": "./dist-types/index.d.ts",
"module": "./dist-es/index.js",
"sideEffects": false,
"dependencies": {
"@aws-crypto/sha256-browser": "^1.0.0",
Expand Down Expand Up @@ -73,8 +67,8 @@
},
"typesVersions": {
"<4.0": {
"dist/types/*": [
"dist/types/ts3.4/*"
"dist-types/*": [
"dist-types/ts3.4/*"
]
}
},
Expand All @@ -83,6 +77,12 @@
"url": "https://aws.amazon.com/javascript/"
},
"license": "Apache-2.0",
"browser": {
"./dist-es/runtimeConfig": "./dist-es/runtimeConfig.browser"
},
"react-native": {
"./dist-es/runtimeConfig": "./dist-es/runtimeConfig.native"
},
"homepage": "https://github.com/aws/aws-sdk-js-v3/tree/main/clients/client-acm-pca",
"repository": {
"type": "git",
Expand Down
40 changes: 0 additions & 40 deletions clients/client-acm-pca/runtimeConfig.browser.ts

This file was deleted.

Loading