@dxtmisha/functional-basic 1.4.0 → 1.4.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/CHANGELOG.md +15 -0
- package/ai-description.md +19 -22
- package/ai-types.md +154 -53
- package/dist/library.js +94 -58
- package/dist/src/classes/Api.d.ts +8 -0
- package/dist/src/classes/ApiInstance.d.ts +11 -0
- package/dist/src/classes/GeoFlag.d.ts +29 -1
- package/dist/src/types/apiTypes.d.ts +4 -0
- package/dist/src/types/geoTypes.d.ts +4 -0
- package/package.json +1 -1
package/dist/library.js
CHANGED
|
@@ -1597,9 +1597,9 @@ var Ye = "d-response-loading", Xe = class {
|
|
|
1597
1597
|
}
|
|
1598
1598
|
}, Ze = class {
|
|
1599
1599
|
constructor(e = "/api/", t = {}) {
|
|
1600
|
-
w(this, "url", void 0), w(this, "headers", void 0), w(this, "requestDefault", void 0), w(this, "status", void 0), w(this, "response", void 0), w(this, "preparation", void 0), w(this, "loading", void 0), w(this, "errorCenter", void 0), w(this, "hydration", void 0), w(this, "timeout", 16e3), w(this, "origin", void 0), this.url = e;
|
|
1601
|
-
let { headersClass: n = We, requestDefaultClass: r = Be, statusClass: i = Le, responseClass: a = Xe, preparationClass: o = qe, loadingClass: s = N.getItem(), errorCenterClass: c = T.getItem(), hydrationClass: l = Ke } = t;
|
|
1602
|
-
this.headers = new n(), this.requestDefault = new r(), this.status = new i(), this.response = new a(this.requestDefault), this.preparation = new o(), this.loading = s, this.errorCenter = c, this.hydration = new l(), this.hydration.initResponse(this.response);
|
|
1600
|
+
w(this, "url", void 0), w(this, "headers", void 0), w(this, "requestDefault", void 0), w(this, "status", void 0), w(this, "response", void 0), w(this, "preparation", void 0), w(this, "loading", void 0), w(this, "errorCenter", void 0), w(this, "hydration", void 0), w(this, "timeout", 16e3), w(this, "origin", void 0), w(this, "wrapper", void 0), this.url = e;
|
|
1601
|
+
let { headersClass: n = We, requestDefaultClass: r = Be, statusClass: i = Le, responseClass: a = Xe, preparationClass: o = qe, loadingClass: s = N.getItem(), errorCenterClass: c = T.getItem(), hydrationClass: l = Ke, wrapper: u } = t;
|
|
1602
|
+
this.headers = new n(), this.requestDefault = new r(), this.status = new i(), this.response = new a(this.requestDefault), this.preparation = new o(), this.loading = s, this.errorCenter = c, this.hydration = new l(), this.wrapper = u, this.hydration.initResponse(this.response);
|
|
1603
1603
|
}
|
|
1604
1604
|
isLocalhost() {
|
|
1605
1605
|
return s() && typeof location < "u" && location.hostname === "localhost";
|
|
@@ -1654,8 +1654,13 @@ var Ye = "d-response-loading", Xe = class {
|
|
|
1654
1654
|
setOrigin(e) {
|
|
1655
1655
|
return this.origin = e, this;
|
|
1656
1656
|
}
|
|
1657
|
+
setWrapper(e) {
|
|
1658
|
+
return this.wrapper = e, this;
|
|
1659
|
+
}
|
|
1657
1660
|
async request(e) {
|
|
1658
|
-
|
|
1661
|
+
var t;
|
|
1662
|
+
let n = d(e) ? { path: e } : e, r = (t = n.wrapper) == null ? this.wrapper : t;
|
|
1663
|
+
return r ? await r(() => this.fetch(n), n) : await this.fetch(n);
|
|
1659
1664
|
}
|
|
1660
1665
|
get(e) {
|
|
1661
1666
|
return this.request({
|
|
@@ -1862,8 +1867,11 @@ var Ye = "d-response-loading", Xe = class {
|
|
|
1862
1867
|
static setOrigin(e) {
|
|
1863
1868
|
this.getItem().setOrigin(e);
|
|
1864
1869
|
}
|
|
1870
|
+
static setWrapper(e) {
|
|
1871
|
+
this.getItem().setWrapper(e);
|
|
1872
|
+
}
|
|
1865
1873
|
static setConfig(e) {
|
|
1866
|
-
e && n(e) && (e.urlRoot && this.setUrl(e.urlRoot), e.headers && this.setHeaders(e.headers), e.requestDefault && this.setRequestDefault(e.requestDefault), e.preparation && this.setPreparation(e.preparation), e.end && this.setEnd(e.end), e.timeout && this.setTimeout(e.timeout), e.devMode && this.getResponse().setDevMode(e.devMode), e.origin && this.setOrigin(e.origin));
|
|
1874
|
+
e && n(e) && (e.urlRoot && this.setUrl(e.urlRoot), e.headers && this.setHeaders(e.headers), e.requestDefault && this.setRequestDefault(e.requestDefault), e.preparation && this.setPreparation(e.preparation), e.end && this.setEnd(e.end), e.timeout && this.setTimeout(e.timeout), e.devMode && this.getResponse().setDevMode(e.devMode), e.origin && this.setOrigin(e.origin), e.wrapper && this.setWrapper(e.wrapper));
|
|
1867
1875
|
}
|
|
1868
1876
|
static async request(e) {
|
|
1869
1877
|
return this.getItem().request(e);
|
|
@@ -2682,8 +2690,10 @@ var H = /* @__PURE__ */ function(e) {
|
|
|
2682
2690
|
var r;
|
|
2683
2691
|
let t = this.getCountry(n);
|
|
2684
2692
|
return {
|
|
2685
|
-
language: this.
|
|
2693
|
+
language: this.getLanguageName(n),
|
|
2694
|
+
languageCode: n.language,
|
|
2686
2695
|
country: t,
|
|
2696
|
+
countryCode: n.country,
|
|
2687
2697
|
standard: n.standard,
|
|
2688
2698
|
icon: (r = e.flags) == null ? void 0 : r[n.country],
|
|
2689
2699
|
label: t,
|
|
@@ -2692,6 +2702,14 @@ var H = /* @__PURE__ */ function(e) {
|
|
|
2692
2702
|
};
|
|
2693
2703
|
}
|
|
2694
2704
|
}
|
|
2705
|
+
getLanguage(e = this.getCode()) {
|
|
2706
|
+
let t = this.get(e);
|
|
2707
|
+
if (t) return {
|
|
2708
|
+
...t,
|
|
2709
|
+
label: t.language,
|
|
2710
|
+
value: t.languageCode
|
|
2711
|
+
};
|
|
2712
|
+
}
|
|
2695
2713
|
getCode() {
|
|
2696
2714
|
return this.code || A.getLocation();
|
|
2697
2715
|
}
|
|
@@ -2703,6 +2721,13 @@ var H = /* @__PURE__ */ function(e) {
|
|
|
2703
2721
|
let n = r(this.getCodes(e), (e) => this.get(e));
|
|
2704
2722
|
return t ? new R().sort(n, (e, t) => [e.label, t.label]) : n;
|
|
2705
2723
|
}
|
|
2724
|
+
getListLanguage(e, t = !0) {
|
|
2725
|
+
let n = [], i = /* @__PURE__ */ new Set();
|
|
2726
|
+
return r(this.getCodes(e), (e) => {
|
|
2727
|
+
let t = this.getLanguage(e);
|
|
2728
|
+
t && !i.has(t.value) && (n.push(t), i.add(t.value));
|
|
2729
|
+
}), t ? new R().sort(n, (e, t) => [e.label, t.label]) : n;
|
|
2730
|
+
}
|
|
2706
2731
|
getNational(t, n = !0) {
|
|
2707
2732
|
let i = r(this.getList(t, !1), (t) => {
|
|
2708
2733
|
let n = new e(t.standard).get(t.standard);
|
|
@@ -2715,6 +2740,18 @@ var H = /* @__PURE__ */ function(e) {
|
|
|
2715
2740
|
});
|
|
2716
2741
|
return n ? new R().sort(i, (e, t) => [e.label, t.label]) : i;
|
|
2717
2742
|
}
|
|
2743
|
+
getNationalLanguage(t, n = !0) {
|
|
2744
|
+
let i = r(this.getListLanguage(t, !1), (t) => {
|
|
2745
|
+
let n = new e(t.standard).getLanguage(t.standard);
|
|
2746
|
+
return {
|
|
2747
|
+
...t,
|
|
2748
|
+
description: n == null ? void 0 : n.language,
|
|
2749
|
+
nationalLanguage: n == null ? void 0 : n.language,
|
|
2750
|
+
nationalCountry: n == null ? void 0 : n.country
|
|
2751
|
+
};
|
|
2752
|
+
});
|
|
2753
|
+
return n ? new R().sort(i, (e, t) => [e.label, t.label]) : i;
|
|
2754
|
+
}
|
|
2718
2755
|
setCode(e) {
|
|
2719
2756
|
return this.code = e, this;
|
|
2720
2757
|
}
|
|
@@ -2724,7 +2761,7 @@ var H = /* @__PURE__ */ function(e) {
|
|
|
2724
2761
|
getCodes(t) {
|
|
2725
2762
|
return t == null ? Object.keys(e.flags) : t;
|
|
2726
2763
|
}
|
|
2727
|
-
|
|
2764
|
+
getLanguageName(e) {
|
|
2728
2765
|
return this.getLocation().languageName(e.language);
|
|
2729
2766
|
}
|
|
2730
2767
|
getCountry(e) {
|
|
@@ -2732,13 +2769,62 @@ var H = /* @__PURE__ */ function(e) {
|
|
|
2732
2769
|
}
|
|
2733
2770
|
};
|
|
2734
2771
|
w(ct, "flags", {
|
|
2772
|
+
RU: "f-ru",
|
|
2773
|
+
FR: "f-fr",
|
|
2774
|
+
GB: "f-gb",
|
|
2775
|
+
US: "f-us",
|
|
2776
|
+
DE: "f-de",
|
|
2777
|
+
ES: "f-es",
|
|
2778
|
+
VN: "f-vn",
|
|
2779
|
+
CN: "f-cn",
|
|
2780
|
+
IT: "f-it",
|
|
2781
|
+
JP: "f-jp",
|
|
2782
|
+
KR: "f-kr",
|
|
2783
|
+
PT: "f-pt",
|
|
2784
|
+
TR: "f-tr",
|
|
2785
|
+
PL: "f-pl",
|
|
2786
|
+
NL: "f-nl",
|
|
2787
|
+
UA: "f-ua",
|
|
2788
|
+
BY: "f-by",
|
|
2789
|
+
KZ: "f-kz",
|
|
2790
|
+
GR: "f-gr",
|
|
2791
|
+
CZ: "f-cz",
|
|
2792
|
+
HU: "f-hu",
|
|
2793
|
+
RO: "f-ro",
|
|
2794
|
+
BG: "f-bg",
|
|
2795
|
+
HR: "f-hr",
|
|
2796
|
+
RS: "f-rs",
|
|
2797
|
+
SK: "f-sk",
|
|
2798
|
+
SI: "f-si",
|
|
2799
|
+
LT: "f-lt",
|
|
2800
|
+
LV: "f-lv",
|
|
2801
|
+
EE: "f-ee",
|
|
2802
|
+
FI: "f-fi",
|
|
2803
|
+
SE: "f-se",
|
|
2804
|
+
NO: "f-no",
|
|
2805
|
+
DK: "f-dk",
|
|
2806
|
+
IL: "f-il",
|
|
2807
|
+
TH: "f-th",
|
|
2808
|
+
ID: "f-id",
|
|
2809
|
+
MY: "f-my",
|
|
2810
|
+
PH: "f-ph",
|
|
2811
|
+
SA: "f-sa",
|
|
2812
|
+
IR: "f-ir",
|
|
2813
|
+
PK: "f-pk",
|
|
2814
|
+
AM: "f-am",
|
|
2815
|
+
GE: "f-ge",
|
|
2816
|
+
AZ: "f-az",
|
|
2817
|
+
TJ: "f-tj",
|
|
2818
|
+
KG: "f-kg",
|
|
2819
|
+
UZ: "f-uz",
|
|
2820
|
+
TM: "f-tm",
|
|
2821
|
+
MN: "f-mn",
|
|
2735
2822
|
AD: "f-ad",
|
|
2736
2823
|
AE: "f-ae",
|
|
2737
2824
|
AF: "f-af",
|
|
2738
2825
|
AG: "f-ag",
|
|
2739
2826
|
AI: "f-ai",
|
|
2740
2827
|
AL: "f-al",
|
|
2741
|
-
AM: "f-am",
|
|
2742
2828
|
AN: "f-an",
|
|
2743
2829
|
AO: "f-ao",
|
|
2744
2830
|
AQ: "f-aq",
|
|
@@ -2747,13 +2833,11 @@ w(ct, "flags", {
|
|
|
2747
2833
|
AT: "f-at",
|
|
2748
2834
|
AU: "f-au",
|
|
2749
2835
|
AW: "f-aw",
|
|
2750
|
-
AZ: "f-az",
|
|
2751
2836
|
BA: "f-ba",
|
|
2752
2837
|
BB: "f-bb",
|
|
2753
2838
|
BD: "f-bd",
|
|
2754
2839
|
BE: "f-be",
|
|
2755
2840
|
BF: "f-bf",
|
|
2756
|
-
BG: "f-bg",
|
|
2757
2841
|
BH: "f-bh",
|
|
2758
2842
|
BI: "f-bi",
|
|
2759
2843
|
BJ: "f-bj",
|
|
@@ -2765,7 +2849,6 @@ w(ct, "flags", {
|
|
|
2765
2849
|
BS: "f-bs",
|
|
2766
2850
|
BT: "f-bt",
|
|
2767
2851
|
BW: "f-bw",
|
|
2768
|
-
BY: "f-by",
|
|
2769
2852
|
BZ: "f-bz",
|
|
2770
2853
|
CA: "f-ca",
|
|
2771
2854
|
CC: "f-cc",
|
|
@@ -2777,7 +2860,6 @@ w(ct, "flags", {
|
|
|
2777
2860
|
CK: "f-ck",
|
|
2778
2861
|
CL: "f-cl",
|
|
2779
2862
|
CM: "f-cm",
|
|
2780
|
-
CN: "f-cn",
|
|
2781
2863
|
CO: "f-co",
|
|
2782
2864
|
CR: "f-cr",
|
|
2783
2865
|
CU: "f-cu",
|
|
@@ -2785,29 +2867,20 @@ w(ct, "flags", {
|
|
|
2785
2867
|
CW: "f-cw",
|
|
2786
2868
|
CX: "f-cx",
|
|
2787
2869
|
CY: "f-cy",
|
|
2788
|
-
CZ: "f-cz",
|
|
2789
|
-
DE: "f-de",
|
|
2790
2870
|
DJ: "f-dj",
|
|
2791
|
-
DK: "f-dk",
|
|
2792
2871
|
DM: "f-dm",
|
|
2793
2872
|
DZ: "f-dz",
|
|
2794
2873
|
EC: "f-ec",
|
|
2795
|
-
EE: "f-ee",
|
|
2796
2874
|
EG: "f-eg",
|
|
2797
2875
|
EH: "f-eh",
|
|
2798
2876
|
ER: "f-er",
|
|
2799
|
-
ES: "f-es",
|
|
2800
2877
|
ET: "f-et",
|
|
2801
|
-
FI: "f-fi",
|
|
2802
2878
|
FJ: "f-fj",
|
|
2803
2879
|
FK: "f-fk",
|
|
2804
2880
|
FM: "f-fm",
|
|
2805
2881
|
FO: "f-fo",
|
|
2806
|
-
FR: "f-fr",
|
|
2807
2882
|
GA: "f-ga",
|
|
2808
|
-
GB: "f-gb",
|
|
2809
2883
|
GD: "f-gd",
|
|
2810
|
-
GE: "f-ge",
|
|
2811
2884
|
GF: "f-gf",
|
|
2812
2885
|
GG: "f-gg",
|
|
2813
2886
|
GH: "f-gh",
|
|
@@ -2816,41 +2889,29 @@ w(ct, "flags", {
|
|
|
2816
2889
|
GM: "f-gm",
|
|
2817
2890
|
GN: "f-gn",
|
|
2818
2891
|
GQ: "f-gq",
|
|
2819
|
-
GR: "f-gr",
|
|
2820
2892
|
GT: "f-gt",
|
|
2821
2893
|
GU: "f-gu",
|
|
2822
2894
|
GW: "f-gw",
|
|
2823
2895
|
GY: "f-gy",
|
|
2824
2896
|
HK: "f-hk",
|
|
2825
2897
|
HN: "f-hn",
|
|
2826
|
-
HR: "f-hr",
|
|
2827
2898
|
HT: "f-ht",
|
|
2828
|
-
HU: "f-hu",
|
|
2829
|
-
ID: "f-id",
|
|
2830
2899
|
IE: "f-ie",
|
|
2831
|
-
IL: "f-il",
|
|
2832
2900
|
IM: "f-im",
|
|
2833
|
-
IN: "f-in",
|
|
2834
2901
|
IO: "f-io",
|
|
2835
2902
|
IQ: "f-iq",
|
|
2836
|
-
IR: "f-ir",
|
|
2837
2903
|
IS: "f-is",
|
|
2838
|
-
IT: "f-it",
|
|
2839
2904
|
JE: "f-je",
|
|
2840
2905
|
JM: "f-jm",
|
|
2841
2906
|
JO: "f-jo",
|
|
2842
|
-
JP: "f-jp",
|
|
2843
2907
|
KE: "f-ke",
|
|
2844
|
-
KG: "f-kg",
|
|
2845
2908
|
KH: "f-kh",
|
|
2846
2909
|
KI: "f-ki",
|
|
2847
2910
|
KM: "f-km",
|
|
2848
2911
|
KN: "f-kn",
|
|
2849
2912
|
KP: "f-kp",
|
|
2850
|
-
KR: "f-kr",
|
|
2851
2913
|
KW: "f-kw",
|
|
2852
2914
|
KY: "f-ky",
|
|
2853
|
-
KZ: "f-kz",
|
|
2854
2915
|
LA: "f-la",
|
|
2855
2916
|
LB: "f-lb",
|
|
2856
2917
|
LC: "f-lc",
|
|
@@ -2858,9 +2919,7 @@ w(ct, "flags", {
|
|
|
2858
2919
|
LK: "f-lk",
|
|
2859
2920
|
LR: "f-lr",
|
|
2860
2921
|
LS: "f-ls",
|
|
2861
|
-
LT: "f-lt",
|
|
2862
2922
|
LU: "f-lu",
|
|
2863
|
-
LV: "f-lv",
|
|
2864
2923
|
LY: "f-ly",
|
|
2865
2924
|
MA: "f-ma",
|
|
2866
2925
|
MC: "f-mc",
|
|
@@ -2872,7 +2931,6 @@ w(ct, "flags", {
|
|
|
2872
2931
|
MK: "f-mk",
|
|
2873
2932
|
ML: "f-ml",
|
|
2874
2933
|
MM: "f-mm",
|
|
2875
|
-
MN: "f-mn",
|
|
2876
2934
|
MO: "f-mo",
|
|
2877
2935
|
MP: "f-mp",
|
|
2878
2936
|
MQ: "f-mq",
|
|
@@ -2883,7 +2941,6 @@ w(ct, "flags", {
|
|
|
2883
2941
|
MV: "f-mv",
|
|
2884
2942
|
MW: "f-mw",
|
|
2885
2943
|
MX: "f-mx",
|
|
2886
|
-
MY: "f-my",
|
|
2887
2944
|
MZ: "f-mz",
|
|
2888
2945
|
NA: "f-na",
|
|
2889
2946
|
NC: "f-nc",
|
|
@@ -2891,8 +2948,6 @@ w(ct, "flags", {
|
|
|
2891
2948
|
NF: "f-nf",
|
|
2892
2949
|
NG: "f-ng",
|
|
2893
2950
|
NI: "f-ni",
|
|
2894
|
-
NL: "f-nl",
|
|
2895
|
-
NO: "f-no",
|
|
2896
2951
|
NP: "f-np",
|
|
2897
2952
|
NR: "f-nr",
|
|
2898
2953
|
NU: "f-nu",
|
|
@@ -2902,32 +2957,21 @@ w(ct, "flags", {
|
|
|
2902
2957
|
PE: "f-pe",
|
|
2903
2958
|
PF: "f-pf",
|
|
2904
2959
|
PG: "f-pg",
|
|
2905
|
-
PH: "f-ph",
|
|
2906
|
-
PK: "f-pk",
|
|
2907
|
-
PL: "f-pl",
|
|
2908
2960
|
PM: "f-pm",
|
|
2909
2961
|
PN: "f-pn",
|
|
2910
2962
|
PR: "f-pr",
|
|
2911
2963
|
PS: "f-ps",
|
|
2912
|
-
PT: "f-pt",
|
|
2913
2964
|
PW: "f-pw",
|
|
2914
2965
|
PY: "f-py",
|
|
2915
2966
|
QA: "f-qa",
|
|
2916
2967
|
RE: "f-re",
|
|
2917
|
-
RO: "f-ro",
|
|
2918
|
-
RS: "f-rs",
|
|
2919
|
-
RU: "f-ru",
|
|
2920
2968
|
RW: "f-rw",
|
|
2921
|
-
SA: "f-sa",
|
|
2922
2969
|
SB: "f-sb",
|
|
2923
2970
|
SC: "f-sc",
|
|
2924
2971
|
SD: "f-sd",
|
|
2925
|
-
SE: "f-se",
|
|
2926
2972
|
SG: "f-sg",
|
|
2927
2973
|
SH: "f-sh",
|
|
2928
|
-
SI: "f-si",
|
|
2929
2974
|
SJ: "f-sj",
|
|
2930
|
-
SK: "f-sk",
|
|
2931
2975
|
SL: "f-sl",
|
|
2932
2976
|
SM: "f-sm",
|
|
2933
2977
|
SN: "f-sn",
|
|
@@ -2942,29 +2986,21 @@ w(ct, "flags", {
|
|
|
2942
2986
|
TC: "f-tc",
|
|
2943
2987
|
TD: "f-td",
|
|
2944
2988
|
TG: "f-tg",
|
|
2945
|
-
TH: "f-th",
|
|
2946
|
-
TJ: "f-tj",
|
|
2947
2989
|
TK: "f-tk",
|
|
2948
2990
|
TL: "f-tl",
|
|
2949
|
-
TM: "f-tm",
|
|
2950
2991
|
TN: "f-tn",
|
|
2951
2992
|
TO: "f-to",
|
|
2952
|
-
TR: "f-tr",
|
|
2953
2993
|
TT: "f-tt",
|
|
2954
2994
|
TV: "f-tv",
|
|
2955
2995
|
TW: "f-tw",
|
|
2956
2996
|
TZ: "f-tz",
|
|
2957
|
-
UA: "f-ua",
|
|
2958
2997
|
UG: "f-ug",
|
|
2959
|
-
US: "f-us",
|
|
2960
2998
|
UY: "f-uy",
|
|
2961
|
-
UZ: "f-uz",
|
|
2962
2999
|
VA: "f-va",
|
|
2963
3000
|
VC: "f-vc",
|
|
2964
3001
|
VE: "f-ve",
|
|
2965
3002
|
VG: "f-vg",
|
|
2966
3003
|
VI: "f-vi",
|
|
2967
|
-
VN: "f-vn",
|
|
2968
3004
|
VU: "f-vu",
|
|
2969
3005
|
WF: "f-wf",
|
|
2970
3006
|
WS: "f-ws",
|
|
@@ -142,6 +142,14 @@ export declare class Api {
|
|
|
142
142
|
* @returns void / ничего не возвращает
|
|
143
143
|
*/
|
|
144
144
|
static setOrigin(origin: string): void;
|
|
145
|
+
/**
|
|
146
|
+
* Sets the wrapper function for requests.
|
|
147
|
+
*
|
|
148
|
+
* Устанавливает функцию-обертку для запросов.
|
|
149
|
+
* @param wrapper wrapper function / функция-обертка
|
|
150
|
+
* @returns void / ничего не возвращает
|
|
151
|
+
*/
|
|
152
|
+
static setWrapper(wrapper: <R>(callback: () => Promise<R>, apiFetch: ApiFetch) => Promise<R>): void;
|
|
145
153
|
/**
|
|
146
154
|
* Sets multiple API configuration options at once.
|
|
147
155
|
*
|
|
@@ -26,6 +26,8 @@ export type ApiInstanceOptions = {
|
|
|
26
26
|
errorCenterClass?: ErrorCenterInstance;
|
|
27
27
|
/** Class for working with hydration / Класс для работы с гидратацией */
|
|
28
28
|
hydrationClass?: typeof ApiHydration;
|
|
29
|
+
/** Wrapper function for requests / Функция-обертка для запросов */
|
|
30
|
+
wrapper?: <R>(callback: () => Promise<R>, apiFetch: ApiFetch) => Promise<R>;
|
|
29
31
|
};
|
|
30
32
|
/**
|
|
31
33
|
* Core class for managing HTTP requests using the Fetch API.
|
|
@@ -53,6 +55,8 @@ export declare class ApiInstance {
|
|
|
53
55
|
/** Timeout for the request in milliseconds / Таймаут запроса в миллисекундах */
|
|
54
56
|
protected timeout: number;
|
|
55
57
|
protected origin?: string;
|
|
58
|
+
/** Wrapper function for requests / Функция-обертка для запросов */
|
|
59
|
+
protected wrapper?: <R>(callback: () => Promise<R>, apiFetch: ApiFetch) => Promise<R>;
|
|
56
60
|
/**
|
|
57
61
|
* Constructor
|
|
58
62
|
* @param url base path to the script / базовый путь к скрипту
|
|
@@ -178,6 +182,13 @@ export declare class ApiInstance {
|
|
|
178
182
|
* @param origin protocol and domain / протокол и домен
|
|
179
183
|
*/
|
|
180
184
|
setOrigin(origin: string): this;
|
|
185
|
+
/**
|
|
186
|
+
* Sets the wrapper function for requests.
|
|
187
|
+
*
|
|
188
|
+
* Устанавливает функцию-обертку для запросов.
|
|
189
|
+
* @param wrapper wrapper function / функция-обертка
|
|
190
|
+
*/
|
|
191
|
+
setWrapper(wrapper: <R>(callback: () => Promise<R>, apiFetch: ApiFetch) => Promise<R>): this;
|
|
181
192
|
/**
|
|
182
193
|
* Executes a request with the given path or configuration.
|
|
183
194
|
*
|
|
@@ -30,6 +30,14 @@ export declare class GeoFlag {
|
|
|
30
30
|
* @returns country information / информация о стране
|
|
31
31
|
*/
|
|
32
32
|
get(code?: string): GeoFlagItem | undefined;
|
|
33
|
+
/**
|
|
34
|
+
* Returns information about the language and its flag.
|
|
35
|
+
*
|
|
36
|
+
* Возвращает информацию о языке и его флаге.
|
|
37
|
+
* @param code country code / код страны
|
|
38
|
+
* @returns language information / информация о языке
|
|
39
|
+
*/
|
|
40
|
+
getLanguage(code?: string): GeoFlagItem | undefined;
|
|
33
41
|
/**
|
|
34
42
|
* Returns the country code.
|
|
35
43
|
*
|
|
@@ -56,6 +64,17 @@ export declare class GeoFlag {
|
|
|
56
64
|
* @returns list of countries / список стран
|
|
57
65
|
*/
|
|
58
66
|
getList(codes?: string[], sort?: boolean): GeoFlagItem[];
|
|
67
|
+
/**
|
|
68
|
+
* Returns a list of languages based on the provided codes.
|
|
69
|
+
* If no codes are provided, returns all available languages.
|
|
70
|
+
*
|
|
71
|
+
* Возвращает список языков на основе предоставленных кодов.
|
|
72
|
+
* Если коды не переданы, возвращает все доступные языки.
|
|
73
|
+
* @param codes array of country codes / массив кодов стран
|
|
74
|
+
* @param sort whether to sort the list / сортировать ли список
|
|
75
|
+
* @returns list of languages / список языков
|
|
76
|
+
*/
|
|
77
|
+
getListLanguage(codes?: string[], sort?: boolean): GeoFlagItem[];
|
|
59
78
|
/**
|
|
60
79
|
* Returns a list of countries in their national languages.
|
|
61
80
|
*
|
|
@@ -65,6 +84,15 @@ export declare class GeoFlag {
|
|
|
65
84
|
* @returns list of countries with national names / список стран с национальными названиями
|
|
66
85
|
*/
|
|
67
86
|
getNational(codes?: string[], sort?: boolean): GeoFlagNational[];
|
|
87
|
+
/**
|
|
88
|
+
* Returns a list of languages in their national names.
|
|
89
|
+
*
|
|
90
|
+
* Возвращает список языков на их национальных названиях.
|
|
91
|
+
* @param codes array of country codes / массив кодов стран
|
|
92
|
+
* @param sort whether to sort the list / сортировать ли список
|
|
93
|
+
* @returns list of languages with national names / список языков с национальными названиями
|
|
94
|
+
*/
|
|
95
|
+
getNationalLanguage(codes?: string[], sort?: boolean): GeoFlagNational[];
|
|
68
96
|
/**
|
|
69
97
|
* Changes the current locale/location.
|
|
70
98
|
*
|
|
@@ -96,7 +124,7 @@ export declare class GeoFlag {
|
|
|
96
124
|
* Получение названия языка.
|
|
97
125
|
* @param data object with information of data/ объект с информацией данных
|
|
98
126
|
*/
|
|
99
|
-
protected
|
|
127
|
+
protected getLanguageName(data: GeoItemFull): string;
|
|
100
128
|
/**
|
|
101
129
|
* Getting the name of the country.
|
|
102
130
|
*
|
|
@@ -65,6 +65,8 @@ export type ApiConfig = {
|
|
|
65
65
|
timeout?: number;
|
|
66
66
|
/** Enable development logging/ Включить логирование разработки */
|
|
67
67
|
devMode?: boolean;
|
|
68
|
+
/** Wrapper function for requests / Функция-обертка для запросов */
|
|
69
|
+
wrapper?: <R>(callback: () => Promise<R>, apiFetch: ApiFetch) => Promise<R>;
|
|
68
70
|
};
|
|
69
71
|
/**
|
|
70
72
|
* Shape of API response data wrapper/ Структура обёртки данных ответа API
|
|
@@ -163,6 +165,8 @@ export type ApiFetch = {
|
|
|
163
165
|
cacheId?: number | string;
|
|
164
166
|
/** Limit of end reset/ Лимит сброса end */
|
|
165
167
|
endResetLimit?: number;
|
|
168
|
+
/** Wrapper function for requests / Функция-обертка для запросов */
|
|
169
|
+
wrapper?: <R>(callback: () => Promise<R>, apiFetch: ApiFetch) => Promise<R>;
|
|
166
170
|
};
|
|
167
171
|
/**
|
|
168
172
|
* Type of API hydration item/ Тип элемента гидратации API
|
|
@@ -49,8 +49,12 @@ export interface GeoItemFull extends Omit<GeoItem, 'firstDay'> {
|
|
|
49
49
|
export interface GeoFlagItem {
|
|
50
50
|
/** Language name/ Название языка */
|
|
51
51
|
language: string;
|
|
52
|
+
/** Language code/ Код языка */
|
|
53
|
+
languageCode: string;
|
|
52
54
|
/** Country name/ Название страны */
|
|
53
55
|
country: string;
|
|
56
|
+
/** Country code/ Код страны */
|
|
57
|
+
countryCode: string;
|
|
54
58
|
/** Standard locale code/ Стандартный код локали */
|
|
55
59
|
standard: string;
|
|
56
60
|
/** Flag icon identifier/ Идентификатор иконки флага */
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@dxtmisha/functional-basic",
|
|
3
3
|
"private": false,
|
|
4
|
-
"version": "1.4.
|
|
4
|
+
"version": "1.4.2",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"description": "Foundational utility library for modern web development — HTTP client, geolocation, i18n, SEO meta tags, caching, storage, DOM utilities, and more. Framework-agnostic, zero dependencies, TypeScript-first.",
|
|
7
7
|
"keywords": [
|