template-saas/apps/backend/node_modules/@aws-sdk/middleware-user-agent/dist-es/configurations.js
rckrdmrd 50a821a415
Some checks failed
CI / Backend CI (push) Has been cancelled
CI / Frontend CI (push) Has been cancelled
CI / Security Scan (push) Has been cancelled
CI / CI Summary (push) Has been cancelled
[SIMCO-V38] feat: Actualizar a SIMCO v3.8.0
- HERENCIA-SIMCO.md actualizado con directivas v3.7 y v3.8
- Actualizaciones de configuracion

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-10 08:53:08 -06:00

29 lines
1.2 KiB
JavaScript

import { normalizeProvider } from "@smithy/core";
export const DEFAULT_UA_APP_ID = undefined;
function isValidUserAgentAppId(appId) {
if (appId === undefined) {
return true;
}
return typeof appId === "string" && appId.length <= 50;
}
export function resolveUserAgentConfig(input) {
const normalizedAppIdProvider = normalizeProvider(input.userAgentAppId ?? DEFAULT_UA_APP_ID);
const { customUserAgent } = input;
return Object.assign(input, {
customUserAgent: typeof customUserAgent === "string" ? [[customUserAgent]] : customUserAgent,
userAgentAppId: async () => {
const appId = await normalizedAppIdProvider();
if (!isValidUserAgentAppId(appId)) {
const logger = input.logger?.constructor?.name === "NoOpLogger" || !input.logger ? console : input.logger;
if (typeof appId !== "string") {
logger?.warn("userAgentAppId must be a string or undefined.");
}
else if (appId.length > 50) {
logger?.warn("The provided userAgentAppId exceeds the maximum length of 50 characters.");
}
}
return appId;
},
});
}