awscdk-construct-scte-scheduler
Version:
AWS CDK Construct for scheduling SCTE-35 events using the MediaLive schedule API
81 lines (71 loc) • 2.46 kB
JavaScript
;
var retry = require('@smithy/core/retry');
const state = {
warningEmitted: false,
};
const emitWarningIfUnsupportedVersion = (version) => {
if (version && !state.warningEmitted) {
if (process.env.AWS_SDK_JS_NODE_VERSION_SUPPORT_WARNING_DISABLED === "true") {
state.warningEmitted = true;
return;
}
const userMajorVersion = parseInt(version.substring(1, version.indexOf(".")));
const vv = 22;
if (userMajorVersion < vv) {
state.warningEmitted = true;
process.emitWarning(`NodeVersionSupportWarning: The AWS SDK for JavaScript (v3)
versions published after the first week of January 2027
will require node >=${vv}. You are running node ${version}.
To continue receiving updates to AWS services, bug fixes,
and security updates please upgrade to node >=${vv}.
More information can be found at: https://a.co/c895JFp`);
}
}
};
const longPollMiddleware = () => (next, context) => async (args) => {
context.__retryLongPoll = true;
return next(args);
};
const longPollMiddlewareOptions = {
name: "longPollMiddleware",
tags: ["RETRY"],
step: "initialize",
override: true,
};
const getLongPollPlugin = (options) => ({
applyToStack: (clientStack) => {
clientStack.add(longPollMiddleware(), longPollMiddlewareOptions);
},
});
function setCredentialFeature(credentials, feature, value) {
if (!credentials.$source) {
credentials.$source = {};
}
credentials.$source[feature] = value;
return credentials;
}
retry.Retry.v2026 ||= typeof process === "object" && process.env?.AWS_NEW_RETRIES_2026 === "true";
function setFeature(context, feature, value) {
if (!context.__aws_sdk_context) {
context.__aws_sdk_context = {
features: {},
};
}
else if (!context.__aws_sdk_context.features) {
context.__aws_sdk_context.features = {};
}
context.__aws_sdk_context.features[feature] = value;
}
function setTokenFeature(token, feature, value) {
if (!token.$source) {
token.$source = {};
}
token.$source[feature] = value;
return token;
}
exports.emitWarningIfUnsupportedVersion = emitWarningIfUnsupportedVersion;
exports.getLongPollPlugin = getLongPollPlugin;
exports.setCredentialFeature = setCredentialFeature;
exports.setFeature = setFeature;
exports.setTokenFeature = setTokenFeature;
exports.state = state;