Initial
This commit is contained in:
3
resources/app/node_modules/@aws-sdk/util-user-agent-node/dist-es/crt-availability.js
generated
vendored
Normal file
3
resources/app/node_modules/@aws-sdk/util-user-agent-node/dist-es/crt-availability.js
generated
vendored
Normal file
@@ -0,0 +1,3 @@
|
||||
export const crtAvailability = {
|
||||
isCrtAvailable: false,
|
||||
};
|
||||
39
resources/app/node_modules/@aws-sdk/util-user-agent-node/dist-es/index.js
generated
vendored
Normal file
39
resources/app/node_modules/@aws-sdk/util-user-agent-node/dist-es/index.js
generated
vendored
Normal file
@@ -0,0 +1,39 @@
|
||||
import { loadConfig } from "@smithy/node-config-provider";
|
||||
import { platform, release } from "os";
|
||||
import { env, versions } from "process";
|
||||
import { isCrtAvailable } from "./is-crt-available";
|
||||
export { crtAvailability } from "./crt-availability";
|
||||
export const UA_APP_ID_ENV_NAME = "AWS_SDK_UA_APP_ID";
|
||||
export const UA_APP_ID_INI_NAME = "sdk-ua-app-id";
|
||||
export const defaultUserAgent = ({ serviceId, clientVersion }) => {
|
||||
const sections = [
|
||||
["aws-sdk-js", clientVersion],
|
||||
["ua", "2.0"],
|
||||
[`os/${platform()}`, release()],
|
||||
["lang/js"],
|
||||
["md/nodejs", `${versions.node}`],
|
||||
];
|
||||
const crtAvailable = isCrtAvailable();
|
||||
if (crtAvailable) {
|
||||
sections.push(crtAvailable);
|
||||
}
|
||||
if (serviceId) {
|
||||
sections.push([`api/${serviceId}`, clientVersion]);
|
||||
}
|
||||
if (env.AWS_EXECUTION_ENV) {
|
||||
sections.push([`exec-env/${env.AWS_EXECUTION_ENV}`]);
|
||||
}
|
||||
const appIdPromise = loadConfig({
|
||||
environmentVariableSelector: (env) => env[UA_APP_ID_ENV_NAME],
|
||||
configFileSelector: (profile) => profile[UA_APP_ID_INI_NAME],
|
||||
default: undefined,
|
||||
})();
|
||||
let resolvedUserAgent = undefined;
|
||||
return async () => {
|
||||
if (!resolvedUserAgent) {
|
||||
const appId = await appIdPromise;
|
||||
resolvedUserAgent = appId ? [...sections, [`app/${appId}`]] : [...sections];
|
||||
}
|
||||
return resolvedUserAgent;
|
||||
};
|
||||
};
|
||||
7
resources/app/node_modules/@aws-sdk/util-user-agent-node/dist-es/is-crt-available.js
generated
vendored
Normal file
7
resources/app/node_modules/@aws-sdk/util-user-agent-node/dist-es/is-crt-available.js
generated
vendored
Normal file
@@ -0,0 +1,7 @@
|
||||
import { crtAvailability } from "./crt-availability";
|
||||
export const isCrtAvailable = () => {
|
||||
if (crtAvailability.isCrtAvailable) {
|
||||
return ["md/crt-avail"];
|
||||
}
|
||||
return null;
|
||||
};
|
||||
Reference in New Issue
Block a user