@hyperline/cli 0.1.0-build.1.1064600 → 0.1.0-build.1.4e4ba70

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.
@@ -71,6 +71,87 @@ async function clearCredentials() {
71
71
  } catch {
72
72
  }
73
73
  }
74
+ async function resolveCompanyId({ flagCompanyId }) {
75
+ if (flagCompanyId)
76
+ return flagCompanyId;
77
+ const envCompanyId = process.env.HYPERLINE_COMPANY_ID;
78
+ if (envCompanyId)
79
+ return envCompanyId;
80
+ const configFile = await readJsonFile(CONFIG_FILE);
81
+ return configFile?.companyId;
82
+ }
83
+ async function saveCompanyId({ companyId }) {
84
+ const existing = await readJsonFile(CONFIG_FILE) ?? {};
85
+ existing.companyId = companyId;
86
+ await writeJsonFile(CONFIG_FILE, existing);
87
+ }
88
+
89
+ // build/prompt.js
90
+ import * as readline from "node:readline";
91
+ function selectPrompt({ message, items }) {
92
+ if (items.length === 0)
93
+ return Promise.resolve(void 0);
94
+ if (items.length === 1)
95
+ return Promise.resolve(items[0].value);
96
+ return new Promise((resolve) => {
97
+ const input = process.stdin;
98
+ const output = process.stderr;
99
+ let selectedIndex = 0;
100
+ const wasRaw = input.isRaw;
101
+ if (!input.isTTY) {
102
+ resolve(items[0].value);
103
+ return;
104
+ }
105
+ input.setRawMode(true);
106
+ readline.emitKeypressEvents(input);
107
+ function render() {
108
+ output.write(`\x1B[?25l`);
109
+ output.write(`\x1B[${items.length}A`);
110
+ for (const [index, item] of items.entries()) {
111
+ const isSelected = index === selectedIndex;
112
+ const pointer = isSelected ? "\x1B[36m>\x1B[0m" : " ";
113
+ const label = isSelected ? `\x1B[36m${item.label}\x1B[0m` : item.label;
114
+ const hint = item.hint ? `\x1B[2m ${item.hint}\x1B[0m` : "";
115
+ output.write(`\x1B[2K${pointer} ${label}${hint}
116
+ `);
117
+ }
118
+ }
119
+ output.write(`${message}
120
+ `);
121
+ for (const [index, item] of items.entries()) {
122
+ const isSelected = index === selectedIndex;
123
+ const pointer = isSelected ? "\x1B[36m>\x1B[0m" : " ";
124
+ const label = isSelected ? `\x1B[36m${item.label}\x1B[0m` : item.label;
125
+ const hint = item.hint ? `\x1B[2m ${item.hint}\x1B[0m` : "";
126
+ output.write(`${pointer} ${label}${hint}
127
+ `);
128
+ }
129
+ function cleanup() {
130
+ input.setRawMode(wasRaw ?? false);
131
+ input.removeListener("keypress", onKeypress);
132
+ input.pause();
133
+ output.write("\x1B[?25h");
134
+ }
135
+ function onKeypress(_str, key) {
136
+ if (!key)
137
+ return;
138
+ if (key.name === "up" || key.name === "k" && !key.ctrl) {
139
+ selectedIndex = selectedIndex <= 0 ? items.length - 1 : selectedIndex - 1;
140
+ render();
141
+ } else if (key.name === "down" || key.name === "j" && !key.ctrl) {
142
+ selectedIndex = selectedIndex >= items.length - 1 ? 0 : selectedIndex + 1;
143
+ render();
144
+ } else if (key.name === "return") {
145
+ cleanup();
146
+ resolve(items[selectedIndex]?.value);
147
+ } else if (key.name === "escape" || key.name === "c" && key.ctrl) {
148
+ cleanup();
149
+ resolve(void 0);
150
+ }
151
+ }
152
+ input.on("keypress", onKeypress);
153
+ });
154
+ }
74
155
 
75
156
  // build/auth.js
76
157
  var CLI_CLIENT_NAME = "Hyperline CLI";
@@ -88,7 +169,10 @@ function generateState() {
88
169
  async function registerDynamicClient({ baseUrl, redirectUri }) {
89
170
  const response = await fetch(`${baseUrl}/oauth/register`, {
90
171
  method: "POST",
91
- headers: { "Content-Type": "application/json" },
172
+ headers: {
173
+ "Content-Type": "application/json",
174
+ "Hyperline-Source": "cli"
175
+ },
92
176
  body: JSON.stringify({
93
177
  client_name: CLI_CLIENT_NAME,
94
178
  redirect_uris: [redirectUri],
@@ -106,7 +190,10 @@ async function registerDynamicClient({ baseUrl, redirectUri }) {
106
190
  async function exchangeCodeForTokens({ baseUrl, code, clientId, codeVerifier, redirectUri }) {
107
191
  const response = await fetch(`${baseUrl}/oauth/tokens`, {
108
192
  method: "POST",
109
- headers: { "Content-Type": "application/json" },
193
+ headers: {
194
+ "Content-Type": "application/json",
195
+ "Hyperline-Source": "cli"
196
+ },
110
197
  body: JSON.stringify({
111
198
  grant_type: "authorization_code",
112
199
  code,
@@ -238,11 +325,59 @@ Please open this URL in your browser:
238
325
  expiresIn: tokens.expires_in
239
326
  });
240
327
  process.stdout.write("Login successful!\n");
328
+ await promptCompanySelection({
329
+ baseUrl,
330
+ accessToken: tokens.access_token
331
+ });
241
332
  } catch (error) {
242
333
  server.close();
243
334
  throw error;
244
335
  }
245
336
  }
337
+ async function fetchCompanies({ baseUrl, accessToken }) {
338
+ const response = await fetch(`${baseUrl}/v1/companies`, {
339
+ headers: {
340
+ Authorization: `Bearer ${accessToken}`,
341
+ "Hyperline-Source": "cli"
342
+ }
343
+ });
344
+ if (!response.ok) {
345
+ throw new Error(`Failed to fetch companies: ${response.status}`);
346
+ }
347
+ const body = await response.json();
348
+ return body.data;
349
+ }
350
+ async function promptCompanySelection({ baseUrl, accessToken }) {
351
+ process.stdout.write("\nFetching your companies...\n");
352
+ const companies = await fetchCompanies({ baseUrl, accessToken });
353
+ if (companies.length === 0) {
354
+ process.stdout.write("No companies found for this account.\n");
355
+ return;
356
+ }
357
+ if (companies.length === 1) {
358
+ const onlyCompany = companies[0];
359
+ await saveCompanyId({ companyId: onlyCompany.id });
360
+ process.stdout.write(`Company set to ${onlyCompany.name}
361
+ `);
362
+ return;
363
+ }
364
+ const selectedCompanyId = await selectPrompt({
365
+ message: "Select a company:",
366
+ items: companies.map((company) => ({
367
+ label: company.name,
368
+ value: company.id,
369
+ hint: company.id
370
+ }))
371
+ });
372
+ if (!selectedCompanyId) {
373
+ process.stdout.write("No company selected. You can set one later with: hyperline company select\n");
374
+ return;
375
+ }
376
+ await saveCompanyId({ companyId: selectedCompanyId });
377
+ const selectedCompany = companies.find((company) => company.id === selectedCompanyId);
378
+ process.stdout.write(`Company set to ${selectedCompany?.name ?? selectedCompanyId}
379
+ `);
380
+ }
246
381
 
247
382
  // build/commands/generated/analytics.js
248
383
  function registerAnalyticsCommands(parent) {
@@ -355,9 +490,9 @@ Examples:
355
490
  }
356
491
 
357
492
  // build/commands/confirm.js
358
- import * as readline from "node:readline";
493
+ import * as readline2 from "node:readline";
359
494
  function confirmPrompt(message) {
360
- const rl = readline.createInterface({
495
+ const rl = readline2.createInterface({
361
496
  input: process.stdin,
362
497
  output: process.stderr
363
498
  });
@@ -7726,8 +7861,364 @@ var countriesAndCurrencies = (
7726
7861
  ]
7727
7862
  );
7728
7863
 
7864
+ // ../hyperline-monitoring/build/context/context.js
7865
+ import { AsyncLocalStorage } from "node:async_hooks";
7866
+ var executionContextStorage = new AsyncLocalStorage();
7867
+ function getExecutionContext() {
7868
+ return executionContextStorage.getStore();
7869
+ }
7870
+
7871
+ // ../hyperline-monitoring/build/context/correlationId.js
7872
+ import { AsyncLocalStorage as AsyncLocalStorage2 } from "node:async_hooks";
7873
+ var correlationIdStorage = new AsyncLocalStorage2();
7874
+ function getCorrelationId() {
7875
+ return correlationIdStorage.getStore();
7876
+ }
7877
+
7878
+ // ../hyperline-config/build/index.js
7879
+ import "dotenv/config";
7880
+ import * as stackTraceParser from "stacktrace-parser";
7881
+ import { ZodOptional as ZodOptional2, z as z2 } from "zod";
7882
+ function coerceBoolean() {
7883
+ return z2.any().refine((value) => ["true", "false"].includes(value), {
7884
+ message: "Expected boolean"
7885
+ }).transform((value) => (
7886
+ // biome-ignore lint/complexity/noUselessTernary: ignore
7887
+ value === "true" ? true : false
7888
+ ));
7889
+ }
7890
+ var types = {
7891
+ string: z2.coerce.string,
7892
+ number: z2.coerce.number,
7893
+ boolean: coerceBoolean,
7894
+ enum: z2.enum
7895
+ };
7896
+ function getConfig(schema, testValues) {
7897
+ const validator = z2.object(Object.fromEntries(Object.entries(schema).map(([key, zodType]) => {
7898
+ if (zodType instanceof ZodOptional2) {
7899
+ return [key, z2.string().optional()];
7900
+ }
7901
+ return [key, z2.string()];
7902
+ })));
7903
+ const processEnv = process.env;
7904
+ const isTestMode = processEnv.NODE_ENV === "test";
7905
+ const envVariables = {
7906
+ ...processEnv,
7907
+ ...isTestMode && testValues ? Object.fromEntries(Object.entries(testValues).map(([key, value]) => [key, String(value)])) : {}
7908
+ };
7909
+ const packageName = envVariables.npm_package_name;
7910
+ const parseProcessEnvResult = validator.safeParse(envVariables);
7911
+ if (!parseProcessEnvResult.success) {
7912
+ const parsedStackTrace = stackTraceParser.parse(parseProcessEnvResult.error.stack ?? "");
7913
+ const getConfigCallLine = parsedStackTrace.find((line) => {
7914
+ return !line.file?.includes("hyperline-config") && (line.file?.includes("apps/") || line.file?.includes("core/") || line.file?.includes("packages/"));
7915
+ });
7916
+ const callerFile = getConfigCallLine?.file;
7917
+ console.error(`Invalid environment variables for service \`${packageName}\`: \`${callerFile}\``);
7918
+ console.error(parseProcessEnvResult.error.format());
7919
+ process.exit(1);
7920
+ }
7921
+ const coercion = z2.object(schema);
7922
+ return coercion.parse(parseProcessEnvResult.data);
7923
+ }
7924
+
7925
+ // ../hyperline-monitoring/build/config.js
7926
+ var config = getConfig({
7927
+ // config
7928
+ APP_VERSION: types.string().optional(),
7929
+ LOGGER_CONSOLE_ENABLED: types.boolean().optional(),
7930
+ LOGGER_STDOUT_ENABLED: types.boolean().optional(),
7931
+ NODE_ENV: types.enum(["local", "test", "staging", "sandbox", "production"]),
7932
+ EVENT_LOOP_MONITORING_ENABLED: types.boolean().optional(),
7933
+ MEMORY_MONITORING_ENABLED: types.boolean().optional()
7934
+ // secrets
7935
+ }, {
7936
+ APP_VERSION: void 0,
7937
+ LOGGER_CONSOLE_ENABLED: false,
7938
+ LOGGER_STDOUT_ENABLED: false,
7939
+ EVENT_LOOP_MONITORING_ENABLED: false,
7940
+ MEMORY_MONITORING_ENABLED: false,
7941
+ NODE_ENV: "test"
7942
+ });
7943
+
7944
+ // ../hyperline-monitoring/build/logger/logger.js
7945
+ import * as util from "node:util";
7946
+ import prune2 from "json-prune";
7947
+ import * as winston from "winston";
7948
+
7949
+ // ../hyperline-monitoring/build/logger/formatting/format.js
7950
+ import prune from "json-prune";
7951
+ function jsonFormat(info) {
7952
+ const prunedInfo = JSON.parse(prune(info));
7953
+ for (const [key, value] of Object.entries(prunedInfo)) {
7954
+ info[key] = value;
7955
+ }
7956
+ return info;
7957
+ }
7958
+ function addMetadata({ getCorrelationId: getCorrelationId2, getExecutionContext: getExecutionContext2 }) {
7959
+ return (info) => {
7960
+ const correlationId = getCorrelationId2();
7961
+ const executionContext = getExecutionContext2();
7962
+ let traceContext;
7963
+ return {
7964
+ ...info,
7965
+ ...executionContext ?? {},
7966
+ ...traceContext ?? {},
7967
+ correlationId
7968
+ };
7969
+ };
7970
+ }
7971
+ function transformErrorEnrich(info, { depth }) {
7972
+ if (depth <= 0) {
7973
+ return info;
7974
+ }
7975
+ Object.entries(info).forEach(([key, value]) => {
7976
+ let newValue = value;
7977
+ if (newValue instanceof Error) {
7978
+ newValue = {
7979
+ ...newValue,
7980
+ // Copy error properties manually because they're not enumerable
7981
+ level: newValue.level,
7982
+ stack: newValue.stack,
7983
+ message: newValue.message,
7984
+ name: newValue.name
7985
+ };
7986
+ }
7987
+ if (newValue instanceof Object) {
7988
+ newValue = transformErrorEnrich(newValue, { depth: depth - 1 });
7989
+ }
7990
+ const isPropertyWritable = Object.getOwnPropertyDescriptor(info, key)?.writable ?? true;
7991
+ if (isPropertyWritable && newValue !== value) {
7992
+ info[key] = newValue;
7993
+ }
7994
+ });
7995
+ return info;
7996
+ }
7997
+ function transformPrune(info) {
7998
+ Object.entries(info).forEach(([key, value]) => {
7999
+ if (typeof value === "function") {
8000
+ return;
8001
+ }
8002
+ const newValue = value instanceof Object ? JSON.parse(prune(value, { depthDecr: 6 })) : value;
8003
+ const isPropertyWritable = Object.getOwnPropertyDescriptor(info, key)?.writable ?? true;
8004
+ if (isPropertyWritable && newValue !== value) {
8005
+ info[key] = newValue;
8006
+ }
8007
+ });
8008
+ return info;
8009
+ }
8010
+ function transformAxiosError(info) {
8011
+ Object.entries(info).forEach(([key, value]) => {
8012
+ if (typeof value === "object" && value?.name === "AxiosError") {
8013
+ info[key] = formatAxiosError(value);
8014
+ }
8015
+ });
8016
+ return info;
8017
+ }
8018
+ function formatAxiosError(error) {
8019
+ if (!isRecord(error) || error.name !== "AxiosError") {
8020
+ return error;
8021
+ }
8022
+ const request = isRecord(error.config) ? error.config : void 0;
8023
+ const response = isRecord(error.response) ? error.response : void 0;
8024
+ return {
8025
+ name: error.name,
8026
+ message: error.message,
8027
+ code: error.code,
8028
+ request: {
8029
+ method: request?.method,
8030
+ url: request?.url,
8031
+ baseURL: request?.baseURL,
8032
+ params: request?.params,
8033
+ headers: request?.headers,
8034
+ "axios-retry": request?.["axios-retry"]
8035
+ },
8036
+ response: {
8037
+ status: response?.status,
8038
+ statusText: response?.statusText,
8039
+ headers: response?.headers,
8040
+ data: response?.data
8041
+ }
8042
+ };
8043
+ }
8044
+ function isRecord(value) {
8045
+ return typeof value === "object" && value !== null && !Array.isArray(value);
8046
+ }
8047
+
8048
+ // ../hyperline-monitoring/build/logger/formatting/routePath.js
8049
+ function transformUrlIntoRoutePath({ params, originalUrl }) {
8050
+ let routePath = originalUrl;
8051
+ for (const [param, value] of Object.entries(params ?? {})) {
8052
+ const strValue = Array.isArray(value) ? value.join("/") : value;
8053
+ routePath = routePath.replace(strValue, `:${param}`);
8054
+ }
8055
+ return routePath.split("?")[0] ?? routePath;
8056
+ }
8057
+
8058
+ // ../hyperline-monitoring/build/logger/formatting/http.js
8059
+ function logHttpRequest(logger2, request, extra) {
8060
+ const { message, metadata } = transform(request);
8061
+ logger2.info(`HTTP REQ - ${message} ${extra?.postfix || ""}`, {
8062
+ ...metadata,
8063
+ ...extra?.metadata ?? {}
8064
+ });
8065
+ }
8066
+ function logHttpResponse(logger2, response, responseTime, extra) {
8067
+ const { request, statusCode, responseBody } = response;
8068
+ const { message, metadata } = transform(request);
8069
+ const readableResponseTime = responseTime ? getReadableTime(responseTime) : void 0;
8070
+ const responseMetadata = {
8071
+ statusCode,
8072
+ responseTime,
8073
+ responseBody
8074
+ };
8075
+ logger2.info(`HTTP RES - ${message} ${statusCode} ${readableResponseTime || ""} ${extra?.postfix || ""}`, {
8076
+ ...metadata,
8077
+ ...responseMetadata,
8078
+ ...extra?.metadata ?? {}
8079
+ });
8080
+ }
8081
+ function transform(request) {
8082
+ const method = request.method.toUpperCase();
8083
+ const message = `${method} ${request.originalUrl}`;
8084
+ const metadata = {};
8085
+ metadata.method = method;
8086
+ metadata.url = request.url;
8087
+ metadata.path = request.path;
8088
+ metadata.hostname = request.hostname;
8089
+ metadata.originalUrl = request.originalUrl;
8090
+ metadata.requestBody = request.body;
8091
+ metadata.routePath = transformUrlIntoRoutePath(request);
8092
+ metadata.apiKeyEnd = request.headers["authorization"]?.slice(-6);
8093
+ return { message, metadata };
8094
+ }
8095
+ function getReadableTime(time) {
8096
+ return time < 1e4 ? `${time}ms` : `${Math.round(time / 1e3)}s`;
8097
+ }
8098
+
8099
+ // ../hyperline-monitoring/build/logger/utils/network.js
8100
+ import * as os2 from "node:os";
8101
+ function getIpAddress() {
8102
+ const interfaces = Object.values(os2.networkInterfaces()).flat().filter((networkInterface) => {
8103
+ return networkInterface !== void 0;
8104
+ });
8105
+ const mainInterface = interfaces.find(({ family, internal }) => family === "IPv4" && internal === false);
8106
+ return mainInterface ? mainInterface.address : null;
8107
+ }
8108
+
8109
+ // ../hyperline-monitoring/build/logger/logger.js
8110
+ function buildLoggerFactory({ config: config2, context }) {
8111
+ const defaultMeta = {
8112
+ env: context.env,
8113
+ service: context.service,
8114
+ version: context.version,
8115
+ pid: process.pid,
8116
+ ppid: process.ppid,
8117
+ host: getIpAddress()
8118
+ };
8119
+ const transports2 = [];
8120
+ if (config2.enableConsoleTransport) {
8121
+ transports2.push(createTransportConsole());
8122
+ }
8123
+ if (config2.enableStdoutTransport) {
8124
+ transports2.push(createTransportStdout());
8125
+ }
8126
+ if (Object.values(config2).every((value) => !value)) {
8127
+ transports2.push(createTransportSilent());
8128
+ }
8129
+ for (const transport of transports2) {
8130
+ transport.on("error", (error) => {
8131
+ console.error(`Unable to log to transport=${transport.name}: ${error.message} ${JSON.stringify(error)}`);
8132
+ });
8133
+ }
8134
+ const internalLogger = winston.createLogger({
8135
+ transports: transports2,
8136
+ defaultMeta,
8137
+ 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()),
8138
+ exitOnError: false
8139
+ });
8140
+ function createLogger3({ serviceName }) {
8141
+ const logger2 = internalLogger.child({ subService: serviceName });
8142
+ return {
8143
+ debug: bindLogger(logger2, "debug"),
8144
+ info: bindLogger(logger2, "info"),
8145
+ warn: bindLogger(logger2, "warn"),
8146
+ error: bindLogger(logger2, "error"),
8147
+ on: logger2.on.bind(logger2),
8148
+ end: logger2.end.bind(logger2)
8149
+ };
8150
+ }
8151
+ return {
8152
+ createLogger: createLogger3
8153
+ };
8154
+ }
8155
+ function bindLogger(logger2, severity) {
8156
+ return (message, data) => {
8157
+ logger2[severity].bind(logger2)(message, preserveReservedKeys(data));
8158
+ };
8159
+ }
8160
+ function preserveReservedKeys(data) {
8161
+ if (!data)
8162
+ return;
8163
+ return Object.fromEntries(Object.entries(data).map(([key, value]) => {
8164
+ let finalKey = key;
8165
+ if (key === "status") {
8166
+ finalKey = "_status";
8167
+ } else if (key === "service") {
8168
+ finalKey = "_service";
8169
+ }
8170
+ return [finalKey, value];
8171
+ }));
8172
+ }
8173
+ var verboseLevels = ["warn", "error", "debug"];
8174
+ function createTransportConsole() {
8175
+ return new winston.transports.Console({
8176
+ level: "debug",
8177
+ handleExceptions: true,
8178
+ format: winston.format.combine(winston.format(jsonFormat)(), winston.format((info) => {
8179
+ const { level, message, ...others } = info;
8180
+ const parts = [message];
8181
+ if (Object.keys(others).length > 0 && verboseLevels.includes(level)) {
8182
+ const rawOthers = JSON.parse(prune2(others));
8183
+ parts.push(util.inspect(rawOthers, false, 4, true));
8184
+ }
8185
+ info.message = parts.filter((part) => !!part).join("\n");
8186
+ return info;
8187
+ })(), winston.format.colorize(), winston.format.printf(({ timestamp, level, message, service = "?" }) => {
8188
+ const result = `[${timestamp}] ${level} ${service}: ${message}`;
8189
+ return result.replace(/\\n/g, "\n");
8190
+ }))
8191
+ });
8192
+ }
8193
+ function createTransportStdout() {
8194
+ return new winston.transports.Console({
8195
+ level: "debug",
8196
+ handleExceptions: true,
8197
+ format: winston.format.combine(winston.format(jsonFormat)(), winston.format.timestamp(), winston.format.json())
8198
+ });
8199
+ }
8200
+ function createTransportSilent() {
8201
+ return new winston.transports.Console({
8202
+ silent: true
8203
+ });
8204
+ }
8205
+
8206
+ // ../hyperline-monitoring/build/logger/instance.js
8207
+ var loggerFactory = buildLoggerFactory({
8208
+ config: {
8209
+ enableConsoleTransport: config.LOGGER_CONSOLE_ENABLED ?? false,
8210
+ enableStdoutTransport: config.LOGGER_STDOUT_ENABLED ?? false
8211
+ },
8212
+ context: {
8213
+ env: config.NODE_ENV,
8214
+ service: "api",
8215
+ version: config.APP_VERSION
8216
+ }
8217
+ });
8218
+ var createLogger2 = loggerFactory.createLogger;
8219
+ var logger = loggerFactory.createLogger({ serviceName: "default" });
8220
+
7729
8221
  // ../hyperline-lib/build/utils/config/usStates.js
7730
- import { logger } from "@hyperline/monitoring";
7731
8222
  var usStates = [
7732
8223
  "AA",
7733
8224
  "AE",
@@ -7792,7 +8283,7 @@ var usStates = [
7792
8283
 
7793
8284
  // ../hyperline-lib/build/utils/dates.js
7794
8285
  import { toLocalTime, toUtc } from "@hyperline/shared";
7795
- import { add, addDays, addHours, addMinutes, addMonths, addWeeks, addYears, areIntervalsOverlapping, differenceInCalendarDays, differenceInCalendarYears, differenceInMilliseconds, differenceInMonths, differenceInWeeks, eachDayOfInterval, endOfDay, endOfMonth, endOfQuarter, endOfWeek, endOfYear, format, getHours, getISOWeek, getISOWeekYear, getMilliseconds, getMinutes, getSeconds, isBefore, isEqual, isSameDay, parse, setHours, setMilliseconds, setMinutes, setSeconds, startOfDay, startOfMonth, startOfQuarter, startOfWeek, startOfYear, sub } from "date-fns";
8286
+ import { add, addDays, addHours, addMinutes, addMonths, addWeeks, addYears, areIntervalsOverlapping, differenceInCalendarDays, differenceInCalendarYears, differenceInMilliseconds, differenceInMonths, differenceInWeeks, eachDayOfInterval, endOfDay, endOfMonth, endOfQuarter, endOfWeek, endOfYear, format as format2, getHours, getISOWeek, getISOWeekYear, getMilliseconds, getMinutes, getSeconds, isBefore, isEqual, isSameDay, parse as parse2, setHours, setMilliseconds, setMinutes, setSeconds, startOfDay, startOfMonth, startOfQuarter, startOfWeek, startOfYear, sub } from "date-fns";
7796
8287
 
7797
8288
  // ../hyperline-lib/build/utils/document.js
7798
8289
  import { toLocalTime as toLocalTime2 } from "@hyperline/shared";
@@ -7864,15 +8355,15 @@ var ErrorSchema = z.object({
7864
8355
  });
7865
8356
 
7866
8357
  // ../hyperline-lib/build/http/dto/pagination.js
7867
- import z2 from "zod";
8358
+ import z3 from "zod";
7868
8359
  var PublicPaginationParams = {
7869
- take: z2.coerce.number().nonnegative().max(100).optional().default(50),
7870
- skip: z2.coerce.number().nonnegative().optional().default(0)
8360
+ take: z3.coerce.number().nonnegative().max(100).optional().default(50),
8361
+ skip: z3.coerce.number().nonnegative().optional().default(0)
7871
8362
  };
7872
- var PublicPaginationSchema = z2.object(PublicPaginationParams);
8363
+ var PublicPaginationSchema = z3.object(PublicPaginationParams);
7873
8364
 
7874
8365
  // ../hyperline-lib/build/http/dto/sort.js
7875
- import z3 from "zod";
8366
+ import z4 from "zod";
7876
8367
 
7877
8368
  // ../hyperline-lib/build/http/dto/state.js
7878
8369
  var StateSchema = z.enum(usStates).openapi({
@@ -7886,12 +8377,356 @@ import { ZodError as ZodError2 } from "zod";
7886
8377
  // ../hyperline-lib/build/http/helpers/correlation.js
7887
8378
  import { validate as validateUuid } from "uuid";
7888
8379
 
8380
+ // ../hyperline-i18n/build/language.js
8381
+ import * as i18next from "i18next";
8382
+ import { z as z5 } from "zod";
8383
+
8384
+ // ../hyperline-i18n/build/config/languages.js
8385
+ var languages = [
8386
+ { id: "fr", name: "French", isoCode: "fr", locale: "fr-FR" },
8387
+ { id: "en", name: "English", isoCode: "en", locale: "en-US" },
8388
+ { id: "de", name: "German", isoCode: "de", locale: "de-DE" },
8389
+ { id: "it", name: "Italian", isoCode: "it", locale: "it-IT" },
8390
+ { id: "nl", name: "Dutch", isoCode: "nl", locale: "nl-NL" },
8391
+ { id: "es", name: "Spanish", isoCode: "es", locale: "es-ES" },
8392
+ { id: "pt", name: "Portuguese", isoCode: "pt", locale: "pt-PT" },
8393
+ { id: "pl", name: "Polish", isoCode: "pl", locale: "pl-PL" }
8394
+ ];
8395
+
8396
+ // ../hyperline-i18n/build/locales/de.js
8397
+ var de = {
8398
+ "accounting.revrec.creditLineDescription": "Umsatz realisieren \u2013 Zeitplan {{scheduleId}}, Zeitraum {{periodDate}}",
8399
+ "accounting.revrec.debitLineDescription": "Abgrenzungsposten reduzieren \u2013 Zeitplan {{scheduleId}}, Zeitraum {{periodDate}}",
8400
+ "accounting.revrec.discountCreditLineDescription": "Erl\xF6sminderung (Rabatt) erfassen \u2013 Zeitplan {{scheduleId}}, Zeitraum {{periodDate}}",
8401
+ "accounting.revrec.discountDebitLineDescription": "Abgegrenzten Rabatt reduzieren \u2013 Zeitplan {{scheduleId}}, Zeitraum {{periodDate}}",
8402
+ "accounting.revrec.entryDescription": "Umsatzrealisierung f\xFCr Zeitplan {{scheduleId}}, Zeitraum {{periodStart}} - {{periodEnd}}",
8403
+ "creditNotes.refundChargeName": "R\xFCckerstattung f\xFCr die Rechnung",
8404
+ "credits.bundleOf": "{{productName}} - Paket mit {{creditCount}} Guthaben",
8405
+ "credits.unitsOf": "{{productName}} - {{creditCount}} Guthaben",
8406
+ "einvoicing.paymentFromWallet": "Zahlung aus Guthaben",
8407
+ "einvoicing.paymentProcessed": "Zahlung verarbeitet",
8408
+ "einvoicing.paymentReceived": "Zahlung erhalten",
8409
+ "invoices.outstandingProduct.description": "Unbezahlter Betrag der Rechnung{{invoiceNumber}} vom {{date}}",
8410
+ "invoices.outstandingProduct.descriptionPeriod": "Unbezahlter Betrag der Rechnung{{invoiceNumber}} vom {{periodStart}} bis {{periodEnd}}",
8411
+ "invoices.outstandingProduct.name": "Offener Saldo",
8412
+ "invoices.prorata.paymentForItem": "Anteilig berechneter Betrag f\xFCr",
8413
+ "invoices.prorata.refundForItem": "Anteilig erstatteter Betrag f\xFCr",
8414
+ "subscriptions.closingChargeName": "Abschlussgeb\xFChr f\xFCr das Abonnement",
8415
+ "subscriptions.correction": "Vorperiodische Anpassung",
8416
+ "subscriptions.updates.addCoupon": "Gutschein hinzuf\xFCgen {{couponName}}",
8417
+ "subscriptions.updates.addProduct": "{{productName}} hinzuf\xFCgen",
8418
+ "subscriptions.updates.removeCoupon": "Gutschein entfernen {{couponName}}",
8419
+ "subscriptions.updates.removeProduct": "{{productName}} entfernen",
8420
+ "subscriptions.updates.unit": "Einheiten",
8421
+ "subscriptions.updates.updateCount": "Aktualisieren Sie {{productName}} ({{previousCount}} \u2192 {{newCount}} {{unit}})",
8422
+ "subscriptions.updates.updateCount.description.full.committed.invoiced": "Eine minimale zugesicherte Anzahl von {{committedCount}} wurde f\xFCr den gesamten Zeitraum angewendet.",
8423
+ "subscriptions.updates.updateCount.description.full.committed.not_invoiced": "Betrag von {{amount}} (mit einer minimal zugesicherten Anzahl von {{committedCount}}) f\xFCr den gesamten Zeitraum nicht in Rechnung gestellt",
8424
+ "subscriptions.updates.updateCount.description.full.not_committed.invoiced": "Diese Position wurde f\xFCr den gesamten Zeitraum in Rechnung gestellt",
8425
+ "subscriptions.updates.updateCount.description.full.not_committed.not_invoiced": "Betrag von {{amount}} f\xFCr den gesamten Zeitraum nicht in Rechnung gestellt",
8426
+ "subscriptions.updates.updateCount.description.prorata.committed.invoiced": "Eine minimale zugesicherte Anzahl von {{committedCount}} wurde angewendet.",
8427
+ "subscriptions.updates.updateCount.description.prorata.committed.not_invoiced": "Betrag von {{amount}} (mit einer minimal zugesicherten Anzahl von {{committedCount}}) f\xFCr den anteiligen Zeitraum nicht in Rechnung gestellt",
8428
+ "subscriptions.updates.updateCount.description.prorata.not_committed.invoiced": "Diese Position wurde f\xFCr den anteiligen Zeitraum in Rechnung gestellt",
8429
+ "subscriptions.updates.updateCount.description.prorata.not_committed.not_invoiced": "Betrag von {{amount}} f\xFCr den anteiligen Zeitraum nicht in Rechnung gestellt",
8430
+ "subscriptions.updates.updatePrices": "Preise f\xFCr {{productName}} aktualisieren"
8431
+ };
8432
+
8433
+ // ../hyperline-i18n/build/locales/en.js
8434
+ var en = {
8435
+ "creditNotes.refundChargeName": "Refund for invoice",
8436
+ "credits.bundleOf": "{{productName}} - Pack of {{creditCount}} credits",
8437
+ "credits.unitsOf": "{{productName}} - {{creditCount}} credits",
8438
+ "invoices.outstandingProduct.description": "Unpaid amount from the invoice{{invoiceNumber}} emitted on {{date}}",
8439
+ "invoices.outstandingProduct.descriptionPeriod": "Unpaid amount from the invoice{{invoiceNumber}} from {{periodStart}} to {{periodEnd}}",
8440
+ "invoices.outstandingProduct.name": "Outstanding balance",
8441
+ "invoices.prorata.paymentForItem": "Prorated payment for",
8442
+ "invoices.prorata.refundForItem": "Prorated refund for",
8443
+ "subscriptions.closingChargeName": "Closing fee for subscription",
8444
+ "subscriptions.correction": "Adjustment previous period",
8445
+ "subscriptions.updates.addCoupon": "Add coupon {{couponName}}",
8446
+ "subscriptions.updates.addProduct": "Add {{productName}}",
8447
+ "subscriptions.updates.removeCoupon": "Remove coupon {{couponName}}",
8448
+ "subscriptions.updates.removeProduct": "Remove {{productName}}",
8449
+ "subscriptions.updates.unit": "units",
8450
+ "subscriptions.updates.updatePrices": "Update prices for {{productName}}",
8451
+ "subscriptions.updates.updateCount": "Update {{productName}} count ({{previousCount}} \u2192 {{newCount}} {{unit}})",
8452
+ "subscriptions.updates.updateCount.description.prorata.committed.invoiced": "A minimum committed count of {{committedCount}} has been applied.",
8453
+ "subscriptions.updates.updateCount.description.prorata.committed.not_invoiced": "Amount of {{amount}} (with a minimum committed count of {{committedCount}}) not invoiced for the prorated period",
8454
+ "subscriptions.updates.updateCount.description.prorata.not_committed.invoiced": "This line has been invoiced for the prorated period",
8455
+ "subscriptions.updates.updateCount.description.prorata.not_committed.not_invoiced": "Amount of {{amount}} not invoiced for the prorated period",
8456
+ "subscriptions.updates.updateCount.description.full.committed.invoiced": "A minimum committed count of {{committedCount}} has been applied for the full period.",
8457
+ "subscriptions.updates.updateCount.description.full.committed.not_invoiced": "Amount of {{amount}} (with a minimum committed count of {{committedCount}}) not invoiced for the full period",
8458
+ "subscriptions.updates.updateCount.description.full.not_committed.invoiced": "This line has been invoiced for the full period",
8459
+ "subscriptions.updates.updateCount.description.full.not_committed.not_invoiced": "Amount of {{amount}} not invoiced for the full period",
8460
+ "accounting.revrec.entryDescription": "Revenue recognition for schedule {{scheduleId}}, period {{periodStart}} - {{periodEnd}}",
8461
+ "accounting.revrec.debitLineDescription": "Decrease deferred revenue \u2013 schedule {{scheduleId}}, period {{periodDate}}",
8462
+ "accounting.revrec.creditLineDescription": "Recognize revenue \u2013 schedule {{scheduleId}}, period {{periodDate}}",
8463
+ "accounting.revrec.discountDebitLineDescription": "Decrease deferred discount \u2013 schedule {{scheduleId}}, period {{periodDate}}",
8464
+ "accounting.revrec.discountCreditLineDescription": "Recognize contra-revenue (discount) \u2013 schedule {{scheduleId}}, period {{periodDate}}",
8465
+ "einvoicing.paymentProcessed": "Payment processed",
8466
+ "einvoicing.paymentReceived": "Payment received",
8467
+ "einvoicing.paymentFromWallet": "Payment from wallet"
8468
+ };
8469
+
8470
+ // ../hyperline-i18n/build/locales/es.js
8471
+ var es = {
8472
+ "accounting.revrec.creditLineDescription": "Reconocer ingresos \u2013 cronograma {{scheduleId}}, per\xEDodo {{periodDate}}",
8473
+ "accounting.revrec.debitLineDescription": "Disminuci\xF3n de ingresos diferidos \u2013 cronograma {{scheduleId}}, per\xEDodo {{periodDate}}",
8474
+ "accounting.revrec.discountCreditLineDescription": "Reconocer contra-ingresos (descuento) \u2013 cronograma {{scheduleId}}, per\xEDodo {{periodDate}}",
8475
+ "accounting.revrec.discountDebitLineDescription": "Disminuci\xF3n de descuento diferido \u2013 cronograma {{scheduleId}}, per\xEDodo {{periodDate}}",
8476
+ "accounting.revrec.entryDescription": "Reconocimiento de ingresos para el cronograma {{scheduleId}}, per\xEDodo {{periodStart}} - {{periodEnd}}",
8477
+ "creditNotes.refundChargeName": "Reembolso por factura",
8478
+ "credits.bundleOf": "{{productName}} - Paquete de {{creditCount}} cr\xE9ditos",
8479
+ "credits.unitsOf": "{{productName}} - {{creditCount}} cr\xE9ditos",
8480
+ "einvoicing.paymentFromWallet": "Pago desde el monedero",
8481
+ "einvoicing.paymentProcessed": "Pago procesado",
8482
+ "einvoicing.paymentReceived": "Pago recibido",
8483
+ "invoices.outstandingProduct.description": "Monto pendiente de la factura{{invoiceNumber}} emitida el {{date}}",
8484
+ "invoices.outstandingProduct.descriptionPeriod": "Monto pendiente de la factura{{invoiceNumber}} del {{periodStart}} al {{periodEnd}}",
8485
+ "invoices.outstandingProduct.name": "Saldo pendiente",
8486
+ "invoices.prorata.paymentForItem": "Pago prorrateado por",
8487
+ "invoices.prorata.refundForItem": "Reembolso prorrateado por",
8488
+ "subscriptions.closingChargeName": "Cargo por cierre de suscripci\xF3n",
8489
+ "subscriptions.correction": "Ajuste del periodo anterior",
8490
+ "subscriptions.updates.addCoupon": "A\xF1adir cup\xF3n {{couponName}}",
8491
+ "subscriptions.updates.addProduct": "A\xF1adir {{productName}}",
8492
+ "subscriptions.updates.removeCoupon": "Eliminar cup\xF3n {{couponName}}",
8493
+ "subscriptions.updates.removeProduct": "Eliminar {{productName}}",
8494
+ "subscriptions.updates.unit": "unidades",
8495
+ "subscriptions.updates.updateCount": "Actualizar {{productName}} ({{previousCount}} \u2192 {{newCount}} {{unit}})",
8496
+ "subscriptions.updates.updateCount.description.full.committed.invoiced": "Se ha aplicado un m\xEDnimo comprometido de {{committedCount}} para el per\xEDodo completo.",
8497
+ "subscriptions.updates.updateCount.description.full.committed.not_invoiced": "Importe de {{amount}} (con un m\xEDnimo comprometido de {{committedCount}}) no facturado para el per\xEDodo completo",
8498
+ "subscriptions.updates.updateCount.description.full.not_committed.invoiced": "Esta l\xEDnea ha sido facturada para el per\xEDodo completo",
8499
+ "subscriptions.updates.updateCount.description.full.not_committed.not_invoiced": "Importe de {{amount}} no facturado para el per\xEDodo completo",
8500
+ "subscriptions.updates.updateCount.description.prorata.committed.invoiced": "Se ha aplicado un m\xEDnimo comprometido de {{committedCount}}.",
8501
+ "subscriptions.updates.updateCount.description.prorata.committed.not_invoiced": "Importe de {{amount}} (con un m\xEDnimo comprometido de {{committedCount}}) no facturado para el per\xEDodo prorrateado",
8502
+ "subscriptions.updates.updateCount.description.prorata.not_committed.invoiced": "Esta l\xEDnea ha sido facturada para el per\xEDodo prorrateado",
8503
+ "subscriptions.updates.updateCount.description.prorata.not_committed.not_invoiced": "Importe de {{amount}} no facturado para el per\xEDodo prorrateado",
8504
+ "subscriptions.updates.updatePrices": "Actualizar precios para {{productName}}"
8505
+ };
8506
+
8507
+ // ../hyperline-i18n/build/locales/fr.js
8508
+ var fr = {
8509
+ "accounting.revrec.creditLineDescription": "Reconnaissance du chiffre d'affaires \u2013 \xE9ch\xE9ancier {{scheduleId}}, p\xE9riode {{periodDate}}",
8510
+ "accounting.revrec.debitLineDescription": "Diminution des produits constat\xE9s d'avance \u2013 \xE9ch\xE9ancier {{scheduleId}}, p\xE9riode {{periodDate}}",
8511
+ "accounting.revrec.discountCreditLineDescription": "Reconnaissance du contre-revenu (remise) \u2013 \xE9ch\xE9ancier {{scheduleId}}, p\xE9riode {{periodDate}}",
8512
+ "accounting.revrec.discountDebitLineDescription": "Diminution des remises diff\xE9r\xE9es \u2013 \xE9ch\xE9ancier {{scheduleId}}, p\xE9riode {{periodDate}}",
8513
+ "accounting.revrec.entryDescription": "Reconnaissance du chiffre d'affaires pour l'\xE9ch\xE9ancier {{scheduleId}}, p\xE9riode {{periodStart}} - {{periodEnd}}",
8514
+ "creditNotes.refundChargeName": "Remboursement pour facture",
8515
+ "credits.bundleOf": "{{productName}} - Pack de {{creditCount}} cr\xE9dits",
8516
+ "credits.unitsOf": "{{productName}} - {{creditCount}} cr\xE9dits",
8517
+ "einvoicing.paymentFromWallet": "Paiement depuis le portefeuille",
8518
+ "einvoicing.paymentProcessed": "Paiement effectu\xE9",
8519
+ "einvoicing.paymentReceived": "Paiement re\xE7u",
8520
+ "invoices.outstandingProduct.description": "Montant impay\xE9 de la facture{{invoiceNumber}} \xE9mise le {{date}}",
8521
+ "invoices.outstandingProduct.descriptionPeriod": "Montant impay\xE9 de la facture{{invoiceNumber}} du {{periodStart}} au {{periodEnd}}",
8522
+ "invoices.outstandingProduct.name": "Solde impay\xE9",
8523
+ "invoices.prorata.paymentForItem": "Paiement au prorata pour",
8524
+ "invoices.prorata.refundForItem": "Remboursement au prorata pour",
8525
+ "subscriptions.closingChargeName": "Frais de cl\xF4ture pour abonnement",
8526
+ "subscriptions.correction": "Ajustement p\xE9riode pr\xE9c\xE9dente",
8527
+ "subscriptions.updates.addCoupon": "Ajout du coupon {{couponName}}",
8528
+ "subscriptions.updates.addProduct": "Ajout {{productName}}",
8529
+ "subscriptions.updates.removeCoupon": "Retrait du coupon {{couponName}}",
8530
+ "subscriptions.updates.removeProduct": "Retrait {{productName}}",
8531
+ "subscriptions.updates.unit": "unit\xE9s",
8532
+ "subscriptions.updates.updateCount": "Mise \xE0 jour {{productName}} ({{previousCount}} \u2192 {{newCount}} {{unit}})",
8533
+ "subscriptions.updates.updateCount.description.full.committed.invoiced": "Un minimum engag\xE9 de {{committedCount}} a \xE9t\xE9 appliqu\xE9 pour la p\xE9riode compl\xE8te.",
8534
+ "subscriptions.updates.updateCount.description.full.committed.not_invoiced": "Montant de {{amount}} (avec un minimum engag\xE9 de {{committedCount}}) non factur\xE9 pour la p\xE9riode compl\xE8te",
8535
+ "subscriptions.updates.updateCount.description.full.not_committed.invoiced": "Cette ligne a \xE9t\xE9 factur\xE9e pour la p\xE9riode compl\xE8te",
8536
+ "subscriptions.updates.updateCount.description.full.not_committed.not_invoiced": "Montant de {{amount}} non factur\xE9 pour la p\xE9riode compl\xE8te",
8537
+ "subscriptions.updates.updateCount.description.prorata.committed.invoiced": "Un minimum engag\xE9 de {{committedCount}} a \xE9t\xE9 appliqu\xE9 pour la p\xE9riode proratis\xE9e.",
8538
+ "subscriptions.updates.updateCount.description.prorata.committed.not_invoiced": "Montant de {{amount}} (avec un minimum engag\xE9 de {{committedCount}}) non factur\xE9 pour la p\xE9riode proratis\xE9e",
8539
+ "subscriptions.updates.updateCount.description.prorata.not_committed.invoiced": "Cette ligne a \xE9t\xE9 factur\xE9e pour la p\xE9riode proratis\xE9e",
8540
+ "subscriptions.updates.updateCount.description.prorata.not_committed.not_invoiced": "Montant de {{amount}} non factur\xE9 pour la p\xE9riode proratis\xE9e",
8541
+ "subscriptions.updates.updatePrices": "Mise \xE0 jour des prix pour {{productName}}"
8542
+ };
8543
+
8544
+ // ../hyperline-i18n/build/locales/it.js
8545
+ var it = {
8546
+ "accounting.revrec.creditLineDescription": "Riconoscere i ricavi \u2013 programma {{scheduleId}}, periodo {{periodDate}}",
8547
+ "accounting.revrec.debitLineDescription": "Diminuzione dei ricavi differiti \u2013 programma {{scheduleId}}, periodo {{periodDate}}",
8548
+ "accounting.revrec.discountCreditLineDescription": "Riconoscere il contra-ricavo (sconto) \u2013 programma {{scheduleId}}, periodo {{periodDate}}",
8549
+ "accounting.revrec.discountDebitLineDescription": "Diminuzione dello sconto differito \u2013 programma {{scheduleId}}, periodo {{periodDate}}",
8550
+ "accounting.revrec.entryDescription": "Riconoscimento dei ricavi per il programma {{scheduleId}}, periodo {{periodStart}} - {{periodEnd}}",
8551
+ "creditNotes.refundChargeName": "Rimborso per fattura",
8552
+ "credits.bundleOf": "{{productName}} - Pacchetto di {{creditCount}} crediti",
8553
+ "credits.unitsOf": "{{productName}} - {{creditCount}} crediti",
8554
+ "einvoicing.paymentFromWallet": "Pagamento dal portafoglio",
8555
+ "einvoicing.paymentProcessed": "Pagamento elaborato",
8556
+ "einvoicing.paymentReceived": "Pagamento ricevuto",
8557
+ "invoices.outstandingProduct.description": "Importo insoluto della fattura{{invoiceNumber}} emessa il {{date}}",
8558
+ "invoices.outstandingProduct.descriptionPeriod": "Importo insoluto della fattura{{invoiceNumber}} dal {{periodStart}} al {{periodEnd}}",
8559
+ "invoices.outstandingProduct.name": "Saldo insoluto",
8560
+ "invoices.prorata.paymentForItem": "Pagamento proporzionale per",
8561
+ "invoices.prorata.refundForItem": "Rimborso proporzionale per",
8562
+ "subscriptions.closingChargeName": "Costo di chiusura per abbonamento",
8563
+ "subscriptions.correction": "Correzione periodo precedente",
8564
+ "subscriptions.updates.addCoupon": "Aggiungi coupon {{couponName}}",
8565
+ "subscriptions.updates.addProduct": "Aggiungi {{productName}}",
8566
+ "subscriptions.updates.removeCoupon": "Rimuovi coupon {{couponName}}",
8567
+ "subscriptions.updates.removeProduct": "Rimuovi {{productName}}",
8568
+ "subscriptions.updates.unit": "unit\xE0",
8569
+ "subscriptions.updates.updateCount": "Aggiorna {{productName}} ({{previousCount}} \u2192 {{newCount}} {{unit}})",
8570
+ "subscriptions.updates.updateCount.description.full.committed.invoiced": "\xC8 stato applicato un minimo impegnato di {{committedCount}} per l\u2019intero periodo.",
8571
+ "subscriptions.updates.updateCount.description.full.committed.not_invoiced": "Importo di {{amount}} (con un minimo impegnato di {{committedCount}}) non fatturato per l\u2019intero periodo",
8572
+ "subscriptions.updates.updateCount.description.full.not_committed.invoiced": "Questa voce \xE8 stata fatturata per l\u2019intero periodo",
8573
+ "subscriptions.updates.updateCount.description.full.not_committed.not_invoiced": "Importo di {{amount}} non fatturato per l\u2019intero periodo",
8574
+ "subscriptions.updates.updateCount.description.prorata.committed.invoiced": "\xC8 stato applicato un minimo impegnato di {{committedCount}}.",
8575
+ "subscriptions.updates.updateCount.description.prorata.committed.not_invoiced": "Importo di {{amount}} (con un minimo impegnato di {{committedCount}}) non fatturato per il periodo proporzionato",
8576
+ "subscriptions.updates.updateCount.description.prorata.not_committed.invoiced": "Questa voce \xE8 stata fatturata per il periodo proporzionato",
8577
+ "subscriptions.updates.updateCount.description.prorata.not_committed.not_invoiced": "Importo di {{amount}} non fatturato per il periodo proporzionato",
8578
+ "subscriptions.updates.updatePrices": "Aggiorna prezzi per {{productName}}"
8579
+ };
8580
+
8581
+ // ../hyperline-i18n/build/locales/nl.js
8582
+ var nl = {
8583
+ "accounting.revrec.creditLineDescription": "Omzet erkennen \u2013 schema {{scheduleId}}, periode {{periodDate}}",
8584
+ "accounting.revrec.debitLineDescription": "Uitgestelde omzet verlagen \u2013 schema {{scheduleId}}, periode {{periodDate}}",
8585
+ "accounting.revrec.discountCreditLineDescription": "Omzetvermindering (korting) erkennen \u2013 schema {{scheduleId}}, periode {{periodDate}}",
8586
+ "accounting.revrec.discountDebitLineDescription": "Uitgestelde korting verlagen \u2013 schema {{scheduleId}}, periode {{periodDate}}",
8587
+ "accounting.revrec.entryDescription": "Omzeterkenning voor schema {{scheduleId}}, periode {{periodStart}} - {{periodEnd}}",
8588
+ "creditNotes.refundChargeName": "Terugbetaling voor factuur",
8589
+ "credits.bundleOf": "{{productName}} - Bundel van {{creditCount}} credits",
8590
+ "credits.unitsOf": "{{productName}} - {{creditCount}} credits",
8591
+ "einvoicing.paymentFromWallet": "Betaling uit tegoed",
8592
+ "einvoicing.paymentProcessed": "Betaling verwerkt",
8593
+ "einvoicing.paymentReceived": "Betaling ontvangen",
8594
+ "invoices.outstandingProduct.description": "Onbetaald bedrag van de factuur{{invoiceNumber}} uitgegeven op {{date}}",
8595
+ "invoices.outstandingProduct.descriptionPeriod": "Onbetaald bedrag van de factuur{{invoiceNumber}} van {{periodStart}} tot {{periodEnd}}",
8596
+ "invoices.outstandingProduct.name": "Openstaand saldo",
8597
+ "invoices.prorata.paymentForItem": "Gedeeltelijke betaling voor",
8598
+ "invoices.prorata.refundForItem": "Gedeeltelijke terugbetaling voor",
8599
+ "subscriptions.closingChargeName": "Afsluitkosten voor abonnement",
8600
+ "subscriptions.correction": "Aanpassing vorige periode",
8601
+ "subscriptions.updates.addCoupon": "Coupon toevoegen {{couponName}}",
8602
+ "subscriptions.updates.addProduct": "{{productName}} toevoegen",
8603
+ "subscriptions.updates.removeCoupon": "Coupon verwijderen {{couponName}}",
8604
+ "subscriptions.updates.removeProduct": "{{productName}} verwijderen",
8605
+ "subscriptions.updates.unit": "eenheden",
8606
+ "subscriptions.updates.updateCount": "Bijwerken {{productName}} aantal ({{previousCount}} \u2192 {{newCount}} {{unit}})",
8607
+ "subscriptions.updates.updateCount.description.full.committed.invoiced": "Een minimaal toegezegd aantal van {{committedCount}} is toegepast voor de volledige periode.",
8608
+ "subscriptions.updates.updateCount.description.full.committed.not_invoiced": "Bedrag van {{amount}} (met een minimaal toegezegd aantal van {{committedCount}}) niet gefactureerd voor de volledige periode",
8609
+ "subscriptions.updates.updateCount.description.full.not_committed.invoiced": "Deze regel is gefactureerd voor de volledige periode",
8610
+ "subscriptions.updates.updateCount.description.full.not_committed.not_invoiced": "Bedrag van {{amount}} niet gefactureerd voor de volledige periode",
8611
+ "subscriptions.updates.updateCount.description.prorata.committed.invoiced": "Een minimaal toegezegd aantal van {{committedCount}} is toegepast.",
8612
+ "subscriptions.updates.updateCount.description.prorata.committed.not_invoiced": "Bedrag van {{amount}} (met een minimaal toegezegd aantal van {{committedCount}}) niet gefactureerd voor de geproportioneerde periode",
8613
+ "subscriptions.updates.updateCount.description.prorata.not_committed.invoiced": "Deze regel is gefactureerd voor de geproportioneerde periode",
8614
+ "subscriptions.updates.updateCount.description.prorata.not_committed.not_invoiced": "Bedrag van {{amount}} niet gefactureerd voor de geproportioneerde periode",
8615
+ "subscriptions.updates.updatePrices": "Prijzen bijwerken voor {{productName}}"
8616
+ };
8617
+
8618
+ // ../hyperline-i18n/build/locales/pl.js
8619
+ var pl = {
8620
+ "accounting.revrec.creditLineDescription": "Rozpoznanie przychodu \u2013 harmonogram {{scheduleId}}, okres {{periodDate}}",
8621
+ "accounting.revrec.debitLineDescription": "Zmniejszenie przychod\xF3w przysz\u0142ych okres\xF3w \u2013 harmonogram {{scheduleId}}, okres {{periodDate}}",
8622
+ "accounting.revrec.discountCreditLineDescription": "Rozpoznanie kontra-przychodu (rabat) \u2013 harmonogram {{scheduleId}}, okres {{periodDate}}",
8623
+ "accounting.revrec.discountDebitLineDescription": "Zmniejszenie odroczonego rabatu \u2013 harmonogram {{scheduleId}}, okres {{periodDate}}",
8624
+ "accounting.revrec.entryDescription": "Rozpoznanie przychodu dla harmonogramu {{scheduleId}}, okres {{periodStart}} - {{periodEnd}}",
8625
+ "creditNotes.refundChargeName": "Zwrot za faktur\u0119",
8626
+ "credits.bundleOf": "{{productName}} - Pakiet {{creditCount}} kredyt\xF3w",
8627
+ "credits.unitsOf": "{{productName}} - {{creditCount}} kredyt\xF3w",
8628
+ "einvoicing.paymentFromWallet": "P\u0142atno\u015B\u0107 z portfela",
8629
+ "einvoicing.paymentProcessed": "P\u0142atno\u015B\u0107 przetworzona",
8630
+ "einvoicing.paymentReceived": "P\u0142atno\u015B\u0107 otrzymana",
8631
+ "invoices.outstandingProduct.description": "Nieop\u0142acona kwota z faktury{{invoiceNumber}} wystawionej {{date}}",
8632
+ "invoices.outstandingProduct.descriptionPeriod": "Nieop\u0142acona kwota z faktury{{invoiceNumber}} od {{periodStart}} do {{periodEnd}}",
8633
+ "invoices.outstandingProduct.name": "Niezap\u0142acone saldo",
8634
+ "invoices.prorata.paymentForItem": "P\u0142atno\u015B\u0107 proporcjonalna za",
8635
+ "invoices.prorata.refundForItem": "Zwrot proporcjonalny za",
8636
+ "subscriptions.closingChargeName": "Op\u0142ata za zamkni\u0119cie subskrypcji",
8637
+ "subscriptions.correction": "Korekta poprzedniego okresu",
8638
+ "subscriptions.updates.addCoupon": "Dodaj kupon {{couponName}}",
8639
+ "subscriptions.updates.addProduct": "Dodaj {{productName}}",
8640
+ "subscriptions.updates.removeCoupon": "Usu\u0144 kupon {{couponName}}",
8641
+ "subscriptions.updates.removeProduct": "Usu\u0144 {{productName}}",
8642
+ "subscriptions.updates.unit": "jednostki",
8643
+ "subscriptions.updates.updateCount": "Aktualizuj {{productName}} liczba ({{previousCount}} \u2192 {{newCount}} {{unit}})",
8644
+ "subscriptions.updates.updateCount.description.full.committed.invoiced": "Zastosowano minimaln\u0105 zobowi\u0105zan\u0105 ilo\u015B\u0107 {{committedCount}} za pe\u0142ny okres.",
8645
+ "subscriptions.updates.updateCount.description.full.committed.not_invoiced": "Kwota {{amount}} (z minimaln\u0105 zobowi\u0105zan\u0105 ilo\u015Bci\u0105 {{committedCount}}) niefakturowana za pe\u0142ny okres",
8646
+ "subscriptions.updates.updateCount.description.full.not_committed.invoiced": "Ta pozycja zosta\u0142a zafakturowana za pe\u0142ny okres",
8647
+ "subscriptions.updates.updateCount.description.full.not_committed.not_invoiced": "Kwota {{amount}} niefakturowana za pe\u0142ny okres",
8648
+ "subscriptions.updates.updateCount.description.prorata.committed.invoiced": "Zastosowano minimaln\u0105 zobowi\u0105zan\u0105 ilo\u015B\u0107 {{committedCount}}.",
8649
+ "subscriptions.updates.updateCount.description.prorata.committed.not_invoiced": "Kwota {{amount}} (z minimaln\u0105 zobowi\u0105zan\u0105 ilo\u015Bci\u0105 {{committedCount}}) niefakturowana za okres proporcjonalny",
8650
+ "subscriptions.updates.updateCount.description.prorata.not_committed.invoiced": "Ta pozycja zosta\u0142a zafakturowana za okres proporcjonalny",
8651
+ "subscriptions.updates.updateCount.description.prorata.not_committed.not_invoiced": "Kwota {{amount}} niefakturowana za okres proporcjonalny",
8652
+ "subscriptions.updates.updatePrices": "Aktualizuj ceny dla {{productName}}"
8653
+ };
8654
+
8655
+ // ../hyperline-i18n/build/locales/pt.js
8656
+ var pt = {
8657
+ "accounting.revrec.creditLineDescription": "Reconhecer receita \u2013 cronograma {{scheduleId}}, per\xEDodo {{periodDate}}",
8658
+ "accounting.revrec.debitLineDescription": "Diminui\xE7\xE3o da receita diferida \u2013 cronograma {{scheduleId}}, per\xEDodo {{periodDate}}",
8659
+ "accounting.revrec.discountCreditLineDescription": "Reconhecer contra-receita (desconto) \u2013 cronograma {{scheduleId}}, per\xEDodo {{periodDate}}",
8660
+ "accounting.revrec.discountDebitLineDescription": "Diminui\xE7\xE3o do desconto diferido \u2013 cronograma {{scheduleId}}, per\xEDodo {{periodDate}}",
8661
+ "accounting.revrec.entryDescription": "Reconhecimento de receita para o cronograma {{scheduleId}}, per\xEDodo {{periodStart}} - {{periodEnd}}",
8662
+ "creditNotes.refundChargeName": "Reembolso pela fatura",
8663
+ "credits.bundleOf": "{{productName}} - Pacote de {{creditCount}} cr\xE9ditos",
8664
+ "credits.unitsOf": "{{productName}} - {{creditCount}} cr\xE9ditos",
8665
+ "einvoicing.paymentFromWallet": "Pagamento da carteira",
8666
+ "einvoicing.paymentProcessed": "Pagamento processado",
8667
+ "einvoicing.paymentReceived": "Pagamento recebido",
8668
+ "invoices.outstandingProduct.description": "Valor em aberto da fatura{{invoiceNumber}} emitida em {{date}}",
8669
+ "invoices.outstandingProduct.descriptionPeriod": "Valor em aberto da fatura{{invoiceNumber}} de {{periodStart}} a {{periodEnd}}",
8670
+ "invoices.outstandingProduct.name": "Saldo em aberto",
8671
+ "invoices.prorata.paymentForItem": "Pagamento proporcional por",
8672
+ "invoices.prorata.refundForItem": "Reembolso proporcional por",
8673
+ "subscriptions.closingChargeName": "Taxa de encerramento da assinatura",
8674
+ "subscriptions.correction": "Ajuste do per\xEDodo anterior",
8675
+ "subscriptions.updates.addCoupon": "Adicionar cupom {{couponName}}",
8676
+ "subscriptions.updates.addProduct": "Adicionar {{productName}}",
8677
+ "subscriptions.updates.removeCoupon": "Remover cupom {{couponName}}",
8678
+ "subscriptions.updates.removeProduct": "Remover {{productName}}",
8679
+ "subscriptions.updates.unit": "unidades",
8680
+ "subscriptions.updates.updateCount": "Atualizar {{productName}} quantidade ({{previousCount}} \u2192 {{newCount}} {{unit}})",
8681
+ "subscriptions.updates.updateCount.description.full.committed.invoiced": "Foi aplicado um m\xEDnimo comprometido de {{committedCount}} para o per\xEDodo completo.",
8682
+ "subscriptions.updates.updateCount.description.full.committed.not_invoiced": "Valor de {{amount}} (com um m\xEDnimo comprometido de {{committedCount}}) n\xE3o faturado para o per\xEDodo completo",
8683
+ "subscriptions.updates.updateCount.description.full.not_committed.invoiced": "Esta linha foi faturada para o per\xEDodo completo",
8684
+ "subscriptions.updates.updateCount.description.full.not_committed.not_invoiced": "Valor de {{amount}} n\xE3o faturado para o per\xEDodo completo",
8685
+ "subscriptions.updates.updateCount.description.prorata.committed.invoiced": "Foi aplicado um m\xEDnimo comprometido de {{committedCount}}.",
8686
+ "subscriptions.updates.updateCount.description.prorata.committed.not_invoiced": "Valor de {{amount}} (com um m\xEDnimo comprometido de {{committedCount}}) n\xE3o faturado para o per\xEDodo proporcional",
8687
+ "subscriptions.updates.updateCount.description.prorata.not_committed.invoiced": "Esta linha foi faturada para o per\xEDodo proporcional",
8688
+ "subscriptions.updates.updateCount.description.prorata.not_committed.not_invoiced": "Valor de {{amount}} n\xE3o faturado para o per\xEDodo proporcional",
8689
+ "subscriptions.updates.updatePrices": "Atualizar pre\xE7os para {{productName}}"
8690
+ };
8691
+
8692
+ // ../hyperline-i18n/build/language.js
8693
+ var LanguageSchema = z5.enum(languages.map((language) => language.isoCode));
8694
+ var translations = {
8695
+ en,
8696
+ fr,
8697
+ de,
8698
+ it,
8699
+ nl,
8700
+ es,
8701
+ pt,
8702
+ pl
8703
+ };
8704
+ i18next.init({
8705
+ fallbackLng: "en",
8706
+ keySeparator: false,
8707
+ resources: Object.fromEntries(Object.entries(translations).map(([isoCode, translation]) => [
8708
+ isoCode,
8709
+ { translation }
8710
+ // "translation" is used as namespace name
8711
+ ]))
8712
+ });
8713
+
8714
+ // ../hyperline-i18n/build/locale.js
8715
+ import { z as z6 } from "zod";
8716
+ var LocaleSchema = z6.string().refine((value) => {
8717
+ const [language, country] = value.split("-");
8718
+ return LanguageSchema.safeParse(language).success && z6.string().length(2).refine((value2) => value2 === value2.toUpperCase()).safeParse(country).success;
8719
+ }, { message: "Invalid locale format" });
8720
+
8721
+ // ../hyperline-i18n/build/timezone.js
8722
+ import { getTimezones } from "@hyperline/shared";
8723
+ import { z as z7 } from "zod";
8724
+ var TimezoneSchema = z7.enum(getTimezones().map((timezone) => timezone.name));
8725
+
7889
8726
  // ../hyperline-lib/build/http/helpers/request.js
7890
- import { isValidLanguage } from "@hyperline/i18n";
7891
- import { z as z4 } from "zod";
8727
+ import { z as z8 } from "zod";
7892
8728
 
7893
8729
  // ../hyperline-lib/build/http/middlewares/distributedRateLimiter.js
7894
- import { logger as logger2 } from "@hyperline/monitoring";
7895
8730
  import { RateLimiterRedis, RateLimiterRes } from "rate-limiter-flexible";
7896
8731
 
7897
8732
  // ../hyperline-lib/build/http/middlewares/httpErrorHandler.js
@@ -7901,7 +8736,6 @@ import { ZodError as ZodError3 } from "zod";
7901
8736
  // ../hyperline-lib/build/http/middlewares/idempotency.js
7902
8737
  import { createHash as createHash2 } from "node:crypto";
7903
8738
  import { isDeepStrictEqual } from "node:util";
7904
- import { logger as logger3 } from "@hyperline/monitoring";
7905
8739
  import { idempotency } from "express-idempotency";
7906
8740
 
7907
8741
  // ../hyperline-lib/build/http/middlewares/httpErrorHandler.js
@@ -7910,15 +8744,11 @@ var isProduction = ["production", "sandbox"].includes(
7910
8744
  process.env.NODE_ENV ?? "production"
7911
8745
  );
7912
8746
 
7913
- // ../hyperline-lib/build/http/helpers/clientIp.js
7914
- import { logger as logger4 } from "@hyperline/monitoring";
7915
-
7916
8747
  // ../hyperline-lib/build/httpClient/error.js
7917
8748
  import axios from "axios";
7918
8749
  var isAxiosError = axios.isAxiosError;
7919
8750
 
7920
8751
  // ../hyperline-lib/build/httpClient/httpClient.js
7921
- import { logHttpRequest, logHttpResponse } from "@hyperline/monitoring";
7922
8752
  import axios2 from "axios";
7923
8753
  import axiosRetry, { isNetworkOrIdempotentRequestError } from "axios-retry";
7924
8754
  import { AxiosError } from "axios";
@@ -7930,13 +8760,13 @@ var recommendedRetryConfig = {
7930
8760
  retryDelay: axiosRetry.exponentialDelay
7931
8761
  };
7932
8762
  function buildHttpClient(dependencies) {
7933
- const { logger: logger6, config, retry } = dependencies;
7934
- const client = axios2.create(config);
8763
+ const { logger: logger2, config: config2, retry } = dependencies;
8764
+ const client = axios2.create(config2);
7935
8765
  if (retry !== "none") {
7936
8766
  axiosRetry(client, {
7937
8767
  ...dependencies.retry === "custom" ? dependencies.retryConfig : dependencies.retry === "recommended" ? recommendedRetryConfig : {},
7938
8768
  onRetry(retryCount, error, requestConfig) {
7939
- logHttpRequest(logger6, toLogRequest(requestConfig), {
8769
+ logHttpRequest(logger2, toLogRequest(requestConfig), {
7940
8770
  postfix: `[EXTERNAL] (attempt ${retryCount})`,
7941
8771
  metadata: {
7942
8772
  // biome-ignore lint/correctness/useParseIntRadix: ignore
@@ -7948,7 +8778,7 @@ function buildHttpClient(dependencies) {
7948
8778
  });
7949
8779
  }
7950
8780
  client.interceptors.request.use((requestConfig) => {
7951
- logHttpRequest(logger6, toLogRequest(requestConfig), {
8781
+ logHttpRequest(logger2, toLogRequest(requestConfig), {
7952
8782
  postfix: "[EXTERNAL]"
7953
8783
  });
7954
8784
  requestConfig.metadata = { timeStart: /* @__PURE__ */ new Date() };
@@ -7960,14 +8790,14 @@ function buildHttpClient(dependencies) {
7960
8790
  const { config: responseConfig, status } = response;
7961
8791
  const timeStart = responseConfig.metadata.timeStart;
7962
8792
  const responseTime = timeStart ? Date.now() - timeStart : void 0;
7963
- logHttpResponse(logger6, { request: toLogRequest(responseConfig), statusCode: status }, responseTime);
8793
+ logHttpResponse(logger2, { request: toLogRequest(responseConfig), statusCode: status }, responseTime);
7964
8794
  return response;
7965
8795
  }, (error) => {
7966
8796
  if (error.response) {
7967
8797
  const { config: responseConfig, status } = error.response;
7968
8798
  const timeStart = responseConfig.metadata.timeStart;
7969
8799
  const responseTime = timeStart ? Date.now() - timeStart : void 0;
7970
- logHttpResponse(logger6, { request: toLogRequest(responseConfig), statusCode: status }, responseTime, { metadata: { error: error.message } });
8800
+ logHttpResponse(logger2, { request: toLogRequest(responseConfig), statusCode: status }, responseTime, { metadata: { error: error.message } });
7971
8801
  }
7972
8802
  return Promise.reject(error);
7973
8803
  });
@@ -7976,20 +8806,19 @@ function buildHttpClient(dependencies) {
7976
8806
  function isTooManyRequestsError(error) {
7977
8807
  return error.response?.status === 429;
7978
8808
  }
7979
- var toLogRequest = (config) => {
8809
+ var toLogRequest = (config2) => {
7980
8810
  return {
7981
- method: config.method ?? "",
7982
- url: config.url ?? "",
7983
- path: config.url ?? "",
7984
- hostname: config.baseURL ?? "",
7985
- originalUrl: `${config.baseURL}${config.url}`,
7986
- body: config.data,
8811
+ method: config2.method ?? "",
8812
+ url: config2.url ?? "",
8813
+ path: config2.url ?? "",
8814
+ hostname: config2.baseURL ?? "",
8815
+ originalUrl: `${config2.baseURL}${config2.url}`,
8816
+ body: config2.data,
7987
8817
  headers: {}
7988
8818
  };
7989
8819
  };
7990
8820
 
7991
8821
  // ../hyperline-lib/build/httpRouter/express.js
7992
- import { runWithExecutionContext } from "@hyperline/monitoring";
7993
8822
  import { OpenAPIRegistry as OpenAPIRegistry2, OpenApiGeneratorV31 } from "@asteasolutions/zod-to-openapi";
7994
8823
  import { Router as ExpressRouter } from "express";
7995
8824
  import multer2 from "multer";
@@ -8066,12 +8895,11 @@ import { McpServer } from "@modelcontextprotocol/sdk/server/mcp.js";
8066
8895
  import { createHmac } from "node:crypto";
8067
8896
 
8068
8897
  // ../hyperline-mcp/build/session/sessionManager.js
8069
- import { logger as logger5 } from "@hyperline/monitoring";
8070
8898
  import { LRUCache } from "lru-cache";
8071
8899
 
8072
8900
  // build/output.js
8073
- function formatOutput({ data, format: format2 }) {
8074
- if (format2 === "json") {
8901
+ function formatOutput({ data, format: format3 }) {
8902
+ if (format3 === "json") {
8075
8903
  return JSON.stringify(data, null, 2);
8076
8904
  }
8077
8905
  return formatText(data);
@@ -8112,7 +8940,7 @@ ${formatText(value, indent + 2)}`;
8112
8940
  }
8113
8941
 
8114
8942
  // build/http.js
8115
- function createCLIContext({ apiKey, baseUrl, outputFormat, source }) {
8943
+ function createCLIContext({ apiKey, baseUrl, outputFormat, source, companyId }) {
8116
8944
  const noop = () => {
8117
8945
  };
8118
8946
  const httpClient = buildHttpClient({
@@ -8138,7 +8966,8 @@ function createCLIContext({ apiKey, baseUrl, outputFormat, source }) {
8138
8966
  params,
8139
8967
  data: hasData ? requestData : void 0,
8140
8968
  headers: {
8141
- "Hyperline-Source": source
8969
+ "Hyperline-Source": source,
8970
+ ...companyId ? { "Hyperline-CompanyId": companyId } : {}
8142
8971
  }
8143
8972
  });
8144
8973
  process.stdout.write(formatOutput({ data: response.data, format: outputFormat }));
@@ -8184,7 +9013,7 @@ function isAxiosError2(error) {
8184
9013
 
8185
9014
  // build/bin/hyperline.js
8186
9015
  var program = new Command();
8187
- program.name("hyperline").description("Agent-first CLI for the Hyperline API").version("0.1.0").option("--api-key <key>", "Hyperline API key (overrides HYPERLINE_API_KEY)").option("--base-url <url>", "API base URL (overrides HYPERLINE_API_URL)").option("--output <format>", "Output format: json or text", "text");
9016
+ program.name("hyperline").description("Agent-first CLI for the Hyperline API").version("0.1.0").option("--api-key <key>", "Hyperline API key (overrides HYPERLINE_API_KEY)").option("--base-url <url>", "API base URL (overrides HYPERLINE_API_URL)").option("--output <format>", "Output format: json or text", "text").option("--company-id <id>", "Company ID (overrides HYPERLINE_COMPANY_ID and stored selection)");
8188
9017
  program.command("login").description("Authenticate with Hyperline via browser").action(async () => {
8189
9018
  const options = program.opts();
8190
9019
  const baseUrl = await resolveBaseUrl({
@@ -8196,10 +9025,63 @@ program.command("logout").description("Clear stored credentials").action(async (
8196
9025
  await clearCredentials();
8197
9026
  process.stdout.write("Logged out.\n");
8198
9027
  });
9028
+ var companyCommand = program.command("company").description("Manage active company");
9029
+ companyCommand.command("select").description("Interactively select the active company").action(async () => {
9030
+ const options = program.opts();
9031
+ const baseUrl = await resolveBaseUrl({
9032
+ flagBaseUrl: options.baseUrl
9033
+ });
9034
+ const apiKey = resolveApiKey({
9035
+ flagApiKey: options.apiKey
9036
+ });
9037
+ const accessToken = apiKey ?? await resolveAccessToken();
9038
+ if (!accessToken) {
9039
+ process.stderr.write("Error: No authentication found. Run: hyperline login\n");
9040
+ process.exit(1);
9041
+ }
9042
+ await promptCompanySelection({ baseUrl, accessToken });
9043
+ });
9044
+ companyCommand.command("set <companyId>").description("Set the active company by ID (for scripts and agents)").action(async (companyId) => {
9045
+ await saveCompanyId({ companyId });
9046
+ process.stdout.write(`Company set to ${companyId}
9047
+ `);
9048
+ });
9049
+ companyCommand.command("list").description("List all accessible companies").action(async () => {
9050
+ const options = program.opts();
9051
+ const baseUrl = await resolveBaseUrl({
9052
+ flagBaseUrl: options.baseUrl
9053
+ });
9054
+ const apiKey = resolveApiKey({
9055
+ flagApiKey: options.apiKey
9056
+ });
9057
+ const accessToken = apiKey ?? await resolveAccessToken();
9058
+ if (!accessToken) {
9059
+ process.stderr.write("Error: No authentication found. Run: hyperline login\n");
9060
+ process.exit(1);
9061
+ }
9062
+ const companies = await fetchCompanies({ baseUrl, accessToken });
9063
+ const currentCompanyId = await resolveCompanyId({});
9064
+ for (const company of companies) {
9065
+ const marker = company.id === currentCompanyId ? " (active)" : "";
9066
+ process.stdout.write(`${company.name} ${company.id}${marker}
9067
+ `);
9068
+ }
9069
+ });
9070
+ companyCommand.command("current").description("Show the currently active company").action(async () => {
9071
+ const companyId = await resolveCompanyId({});
9072
+ if (companyId) {
9073
+ process.stdout.write(`${companyId}
9074
+ `);
9075
+ } else {
9076
+ process.stdout.write("No company selected. Run: hyperline company select\n");
9077
+ }
9078
+ });
8199
9079
  registerAllCommands(program);
9080
+ var selfAuthCommands = /* @__PURE__ */ new Set(["login", "logout", "company"]);
8200
9081
  program.hook("preAction", async (thisCommand, actionCommand) => {
8201
9082
  const commandName = actionCommand.name();
8202
- if (commandName === "login" || commandName === "logout")
9083
+ const parentName = actionCommand.parent?.name();
9084
+ if (selfAuthCommands.has(commandName) || selfAuthCommands.has(parentName ?? ""))
8203
9085
  return;
8204
9086
  const options = program.opts();
8205
9087
  const outputFormat = options.output ?? "text";
@@ -8214,11 +9096,15 @@ program.hook("preAction", async (thisCommand, actionCommand) => {
8214
9096
  const baseUrl = await resolveBaseUrl({
8215
9097
  flagBaseUrl: options.baseUrl
8216
9098
  });
9099
+ const companyId = await resolveCompanyId({
9100
+ flagCompanyId: options.companyId
9101
+ });
8217
9102
  const ctx = createCLIContext({
8218
9103
  apiKey: token,
8219
9104
  baseUrl,
8220
9105
  outputFormat,
8221
- source: apiKey ? "cli" : "cli-oauth"
9106
+ source: apiKey ? "cli" : "cli-oauth",
9107
+ companyId
8222
9108
  });
8223
9109
  thisCommand.setOptionValue("_ctx", ctx);
8224
9110
  });
@@ -0,0 +1,24 @@
1
+ {
2
+ "@asteasolutions/zod-to-openapi": "8.1.0",
3
+ "@hyperline/shared": "0.0.150",
4
+ "@modelcontextprotocol/sdk": "1.25.2",
5
+ "axios": "1.13.2",
6
+ "axios-retry": "4.5.0",
7
+ "commander": "13.1.0",
8
+ "date-fns": "3.6.0",
9
+ "decimal.js": "^10.6.0",
10
+ "dotenv": "16.3.1",
11
+ "express": "5.2.1",
12
+ "express-idempotency": "2.0.0",
13
+ "fast-equals": "5.2.2",
14
+ "helmet": "6.2.0",
15
+ "i18next": "22.5.1",
16
+ "json-prune": "1.1.0",
17
+ "lru-cache": "11.0.2",
18
+ "multer": "1.4.5-lts.1",
19
+ "rate-limiter-flexible": "2.4.2",
20
+ "stacktrace-parser": "0.1.10",
21
+ "uuid": "9.0.1",
22
+ "winston": "3.10.0",
23
+ "zod": "4.1.12"
24
+ }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@hyperline/cli",
3
- "version": "0.1.0-build.1.1064600",
3
+ "version": "0.1.0-build.1.4e4ba70",
4
4
  "description": "Agent-first CLI for Hyperline API",
5
5
  "type": "module",
6
6
  "main": "./dist/index.js",
@@ -22,10 +22,28 @@
22
22
  "typecheck": "tsc -b --emitDeclarationOnly"
23
23
  },
24
24
  "dependencies": {
25
+ "@asteasolutions/zod-to-openapi": "8.1.0",
26
+ "@hyperline/shared": "0.0.150",
27
+ "@modelcontextprotocol/sdk": "1.25.2",
25
28
  "axios": "1.13.2",
26
29
  "axios-retry": "4.5.0",
27
30
  "commander": "13.1.0",
28
- "dotenv": "16.3.1"
31
+ "date-fns": "3.6.0",
32
+ "decimal.js": "^10.6.0",
33
+ "dotenv": "16.3.1",
34
+ "express": "5.2.1",
35
+ "express-idempotency": "2.0.0",
36
+ "fast-equals": "5.2.2",
37
+ "helmet": "6.2.0",
38
+ "i18next": "22.5.1",
39
+ "json-prune": "1.1.0",
40
+ "lru-cache": "11.0.2",
41
+ "multer": "1.4.5-lts.1",
42
+ "rate-limiter-flexible": "2.4.2",
43
+ "stacktrace-parser": "0.1.10",
44
+ "uuid": "9.0.1",
45
+ "winston": "3.10.0",
46
+ "zod": "4.1.12"
29
47
  },
30
48
  "devDependencies": {
31
49
  "@biomejs/biome": "2.3.8",