@beam3_dev/api_module 0.0.19 → 0.0.21
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 +98 -153
- package/dist/wb3Api.umd.cjs +1 -2
- package/package.json +1 -1
package/dist/wb3Api.js
CHANGED
|
@@ -1,168 +1,113 @@
|
|
|
1
|
-
import "uuid";
|
|
2
|
-
import "luxon";
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
C(["DS/WAFData/WAFData"], (i) => {
|
|
6
|
-
i.authenticatedRequest(e, t);
|
|
7
|
-
});
|
|
8
|
-
}
|
|
9
|
-
function A(e, t = void 0, i = void 0) {
|
|
10
|
-
C(
|
|
11
|
-
["DS/i3DXCompassServices/i3DXCompassServices"],
|
|
12
|
-
(r) => {
|
|
13
|
-
(!e || e === "") && (e = v.getValue("PlatFormInstanceId")), (!e || e === "") && (e = void 0), r.getPlatformServices({
|
|
14
|
-
platformId: e,
|
|
15
|
-
onComplete: t,
|
|
16
|
-
onFailure: i
|
|
17
|
-
});
|
|
18
|
-
}
|
|
19
|
-
), T(), t && t(T());
|
|
1
|
+
import { v4 as f } from "uuid";
|
|
2
|
+
import { DateTime as s } from "luxon";
|
|
3
|
+
function h() {
|
|
4
|
+
return f();
|
|
20
5
|
}
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
let g = p.filter(
|
|
60
|
-
(h) => h.role.name === s
|
|
61
|
-
);
|
|
62
|
-
g.length === 1 ? (u = g[0].role.name, m = g[0].organization.title) : l(g);
|
|
63
|
-
}
|
|
64
|
-
});
|
|
65
|
-
}) : p.forEach((s) => {
|
|
66
|
-
if (i === s.role.name && r === s.organization.title)
|
|
67
|
-
u = i, m = r;
|
|
68
|
-
else if (i === s.role.name) {
|
|
69
|
-
let f = p.filter(
|
|
70
|
-
(g) => g.role.name === i
|
|
71
|
-
);
|
|
72
|
-
f.length === 1 ? (u = f[0].role.name, m = f[0].organization.title) : l(f);
|
|
73
|
-
}
|
|
74
|
-
}));
|
|
75
|
-
}
|
|
6
|
+
const p = {
|
|
7
|
+
b3M3Yellow: "#FFB300",
|
|
8
|
+
b3AboutageBlue: "#42A5F5",
|
|
9
|
+
b3UsinageGreen: "#689F38",
|
|
10
|
+
b3PanneauOrange: "#ff8000",
|
|
11
|
+
b3M350percent: "#fafa6e",
|
|
12
|
+
b3M380percent: "#aae479",
|
|
13
|
+
b3M390percent: "#64c987",
|
|
14
|
+
b3M3100percent: "#23aa8f",
|
|
15
|
+
b3M3105percent: "#00898a",
|
|
16
|
+
b3M3110percent: "#176877",
|
|
17
|
+
b3M3120percent: "#2a4858",
|
|
18
|
+
b3Aboutage50percent: "#fafa6e",
|
|
19
|
+
b3Aboutage80percent: "#aae479",
|
|
20
|
+
b3Aboutage90percent: "#64c987",
|
|
21
|
+
b3Aboutage100percent: "#23aa8f",
|
|
22
|
+
b3Aboutage105percent: "#00898a",
|
|
23
|
+
b3Aboutage110percent: "#176877",
|
|
24
|
+
b3Aboutage120percent: "#2a4858",
|
|
25
|
+
b3Warning: "#FF0000",
|
|
26
|
+
b3Edit1: "#AD1457",
|
|
27
|
+
b3Edit2: "#F4511E",
|
|
28
|
+
b3Edit3: "#009688",
|
|
29
|
+
b3Edit4: "#D50000",
|
|
30
|
+
b3Edit5: "#039BE5",
|
|
31
|
+
b3Edit6: "#9E69AF",
|
|
32
|
+
b3Edit7: "#A79B8E",
|
|
33
|
+
b3Edit8: "#616161",
|
|
34
|
+
b3Edit9: "#795548"
|
|
35
|
+
};
|
|
36
|
+
async function g(o, a = void 0, c = void 0) {
|
|
37
|
+
const t = parseInt(o);
|
|
38
|
+
await fetch(
|
|
39
|
+
"https://apicarto.ign.fr/api/codes-postaux/communes/" + t,
|
|
40
|
+
{
|
|
41
|
+
method: "GET",
|
|
42
|
+
headers: {
|
|
43
|
+
Accept: "application/json"
|
|
76
44
|
}
|
|
77
|
-
S && m && u ? (c = u + "." + m + "." + S, o(c)) : n.preferredcredentials ? (c = n.preferredcredentials.role.name + "." + n.preferredcredentials.organization.title + "." + n.preferredcredentials.collabspace.title, o(c)) : l && (c = u + "." + m + "." + S, l(c));
|
|
78
|
-
},
|
|
79
|
-
onFailure(a) {
|
|
80
|
-
console.log("Erreur de récupération du contexte de sécurité. => ", a);
|
|
81
45
|
}
|
|
46
|
+
).then((r) => r.json()).then((r) => {
|
|
47
|
+
a && a(r);
|
|
48
|
+
}).catch((r) => {
|
|
49
|
+
c && c(r), console.error("Erreur : " + r);
|
|
82
50
|
});
|
|
83
51
|
}
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
},
|
|
93
|
-
onFailure(o) {
|
|
94
|
-
i && i(o);
|
|
52
|
+
async function E(o, a = void 0, c = void 0) {
|
|
53
|
+
o = encodeURIComponent(o), await fetch(
|
|
54
|
+
"https://api-adresse.data.gouv.fr/search/?q=" + o + "&limit=15",
|
|
55
|
+
{
|
|
56
|
+
method: "GET",
|
|
57
|
+
headers: {
|
|
58
|
+
Accept: "application/json"
|
|
59
|
+
}
|
|
95
60
|
}
|
|
61
|
+
).then((t) => t.json()).then((t) => {
|
|
62
|
+
a && a(t);
|
|
63
|
+
}).catch((t) => {
|
|
64
|
+
c && c(t), console.error("Erreur : " + t);
|
|
96
65
|
});
|
|
97
66
|
}
|
|
98
|
-
function
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
e
|
|
102
|
-
|
|
103
|
-
|
|
67
|
+
async function A(o, a = p) {
|
|
68
|
+
let c = s.now().year;
|
|
69
|
+
const t = o, r = [], d = (n) => {
|
|
70
|
+
for (let e in n)
|
|
71
|
+
r.push({ date: e, comment: n[e] });
|
|
72
|
+
};
|
|
73
|
+
for (let n = c; n <= c + 1; n++)
|
|
74
|
+
await fetch(
|
|
75
|
+
"https://calendrier.api.gouv.fr/jours-feries/metropole/" + n + ".json",
|
|
76
|
+
{
|
|
104
77
|
method: "GET",
|
|
105
|
-
headers: {
|
|
106
|
-
|
|
107
|
-
const n = JSON.parse(l);
|
|
108
|
-
t && t(n.result);
|
|
109
|
-
},
|
|
110
|
-
onFailure(l) {
|
|
111
|
-
i && i(l);
|
|
78
|
+
headers: {
|
|
79
|
+
Accept: "application/json"
|
|
112
80
|
}
|
|
81
|
+
}
|
|
82
|
+
).then((e) => e.json()).then((e) => {
|
|
83
|
+
d(e);
|
|
84
|
+
}).catch((e) => console.error("Erreur : " + e));
|
|
85
|
+
return (() => {
|
|
86
|
+
const n = t.length === 0 ? {
|
|
87
|
+
events: []
|
|
88
|
+
} : t;
|
|
89
|
+
for (let e of r)
|
|
90
|
+
n.events.findIndex(
|
|
91
|
+
(i) => i.start === s.fromISO(e.date).toISODate() && i.name === "Férié : " + e.comment
|
|
92
|
+
) === -1 && n.events.push({
|
|
93
|
+
name: "Férié : " + e.comment,
|
|
94
|
+
start: s.fromISO(e.date).toISODate(),
|
|
95
|
+
end: s.fromISO(e.date).toISODate(),
|
|
96
|
+
color: a.b3BusinnessDays,
|
|
97
|
+
timed: !1
|
|
113
98
|
});
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
);
|
|
117
|
-
}
|
|
118
|
-
function F(e, t = void 0, i = void 0) {
|
|
119
|
-
A(
|
|
120
|
-
null,
|
|
121
|
-
(r) => {
|
|
122
|
-
let o = [], l = [], d, a = {};
|
|
123
|
-
for (let n of r)
|
|
124
|
-
"3DSpace" in n && (l.push({
|
|
125
|
-
label: `${n.displayName} ( ${n.platformId} )`,
|
|
126
|
-
value: `${l.length}`
|
|
127
|
-
}), l.sort(), o.push(n));
|
|
128
|
-
for (let [n, c] of o.entries())
|
|
129
|
-
c.platformId === e.tenant && (a = c, d = n);
|
|
130
|
-
v.addPreference({
|
|
131
|
-
name: "_CurrentTenantID_",
|
|
132
|
-
type: "list",
|
|
133
|
-
label: "Tenant",
|
|
134
|
-
defaultValue: d,
|
|
135
|
-
options: l
|
|
136
|
-
}), Object.keys(a).length > 0, y(
|
|
137
|
-
e.space,
|
|
138
|
-
"ESPACE COMMUN",
|
|
139
|
-
// "B3-R&D" || "ESPACE COMMUN",
|
|
140
|
-
["VPLMProjectLeader", "VPLMCreator"],
|
|
141
|
-
void 0,
|
|
142
|
-
(n) => e.ctx = n,
|
|
143
|
-
(n) => {
|
|
144
|
-
console.log("on Error CTX =>", n);
|
|
145
|
-
}
|
|
146
|
-
), O(
|
|
147
|
-
e,
|
|
148
|
-
(n) => {
|
|
149
|
-
t && t(n, a);
|
|
150
|
-
},
|
|
151
|
-
(n) => {
|
|
152
|
-
i && i(n);
|
|
153
|
-
}
|
|
154
|
-
);
|
|
155
|
-
},
|
|
156
|
-
(r) => {
|
|
157
|
-
console.log("** _getPlatformServices Erreur **", r);
|
|
158
|
-
}
|
|
159
|
-
);
|
|
99
|
+
return n;
|
|
100
|
+
})();
|
|
160
101
|
}
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
return console.log(t), t;
|
|
102
|
+
function F(o) {
|
|
103
|
+
const a = "Hello " + o;
|
|
104
|
+
return console.log(a), a;
|
|
165
105
|
}
|
|
166
106
|
export {
|
|
167
|
-
|
|
107
|
+
h as UUID,
|
|
108
|
+
p as couleurs,
|
|
109
|
+
E as findAdresse,
|
|
110
|
+
g as getCommunes,
|
|
111
|
+
A as getDataFromGouvFr,
|
|
112
|
+
F as sayHello
|
|
168
113
|
};
|
package/dist/wb3Api.umd.cjs
CHANGED
|
@@ -1,2 +1 @@
|
|
|
1
|
-
(function(
|
|
2
|
-
function O(e,t=void 0,i=void 0){const r=e.space+"/api/index/tk";_(r,{onComplete(o,l,c){var n;const s=JSON.parse(o);t&&(e.token=(n=s==null?void 0:s.result)==null?void 0:n.ServerToken,t(s))},onFailure(o){i&&i(o)}})}function b(e,t=void 0,i=void 0){const r=e.space+"/api/user/getcurrent/";O(e,o=>{_(r,{method:"GET",headers:{"X-DS-SWYM-CSRFTOKEN":o.result.ServerToken},onComplete(l,c,s){const n=JSON.parse(l);t&&t(n.result)},onFailure(l){i&&i(l)}})},i)}function q(e,t=void 0,i=void 0){w(null,r=>{let o=[],l=[],c,s={};for(let n of r)"3DSpace"in n&&(l.push({label:`${n.displayName} ( ${n.platformId} )`,value:`${l.length}`}),l.sort(),o.push(n));for(let[n,d]of o.entries())d.platformId===e.tenant&&(s=d,c=n);h.widget.addPreference({name:"_CurrentTenantID_",type:"list",label:"Tenant",defaultValue:c,options:l}),Object.keys(s).length>0,A(e.space,"ESPACE COMMUN",["VPLMProjectLeader","VPLMCreator"],void 0,n=>e.ctx=n,n=>{console.log("on Error CTX =>",n)}),b(e,n=>{t&&t(n,s)},n=>{i&&i(n)})},r=>{console.log("** _getPlatformServices Erreur **",r)})}module.exports={getActiveServices:q};function D(e){const t="Hello "+e;return console.log(t),t}u.sayHello=D,Object.defineProperty(u,Symbol.toStringTag,{value:"Module"})});
|
|
1
|
+
(function(e,d){typeof exports=="object"&&typeof module<"u"?d(exports,require("uuid"),require("luxon")):typeof define=="function"&&define.amd?define(["exports","uuid","luxon"],d):(e=typeof globalThis<"u"?globalThis:e||self,d(e["@beam3_dev/api_module"]=e["@beam3_dev/api_module"]||{},e.uuid,e.luxon))})(this,function(e,d,s){"use strict";function m(){return d.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(i,a=void 0,r=void 0){const n=parseInt(i);await fetch("https://apicarto.ign.fr/api/codes-postaux/communes/"+n,{method:"GET",headers:{Accept:"application/json"}}).then(c=>c.json()).then(c=>{a&&a(c)}).catch(c=>{r&&r(c),console.error("Erreur : "+c)})}async function b(i,a=void 0,r=void 0){i=encodeURIComponent(i),await fetch("https://api-adresse.data.gouv.fr/search/?q="+i+"&limit=15",{method:"GET",headers:{Accept:"application/json"}}).then(n=>n.json()).then(n=>{a&&a(n)}).catch(n=>{r&&r(n),console.error("Erreur : "+n)})}async function l(i,a=u){let r=s.DateTime.now().year;const n=i,c=[],g=o=>{for(let t in o)c.push({date:t,comment:o[t]})};for(let o=r;o<=r+1;o++)await fetch("https://calendrier.api.gouv.fr/jours-feries/metropole/"+o+".json",{method:"GET",headers:{Accept:"application/json"}}).then(t=>t.json()).then(t=>{g(t)}).catch(t=>console.error("Erreur : "+t));return(()=>{const o=n.length===0?{events:[]}:n;for(let t of c)o.events.findIndex(f=>f.start===s.DateTime.fromISO(t.date).toISODate()&&f.name==="Férié : "+t.comment)===-1&&o.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 o})()}function h(i){const a="Hello "+i;return console.log(a),a}e.UUID=m,e.couleurs=u,e.findAdresse=b,e.getCommunes=p,e.getDataFromGouvFr=l,e.sayHello=h,Object.defineProperty(e,Symbol.toStringTag,{value:"Module"})});
|