working rss feed to nostr publish
This commit is contained in:
Generated
Vendored
+30
@@ -0,0 +1,30 @@
|
||||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.createConfigValueProvider = void 0;
|
||||
const createConfigValueProvider = (configKey, canonicalEndpointParamKey, config) => {
|
||||
const configProvider = async () => {
|
||||
var _a;
|
||||
const configValue = (_a = config[configKey]) !== null && _a !== void 0 ? _a : config[canonicalEndpointParamKey];
|
||||
if (typeof configValue === "function") {
|
||||
return configValue();
|
||||
}
|
||||
return configValue;
|
||||
};
|
||||
if (configKey === "endpoint" || canonicalEndpointParamKey === "endpoint") {
|
||||
return async () => {
|
||||
const endpoint = await configProvider();
|
||||
if (endpoint && typeof endpoint === "object") {
|
||||
if ("url" in endpoint) {
|
||||
return endpoint.url.href;
|
||||
}
|
||||
if ("hostname" in endpoint) {
|
||||
const { protocol, hostname, port, path } = endpoint;
|
||||
return `${protocol}//${hostname}${port ? ":" + port : ""}${path}`;
|
||||
}
|
||||
}
|
||||
return endpoint;
|
||||
};
|
||||
}
|
||||
return configProvider;
|
||||
};
|
||||
exports.createConfigValueProvider = createConfigValueProvider;
|
||||
Generated
Vendored
+5
@@ -0,0 +1,5 @@
|
||||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.getEndpointFromConfig = void 0;
|
||||
const getEndpointFromConfig = async (serviceId) => undefined;
|
||||
exports.getEndpointFromConfig = getEndpointFromConfig;
|
||||
Generated
Vendored
+7
@@ -0,0 +1,7 @@
|
||||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.getEndpointFromConfig = void 0;
|
||||
const node_config_provider_1 = require("@smithy/node-config-provider");
|
||||
const getEndpointUrlConfig_1 = require("./getEndpointUrlConfig");
|
||||
const getEndpointFromConfig = async (serviceId) => (0, node_config_provider_1.loadConfig)((0, getEndpointUrlConfig_1.getEndpointUrlConfig)(serviceId))();
|
||||
exports.getEndpointFromConfig = getEndpointFromConfig;
|
||||
Generated
Vendored
+51
@@ -0,0 +1,51 @@
|
||||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.resolveParams = exports.getEndpointFromInstructions = void 0;
|
||||
const service_customizations_1 = require("../service-customizations");
|
||||
const createConfigValueProvider_1 = require("./createConfigValueProvider");
|
||||
const getEndpointFromConfig_1 = require("./getEndpointFromConfig");
|
||||
const toEndpointV1_1 = require("./toEndpointV1");
|
||||
const getEndpointFromInstructions = async (commandInput, instructionsSupplier, clientConfig, context) => {
|
||||
if (!clientConfig.endpoint) {
|
||||
const endpointFromConfig = await (0, getEndpointFromConfig_1.getEndpointFromConfig)(clientConfig.serviceId || "");
|
||||
if (endpointFromConfig) {
|
||||
clientConfig.endpoint = () => Promise.resolve((0, toEndpointV1_1.toEndpointV1)(endpointFromConfig));
|
||||
}
|
||||
}
|
||||
const endpointParams = await (0, exports.resolveParams)(commandInput, instructionsSupplier, clientConfig);
|
||||
if (typeof clientConfig.endpointProvider !== "function") {
|
||||
throw new Error("config.endpointProvider is not set.");
|
||||
}
|
||||
const endpoint = clientConfig.endpointProvider(endpointParams, context);
|
||||
return endpoint;
|
||||
};
|
||||
exports.getEndpointFromInstructions = getEndpointFromInstructions;
|
||||
const resolveParams = async (commandInput, instructionsSupplier, clientConfig) => {
|
||||
var _a;
|
||||
const endpointParams = {};
|
||||
const instructions = ((_a = instructionsSupplier === null || instructionsSupplier === void 0 ? void 0 : instructionsSupplier.getEndpointParameterInstructions) === null || _a === void 0 ? void 0 : _a.call(instructionsSupplier)) || {};
|
||||
for (const [name, instruction] of Object.entries(instructions)) {
|
||||
switch (instruction.type) {
|
||||
case "staticContextParams":
|
||||
endpointParams[name] = instruction.value;
|
||||
break;
|
||||
case "contextParams":
|
||||
endpointParams[name] = commandInput[instruction.name];
|
||||
break;
|
||||
case "clientContextParams":
|
||||
case "builtInParams":
|
||||
endpointParams[name] = await (0, createConfigValueProvider_1.createConfigValueProvider)(instruction.name, name, clientConfig)();
|
||||
break;
|
||||
default:
|
||||
throw new Error("Unrecognized endpoint parameter instruction: " + JSON.stringify(instruction));
|
||||
}
|
||||
}
|
||||
if (Object.keys(instructions).length === 0) {
|
||||
Object.assign(endpointParams, clientConfig);
|
||||
}
|
||||
if (String(clientConfig.serviceId).toLowerCase() === "s3") {
|
||||
await (0, service_customizations_1.resolveParamsForS3)(endpointParams);
|
||||
}
|
||||
return endpointParams;
|
||||
};
|
||||
exports.resolveParams = resolveParams;
|
||||
Generated
Vendored
+35
@@ -0,0 +1,35 @@
|
||||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.getEndpointUrlConfig = void 0;
|
||||
const shared_ini_file_loader_1 = require("@smithy/shared-ini-file-loader");
|
||||
const ENV_ENDPOINT_URL = "AWS_ENDPOINT_URL";
|
||||
const CONFIG_ENDPOINT_URL = "endpoint_url";
|
||||
const getEndpointUrlConfig = (serviceId) => ({
|
||||
environmentVariableSelector: (env) => {
|
||||
const serviceSuffixParts = serviceId.split(" ").map((w) => w.toUpperCase());
|
||||
const serviceEndpointUrl = env[[ENV_ENDPOINT_URL, ...serviceSuffixParts].join("_")];
|
||||
if (serviceEndpointUrl)
|
||||
return serviceEndpointUrl;
|
||||
const endpointUrl = env[ENV_ENDPOINT_URL];
|
||||
if (endpointUrl)
|
||||
return endpointUrl;
|
||||
return undefined;
|
||||
},
|
||||
configFileSelector: (profile, config) => {
|
||||
if (config && profile.services) {
|
||||
const servicesSection = config[["services", profile.services].join(shared_ini_file_loader_1.CONFIG_PREFIX_SEPARATOR)];
|
||||
if (servicesSection) {
|
||||
const servicePrefixParts = serviceId.split(" ").map((w) => w.toLowerCase());
|
||||
const endpointUrl = servicesSection[[servicePrefixParts.join("_"), CONFIG_ENDPOINT_URL].join(shared_ini_file_loader_1.CONFIG_PREFIX_SEPARATOR)];
|
||||
if (endpointUrl)
|
||||
return endpointUrl;
|
||||
}
|
||||
}
|
||||
const endpointUrl = profile[CONFIG_ENDPOINT_URL];
|
||||
if (endpointUrl)
|
||||
return endpointUrl;
|
||||
return undefined;
|
||||
},
|
||||
default: undefined,
|
||||
});
|
||||
exports.getEndpointUrlConfig = getEndpointUrlConfig;
|
||||
+5
@@ -0,0 +1,5 @@
|
||||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
const tslib_1 = require("tslib");
|
||||
tslib_1.__exportStar(require("./getEndpointFromInstructions"), exports);
|
||||
tslib_1.__exportStar(require("./toEndpointV1"), exports);
|
||||
+14
@@ -0,0 +1,14 @@
|
||||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.toEndpointV1 = void 0;
|
||||
const url_parser_1 = require("@smithy/url-parser");
|
||||
const toEndpointV1 = (endpoint) => {
|
||||
if (typeof endpoint === "object") {
|
||||
if ("url" in endpoint) {
|
||||
return (0, url_parser_1.parseUrl)(endpoint.url);
|
||||
}
|
||||
return endpoint;
|
||||
}
|
||||
return (0, url_parser_1.parseUrl)(endpoint);
|
||||
};
|
||||
exports.toEndpointV1 = toEndpointV1;
|
||||
Reference in New Issue
Block a user