@beam3_dev/api_module 0.0.21 → 0.0.22
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/wb3Api.js +50 -43
- package/dist/wb3Api.umd.cjs +1 -1
- package/package.json +4 -1
package/dist/wb3Api.js
CHANGED
|
@@ -1,9 +1,10 @@
|
|
|
1
1
|
import { v4 as f } from "uuid";
|
|
2
|
-
import { DateTime as
|
|
3
|
-
|
|
2
|
+
import { DateTime as i } from "luxon";
|
|
3
|
+
import { requirejs as p } from "@widget-lab/3ddashboard-utils";
|
|
4
|
+
function g() {
|
|
4
5
|
return f();
|
|
5
6
|
}
|
|
6
|
-
const
|
|
7
|
+
const u = {
|
|
7
8
|
b3M3Yellow: "#FFB300",
|
|
8
9
|
b3AboutageBlue: "#42A5F5",
|
|
9
10
|
b3UsinageGreen: "#689F38",
|
|
@@ -33,46 +34,46 @@ const p = {
|
|
|
33
34
|
b3Edit8: "#616161",
|
|
34
35
|
b3Edit9: "#795548"
|
|
35
36
|
};
|
|
36
|
-
async function
|
|
37
|
-
const
|
|
37
|
+
async function E(a, t = void 0, o = void 0) {
|
|
38
|
+
const n = parseInt(a);
|
|
38
39
|
await fetch(
|
|
39
|
-
"https://apicarto.ign.fr/api/codes-postaux/communes/" +
|
|
40
|
+
"https://apicarto.ign.fr/api/codes-postaux/communes/" + n,
|
|
40
41
|
{
|
|
41
42
|
method: "GET",
|
|
42
43
|
headers: {
|
|
43
44
|
Accept: "application/json"
|
|
44
45
|
}
|
|
45
46
|
}
|
|
46
|
-
).then((
|
|
47
|
-
|
|
48
|
-
}).catch((
|
|
49
|
-
|
|
47
|
+
).then((c) => c.json()).then((c) => {
|
|
48
|
+
t && t(c);
|
|
49
|
+
}).catch((c) => {
|
|
50
|
+
o && o(c), console.error("Erreur : " + c);
|
|
50
51
|
});
|
|
51
52
|
}
|
|
52
|
-
async function
|
|
53
|
-
|
|
54
|
-
"https://api-adresse.data.gouv.fr/search/?q=" +
|
|
53
|
+
async function D(a, t = void 0, o = void 0) {
|
|
54
|
+
a = encodeURIComponent(a), await fetch(
|
|
55
|
+
"https://api-adresse.data.gouv.fr/search/?q=" + a + "&limit=15",
|
|
55
56
|
{
|
|
56
57
|
method: "GET",
|
|
57
58
|
headers: {
|
|
58
59
|
Accept: "application/json"
|
|
59
60
|
}
|
|
60
61
|
}
|
|
61
|
-
).then((
|
|
62
|
-
|
|
63
|
-
}).catch((
|
|
64
|
-
|
|
62
|
+
).then((n) => n.json()).then((n) => {
|
|
63
|
+
t && t(n);
|
|
64
|
+
}).catch((n) => {
|
|
65
|
+
o && o(n), console.error("Erreur : " + n);
|
|
65
66
|
});
|
|
66
67
|
}
|
|
67
|
-
async function
|
|
68
|
-
let
|
|
69
|
-
const
|
|
70
|
-
for (let e in
|
|
71
|
-
|
|
68
|
+
async function F(a, t = u) {
|
|
69
|
+
let o = i.now().year;
|
|
70
|
+
const n = a, c = [], d = (r) => {
|
|
71
|
+
for (let e in r)
|
|
72
|
+
c.push({ date: e, comment: r[e] });
|
|
72
73
|
};
|
|
73
|
-
for (let
|
|
74
|
+
for (let r = o; r <= o + 1; r++)
|
|
74
75
|
await fetch(
|
|
75
|
-
"https://calendrier.api.gouv.fr/jours-feries/metropole/" +
|
|
76
|
+
"https://calendrier.api.gouv.fr/jours-feries/metropole/" + r + ".json",
|
|
76
77
|
{
|
|
77
78
|
method: "GET",
|
|
78
79
|
headers: {
|
|
@@ -83,31 +84,37 @@ async function A(o, a = p) {
|
|
|
83
84
|
d(e);
|
|
84
85
|
}).catch((e) => console.error("Erreur : " + e));
|
|
85
86
|
return (() => {
|
|
86
|
-
const
|
|
87
|
+
const r = n.length === 0 ? {
|
|
87
88
|
events: []
|
|
88
|
-
} :
|
|
89
|
-
for (let e of
|
|
90
|
-
|
|
91
|
-
(
|
|
92
|
-
) === -1 &&
|
|
89
|
+
} : n;
|
|
90
|
+
for (let e of c)
|
|
91
|
+
r.events.findIndex(
|
|
92
|
+
(s) => s.start === i.fromISO(e.date).toISODate() && s.name === "Férié : " + e.comment
|
|
93
|
+
) === -1 && r.events.push({
|
|
93
94
|
name: "Férié : " + e.comment,
|
|
94
|
-
start:
|
|
95
|
-
end:
|
|
96
|
-
color:
|
|
95
|
+
start: i.fromISO(e.date).toISODate(),
|
|
96
|
+
end: i.fromISO(e.date).toISODate(),
|
|
97
|
+
color: t.b3BusinnessDays,
|
|
97
98
|
timed: !1
|
|
98
99
|
});
|
|
99
|
-
return
|
|
100
|
+
return r;
|
|
100
101
|
})();
|
|
101
102
|
}
|
|
102
|
-
function
|
|
103
|
-
|
|
104
|
-
|
|
103
|
+
function I(a, t) {
|
|
104
|
+
p(["DS/WAFData/WAFData"], (o) => {
|
|
105
|
+
o.authenticatedRequest(a, t);
|
|
106
|
+
});
|
|
107
|
+
}
|
|
108
|
+
function j(a) {
|
|
109
|
+
const t = "Hello " + a;
|
|
110
|
+
return console.log(t), t;
|
|
105
111
|
}
|
|
106
112
|
export {
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
F as
|
|
113
|
+
g as UUID,
|
|
114
|
+
I as _httpCallAuthenticated,
|
|
115
|
+
u as couleurs,
|
|
116
|
+
D as findAdresse,
|
|
117
|
+
E as getCommunes,
|
|
118
|
+
F as getDataFromGouvFr,
|
|
119
|
+
j as sayHello
|
|
113
120
|
};
|
package/dist/wb3Api.umd.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
(function(e,
|
|
1
|
+
(function(e,c){typeof exports=="object"&&typeof module<"u"?c(exports,require("uuid"),require("luxon"),require("@widget-lab/3ddashboard-utils")):typeof define=="function"&&define.amd?define(["exports","uuid","luxon","@widget-lab/3ddashboard-utils"],c):(e=typeof globalThis<"u"?globalThis:e||self,c(e["@beam3_dev/api_module"]=e["@beam3_dev/api_module"]||{},e.uuid,e.luxon,e["@widget-lab/3ddashboard-utils"]))})(this,function(e,c,s,b){"use strict";function m(){return c.v4()}const u={b3M3Yellow:"#FFB300",b3AboutageBlue:"#42A5F5",b3UsinageGreen:"#689F38",b3PanneauOrange:"#ff8000",b3M350percent:"#fafa6e",b3M380percent:"#aae479",b3M390percent:"#64c987",b3M3100percent:"#23aa8f",b3M3105percent:"#00898a",b3M3110percent:"#176877",b3M3120percent:"#2a4858",b3Aboutage50percent:"#fafa6e",b3Aboutage80percent:"#aae479",b3Aboutage90percent:"#64c987",b3Aboutage100percent:"#23aa8f",b3Aboutage105percent:"#00898a",b3Aboutage110percent:"#176877",b3Aboutage120percent:"#2a4858",b3Warning:"#FF0000",b3Edit1:"#AD1457",b3Edit2:"#F4511E",b3Edit3:"#009688",b3Edit4:"#D50000",b3Edit5:"#039BE5",b3Edit6:"#9E69AF",b3Edit7:"#A79B8E",b3Edit8:"#616161",b3Edit9:"#795548"};async function p(n,a=void 0,i=void 0){const o=parseInt(n);await fetch("https://apicarto.ign.fr/api/codes-postaux/communes/"+o,{method:"GET",headers:{Accept:"application/json"}}).then(r=>r.json()).then(r=>{a&&a(r)}).catch(r=>{i&&i(r),console.error("Erreur : "+r)})}async function l(n,a=void 0,i=void 0){n=encodeURIComponent(n),await fetch("https://api-adresse.data.gouv.fr/search/?q="+n+"&limit=15",{method:"GET",headers:{Accept:"application/json"}}).then(o=>o.json()).then(o=>{a&&a(o)}).catch(o=>{i&&i(o),console.error("Erreur : "+o)})}async function h(n,a=u){let i=s.DateTime.now().year;const o=n,r=[],D=d=>{for(let t in d)r.push({date:t,comment:d[t]})};for(let d=i;d<=i+1;d++)await fetch("https://calendrier.api.gouv.fr/jours-feries/metropole/"+d+".json",{method:"GET",headers:{Accept:"application/json"}}).then(t=>t.json()).then(t=>{D(t)}).catch(t=>console.error("Erreur : "+t));return(()=>{const d=o.length===0?{events:[]}:o;for(let t of r)d.events.findIndex(f=>f.start===s.DateTime.fromISO(t.date).toISODate()&&f.name==="Férié : "+t.comment)===-1&&d.events.push({name:"Férié : "+t.comment,start:s.DateTime.fromISO(t.date).toISODate(),end:s.DateTime.fromISO(t.date).toISODate(),color:a.b3BusinnessDays,timed:!1});return d})()}function g(n,a){b.requirejs(["DS/WAFData/WAFData"],i=>{i.authenticatedRequest(n,a)})}function A(n){const a="Hello "+n;return console.log(a),a}e.UUID=m,e._httpCallAuthenticated=g,e.couleurs=u,e.findAdresse=l,e.getCommunes=p,e.getDataFromGouvFr=h,e.sayHello=A,Object.defineProperty(e,Symbol.toStringTag,{value:"Module"})});
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@beam3_dev/api_module",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.22",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"main": "./dist/wb3Api.umd.cjs",
|
|
6
6
|
"module": "./dist/wb3Api.js",
|
|
@@ -29,5 +29,8 @@
|
|
|
29
29
|
"raw-loader": "4.0.2",
|
|
30
30
|
"requirejs": "2.3.6",
|
|
31
31
|
"uuid": "^9.0.1"
|
|
32
|
+
},
|
|
33
|
+
"dependencies": {
|
|
34
|
+
"vite-plugin-external": "^4.3.0"
|
|
32
35
|
}
|
|
33
36
|
}
|