@hyperline/cli 0.1.0-build.1.dfac129 → 0.1.0-build.1.e058e00

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.
@@ -34894,10 +34894,10 @@ var require_shared = __commonJS({
34894
34894
  ZodId: () => ZodId,
34895
34895
  ZodTranslationsSchemaFn: () => ZodTranslationsSchemaFn
34896
34896
  });
34897
- var import_zod19 = require_lib();
34897
+ var import_zod20 = require_lib();
34898
34898
  var countryIds2 = ["all", ...countries.map(({ id }) => id)];
34899
- var ZodId = import_zod19.z.enum(countryIds2);
34900
- var ZodTranslationsSchemaFn = (schema) => import_zod19.z.record(import_zod19.z.string(), schema.optional());
34899
+ var ZodId = import_zod20.z.enum(countryIds2);
34900
+ var ZodTranslationsSchemaFn = (schema) => import_zod20.z.record(import_zod20.z.string(), schema.optional());
34901
34901
  var UsStates = [
34902
34902
  { id: "AA", name: "Armed Forces Americas" },
34903
34903
  { id: "AE", name: "Armed Forces Europe" },
@@ -38369,10 +38369,10 @@ Examples:
38369
38369
  queryParamKeys: []
38370
38370
  });
38371
38371
  });
38372
- resource.command("create-custom-property").description(`Create a new custom property definition with a name, type (string, number, boolean, date, select), and optional default value.`).requiredOption("--name <value>", `name`).requiredOption("--type <value>", `type`).requiredOption("--slug <value>", `slug`).requiredOption("--entities <value>", `entities`).option("--api-only", `api_only`).option("--authorized-values <value>", `authorized_values`).addHelpText("after", `
38372
+ resource.command("create-custom-property").description(`Create a new custom property definition with a name, type (string, number, boolean, date, select), and optional default value.`).requiredOption("--name <value>", `name`).requiredOption("--type <value>", `type`).requiredOption("--slug <value>", `slug`).requiredOption("--entities <value>", `entities`).option("--api-only", `api_only`).option("--required", `required`).option("--authorized-values <value>", `authorized_values`).addHelpText("after", `
38373
38373
  Examples:
38374
38374
  hyperline custom-properties create-custom-property --name <name> --type <type> --slug <slug> --entities <entities>
38375
- hyperline custom-properties create-custom-property --name <name> --type <type> --slug <slug> --entities <entities> --api-only --authorized-values <authorized_values>
38375
+ hyperline custom-properties create-custom-property --name <name> --type <type> --slug <slug> --entities <entities> --api-only --required
38376
38376
  hyperline custom-properties create-custom-property --name <name> --type <type> --slug <slug> --entities <entities> --output json`).action(async (opts) => {
38377
38377
  const ctx = resource.parent?.opts()._ctx;
38378
38378
  if (!ctx) {
@@ -38392,6 +38392,8 @@ Examples:
38392
38392
  args.authorized_values = opts.authorizedValues;
38393
38393
  if (opts.apiOnly !== void 0)
38394
38394
  args.api_only = true;
38395
+ if (opts.required !== void 0)
38396
+ args.required = true;
38395
38397
  await ctx.execute({
38396
38398
  method: "POST",
38397
38399
  path: "/v1/custom-properties",
@@ -38399,10 +38401,10 @@ Examples:
38399
38401
  queryParamKeys: []
38400
38402
  });
38401
38403
  });
38402
- resource.command("update-custom-property").description(`Update an existing custom property definition by ID.`).requiredOption("--id <value>", `id parameter`).requiredOption("--name <value>", `name`).requiredOption("--type <value>", `type`).requiredOption("--slug <value>", `slug`).requiredOption("--entities <value>", `entities`).option("--api-only", `api_only`).option("--authorized-values <value>", `authorized_values`).addHelpText("after", `
38404
+ resource.command("update-custom-property").description(`Update an existing custom property definition by ID.`).requiredOption("--id <value>", `id parameter`).requiredOption("--name <value>", `name`).requiredOption("--type <value>", `type`).requiredOption("--slug <value>", `slug`).requiredOption("--entities <value>", `entities`).option("--api-only", `api_only`).option("--required", `required`).option("--authorized-values <value>", `authorized_values`).addHelpText("after", `
38403
38405
  Examples:
38404
38406
  hyperline custom-properties update-custom-property --id <id> --name <name> --type <type> --slug <slug> --entities <entities>
38405
- hyperline custom-properties update-custom-property --id <id> --name <name> --type <type> --slug <slug> --entities <entities> --api-only --authorized-values <authorized_values>
38407
+ hyperline custom-properties update-custom-property --id <id> --name <name> --type <type> --slug <slug> --entities <entities> --api-only --required
38406
38408
  hyperline custom-properties update-custom-property --id <id> --name <name> --type <type> --slug <slug> --entities <entities> --output json`).action(async (opts) => {
38407
38409
  const ctx = resource.parent?.opts()._ctx;
38408
38410
  if (!ctx) {
@@ -38424,6 +38426,8 @@ Examples:
38424
38426
  args.authorized_values = opts.authorizedValues;
38425
38427
  if (opts.apiOnly !== void 0)
38426
38428
  args.api_only = true;
38429
+ if (opts.required !== void 0)
38430
+ args.required = true;
38427
38431
  await ctx.execute({
38428
38432
  method: "PUT",
38429
38433
  path: "/v1/custom-properties/{id}",
@@ -38781,7 +38785,7 @@ Customer type.
38781
38785
 
38782
38786
  - \`taxable\`: Taxes are automatically determined for the customer.
38783
38787
  - \`exempt\`: The customer is exempt from tax.
38784
- `).option("--registration-number <value>", `Customer registration number.`).option("--external-id <value>", `ID of the customer in your system. This helps matching your customer with the one on Hyperline.`).option("--invoicing-entity-id <value>", `ID of the invoicing entity this customer will be attached to.`).option("--billing-address <value>", `Customer billing address.`).option("--shipping-address <value>", `Customer shipping address.`).option("--billing-email <value>", `Email to which all communications will be sent.`).option("--invoice-emails <value>", `Emails to which invoices will be sent (e.g. payer, finance team, accounting firm). If not defined, invoices will be sent to the \`billing_email\`; otherwise, they won't be sent to the \`billing_email\`.`).option("--language <value>", `Language used for invoices, emails, and hosted pages.`).option("--timezone <value>", `Customer timezone.`).option("--available-payment-methods <value>", `List of payment methods you allow your customer to pay with. You customer will be able to select one of them in their portal page and those will be the default options when creating a checkout session.`).option("--payment-method-type <value>", `Default payment method type used to pay subscriptions and one-off invoices.`).option("--bank-account <value>", `Custom bank account for the customer. If not defined and customer paying by bank transfer, the bank accounts configured in your account settings will be used.`).option("--custom-payment-delay <number>", `Custom payment terms in days. If not defined, the default one defined on the related invoicing entity will be used.`).option("--custom-payment-initiation-delay <number>", `Custom initiation delay in days before triggering payment. If not defined, the default one defined on the related invoicing entity will be used.`).option("--organisation-id <value>", `Parent organization ID to which the client is attached.`).option("--organisation-invoicing <value>", `
38788
+ `).option("--registration-number <value>", `Customer registration number.`).option("--external-id <value>", `ID of the customer in your system. This helps matching your customer with the one on Hyperline.`).option("--domain <value>", `Customer domain. If not defined, it is inferred from the billing email.`).option("--invoicing-entity-id <value>", `ID of the invoicing entity this customer will be attached to.`).option("--billing-address <value>", `Customer billing address.`).option("--shipping-address <value>", `Customer shipping address.`).option("--billing-email <value>", `Email to which all communications will be sent.`).option("--invoice-emails <value>", `Emails to which invoices will be sent (e.g. payer, finance team, accounting firm). If not defined, invoices will be sent to the \`billing_email\`; otherwise, they won't be sent to the \`billing_email\`.`).option("--language <value>", `Language used for invoices, emails, and hosted pages.`).option("--timezone <value>", `Customer timezone.`).option("--available-payment-methods <value>", `List of payment methods you allow your customer to pay with. You customer will be able to select one of them in their portal page and those will be the default options when creating a checkout session.`).option("--payment-method-type <value>", `Default payment method type used to pay subscriptions and one-off invoices.`).option("--bank-account <value>", `Custom bank account for the customer. If not defined and customer paying by bank transfer, the bank accounts configured in your account settings will be used.`).option("--custom-payment-delay <number>", `Custom payment terms in days. If not defined, the default one defined on the related invoicing entity will be used.`).option("--custom-payment-initiation-delay <number>", `Custom initiation delay in days before triggering payment. If not defined, the default one defined on the related invoicing entity will be used.`).option("--organisation-id <value>", `Parent organization ID to which the client is attached.`).option("--organisation-invoicing <value>", `
38785
38789
  How customer invoices are issued from the parent organisation.
38786
38790
 
38787
38791
  - \`none\`: Invoices will keep being issued from this customer.
@@ -38812,6 +38816,8 @@ Examples:
38812
38816
  args.registration_number = opts.registrationNumber;
38813
38817
  if (opts.externalId !== void 0)
38814
38818
  args.external_id = opts.externalId;
38819
+ if (opts.domain !== void 0)
38820
+ args.domain = opts.domain;
38815
38821
  if (opts.invoicingEntityId !== void 0)
38816
38822
  args.invoicing_entity_id = opts.invoicingEntityId;
38817
38823
  if (opts.billingAddress !== void 0)
@@ -38910,7 +38916,7 @@ Customer type.
38910
38916
 
38911
38917
  - \`taxable\`: Taxes are automatically determined for the customer.
38912
38918
  - \`exempt\`: The customer is exempt from tax.
38913
- `).option("--registration-number <value>", `Customer registration number.`).option("--is-government-affiliated", `Indicates if the customer is affiliated with a government entity.`).option("--external-id <value>", `ID of the customer in your system. This helps matching your customer with the one on Hyperline.`).option("--invoicing-entity-id <value>", `ID of the invoicing entity this customer will be attached to.`).option("--billing-address <value>", `Customer billing address.`).option("--shipping-address <value>", `Customer shipping address.`).option("--billing-email <value>", `Email to which all communications will be sent.`).option("--invoice-emails <value>", `Emails to which invoices will be sent (e.g. payer, finance team, accounting firm). If not defined, invoices will be sent to the \`billing_email\`; otherwise, they won't be sent to the \`billing_email\`.`).option("--language <value>", `Language used for invoices, emails, and hosted pages.`).option("--timezone <value>", `Customer timezone.`).option("--available-payment-methods <value>", `List of payment methods you allow your customer to pay with. You customer will be able to select one of them in their portal page and those will be the default options when creating a checkout session.`).option("--payment-method-type <value>", `Default payment method type used to pay subscriptions and one-off invoices.`).option("--payment-method-id <value>", `ID of the default payment method of the customer. Only applies to card and direct debit.`).option("--bank-account <value>", `Custom bank account for the customer. If not defined and customer paying by bank transfer, the bank accounts configured in your account settings will be used.`).option("--custom-payment-delay <number>", `Custom payment terms in days. If not defined, the default one defined on the related invoicing entity will be used.`).option("--custom-payment-initiation-delay <number>", `Custom initiation delay in days before triggering payment. If not defined, the default one defined on the related invoicing entity will be used.`).option("--organisation-id <value>", `Parent organization ID to which the client is attached.`).option("--organisation-invoicing <value>", `
38919
+ `).option("--registration-number <value>", `Customer registration number.`).option("--is-government-affiliated", `Indicates if the customer is affiliated with a government entity.`).option("--external-id <value>", `ID of the customer in your system. This helps matching your customer with the one on Hyperline.`).option("--domain <value>", `Customer domain. If not defined, it is inferred from the billing email.`).option("--invoicing-entity-id <value>", `ID of the invoicing entity this customer will be attached to.`).option("--billing-address <value>", `Customer billing address.`).option("--shipping-address <value>", `Customer shipping address.`).option("--billing-email <value>", `Email to which all communications will be sent.`).option("--invoice-emails <value>", `Emails to which invoices will be sent (e.g. payer, finance team, accounting firm). If not defined, invoices will be sent to the \`billing_email\`; otherwise, they won't be sent to the \`billing_email\`.`).option("--language <value>", `Language used for invoices, emails, and hosted pages.`).option("--timezone <value>", `Customer timezone.`).option("--available-payment-methods <value>", `List of payment methods you allow your customer to pay with. You customer will be able to select one of them in their portal page and those will be the default options when creating a checkout session.`).option("--payment-method-type <value>", `Default payment method type used to pay subscriptions and one-off invoices.`).option("--payment-method-id <value>", `ID of the default payment method of the customer. Only applies to card and direct debit.`).option("--bank-account <value>", `Custom bank account for the customer. If not defined and customer paying by bank transfer, the bank accounts configured in your account settings will be used.`).option("--custom-payment-delay <number>", `Custom payment terms in days. If not defined, the default one defined on the related invoicing entity will be used.`).option("--custom-payment-initiation-delay <number>", `Custom initiation delay in days before triggering payment. If not defined, the default one defined on the related invoicing entity will be used.`).option("--organisation-id <value>", `Parent organization ID to which the client is attached.`).option("--organisation-invoicing <value>", `
38914
38920
  How customer invoices are issued from the parent organisation.
38915
38921
 
38916
38922
  - \`none\`: Invoices will keep being issued from this customer.
@@ -38943,6 +38949,8 @@ Examples:
38943
38949
  args.registration_number = opts.registrationNumber;
38944
38950
  if (opts.externalId !== void 0)
38945
38951
  args.external_id = opts.externalId;
38952
+ if (opts.domain !== void 0)
38953
+ args.domain = opts.domain;
38946
38954
  if (opts.invoicingEntityId !== void 0)
38947
38955
  args.invoicing_entity_id = opts.invoicingEntityId;
38948
38956
  if (opts.billingAddress !== void 0)
@@ -39112,6 +39120,38 @@ Examples:
39112
39120
  queryParamKeys: []
39113
39121
  });
39114
39122
  });
39123
+ resource.command("get-customer-arr-history").description(`List every subscription-level ARR evolution for a customer, including previous and current fixed, variable, and total annual values in each subscription currency. Results are latest-first and paginated with limit/cursor.`).requiredOption("--id <value>", `id parameter`).option("--limit <number>", `Maximum number of items to return (1-100).`).option("--cursor <value>", `Opaque cursor returned in the previous response's \`next_cursor\`. Omit to fetch the first page.`).option("--occurred-at.gte <value>", `Return evolutions that occurred at or after this UTC date and time.`).option("--occurred-at.lte <value>", `Return evolutions that occurred at or before this UTC date and time.`).addHelpText("after", `
39124
+ Examples:
39125
+ hyperline customers get-customer-arr-history --id <id>
39126
+ hyperline customers get-customer-arr-history --id <id> --limit <limit> --cursor <cursor>`).action(async (opts) => {
39127
+ const ctx = resource.parent?.opts()._ctx;
39128
+ if (!ctx) {
39129
+ process.stderr.write("Error: Not authenticated\n");
39130
+ process.exit(1);
39131
+ }
39132
+ const args = {};
39133
+ if (opts.id !== void 0)
39134
+ args.id = opts.id;
39135
+ if (opts.cursor !== void 0)
39136
+ args.cursor = opts.cursor;
39137
+ if (opts["occurredAt.gte"] !== void 0)
39138
+ args.occurred_at__gte = opts["occurredAt.gte"];
39139
+ if (opts["occurredAt.lte"] !== void 0)
39140
+ args.occurred_at__lte = opts["occurredAt.lte"];
39141
+ if (opts.limit !== void 0)
39142
+ args.limit = Number(opts.limit);
39143
+ await ctx.execute({
39144
+ method: "GET",
39145
+ path: "/v1/customers/{id}/arr-history",
39146
+ args,
39147
+ queryParamKeys: [
39148
+ "limit",
39149
+ "cursor",
39150
+ "occurred_at__gte",
39151
+ "occurred_at__lte"
39152
+ ]
39153
+ });
39154
+ });
39115
39155
  resource.command("get-customer-valuation").description(`Compute aggregated valuation metrics for a customer across all active subscriptions, grouped by currency. Returns contract value, recurring contract value, and ARR for each subscription and aggregated totals. Optionally pass granularity (year/quarter/month) for period breakdown.`).requiredOption("--id <value>", `id parameter`).option("--granularity <value>", `Period granularity for the breakdown. When provided, contract value and recurring contract value include a \`by_period\` array.`).addHelpText("after", `
39116
39156
  Examples:
39117
39157
  hyperline customers get-customer-valuation --id <id>
@@ -40465,7 +40505,7 @@ Examples:
40465
40505
  queryParamKeys: []
40466
40506
  });
40467
40507
  });
40468
- resource.command("update").description(`Update an invoice. Draft/grace_period allow modifying line items, dates, and metadata before finalization. Finalized invoices are restricted to metadata (paid: custom_note; uncollectible: properties/custom_note/custom_properties).`).requiredOption("--id <value>", `id parameter`).option("--type <value>", `Type of the invoice.
40508
+ resource.command("update").description(`Update an invoice. Draft/grace_period allow modifying line items, dates, and metadata before finalization. Finalized invoices are restricted to metadata (paid: custom_note/purchase_order; uncollectible: properties/custom_note/custom_properties).`).requiredOption("--id <value>", `id parameter`).option("--type <value>", `Type of the invoice.
40469
40509
 
40470
40510
  - \`invoice\`: Legal invoice to be paid by your customer.
40471
40511
  - \`credit_note\`: Legal credit note cancelling an invoice and refunding your customer.
@@ -41421,6 +41461,32 @@ Examples:
41421
41461
  queryParamKeys: []
41422
41462
  });
41423
41463
  });
41464
+ resource.command("delete").description(`Permanently delete an archived product by ID. Products attached to subscriptions, plans, or templates cannot be deleted.`).requiredOption("--id <value>", `id parameter`).option("--yes", "Skip confirmation").addHelpText("after", `
41465
+ Examples:
41466
+ hyperline products delete --id <id>
41467
+ hyperline products delete --id <id> --output json`).action(async (opts) => {
41468
+ const ctx = resource.parent?.opts()._ctx;
41469
+ if (!ctx) {
41470
+ process.stderr.write("Error: Not authenticated\n");
41471
+ process.exit(1);
41472
+ }
41473
+ const args = {};
41474
+ if (opts.id !== void 0)
41475
+ args.id = opts.id;
41476
+ if (!opts.yes) {
41477
+ const confirmed = await confirmPrompt("Are you sure? Pass --yes to skip. [y/N] ");
41478
+ if (!confirmed) {
41479
+ process.stdout.write("Aborted.\n");
41480
+ return;
41481
+ }
41482
+ }
41483
+ await ctx.execute({
41484
+ method: "DELETE",
41485
+ path: "/v1/products/{id}",
41486
+ args,
41487
+ queryParamKeys: []
41488
+ });
41489
+ });
41424
41490
  resource.command("unarchive").description(`Restore a previously archived product, making it available for new subscriptions again.`).requiredOption("--id <value>", `id parameter`).addHelpText("after", `
41425
41491
  Examples:
41426
41492
  hyperline products unarchive --id <id>
@@ -42761,6 +42827,38 @@ Examples:
42761
42827
  queryParamKeys: []
42762
42828
  });
42763
42829
  });
42830
+ resource.command("get-subscription-arr-history").description(`List every ARR evolution for a subscription, including previous and current fixed, variable, and total annual values in the subscription currency. Results are latest-first and paginated with limit/cursor.`).requiredOption("--id <value>", `id parameter`).option("--limit <number>", `Maximum number of items to return (1-100).`).option("--cursor <value>", `Opaque cursor returned in the previous response's \`next_cursor\`. Omit to fetch the first page.`).option("--occurred-at.gte <value>", `Return evolutions that occurred at or after this UTC date and time.`).option("--occurred-at.lte <value>", `Return evolutions that occurred at or before this UTC date and time.`).addHelpText("after", `
42831
+ Examples:
42832
+ hyperline subscriptions get-subscription-arr-history --id <id>
42833
+ hyperline subscriptions get-subscription-arr-history --id <id> --limit <limit> --cursor <cursor>`).action(async (opts) => {
42834
+ const ctx = resource.parent?.opts()._ctx;
42835
+ if (!ctx) {
42836
+ process.stderr.write("Error: Not authenticated\n");
42837
+ process.exit(1);
42838
+ }
42839
+ const args = {};
42840
+ if (opts.id !== void 0)
42841
+ args.id = opts.id;
42842
+ if (opts.cursor !== void 0)
42843
+ args.cursor = opts.cursor;
42844
+ if (opts["occurredAt.gte"] !== void 0)
42845
+ args.occurred_at__gte = opts["occurredAt.gte"];
42846
+ if (opts["occurredAt.lte"] !== void 0)
42847
+ args.occurred_at__lte = opts["occurredAt.lte"];
42848
+ if (opts.limit !== void 0)
42849
+ args.limit = Number(opts.limit);
42850
+ await ctx.execute({
42851
+ method: "GET",
42852
+ path: "/v1/subscriptions/{id}/arr-history",
42853
+ args,
42854
+ queryParamKeys: [
42855
+ "limit",
42856
+ "cursor",
42857
+ "occurred_at__gte",
42858
+ "occurred_at__lte"
42859
+ ]
42860
+ });
42861
+ });
42764
42862
  resource.command("get-subscription-valuation").description(`Compute valuation metrics for a subscription: contract value (total/invoiced/remaining), recurring contract value, and ARR (fixed + variable). Optionally pass granularity (year/quarter/month) for period breakdown.`).requiredOption("--id <value>", `id parameter`).option("--granularity <value>", `Period granularity for the breakdown. When provided, contract value and recurring contract value include a \`by_period\` array.`).addHelpText("after", `
42765
42863
  Examples:
42766
42864
  hyperline subscriptions get-subscription-valuation --id <id>
@@ -57541,163 +57639,543 @@ var AmountSchema = external_exports.number().openapi({
57541
57639
  description: `Monetary amount. ${amountDescription}`
57542
57640
  });
57543
57641
 
57544
- // ../../node_modules/decimal.js/decimal.mjs
57545
- var EXP_LIMIT = 9e15;
57546
- var MAX_DIGITS = 1e9;
57547
- var NUMERALS = "0123456789abcdef";
57548
- var LN10 = "2.3025850929940456840179914546843642076011014886287729760333279009675726096773524802359972050895982983419677840422862486334095254650828067566662873690987816894829072083255546808437998948262331985283935053089653777326288461633662222876982198867465436674744042432743651550489343149393914796194044002221051017141748003688084012647080685567743216228355220114804663715659121373450747856947683463616792101806445070648000277502684916746550586856935673420670581136429224554405758925724208241314695689016758940256776311356919292033376587141660230105703089634572075440370847469940168269282808481184289314848524948644871927809676271275775397027668605952496716674183485704422507197965004714951050492214776567636938662976979522110718264549734772662425709429322582798502585509785265383207606726317164309505995087807523710333101197857547331541421808427543863591778117054309827482385045648019095610299291824318237525357709750539565187697510374970888692180205189339507238539205144634197265287286965110862571492198849978748873771345686209167058";
57549
- var PI = "3.1415926535897932384626433832795028841971693993751058209749445923078164062862089986280348253421170679821480865132823066470938446095505822317253594081284811174502841027019385211055596446229489549303819644288109756659334461284756482337867831652712019091456485669234603486104543266482133936072602491412737245870066063155881748815209209628292540917153643678925903600113305305488204665213841469519415116094330572703657595919530921861173819326117931051185480744623799627495673518857527248912279381830119491298336733624406566430860213949463952247371907021798609437027705392171762931767523846748184676694051320005681271452635608277857713427577896091736371787214684409012249534301465495853710507922796892589235420199561121290219608640344181598136297747713099605187072113499999983729780499510597317328160963185950244594553469083026425223082533446850352619311881710100031378387528865875332083814206171776691473035982534904287554687311595628638823537875937519577818577805321712268066130019278766111959092164201989380952572010654858632789";
57550
- var DEFAULTS = {
57551
- // These values must be integers within the stated ranges (inclusive).
57552
- // Most of these values can be changed at run-time using the `Decimal.config` method.
57553
- // The maximum number of significant digits of the result of a calculation or base conversion.
57554
- // E.g. `Decimal.config({ precision: 20 });`
57555
- precision: 20,
57556
- // 1 to MAX_DIGITS
57557
- // The rounding mode used when rounding to `precision`.
57558
- //
57559
- // ROUND_UP 0 Away from zero.
57560
- // ROUND_DOWN 1 Towards zero.
57561
- // ROUND_CEIL 2 Towards +Infinity.
57562
- // ROUND_FLOOR 3 Towards -Infinity.
57563
- // ROUND_HALF_UP 4 Towards nearest neighbour. If equidistant, up.
57564
- // ROUND_HALF_DOWN 5 Towards nearest neighbour. If equidistant, down.
57565
- // ROUND_HALF_EVEN 6 Towards nearest neighbour. If equidistant, towards even neighbour.
57566
- // ROUND_HALF_CEIL 7 Towards nearest neighbour. If equidistant, towards +Infinity.
57567
- // ROUND_HALF_FLOOR 8 Towards nearest neighbour. If equidistant, towards -Infinity.
57568
- //
57569
- // E.g.
57570
- // `Decimal.rounding = 4;`
57571
- // `Decimal.rounding = Decimal.ROUND_HALF_UP;`
57572
- rounding: 4,
57573
- // 0 to 8
57574
- // The modulo mode used when calculating the modulus: a mod n.
57575
- // The quotient (q = a / n) is calculated according to the corresponding rounding mode.
57576
- // The remainder (r) is calculated as: r = a - n * q.
57577
- //
57578
- // UP 0 The remainder is positive if the dividend is negative, else is negative.
57579
- // DOWN 1 The remainder has the same sign as the dividend (JavaScript %).
57580
- // FLOOR 3 The remainder has the same sign as the divisor (Python %).
57581
- // HALF_EVEN 6 The IEEE 754 remainder function.
57582
- // EUCLID 9 Euclidian division. q = sign(n) * floor(a / abs(n)). Always positive.
57583
- //
57584
- // Truncated division (1), floored division (3), the IEEE 754 remainder (6), and Euclidian
57585
- // division (9) are commonly used for the modulus operation. The other rounding modes can also
57586
- // be used, but they may not give useful results.
57587
- modulo: 1,
57588
- // 0 to 9
57589
- // The exponent value at and beneath which `toString` returns exponential notation.
57590
- // JavaScript numbers: -7
57591
- toExpNeg: -7,
57592
- // 0 to -EXP_LIMIT
57593
- // The exponent value at and above which `toString` returns exponential notation.
57594
- // JavaScript numbers: 21
57595
- toExpPos: 21,
57596
- // 0 to EXP_LIMIT
57597
- // The minimum exponent value, beneath which underflow to zero occurs.
57598
- // JavaScript numbers: -324 (5e-324)
57599
- minE: -EXP_LIMIT,
57600
- // -1 to -EXP_LIMIT
57601
- // The maximum exponent value, above which overflow to Infinity occurs.
57602
- // JavaScript numbers: 308 (1.7976931348623157e+308)
57603
- maxE: EXP_LIMIT,
57604
- // 1 to EXP_LIMIT
57605
- // Whether to use cryptographically-secure random number generation, if available.
57606
- crypto: false
57607
- // true/false
57608
- };
57609
- var inexact;
57610
- var quadrant;
57611
- var external = true;
57612
- var decimalError = "[DecimalError] ";
57613
- var invalidArgument = decimalError + "Invalid argument: ";
57614
- var precisionLimitExceeded = decimalError + "Precision limit exceeded";
57615
- var cryptoUnavailable = decimalError + "crypto unavailable";
57616
- var tag = "[object Decimal]";
57617
- var mathfloor = Math.floor;
57618
- var mathpow = Math.pow;
57619
- var isBinary = /^0b([01]+(\.[01]*)?|\.[01]+)(p[+-]?\d+)?$/i;
57620
- var isHex = /^0x([0-9a-f]+(\.[0-9a-f]*)?|\.[0-9a-f]+)(p[+-]?\d+)?$/i;
57621
- var isOctal = /^0o([0-7]+(\.[0-7]*)?|\.[0-7]+)(p[+-]?\d+)?$/i;
57622
- var isDecimal = /^(\d+(\.\d*)?|\.\d+)(e[+-]?\d+)?$/i;
57623
- var BASE = 1e7;
57624
- var LOG_BASE = 7;
57625
- var MAX_SAFE_INTEGER = 9007199254740991;
57626
- var LN10_PRECISION = LN10.length - 1;
57627
- var PI_PRECISION = PI.length - 1;
57628
- var P = { toStringTag: tag };
57629
- P.absoluteValue = P.abs = function() {
57630
- var x = new this.constructor(this);
57631
- if (x.s < 0) x.s = 1;
57632
- return finalise(x);
57633
- };
57634
- P.ceil = function() {
57635
- return finalise(new this.constructor(this), this.e + 1, 2);
57636
- };
57637
- P.clampedTo = P.clamp = function(min2, max2) {
57638
- var k, x = this, Ctor = x.constructor;
57639
- min2 = new Ctor(min2);
57640
- max2 = new Ctor(max2);
57641
- if (!min2.s || !max2.s) return new Ctor(NaN);
57642
- if (min2.gt(max2)) throw Error(invalidArgument + max2);
57643
- k = x.cmp(min2);
57644
- return k < 0 ? min2 : x.cmp(max2) > 0 ? max2 : new Ctor(x);
57645
- };
57646
- P.comparedTo = P.cmp = function(y) {
57647
- var i, j, xdL, ydL, x = this, xd = x.d, yd = (y = new x.constructor(y)).d, xs = x.s, ys = y.s;
57648
- if (!xd || !yd) {
57649
- return !xs || !ys ? NaN : xs !== ys ? xs : xd === yd ? 0 : !xd ^ xs < 0 ? 1 : -1;
57650
- }
57651
- if (!xd[0] || !yd[0]) return xd[0] ? xs : yd[0] ? -ys : 0;
57652
- if (xs !== ys) return xs;
57653
- if (x.e !== y.e) return x.e > y.e ^ xs < 0 ? 1 : -1;
57654
- xdL = xd.length;
57655
- ydL = yd.length;
57656
- for (i = 0, j = xdL < ydL ? xdL : ydL; i < j; ++i) {
57657
- if (xd[i] !== yd[i]) return xd[i] > yd[i] ^ xs < 0 ? 1 : -1;
57658
- }
57659
- return xdL === ydL ? 0 : xdL > ydL ^ xs < 0 ? 1 : -1;
57660
- };
57661
- P.cosine = P.cos = function() {
57662
- var pr, rm, x = this, Ctor = x.constructor;
57663
- if (!x.d) return new Ctor(NaN);
57664
- if (!x.d[0]) return new Ctor(1);
57665
- pr = Ctor.precision;
57666
- rm = Ctor.rounding;
57667
- Ctor.precision = pr + Math.max(x.e, x.sd()) + LOG_BASE;
57668
- Ctor.rounding = 1;
57669
- x = cosine(Ctor, toLessThanHalfPi(Ctor, x));
57670
- Ctor.precision = pr;
57671
- Ctor.rounding = rm;
57672
- return finalise(quadrant == 2 || quadrant == 3 ? x.neg() : x, pr, rm, true);
57642
+ // ../hyperline-monitoring/build/context/context.js
57643
+ import { AsyncLocalStorage } from "node:async_hooks";
57644
+ var executionContextStorage = new AsyncLocalStorage();
57645
+ function getExecutionContext() {
57646
+ return executionContextStorage.getStore();
57647
+ }
57648
+
57649
+ // ../hyperline-monitoring/build/context/correlationId.js
57650
+ import { AsyncLocalStorage as AsyncLocalStorage2 } from "node:async_hooks";
57651
+ var correlationIdStorage = new AsyncLocalStorage2();
57652
+ function getCorrelationId() {
57653
+ return correlationIdStorage.getStore();
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
57673
57672
  };
57674
- P.cubeRoot = P.cbrt = function() {
57675
- var e, m, n, r, rep, s, sd, t, t3, t3plusx, x = this, Ctor = x.constructor;
57676
- if (!x.isFinite() || x.isZero()) return new Ctor(x);
57677
- external = false;
57678
- s = x.s * mathpow(x.s * x, 1 / 3);
57679
- if (!s || Math.abs(s) == 1 / 0) {
57680
- n = digitsToString(x.d);
57681
- e = x.e;
57682
- if (s = (e - n.length + 1) % 3) n += s == 1 || s == -2 ? "0" : "00";
57683
- s = mathpow(n, 1 / 3);
57684
- e = mathfloor((e + 1) / 3) - (e % 3 == (e < 0 ? -1 : 2));
57685
- if (s == 1 / 0) {
57686
- n = "5e" + e;
57687
- } else {
57688
- n = s.toExponential();
57689
- n = n.slice(0, n.indexOf("e") + 1) + e;
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()];
57690
57677
  }
57691
- r = new Ctor(n);
57692
- r.s = x.s;
57693
- } else {
57694
- r = new Ctor(s.toString());
57695
- }
57696
- sd = (e = Ctor.precision) + 3;
57697
- for (; ; ) {
57698
- t = r;
57699
- t3 = t.times(t).times(t);
57700
- t3plusx = t3.plus(x);
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
+ // ../../node_modules/decimal.js/decimal.mjs
58023
+ var EXP_LIMIT = 9e15;
58024
+ var MAX_DIGITS = 1e9;
58025
+ var NUMERALS = "0123456789abcdef";
58026
+ var LN10 = "2.3025850929940456840179914546843642076011014886287729760333279009675726096773524802359972050895982983419677840422862486334095254650828067566662873690987816894829072083255546808437998948262331985283935053089653777326288461633662222876982198867465436674744042432743651550489343149393914796194044002221051017141748003688084012647080685567743216228355220114804663715659121373450747856947683463616792101806445070648000277502684916746550586856935673420670581136429224554405758925724208241314695689016758940256776311356919292033376587141660230105703089634572075440370847469940168269282808481184289314848524948644871927809676271275775397027668605952496716674183485704422507197965004714951050492214776567636938662976979522110718264549734772662425709429322582798502585509785265383207606726317164309505995087807523710333101197857547331541421808427543863591778117054309827482385045648019095610299291824318237525357709750539565187697510374970888692180205189339507238539205144634197265287286965110862571492198849978748873771345686209167058";
58027
+ var PI = "3.1415926535897932384626433832795028841971693993751058209749445923078164062862089986280348253421170679821480865132823066470938446095505822317253594081284811174502841027019385211055596446229489549303819644288109756659334461284756482337867831652712019091456485669234603486104543266482133936072602491412737245870066063155881748815209209628292540917153643678925903600113305305488204665213841469519415116094330572703657595919530921861173819326117931051185480744623799627495673518857527248912279381830119491298336733624406566430860213949463952247371907021798609437027705392171762931767523846748184676694051320005681271452635608277857713427577896091736371787214684409012249534301465495853710507922796892589235420199561121290219608640344181598136297747713099605187072113499999983729780499510597317328160963185950244594553469083026425223082533446850352619311881710100031378387528865875332083814206171776691473035982534904287554687311595628638823537875937519577818577805321712268066130019278766111959092164201989380952572010654858632789";
58028
+ var DEFAULTS = {
58029
+ // These values must be integers within the stated ranges (inclusive).
58030
+ // Most of these values can be changed at run-time using the `Decimal.config` method.
58031
+ // The maximum number of significant digits of the result of a calculation or base conversion.
58032
+ // E.g. `Decimal.config({ precision: 20 });`
58033
+ precision: 20,
58034
+ // 1 to MAX_DIGITS
58035
+ // The rounding mode used when rounding to `precision`.
58036
+ //
58037
+ // ROUND_UP 0 Away from zero.
58038
+ // ROUND_DOWN 1 Towards zero.
58039
+ // ROUND_CEIL 2 Towards +Infinity.
58040
+ // ROUND_FLOOR 3 Towards -Infinity.
58041
+ // ROUND_HALF_UP 4 Towards nearest neighbour. If equidistant, up.
58042
+ // ROUND_HALF_DOWN 5 Towards nearest neighbour. If equidistant, down.
58043
+ // ROUND_HALF_EVEN 6 Towards nearest neighbour. If equidistant, towards even neighbour.
58044
+ // ROUND_HALF_CEIL 7 Towards nearest neighbour. If equidistant, towards +Infinity.
58045
+ // ROUND_HALF_FLOOR 8 Towards nearest neighbour. If equidistant, towards -Infinity.
58046
+ //
58047
+ // E.g.
58048
+ // `Decimal.rounding = 4;`
58049
+ // `Decimal.rounding = Decimal.ROUND_HALF_UP;`
58050
+ rounding: 4,
58051
+ // 0 to 8
58052
+ // The modulo mode used when calculating the modulus: a mod n.
58053
+ // The quotient (q = a / n) is calculated according to the corresponding rounding mode.
58054
+ // The remainder (r) is calculated as: r = a - n * q.
58055
+ //
58056
+ // UP 0 The remainder is positive if the dividend is negative, else is negative.
58057
+ // DOWN 1 The remainder has the same sign as the dividend (JavaScript %).
58058
+ // FLOOR 3 The remainder has the same sign as the divisor (Python %).
58059
+ // HALF_EVEN 6 The IEEE 754 remainder function.
58060
+ // EUCLID 9 Euclidian division. q = sign(n) * floor(a / abs(n)). Always positive.
58061
+ //
58062
+ // Truncated division (1), floored division (3), the IEEE 754 remainder (6), and Euclidian
58063
+ // division (9) are commonly used for the modulus operation. The other rounding modes can also
58064
+ // be used, but they may not give useful results.
58065
+ modulo: 1,
58066
+ // 0 to 9
58067
+ // The exponent value at and beneath which `toString` returns exponential notation.
58068
+ // JavaScript numbers: -7
58069
+ toExpNeg: -7,
58070
+ // 0 to -EXP_LIMIT
58071
+ // The exponent value at and above which `toString` returns exponential notation.
58072
+ // JavaScript numbers: 21
58073
+ toExpPos: 21,
58074
+ // 0 to EXP_LIMIT
58075
+ // The minimum exponent value, beneath which underflow to zero occurs.
58076
+ // JavaScript numbers: -324 (5e-324)
58077
+ minE: -EXP_LIMIT,
58078
+ // -1 to -EXP_LIMIT
58079
+ // The maximum exponent value, above which overflow to Infinity occurs.
58080
+ // JavaScript numbers: 308 (1.7976931348623157e+308)
58081
+ maxE: EXP_LIMIT,
58082
+ // 1 to EXP_LIMIT
58083
+ // Whether to use cryptographically-secure random number generation, if available.
58084
+ crypto: false
58085
+ // true/false
58086
+ };
58087
+ var inexact;
58088
+ var quadrant;
58089
+ var external = true;
58090
+ var decimalError = "[DecimalError] ";
58091
+ var invalidArgument = decimalError + "Invalid argument: ";
58092
+ var precisionLimitExceeded = decimalError + "Precision limit exceeded";
58093
+ var cryptoUnavailable = decimalError + "crypto unavailable";
58094
+ var tag = "[object Decimal]";
58095
+ var mathfloor = Math.floor;
58096
+ var mathpow = Math.pow;
58097
+ var isBinary = /^0b([01]+(\.[01]*)?|\.[01]+)(p[+-]?\d+)?$/i;
58098
+ var isHex = /^0x([0-9a-f]+(\.[0-9a-f]*)?|\.[0-9a-f]+)(p[+-]?\d+)?$/i;
58099
+ var isOctal = /^0o([0-7]+(\.[0-7]*)?|\.[0-7]+)(p[+-]?\d+)?$/i;
58100
+ var isDecimal = /^(\d+(\.\d*)?|\.\d+)(e[+-]?\d+)?$/i;
58101
+ var BASE = 1e7;
58102
+ var LOG_BASE = 7;
58103
+ var MAX_SAFE_INTEGER = 9007199254740991;
58104
+ var LN10_PRECISION = LN10.length - 1;
58105
+ var PI_PRECISION = PI.length - 1;
58106
+ var P = { toStringTag: tag };
58107
+ P.absoluteValue = P.abs = function() {
58108
+ var x = new this.constructor(this);
58109
+ if (x.s < 0) x.s = 1;
58110
+ return finalise(x);
58111
+ };
58112
+ P.ceil = function() {
58113
+ return finalise(new this.constructor(this), this.e + 1, 2);
58114
+ };
58115
+ P.clampedTo = P.clamp = function(min2, max2) {
58116
+ var k, x = this, Ctor = x.constructor;
58117
+ min2 = new Ctor(min2);
58118
+ max2 = new Ctor(max2);
58119
+ if (!min2.s || !max2.s) return new Ctor(NaN);
58120
+ if (min2.gt(max2)) throw Error(invalidArgument + max2);
58121
+ k = x.cmp(min2);
58122
+ return k < 0 ? min2 : x.cmp(max2) > 0 ? max2 : new Ctor(x);
58123
+ };
58124
+ P.comparedTo = P.cmp = function(y) {
58125
+ var i, j, xdL, ydL, x = this, xd = x.d, yd = (y = new x.constructor(y)).d, xs = x.s, ys = y.s;
58126
+ if (!xd || !yd) {
58127
+ return !xs || !ys ? NaN : xs !== ys ? xs : xd === yd ? 0 : !xd ^ xs < 0 ? 1 : -1;
58128
+ }
58129
+ if (!xd[0] || !yd[0]) return xd[0] ? xs : yd[0] ? -ys : 0;
58130
+ if (xs !== ys) return xs;
58131
+ if (x.e !== y.e) return x.e > y.e ^ xs < 0 ? 1 : -1;
58132
+ xdL = xd.length;
58133
+ ydL = yd.length;
58134
+ for (i = 0, j = xdL < ydL ? xdL : ydL; i < j; ++i) {
58135
+ if (xd[i] !== yd[i]) return xd[i] > yd[i] ^ xs < 0 ? 1 : -1;
58136
+ }
58137
+ return xdL === ydL ? 0 : xdL > ydL ^ xs < 0 ? 1 : -1;
58138
+ };
58139
+ P.cosine = P.cos = function() {
58140
+ var pr, rm, x = this, Ctor = x.constructor;
58141
+ if (!x.d) return new Ctor(NaN);
58142
+ if (!x.d[0]) return new Ctor(1);
58143
+ pr = Ctor.precision;
58144
+ rm = Ctor.rounding;
58145
+ Ctor.precision = pr + Math.max(x.e, x.sd()) + LOG_BASE;
58146
+ Ctor.rounding = 1;
58147
+ x = cosine(Ctor, toLessThanHalfPi(Ctor, x));
58148
+ Ctor.precision = pr;
58149
+ Ctor.rounding = rm;
58150
+ return finalise(quadrant == 2 || quadrant == 3 ? x.neg() : x, pr, rm, true);
58151
+ };
58152
+ P.cubeRoot = P.cbrt = function() {
58153
+ var e, m, n, r, rep, s, sd, t, t3, t3plusx, x = this, Ctor = x.constructor;
58154
+ if (!x.isFinite() || x.isZero()) return new Ctor(x);
58155
+ external = false;
58156
+ s = x.s * mathpow(x.s * x, 1 / 3);
58157
+ if (!s || Math.abs(s) == 1 / 0) {
58158
+ n = digitsToString(x.d);
58159
+ e = x.e;
58160
+ if (s = (e - n.length + 1) % 3) n += s == 1 || s == -2 ? "0" : "00";
58161
+ s = mathpow(n, 1 / 3);
58162
+ e = mathfloor((e + 1) / 3) - (e % 3 == (e < 0 ? -1 : 2));
58163
+ if (s == 1 / 0) {
58164
+ n = "5e" + e;
58165
+ } else {
58166
+ n = s.toExponential();
58167
+ n = n.slice(0, n.indexOf("e") + 1) + e;
58168
+ }
58169
+ r = new Ctor(n);
58170
+ r.s = x.s;
58171
+ } else {
58172
+ r = new Ctor(s.toString());
58173
+ }
58174
+ sd = (e = Ctor.precision) + 3;
58175
+ for (; ; ) {
58176
+ t = r;
58177
+ t3 = t.times(t).times(t);
58178
+ t3plusx = t3.plus(x);
57701
58179
  r = divide(t3plusx.plus(x).times(t), t3plusx.plus(t3), sd + 2, 1);
57702
58180
  if (digitsToString(t.d).slice(0, sd) === (n = digitsToString(r.d)).slice(0, sd)) {
57703
58181
  n = n.slice(sd - 3, sd + 1);
@@ -59362,7 +59840,7 @@ function ceil(x) {
59362
59840
  function clamp(x, min2, max2) {
59363
59841
  return new this(x).clamp(min2, max2);
59364
59842
  }
59365
- function config2(obj) {
59843
+ function config3(obj) {
59366
59844
  if (!obj || typeof obj !== "object") throw Error(decimalError + "Object expected");
59367
59845
  var i, p, v, useDefaults = obj.defaults === true, ps = [
59368
59846
  "precision",
@@ -59516,7 +59994,7 @@ function clone2(obj) {
59516
59994
  Decimal2.ROUND_HALF_CEIL = 7;
59517
59995
  Decimal2.ROUND_HALF_FLOOR = 8;
59518
59996
  Decimal2.EUCLID = 9;
59519
- Decimal2.config = Decimal2.set = config2;
59997
+ Decimal2.config = Decimal2.set = config3;
59520
59998
  Decimal2.clone = clone2;
59521
59999
  Decimal2.isDecimal = isDecimalInstance;
59522
60000
  Decimal2.abs = abs;
@@ -61685,445 +62163,69 @@ var countriesAndCurrencies = (
61685
62163
  {
61686
62164
  countryCode: "WF",
61687
62165
  countryName: "Wallis and Futuna",
61688
- currencyCode: "XPF",
61689
- population: "16025",
61690
- capital: "Mata-Utu",
61691
- continentName: "Oceania"
61692
- },
61693
- {
61694
- countryCode: "WS",
61695
- countryName: "Samoa",
61696
- currencyCode: "WST",
61697
- population: "192001",
61698
- capital: "Apia",
61699
- continentName: "Oceania"
61700
- },
61701
- {
61702
- countryCode: "XK",
61703
- countryName: "Kosovo",
61704
- currencyCode: "EUR",
61705
- population: "1800000",
61706
- capital: "Pristina",
61707
- continentName: "Europe"
61708
- },
61709
- {
61710
- countryCode: "YE",
61711
- countryName: "Yemen",
61712
- currencyCode: "YER",
61713
- population: "23495361",
61714
- capital: "Sanaa",
61715
- continentName: "Asia"
61716
- },
61717
- {
61718
- countryCode: "YT",
61719
- countryName: "Mayotte",
61720
- currencyCode: "EUR",
61721
- population: "159042",
61722
- capital: "Mamoudzou",
61723
- continentName: "Africa"
61724
- },
61725
- {
61726
- countryCode: "ZA",
61727
- countryName: "South Africa",
61728
- currencyCode: "ZAR",
61729
- population: "49000000",
61730
- capital: "Pretoria",
61731
- continentName: "Africa"
61732
- },
61733
- {
61734
- countryCode: "ZM",
61735
- countryName: "Zambia",
61736
- currencyCode: "ZMW",
61737
- population: "13460305",
61738
- capital: "Lusaka",
61739
- continentName: "Africa"
61740
- },
61741
- {
61742
- countryCode: "ZW",
61743
- countryName: "Zimbabwe",
61744
- currencyCode: "ZWL",
61745
- population: "13061000",
61746
- capital: "Harare",
61747
- continentName: "Africa"
61748
- }
61749
- ]
61750
- );
61751
-
61752
- // ../hyperline-monitoring/build/context/context.js
61753
- import { AsyncLocalStorage } from "node:async_hooks";
61754
- var executionContextStorage = new AsyncLocalStorage();
61755
- function getExecutionContext() {
61756
- return executionContextStorage.getStore();
61757
- }
61758
-
61759
- // ../hyperline-monitoring/build/context/correlationId.js
61760
- import { AsyncLocalStorage as AsyncLocalStorage2 } from "node:async_hooks";
61761
- var correlationIdStorage = new AsyncLocalStorage2();
61762
- function getCorrelationId() {
61763
- return correlationIdStorage.getStore();
61764
- }
61765
-
61766
- // ../hyperline-config/build/index.js
61767
- import "dotenv/config";
61768
- import * as stackTraceParser from "stacktrace-parser";
61769
- function coerceBoolean() {
61770
- return external_exports.any().refine((value) => ["true", "false"].includes(value), {
61771
- message: "Expected boolean"
61772
- }).transform((value) => (
61773
- // biome-ignore lint/complexity/noUselessTernary: ignore
61774
- value === "true" ? true : false
61775
- ));
61776
- }
61777
- var types = {
61778
- string: external_exports.coerce.string,
61779
- number: external_exports.coerce.number,
61780
- boolean: coerceBoolean,
61781
- enum: external_exports.enum
61782
- };
61783
- function getConfig(schema, testValues) {
61784
- const validator = external_exports.object(Object.fromEntries(Object.entries(schema).map(([key, zodType]) => {
61785
- if (zodType instanceof ZodOptional) {
61786
- return [key, external_exports.string().optional()];
61787
- }
61788
- return [key, external_exports.string()];
61789
- })));
61790
- const processEnv = process.env;
61791
- const isTestMode = processEnv.NODE_ENV === "test";
61792
- const envVariables = {
61793
- ...processEnv,
61794
- ...isTestMode && testValues ? Object.fromEntries(Object.entries(testValues).map(([key, value]) => [key, String(value)])) : {}
61795
- };
61796
- const packageName = envVariables.npm_package_name;
61797
- const parseProcessEnvResult = validator.safeParse(envVariables);
61798
- if (!parseProcessEnvResult.success) {
61799
- const parsedStackTrace = stackTraceParser.parse(parseProcessEnvResult.error.stack ?? "");
61800
- const getConfigCallLine = parsedStackTrace.find((line) => {
61801
- return !line.file?.includes("hyperline-config") && (line.file?.includes("apps/") || line.file?.includes("core/") || line.file?.includes("packages/"));
61802
- });
61803
- const callerFile = getConfigCallLine?.file;
61804
- console.error(`Invalid environment variables for service \`${packageName}\`: \`${callerFile}\``);
61805
- console.error(parseProcessEnvResult.error.format());
61806
- process.exit(1);
61807
- }
61808
- const coercion = external_exports.object(schema);
61809
- return coercion.parse(parseProcessEnvResult.data);
61810
- }
61811
-
61812
- // ../hyperline-monitoring/build/config.js
61813
- var config3 = getConfig({
61814
- // config
61815
- APP_VERSION: types.string().optional(),
61816
- DD_SERVICE: types.string().optional(),
61817
- LOGGER_CONSOLE_ENABLED: types.boolean().optional(),
61818
- LOGGER_STDOUT_ENABLED: types.boolean().optional(),
61819
- NODE_ENV: types.enum(["local", "test", "staging", "sandbox", "production"]),
61820
- EVENT_LOOP_MONITORING_ENABLED: types.boolean().optional(),
61821
- MEMORY_MONITORING_ENABLED: types.boolean().optional(),
61822
- MEMORY_MONITORING_INTERVAL_MS: types.number().optional()
61823
- // secrets
61824
- }, {
61825
- APP_VERSION: void 0,
61826
- DD_SERVICE: void 0,
61827
- LOGGER_CONSOLE_ENABLED: false,
61828
- LOGGER_STDOUT_ENABLED: false,
61829
- EVENT_LOOP_MONITORING_ENABLED: false,
61830
- MEMORY_MONITORING_ENABLED: false,
61831
- MEMORY_MONITORING_INTERVAL_MS: 3e4,
61832
- NODE_ENV: "test"
61833
- });
61834
-
61835
- // ../hyperline-monitoring/build/logger/logger.js
61836
- import * as util from "node:util";
61837
- import prune2 from "json-prune";
61838
- import * as winston from "winston";
61839
-
61840
- // ../hyperline-monitoring/build/logger/formatting/format.js
61841
- import prune from "json-prune";
61842
- var REDACTED_HEADER_KEY_PATTERN = /authorization|authenticate|cookie|secret|token|credential|signature|jwt|api[_-]?key|access[_-]?token|refresh[_-]?token|private[_-]?key/i;
61843
- function jsonFormat(info) {
61844
- const prunedInfo = JSON.parse(prune(info));
61845
- for (const [key, value] of Object.entries(prunedInfo)) {
61846
- info[key] = value;
61847
- }
61848
- return info;
61849
- }
61850
- function addMetadata({ getCorrelationId: getCorrelationId2, getExecutionContext: getExecutionContext2 }) {
61851
- return (info) => {
61852
- const correlationId = getCorrelationId2();
61853
- const executionContext = getExecutionContext2();
61854
- let traceContext;
61855
- return {
61856
- ...info,
61857
- ...executionContext ?? {},
61858
- ...traceContext ?? {},
61859
- correlationId
61860
- };
61861
- };
61862
- }
61863
- function transformErrorEnrich(info, { depth }) {
61864
- if (depth <= 0) {
61865
- return info;
61866
- }
61867
- Object.entries(info).forEach(([key, value]) => {
61868
- let newValue = value;
61869
- if (newValue instanceof Error) {
61870
- newValue = {
61871
- ...newValue,
61872
- // Copy error properties manually because they're not enumerable
61873
- level: newValue.level,
61874
- stack: newValue.stack,
61875
- message: newValue.message,
61876
- name: newValue.name
61877
- };
61878
- }
61879
- if (newValue instanceof Object) {
61880
- newValue = transformErrorEnrich(newValue, { depth: depth - 1 });
61881
- }
61882
- const isPropertyWritable = Object.getOwnPropertyDescriptor(info, key)?.writable ?? true;
61883
- if (isPropertyWritable && newValue !== value) {
61884
- info[key] = newValue;
61885
- }
61886
- });
61887
- return info;
61888
- }
61889
- function transformPrune(info) {
61890
- Object.entries(info).forEach(([key, value]) => {
61891
- if (typeof value === "function") {
61892
- return;
61893
- }
61894
- const newValue = value instanceof Object ? JSON.parse(prune(value, { depthDecr: 6 })) : value;
61895
- const isPropertyWritable = Object.getOwnPropertyDescriptor(info, key)?.writable ?? true;
61896
- if (isPropertyWritable && newValue !== value) {
61897
- info[key] = newValue;
61898
- }
61899
- });
61900
- return info;
61901
- }
61902
- function transformAxiosError(info) {
61903
- Object.entries(info).forEach(([key, value]) => {
61904
- if (typeof value === "object" && value?.name === "AxiosError") {
61905
- info[key] = formatAxiosError(value);
61906
- }
61907
- });
61908
- return info;
61909
- }
61910
- function formatAxiosError(error48) {
61911
- if (!isRecord(error48) || error48.name !== "AxiosError") {
61912
- return error48;
61913
- }
61914
- const request = isRecord(error48.config) ? error48.config : void 0;
61915
- const response = isRecord(error48.response) ? error48.response : void 0;
61916
- return {
61917
- name: error48.name,
61918
- message: error48.message,
61919
- code: error48.code,
61920
- request: {
61921
- method: request?.method,
61922
- url: request?.url,
61923
- baseURL: request?.baseURL,
61924
- params: request?.params,
61925
- headers: redactHeaders({ headers: request?.headers }),
61926
- "axios-retry": request?.["axios-retry"]
62166
+ currencyCode: "XPF",
62167
+ population: "16025",
62168
+ capital: "Mata-Utu",
62169
+ continentName: "Oceania"
61927
62170
  },
61928
- response: {
61929
- status: response?.status,
61930
- statusText: response?.statusText,
61931
- headers: redactHeaders({ headers: response?.headers }),
61932
- data: response?.data
61933
- }
61934
- };
61935
- }
61936
- function redactHeaders({ headers }) {
61937
- if (!isRecord(headers)) {
61938
- return headers;
61939
- }
61940
- return Object.fromEntries(Object.entries(headers).map(([headerKey, headerValue]) => [
61941
- headerKey,
61942
- REDACTED_HEADER_KEY_PATTERN.test(headerKey) ? "<redacted>" : headerValue
61943
- ]));
61944
- }
61945
- function isRecord(value) {
61946
- return typeof value === "object" && value !== null && !Array.isArray(value);
61947
- }
61948
-
61949
- // ../hyperline-monitoring/build/logger/formatting/routePath.js
61950
- function transformUrlIntoRoutePath({ params, originalUrl }) {
61951
- let routePath = originalUrl;
61952
- for (const [param, value] of Object.entries(params ?? {})) {
61953
- const strValue = Array.isArray(value) ? value.join("/") : value;
61954
- routePath = routePath.replace(strValue, `:${param}`);
61955
- }
61956
- return routePath.split("?")[0] ?? routePath;
61957
- }
61958
-
61959
- // ../hyperline-monitoring/build/logger/formatting/http.js
61960
- function logHttpRequest(logger2, request, extra) {
61961
- const { message, metadata } = transform2(request);
61962
- logger2.info(`HTTP REQ - ${message} ${extra?.postfix || ""}`, {
61963
- ...metadata,
61964
- ...extra?.metadata ?? {}
61965
- });
61966
- }
61967
- function logHttpResponse(logger2, response, responseTime, extra) {
61968
- const { request, statusCode, responseBody, responseHeaders } = response;
61969
- const { message, metadata } = transform2(request);
61970
- const readableResponseTime = responseTime ? getReadableTime(responseTime) : void 0;
61971
- const responseMetadata = {
61972
- statusCode,
61973
- responseTime,
61974
- responseBody,
61975
- // Redacted so secrets (authorization/cookie/token/…) never reach the logs
61976
- // while diagnostic headers (e.g. rate-limit headers on a 429) stay visible.
61977
- responseHeaders: responseHeaders === void 0 ? void 0 : redactHeaders({ headers: responseHeaders })
61978
- };
61979
- logger2.info(`HTTP RES - ${message} ${statusCode} ${readableResponseTime || ""} ${extra?.postfix || ""}`, {
61980
- ...metadata,
61981
- ...responseMetadata,
61982
- ...extra?.metadata ?? {}
61983
- });
61984
- }
61985
- function transform2(request) {
61986
- const method = request.method.toUpperCase();
61987
- const message = `${method} ${request.originalUrl}`;
61988
- const metadata = {};
61989
- metadata.method = method;
61990
- metadata.url = request.url;
61991
- metadata.path = request.path;
61992
- metadata.hostname = request.hostname;
61993
- metadata.originalUrl = request.originalUrl;
61994
- metadata.requestBody = request.body;
61995
- metadata.routePath = transformUrlIntoRoutePath(request);
61996
- metadata.apiKeyEnd = request.headers["authorization"]?.slice(-6);
61997
- return { message, metadata };
61998
- }
61999
- function getReadableTime(time3) {
62000
- return time3 < 1e4 ? `${time3}ms` : `${Math.round(time3 / 1e3)}s`;
62001
- }
62002
-
62003
- // ../hyperline-monitoring/build/logger/utils/network.js
62004
- import * as os2 from "node:os";
62005
- function getIpAddress() {
62006
- const interfaces = Object.values(os2.networkInterfaces()).flat().filter((networkInterface) => {
62007
- return networkInterface !== void 0;
62008
- });
62009
- const mainInterface = interfaces.find(({ family, internal }) => family === "IPv4" && internal === false);
62010
- return mainInterface ? mainInterface.address : null;
62011
- }
62012
-
62013
- // ../hyperline-monitoring/build/logger/logger.js
62014
- function buildLoggerFactory({ config: config4, context }) {
62015
- const defaultMeta = {
62016
- env: context.env,
62017
- service: context.service,
62018
- version: context.version,
62019
- pid: process.pid,
62020
- ppid: process.ppid,
62021
- host: getIpAddress()
62022
- };
62023
- const transports2 = [];
62024
- if (config4.enableConsoleTransport) {
62025
- transports2.push(createTransportConsole());
62026
- }
62027
- if (config4.enableStdoutTransport) {
62028
- transports2.push(createTransportStdout());
62029
- }
62030
- if (Object.values(config4).every((value) => !value)) {
62031
- transports2.push(createTransportSilent());
62032
- }
62033
- for (const transport of transports2) {
62034
- transport.on("error", (error48) => {
62035
- console.error(`Unable to log to transport=${transport.name}: ${error48.message} ${JSON.stringify(error48)}`);
62036
- });
62037
- }
62038
- const internalLogger = winston.createLogger({
62039
- transports: transports2,
62040
- defaultMeta,
62041
- 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()),
62042
- exitOnError: false
62043
- });
62044
- function createLogger3({ serviceName }) {
62045
- const logger2 = internalLogger.child({ subService: serviceName });
62046
- return {
62047
- debug: bindLogger(logger2, "debug"),
62048
- info: bindLogger(logger2, "info"),
62049
- warn: bindLogger(logger2, "warn"),
62050
- error: bindLogger(logger2, "error"),
62051
- on: logger2.on.bind(logger2),
62052
- end: logger2.end.bind(logger2)
62053
- };
62054
- }
62055
- return {
62056
- createLogger: createLogger3
62057
- };
62058
- }
62059
- function bindLogger(logger2, severity) {
62060
- return (message, data) => {
62061
- logger2[severity].bind(logger2)(message, preserveReservedKeys(data));
62062
- };
62063
- }
62064
- function preserveReservedKeys(data) {
62065
- if (!data)
62066
- return;
62067
- return Object.fromEntries(Object.entries(data).map(([key, value]) => {
62068
- let finalKey = key;
62069
- if (key === "status") {
62070
- finalKey = "_status";
62071
- } else if (key === "service") {
62072
- finalKey = "_service";
62171
+ {
62172
+ countryCode: "WS",
62173
+ countryName: "Samoa",
62174
+ currencyCode: "WST",
62175
+ population: "192001",
62176
+ capital: "Apia",
62177
+ continentName: "Oceania"
62178
+ },
62179
+ {
62180
+ countryCode: "XK",
62181
+ countryName: "Kosovo",
62182
+ currencyCode: "EUR",
62183
+ population: "1800000",
62184
+ capital: "Pristina",
62185
+ continentName: "Europe"
62186
+ },
62187
+ {
62188
+ countryCode: "YE",
62189
+ countryName: "Yemen",
62190
+ currencyCode: "YER",
62191
+ population: "23495361",
62192
+ capital: "Sanaa",
62193
+ continentName: "Asia"
62194
+ },
62195
+ {
62196
+ countryCode: "YT",
62197
+ countryName: "Mayotte",
62198
+ currencyCode: "EUR",
62199
+ population: "159042",
62200
+ capital: "Mamoudzou",
62201
+ continentName: "Africa"
62202
+ },
62203
+ {
62204
+ countryCode: "ZA",
62205
+ countryName: "South Africa",
62206
+ currencyCode: "ZAR",
62207
+ population: "49000000",
62208
+ capital: "Pretoria",
62209
+ continentName: "Africa"
62210
+ },
62211
+ {
62212
+ countryCode: "ZM",
62213
+ countryName: "Zambia",
62214
+ currencyCode: "ZMW",
62215
+ population: "13460305",
62216
+ capital: "Lusaka",
62217
+ continentName: "Africa"
62218
+ },
62219
+ {
62220
+ countryCode: "ZW",
62221
+ countryName: "Zimbabwe",
62222
+ currencyCode: "ZWL",
62223
+ population: "13061000",
62224
+ capital: "Harare",
62225
+ continentName: "Africa"
62073
62226
  }
62074
- return [finalKey, value];
62075
- }));
62076
- }
62077
- var verboseLevels = ["warn", "error", "debug"];
62078
- function createTransportConsole() {
62079
- return new winston.transports.Console({
62080
- level: "debug",
62081
- handleExceptions: true,
62082
- format: winston.format.combine(winston.format(jsonFormat)(), winston.format((info) => {
62083
- const { level, message, ...others } = info;
62084
- const parts = [message];
62085
- if (Object.keys(others).length > 0 && verboseLevels.includes(level)) {
62086
- const rawOthers = JSON.parse(prune2(others));
62087
- parts.push(util.inspect(rawOthers, false, 4, true));
62088
- }
62089
- info.message = parts.filter((part) => !!part).join("\n");
62090
- return info;
62091
- })(), winston.format.colorize(), winston.format.printf(({ timestamp, level, message, service = "?" }) => {
62092
- const result = `[${timestamp}] ${level} ${service}: ${message}`;
62093
- return result.replace(/\\n/g, "\n");
62094
- }))
62095
- });
62096
- }
62097
- function createTransportStdout() {
62098
- return new winston.transports.Console({
62099
- level: "debug",
62100
- handleExceptions: true,
62101
- format: winston.format.combine(winston.format(jsonFormat)(), winston.format.timestamp(), winston.format.json())
62102
- });
62103
- }
62104
- function createTransportSilent() {
62105
- return new winston.transports.Console({
62106
- silent: true
62107
- });
62108
- }
62109
-
62110
- // ../hyperline-monitoring/build/logger/instance.js
62111
- var loggerFactory = buildLoggerFactory({
62112
- config: {
62113
- enableConsoleTransport: config3.LOGGER_CONSOLE_ENABLED ?? false,
62114
- enableStdoutTransport: config3.LOGGER_STDOUT_ENABLED ?? false
62115
- },
62116
- context: {
62117
- env: config3.NODE_ENV,
62118
- service: config3.DD_SERVICE ?? "api",
62119
- version: config3.APP_VERSION
62120
- }
62121
- });
62122
- var createLogger2 = loggerFactory.createLogger;
62123
- var logger = loggerFactory.createLogger({ serviceName: "default" });
62124
-
62125
- // ../hyperline-monitoring/build/tracing/tracing.js
62126
- import tracer from "dd-trace";
62227
+ ]
62228
+ );
62127
62229
 
62128
62230
  // ../hyperline-lib/build/utils/config/usStates.js
62129
62231
  var usStates = [
@@ -62255,6 +62357,12 @@ var DateTimeSchema = external_exports.iso.datetime({
62255
62357
  example: "2024-12-20T16:04:11Z"
62256
62358
  });
62257
62359
 
62360
+ // ../hyperline-lib/build/http/dto/domain.js
62361
+ var DomainSchema = external_exports.string().trim().toLowerCase().regex(/^(?!:\/\/)(?=.{1,253}$)(?!-)([a-z0-9-]{1,63}\.)+[a-z]{2,63}$/, "Invalid domain").openapi({
62362
+ description: "Domain name.",
62363
+ example: "acme.com"
62364
+ });
62365
+
62258
62366
  // ../hyperline-lib/build/http/dto/error.js
62259
62367
  var ErrorSchema = external_exports.object({
62260
62368
  message: external_exports.string()