@rpcbase/auth 0.157.0 → 0.159.0

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.
Files changed (41) hide show
  1. package/dist/api/request-password-reset/handler.d.ts +4 -1
  2. package/dist/api/request-password-reset/handler.d.ts.map +1 -1
  3. package/dist/api/request-password-reset/index.d.ts +1 -0
  4. package/dist/api/request-password-reset/index.d.ts.map +1 -1
  5. package/dist/components/ResendCodeButton/index.d.ts +1 -1
  6. package/dist/components/ResendCodeButton/index.d.ts.map +1 -1
  7. package/dist/{handler-BIFPHnwb.js → handler-B_lItxOC.js} +2 -2
  8. package/dist/{handler-BIFPHnwb.js.map → handler-B_lItxOC.js.map} +1 -1
  9. package/dist/{handler-4-ccxPqk.js → handler-BuwKXMOu.js} +2 -2
  10. package/dist/{handler-4-ccxPqk.js.map → handler-BuwKXMOu.js.map} +1 -1
  11. package/dist/{handler-BOCOLt9O.js → handler-C-hPxnHG.js} +2 -2
  12. package/dist/{handler-BOCOLt9O.js.map → handler-C-hPxnHG.js.map} +1 -1
  13. package/dist/{handler-DZiCZNkX.js → handler-CYL3nA6F.js} +40 -15
  14. package/dist/handler-CYL3nA6F.js.map +1 -0
  15. package/dist/{handler-Y6JMPCW0.js → handler-CoHpAhui.js} +2 -2
  16. package/dist/{handler-Y6JMPCW0.js.map → handler-CoHpAhui.js.map} +1 -1
  17. package/dist/{handler-DG8GMWwR.js → handler-DBafWh0I.js} +2 -2
  18. package/dist/{handler-DG8GMWwR.js.map → handler-DBafWh0I.js.map} +1 -1
  19. package/dist/{handler-BvztD8II.js → handler-DfZwgoA4.js} +2 -2
  20. package/dist/{handler-BvztD8II.js.map → handler-DfZwgoA4.js.map} +1 -1
  21. package/dist/{handler-BlhyOTyk.js → handler-Duy5AFEH.js} +2 -2
  22. package/dist/{handler-BlhyOTyk.js.map → handler-Duy5AFEH.js.map} +1 -1
  23. package/dist/{handler-Dbkf3cD8.js → handler-Eyjkxj9l.js} +2 -2
  24. package/dist/{handler-Dbkf3cD8.js.map → handler-Eyjkxj9l.js.map} +1 -1
  25. package/dist/{handler-EYTkh4N4.js → handler-U3df_2Al.js} +2 -2
  26. package/dist/{handler-EYTkh4N4.js.map → handler-U3df_2Al.js.map} +1 -1
  27. package/dist/{index-sfjvVpg9.js → index-1_ZKABa_.js} +2 -2
  28. package/dist/{index-sfjvVpg9.js.map → index-1_ZKABa_.js.map} +1 -1
  29. package/dist/{index-DznfuMJi.js → index-D94-1Zwh.js} +2 -2
  30. package/dist/{index-DznfuMJi.js.map → index-D94-1Zwh.js.map} +1 -1
  31. package/dist/index.d.ts +1 -0
  32. package/dist/index.d.ts.map +1 -1
  33. package/dist/index.js +100 -28
  34. package/dist/index.js.map +1 -1
  35. package/dist/passwordReset.d.ts +21 -0
  36. package/dist/passwordReset.d.ts.map +1 -0
  37. package/dist/routes.js +1 -1
  38. package/dist/{schemas-BYptELX5.js → schemas--f80aXK7.js} +372 -1
  39. package/dist/{schemas-BYptELX5.js.map → schemas--f80aXK7.js.map} +1 -1
  40. package/package.json +12 -1
  41. package/dist/handler-DZiCZNkX.js.map +0 -1
@@ -95,6 +95,14 @@ function cleanRegex(source) {
95
95
  const end = source.endsWith("$") ? source.length - 1 : source.length;
96
96
  return source.slice(start, end);
97
97
  }
98
+ function floatSafeRemainder(val, step) {
99
+ const ratio = val / step;
100
+ const roundedRatio = Math.round(ratio);
101
+ const tolerance = Number.EPSILON * Math.max(Math.abs(ratio), 1);
102
+ if (Math.abs(ratio - roundedRatio) < tolerance)
103
+ return 0;
104
+ return ratio - roundedRatio;
105
+ }
98
106
  const EVALUATING = /* @__PURE__ */ Symbol("evaluating");
99
107
  function defineLazy(object2, key, getter) {
100
108
  let value = void 0;
@@ -218,6 +226,13 @@ function optionalKeys(shape) {
218
226
  return shape[k]._zod.optin === "optional" && shape[k]._zod.optout === "optional";
219
227
  });
220
228
  }
229
+ const NUMBER_FORMAT_RANGES = {
230
+ safeint: [Number.MIN_SAFE_INTEGER, Number.MAX_SAFE_INTEGER],
231
+ int32: [-2147483648, 2147483647],
232
+ uint32: [0, 4294967295],
233
+ float32: [-34028234663852886e22, 34028234663852886e22],
234
+ float64: [-Number.MAX_VALUE, Number.MAX_VALUE]
235
+ };
221
236
  function pick(schema, mask) {
222
237
  const currDef = schema._zod.def;
223
238
  const checks = currDef.checks;
@@ -643,6 +658,8 @@ const string$1 = (params) => {
643
658
  const regex = params ? `[\\s\\S]{${params?.minimum ?? 0},${params?.maximum ?? ""}}` : `[\\s\\S]*`;
644
659
  return new RegExp(`^${regex}$`);
645
660
  };
661
+ const integer = /^-?\d+$/;
662
+ const number$1 = /^-?\d+(?:\.\d+)?$/;
646
663
  const boolean$1 = /^(?:true|false)$/i;
647
664
  const lowercase = /^[^A-Z]*$/;
648
665
  const uppercase = /^[^a-z]*$/;
@@ -652,6 +669,168 @@ const $ZodCheck = /* @__PURE__ */ $constructor("$ZodCheck", (inst, def) => {
652
669
  inst._zod.def = def;
653
670
  (_a2 = inst._zod).onattach ?? (_a2.onattach = []);
654
671
  });
672
+ const numericOriginMap = {
673
+ number: "number",
674
+ bigint: "bigint",
675
+ object: "date"
676
+ };
677
+ const $ZodCheckLessThan = /* @__PURE__ */ $constructor("$ZodCheckLessThan", (inst, def) => {
678
+ $ZodCheck.init(inst, def);
679
+ const origin = numericOriginMap[typeof def.value];
680
+ inst._zod.onattach.push((inst2) => {
681
+ const bag = inst2._zod.bag;
682
+ const curr = (def.inclusive ? bag.maximum : bag.exclusiveMaximum) ?? Number.POSITIVE_INFINITY;
683
+ if (def.value < curr) {
684
+ if (def.inclusive)
685
+ bag.maximum = def.value;
686
+ else
687
+ bag.exclusiveMaximum = def.value;
688
+ }
689
+ });
690
+ inst._zod.check = (payload) => {
691
+ if (def.inclusive ? payload.value <= def.value : payload.value < def.value) {
692
+ return;
693
+ }
694
+ payload.issues.push({
695
+ origin,
696
+ code: "too_big",
697
+ maximum: typeof def.value === "object" ? def.value.getTime() : def.value,
698
+ input: payload.value,
699
+ inclusive: def.inclusive,
700
+ inst,
701
+ continue: !def.abort
702
+ });
703
+ };
704
+ });
705
+ const $ZodCheckGreaterThan = /* @__PURE__ */ $constructor("$ZodCheckGreaterThan", (inst, def) => {
706
+ $ZodCheck.init(inst, def);
707
+ const origin = numericOriginMap[typeof def.value];
708
+ inst._zod.onattach.push((inst2) => {
709
+ const bag = inst2._zod.bag;
710
+ const curr = (def.inclusive ? bag.minimum : bag.exclusiveMinimum) ?? Number.NEGATIVE_INFINITY;
711
+ if (def.value > curr) {
712
+ if (def.inclusive)
713
+ bag.minimum = def.value;
714
+ else
715
+ bag.exclusiveMinimum = def.value;
716
+ }
717
+ });
718
+ inst._zod.check = (payload) => {
719
+ if (def.inclusive ? payload.value >= def.value : payload.value > def.value) {
720
+ return;
721
+ }
722
+ payload.issues.push({
723
+ origin,
724
+ code: "too_small",
725
+ minimum: typeof def.value === "object" ? def.value.getTime() : def.value,
726
+ input: payload.value,
727
+ inclusive: def.inclusive,
728
+ inst,
729
+ continue: !def.abort
730
+ });
731
+ };
732
+ });
733
+ const $ZodCheckMultipleOf = /* @__PURE__ */ $constructor("$ZodCheckMultipleOf", (inst, def) => {
734
+ $ZodCheck.init(inst, def);
735
+ inst._zod.onattach.push((inst2) => {
736
+ var _a2;
737
+ (_a2 = inst2._zod.bag).multipleOf ?? (_a2.multipleOf = def.value);
738
+ });
739
+ inst._zod.check = (payload) => {
740
+ if (typeof payload.value !== typeof def.value)
741
+ throw new Error("Cannot mix number and bigint in multiple_of check.");
742
+ const isMultiple = typeof payload.value === "bigint" ? payload.value % def.value === BigInt(0) : floatSafeRemainder(payload.value, def.value) === 0;
743
+ if (isMultiple)
744
+ return;
745
+ payload.issues.push({
746
+ origin: typeof payload.value,
747
+ code: "not_multiple_of",
748
+ divisor: def.value,
749
+ input: payload.value,
750
+ inst,
751
+ continue: !def.abort
752
+ });
753
+ };
754
+ });
755
+ const $ZodCheckNumberFormat = /* @__PURE__ */ $constructor("$ZodCheckNumberFormat", (inst, def) => {
756
+ $ZodCheck.init(inst, def);
757
+ def.format = def.format || "float64";
758
+ const isInt = def.format?.includes("int");
759
+ const origin = isInt ? "int" : "number";
760
+ const [minimum, maximum] = NUMBER_FORMAT_RANGES[def.format];
761
+ inst._zod.onattach.push((inst2) => {
762
+ const bag = inst2._zod.bag;
763
+ bag.format = def.format;
764
+ bag.minimum = minimum;
765
+ bag.maximum = maximum;
766
+ if (isInt)
767
+ bag.pattern = integer;
768
+ });
769
+ inst._zod.check = (payload) => {
770
+ const input = payload.value;
771
+ if (isInt) {
772
+ if (!Number.isInteger(input)) {
773
+ payload.issues.push({
774
+ expected: origin,
775
+ format: def.format,
776
+ code: "invalid_type",
777
+ continue: false,
778
+ input,
779
+ inst
780
+ });
781
+ return;
782
+ }
783
+ if (!Number.isSafeInteger(input)) {
784
+ if (input > 0) {
785
+ payload.issues.push({
786
+ input,
787
+ code: "too_big",
788
+ maximum: Number.MAX_SAFE_INTEGER,
789
+ note: "Integers must be within the safe integer range.",
790
+ inst,
791
+ origin,
792
+ inclusive: true,
793
+ continue: !def.abort
794
+ });
795
+ } else {
796
+ payload.issues.push({
797
+ input,
798
+ code: "too_small",
799
+ minimum: Number.MIN_SAFE_INTEGER,
800
+ note: "Integers must be within the safe integer range.",
801
+ inst,
802
+ origin,
803
+ inclusive: true,
804
+ continue: !def.abort
805
+ });
806
+ }
807
+ return;
808
+ }
809
+ }
810
+ if (input < minimum) {
811
+ payload.issues.push({
812
+ origin: "number",
813
+ input,
814
+ code: "too_small",
815
+ minimum,
816
+ inclusive: true,
817
+ inst,
818
+ continue: !def.abort
819
+ });
820
+ }
821
+ if (input > maximum) {
822
+ payload.issues.push({
823
+ origin: "number",
824
+ input,
825
+ code: "too_big",
826
+ maximum,
827
+ inclusive: true,
828
+ inst,
829
+ continue: !def.abort
830
+ });
831
+ }
832
+ };
833
+ });
655
834
  const $ZodCheckMaxLength = /* @__PURE__ */ $constructor("$ZodCheckMaxLength", (inst, def) => {
656
835
  var _a2;
657
836
  $ZodCheck.init(inst, def);
@@ -1328,6 +1507,34 @@ const $ZodJWT = /* @__PURE__ */ $constructor("$ZodJWT", (inst, def) => {
1328
1507
  });
1329
1508
  };
1330
1509
  });
1510
+ const $ZodNumber = /* @__PURE__ */ $constructor("$ZodNumber", (inst, def) => {
1511
+ $ZodType.init(inst, def);
1512
+ inst._zod.pattern = inst._zod.bag.pattern ?? number$1;
1513
+ inst._zod.parse = (payload, _ctx) => {
1514
+ if (def.coerce)
1515
+ try {
1516
+ payload.value = Number(payload.value);
1517
+ } catch (_) {
1518
+ }
1519
+ const input = payload.value;
1520
+ if (typeof input === "number" && !Number.isNaN(input) && Number.isFinite(input)) {
1521
+ return payload;
1522
+ }
1523
+ const received = typeof input === "number" ? Number.isNaN(input) ? "NaN" : !Number.isFinite(input) ? "Infinity" : void 0 : void 0;
1524
+ payload.issues.push({
1525
+ expected: "number",
1526
+ code: "invalid_type",
1527
+ input,
1528
+ inst,
1529
+ ...received ? { received } : {}
1530
+ });
1531
+ return payload;
1532
+ };
1533
+ });
1534
+ const $ZodNumberFormat = /* @__PURE__ */ $constructor("$ZodNumberFormat", (inst, def) => {
1535
+ $ZodCheckNumberFormat.init(inst, def);
1536
+ $ZodNumber.init(inst, def);
1537
+ });
1331
1538
  const $ZodBoolean = /* @__PURE__ */ $constructor("$ZodBoolean", (inst, def) => {
1332
1539
  $ZodType.init(inst, def);
1333
1540
  inst._zod.pattern = boolean$1;
@@ -2443,6 +2650,24 @@ function _isoDuration(Class, params) {
2443
2650
  });
2444
2651
  }
2445
2652
  // @__NO_SIDE_EFFECTS__
2653
+ function _number(Class, params) {
2654
+ return new Class({
2655
+ type: "number",
2656
+ checks: [],
2657
+ ...normalizeParams(params)
2658
+ });
2659
+ }
2660
+ // @__NO_SIDE_EFFECTS__
2661
+ function _int(Class, params) {
2662
+ return new Class({
2663
+ type: "number",
2664
+ check: "number_format",
2665
+ abort: false,
2666
+ format: "safeint",
2667
+ ...normalizeParams(params)
2668
+ });
2669
+ }
2670
+ // @__NO_SIDE_EFFECTS__
2446
2671
  function _boolean(Class, params) {
2447
2672
  return new Class({
2448
2673
  type: "boolean",
@@ -2463,6 +2688,50 @@ function _never(Class, params) {
2463
2688
  });
2464
2689
  }
2465
2690
  // @__NO_SIDE_EFFECTS__
2691
+ function _lt(value, params) {
2692
+ return new $ZodCheckLessThan({
2693
+ check: "less_than",
2694
+ ...normalizeParams(params),
2695
+ value,
2696
+ inclusive: false
2697
+ });
2698
+ }
2699
+ // @__NO_SIDE_EFFECTS__
2700
+ function _lte(value, params) {
2701
+ return new $ZodCheckLessThan({
2702
+ check: "less_than",
2703
+ ...normalizeParams(params),
2704
+ value,
2705
+ inclusive: true
2706
+ });
2707
+ }
2708
+ // @__NO_SIDE_EFFECTS__
2709
+ function _gt(value, params) {
2710
+ return new $ZodCheckGreaterThan({
2711
+ check: "greater_than",
2712
+ ...normalizeParams(params),
2713
+ value,
2714
+ inclusive: false
2715
+ });
2716
+ }
2717
+ // @__NO_SIDE_EFFECTS__
2718
+ function _gte(value, params) {
2719
+ return new $ZodCheckGreaterThan({
2720
+ check: "greater_than",
2721
+ ...normalizeParams(params),
2722
+ value,
2723
+ inclusive: true
2724
+ });
2725
+ }
2726
+ // @__NO_SIDE_EFFECTS__
2727
+ function _multipleOf(value, params) {
2728
+ return new $ZodCheckMultipleOf({
2729
+ check: "multiple_of",
2730
+ ...normalizeParams(params),
2731
+ value
2732
+ });
2733
+ }
2734
+ // @__NO_SIDE_EFFECTS__
2466
2735
  function _maxLength(maximum, params) {
2467
2736
  const ch = new $ZodCheckMaxLength({
2468
2737
  check: "max_length",
@@ -3013,6 +3282,39 @@ const stringProcessor = (schema, ctx, _json, _params) => {
3013
3282
  }
3014
3283
  }
3015
3284
  };
3285
+ const numberProcessor = (schema, ctx, _json, _params) => {
3286
+ const json = _json;
3287
+ const { minimum, maximum, format, multipleOf, exclusiveMaximum, exclusiveMinimum } = schema._zod.bag;
3288
+ if (typeof format === "string" && format.includes("int"))
3289
+ json.type = "integer";
3290
+ else
3291
+ json.type = "number";
3292
+ const exMin = typeof exclusiveMinimum === "number" && exclusiveMinimum >= (minimum ?? Number.NEGATIVE_INFINITY);
3293
+ const exMax = typeof exclusiveMaximum === "number" && exclusiveMaximum <= (maximum ?? Number.POSITIVE_INFINITY);
3294
+ const legacy = ctx.target === "draft-04" || ctx.target === "openapi-3.0";
3295
+ if (exMin) {
3296
+ if (legacy) {
3297
+ json.minimum = exclusiveMinimum;
3298
+ json.exclusiveMinimum = true;
3299
+ } else {
3300
+ json.exclusiveMinimum = exclusiveMinimum;
3301
+ }
3302
+ } else if (typeof minimum === "number") {
3303
+ json.minimum = minimum;
3304
+ }
3305
+ if (exMax) {
3306
+ if (legacy) {
3307
+ json.maximum = exclusiveMaximum;
3308
+ json.exclusiveMaximum = true;
3309
+ } else {
3310
+ json.exclusiveMaximum = exclusiveMaximum;
3311
+ }
3312
+ } else if (typeof maximum === "number") {
3313
+ json.maximum = maximum;
3314
+ }
3315
+ if (typeof multipleOf === "number")
3316
+ json.multipleOf = multipleOf;
3317
+ };
3016
3318
  const booleanProcessor = (_schema, _ctx, json, _params) => {
3017
3319
  json.type = "boolean";
3018
3320
  };
@@ -3599,6 +3901,74 @@ const ZodJWT = /* @__PURE__ */ $constructor("ZodJWT", (inst, def) => {
3599
3901
  $ZodJWT.init(inst, def);
3600
3902
  ZodStringFormat.init(inst, def);
3601
3903
  });
3904
+ const ZodNumber = /* @__PURE__ */ $constructor("ZodNumber", (inst, def) => {
3905
+ $ZodNumber.init(inst, def);
3906
+ ZodType.init(inst, def);
3907
+ inst._zod.processJSONSchema = (ctx, json, params) => numberProcessor(inst, ctx, json);
3908
+ _installLazyMethods(inst, "ZodNumber", {
3909
+ gt(value, params) {
3910
+ return this.check(/* @__PURE__ */ _gt(value, params));
3911
+ },
3912
+ gte(value, params) {
3913
+ return this.check(/* @__PURE__ */ _gte(value, params));
3914
+ },
3915
+ min(value, params) {
3916
+ return this.check(/* @__PURE__ */ _gte(value, params));
3917
+ },
3918
+ lt(value, params) {
3919
+ return this.check(/* @__PURE__ */ _lt(value, params));
3920
+ },
3921
+ lte(value, params) {
3922
+ return this.check(/* @__PURE__ */ _lte(value, params));
3923
+ },
3924
+ max(value, params) {
3925
+ return this.check(/* @__PURE__ */ _lte(value, params));
3926
+ },
3927
+ int(params) {
3928
+ return this.check(int(params));
3929
+ },
3930
+ safe(params) {
3931
+ return this.check(int(params));
3932
+ },
3933
+ positive(params) {
3934
+ return this.check(/* @__PURE__ */ _gt(0, params));
3935
+ },
3936
+ nonnegative(params) {
3937
+ return this.check(/* @__PURE__ */ _gte(0, params));
3938
+ },
3939
+ negative(params) {
3940
+ return this.check(/* @__PURE__ */ _lt(0, params));
3941
+ },
3942
+ nonpositive(params) {
3943
+ return this.check(/* @__PURE__ */ _lte(0, params));
3944
+ },
3945
+ multipleOf(value, params) {
3946
+ return this.check(/* @__PURE__ */ _multipleOf(value, params));
3947
+ },
3948
+ step(value, params) {
3949
+ return this.check(/* @__PURE__ */ _multipleOf(value, params));
3950
+ },
3951
+ finite() {
3952
+ return this;
3953
+ }
3954
+ });
3955
+ const bag = inst._zod.bag;
3956
+ inst.minValue = Math.max(bag.minimum ?? Number.NEGATIVE_INFINITY, bag.exclusiveMinimum ?? Number.NEGATIVE_INFINITY) ?? null;
3957
+ inst.maxValue = Math.min(bag.maximum ?? Number.POSITIVE_INFINITY, bag.exclusiveMaximum ?? Number.POSITIVE_INFINITY) ?? null;
3958
+ inst.isInt = (bag.format ?? "").includes("int") || Number.isSafeInteger(bag.multipleOf ?? 0.5);
3959
+ inst.isFinite = true;
3960
+ inst.format = bag.format ?? null;
3961
+ });
3962
+ function number(params) {
3963
+ return /* @__PURE__ */ _number(ZodNumber, params);
3964
+ }
3965
+ const ZodNumberFormat = /* @__PURE__ */ $constructor("ZodNumberFormat", (inst, def) => {
3966
+ $ZodNumberFormat.init(inst, def);
3967
+ ZodNumber.init(inst, def);
3968
+ });
3969
+ function int(params) {
3970
+ return /* @__PURE__ */ _int(ZodNumberFormat, params);
3971
+ }
3602
3972
  const ZodBoolean = /* @__PURE__ */ $constructor("ZodBoolean", (inst, def) => {
3603
3973
  $ZodBoolean.init(inst, def);
3604
3974
  ZodType.init(inst, def);
@@ -3952,7 +4322,8 @@ function superRefine(fn, params) {
3952
4322
  export {
3953
4323
  array as a,
3954
4324
  boolean as b,
4325
+ number as n,
3955
4326
  object as o,
3956
4327
  string as s
3957
4328
  };
3958
- //# sourceMappingURL=schemas-BYptELX5.js.map
4329
+ //# sourceMappingURL=schemas--f80aXK7.js.map