@hyperline/cli 0.1.0-build.1.3c3eb4b → 0.1.0-build.1.3da5bc9
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/bin/hyperline-main.js +534 -453
- package/package.json +1 -1
|
@@ -41125,6 +41125,24 @@ Examples:
|
|
|
41125
41125
|
]
|
|
41126
41126
|
});
|
|
41127
41127
|
});
|
|
41128
|
+
resource.command("get").description(`Retrieve a price configuration by ID, including its prices and external integration references.`).requiredOption("--id <value>", `id parameter`).addHelpText("after", `
|
|
41129
|
+
Examples:
|
|
41130
|
+
hyperline price-configurations get --id <id>`).action(async (opts) => {
|
|
41131
|
+
const ctx = resource.parent?.opts()._ctx;
|
|
41132
|
+
if (!ctx) {
|
|
41133
|
+
process.stderr.write("Error: Not authenticated\n");
|
|
41134
|
+
process.exit(1);
|
|
41135
|
+
}
|
|
41136
|
+
const args = {};
|
|
41137
|
+
if (opts.id !== void 0)
|
|
41138
|
+
args.id = opts.id;
|
|
41139
|
+
await ctx.execute({
|
|
41140
|
+
method: "GET",
|
|
41141
|
+
path: "/v1/price-configurations/{id}",
|
|
41142
|
+
args,
|
|
41143
|
+
queryParamKeys: []
|
|
41144
|
+
});
|
|
41145
|
+
});
|
|
41128
41146
|
resource.command("update-prices").description(`Update the prices of an existing price configuration by ID. Allows changing tier thresholds, unit prices, and flat fees.`).requiredOption("--id <value>", `id parameter`).option("--stdin", `Read JSON array input from stdin`).addHelpText("after", `
|
|
41129
41147
|
Examples:
|
|
41130
41148
|
hyperline price-configurations update-prices --id <id>
|
|
@@ -43580,10 +43598,10 @@ Examples:
|
|
|
43580
43598
|
queryParamKeys: []
|
|
43581
43599
|
});
|
|
43582
43600
|
});
|
|
43583
|
-
resource.command("list-wallet-transactions").description(`List all transactions (loads, usages, refunds) for a wallet. Paginated with take/skip.`).requiredOption("--id <value>", `id parameter`).option("--take <number>", `take`).option("--skip <number>", `skip`).addHelpText("after", `
|
|
43601
|
+
resource.command("list-wallet-transactions").description(`List all transactions (loads, usages, refunds) for a wallet. Paginated with take/skip.`).requiredOption("--id <value>", `id parameter`).option("--take <number>", `take`).option("--skip <number>", `skip`).option("--type <value>", `Filter transactions by their type.`).option("--amount <number>", `Filter transactions by their exact amount, expressed in the currency's smallest unit.`).option("--invoice-id <value>", `Filter transactions by the invoice they are attached to.`).option("--comment <value>", `Filter transactions whose comment contains this value, case-insensitive.`).addHelpText("after", `
|
|
43584
43602
|
Examples:
|
|
43585
43603
|
hyperline wallets list-wallet-transactions --id <id>
|
|
43586
|
-
hyperline wallets list-wallet-transactions --id <id> --take <take>`).action(async (opts) => {
|
|
43604
|
+
hyperline wallets list-wallet-transactions --id <id> --take <take> --type <type>`).action(async (opts) => {
|
|
43587
43605
|
const ctx = resource.parent?.opts()._ctx;
|
|
43588
43606
|
if (!ctx) {
|
|
43589
43607
|
process.stderr.write("Error: Not authenticated\n");
|
|
@@ -43592,15 +43610,30 @@ Examples:
|
|
|
43592
43610
|
const args = {};
|
|
43593
43611
|
if (opts.id !== void 0)
|
|
43594
43612
|
args.id = opts.id;
|
|
43613
|
+
if (opts.type !== void 0)
|
|
43614
|
+
args.type = opts.type;
|
|
43615
|
+
if (opts.invoiceId !== void 0)
|
|
43616
|
+
args.invoice_id = opts.invoiceId;
|
|
43617
|
+
if (opts.comment !== void 0)
|
|
43618
|
+
args.comment = opts.comment;
|
|
43595
43619
|
if (opts.take !== void 0)
|
|
43596
43620
|
args.take = Number(opts.take);
|
|
43597
43621
|
if (opts.skip !== void 0)
|
|
43598
43622
|
args.skip = Number(opts.skip);
|
|
43623
|
+
if (opts.amount !== void 0)
|
|
43624
|
+
args.amount = Number(opts.amount);
|
|
43599
43625
|
await ctx.execute({
|
|
43600
43626
|
method: "GET",
|
|
43601
43627
|
path: "/v1/wallets/{id}/transactions",
|
|
43602
43628
|
args,
|
|
43603
|
-
queryParamKeys: [
|
|
43629
|
+
queryParamKeys: [
|
|
43630
|
+
"take",
|
|
43631
|
+
"skip",
|
|
43632
|
+
"type",
|
|
43633
|
+
"amount",
|
|
43634
|
+
"invoice_id",
|
|
43635
|
+
"comment"
|
|
43636
|
+
]
|
|
43604
43637
|
});
|
|
43605
43638
|
});
|
|
43606
43639
|
resource.command("revert-wallet-load").description(`Revert a wallet credit transaction: voids the related credit note and creates a debit transaction to undo the load.`).requiredOption("--id <value>", `id parameter`).requiredOption("--transaction-id <value>", `transactionId parameter`).addHelpText("after", `
|
|
@@ -57639,398 +57672,18 @@ var AmountSchema = external_exports.number().openapi({
|
|
|
57639
57672
|
description: `Monetary amount. ${amountDescription}`
|
|
57640
57673
|
});
|
|
57641
57674
|
|
|
57642
|
-
// ../hyperline-
|
|
57643
|
-
|
|
57644
|
-
|
|
57645
|
-
|
|
57646
|
-
|
|
57647
|
-
|
|
57648
|
-
|
|
57649
|
-
|
|
57650
|
-
|
|
57651
|
-
|
|
57652
|
-
|
|
57653
|
-
|
|
57654
|
-
}
|
|
57655
|
-
|
|
57656
|
-
// ../hyperline-config/build/index.js
|
|
57657
|
-
import "dotenv/config";
|
|
57658
|
-
import * as stackTraceParser from "stacktrace-parser";
|
|
57659
|
-
function coerceBoolean() {
|
|
57660
|
-
return external_exports.any().refine((value) => ["true", "false"].includes(value), {
|
|
57661
|
-
message: "Expected boolean"
|
|
57662
|
-
}).transform((value) => (
|
|
57663
|
-
// biome-ignore lint/complexity/noUselessTernary: ignore
|
|
57664
|
-
value === "true" ? true : false
|
|
57665
|
-
));
|
|
57666
|
-
}
|
|
57667
|
-
var types = {
|
|
57668
|
-
string: external_exports.coerce.string,
|
|
57669
|
-
number: external_exports.coerce.number,
|
|
57670
|
-
boolean: coerceBoolean,
|
|
57671
|
-
enum: external_exports.enum
|
|
57672
|
-
};
|
|
57673
|
-
function getConfig(schema, testValues) {
|
|
57674
|
-
const validator = external_exports.object(Object.fromEntries(Object.entries(schema).map(([key, zodType]) => {
|
|
57675
|
-
if (zodType instanceof ZodOptional) {
|
|
57676
|
-
return [key, external_exports.string().optional()];
|
|
57677
|
-
}
|
|
57678
|
-
return [key, external_exports.string()];
|
|
57679
|
-
})));
|
|
57680
|
-
const processEnv = process.env;
|
|
57681
|
-
const isTestMode = processEnv.NODE_ENV === "test";
|
|
57682
|
-
const envVariables = {
|
|
57683
|
-
...processEnv,
|
|
57684
|
-
...isTestMode && testValues ? Object.fromEntries(Object.entries(testValues).map(([key, value]) => [key, String(value)])) : {}
|
|
57685
|
-
};
|
|
57686
|
-
const packageName = envVariables.npm_package_name;
|
|
57687
|
-
const parseProcessEnvResult = validator.safeParse(envVariables);
|
|
57688
|
-
if (!parseProcessEnvResult.success) {
|
|
57689
|
-
const parsedStackTrace = stackTraceParser.parse(parseProcessEnvResult.error.stack ?? "");
|
|
57690
|
-
const getConfigCallLine = parsedStackTrace.find((line) => {
|
|
57691
|
-
return !line.file?.includes("hyperline-config") && (line.file?.includes("apps/") || line.file?.includes("core/") || line.file?.includes("packages/"));
|
|
57692
|
-
});
|
|
57693
|
-
const callerFile = getConfigCallLine?.file;
|
|
57694
|
-
console.error(`Invalid environment variables for service \`${packageName}\`: \`${callerFile}\``);
|
|
57695
|
-
console.error(parseProcessEnvResult.error.format());
|
|
57696
|
-
process.exit(1);
|
|
57697
|
-
}
|
|
57698
|
-
const coercion = external_exports.object(schema);
|
|
57699
|
-
return coercion.parse(parseProcessEnvResult.data);
|
|
57700
|
-
}
|
|
57701
|
-
|
|
57702
|
-
// ../hyperline-monitoring/build/config.js
|
|
57703
|
-
var config2 = getConfig({
|
|
57704
|
-
// config
|
|
57705
|
-
APP_VERSION: types.string().optional(),
|
|
57706
|
-
DD_SERVICE: types.string().optional(),
|
|
57707
|
-
LOGGER_CONSOLE_ENABLED: types.boolean().optional(),
|
|
57708
|
-
LOGGER_STDOUT_ENABLED: types.boolean().optional(),
|
|
57709
|
-
NODE_ENV: types.enum(["local", "test", "staging", "sandbox", "production"]),
|
|
57710
|
-
EVENT_LOOP_MONITORING_ENABLED: types.boolean().optional(),
|
|
57711
|
-
MEMORY_MONITORING_ENABLED: types.boolean().optional(),
|
|
57712
|
-
MEMORY_MONITORING_INTERVAL_MS: types.number().optional()
|
|
57713
|
-
// secrets
|
|
57714
|
-
}, {
|
|
57715
|
-
APP_VERSION: void 0,
|
|
57716
|
-
DD_SERVICE: void 0,
|
|
57717
|
-
LOGGER_CONSOLE_ENABLED: false,
|
|
57718
|
-
LOGGER_STDOUT_ENABLED: false,
|
|
57719
|
-
EVENT_LOOP_MONITORING_ENABLED: false,
|
|
57720
|
-
MEMORY_MONITORING_ENABLED: false,
|
|
57721
|
-
MEMORY_MONITORING_INTERVAL_MS: 3e4,
|
|
57722
|
-
NODE_ENV: "test"
|
|
57723
|
-
});
|
|
57724
|
-
|
|
57725
|
-
// ../hyperline-monitoring/build/logger/logger.js
|
|
57726
|
-
import * as util from "node:util";
|
|
57727
|
-
import prune2 from "json-prune";
|
|
57728
|
-
import * as winston from "winston";
|
|
57729
|
-
|
|
57730
|
-
// ../hyperline-monitoring/build/logger/formatting/format.js
|
|
57731
|
-
import prune from "json-prune";
|
|
57732
|
-
var REDACTED_HEADER_KEY_PATTERN = /authorization|authenticate|cookie|secret|token|credential|signature|jwt|api[_-]?key|access[_-]?token|refresh[_-]?token|private[_-]?key/i;
|
|
57733
|
-
function jsonFormat(info) {
|
|
57734
|
-
const prunedInfo = JSON.parse(prune(info));
|
|
57735
|
-
for (const [key, value] of Object.entries(prunedInfo)) {
|
|
57736
|
-
info[key] = value;
|
|
57737
|
-
}
|
|
57738
|
-
return info;
|
|
57739
|
-
}
|
|
57740
|
-
function addMetadata({ getCorrelationId: getCorrelationId2, getExecutionContext: getExecutionContext2 }) {
|
|
57741
|
-
return (info) => {
|
|
57742
|
-
const correlationId = getCorrelationId2();
|
|
57743
|
-
const executionContext = getExecutionContext2();
|
|
57744
|
-
let traceContext;
|
|
57745
|
-
return {
|
|
57746
|
-
...info,
|
|
57747
|
-
...executionContext ?? {},
|
|
57748
|
-
...traceContext ?? {},
|
|
57749
|
-
correlationId
|
|
57750
|
-
};
|
|
57751
|
-
};
|
|
57752
|
-
}
|
|
57753
|
-
function transformErrorEnrich(info, { depth }) {
|
|
57754
|
-
if (depth <= 0) {
|
|
57755
|
-
return info;
|
|
57756
|
-
}
|
|
57757
|
-
Object.entries(info).forEach(([key, value]) => {
|
|
57758
|
-
let newValue = value;
|
|
57759
|
-
if (newValue instanceof Error) {
|
|
57760
|
-
newValue = {
|
|
57761
|
-
...newValue,
|
|
57762
|
-
// Copy error properties manually because they're not enumerable
|
|
57763
|
-
level: newValue.level,
|
|
57764
|
-
stack: newValue.stack,
|
|
57765
|
-
message: newValue.message,
|
|
57766
|
-
name: newValue.name
|
|
57767
|
-
};
|
|
57768
|
-
}
|
|
57769
|
-
if (newValue instanceof Object) {
|
|
57770
|
-
newValue = transformErrorEnrich(newValue, { depth: depth - 1 });
|
|
57771
|
-
}
|
|
57772
|
-
const isPropertyWritable = Object.getOwnPropertyDescriptor(info, key)?.writable ?? true;
|
|
57773
|
-
if (isPropertyWritable && newValue !== value) {
|
|
57774
|
-
info[key] = newValue;
|
|
57775
|
-
}
|
|
57776
|
-
});
|
|
57777
|
-
return info;
|
|
57778
|
-
}
|
|
57779
|
-
function transformPrune(info) {
|
|
57780
|
-
Object.entries(info).forEach(([key, value]) => {
|
|
57781
|
-
if (typeof value === "function") {
|
|
57782
|
-
return;
|
|
57783
|
-
}
|
|
57784
|
-
const newValue = value instanceof Object ? JSON.parse(prune(value, { depthDecr: 6 })) : value;
|
|
57785
|
-
const isPropertyWritable = Object.getOwnPropertyDescriptor(info, key)?.writable ?? true;
|
|
57786
|
-
if (isPropertyWritable && newValue !== value) {
|
|
57787
|
-
info[key] = newValue;
|
|
57788
|
-
}
|
|
57789
|
-
});
|
|
57790
|
-
return info;
|
|
57791
|
-
}
|
|
57792
|
-
function transformAxiosError(info) {
|
|
57793
|
-
Object.entries(info).forEach(([key, value]) => {
|
|
57794
|
-
if (typeof value === "object" && value?.name === "AxiosError") {
|
|
57795
|
-
info[key] = formatAxiosError(value);
|
|
57796
|
-
}
|
|
57797
|
-
});
|
|
57798
|
-
return info;
|
|
57799
|
-
}
|
|
57800
|
-
function formatAxiosError(error48) {
|
|
57801
|
-
if (!isRecord(error48) || error48.name !== "AxiosError") {
|
|
57802
|
-
return error48;
|
|
57803
|
-
}
|
|
57804
|
-
const request = isRecord(error48.config) ? error48.config : void 0;
|
|
57805
|
-
const response = isRecord(error48.response) ? error48.response : void 0;
|
|
57806
|
-
return {
|
|
57807
|
-
name: error48.name,
|
|
57808
|
-
message: error48.message,
|
|
57809
|
-
code: error48.code,
|
|
57810
|
-
request: {
|
|
57811
|
-
method: request?.method,
|
|
57812
|
-
url: request?.url,
|
|
57813
|
-
baseURL: request?.baseURL,
|
|
57814
|
-
params: request?.params,
|
|
57815
|
-
headers: redactHeaders({ headers: request?.headers }),
|
|
57816
|
-
"axios-retry": request?.["axios-retry"]
|
|
57817
|
-
},
|
|
57818
|
-
response: {
|
|
57819
|
-
status: response?.status,
|
|
57820
|
-
statusText: response?.statusText,
|
|
57821
|
-
headers: redactHeaders({ headers: response?.headers }),
|
|
57822
|
-
data: response?.data
|
|
57823
|
-
}
|
|
57824
|
-
};
|
|
57825
|
-
}
|
|
57826
|
-
function redactHeaders({ headers }) {
|
|
57827
|
-
if (!isRecord(headers)) {
|
|
57828
|
-
return headers;
|
|
57829
|
-
}
|
|
57830
|
-
return Object.fromEntries(Object.entries(headers).map(([headerKey, headerValue]) => [
|
|
57831
|
-
headerKey,
|
|
57832
|
-
REDACTED_HEADER_KEY_PATTERN.test(headerKey) ? "<redacted>" : headerValue
|
|
57833
|
-
]));
|
|
57834
|
-
}
|
|
57835
|
-
function isRecord(value) {
|
|
57836
|
-
return typeof value === "object" && value !== null && !Array.isArray(value);
|
|
57837
|
-
}
|
|
57838
|
-
|
|
57839
|
-
// ../hyperline-monitoring/build/logger/formatting/routePath.js
|
|
57840
|
-
function transformUrlIntoRoutePath({ params, originalUrl }) {
|
|
57841
|
-
let routePath = originalUrl;
|
|
57842
|
-
for (const [param, value] of Object.entries(params ?? {})) {
|
|
57843
|
-
const strValue = Array.isArray(value) ? value.join("/") : value;
|
|
57844
|
-
routePath = routePath.replace(strValue, `:${param}`);
|
|
57845
|
-
}
|
|
57846
|
-
return routePath.split("?")[0] ?? routePath;
|
|
57847
|
-
}
|
|
57848
|
-
|
|
57849
|
-
// ../hyperline-monitoring/build/logger/formatting/http.js
|
|
57850
|
-
function logHttpRequest(logger2, request, extra) {
|
|
57851
|
-
const { message, metadata } = transform2(request);
|
|
57852
|
-
logger2.info(`HTTP REQ - ${message} ${extra?.postfix || ""}`, {
|
|
57853
|
-
...metadata,
|
|
57854
|
-
...extra?.metadata ?? {}
|
|
57855
|
-
});
|
|
57856
|
-
}
|
|
57857
|
-
function logHttpResponse(logger2, response, responseTime, extra) {
|
|
57858
|
-
const { request, statusCode, responseBody, responseHeaders } = response;
|
|
57859
|
-
const { message, metadata } = transform2(request);
|
|
57860
|
-
const readableResponseTime = responseTime ? getReadableTime(responseTime) : void 0;
|
|
57861
|
-
const responseMetadata = {
|
|
57862
|
-
statusCode,
|
|
57863
|
-
responseTime,
|
|
57864
|
-
responseBody,
|
|
57865
|
-
// Redacted so secrets (authorization/cookie/token/…) never reach the logs
|
|
57866
|
-
// while diagnostic headers (e.g. rate-limit headers on a 429) stay visible.
|
|
57867
|
-
responseHeaders: responseHeaders === void 0 ? void 0 : redactHeaders({ headers: responseHeaders })
|
|
57868
|
-
};
|
|
57869
|
-
logger2.info(`HTTP RES - ${message} ${statusCode} ${readableResponseTime || ""} ${extra?.postfix || ""}`, {
|
|
57870
|
-
...metadata,
|
|
57871
|
-
...responseMetadata,
|
|
57872
|
-
...extra?.metadata ?? {}
|
|
57873
|
-
});
|
|
57874
|
-
}
|
|
57875
|
-
function transform2(request) {
|
|
57876
|
-
const method = request.method.toUpperCase();
|
|
57877
|
-
const message = `${method} ${request.originalUrl}`;
|
|
57878
|
-
const metadata = {};
|
|
57879
|
-
metadata.method = method;
|
|
57880
|
-
metadata.url = request.url;
|
|
57881
|
-
metadata.path = request.path;
|
|
57882
|
-
metadata.hostname = request.hostname;
|
|
57883
|
-
metadata.originalUrl = request.originalUrl;
|
|
57884
|
-
metadata.requestBody = request.body;
|
|
57885
|
-
metadata.routePath = transformUrlIntoRoutePath(request);
|
|
57886
|
-
metadata.apiKeyEnd = request.headers["authorization"]?.slice(-6);
|
|
57887
|
-
return { message, metadata };
|
|
57888
|
-
}
|
|
57889
|
-
function getReadableTime(time3) {
|
|
57890
|
-
return time3 < 1e4 ? `${time3}ms` : `${Math.round(time3 / 1e3)}s`;
|
|
57891
|
-
}
|
|
57892
|
-
|
|
57893
|
-
// ../hyperline-monitoring/build/logger/utils/network.js
|
|
57894
|
-
import * as os2 from "node:os";
|
|
57895
|
-
function getIpAddress() {
|
|
57896
|
-
const interfaces = Object.values(os2.networkInterfaces()).flat().filter((networkInterface) => {
|
|
57897
|
-
return networkInterface !== void 0;
|
|
57898
|
-
});
|
|
57899
|
-
const mainInterface = interfaces.find(({ family, internal }) => family === "IPv4" && internal === false);
|
|
57900
|
-
return mainInterface ? mainInterface.address : null;
|
|
57901
|
-
}
|
|
57902
|
-
|
|
57903
|
-
// ../hyperline-monitoring/build/logger/logger.js
|
|
57904
|
-
function buildLoggerFactory({ config: config4, context }) {
|
|
57905
|
-
const defaultMeta = {
|
|
57906
|
-
env: context.env,
|
|
57907
|
-
service: context.service,
|
|
57908
|
-
version: context.version,
|
|
57909
|
-
pid: process.pid,
|
|
57910
|
-
ppid: process.ppid,
|
|
57911
|
-
host: getIpAddress()
|
|
57912
|
-
};
|
|
57913
|
-
const transports2 = [];
|
|
57914
|
-
if (config4.enableConsoleTransport) {
|
|
57915
|
-
transports2.push(createTransportConsole());
|
|
57916
|
-
}
|
|
57917
|
-
if (config4.enableStdoutTransport) {
|
|
57918
|
-
transports2.push(createTransportStdout());
|
|
57919
|
-
}
|
|
57920
|
-
if (Object.values(config4).every((value) => !value)) {
|
|
57921
|
-
transports2.push(createTransportSilent());
|
|
57922
|
-
}
|
|
57923
|
-
for (const transport of transports2) {
|
|
57924
|
-
transport.on("error", (error48) => {
|
|
57925
|
-
console.error(`Unable to log to transport=${transport.name}: ${error48.message} ${JSON.stringify(error48)}`);
|
|
57926
|
-
});
|
|
57927
|
-
}
|
|
57928
|
-
const internalLogger = winston.createLogger({
|
|
57929
|
-
transports: transports2,
|
|
57930
|
-
defaultMeta,
|
|
57931
|
-
format: winston.format.combine(winston.format.splat(), winston.format(addMetadata({ getCorrelationId, getExecutionContext }))(), winston.format(transformErrorEnrich)({ depth: 5 }), winston.format(transformPrune)(), winston.format(transformAxiosError)(), winston.format.timestamp()),
|
|
57932
|
-
exitOnError: false
|
|
57933
|
-
});
|
|
57934
|
-
function createLogger3({ serviceName }) {
|
|
57935
|
-
const logger2 = internalLogger.child({ subService: serviceName });
|
|
57936
|
-
return {
|
|
57937
|
-
debug: bindLogger(logger2, "debug"),
|
|
57938
|
-
info: bindLogger(logger2, "info"),
|
|
57939
|
-
warn: bindLogger(logger2, "warn"),
|
|
57940
|
-
error: bindLogger(logger2, "error"),
|
|
57941
|
-
on: logger2.on.bind(logger2),
|
|
57942
|
-
end: logger2.end.bind(logger2)
|
|
57943
|
-
};
|
|
57944
|
-
}
|
|
57945
|
-
return {
|
|
57946
|
-
createLogger: createLogger3
|
|
57947
|
-
};
|
|
57948
|
-
}
|
|
57949
|
-
function bindLogger(logger2, severity) {
|
|
57950
|
-
return (message, data) => {
|
|
57951
|
-
logger2[severity].bind(logger2)(message, preserveReservedKeys(data));
|
|
57952
|
-
};
|
|
57953
|
-
}
|
|
57954
|
-
function preserveReservedKeys(data) {
|
|
57955
|
-
if (!data)
|
|
57956
|
-
return;
|
|
57957
|
-
return Object.fromEntries(Object.entries(data).map(([key, value]) => {
|
|
57958
|
-
let finalKey = key;
|
|
57959
|
-
if (key === "status") {
|
|
57960
|
-
finalKey = "_status";
|
|
57961
|
-
} else if (key === "service") {
|
|
57962
|
-
finalKey = "_service";
|
|
57963
|
-
}
|
|
57964
|
-
return [finalKey, value];
|
|
57965
|
-
}));
|
|
57966
|
-
}
|
|
57967
|
-
var verboseLevels = ["warn", "error", "debug"];
|
|
57968
|
-
function createTransportConsole() {
|
|
57969
|
-
return new winston.transports.Console({
|
|
57970
|
-
level: "debug",
|
|
57971
|
-
handleExceptions: true,
|
|
57972
|
-
format: winston.format.combine(winston.format(jsonFormat)(), winston.format((info) => {
|
|
57973
|
-
const { level, message, ...others } = info;
|
|
57974
|
-
const parts = [message];
|
|
57975
|
-
if (Object.keys(others).length > 0 && verboseLevels.includes(level)) {
|
|
57976
|
-
const rawOthers = JSON.parse(prune2(others));
|
|
57977
|
-
parts.push(util.inspect(rawOthers, false, 4, true));
|
|
57978
|
-
}
|
|
57979
|
-
info.message = parts.filter((part) => !!part).join("\n");
|
|
57980
|
-
return info;
|
|
57981
|
-
})(), winston.format.colorize(), winston.format.printf(({ timestamp, level, message, service = "?" }) => {
|
|
57982
|
-
const result = `[${timestamp}] ${level} ${service}: ${message}`;
|
|
57983
|
-
return result.replace(/\\n/g, "\n");
|
|
57984
|
-
}))
|
|
57985
|
-
});
|
|
57986
|
-
}
|
|
57987
|
-
function createTransportStdout() {
|
|
57988
|
-
return new winston.transports.Console({
|
|
57989
|
-
level: "debug",
|
|
57990
|
-
handleExceptions: true,
|
|
57991
|
-
format: winston.format.combine(winston.format(jsonFormat)(), winston.format.timestamp(), winston.format.json())
|
|
57992
|
-
});
|
|
57993
|
-
}
|
|
57994
|
-
function createTransportSilent() {
|
|
57995
|
-
return new winston.transports.Console({
|
|
57996
|
-
silent: true
|
|
57997
|
-
});
|
|
57998
|
-
}
|
|
57999
|
-
|
|
58000
|
-
// ../hyperline-monitoring/build/logger/instance.js
|
|
58001
|
-
var loggerFactory = buildLoggerFactory({
|
|
58002
|
-
config: {
|
|
58003
|
-
enableConsoleTransport: config2.LOGGER_CONSOLE_ENABLED ?? false,
|
|
58004
|
-
enableStdoutTransport: config2.LOGGER_STDOUT_ENABLED ?? false
|
|
58005
|
-
},
|
|
58006
|
-
context: {
|
|
58007
|
-
env: config2.NODE_ENV,
|
|
58008
|
-
service: config2.DD_SERVICE ?? "api",
|
|
58009
|
-
version: config2.APP_VERSION
|
|
58010
|
-
}
|
|
58011
|
-
});
|
|
58012
|
-
var createLogger2 = loggerFactory.createLogger;
|
|
58013
|
-
var logger = loggerFactory.createLogger({ serviceName: "default" });
|
|
58014
|
-
|
|
58015
|
-
// ../hyperline-monitoring/build/tracing/tracing.js
|
|
58016
|
-
import tracer from "dd-trace";
|
|
58017
|
-
|
|
58018
|
-
// ../hyperline-lib/build/utils/aws.js
|
|
58019
|
-
import { GetBucketLocationCommand, S3Client } from "@aws-sdk/client-s3";
|
|
58020
|
-
import { GetCallerIdentityCommand, STSClient } from "@aws-sdk/client-sts";
|
|
58021
|
-
|
|
58022
|
-
// ../hyperline-lib/build/utils/config/countries.js
|
|
58023
|
-
var countriesAndCurrencies = (
|
|
58024
|
-
// 20221115164054
|
|
58025
|
-
// https://gist.githubusercontent.com/tiagodealmeida/0b97ccf117252d742dddf098bc6cc58a/raw/f621703926fc13be4f618fb4a058d0454177cceb/countries.json
|
|
58026
|
-
[
|
|
58027
|
-
{
|
|
58028
|
-
countryCode: "AD",
|
|
58029
|
-
countryName: "Andorra",
|
|
58030
|
-
currencyCode: "EUR",
|
|
58031
|
-
population: "84000",
|
|
58032
|
-
capital: "Andorra la Vella",
|
|
58033
|
-
continentName: "Europe"
|
|
57675
|
+
// ../hyperline-lib/build/utils/config/countries.js
|
|
57676
|
+
var countriesAndCurrencies = (
|
|
57677
|
+
// 20221115164054
|
|
57678
|
+
// https://gist.githubusercontent.com/tiagodealmeida/0b97ccf117252d742dddf098bc6cc58a/raw/f621703926fc13be4f618fb4a058d0454177cceb/countries.json
|
|
57679
|
+
[
|
|
57680
|
+
{
|
|
57681
|
+
countryCode: "AD",
|
|
57682
|
+
countryName: "Andorra",
|
|
57683
|
+
currencyCode: "EUR",
|
|
57684
|
+
population: "84000",
|
|
57685
|
+
capital: "Andorra la Vella",
|
|
57686
|
+
continentName: "Europe"
|
|
58034
57687
|
},
|
|
58035
57688
|
{
|
|
58036
57689
|
countryCode: "AE",
|
|
@@ -60064,8 +59717,492 @@ var countriesAndCurrencies = (
|
|
|
60064
59717
|
capital: "Harare",
|
|
60065
59718
|
continentName: "Africa"
|
|
60066
59719
|
}
|
|
60067
|
-
]
|
|
60068
|
-
);
|
|
59720
|
+
]
|
|
59721
|
+
);
|
|
59722
|
+
var countryCodesInTable = new Set(countriesAndCurrencies.map(({ countryCode }) => countryCode));
|
|
59723
|
+
function isCountryCodeInTable(countryCode) {
|
|
59724
|
+
return countryCodesInTable.has(countryCode);
|
|
59725
|
+
}
|
|
59726
|
+
function foldCountryName(countryName) {
|
|
59727
|
+
return countryName.normalize("NFD").replace(new RegExp("\\p{Diacritic}", "gu"), "").toLowerCase();
|
|
59728
|
+
}
|
|
59729
|
+
function getCountryCodeFromName(countryName) {
|
|
59730
|
+
return countriesAndCurrencies.find((c) => foldCountryName(c.countryName) === foldCountryName(countryName))?.countryCode;
|
|
59731
|
+
}
|
|
59732
|
+
|
|
59733
|
+
// ../hyperline-lib/build/utils/countries.js
|
|
59734
|
+
function isValidCountryCode(countryCode) {
|
|
59735
|
+
return isCountryCodeInTable(countryCode);
|
|
59736
|
+
}
|
|
59737
|
+
var NON_ISO_COUNTRY_CODE_ALIASES = /* @__PURE__ */ new Map([
|
|
59738
|
+
["XI", "GB"],
|
|
59739
|
+
["UK", "GB"],
|
|
59740
|
+
["USA", "US"],
|
|
59741
|
+
["FRA", "FR"]
|
|
59742
|
+
]);
|
|
59743
|
+
var COUNTRY_NAME_ALIASES = /* @__PURE__ */ new Map([
|
|
59744
|
+
["czech republic", "CZ"],
|
|
59745
|
+
["cote d'ivoire", "CI"]
|
|
59746
|
+
]);
|
|
59747
|
+
function normalizeProviderCountry({ country }) {
|
|
59748
|
+
const trimmedCountry = country?.trim();
|
|
59749
|
+
if (!trimmedCountry) {
|
|
59750
|
+
return null;
|
|
59751
|
+
}
|
|
59752
|
+
const upperCasedCountry = trimmedCountry.toUpperCase();
|
|
59753
|
+
const aliasedCountryCode = NON_ISO_COUNTRY_CODE_ALIASES.get(upperCasedCountry) ?? upperCasedCountry;
|
|
59754
|
+
if (isValidCountryCode(aliasedCountryCode)) {
|
|
59755
|
+
return aliasedCountryCode;
|
|
59756
|
+
}
|
|
59757
|
+
return getCountryCodeFromName(trimmedCountry) ?? COUNTRY_NAME_ALIASES.get(foldCountryName(trimmedCountry)) ?? null;
|
|
59758
|
+
}
|
|
59759
|
+
|
|
59760
|
+
// ../hyperline-lib/build/http/dto/country.js
|
|
59761
|
+
var countryCodes = countriesAndCurrencies.map(({ countryCode }) => countryCode);
|
|
59762
|
+
var CountrySchema = external_exports.enum(countryCodes).openapi({
|
|
59763
|
+
description: "Two-letter country code in ISO format. See [ISO 3166-1 alpha-2](https://en.wikipedia.org/wiki/ISO_3166-1_alpha-2).",
|
|
59764
|
+
example: "FR"
|
|
59765
|
+
});
|
|
59766
|
+
var NormalizedCountrySchema = external_exports.preprocess((value) => typeof value === "string" ? normalizeProviderCountry({ country: value }) : value, CountrySchema.nullable());
|
|
59767
|
+
|
|
59768
|
+
// ../hyperline-lib/build/http/dto/currency.js
|
|
59769
|
+
var currencyCodes = Array.from(new Set(countriesAndCurrencies.map(({ currencyCode }) => currencyCode).filter((currencyCode) => Boolean(currencyCode))));
|
|
59770
|
+
var CurrencySchema = external_exports.enum(currencyCodes).openapi({
|
|
59771
|
+
description: "Currency code. See [ISO 4217](https://en.wikipedia.org/wiki/ISO_4217#List_of_ISO_4217_currency_codes).",
|
|
59772
|
+
example: "EUR"
|
|
59773
|
+
});
|
|
59774
|
+
|
|
59775
|
+
// ../hyperline-lib/build/http/dto/dateTime.js
|
|
59776
|
+
var dateTimeDescription = "UTC date time string in the [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) format.";
|
|
59777
|
+
var DateTimeSchema = external_exports.iso.datetime({
|
|
59778
|
+
offset: false
|
|
59779
|
+
// only UTC date time
|
|
59780
|
+
}).openapi({
|
|
59781
|
+
description: dateTimeDescription,
|
|
59782
|
+
example: "2024-12-20T16:04:11Z"
|
|
59783
|
+
});
|
|
59784
|
+
|
|
59785
|
+
// ../hyperline-lib/build/http/dto/domain.js
|
|
59786
|
+
var DomainSchema = external_exports.string().trim().toLowerCase().regex(/^(?!:\/\/)(?=.{1,253}$)(?!-)([a-z0-9-]{1,63}\.)+[a-z]{2,63}$/, "Invalid domain").openapi({
|
|
59787
|
+
description: "Domain name.",
|
|
59788
|
+
example: "acme.com"
|
|
59789
|
+
});
|
|
59790
|
+
|
|
59791
|
+
// ../hyperline-lib/build/http/dto/error.js
|
|
59792
|
+
var ErrorSchema = external_exports.object({
|
|
59793
|
+
message: external_exports.string()
|
|
59794
|
+
});
|
|
59795
|
+
|
|
59796
|
+
// ../hyperline-lib/build/http/dto/pagination.js
|
|
59797
|
+
var PublicPaginationParams = {
|
|
59798
|
+
take: zod_default.coerce.number().nonnegative().max(100).optional().default(50),
|
|
59799
|
+
skip: zod_default.coerce.number().nonnegative().optional().default(0)
|
|
59800
|
+
};
|
|
59801
|
+
var PublicPaginationSchema = zod_default.object(PublicPaginationParams);
|
|
59802
|
+
var PublicCursorPaginationParams = {
|
|
59803
|
+
limit: zod_default.coerce.number().positive().max(100).optional().default(50).openapi({
|
|
59804
|
+
description: "Maximum number of items to return (1-100).",
|
|
59805
|
+
example: 50
|
|
59806
|
+
}),
|
|
59807
|
+
cursor: zod_default.string().optional().openapi({
|
|
59808
|
+
description: "Opaque cursor returned in the previous response's `next_cursor`. Omit to fetch the first page."
|
|
59809
|
+
}),
|
|
59810
|
+
include_total: BooleanSchema.optional().default(false).openapi({
|
|
59811
|
+
description: "Set to `true` to include `total` in the response.",
|
|
59812
|
+
example: false
|
|
59813
|
+
})
|
|
59814
|
+
};
|
|
59815
|
+
var PublicCursorPaginationSchema = zod_default.object(PublicCursorPaginationParams);
|
|
59816
|
+
|
|
59817
|
+
// ../hyperline-monitoring/build/context/context.js
|
|
59818
|
+
import { AsyncLocalStorage } from "node:async_hooks";
|
|
59819
|
+
var executionContextStorage = new AsyncLocalStorage();
|
|
59820
|
+
function getExecutionContext() {
|
|
59821
|
+
return executionContextStorage.getStore();
|
|
59822
|
+
}
|
|
59823
|
+
|
|
59824
|
+
// ../hyperline-monitoring/build/context/correlationId.js
|
|
59825
|
+
import { AsyncLocalStorage as AsyncLocalStorage2 } from "node:async_hooks";
|
|
59826
|
+
var correlationIdStorage = new AsyncLocalStorage2();
|
|
59827
|
+
function getCorrelationId() {
|
|
59828
|
+
return correlationIdStorage.getStore();
|
|
59829
|
+
}
|
|
59830
|
+
|
|
59831
|
+
// ../hyperline-config/build/index.js
|
|
59832
|
+
import "dotenv/config";
|
|
59833
|
+
import * as stackTraceParser from "stacktrace-parser";
|
|
59834
|
+
function coerceBoolean() {
|
|
59835
|
+
return external_exports.any().refine((value) => ["true", "false"].includes(value), {
|
|
59836
|
+
message: "Expected boolean"
|
|
59837
|
+
}).transform((value) => (
|
|
59838
|
+
// biome-ignore lint/complexity/noUselessTernary: ignore
|
|
59839
|
+
value === "true" ? true : false
|
|
59840
|
+
));
|
|
59841
|
+
}
|
|
59842
|
+
var types = {
|
|
59843
|
+
string: external_exports.coerce.string,
|
|
59844
|
+
number: external_exports.coerce.number,
|
|
59845
|
+
boolean: coerceBoolean,
|
|
59846
|
+
enum: external_exports.enum
|
|
59847
|
+
};
|
|
59848
|
+
function getConfig(schema, testValues) {
|
|
59849
|
+
const validator = external_exports.object(Object.fromEntries(Object.entries(schema).map(([key, zodType]) => {
|
|
59850
|
+
if (zodType instanceof ZodOptional) {
|
|
59851
|
+
return [key, external_exports.string().optional()];
|
|
59852
|
+
}
|
|
59853
|
+
return [key, external_exports.string()];
|
|
59854
|
+
})));
|
|
59855
|
+
const processEnv = process.env;
|
|
59856
|
+
const isTestMode = processEnv.NODE_ENV === "test";
|
|
59857
|
+
const envVariables = {
|
|
59858
|
+
...processEnv,
|
|
59859
|
+
...isTestMode && testValues ? Object.fromEntries(Object.entries(testValues).map(([key, value]) => [key, String(value)])) : {}
|
|
59860
|
+
};
|
|
59861
|
+
const packageName = envVariables.npm_package_name;
|
|
59862
|
+
const parseProcessEnvResult = validator.safeParse(envVariables);
|
|
59863
|
+
if (!parseProcessEnvResult.success) {
|
|
59864
|
+
const parsedStackTrace = stackTraceParser.parse(parseProcessEnvResult.error.stack ?? "");
|
|
59865
|
+
const getConfigCallLine = parsedStackTrace.find((line) => {
|
|
59866
|
+
return !line.file?.includes("hyperline-config") && (line.file?.includes("apps/") || line.file?.includes("core/") || line.file?.includes("packages/"));
|
|
59867
|
+
});
|
|
59868
|
+
const callerFile = getConfigCallLine?.file;
|
|
59869
|
+
console.error(`Invalid environment variables for service \`${packageName}\`: \`${callerFile}\``);
|
|
59870
|
+
console.error(parseProcessEnvResult.error.format());
|
|
59871
|
+
process.exit(1);
|
|
59872
|
+
}
|
|
59873
|
+
const coercion = external_exports.object(schema);
|
|
59874
|
+
return coercion.parse(parseProcessEnvResult.data);
|
|
59875
|
+
}
|
|
59876
|
+
|
|
59877
|
+
// ../hyperline-monitoring/build/config.js
|
|
59878
|
+
var config2 = getConfig({
|
|
59879
|
+
// config
|
|
59880
|
+
APP_VERSION: types.string().optional(),
|
|
59881
|
+
// Deployment environment for log tagging, when it cannot be read off
|
|
59882
|
+
// NODE_ENV. Set only by the PDF render worker pools, which must run with
|
|
59883
|
+
// NODE_ENV="production" to get the production React build regardless of which
|
|
59884
|
+
// environment the pod is actually in (see core/invoicing/services/pdf/index.ts).
|
|
59885
|
+
// Unset everywhere else, so the NODE_ENV fallback keeps current behaviour.
|
|
59886
|
+
APP_ENV: types.string().optional(),
|
|
59887
|
+
DD_SERVICE: types.string().optional(),
|
|
59888
|
+
LOGGER_CONSOLE_ENABLED: types.boolean().optional(),
|
|
59889
|
+
LOGGER_STDOUT_ENABLED: types.boolean().optional(),
|
|
59890
|
+
NODE_ENV: types.enum(["local", "test", "staging", "sandbox", "production"]),
|
|
59891
|
+
EVENT_LOOP_MONITORING_ENABLED: types.boolean().optional(),
|
|
59892
|
+
MEMORY_MONITORING_ENABLED: types.boolean().optional(),
|
|
59893
|
+
MEMORY_MONITORING_INTERVAL_MS: types.number().optional()
|
|
59894
|
+
// secrets
|
|
59895
|
+
}, {
|
|
59896
|
+
APP_VERSION: void 0,
|
|
59897
|
+
APP_ENV: void 0,
|
|
59898
|
+
DD_SERVICE: void 0,
|
|
59899
|
+
LOGGER_CONSOLE_ENABLED: false,
|
|
59900
|
+
LOGGER_STDOUT_ENABLED: false,
|
|
59901
|
+
EVENT_LOOP_MONITORING_ENABLED: false,
|
|
59902
|
+
MEMORY_MONITORING_ENABLED: false,
|
|
59903
|
+
MEMORY_MONITORING_INTERVAL_MS: 3e4,
|
|
59904
|
+
NODE_ENV: "test"
|
|
59905
|
+
});
|
|
59906
|
+
|
|
59907
|
+
// ../hyperline-monitoring/build/logger/logger.js
|
|
59908
|
+
import * as util from "node:util";
|
|
59909
|
+
import prune2 from "json-prune";
|
|
59910
|
+
import * as winston from "winston";
|
|
59911
|
+
|
|
59912
|
+
// ../hyperline-monitoring/build/logger/formatting/format.js
|
|
59913
|
+
import prune from "json-prune";
|
|
59914
|
+
var REDACTED_HEADER_KEY_PATTERN = /authorization|authenticate|cookie|secret|token|credential|signature|jwt|api[_-]?key|access[_-]?token|refresh[_-]?token|private[_-]?key/i;
|
|
59915
|
+
function jsonFormat(info) {
|
|
59916
|
+
const prunedInfo = JSON.parse(prune(info));
|
|
59917
|
+
for (const [key, value] of Object.entries(prunedInfo)) {
|
|
59918
|
+
info[key] = value;
|
|
59919
|
+
}
|
|
59920
|
+
return info;
|
|
59921
|
+
}
|
|
59922
|
+
function addMetadata({ getCorrelationId: getCorrelationId2, getExecutionContext: getExecutionContext2 }) {
|
|
59923
|
+
return (info) => {
|
|
59924
|
+
const correlationId = getCorrelationId2();
|
|
59925
|
+
const executionContext = getExecutionContext2();
|
|
59926
|
+
let traceContext;
|
|
59927
|
+
return {
|
|
59928
|
+
...info,
|
|
59929
|
+
...executionContext ?? {},
|
|
59930
|
+
...traceContext ?? {},
|
|
59931
|
+
correlationId
|
|
59932
|
+
};
|
|
59933
|
+
};
|
|
59934
|
+
}
|
|
59935
|
+
function transformErrorEnrich(info, { depth }) {
|
|
59936
|
+
if (depth <= 0) {
|
|
59937
|
+
return info;
|
|
59938
|
+
}
|
|
59939
|
+
Object.entries(info).forEach(([key, value]) => {
|
|
59940
|
+
let newValue = value;
|
|
59941
|
+
if (newValue instanceof Error) {
|
|
59942
|
+
newValue = {
|
|
59943
|
+
...newValue,
|
|
59944
|
+
// Copy error properties manually because they're not enumerable
|
|
59945
|
+
level: newValue.level,
|
|
59946
|
+
stack: newValue.stack,
|
|
59947
|
+
message: newValue.message,
|
|
59948
|
+
name: newValue.name
|
|
59949
|
+
};
|
|
59950
|
+
}
|
|
59951
|
+
if (newValue instanceof Object) {
|
|
59952
|
+
newValue = transformErrorEnrich(newValue, { depth: depth - 1 });
|
|
59953
|
+
}
|
|
59954
|
+
const isPropertyWritable = Object.getOwnPropertyDescriptor(info, key)?.writable ?? true;
|
|
59955
|
+
if (isPropertyWritable && newValue !== value) {
|
|
59956
|
+
info[key] = newValue;
|
|
59957
|
+
}
|
|
59958
|
+
});
|
|
59959
|
+
return info;
|
|
59960
|
+
}
|
|
59961
|
+
function transformPrune(info) {
|
|
59962
|
+
Object.entries(info).forEach(([key, value]) => {
|
|
59963
|
+
if (typeof value === "function") {
|
|
59964
|
+
return;
|
|
59965
|
+
}
|
|
59966
|
+
const newValue = value instanceof Object ? JSON.parse(prune(value, { depthDecr: 6 })) : value;
|
|
59967
|
+
const isPropertyWritable = Object.getOwnPropertyDescriptor(info, key)?.writable ?? true;
|
|
59968
|
+
if (isPropertyWritable && newValue !== value) {
|
|
59969
|
+
info[key] = newValue;
|
|
59970
|
+
}
|
|
59971
|
+
});
|
|
59972
|
+
return info;
|
|
59973
|
+
}
|
|
59974
|
+
function transformAxiosError(info) {
|
|
59975
|
+
Object.entries(info).forEach(([key, value]) => {
|
|
59976
|
+
if (typeof value === "object" && value?.name === "AxiosError") {
|
|
59977
|
+
info[key] = formatAxiosError(value);
|
|
59978
|
+
}
|
|
59979
|
+
});
|
|
59980
|
+
return info;
|
|
59981
|
+
}
|
|
59982
|
+
function formatAxiosError(error48) {
|
|
59983
|
+
if (!isRecord(error48) || error48.name !== "AxiosError") {
|
|
59984
|
+
return error48;
|
|
59985
|
+
}
|
|
59986
|
+
const request = isRecord(error48.config) ? error48.config : void 0;
|
|
59987
|
+
const response = isRecord(error48.response) ? error48.response : void 0;
|
|
59988
|
+
return {
|
|
59989
|
+
name: error48.name,
|
|
59990
|
+
message: error48.message,
|
|
59991
|
+
code: error48.code,
|
|
59992
|
+
request: {
|
|
59993
|
+
method: request?.method,
|
|
59994
|
+
url: request?.url,
|
|
59995
|
+
baseURL: request?.baseURL,
|
|
59996
|
+
params: request?.params,
|
|
59997
|
+
headers: redactHeaders({ headers: request?.headers }),
|
|
59998
|
+
"axios-retry": request?.["axios-retry"]
|
|
59999
|
+
},
|
|
60000
|
+
response: {
|
|
60001
|
+
status: response?.status,
|
|
60002
|
+
statusText: response?.statusText,
|
|
60003
|
+
headers: redactHeaders({ headers: response?.headers }),
|
|
60004
|
+
data: response?.data
|
|
60005
|
+
}
|
|
60006
|
+
};
|
|
60007
|
+
}
|
|
60008
|
+
function redactHeaders({ headers }) {
|
|
60009
|
+
if (!isRecord(headers)) {
|
|
60010
|
+
return headers;
|
|
60011
|
+
}
|
|
60012
|
+
return Object.fromEntries(Object.entries(headers).map(([headerKey, headerValue]) => [
|
|
60013
|
+
headerKey,
|
|
60014
|
+
REDACTED_HEADER_KEY_PATTERN.test(headerKey) ? "<redacted>" : headerValue
|
|
60015
|
+
]));
|
|
60016
|
+
}
|
|
60017
|
+
function isRecord(value) {
|
|
60018
|
+
return typeof value === "object" && value !== null && !Array.isArray(value);
|
|
60019
|
+
}
|
|
60020
|
+
|
|
60021
|
+
// ../hyperline-monitoring/build/logger/formatting/routePath.js
|
|
60022
|
+
function transformUrlIntoRoutePath({ params, originalUrl }) {
|
|
60023
|
+
let routePath = originalUrl;
|
|
60024
|
+
for (const [param, value] of Object.entries(params ?? {})) {
|
|
60025
|
+
const strValue = Array.isArray(value) ? value.join("/") : value;
|
|
60026
|
+
routePath = routePath.replace(strValue, `:${param}`);
|
|
60027
|
+
}
|
|
60028
|
+
return routePath.split("?")[0] ?? routePath;
|
|
60029
|
+
}
|
|
60030
|
+
|
|
60031
|
+
// ../hyperline-monitoring/build/logger/formatting/http.js
|
|
60032
|
+
function logHttpRequest(logger2, request, extra) {
|
|
60033
|
+
const { message, metadata } = transform2(request);
|
|
60034
|
+
logger2.info(`HTTP REQ - ${message} ${extra?.postfix || ""}`, {
|
|
60035
|
+
...metadata,
|
|
60036
|
+
...extra?.metadata ?? {}
|
|
60037
|
+
});
|
|
60038
|
+
}
|
|
60039
|
+
function logHttpResponse(logger2, response, responseTime, extra) {
|
|
60040
|
+
const { request, statusCode, responseBody, responseHeaders } = response;
|
|
60041
|
+
const { message, metadata } = transform2(request);
|
|
60042
|
+
const readableResponseTime = responseTime ? getReadableTime(responseTime) : void 0;
|
|
60043
|
+
const responseMetadata = {
|
|
60044
|
+
statusCode,
|
|
60045
|
+
responseTime,
|
|
60046
|
+
responseBody,
|
|
60047
|
+
// Redacted so secrets (authorization/cookie/token/…) never reach the logs
|
|
60048
|
+
// while diagnostic headers (e.g. rate-limit headers on a 429) stay visible.
|
|
60049
|
+
responseHeaders: responseHeaders === void 0 ? void 0 : redactHeaders({ headers: responseHeaders })
|
|
60050
|
+
};
|
|
60051
|
+
logger2.info(`HTTP RES - ${message} ${statusCode} ${readableResponseTime || ""} ${extra?.postfix || ""}`, {
|
|
60052
|
+
...metadata,
|
|
60053
|
+
...responseMetadata,
|
|
60054
|
+
...extra?.metadata ?? {}
|
|
60055
|
+
});
|
|
60056
|
+
}
|
|
60057
|
+
function transform2(request) {
|
|
60058
|
+
const method = request.method.toUpperCase();
|
|
60059
|
+
const message = `${method} ${request.originalUrl}`;
|
|
60060
|
+
const metadata = {};
|
|
60061
|
+
metadata.method = method;
|
|
60062
|
+
metadata.url = request.url;
|
|
60063
|
+
metadata.path = request.path;
|
|
60064
|
+
metadata.hostname = request.hostname;
|
|
60065
|
+
metadata.originalUrl = request.originalUrl;
|
|
60066
|
+
metadata.requestBody = request.body;
|
|
60067
|
+
metadata.routePath = transformUrlIntoRoutePath(request);
|
|
60068
|
+
metadata.apiKeyEnd = request.headers["authorization"]?.slice(-6);
|
|
60069
|
+
return { message, metadata };
|
|
60070
|
+
}
|
|
60071
|
+
function getReadableTime(time3) {
|
|
60072
|
+
return time3 < 1e4 ? `${time3}ms` : `${Math.round(time3 / 1e3)}s`;
|
|
60073
|
+
}
|
|
60074
|
+
|
|
60075
|
+
// ../hyperline-monitoring/build/logger/utils/network.js
|
|
60076
|
+
import * as os2 from "node:os";
|
|
60077
|
+
function getIpAddress() {
|
|
60078
|
+
const interfaces = Object.values(os2.networkInterfaces()).flat().filter((networkInterface) => {
|
|
60079
|
+
return networkInterface !== void 0;
|
|
60080
|
+
});
|
|
60081
|
+
const mainInterface = interfaces.find(({ family, internal }) => family === "IPv4" && internal === false);
|
|
60082
|
+
return mainInterface ? mainInterface.address : null;
|
|
60083
|
+
}
|
|
60084
|
+
|
|
60085
|
+
// ../hyperline-monitoring/build/logger/logger.js
|
|
60086
|
+
function buildLoggerFactory({ config: config4, context }) {
|
|
60087
|
+
const defaultMeta = {
|
|
60088
|
+
env: context.env,
|
|
60089
|
+
service: context.service,
|
|
60090
|
+
version: context.version,
|
|
60091
|
+
pid: process.pid,
|
|
60092
|
+
ppid: process.ppid,
|
|
60093
|
+
host: getIpAddress()
|
|
60094
|
+
};
|
|
60095
|
+
const transports2 = [];
|
|
60096
|
+
if (config4.enableConsoleTransport) {
|
|
60097
|
+
transports2.push(createTransportConsole());
|
|
60098
|
+
}
|
|
60099
|
+
if (config4.enableStdoutTransport) {
|
|
60100
|
+
transports2.push(createTransportStdout());
|
|
60101
|
+
}
|
|
60102
|
+
if (Object.values(config4).every((value) => !value)) {
|
|
60103
|
+
transports2.push(createTransportSilent());
|
|
60104
|
+
}
|
|
60105
|
+
for (const transport of transports2) {
|
|
60106
|
+
transport.on("error", (error48) => {
|
|
60107
|
+
console.error(`Unable to log to transport=${transport.name}: ${error48.message} ${JSON.stringify(error48)}`);
|
|
60108
|
+
});
|
|
60109
|
+
}
|
|
60110
|
+
const internalLogger = winston.createLogger({
|
|
60111
|
+
transports: transports2,
|
|
60112
|
+
defaultMeta,
|
|
60113
|
+
format: winston.format.combine(winston.format.splat(), winston.format(addMetadata({ getCorrelationId, getExecutionContext }))(), winston.format(transformErrorEnrich)({ depth: 5 }), winston.format(transformPrune)(), winston.format(transformAxiosError)(), winston.format.timestamp()),
|
|
60114
|
+
exitOnError: false
|
|
60115
|
+
});
|
|
60116
|
+
function createLogger3({ serviceName }) {
|
|
60117
|
+
const logger2 = internalLogger.child({ subService: serviceName });
|
|
60118
|
+
return {
|
|
60119
|
+
debug: bindLogger(logger2, "debug"),
|
|
60120
|
+
info: bindLogger(logger2, "info"),
|
|
60121
|
+
warn: bindLogger(logger2, "warn"),
|
|
60122
|
+
error: bindLogger(logger2, "error"),
|
|
60123
|
+
on: logger2.on.bind(logger2),
|
|
60124
|
+
end: logger2.end.bind(logger2)
|
|
60125
|
+
};
|
|
60126
|
+
}
|
|
60127
|
+
return {
|
|
60128
|
+
createLogger: createLogger3
|
|
60129
|
+
};
|
|
60130
|
+
}
|
|
60131
|
+
function bindLogger(logger2, severity) {
|
|
60132
|
+
return (message, data) => {
|
|
60133
|
+
logger2[severity].bind(logger2)(message, preserveReservedKeys(data));
|
|
60134
|
+
};
|
|
60135
|
+
}
|
|
60136
|
+
function preserveReservedKeys(data) {
|
|
60137
|
+
if (!data)
|
|
60138
|
+
return;
|
|
60139
|
+
return Object.fromEntries(Object.entries(data).map(([key, value]) => {
|
|
60140
|
+
let finalKey = key;
|
|
60141
|
+
if (key === "status") {
|
|
60142
|
+
finalKey = "_status";
|
|
60143
|
+
} else if (key === "service") {
|
|
60144
|
+
finalKey = "_service";
|
|
60145
|
+
}
|
|
60146
|
+
return [finalKey, value];
|
|
60147
|
+
}));
|
|
60148
|
+
}
|
|
60149
|
+
var verboseLevels = ["warn", "error", "debug"];
|
|
60150
|
+
function createTransportConsole() {
|
|
60151
|
+
return new winston.transports.Console({
|
|
60152
|
+
level: "debug",
|
|
60153
|
+
handleExceptions: true,
|
|
60154
|
+
format: winston.format.combine(winston.format(jsonFormat)(), winston.format((info) => {
|
|
60155
|
+
const { level, message, ...others } = info;
|
|
60156
|
+
const parts = [message];
|
|
60157
|
+
if (Object.keys(others).length > 0 && verboseLevels.includes(level)) {
|
|
60158
|
+
const rawOthers = JSON.parse(prune2(others));
|
|
60159
|
+
parts.push(util.inspect(rawOthers, false, 4, true));
|
|
60160
|
+
}
|
|
60161
|
+
info.message = parts.filter((part) => !!part).join("\n");
|
|
60162
|
+
return info;
|
|
60163
|
+
})(), winston.format.colorize(), winston.format.printf(({ timestamp, level, message, service = "?" }) => {
|
|
60164
|
+
const result = `[${timestamp}] ${level} ${service}: ${message}`;
|
|
60165
|
+
return result.replace(/\\n/g, "\n");
|
|
60166
|
+
}))
|
|
60167
|
+
});
|
|
60168
|
+
}
|
|
60169
|
+
function createTransportStdout() {
|
|
60170
|
+
return new winston.transports.Console({
|
|
60171
|
+
level: "debug",
|
|
60172
|
+
handleExceptions: true,
|
|
60173
|
+
format: winston.format.combine(winston.format(jsonFormat)(), winston.format.timestamp(), winston.format.json())
|
|
60174
|
+
});
|
|
60175
|
+
}
|
|
60176
|
+
function createTransportSilent() {
|
|
60177
|
+
return new winston.transports.Console({
|
|
60178
|
+
silent: true
|
|
60179
|
+
});
|
|
60180
|
+
}
|
|
60181
|
+
|
|
60182
|
+
// ../hyperline-monitoring/build/logger/instance.js
|
|
60183
|
+
var loggerFactory = buildLoggerFactory({
|
|
60184
|
+
config: {
|
|
60185
|
+
enableConsoleTransport: config2.LOGGER_CONSOLE_ENABLED ?? false,
|
|
60186
|
+
enableStdoutTransport: config2.LOGGER_STDOUT_ENABLED ?? false
|
|
60187
|
+
},
|
|
60188
|
+
context: {
|
|
60189
|
+
// APP_ENV wins where NODE_ENV is not the real environment — today only the PDF
|
|
60190
|
+
// render workers, which force NODE_ENV="production" for the React build.
|
|
60191
|
+
// Unset elsewhere, so this is a no-op fallback for every other process.
|
|
60192
|
+
env: config2.APP_ENV ?? config2.NODE_ENV,
|
|
60193
|
+
service: config2.DD_SERVICE ?? "api",
|
|
60194
|
+
version: config2.APP_VERSION
|
|
60195
|
+
}
|
|
60196
|
+
});
|
|
60197
|
+
var createLogger2 = loggerFactory.createLogger;
|
|
60198
|
+
var logger = loggerFactory.createLogger({ serviceName: "default" });
|
|
60199
|
+
|
|
60200
|
+
// ../hyperline-monitoring/build/tracing/tracing.js
|
|
60201
|
+
import tracer from "dd-trace";
|
|
60202
|
+
|
|
60203
|
+
// ../hyperline-lib/build/utils/aws.js
|
|
60204
|
+
import { GetBucketLocationCommand, S3Client } from "@aws-sdk/client-s3";
|
|
60205
|
+
import { GetCallerIdentityCommand, STSClient } from "@aws-sdk/client-sts";
|
|
60069
60206
|
|
|
60070
60207
|
// ../../node_modules/decimal.js/decimal.mjs
|
|
60071
60208
|
var EXP_LIMIT = 9e15;
|
|
@@ -62349,62 +62486,6 @@ var authorizedOperators = [
|
|
|
62349
62486
|
...mapAuthorizedOperators
|
|
62350
62487
|
];
|
|
62351
62488
|
|
|
62352
|
-
// ../hyperline-lib/build/http/dto/country.js
|
|
62353
|
-
var countryCodes = countriesAndCurrencies.map(({ countryCode }) => countryCode);
|
|
62354
|
-
var CountrySchema = external_exports.enum(countryCodes).openapi({
|
|
62355
|
-
description: "Two-letter country code in ISO format. See [ISO 3166-1 alpha-2](https://en.wikipedia.org/wiki/ISO_3166-1_alpha-2).",
|
|
62356
|
-
example: "FR"
|
|
62357
|
-
});
|
|
62358
|
-
|
|
62359
|
-
// ../hyperline-lib/build/http/dto/currency.js
|
|
62360
|
-
var currencyCodes = Array.from(new Set(countriesAndCurrencies.map(({ currencyCode }) => currencyCode).filter((currencyCode) => Boolean(currencyCode))));
|
|
62361
|
-
var CurrencySchema = external_exports.enum(currencyCodes).openapi({
|
|
62362
|
-
description: "Currency code. See [ISO 4217](https://en.wikipedia.org/wiki/ISO_4217#List_of_ISO_4217_currency_codes).",
|
|
62363
|
-
example: "EUR"
|
|
62364
|
-
});
|
|
62365
|
-
|
|
62366
|
-
// ../hyperline-lib/build/http/dto/dateTime.js
|
|
62367
|
-
var dateTimeDescription = "UTC date time string in the [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) format.";
|
|
62368
|
-
var DateTimeSchema = external_exports.iso.datetime({
|
|
62369
|
-
offset: false
|
|
62370
|
-
// only UTC date time
|
|
62371
|
-
}).openapi({
|
|
62372
|
-
description: dateTimeDescription,
|
|
62373
|
-
example: "2024-12-20T16:04:11Z"
|
|
62374
|
-
});
|
|
62375
|
-
|
|
62376
|
-
// ../hyperline-lib/build/http/dto/domain.js
|
|
62377
|
-
var DomainSchema = external_exports.string().trim().toLowerCase().regex(/^(?!:\/\/)(?=.{1,253}$)(?!-)([a-z0-9-]{1,63}\.)+[a-z]{2,63}$/, "Invalid domain").openapi({
|
|
62378
|
-
description: "Domain name.",
|
|
62379
|
-
example: "acme.com"
|
|
62380
|
-
});
|
|
62381
|
-
|
|
62382
|
-
// ../hyperline-lib/build/http/dto/error.js
|
|
62383
|
-
var ErrorSchema = external_exports.object({
|
|
62384
|
-
message: external_exports.string()
|
|
62385
|
-
});
|
|
62386
|
-
|
|
62387
|
-
// ../hyperline-lib/build/http/dto/pagination.js
|
|
62388
|
-
var PublicPaginationParams = {
|
|
62389
|
-
take: zod_default.coerce.number().nonnegative().max(100).optional().default(50),
|
|
62390
|
-
skip: zod_default.coerce.number().nonnegative().optional().default(0)
|
|
62391
|
-
};
|
|
62392
|
-
var PublicPaginationSchema = zod_default.object(PublicPaginationParams);
|
|
62393
|
-
var PublicCursorPaginationParams = {
|
|
62394
|
-
limit: zod_default.coerce.number().positive().max(100).optional().default(50).openapi({
|
|
62395
|
-
description: "Maximum number of items to return (1-100).",
|
|
62396
|
-
example: 50
|
|
62397
|
-
}),
|
|
62398
|
-
cursor: zod_default.string().optional().openapi({
|
|
62399
|
-
description: "Opaque cursor returned in the previous response's `next_cursor`. Omit to fetch the first page."
|
|
62400
|
-
}),
|
|
62401
|
-
include_total: BooleanSchema.optional().default(false).openapi({
|
|
62402
|
-
description: "Set to `true` to include `total` in the response.",
|
|
62403
|
-
example: false
|
|
62404
|
-
})
|
|
62405
|
-
};
|
|
62406
|
-
var PublicCursorPaginationSchema = zod_default.object(PublicCursorPaginationParams);
|
|
62407
|
-
|
|
62408
62489
|
// ../hyperline-lib/build/http/dto/state.js
|
|
62409
62490
|
var StateSchema = external_exports.enum(usStates).openapi({
|
|
62410
62491
|
description: "Only for US country. Second part of subdivision code in ISO format. See [ISO 3166-2:US](https://en.wikipedia.org/wiki/ISO_3166-2:US).",
|