dipcoin-cli 0.8.0 → 0.8.2

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/dist/cli.cjs CHANGED
@@ -48,8 +48,8 @@ function initSDKOptions(options) {
48
48
  };
49
49
  }
50
50
 
51
- const PACKAGE_VERSION = "1.45.0";
52
- const TARGETED_RPC_VERSION = "1.61.0";
51
+ const PACKAGE_VERSION = "1.45.2";
52
+ const TARGETED_RPC_VERSION = "1.62.0";
53
53
 
54
54
  const CODE_TO_ERROR_TYPE = {
55
55
  "-32700": "ParseError",
@@ -2503,773 +2503,902 @@ class Experimental_BaseClient {
2503
2503
  }
2504
2504
  }
2505
2505
 
2506
- // src/actions/await/awaitAsync.ts
2507
-
2508
- // src/storages/globalConfig/globalConfig.ts
2509
- var store;
2510
- function getGlobalConfig(config2) {
2511
- return {
2512
- lang: config2?.lang ?? store?.lang,
2513
- message: config2?.message,
2514
- abortEarly: config2?.abortEarly ?? store?.abortEarly,
2515
- abortPipeEarly: config2?.abortPipeEarly ?? store?.abortPipeEarly
2516
- };
2506
+ //#region src/storages/globalConfig/globalConfig.ts
2507
+ let store$4;
2508
+ /**
2509
+ * Returns the global configuration.
2510
+ *
2511
+ * @param config The config to merge.
2512
+ *
2513
+ * @returns The configuration.
2514
+ */
2515
+ /* @__NO_SIDE_EFFECTS__ */
2516
+ function getGlobalConfig(config$1) {
2517
+ return {
2518
+ lang: config$1?.lang ?? store$4?.lang,
2519
+ message: config$1?.message,
2520
+ abortEarly: config$1?.abortEarly ?? store$4?.abortEarly,
2521
+ abortPipeEarly: config$1?.abortPipeEarly ?? store$4?.abortPipeEarly
2522
+ };
2517
2523
  }
2518
2524
 
2519
- // src/storages/globalMessage/globalMessage.ts
2520
- var store2;
2525
+ //#endregion
2526
+ //#region src/storages/globalMessage/globalMessage.ts
2527
+ let store$3;
2528
+ /**
2529
+ * Returns a global error message.
2530
+ *
2531
+ * @param lang The language of the message.
2532
+ *
2533
+ * @returns The error message.
2534
+ */
2535
+ /* @__NO_SIDE_EFFECTS__ */
2521
2536
  function getGlobalMessage(lang) {
2522
- return store2?.get(lang);
2537
+ return store$3?.get(lang);
2523
2538
  }
2524
2539
 
2525
- // src/storages/schemaMessage/schemaMessage.ts
2526
- var store3;
2540
+ //#endregion
2541
+ //#region src/storages/schemaMessage/schemaMessage.ts
2542
+ let store$2;
2543
+ /**
2544
+ * Returns a schema error message.
2545
+ *
2546
+ * @param lang The language of the message.
2547
+ *
2548
+ * @returns The error message.
2549
+ */
2550
+ /* @__NO_SIDE_EFFECTS__ */
2527
2551
  function getSchemaMessage(lang) {
2528
- return store3?.get(lang);
2552
+ return store$2?.get(lang);
2529
2553
  }
2530
2554
 
2531
- // src/storages/specificMessage/specificMessage.ts
2532
- var store4;
2555
+ //#endregion
2556
+ //#region src/storages/specificMessage/specificMessage.ts
2557
+ let store$1;
2558
+ /**
2559
+ * Returns a specific error message.
2560
+ *
2561
+ * @param reference The identifier reference.
2562
+ * @param lang The language of the message.
2563
+ *
2564
+ * @returns The error message.
2565
+ */
2566
+ /* @__NO_SIDE_EFFECTS__ */
2533
2567
  function getSpecificMessage(reference, lang) {
2534
- return store4?.get(reference)?.get(lang);
2568
+ return store$1?.get(reference)?.get(lang);
2535
2569
  }
2536
2570
 
2537
- // src/utils/_stringify/_stringify.ts
2571
+ //#endregion
2572
+ //#region src/utils/_stringify/_stringify.ts
2573
+ /**
2574
+ * Stringifies an unknown input to a literal or type string.
2575
+ *
2576
+ * @param input The unknown input.
2577
+ *
2578
+ * @returns A literal or type string.
2579
+ *
2580
+ * @internal
2581
+ */
2582
+ /* @__NO_SIDE_EFFECTS__ */
2538
2583
  function _stringify(input) {
2539
- const type = typeof input;
2540
- if (type === "string") {
2541
- return `"${input}"`;
2542
- }
2543
- if (type === "number" || type === "bigint" || type === "boolean") {
2544
- return `${input}`;
2545
- }
2546
- if (type === "object" || type === "function") {
2547
- return (input && Object.getPrototypeOf(input)?.constructor?.name) ?? "null";
2548
- }
2549
- return type;
2584
+ const type = typeof input;
2585
+ if (type === "string") return `"${input}"`;
2586
+ if (type === "number" || type === "bigint" || type === "boolean") return `${input}`;
2587
+ if (type === "object" || type === "function") return (input && Object.getPrototypeOf(input)?.constructor?.name) ?? "null";
2588
+ return type;
2550
2589
  }
2551
2590
 
2552
- // src/utils/_addIssue/_addIssue.ts
2553
- function _addIssue(context, label, dataset, config2, other) {
2554
- const input = other && "input" in other ? other.input : dataset.value;
2555
- const expected = other?.expected ?? context.expects ?? null;
2556
- const received = other?.received ?? _stringify(input);
2557
- const issue = {
2558
- kind: context.kind,
2559
- type: context.type,
2560
- input,
2561
- expected,
2562
- received,
2563
- message: `Invalid ${label}: ${expected ? `Expected ${expected} but r` : "R"}eceived ${received}`,
2564
- // @ts-expect-error
2565
- requirement: context.requirement,
2566
- path: other?.path,
2567
- issues: other?.issues,
2568
- lang: config2.lang,
2569
- abortEarly: config2.abortEarly,
2570
- abortPipeEarly: config2.abortPipeEarly
2571
- };
2572
- const isSchema = context.kind === "schema";
2573
- const message = other?.message ?? // @ts-expect-error
2574
- context.message ?? getSpecificMessage(context.reference, issue.lang) ?? (isSchema ? getSchemaMessage(issue.lang) : null) ?? config2.message ?? getGlobalMessage(issue.lang);
2575
- if (message) {
2576
- issue.message = typeof message === "function" ? message(issue) : message;
2577
- }
2578
- if (isSchema) {
2579
- dataset.typed = false;
2580
- }
2581
- if (dataset.issues) {
2582
- dataset.issues.push(issue);
2583
- } else {
2584
- dataset.issues = [issue];
2585
- }
2591
+ //#endregion
2592
+ //#region src/utils/_addIssue/_addIssue.ts
2593
+ /**
2594
+ * Adds an issue to the dataset.
2595
+ *
2596
+ * @param context The issue context.
2597
+ * @param label The issue label.
2598
+ * @param dataset The input dataset.
2599
+ * @param config The configuration.
2600
+ * @param other The optional props.
2601
+ *
2602
+ * @internal
2603
+ */
2604
+ function _addIssue(context, label, dataset, config$1, other) {
2605
+ const input = other && "input" in other ? other.input : dataset.value;
2606
+ const expected = other?.expected ?? context.expects ?? null;
2607
+ const received = other?.received ?? /* @__PURE__ */ _stringify(input);
2608
+ const issue = {
2609
+ kind: context.kind,
2610
+ type: context.type,
2611
+ input,
2612
+ expected,
2613
+ received,
2614
+ message: `Invalid ${label}: ${expected ? `Expected ${expected} but r` : "R"}eceived ${received}`,
2615
+ requirement: context.requirement,
2616
+ path: other?.path,
2617
+ issues: other?.issues,
2618
+ lang: config$1.lang,
2619
+ abortEarly: config$1.abortEarly,
2620
+ abortPipeEarly: config$1.abortPipeEarly
2621
+ };
2622
+ const isSchema = context.kind === "schema";
2623
+ const message$1 = other?.message ?? context.message ?? /* @__PURE__ */ getSpecificMessage(context.reference, issue.lang) ?? (isSchema ? /* @__PURE__ */ getSchemaMessage(issue.lang) : null) ?? config$1.message ?? /* @__PURE__ */ getGlobalMessage(issue.lang);
2624
+ if (message$1 !== void 0) issue.message = typeof message$1 === "function" ? message$1(issue) : message$1;
2625
+ if (isSchema) dataset.typed = false;
2626
+ if (dataset.issues) dataset.issues.push(issue);
2627
+ else dataset.issues = [issue];
2586
2628
  }
2587
2629
 
2588
- // src/utils/_isValidObjectKey/_isValidObjectKey.ts
2589
- function _isValidObjectKey(object2, key) {
2590
- return Object.hasOwn(object2, key) && key !== "__proto__" && key !== "prototype" && key !== "constructor";
2630
+ //#endregion
2631
+ //#region src/utils/_getStandardProps/_getStandardProps.ts
2632
+ /**
2633
+ * Returns the Standard Schema properties.
2634
+ *
2635
+ * @param context The schema context.
2636
+ *
2637
+ * @returns The Standard Schema properties.
2638
+ */
2639
+ /* @__NO_SIDE_EFFECTS__ */
2640
+ function _getStandardProps(context) {
2641
+ return {
2642
+ version: 1,
2643
+ vendor: "valibot",
2644
+ validate(value$1) {
2645
+ return context["~run"]({ value: value$1 }, /* @__PURE__ */ getGlobalConfig());
2646
+ }
2647
+ };
2591
2648
  }
2592
2649
 
2593
- // src/utils/ValiError/ValiError.ts
2650
+ //#endregion
2651
+ //#region src/utils/_isValidObjectKey/_isValidObjectKey.ts
2652
+ /**
2653
+ * Disallows inherited object properties and prevents object prototype
2654
+ * pollution by disallowing certain keys.
2655
+ *
2656
+ * @param object The object to check.
2657
+ * @param key The key to check.
2658
+ *
2659
+ * @returns Whether the key is allowed.
2660
+ *
2661
+ * @internal
2662
+ */
2663
+ /* @__NO_SIDE_EFFECTS__ */
2664
+ function _isValidObjectKey(object$1, key) {
2665
+ return Object.hasOwn(object$1, key) && key !== "__proto__" && key !== "prototype" && key !== "constructor";
2666
+ }
2667
+
2668
+ //#endregion
2669
+ //#region src/utils/_joinExpects/_joinExpects.ts
2670
+ /**
2671
+ * Joins multiple `expects` values with the given separator.
2672
+ *
2673
+ * @param values The `expects` values.
2674
+ * @param separator The separator.
2675
+ *
2676
+ * @returns The joined `expects` property.
2677
+ *
2678
+ * @internal
2679
+ */
2680
+ /* @__NO_SIDE_EFFECTS__ */
2681
+ function _joinExpects(values$1, separator) {
2682
+ const list = [...new Set(values$1)];
2683
+ if (list.length > 1) return `(${list.join(` ${separator} `)})`;
2684
+ return list[0] ?? "never";
2685
+ }
2686
+
2687
+ //#endregion
2688
+ //#region src/utils/ValiError/ValiError.ts
2689
+ /**
2690
+ * A Valibot error with useful information.
2691
+ */
2594
2692
  var ValiError = class extends Error {
2595
- /**
2596
- * The error issues.
2597
- */
2598
- issues;
2599
- /**
2600
- * Creates a Valibot error with useful information.
2601
- *
2602
- * @param issues The error issues.
2603
- */
2604
- constructor(issues) {
2605
- super(issues[0].message);
2606
- this.name = "ValiError";
2607
- this.issues = issues;
2608
- }
2693
+ /**
2694
+ * Creates a Valibot error with useful information.
2695
+ *
2696
+ * @param issues The error issues.
2697
+ */
2698
+ constructor(issues) {
2699
+ super(issues[0].message);
2700
+ this.name = "ValiError";
2701
+ this.issues = issues;
2702
+ }
2609
2703
  };
2610
2704
 
2611
- // src/actions/check/check.ts
2612
- function check(requirement, message) {
2613
- return {
2614
- kind: "validation",
2615
- type: "check",
2616
- reference: check,
2617
- async: false,
2618
- expects: null,
2619
- requirement,
2620
- message,
2621
- _run(dataset, config2) {
2622
- if (dataset.typed && !this.requirement(dataset.value)) {
2623
- _addIssue(this, "input", dataset, config2);
2624
- }
2625
- return dataset;
2626
- }
2627
- };
2705
+ //#endregion
2706
+ //#region src/actions/check/check.ts
2707
+ /* @__NO_SIDE_EFFECTS__ */
2708
+ function check(requirement, message$1) {
2709
+ return {
2710
+ kind: "validation",
2711
+ type: "check",
2712
+ reference: check,
2713
+ async: false,
2714
+ expects: null,
2715
+ requirement,
2716
+ message: message$1,
2717
+ "~run"(dataset, config$1) {
2718
+ if (dataset.typed && !this.requirement(dataset.value)) _addIssue(this, "input", dataset, config$1);
2719
+ return dataset;
2720
+ }
2721
+ };
2628
2722
  }
2629
2723
 
2630
- // src/actions/integer/integer.ts
2631
- function integer(message) {
2632
- return {
2633
- kind: "validation",
2634
- type: "integer",
2635
- reference: integer,
2636
- async: false,
2637
- expects: null,
2638
- requirement: Number.isInteger,
2639
- message,
2640
- _run(dataset, config2) {
2641
- if (dataset.typed && !this.requirement(dataset.value)) {
2642
- _addIssue(this, "integer", dataset, config2);
2643
- }
2644
- return dataset;
2645
- }
2646
- };
2724
+ //#endregion
2725
+ //#region src/actions/integer/integer.ts
2726
+ /* @__NO_SIDE_EFFECTS__ */
2727
+ function integer(message$1) {
2728
+ return {
2729
+ kind: "validation",
2730
+ type: "integer",
2731
+ reference: integer,
2732
+ async: false,
2733
+ expects: null,
2734
+ requirement: Number.isInteger,
2735
+ message: message$1,
2736
+ "~run"(dataset, config$1) {
2737
+ if (dataset.typed && !this.requirement(dataset.value)) _addIssue(this, "integer", dataset, config$1);
2738
+ return dataset;
2739
+ }
2740
+ };
2647
2741
  }
2648
2742
 
2649
- // src/actions/transform/transform.ts
2743
+ //#endregion
2744
+ //#region src/actions/transform/transform.ts
2745
+ /**
2746
+ * Creates a custom transformation action.
2747
+ *
2748
+ * @param operation The transformation operation.
2749
+ *
2750
+ * @returns A transform action.
2751
+ */
2752
+ /* @__NO_SIDE_EFFECTS__ */
2650
2753
  function transform(operation) {
2651
- return {
2652
- kind: "transformation",
2653
- type: "transform",
2654
- reference: transform,
2655
- async: false,
2656
- operation,
2657
- _run(dataset) {
2658
- dataset.value = this.operation(dataset.value);
2659
- return dataset;
2660
- }
2661
- };
2754
+ return {
2755
+ kind: "transformation",
2756
+ type: "transform",
2757
+ reference: transform,
2758
+ async: false,
2759
+ operation,
2760
+ "~run"(dataset) {
2761
+ dataset.value = this.operation(dataset.value);
2762
+ return dataset;
2763
+ }
2764
+ };
2662
2765
  }
2663
2766
 
2664
- // src/methods/getDefault/getDefault.ts
2665
- function getDefault(schema, dataset, config2) {
2666
- return typeof schema.default === "function" ? (
2667
- // @ts-expect-error
2668
- schema.default(dataset, config2)
2669
- ) : (
2670
- // @ts-expect-error
2671
- schema.default
2672
- );
2767
+ //#endregion
2768
+ //#region src/methods/getFallback/getFallback.ts
2769
+ /**
2770
+ * Returns the fallback value of the schema.
2771
+ *
2772
+ * @param schema The schema to get it from.
2773
+ * @param dataset The output dataset if available.
2774
+ * @param config The config if available.
2775
+ *
2776
+ * @returns The fallback value.
2777
+ */
2778
+ /* @__NO_SIDE_EFFECTS__ */
2779
+ function getFallback(schema, dataset, config$1) {
2780
+ return typeof schema.fallback === "function" ? schema.fallback(dataset, config$1) : schema.fallback;
2673
2781
  }
2674
2782
 
2675
- // src/methods/is/is.ts
2783
+ //#endregion
2784
+ //#region src/methods/getDefault/getDefault.ts
2785
+ /**
2786
+ * Returns the default value of the schema.
2787
+ *
2788
+ * @param schema The schema to get it from.
2789
+ * @param dataset The input dataset if available.
2790
+ * @param config The config if available.
2791
+ *
2792
+ * @returns The default value.
2793
+ */
2794
+ /* @__NO_SIDE_EFFECTS__ */
2795
+ function getDefault(schema, dataset, config$1) {
2796
+ return typeof schema.default === "function" ? schema.default(dataset, config$1) : schema.default;
2797
+ }
2798
+
2799
+ //#endregion
2800
+ //#region src/methods/is/is.ts
2801
+ /**
2802
+ * Checks if the input matches the schema. By using a type predicate, this
2803
+ * function can be used as a type guard.
2804
+ *
2805
+ * @param schema The schema to be used.
2806
+ * @param input The input to be tested.
2807
+ *
2808
+ * @returns Whether the input matches the schema.
2809
+ */
2810
+ /* @__NO_SIDE_EFFECTS__ */
2676
2811
  function is(schema, input) {
2677
- return !schema._run({ typed: false, value: input }, { abortEarly: true }).issues;
2812
+ return !schema["~run"]({ value: input }, { abortEarly: true }).issues;
2678
2813
  }
2679
2814
 
2680
- // src/schemas/array/array.ts
2681
- function array(item, message) {
2682
- return {
2683
- kind: "schema",
2684
- type: "array",
2685
- reference: array,
2686
- expects: "Array",
2687
- async: false,
2688
- item,
2689
- message,
2690
- _run(dataset, config2) {
2691
- const input = dataset.value;
2692
- if (Array.isArray(input)) {
2693
- dataset.typed = true;
2694
- dataset.value = [];
2695
- for (let key = 0; key < input.length; key++) {
2696
- const value2 = input[key];
2697
- const itemDataset = this.item._run({ typed: false, value: value2 }, config2);
2698
- if (itemDataset.issues) {
2699
- const pathItem = {
2700
- type: "array",
2701
- origin: "value",
2702
- input,
2703
- key,
2704
- value: value2
2705
- };
2706
- for (const issue of itemDataset.issues) {
2707
- if (issue.path) {
2708
- issue.path.unshift(pathItem);
2709
- } else {
2710
- issue.path = [pathItem];
2711
- }
2712
- dataset.issues?.push(issue);
2713
- }
2714
- if (!dataset.issues) {
2715
- dataset.issues = itemDataset.issues;
2716
- }
2717
- if (config2.abortEarly) {
2718
- dataset.typed = false;
2719
- break;
2720
- }
2721
- }
2722
- if (!itemDataset.typed) {
2723
- dataset.typed = false;
2724
- }
2725
- dataset.value.push(itemDataset.value);
2726
- }
2727
- } else {
2728
- _addIssue(this, "type", dataset, config2);
2729
- }
2730
- return dataset;
2731
- }
2732
- };
2815
+ //#endregion
2816
+ //#region src/schemas/array/array.ts
2817
+ /* @__NO_SIDE_EFFECTS__ */
2818
+ function array(item, message$1) {
2819
+ return {
2820
+ kind: "schema",
2821
+ type: "array",
2822
+ reference: array,
2823
+ expects: "Array",
2824
+ async: false,
2825
+ item,
2826
+ message: message$1,
2827
+ get "~standard"() {
2828
+ return /* @__PURE__ */ _getStandardProps(this);
2829
+ },
2830
+ "~run"(dataset, config$1) {
2831
+ const input = dataset.value;
2832
+ if (Array.isArray(input)) {
2833
+ dataset.typed = true;
2834
+ dataset.value = [];
2835
+ for (let key = 0; key < input.length; key++) {
2836
+ const value$1 = input[key];
2837
+ const itemDataset = this.item["~run"]({ value: value$1 }, config$1);
2838
+ if (itemDataset.issues) {
2839
+ const pathItem = {
2840
+ type: "array",
2841
+ origin: "value",
2842
+ input,
2843
+ key,
2844
+ value: value$1
2845
+ };
2846
+ for (const issue of itemDataset.issues) {
2847
+ if (issue.path) issue.path.unshift(pathItem);
2848
+ else issue.path = [pathItem];
2849
+ dataset.issues?.push(issue);
2850
+ }
2851
+ if (!dataset.issues) dataset.issues = itemDataset.issues;
2852
+ if (config$1.abortEarly) {
2853
+ dataset.typed = false;
2854
+ break;
2855
+ }
2856
+ }
2857
+ if (!itemDataset.typed) dataset.typed = false;
2858
+ dataset.value.push(itemDataset.value);
2859
+ }
2860
+ } else _addIssue(this, "type", dataset, config$1);
2861
+ return dataset;
2862
+ }
2863
+ };
2733
2864
  }
2734
2865
 
2735
- // src/schemas/bigint/bigint.ts
2736
- function bigint(message) {
2737
- return {
2738
- kind: "schema",
2739
- type: "bigint",
2740
- reference: bigint,
2741
- expects: "bigint",
2742
- async: false,
2743
- message,
2744
- _run(dataset, config2) {
2745
- if (typeof dataset.value === "bigint") {
2746
- dataset.typed = true;
2747
- } else {
2748
- _addIssue(this, "type", dataset, config2);
2749
- }
2750
- return dataset;
2751
- }
2752
- };
2866
+ //#endregion
2867
+ //#region src/schemas/bigint/bigint.ts
2868
+ /* @__NO_SIDE_EFFECTS__ */
2869
+ function bigint(message$1) {
2870
+ return {
2871
+ kind: "schema",
2872
+ type: "bigint",
2873
+ reference: bigint,
2874
+ expects: "bigint",
2875
+ async: false,
2876
+ message: message$1,
2877
+ get "~standard"() {
2878
+ return /* @__PURE__ */ _getStandardProps(this);
2879
+ },
2880
+ "~run"(dataset, config$1) {
2881
+ if (typeof dataset.value === "bigint") dataset.typed = true;
2882
+ else _addIssue(this, "type", dataset, config$1);
2883
+ return dataset;
2884
+ }
2885
+ };
2753
2886
  }
2754
2887
 
2755
- // src/schemas/boolean/boolean.ts
2756
- function boolean(message) {
2757
- return {
2758
- kind: "schema",
2759
- type: "boolean",
2760
- reference: boolean,
2761
- expects: "boolean",
2762
- async: false,
2763
- message,
2764
- _run(dataset, config2) {
2765
- if (typeof dataset.value === "boolean") {
2766
- dataset.typed = true;
2767
- } else {
2768
- _addIssue(this, "type", dataset, config2);
2769
- }
2770
- return dataset;
2771
- }
2772
- };
2888
+ //#endregion
2889
+ //#region src/schemas/boolean/boolean.ts
2890
+ /* @__NO_SIDE_EFFECTS__ */
2891
+ function boolean(message$1) {
2892
+ return {
2893
+ kind: "schema",
2894
+ type: "boolean",
2895
+ reference: boolean,
2896
+ expects: "boolean",
2897
+ async: false,
2898
+ message: message$1,
2899
+ get "~standard"() {
2900
+ return /* @__PURE__ */ _getStandardProps(this);
2901
+ },
2902
+ "~run"(dataset, config$1) {
2903
+ if (typeof dataset.value === "boolean") dataset.typed = true;
2904
+ else _addIssue(this, "type", dataset, config$1);
2905
+ return dataset;
2906
+ }
2907
+ };
2773
2908
  }
2774
2909
 
2775
- // src/schemas/lazy/lazy.ts
2910
+ //#endregion
2911
+ //#region src/schemas/lazy/lazy.ts
2912
+ /**
2913
+ * Creates a lazy schema.
2914
+ *
2915
+ * @param getter The schema getter.
2916
+ *
2917
+ * @returns A lazy schema.
2918
+ */
2919
+ /* @__NO_SIDE_EFFECTS__ */
2776
2920
  function lazy(getter) {
2777
- return {
2778
- kind: "schema",
2779
- type: "lazy",
2780
- reference: lazy,
2781
- expects: "unknown",
2782
- async: false,
2783
- getter,
2784
- _run(dataset, config2) {
2785
- return this.getter(dataset.value)._run(dataset, config2);
2786
- }
2787
- };
2921
+ return {
2922
+ kind: "schema",
2923
+ type: "lazy",
2924
+ reference: lazy,
2925
+ expects: "unknown",
2926
+ async: false,
2927
+ getter,
2928
+ get "~standard"() {
2929
+ return /* @__PURE__ */ _getStandardProps(this);
2930
+ },
2931
+ "~run"(dataset, config$1) {
2932
+ return this.getter(dataset.value)["~run"](dataset, config$1);
2933
+ }
2934
+ };
2788
2935
  }
2789
2936
 
2790
- // src/schemas/literal/literal.ts
2791
- function literal(literal_, message) {
2792
- return {
2793
- kind: "schema",
2794
- type: "literal",
2795
- reference: literal,
2796
- expects: _stringify(literal_),
2797
- async: false,
2798
- literal: literal_,
2799
- message,
2800
- _run(dataset, config2) {
2801
- if (dataset.value === this.literal) {
2802
- dataset.typed = true;
2803
- } else {
2804
- _addIssue(this, "type", dataset, config2);
2805
- }
2806
- return dataset;
2807
- }
2808
- };
2937
+ //#endregion
2938
+ //#region src/schemas/literal/literal.ts
2939
+ /* @__NO_SIDE_EFFECTS__ */
2940
+ function literal(literal_, message$1) {
2941
+ return {
2942
+ kind: "schema",
2943
+ type: "literal",
2944
+ reference: literal,
2945
+ expects: /* @__PURE__ */ _stringify(literal_),
2946
+ async: false,
2947
+ literal: literal_,
2948
+ message: message$1,
2949
+ get "~standard"() {
2950
+ return /* @__PURE__ */ _getStandardProps(this);
2951
+ },
2952
+ "~run"(dataset, config$1) {
2953
+ if (dataset.value === this.literal) dataset.typed = true;
2954
+ else _addIssue(this, "type", dataset, config$1);
2955
+ return dataset;
2956
+ }
2957
+ };
2809
2958
  }
2810
2959
 
2811
- // src/schemas/nullable/nullable.ts
2812
- function nullable(wrapped, ...args) {
2813
- const schema = {
2814
- kind: "schema",
2815
- type: "nullable",
2816
- reference: nullable,
2817
- expects: `${wrapped.expects} | null`,
2818
- async: false,
2819
- wrapped,
2820
- _run(dataset, config2) {
2821
- if (dataset.value === null) {
2822
- if ("default" in this) {
2823
- dataset.value = getDefault(
2824
- this,
2825
- dataset,
2826
- config2
2827
- );
2828
- }
2829
- if (dataset.value === null) {
2830
- dataset.typed = true;
2831
- return dataset;
2832
- }
2833
- }
2834
- return this.wrapped._run(dataset, config2);
2835
- }
2836
- };
2837
- if (0 in args) {
2838
- schema.default = args[0];
2839
- }
2840
- return schema;
2960
+ //#endregion
2961
+ //#region src/schemas/nullable/nullable.ts
2962
+ /* @__NO_SIDE_EFFECTS__ */
2963
+ function nullable(wrapped, default_) {
2964
+ return {
2965
+ kind: "schema",
2966
+ type: "nullable",
2967
+ reference: nullable,
2968
+ expects: `(${wrapped.expects} | null)`,
2969
+ async: false,
2970
+ wrapped,
2971
+ default: default_,
2972
+ get "~standard"() {
2973
+ return /* @__PURE__ */ _getStandardProps(this);
2974
+ },
2975
+ "~run"(dataset, config$1) {
2976
+ if (dataset.value === null) {
2977
+ if (this.default !== void 0) dataset.value = /* @__PURE__ */ getDefault(this, dataset, config$1);
2978
+ if (dataset.value === null) {
2979
+ dataset.typed = true;
2980
+ return dataset;
2981
+ }
2982
+ }
2983
+ return this.wrapped["~run"](dataset, config$1);
2984
+ }
2985
+ };
2841
2986
  }
2842
2987
 
2843
- // src/schemas/nullish/nullish.ts
2844
- function nullish(wrapped, ...args) {
2845
- const schema = {
2846
- kind: "schema",
2847
- type: "nullish",
2848
- reference: nullish,
2849
- expects: `${wrapped.expects} | null | undefined`,
2850
- async: false,
2851
- wrapped,
2852
- _run(dataset, config2) {
2853
- if (dataset.value === null || dataset.value === void 0) {
2854
- if ("default" in this) {
2855
- dataset.value = getDefault(
2856
- this,
2857
- dataset,
2858
- config2
2859
- );
2860
- }
2861
- if (dataset.value === null || dataset.value === void 0) {
2862
- dataset.typed = true;
2863
- return dataset;
2864
- }
2865
- }
2866
- return this.wrapped._run(dataset, config2);
2867
- }
2868
- };
2869
- if (0 in args) {
2870
- schema.default = args[0];
2871
- }
2872
- return schema;
2988
+ //#endregion
2989
+ //#region src/schemas/nullish/nullish.ts
2990
+ /* @__NO_SIDE_EFFECTS__ */
2991
+ function nullish(wrapped, default_) {
2992
+ return {
2993
+ kind: "schema",
2994
+ type: "nullish",
2995
+ reference: nullish,
2996
+ expects: `(${wrapped.expects} | null | undefined)`,
2997
+ async: false,
2998
+ wrapped,
2999
+ default: default_,
3000
+ get "~standard"() {
3001
+ return /* @__PURE__ */ _getStandardProps(this);
3002
+ },
3003
+ "~run"(dataset, config$1) {
3004
+ if (dataset.value === null || dataset.value === void 0) {
3005
+ if (this.default !== void 0) dataset.value = /* @__PURE__ */ getDefault(this, dataset, config$1);
3006
+ if (dataset.value === null || dataset.value === void 0) {
3007
+ dataset.typed = true;
3008
+ return dataset;
3009
+ }
3010
+ }
3011
+ return this.wrapped["~run"](dataset, config$1);
3012
+ }
3013
+ };
2873
3014
  }
2874
3015
 
2875
- // src/schemas/number/number.ts
2876
- function number(message) {
2877
- return {
2878
- kind: "schema",
2879
- type: "number",
2880
- reference: number,
2881
- expects: "number",
2882
- async: false,
2883
- message,
2884
- _run(dataset, config2) {
2885
- if (typeof dataset.value === "number" && !isNaN(dataset.value)) {
2886
- dataset.typed = true;
2887
- } else {
2888
- _addIssue(this, "type", dataset, config2);
2889
- }
2890
- return dataset;
2891
- }
2892
- };
3016
+ //#endregion
3017
+ //#region src/schemas/number/number.ts
3018
+ /* @__NO_SIDE_EFFECTS__ */
3019
+ function number(message$1) {
3020
+ return {
3021
+ kind: "schema",
3022
+ type: "number",
3023
+ reference: number,
3024
+ expects: "number",
3025
+ async: false,
3026
+ message: message$1,
3027
+ get "~standard"() {
3028
+ return /* @__PURE__ */ _getStandardProps(this);
3029
+ },
3030
+ "~run"(dataset, config$1) {
3031
+ if (typeof dataset.value === "number" && !isNaN(dataset.value)) dataset.typed = true;
3032
+ else _addIssue(this, "type", dataset, config$1);
3033
+ return dataset;
3034
+ }
3035
+ };
2893
3036
  }
2894
3037
 
2895
- // src/schemas/object/object.ts
2896
- function object(entries, message) {
2897
- return {
2898
- kind: "schema",
2899
- type: "object",
2900
- reference: object,
2901
- expects: "Object",
2902
- async: false,
2903
- entries,
2904
- message,
2905
- _run(dataset, config2) {
2906
- const input = dataset.value;
2907
- if (input && typeof input === "object") {
2908
- dataset.typed = true;
2909
- dataset.value = {};
2910
- for (const key in this.entries) {
2911
- const value2 = input[key];
2912
- const valueDataset = this.entries[key]._run(
2913
- { typed: false, value: value2 },
2914
- config2
2915
- );
2916
- if (valueDataset.issues) {
2917
- const pathItem = {
2918
- type: "object",
2919
- origin: "value",
2920
- input,
2921
- key,
2922
- value: value2
2923
- };
2924
- for (const issue of valueDataset.issues) {
2925
- if (issue.path) {
2926
- issue.path.unshift(pathItem);
2927
- } else {
2928
- issue.path = [pathItem];
2929
- }
2930
- dataset.issues?.push(issue);
2931
- }
2932
- if (!dataset.issues) {
2933
- dataset.issues = valueDataset.issues;
2934
- }
2935
- if (config2.abortEarly) {
2936
- dataset.typed = false;
2937
- break;
2938
- }
2939
- }
2940
- if (!valueDataset.typed) {
2941
- dataset.typed = false;
2942
- }
2943
- if (valueDataset.value !== void 0 || key in input) {
2944
- dataset.value[key] = valueDataset.value;
2945
- }
2946
- }
2947
- } else {
2948
- _addIssue(this, "type", dataset, config2);
2949
- }
2950
- return dataset;
2951
- }
2952
- };
3038
+ //#endregion
3039
+ //#region src/schemas/object/object.ts
3040
+ /* @__NO_SIDE_EFFECTS__ */
3041
+ function object(entries$1, message$1) {
3042
+ return {
3043
+ kind: "schema",
3044
+ type: "object",
3045
+ reference: object,
3046
+ expects: "Object",
3047
+ async: false,
3048
+ entries: entries$1,
3049
+ message: message$1,
3050
+ get "~standard"() {
3051
+ return /* @__PURE__ */ _getStandardProps(this);
3052
+ },
3053
+ "~run"(dataset, config$1) {
3054
+ const input = dataset.value;
3055
+ if (input && typeof input === "object") {
3056
+ dataset.typed = true;
3057
+ dataset.value = {};
3058
+ for (const key in this.entries) {
3059
+ const valueSchema = this.entries[key];
3060
+ if (key in input || (valueSchema.type === "exact_optional" || valueSchema.type === "optional" || valueSchema.type === "nullish") && valueSchema.default !== void 0) {
3061
+ const value$1 = key in input ? input[key] : /* @__PURE__ */ getDefault(valueSchema);
3062
+ const valueDataset = valueSchema["~run"]({ value: value$1 }, config$1);
3063
+ if (valueDataset.issues) {
3064
+ const pathItem = {
3065
+ type: "object",
3066
+ origin: "value",
3067
+ input,
3068
+ key,
3069
+ value: value$1
3070
+ };
3071
+ for (const issue of valueDataset.issues) {
3072
+ if (issue.path) issue.path.unshift(pathItem);
3073
+ else issue.path = [pathItem];
3074
+ dataset.issues?.push(issue);
3075
+ }
3076
+ if (!dataset.issues) dataset.issues = valueDataset.issues;
3077
+ if (config$1.abortEarly) {
3078
+ dataset.typed = false;
3079
+ break;
3080
+ }
3081
+ }
3082
+ if (!valueDataset.typed) dataset.typed = false;
3083
+ dataset.value[key] = valueDataset.value;
3084
+ } else if (valueSchema.fallback !== void 0) dataset.value[key] = /* @__PURE__ */ getFallback(valueSchema);
3085
+ else if (valueSchema.type !== "exact_optional" && valueSchema.type !== "optional" && valueSchema.type !== "nullish") {
3086
+ _addIssue(this, "key", dataset, config$1, {
3087
+ input: void 0,
3088
+ expected: `"${key}"`,
3089
+ path: [{
3090
+ type: "object",
3091
+ origin: "key",
3092
+ input,
3093
+ key,
3094
+ value: input[key]
3095
+ }]
3096
+ });
3097
+ if (config$1.abortEarly) break;
3098
+ }
3099
+ }
3100
+ } else _addIssue(this, "type", dataset, config$1);
3101
+ return dataset;
3102
+ }
3103
+ };
2953
3104
  }
2954
3105
 
2955
- // src/schemas/optional/optional.ts
2956
- function optional(wrapped, ...args) {
2957
- const schema = {
2958
- kind: "schema",
2959
- type: "optional",
2960
- reference: optional,
2961
- expects: `${wrapped.expects} | undefined`,
2962
- async: false,
2963
- wrapped,
2964
- _run(dataset, config2) {
2965
- if (dataset.value === void 0) {
2966
- if ("default" in this) {
2967
- dataset.value = getDefault(
2968
- this,
2969
- dataset,
2970
- config2
2971
- );
2972
- }
2973
- if (dataset.value === void 0) {
2974
- dataset.typed = true;
2975
- return dataset;
2976
- }
2977
- }
2978
- return this.wrapped._run(dataset, config2);
2979
- }
2980
- };
2981
- if (0 in args) {
2982
- schema.default = args[0];
2983
- }
2984
- return schema;
3106
+ //#endregion
3107
+ //#region src/schemas/optional/optional.ts
3108
+ /* @__NO_SIDE_EFFECTS__ */
3109
+ function optional(wrapped, default_) {
3110
+ return {
3111
+ kind: "schema",
3112
+ type: "optional",
3113
+ reference: optional,
3114
+ expects: `(${wrapped.expects} | undefined)`,
3115
+ async: false,
3116
+ wrapped,
3117
+ default: default_,
3118
+ get "~standard"() {
3119
+ return /* @__PURE__ */ _getStandardProps(this);
3120
+ },
3121
+ "~run"(dataset, config$1) {
3122
+ if (dataset.value === void 0) {
3123
+ if (this.default !== void 0) dataset.value = /* @__PURE__ */ getDefault(this, dataset, config$1);
3124
+ if (dataset.value === void 0) {
3125
+ dataset.typed = true;
3126
+ return dataset;
3127
+ }
3128
+ }
3129
+ return this.wrapped["~run"](dataset, config$1);
3130
+ }
3131
+ };
2985
3132
  }
2986
3133
 
2987
- // src/schemas/record/record.ts
2988
- function record(key, value2, message) {
2989
- return {
2990
- kind: "schema",
2991
- type: "record",
2992
- reference: record,
2993
- expects: "Object",
2994
- async: false,
2995
- key,
2996
- value: value2,
2997
- message,
2998
- _run(dataset, config2) {
2999
- const input = dataset.value;
3000
- if (input && typeof input === "object") {
3001
- dataset.typed = true;
3002
- dataset.value = {};
3003
- for (const entryKey in input) {
3004
- if (_isValidObjectKey(input, entryKey)) {
3005
- const entryValue = input[entryKey];
3006
- const keyDataset = this.key._run(
3007
- { typed: false, value: entryKey },
3008
- config2
3009
- );
3010
- if (keyDataset.issues) {
3011
- const pathItem = {
3012
- type: "object",
3013
- origin: "key",
3014
- input,
3015
- key: entryKey,
3016
- value: entryValue
3017
- };
3018
- for (const issue of keyDataset.issues) {
3019
- issue.path = [pathItem];
3020
- dataset.issues?.push(issue);
3021
- }
3022
- if (!dataset.issues) {
3023
- dataset.issues = keyDataset.issues;
3024
- }
3025
- if (config2.abortEarly) {
3026
- dataset.typed = false;
3027
- break;
3028
- }
3029
- }
3030
- const valueDataset = this.value._run(
3031
- { typed: false, value: entryValue },
3032
- config2
3033
- );
3034
- if (valueDataset.issues) {
3035
- const pathItem = {
3036
- type: "object",
3037
- origin: "value",
3038
- input,
3039
- key: entryKey,
3040
- value: entryValue
3041
- };
3042
- for (const issue of valueDataset.issues) {
3043
- if (issue.path) {
3044
- issue.path.unshift(pathItem);
3045
- } else {
3046
- issue.path = [pathItem];
3047
- }
3048
- dataset.issues?.push(issue);
3049
- }
3050
- if (!dataset.issues) {
3051
- dataset.issues = valueDataset.issues;
3052
- }
3053
- if (config2.abortEarly) {
3054
- dataset.typed = false;
3055
- break;
3056
- }
3057
- }
3058
- if (!keyDataset.typed || !valueDataset.typed) {
3059
- dataset.typed = false;
3060
- }
3061
- if (keyDataset.typed) {
3062
- dataset.value[keyDataset.value] = valueDataset.value;
3063
- }
3064
- }
3065
- }
3066
- } else {
3067
- _addIssue(this, "type", dataset, config2);
3068
- }
3069
- return dataset;
3070
- }
3071
- };
3134
+ //#endregion
3135
+ //#region src/schemas/record/record.ts
3136
+ /* @__NO_SIDE_EFFECTS__ */
3137
+ function record(key, value$1, message$1) {
3138
+ return {
3139
+ kind: "schema",
3140
+ type: "record",
3141
+ reference: record,
3142
+ expects: "Object",
3143
+ async: false,
3144
+ key,
3145
+ value: value$1,
3146
+ message: message$1,
3147
+ get "~standard"() {
3148
+ return /* @__PURE__ */ _getStandardProps(this);
3149
+ },
3150
+ "~run"(dataset, config$1) {
3151
+ const input = dataset.value;
3152
+ if (input && typeof input === "object") {
3153
+ dataset.typed = true;
3154
+ dataset.value = {};
3155
+ for (const entryKey in input) if (/* @__PURE__ */ _isValidObjectKey(input, entryKey)) {
3156
+ const entryValue = input[entryKey];
3157
+ const keyDataset = this.key["~run"]({ value: entryKey }, config$1);
3158
+ if (keyDataset.issues) {
3159
+ const pathItem = {
3160
+ type: "object",
3161
+ origin: "key",
3162
+ input,
3163
+ key: entryKey,
3164
+ value: entryValue
3165
+ };
3166
+ for (const issue of keyDataset.issues) {
3167
+ issue.path = [pathItem];
3168
+ dataset.issues?.push(issue);
3169
+ }
3170
+ if (!dataset.issues) dataset.issues = keyDataset.issues;
3171
+ if (config$1.abortEarly) {
3172
+ dataset.typed = false;
3173
+ break;
3174
+ }
3175
+ }
3176
+ const valueDataset = this.value["~run"]({ value: entryValue }, config$1);
3177
+ if (valueDataset.issues) {
3178
+ const pathItem = {
3179
+ type: "object",
3180
+ origin: "value",
3181
+ input,
3182
+ key: entryKey,
3183
+ value: entryValue
3184
+ };
3185
+ for (const issue of valueDataset.issues) {
3186
+ if (issue.path) issue.path.unshift(pathItem);
3187
+ else issue.path = [pathItem];
3188
+ dataset.issues?.push(issue);
3189
+ }
3190
+ if (!dataset.issues) dataset.issues = valueDataset.issues;
3191
+ if (config$1.abortEarly) {
3192
+ dataset.typed = false;
3193
+ break;
3194
+ }
3195
+ }
3196
+ if (!keyDataset.typed || !valueDataset.typed) dataset.typed = false;
3197
+ if (keyDataset.typed) dataset.value[keyDataset.value] = valueDataset.value;
3198
+ }
3199
+ } else _addIssue(this, "type", dataset, config$1);
3200
+ return dataset;
3201
+ }
3202
+ };
3072
3203
  }
3073
3204
 
3074
- // src/schemas/string/string.ts
3075
- function string(message) {
3076
- return {
3077
- kind: "schema",
3078
- type: "string",
3079
- reference: string,
3080
- expects: "string",
3081
- async: false,
3082
- message,
3083
- _run(dataset, config2) {
3084
- if (typeof dataset.value === "string") {
3085
- dataset.typed = true;
3086
- } else {
3087
- _addIssue(this, "type", dataset, config2);
3088
- }
3089
- return dataset;
3090
- }
3091
- };
3205
+ //#endregion
3206
+ //#region src/schemas/string/string.ts
3207
+ /* @__NO_SIDE_EFFECTS__ */
3208
+ function string(message$1) {
3209
+ return {
3210
+ kind: "schema",
3211
+ type: "string",
3212
+ reference: string,
3213
+ expects: "string",
3214
+ async: false,
3215
+ message: message$1,
3216
+ get "~standard"() {
3217
+ return /* @__PURE__ */ _getStandardProps(this);
3218
+ },
3219
+ "~run"(dataset, config$1) {
3220
+ if (typeof dataset.value === "string") dataset.typed = true;
3221
+ else _addIssue(this, "type", dataset, config$1);
3222
+ return dataset;
3223
+ }
3224
+ };
3092
3225
  }
3093
3226
 
3094
- // src/schemas/tuple/tuple.ts
3095
- function tuple(items, message) {
3096
- return {
3097
- kind: "schema",
3098
- type: "tuple",
3099
- reference: tuple,
3100
- expects: "Array",
3101
- async: false,
3102
- items,
3103
- message,
3104
- _run(dataset, config2) {
3105
- const input = dataset.value;
3106
- if (Array.isArray(input)) {
3107
- dataset.typed = true;
3108
- dataset.value = [];
3109
- for (let key = 0; key < this.items.length; key++) {
3110
- const value2 = input[key];
3111
- const itemDataset = this.items[key]._run(
3112
- { typed: false, value: value2 },
3113
- config2
3114
- );
3115
- if (itemDataset.issues) {
3116
- const pathItem = {
3117
- type: "array",
3118
- origin: "value",
3119
- input,
3120
- key,
3121
- value: value2
3122
- };
3123
- for (const issue of itemDataset.issues) {
3124
- if (issue.path) {
3125
- issue.path.unshift(pathItem);
3126
- } else {
3127
- issue.path = [pathItem];
3128
- }
3129
- dataset.issues?.push(issue);
3130
- }
3131
- if (!dataset.issues) {
3132
- dataset.issues = itemDataset.issues;
3133
- }
3134
- if (config2.abortEarly) {
3135
- dataset.typed = false;
3136
- break;
3137
- }
3138
- }
3139
- if (!itemDataset.typed) {
3140
- dataset.typed = false;
3141
- }
3142
- dataset.value.push(itemDataset.value);
3143
- }
3144
- } else {
3145
- _addIssue(this, "type", dataset, config2);
3146
- }
3147
- return dataset;
3148
- }
3149
- };
3227
+ //#endregion
3228
+ //#region src/schemas/tuple/tuple.ts
3229
+ /* @__NO_SIDE_EFFECTS__ */
3230
+ function tuple(items, message$1) {
3231
+ return {
3232
+ kind: "schema",
3233
+ type: "tuple",
3234
+ reference: tuple,
3235
+ expects: "Array",
3236
+ async: false,
3237
+ items,
3238
+ message: message$1,
3239
+ get "~standard"() {
3240
+ return /* @__PURE__ */ _getStandardProps(this);
3241
+ },
3242
+ "~run"(dataset, config$1) {
3243
+ const input = dataset.value;
3244
+ if (Array.isArray(input)) {
3245
+ dataset.typed = true;
3246
+ dataset.value = [];
3247
+ for (let key = 0; key < this.items.length; key++) {
3248
+ const value$1 = input[key];
3249
+ const itemDataset = this.items[key]["~run"]({ value: value$1 }, config$1);
3250
+ if (itemDataset.issues) {
3251
+ const pathItem = {
3252
+ type: "array",
3253
+ origin: "value",
3254
+ input,
3255
+ key,
3256
+ value: value$1
3257
+ };
3258
+ for (const issue of itemDataset.issues) {
3259
+ if (issue.path) issue.path.unshift(pathItem);
3260
+ else issue.path = [pathItem];
3261
+ dataset.issues?.push(issue);
3262
+ }
3263
+ if (!dataset.issues) dataset.issues = itemDataset.issues;
3264
+ if (config$1.abortEarly) {
3265
+ dataset.typed = false;
3266
+ break;
3267
+ }
3268
+ }
3269
+ if (!itemDataset.typed) dataset.typed = false;
3270
+ dataset.value.push(itemDataset.value);
3271
+ }
3272
+ } else _addIssue(this, "type", dataset, config$1);
3273
+ return dataset;
3274
+ }
3275
+ };
3150
3276
  }
3151
3277
 
3152
- // src/schemas/union/utils/_subIssues/_subIssues.ts
3278
+ //#endregion
3279
+ //#region src/schemas/union/utils/_subIssues/_subIssues.ts
3280
+ /**
3281
+ * Returns the sub issues of the provided datasets for the union issue.
3282
+ *
3283
+ * @param datasets The datasets.
3284
+ *
3285
+ * @returns The sub issues.
3286
+ *
3287
+ * @internal
3288
+ */
3289
+ /* @__NO_SIDE_EFFECTS__ */
3153
3290
  function _subIssues(datasets) {
3154
- let issues;
3155
- if (datasets) {
3156
- for (const dataset of datasets) {
3157
- if (issues) {
3158
- issues.push(...dataset.issues);
3159
- } else {
3160
- issues = dataset.issues;
3161
- }
3162
- }
3163
- }
3164
- return issues;
3291
+ let issues;
3292
+ if (datasets) for (const dataset of datasets) if (issues) issues.push(...dataset.issues);
3293
+ else issues = dataset.issues;
3294
+ return issues;
3165
3295
  }
3166
3296
 
3167
- // src/schemas/union/union.ts
3168
- function union(options, message) {
3169
- return {
3170
- kind: "schema",
3171
- type: "union",
3172
- reference: union,
3173
- expects: [...new Set(options.map((option) => option.expects))].join(" | ") || "never",
3174
- async: false,
3175
- options,
3176
- message,
3177
- _run(dataset, config2) {
3178
- let validDataset;
3179
- let typedDatasets;
3180
- let untypedDatasets;
3181
- for (const schema of this.options) {
3182
- const optionDataset = schema._run(
3183
- { typed: false, value: dataset.value },
3184
- config2
3185
- );
3186
- if (optionDataset.typed) {
3187
- if (optionDataset.issues) {
3188
- if (typedDatasets) {
3189
- typedDatasets.push(optionDataset);
3190
- } else {
3191
- typedDatasets = [optionDataset];
3192
- }
3193
- } else {
3194
- validDataset = optionDataset;
3195
- break;
3196
- }
3197
- } else {
3198
- if (untypedDatasets) {
3199
- untypedDatasets.push(optionDataset);
3200
- } else {
3201
- untypedDatasets = [optionDataset];
3202
- }
3203
- }
3204
- }
3205
- if (validDataset) {
3206
- return validDataset;
3207
- }
3208
- if (typedDatasets) {
3209
- if (typedDatasets.length === 1) {
3210
- return typedDatasets[0];
3211
- }
3212
- _addIssue(this, "type", dataset, config2, {
3213
- issues: _subIssues(typedDatasets)
3214
- });
3215
- dataset.typed = true;
3216
- } else if (untypedDatasets?.length === 1) {
3217
- return untypedDatasets[0];
3218
- } else {
3219
- _addIssue(this, "type", dataset, config2, {
3220
- issues: _subIssues(untypedDatasets)
3221
- });
3222
- }
3223
- return dataset;
3224
- }
3225
- };
3297
+ //#endregion
3298
+ //#region src/schemas/union/union.ts
3299
+ /* @__NO_SIDE_EFFECTS__ */
3300
+ function union(options, message$1) {
3301
+ return {
3302
+ kind: "schema",
3303
+ type: "union",
3304
+ reference: union,
3305
+ expects: /* @__PURE__ */ _joinExpects(options.map((option) => option.expects), "|"),
3306
+ async: false,
3307
+ options,
3308
+ message: message$1,
3309
+ get "~standard"() {
3310
+ return /* @__PURE__ */ _getStandardProps(this);
3311
+ },
3312
+ "~run"(dataset, config$1) {
3313
+ let validDataset;
3314
+ let typedDatasets;
3315
+ let untypedDatasets;
3316
+ for (const schema of this.options) {
3317
+ const optionDataset = schema["~run"]({ value: dataset.value }, config$1);
3318
+ if (optionDataset.typed) if (optionDataset.issues) if (typedDatasets) typedDatasets.push(optionDataset);
3319
+ else typedDatasets = [optionDataset];
3320
+ else {
3321
+ validDataset = optionDataset;
3322
+ break;
3323
+ }
3324
+ else if (untypedDatasets) untypedDatasets.push(optionDataset);
3325
+ else untypedDatasets = [optionDataset];
3326
+ }
3327
+ if (validDataset) return validDataset;
3328
+ if (typedDatasets) {
3329
+ if (typedDatasets.length === 1) return typedDatasets[0];
3330
+ _addIssue(this, "type", dataset, config$1, { issues: /* @__PURE__ */ _subIssues(typedDatasets) });
3331
+ dataset.typed = true;
3332
+ } else if (untypedDatasets?.length === 1) return untypedDatasets[0];
3333
+ else _addIssue(this, "type", dataset, config$1, { issues: /* @__PURE__ */ _subIssues(untypedDatasets) });
3334
+ return dataset;
3335
+ }
3336
+ };
3226
3337
  }
3227
3338
 
3228
- // src/schemas/unknown/unknown.ts
3339
+ //#endregion
3340
+ //#region src/schemas/unknown/unknown.ts
3341
+ /**
3342
+ * Creates a unknown schema.
3343
+ *
3344
+ * @returns A unknown schema.
3345
+ */
3346
+ /* @__NO_SIDE_EFFECTS__ */
3229
3347
  function unknown() {
3230
- return {
3231
- kind: "schema",
3232
- type: "unknown",
3233
- reference: unknown,
3234
- expects: "unknown",
3235
- async: false,
3236
- _run(dataset) {
3237
- dataset.typed = true;
3238
- return dataset;
3239
- }
3240
- };
3348
+ return {
3349
+ kind: "schema",
3350
+ type: "unknown",
3351
+ reference: unknown,
3352
+ expects: "unknown",
3353
+ async: false,
3354
+ get "~standard"() {
3355
+ return /* @__PURE__ */ _getStandardProps(this);
3356
+ },
3357
+ "~run"(dataset) {
3358
+ dataset.typed = true;
3359
+ return dataset;
3360
+ }
3361
+ };
3241
3362
  }
3242
3363
 
3243
- // src/methods/parse/parse.ts
3244
- function parse(schema, input, config2) {
3245
- const dataset = schema._run(
3246
- { typed: false, value: input },
3247
- getGlobalConfig(config2)
3248
- );
3249
- if (dataset.issues) {
3250
- throw new ValiError(dataset.issues);
3251
- }
3252
- return dataset.value;
3364
+ //#endregion
3365
+ //#region src/methods/parse/parse.ts
3366
+ /**
3367
+ * Parses an unknown input based on a schema.
3368
+ *
3369
+ * @param schema The schema to be used.
3370
+ * @param input The input to be parsed.
3371
+ * @param config The parse configuration.
3372
+ *
3373
+ * @returns The parsed input.
3374
+ */
3375
+ function parse(schema, input, config$1) {
3376
+ const dataset = schema["~run"]({ value: input }, /* @__PURE__ */ getGlobalConfig(config$1));
3377
+ if (dataset.issues) throw new ValiError(dataset.issues);
3378
+ return dataset.value;
3253
3379
  }
3254
3380
 
3255
- // src/methods/pipe/pipe.ts
3256
- function pipe(...pipe2) {
3257
- return {
3258
- ...pipe2[0],
3259
- pipe: pipe2,
3260
- _run(dataset, config2) {
3261
- for (let index = 0; index < pipe2.length; index++) {
3262
- if (dataset.issues && (pipe2[index].kind === "schema" || pipe2[index].kind === "transformation")) {
3263
- dataset.typed = false;
3264
- break;
3265
- }
3266
- if (!dataset.issues || !config2.abortEarly && !config2.abortPipeEarly) {
3267
- dataset = pipe2[index]._run(dataset, config2);
3268
- }
3269
- }
3270
- return dataset;
3271
- }
3272
- };
3381
+ //#endregion
3382
+ //#region src/methods/pipe/pipe.ts
3383
+ /* @__NO_SIDE_EFFECTS__ */
3384
+ function pipe(...pipe$1) {
3385
+ return {
3386
+ ...pipe$1[0],
3387
+ pipe: pipe$1,
3388
+ get "~standard"() {
3389
+ return /* @__PURE__ */ _getStandardProps(this);
3390
+ },
3391
+ "~run"(dataset, config$1) {
3392
+ for (const item of pipe$1) if (item.kind !== "metadata") {
3393
+ if (dataset.issues && (item.kind === "schema" || item.kind === "transformation")) {
3394
+ dataset.typed = false;
3395
+ break;
3396
+ }
3397
+ if (!dataset.issues || !config$1.abortEarly && !config$1.abortPipeEarly) dataset = item["~run"](dataset, config$1);
3398
+ }
3399
+ return dataset;
3400
+ }
3401
+ };
3273
3402
  }
3274
3403
 
3275
3404
  const SUI_NS_NAME_REGEX = /^(?!.*(^(?!@)|[-.@])($|[-.@]))(?:[a-z0-9-]{0,63}(?:\.[a-z0-9-]{0,63})*)?@[a-z0-9-]{0,63}$/i;
@@ -3388,10 +3517,12 @@ function safeEnum(options) {
3388
3517
  const unionOptions = Object.entries(options).map(([key, value]) => object({ [key]: value }));
3389
3518
  return pipe(
3390
3519
  union(unionOptions),
3391
- transform((value) => ({
3392
- ...value,
3393
- $kind: Object.keys(value)[0]
3394
- }))
3520
+ transform(
3521
+ (value) => ({
3522
+ ...value,
3523
+ $kind: Object.keys(value)[0]
3524
+ })
3525
+ )
3395
3526
  );
3396
3527
  }
3397
3528
  const SuiAddress = pipe(
@@ -7677,6 +7808,7 @@ runPlugins_fn = async function(plugins, options) {
7677
7808
  } finally {
7678
7809
  __privateSet$4(this, _inputSection, __privateGet$4(this, _data$1).inputs.slice());
7679
7810
  __privateSet$4(this, _commandSection, __privateGet$4(this, _data$1).commands.slice());
7811
+ __privateSet$4(this, _availableResults, new Set(__privateGet$4(this, _commandSection).map((_, i) => i)));
7680
7812
  }
7681
7813
  };
7682
7814
  waitForPendingTasks_fn = async function() {
@@ -19291,9 +19423,18 @@ function deriveKeypairFromMnemonic(mnemonic, index) {
19291
19423
  * Read and validate MNEMONIC from env.
19292
19424
  */
19293
19425
  function getMnemonic() {
19294
- const mnemonic = process.env.MNEMONIC;
19426
+ const mnemonic = process.env.DIPCOIN_MNEMONIC;
19295
19427
  if (!mnemonic) {
19296
- console.error(`Error: MNEMONIC not set. Create config at ${globalEnv}`);
19428
+ console.error(`Error: DIPCOIN_MNEMONIC not set.\n`);
19429
+ console.error(`Option 1 — Create a config file:\n`);
19430
+ console.error(` mkdir -p ~/.config/dipcoin`);
19431
+ console.error(` cat > ~/.config/dipcoin/env << 'EOF'`);
19432
+ console.error(`DIPCOIN_MNEMONIC=word1 word2 word3 ... word12`);
19433
+ console.error(`DIPCOIN_NETWORK=testnet`);
19434
+ console.error(`EOF\n`);
19435
+ console.error(`Option 2 — Export environment variables:\n`);
19436
+ console.error(` export DIPCOIN_MNEMONIC="word1 word2 word3 ... word12"`);
19437
+ console.error(` export DIPCOIN_NETWORK=testnet # or mainnet\n`);
19297
19438
  process.exit(1);
19298
19439
  }
19299
19440
  return mnemonic;
@@ -19302,7 +19443,7 @@ function getMnemonic() {
19302
19443
  * Get the network from env.
19303
19444
  */
19304
19445
  function getNetwork() {
19305
- return process.env.NETWORK || "testnet";
19446
+ return process.env.DIPCOIN_NETWORK || "testnet";
19306
19447
  }
19307
19448
  /**
19308
19449
  * Trading mode SDK: main keypair = index 0, sub keypair = index N.
@@ -19389,7 +19530,7 @@ function getGlobalVaultIndex(prog) {
19389
19530
  return n;
19390
19531
  }
19391
19532
  // Fallback to DEFAULT_VAULT_INDEX env
19392
- const envDefault = process.env.DEFAULT_VAULT_INDEX;
19533
+ const envDefault = process.env.DIPCOIN_DEFAULT_VAULT_INDEX;
19393
19534
  if (envDefault !== undefined) {
19394
19535
  const n = Number(envDefault);
19395
19536
  if (!isNaN(n) && n >= 0)
@@ -20490,11 +20631,27 @@ function registerBalanceCommand(program) {
20490
20631
  });
20491
20632
  }
20492
20633
 
20634
+ function getPackageVersion() {
20635
+ try {
20636
+ // Works in both ESM and CJS after bundling
20637
+ const pkgPath = path.resolve(path.dirname(url.fileURLToPath((typeof document === 'undefined' ? new (require('u' + 'rl').URL)('file:' + __filename).href : (document.currentScript && document.currentScript.tagName.toUpperCase() === 'SCRIPT' && document.currentScript.src || new URL('cli.cjs', document.baseURI).href)))), "../package.json");
20638
+ return JSON.parse(fs.readFileSync(pkgPath, "utf-8")).version;
20639
+ }
20640
+ catch {
20641
+ try {
20642
+ // Fallback: resolve from cwd
20643
+ return JSON.parse(fs.readFileSync(path.resolve(process.cwd(), "package.json"), "utf-8")).version;
20644
+ }
20645
+ catch {
20646
+ return "0.0.0";
20647
+ }
20648
+ }
20649
+ }
20493
20650
  const program = new commander.Command();
20494
20651
  program
20495
20652
  .name("dipcoin-cli")
20496
20653
  .description("DipCoin Perpetual Trading CLI")
20497
- .version("0.5.0")
20654
+ .version(getPackageVersion())
20498
20655
  .option("--json", "Output in JSON format")
20499
20656
  .option("--vault-index <n>", "Vault index (1+ for HD-derived sub-accounts)");
20500
20657
  registerAccountCommands(program);