@m1212e/rumble 0.23.22 → 0.23.23

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/out/index.cjs CHANGED
@@ -51,7 +51,7 @@ _pothos_plugin_validation = __toESM(_pothos_plugin_validation, 1);
51
51
  let graphql_scalars = require("graphql-scalars");
52
52
  let dataloader = require("dataloader");
53
53
  dataloader = __toESM(dataloader, 1);
54
- let lib_address = require("lib-address");
54
+ let node_module = require("node:module");
55
55
  let zod = require("zod");
56
56
  let libphonenumber_js = require("libphonenumber-js");
57
57
  //#region lib/types/rumbleError.ts
@@ -216,7 +216,7 @@ function mapNullFieldsToUndefined(obj) {
216
216
  }
217
217
  //#endregion
218
218
  //#region package.json
219
- var version = "0.23.22";
219
+ var version = "0.23.23";
220
220
  //#endregion
221
221
  //#region lib/helpers/errorLogging.ts
222
222
  function hasMessage(error) {
@@ -2642,6 +2642,9 @@ function registerRuntimeFiltersPlugin() {
2642
2642
  }
2643
2643
  //#endregion
2644
2644
  //#region lib/scalars/addressValidation.ts
2645
+ const libAddress = (0, node_module.createRequire)(require("url").pathToFileURL(__filename).href)("lib-address");
2646
+ const { AddressValidationError, CountryMissingError, InvalidStateError, InvalidZipError, isValidCountryCode, MissingFieldError } = libAddress;
2647
+ const validateAddress = libAddress.validateAddress;
2645
2648
  const FIELD_PATH_MAP = {
2646
2649
  addressLine1: "streetAddress",
2647
2650
  addressLine2: "streetAddress",
@@ -2687,7 +2690,7 @@ const addressValidationSchema = zod.z.object({
2687
2690
  });
2688
2691
  return;
2689
2692
  }
2690
- if (!(0, lib_address.isValidCountryCode)(address.countryCode)) {
2693
+ if (!isValidCountryCode(address.countryCode)) {
2691
2694
  ctx.addIssue({
2692
2695
  code: "custom",
2693
2696
  path: ["countryCode"],
@@ -2697,7 +2700,7 @@ const addressValidationSchema = zod.z.object({
2697
2700
  }
2698
2701
  const [addressLine1, addressLine2, addressLine3] = address.streetAddress ? address.streetAddress.split("\n") : [];
2699
2702
  try {
2700
- (0, lib_address.validateAddress)({
2703
+ validateAddress({
2701
2704
  country: address.countryCode,
2702
2705
  addressLine1,
2703
2706
  addressLine2,
@@ -2707,7 +2710,7 @@ const addressValidationSchema = zod.z.object({
2707
2710
  zip: address.postalCode ?? void 0
2708
2711
  });
2709
2712
  } catch (error) {
2710
- if (error instanceof lib_address.CountryMissingError) {
2713
+ if (error instanceof CountryMissingError) {
2711
2714
  ctx.addIssue({
2712
2715
  code: "custom",
2713
2716
  path: ["countryCode"],
@@ -2715,8 +2718,8 @@ const addressValidationSchema = zod.z.object({
2715
2718
  });
2716
2719
  return;
2717
2720
  }
2718
- if (!(error instanceof lib_address.AddressValidationError)) throw error;
2719
- for (const subError of error.errors) if (subError instanceof lib_address.MissingFieldError) {
2721
+ if (!(error instanceof AddressValidationError)) throw error;
2722
+ for (const subError of error.errors) if (subError instanceof MissingFieldError) {
2720
2723
  const path = FIELD_PATH_MAP[subError.field];
2721
2724
  if (!path) continue;
2722
2725
  ctx.addIssue({
@@ -2724,12 +2727,12 @@ const addressValidationSchema = zod.z.object({
2724
2727
  path: [path],
2725
2728
  message: `${path} is required for country ${address.countryCode}.`
2726
2729
  });
2727
- } else if (subError instanceof lib_address.InvalidZipError) ctx.addIssue({
2730
+ } else if (subError instanceof InvalidZipError) ctx.addIssue({
2728
2731
  code: "custom",
2729
2732
  path: ["postalCode"],
2730
2733
  message: `Invalid postal code for country ${address.countryCode}.`
2731
2734
  });
2732
- else if (subError instanceof lib_address.InvalidStateError) ctx.addIssue({
2735
+ else if (subError instanceof InvalidStateError) ctx.addIssue({
2733
2736
  code: "custom",
2734
2737
  path: ["region"],
2735
2738
  message: `Invalid region for country ${address.countryCode}.`