@m1212e/rumble 0.23.21 → 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.21";
219
+ var version = "0.23.23";
220
220
  //#endregion
221
221
  //#region lib/helpers/errorLogging.ts
222
222
  function hasMessage(error) {
@@ -2635,12 +2635,16 @@ var RuntimeFiltersPlugin = class extends _pothos_core.BasePlugin {
2635
2635
  let registered = false;
2636
2636
  function registerRuntimeFiltersPlugin() {
2637
2637
  if (!registered) {
2638
+ _pothos_core.default.allowPluginReRegistration = true;
2638
2639
  _pothos_core.default.registerPlugin(pluginName, RuntimeFiltersPlugin);
2639
2640
  registered = true;
2640
2641
  }
2641
2642
  }
2642
2643
  //#endregion
2643
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;
2644
2648
  const FIELD_PATH_MAP = {
2645
2649
  addressLine1: "streetAddress",
2646
2650
  addressLine2: "streetAddress",
@@ -2686,7 +2690,7 @@ const addressValidationSchema = zod.z.object({
2686
2690
  });
2687
2691
  return;
2688
2692
  }
2689
- if (!(0, lib_address.isValidCountryCode)(address.countryCode)) {
2693
+ if (!isValidCountryCode(address.countryCode)) {
2690
2694
  ctx.addIssue({
2691
2695
  code: "custom",
2692
2696
  path: ["countryCode"],
@@ -2696,7 +2700,7 @@ const addressValidationSchema = zod.z.object({
2696
2700
  }
2697
2701
  const [addressLine1, addressLine2, addressLine3] = address.streetAddress ? address.streetAddress.split("\n") : [];
2698
2702
  try {
2699
- (0, lib_address.validateAddress)({
2703
+ validateAddress({
2700
2704
  country: address.countryCode,
2701
2705
  addressLine1,
2702
2706
  addressLine2,
@@ -2706,7 +2710,7 @@ const addressValidationSchema = zod.z.object({
2706
2710
  zip: address.postalCode ?? void 0
2707
2711
  });
2708
2712
  } catch (error) {
2709
- if (error instanceof lib_address.CountryMissingError) {
2713
+ if (error instanceof CountryMissingError) {
2710
2714
  ctx.addIssue({
2711
2715
  code: "custom",
2712
2716
  path: ["countryCode"],
@@ -2714,8 +2718,8 @@ const addressValidationSchema = zod.z.object({
2714
2718
  });
2715
2719
  return;
2716
2720
  }
2717
- if (!(error instanceof lib_address.AddressValidationError)) throw error;
2718
- 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) {
2719
2723
  const path = FIELD_PATH_MAP[subError.field];
2720
2724
  if (!path) continue;
2721
2725
  ctx.addIssue({
@@ -2723,12 +2727,12 @@ const addressValidationSchema = zod.z.object({
2723
2727
  path: [path],
2724
2728
  message: `${path} is required for country ${address.countryCode}.`
2725
2729
  });
2726
- } else if (subError instanceof lib_address.InvalidZipError) ctx.addIssue({
2730
+ } else if (subError instanceof InvalidZipError) ctx.addIssue({
2727
2731
  code: "custom",
2728
2732
  path: ["postalCode"],
2729
2733
  message: `Invalid postal code for country ${address.countryCode}.`
2730
2734
  });
2731
- else if (subError instanceof lib_address.InvalidStateError) ctx.addIssue({
2735
+ else if (subError instanceof InvalidStateError) ctx.addIssue({
2732
2736
  code: "custom",
2733
2737
  path: ["region"],
2734
2738
  message: `Invalid region for country ${address.countryCode}.`