@supersoniks/concorde 1.1.41 → 1.1.43
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/README.md +0 -0
- package/cli.js +0 -0
- package/components.d.ts +0 -0
- package/components.js +2 -3
- package/concorde-core.bundle.js +37 -42
- package/concorde-core.es.js +5702 -4823
- package/core/_types/types.d.ts +26 -0
- package/core/_types/types.js +1 -0
- package/core/components/functional/date/date.d.ts +13 -5
- package/core/components/functional/date/date.js +48 -29
- package/core/components/functional/example/example.d.ts +1 -1
- package/core/components/functional/example/example.js +1 -1
- package/core/components/functional/fetch/fetch.d.ts +40 -3
- package/core/components/functional/fetch/fetch.js +2 -6
- package/core/components/functional/functional.d.ts +2 -0
- package/core/components/functional/functional.js +2 -0
- package/core/components/functional/if/if.d.ts +3 -0
- package/core/components/functional/if/if.js +6 -12
- package/core/components/functional/if/if.test.d.ts +1 -0
- package/core/components/functional/if/if.test.js +44 -0
- package/core/components/functional/list/list.d.ts +32 -8
- package/core/components/functional/list/list.js +33 -40
- package/core/components/functional/mix/mix.d.ts +22 -0
- package/core/components/functional/mix/mix.js +99 -0
- package/core/components/functional/queue/queue.d.ts +16 -3
- package/core/components/functional/queue/queue.js +71 -15
- package/core/components/functional/router/redirect.d.ts +10 -1
- package/core/components/functional/router/redirect.js +5 -6
- package/core/components/functional/router/router.d.ts +15 -1
- package/core/components/functional/router/router.js +1 -6
- package/core/components/functional/sdui/SDUIDescriptorTransformer.d.ts +1 -1
- package/core/components/functional/sdui/SDUIDescriptorTransformer.js +24 -12
- package/core/components/functional/sdui/default-library.json +108 -0
- package/core/components/functional/sdui/sdui-utils.d.ts +5 -0
- package/core/components/functional/sdui/sdui-utils.js +63 -0
- package/core/components/functional/sdui/sdui.d.ts +20 -9
- package/core/components/functional/sdui/sdui.js +64 -24
- package/core/components/functional/sdui/types.d.ts +4 -2
- package/core/components/functional/sdui/types.js +0 -0
- package/core/components/functional/sonic-scope/sonic-scope.d.ts +0 -0
- package/core/components/functional/sonic-scope/sonic-scope.js +0 -0
- package/core/components/functional/states/states.d.ts +19 -3
- package/core/components/functional/states/states.js +7 -12
- package/core/components/functional/submit/submit.d.ts +16 -1
- package/core/components/functional/submit/submit.js +87 -17
- package/core/components/functional/subscriber/subscriber.d.ts +4 -1
- package/core/components/functional/subscriber/subscriber.js +1 -6
- package/core/components/functional/value/value.d.ts +7 -0
- package/core/components/functional/value/value.js +26 -0
- package/core/components/ui/_css/scroll.d.ts +0 -0
- package/core/components/ui/_css/scroll.js +6 -7
- package/core/components/ui/_css/size.d.ts +1 -0
- package/core/components/ui/_css/size.js +3 -1
- package/core/components/ui/_css/type.d.ts +0 -0
- package/core/components/ui/_css/type.js +0 -0
- package/core/components/ui/alert/alert.d.ts +2 -2
- package/core/components/ui/alert/alert.js +11 -16
- package/core/components/ui/badge/badge.d.ts +3 -1
- package/core/components/ui/badge/badge.js +36 -22
- package/core/components/ui/button/button.d.ts +23 -20
- package/core/components/ui/button/button.js +59 -42
- package/core/components/ui/captcha/captcha.d.ts +14 -2
- package/core/components/ui/captcha/captcha.js +17 -12
- package/core/components/ui/card/card-footer.d.ts +0 -0
- package/core/components/ui/card/card-footer.js +1 -8
- package/core/components/ui/card/card-header-descripton.d.ts +0 -0
- package/core/components/ui/card/card-header-descripton.js +3 -9
- package/core/components/ui/card/card-header.d.ts +0 -0
- package/core/components/ui/card/card-header.js +1 -6
- package/core/components/ui/card/card-main.d.ts +0 -0
- package/core/components/ui/card/card-main.js +0 -5
- package/core/components/ui/card/card.d.ts +1 -1
- package/core/components/ui/card/card.js +28 -12
- package/core/components/ui/divider/divider.d.ts +2 -0
- package/core/components/ui/divider/divider.js +44 -17
- package/core/components/ui/form/checkbox/checkbox.d.ts +53 -16
- package/core/components/ui/form/checkbox/checkbox.js +54 -29
- package/core/components/ui/form/css/form-control.d.ts +2 -0
- package/core/components/ui/form/css/form-control.js +145 -67
- package/core/components/ui/form/fieldset/fieldset.d.ts +8 -1
- package/core/components/ui/form/fieldset/fieldset.js +45 -8
- package/core/components/ui/form/fieldset/legend-description.d.ts +0 -0
- package/core/components/ui/form/fieldset/legend-description.js +0 -5
- package/core/components/ui/form/fieldset/legend.d.ts +0 -0
- package/core/components/ui/form/fieldset/legend.js +4 -7
- package/core/components/ui/form/form-actions/form-actions.d.ts +2 -0
- package/core/components/ui/form/form-actions/form-actions.js +26 -11
- package/core/components/ui/form/form-layout/form-layout.d.ts +5 -2
- package/core/components/ui/form/form-layout/form-layout.js +31 -9
- package/core/components/ui/form/input/input.d.ts +15 -18
- package/core/components/ui/form/input/input.js +89 -54
- package/core/components/ui/form/input/password-helper.d.ts +7 -1
- package/core/components/ui/form/input/password-helper.js +33 -10
- package/core/components/ui/form/input/same-value-helper.d.ts +1 -1
- package/core/components/ui/form/input/same-value-helper.js +1 -0
- package/core/components/ui/form/input-autocomplete/input-autocomplete.d.ts +34 -0
- package/core/components/ui/form/input-autocomplete/input-autocomplete.js +133 -0
- package/core/components/ui/form/radio/radio.d.ts +6 -0
- package/core/components/ui/form/radio/radio.js +7 -12
- package/core/components/ui/form/select/select.d.ts +23 -7
- package/core/components/ui/form/select/select.js +71 -40
- package/core/components/ui/form/textarea/textarea.d.ts +13 -13
- package/core/components/ui/form/textarea/textarea.js +31 -38
- package/core/components/ui/group/group.d.ts +11 -1
- package/core/components/ui/group/group.js +79 -17
- package/core/components/ui/icon/icon.d.ts +10 -3
- package/core/components/ui/icon/icon.js +16 -15
- package/core/components/ui/icon/icons.d.ts +0 -0
- package/core/components/ui/icon/icons.js +11 -8
- package/core/components/ui/icon/icons.json +1 -1
- package/core/components/ui/image/image.d.ts +0 -0
- package/core/components/ui/image/image.js +0 -5
- package/core/components/ui/link/link.d.ts +1 -1
- package/core/components/ui/link/link.js +2 -6
- package/core/components/ui/loader/loader.d.ts +0 -0
- package/core/components/ui/loader/loader.js +2 -8
- package/core/components/ui/loader/styles/fixed.d.ts +0 -0
- package/core/components/ui/loader/styles/fixed.js +0 -0
- package/core/components/ui/loader/styles/inline.d.ts +0 -0
- package/core/components/ui/loader/styles/inline.js +0 -0
- package/core/components/ui/menu/menu-item.d.ts +0 -0
- package/core/components/ui/menu/menu-item.js +4 -9
- package/core/components/ui/menu/menu.d.ts +9 -1
- package/core/components/ui/menu/menu.js +183 -27
- package/core/components/ui/modal/modal-actions.d.ts +0 -0
- package/core/components/ui/modal/modal-actions.js +1 -6
- package/core/components/ui/modal/modal-close.d.ts +1 -0
- package/core/components/ui/modal/modal-close.js +14 -10
- package/core/components/ui/modal/modal-content.d.ts +0 -0
- package/core/components/ui/modal/modal-content.js +0 -5
- package/core/components/ui/modal/modal-subtitle.d.ts +0 -0
- package/core/components/ui/modal/modal-subtitle.js +2 -6
- package/core/components/ui/modal/modal-title.d.ts +0 -0
- package/core/components/ui/modal/modal-title.js +0 -5
- package/core/components/ui/modal/modal.d.ts +7 -7
- package/core/components/ui/modal/modal.js +36 -36
- package/core/components/ui/pop/pop.d.ts +2 -1
- package/core/components/ui/pop/pop.js +11 -10
- package/core/components/ui/progress/progress.d.ts +0 -0
- package/core/components/ui/progress/progress.js +34 -32
- package/core/components/ui/table/table-caption.d.ts +0 -0
- package/core/components/ui/table/table-caption.js +5 -10
- package/core/components/ui/table/table-tbody.d.ts +0 -0
- package/core/components/ui/table/table-tbody.js +10 -14
- package/core/components/ui/table/table-td.d.ts +2 -0
- package/core/components/ui/table/table-td.js +8 -5
- package/core/components/ui/table/table-tfoot.d.ts +0 -0
- package/core/components/ui/table/table-tfoot.js +5 -7
- package/core/components/ui/table/table-th.d.ts +2 -0
- package/core/components/ui/table/table-th.js +12 -9
- package/core/components/ui/table/table-thead.d.ts +0 -0
- package/core/components/ui/table/table-thead.js +1 -6
- package/core/components/ui/table/table-tr.d.ts +0 -0
- package/core/components/ui/table/table-tr.js +4 -6
- package/core/components/ui/table/table.d.ts +0 -3
- package/core/components/ui/table/table.js +14 -31
- package/core/components/ui/taxonomy/taxonomy.d.ts +6 -3
- package/core/components/ui/taxonomy/taxonomy.js +9 -9
- package/core/components/ui/theme/css/tailwind.css +0 -0
- package/core/components/ui/theme/css/tailwind.d.ts +0 -0
- package/core/components/ui/theme/theme-collection/core-variables.d.ts +0 -0
- package/core/components/ui/theme/theme-collection/core-variables.js +13 -11
- package/core/components/ui/theme/theme-collection/dark.d.ts +0 -0
- package/core/components/ui/theme/theme-collection/dark.js +1 -1
- package/core/components/ui/theme/theme-collection/light.d.ts +0 -0
- package/core/components/ui/theme/theme-collection/light.js +0 -0
- package/core/components/ui/theme/theme.d.ts +1 -6
- package/core/components/ui/theme/theme.js +7 -36
- package/core/components/ui/toast/message-subscriber.d.ts +13 -7
- package/core/components/ui/toast/message-subscriber.js +0 -0
- package/core/components/ui/toast/toast-item.d.ts +0 -0
- package/core/components/ui/toast/toast-item.js +1 -1
- package/core/components/ui/toast/toast.d.ts +2 -1
- package/core/components/ui/toast/toast.js +29 -14
- package/core/components/ui/toast/types.d.ts +0 -0
- package/core/components/ui/toast/types.js +0 -0
- package/core/components/ui/tooltip/tooltip.d.ts +1 -0
- package/core/components/ui/tooltip/tooltip.js +35 -14
- package/core/components/ui/ui.d.ts +1 -0
- package/core/components/ui/ui.js +1 -3
- package/core/core.d.ts +0 -0
- package/core/core.js +5 -6
- package/core/mixins/Fetcher.d.ts +19 -10
- package/core/mixins/Fetcher.js +26 -10
- package/core/mixins/FormCheckable.d.ts +17 -8
- package/core/mixins/FormCheckable.js +177 -22
- package/core/mixins/FormElement.d.ts +12 -7
- package/core/mixins/FormElement.js +42 -26
- package/core/mixins/FormInput.d.ts +8 -4
- package/core/mixins/FormInput.js +4 -3
- package/core/mixins/Subscriber.d.ts +7 -5
- package/core/mixins/Subscriber.js +34 -32
- package/core/mixins/TemplatesContainer.d.ts +0 -0
- package/core/mixins/TemplatesContainer.js +0 -0
- package/core/mixins/mixins.d.ts +0 -0
- package/core/mixins/mixins.js +0 -0
- package/core/utils/Arrays.d.ts +15 -15
- package/core/utils/Arrays.js +0 -0
- package/core/utils/DataBindObserver.d.ts +16 -9
- package/core/utils/DataBindObserver.js +23 -28
- package/core/utils/Electron.d.ts +5 -1
- package/core/utils/Electron.js +4 -2
- package/core/utils/Format.d.ts +0 -0
- package/core/utils/Format.js +0 -0
- package/core/utils/HTML.d.ts +9 -2
- package/core/utils/HTML.js +22 -3
- package/core/utils/LocationHandler.d.ts +6 -5
- package/core/utils/LocationHandler.js +19 -8
- package/core/utils/Objects.d.ts +7 -4
- package/core/utils/Objects.js +28 -6
- package/core/utils/{PublisherProxy.d.mts → PublisherProxy.d.ts} +40 -31
- package/core/utils/{PublisherProxy.mjs → PublisherProxy.js} +54 -28
- package/core/utils/Utils.d.ts +3 -0
- package/core/utils/Utils.js +18 -0
- package/core/utils/api.d.ts +39 -7
- package/core/utils/api.js +45 -32
- package/img/concorde-logo.svg +1 -0
- package/img/concorde.png +0 -0
- package/img/concorde_def.png +0 -0
- package/mixins.d.ts +36 -18
- package/mixins.js +3 -4
- package/package.json +47 -10
- package/svg/regular/plane.svg +1 -0
- package/svg/solid/plane.svg +1 -0
- package/test-utils/TestUtils.d.ts +4 -0
- package/test-utils/TestUtils.js +12 -0
- package/utils.d.ts +3 -1
- package/utils.js +7 -5
- package/core/components/functional/configuration/configuration.d.ts +0 -5
- package/core/components/functional/configuration/configuration.js +0 -22
- package/core/components/ui/tabs/tab.d.ts +0 -6
- package/core/components/ui/tabs/tab.js +0 -46
- package/core/components/ui/tabs/tabs.d.ts +0 -15
- package/core/components/ui/tabs/tabs.js +0 -129
|
@@ -39,6 +39,7 @@ export default class LocationHandler {
|
|
|
39
39
|
LocationHandler.listen();
|
|
40
40
|
}
|
|
41
41
|
LocationHandler.listeners.push(listener);
|
|
42
|
+
listener.location = this.prevURL;
|
|
42
43
|
}
|
|
43
44
|
/**
|
|
44
45
|
*
|
|
@@ -49,24 +50,34 @@ export default class LocationHandler {
|
|
|
49
50
|
* Voir link et button pour les exemples d'implémentation
|
|
50
51
|
**/
|
|
51
52
|
static changeFromComponent(component) {
|
|
52
|
-
|
|
53
|
+
const goBack = component.goBack;
|
|
54
|
+
const referrer = document.referrer;
|
|
55
|
+
if (goBack !== null && goBack !== undefined) {
|
|
53
56
|
const origin = document.location.origin;
|
|
54
|
-
let urlDest =
|
|
55
|
-
|
|
57
|
+
let urlDest = goBack || origin;
|
|
58
|
+
const isHTTP = referrer.indexOf("http") == 0;
|
|
59
|
+
const isNotSameOrigin = isHTTP ? new URL(referrer).origin != origin : false;
|
|
60
|
+
const isReferrerEmpty = referrer == "";
|
|
61
|
+
const isFirstPage = history.length < 3; // imparfait mais variabsle selon les situations
|
|
62
|
+
const isFallbackNoReferer = isReferrerEmpty && isFirstPage; // fallback pour ff qui a parfois un referer nulle ex : drupal 9
|
|
63
|
+
const isNotSameURL = urlDest != document.location.href;
|
|
64
|
+
const goToURLDest = (isNotSameOrigin && isNotSameURL) || isFallbackNoReferer;
|
|
65
|
+
if (goToURLDest) {
|
|
56
66
|
let state = history.state || {};
|
|
57
67
|
state.concorde = state.concorde || {};
|
|
58
|
-
state.concorde.hasDoneHistoryBack = true;
|
|
68
|
+
state.concorde.hasDoneHistoryBack = true;
|
|
59
69
|
history.pushState(state, document.title);
|
|
60
70
|
history.back();
|
|
61
71
|
document.location.replace(urlDest);
|
|
62
72
|
}
|
|
63
|
-
else
|
|
73
|
+
else {
|
|
64
74
|
history.back();
|
|
75
|
+
}
|
|
65
76
|
return;
|
|
66
77
|
}
|
|
67
|
-
let to = component.getAttribute("to");
|
|
78
|
+
let to = component.getAttribute("to") || "";
|
|
68
79
|
if (!to)
|
|
69
|
-
to = component.href;
|
|
80
|
+
to = component.href || "";
|
|
70
81
|
if (!to)
|
|
71
82
|
return;
|
|
72
83
|
if (to.indexOf("#") == 0) {
|
|
@@ -102,7 +113,7 @@ export default class LocationHandler {
|
|
|
102
113
|
return;
|
|
103
114
|
if (component.href && component.href.indexOf("http") != 0) {
|
|
104
115
|
let url1 = new URL(component.href, document.location.href);
|
|
105
|
-
let url2 = new URL(component.location, document.location.origin);
|
|
116
|
+
let url2 = new URL(component.location || "", document.location.origin);
|
|
106
117
|
let isActive = false;
|
|
107
118
|
if (component.autoActive == "strict") {
|
|
108
119
|
isActive = url1.pathname == url2.pathname && url1.hash == url2.hash && url1.search == url2.search;
|
package/core/utils/Objects.d.ts
CHANGED
|
@@ -1,24 +1,27 @@
|
|
|
1
|
+
import { TypeAndRecordOfType } from "../_types/types";
|
|
1
2
|
declare class Objects {
|
|
2
3
|
/**
|
|
3
4
|
* Effectue une comparaison d'égalité non profonde entre deux objets.
|
|
4
5
|
*/
|
|
5
|
-
static shallowEqual(object1: any, object2: any): boolean;
|
|
6
|
+
static shallowEqual(object1: any, object2: any, useStrictComparaison?: boolean): boolean;
|
|
6
7
|
/**
|
|
7
8
|
* Effectue une comparaison d'égalité profonde entre deux objets.
|
|
8
9
|
*/
|
|
9
|
-
static deepEqual(object1: any, object2: any): boolean;
|
|
10
|
+
static deepEqual(object1: any, object2: any, useStrictComparaison?: boolean): boolean;
|
|
10
11
|
/**
|
|
11
12
|
* @returns true si l'objet est un objet ou un tableau (qui est un objet). mais false si null (car sinon typeof null "object")
|
|
12
13
|
*/
|
|
13
|
-
static isObject(object:
|
|
14
|
+
static isObject<T>(object: T): boolean;
|
|
14
15
|
/**
|
|
15
16
|
* @returns true si l'argument est null ou undefined
|
|
16
17
|
*/
|
|
17
|
-
static isUndefindOrNull(object:
|
|
18
|
+
static isUndefindOrNull<T>(object: T): boolean;
|
|
18
19
|
/**
|
|
19
20
|
* traverse l'objet pour obtenir la valeur a l'adresse donnée via le tableau de clés pathArray.
|
|
20
21
|
* Si extendValues = true, les propriétés des objets parents sont copiées au fur et a mesure de la descente dans la hierarchie, avant l'assignation des propriétés de l'objet lui même.
|
|
21
22
|
*/
|
|
22
23
|
static traverse(obj: any, pathArray: string[], extendValues?: boolean): any;
|
|
24
|
+
static getURLSearchArray(sourceObject?: TypeAndRecordOfType<string>, prefix?: string): string[];
|
|
25
|
+
static getURLSearchString(sourceObject: TypeAndRecordOfType<string>): string;
|
|
23
26
|
}
|
|
24
27
|
export default Objects;
|
package/core/utils/Objects.js
CHANGED
|
@@ -2,14 +2,17 @@ class Objects {
|
|
|
2
2
|
/**
|
|
3
3
|
* Effectue une comparaison d'égalité non profonde entre deux objets.
|
|
4
4
|
*/
|
|
5
|
-
static shallowEqual(object1, object2) {
|
|
5
|
+
static shallowEqual(object1, object2, useStrictComparaison = true) {
|
|
6
6
|
const keys1 = Object.keys(object1);
|
|
7
7
|
const keys2 = Object.keys(object2);
|
|
8
|
-
if (keys1.length !== keys2.length) {
|
|
8
|
+
if (keys1.length !== keys2.length && useStrictComparaison) {
|
|
9
9
|
return false;
|
|
10
10
|
}
|
|
11
11
|
for (let key of keys1) {
|
|
12
|
-
|
|
12
|
+
const val1 = object1[key];
|
|
13
|
+
const val2 = object2[key];
|
|
14
|
+
const areEqual = useStrictComparaison ? val1 !== val2 : val1 != val2;
|
|
15
|
+
if (areEqual) {
|
|
13
16
|
return false;
|
|
14
17
|
}
|
|
15
18
|
}
|
|
@@ -18,17 +21,18 @@ class Objects {
|
|
|
18
21
|
/**
|
|
19
22
|
* Effectue une comparaison d'égalité profonde entre deux objets.
|
|
20
23
|
*/
|
|
21
|
-
static deepEqual(object1, object2) {
|
|
24
|
+
static deepEqual(object1, object2, useStrictComparaison = true) {
|
|
22
25
|
const keys1 = Object.keys(object1);
|
|
23
26
|
const keys2 = Object.keys(object2);
|
|
24
|
-
if (keys1.length !== keys2.length) {
|
|
27
|
+
if (keys1.length !== keys2.length && useStrictComparaison) {
|
|
25
28
|
return false;
|
|
26
29
|
}
|
|
27
30
|
for (const key of keys1) {
|
|
28
31
|
const val1 = object1[key];
|
|
29
32
|
const val2 = object2[key];
|
|
30
33
|
const areObjects = Objects.isObject(val1) && Objects.isObject(val2);
|
|
31
|
-
|
|
34
|
+
const areEqual = useStrictComparaison ? val1 !== val2 : val1 != val2;
|
|
35
|
+
if ((areObjects && !Objects.deepEqual(val1, val2)) || (!areObjects && areEqual)) {
|
|
32
36
|
return false;
|
|
33
37
|
}
|
|
34
38
|
}
|
|
@@ -65,5 +69,23 @@ class Objects {
|
|
|
65
69
|
}
|
|
66
70
|
return obj;
|
|
67
71
|
}
|
|
72
|
+
static getURLSearchArray(sourceObject, prefix = "") {
|
|
73
|
+
let arr = [];
|
|
74
|
+
for (let key in sourceObject) {
|
|
75
|
+
let value = sourceObject[key];
|
|
76
|
+
if (prefix)
|
|
77
|
+
key = prefix + "[" + key + "]";
|
|
78
|
+
if (Objects.isObject(value)) {
|
|
79
|
+
arr = [...arr, ...this.getURLSearchArray(value, key)];
|
|
80
|
+
}
|
|
81
|
+
else {
|
|
82
|
+
arr.push(`${key}=${value}`);
|
|
83
|
+
}
|
|
84
|
+
}
|
|
85
|
+
return arr;
|
|
86
|
+
}
|
|
87
|
+
static getURLSearchString(sourceObject) {
|
|
88
|
+
return Objects.getURLSearchArray(sourceObject, "").join("&");
|
|
89
|
+
}
|
|
68
90
|
}
|
|
69
91
|
export default Objects;
|
|
@@ -1,18 +1,23 @@
|
|
|
1
|
+
declare type CoreJSType = Object | string | number | boolean | BigInt | undefined | null | symbol;
|
|
2
|
+
declare type PublisherContentType = CoreJSType & {
|
|
3
|
+
__value?: any;
|
|
4
|
+
} & Record<string, any>;
|
|
1
5
|
/**
|
|
2
6
|
* Custom Proxy contient les méthodes des publishers retournés par PublisherManager.get(publisherId) qui seront utilisées couramment
|
|
3
7
|
*/
|
|
4
|
-
export class PublisherProxy {
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
_invalidateListeners_: Set<
|
|
9
|
-
_assignListeners_: Set<
|
|
10
|
-
_mutationListeners_: Set<
|
|
11
|
-
_fillListeners_: Set<
|
|
12
|
-
_templateFillListeners_: Set<
|
|
8
|
+
export declare class PublisherProxy<T extends PublisherContentType = any> {
|
|
9
|
+
_proxies_: Map<string, PublisherProxy>;
|
|
10
|
+
_value_: T;
|
|
11
|
+
_key_: string;
|
|
12
|
+
_invalidateListeners_: Set<VoidFunction>;
|
|
13
|
+
_assignListeners_: Set<(value: T) => void>;
|
|
14
|
+
_mutationListeners_: Set<VoidFunction>;
|
|
15
|
+
_fillListeners_: Set<unknown>;
|
|
16
|
+
_templateFillListeners_: Set<unknown>;
|
|
13
17
|
_lockInternalMutationPublishing_: boolean;
|
|
14
|
-
parent:
|
|
15
|
-
root:
|
|
18
|
+
parent: PublisherProxy | null;
|
|
19
|
+
root: PublisherProxy;
|
|
20
|
+
constructor(target: T, parentProxPub: PublisherProxy | null);
|
|
16
21
|
/**
|
|
17
22
|
* Supprime le proxy et ses sous proxy
|
|
18
23
|
* Supprime les écouteurs associés
|
|
@@ -25,38 +30,38 @@ export class PublisherProxy {
|
|
|
25
30
|
_publishInternalMutation_(lockInternalMutationsTransmission?: boolean): void;
|
|
26
31
|
_publishAssignement_(lockInternalMutationsTransmission?: boolean): void;
|
|
27
32
|
_publishInvalidation_(): void;
|
|
28
|
-
_publishDynamicFilling_(key:
|
|
29
|
-
_publishTemplateFilling_(key:
|
|
33
|
+
_publishDynamicFilling_(key: string, value: any): void;
|
|
34
|
+
_publishTemplateFilling_(key: string, value: any): void;
|
|
30
35
|
/**
|
|
31
36
|
* Appel la fonction "handler" (passée en paramettre) lorsque la valeur gérée par le proxy change par assignation
|
|
32
37
|
* hanlder reçois alors la nouvelle valeur interne du proxy en paramètre
|
|
33
38
|
*/
|
|
34
|
-
onAssign(handler:
|
|
39
|
+
onAssign(handler: (value: T) => void): void;
|
|
35
40
|
/**
|
|
36
41
|
* Stop les appels de la fonction "handler" (passée en paramettre) lorsque la valeur gérée par le proxy change par assignation
|
|
37
42
|
*/
|
|
38
|
-
offAssign(handler:
|
|
43
|
+
offAssign(handler: (value: T) => void): void;
|
|
39
44
|
/**
|
|
40
45
|
* Appel la fonction "handler" (passée en paramettre) lorsque la donnée est flaggée comme invalide
|
|
41
46
|
*/
|
|
42
|
-
onInvalidate(handler:
|
|
47
|
+
onInvalidate(handler: VoidFunction | undefined): void;
|
|
43
48
|
/**
|
|
44
49
|
* Stop les appels de la fonction "handler" (passée en paramettre) lorsque la donnée est flaggée comme invalide
|
|
45
50
|
*/
|
|
46
|
-
offInvalidate(handler:
|
|
51
|
+
offInvalidate(handler: VoidFunction | undefined): void;
|
|
47
52
|
/**
|
|
48
53
|
* Flag les données comme étant invalides
|
|
49
54
|
*/
|
|
50
|
-
invalidate(
|
|
55
|
+
invalidate(): void;
|
|
51
56
|
/**
|
|
52
57
|
* Appel la fonction "handler" (passée en paramettre) lorsque quelque chose change la valeur gérée par le proxy quelque soit la profondeur de la donnée
|
|
53
58
|
*
|
|
54
59
|
*/
|
|
55
|
-
onInternalMutation(handler:
|
|
60
|
+
onInternalMutation(handler: VoidFunction | undefined): void;
|
|
56
61
|
/**
|
|
57
62
|
* Stop les Appels de la fonction "handler" (passée en paramettre) lorsque quelque chose change la valeur gérée par le proxy quelque soit la profondeur de la donnée
|
|
58
63
|
*/
|
|
59
|
-
offInternalMutation(handler:
|
|
64
|
+
offInternalMutation(handler: VoidFunction | undefined): void;
|
|
60
65
|
/**
|
|
61
66
|
* Maintient le remplissage de l'objet / tableau "handler" passé en paramètre avec les valeurs du proxy
|
|
62
67
|
* Remplit uniquement les valeurs déjà présentes dans l'objet / tableau passé en paramètre
|
|
@@ -75,19 +80,21 @@ export class PublisherProxy {
|
|
|
75
80
|
/**
|
|
76
81
|
* Assigne une nouvelle valeur au proxy ce qui déclenche la transmission de la donnée en fonction des "écouteurs" associés
|
|
77
82
|
*/
|
|
78
|
-
set(newValue:
|
|
83
|
+
set(newValue: T, lockInternalMutationsTransmission?: boolean): boolean;
|
|
79
84
|
/**
|
|
80
85
|
* Extraire la valeur actuelle du proxy
|
|
81
86
|
*/
|
|
82
|
-
get():
|
|
87
|
+
get(): T;
|
|
83
88
|
}
|
|
84
89
|
/**
|
|
85
90
|
* Utilitaires de gestion des Publisher
|
|
86
91
|
* Obtenir, replacer ou supprimer un Publisher
|
|
87
92
|
*
|
|
88
93
|
*/
|
|
89
|
-
export class PublisherManager {
|
|
90
|
-
static instance: null;
|
|
94
|
+
export declare class PublisherManager {
|
|
95
|
+
static instance: PublisherManager | null;
|
|
96
|
+
publishers: Map<string, Publisher<any>>;
|
|
97
|
+
constructor();
|
|
91
98
|
/**
|
|
92
99
|
* PublisherManager est un singleton
|
|
93
100
|
*/
|
|
@@ -96,29 +103,31 @@ export class PublisherManager {
|
|
|
96
103
|
* shortcut static pour obtenir un publisher vias sont id/adresse sans taper getInstance.
|
|
97
104
|
* Si le publisher n'existe pas, il est créé.
|
|
98
105
|
*/
|
|
99
|
-
static get(id:
|
|
106
|
+
static get(id: string): any;
|
|
100
107
|
/**
|
|
101
108
|
* shortcut static pour supprimer un publisher de la liste et appel également delete sur le publisher ce qui le supprime, de même que ses sous publishers
|
|
102
109
|
*/
|
|
103
|
-
static delete(id:
|
|
104
|
-
publishers: Map<any, any>;
|
|
110
|
+
static delete(id: string): boolean;
|
|
105
111
|
/**
|
|
106
112
|
* Obtenir un publisher vias sont id/adresse
|
|
107
113
|
* Si le publisher n'existe pas, il est créé.
|
|
108
114
|
*/
|
|
109
|
-
get(id:
|
|
115
|
+
get(id: string): any;
|
|
110
116
|
/**
|
|
111
117
|
* Remplace un publisher pour l'id fourni par un autre.
|
|
112
118
|
* L'autre publisher n'est pas supprimé.
|
|
113
119
|
*/
|
|
114
|
-
set(id:
|
|
120
|
+
set(id: string, publisher: Publisher): void;
|
|
115
121
|
/**
|
|
116
122
|
* supprimer un publisher de la liste et appel également delete sur le publisher ce qui le supprime, de même que ses sous publishers
|
|
117
123
|
*/
|
|
118
|
-
delete(id:
|
|
124
|
+
delete(id: string): boolean;
|
|
119
125
|
}
|
|
120
126
|
/**
|
|
121
127
|
* Le Proxy Javascript
|
|
122
128
|
*/
|
|
123
|
-
export default class Publisher extends PublisherProxy {
|
|
129
|
+
export default class Publisher<T extends PublisherContentType = any> extends PublisherProxy<T> {
|
|
130
|
+
constructor(target: T, parentProxPub?: PublisherProxy | null);
|
|
131
|
+
getProperty<U, K extends keyof U>(o: U, propertyName: K): U[K];
|
|
124
132
|
}
|
|
133
|
+
export {};
|
|
@@ -1,8 +1,3 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
|
|
3
|
-
* Merci de laisser ce fichier sans la moindre dépendance.
|
|
4
|
-
* !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
|
|
5
|
-
* **/
|
|
6
1
|
function isComplex(value) {
|
|
7
2
|
return typeof value === "object" && value != null;
|
|
8
3
|
}
|
|
@@ -10,17 +5,18 @@ function isComplex(value) {
|
|
|
10
5
|
* Custom Proxy contient les méthodes des publishers retournés par PublisherManager.get(publisherId) qui seront utilisées couramment
|
|
11
6
|
*/
|
|
12
7
|
export class PublisherProxy {
|
|
13
|
-
constructor(target, parentProxPub
|
|
8
|
+
constructor(target, parentProxPub) {
|
|
14
9
|
this._proxies_ = new Map();
|
|
15
|
-
this.
|
|
10
|
+
this._key_ = "";
|
|
16
11
|
this._invalidateListeners_ = new Set();
|
|
17
12
|
this._assignListeners_ = new Set();
|
|
18
13
|
this._mutationListeners_ = new Set();
|
|
19
14
|
this._fillListeners_ = new Set();
|
|
20
15
|
this._templateFillListeners_ = new Set();
|
|
21
16
|
this._lockInternalMutationPublishing_ = false;
|
|
22
|
-
this.parent = parentProxPub;
|
|
23
17
|
this.root = this;
|
|
18
|
+
this._value_ = target;
|
|
19
|
+
this.parent = parentProxPub || null;
|
|
24
20
|
while (this.root.parent) {
|
|
25
21
|
this.root = this.root.parent;
|
|
26
22
|
}
|
|
@@ -75,7 +71,7 @@ export class PublisherProxy {
|
|
|
75
71
|
_publishTemplateFilling_(key, value) {
|
|
76
72
|
this._templateFillListeners_.forEach((handler) => {
|
|
77
73
|
let desc = Object.getOwnPropertyDescriptor(handler, key);
|
|
78
|
-
if (desc && !desc.set)
|
|
74
|
+
if (desc && !desc.set && !desc.writable)
|
|
79
75
|
return;
|
|
80
76
|
if (handler.propertyMap && handler.propertyMap[key]) {
|
|
81
77
|
key = handler.propertyMap[key];
|
|
@@ -113,12 +109,14 @@ export class PublisherProxy {
|
|
|
113
109
|
* Stop les appels de la fonction "handler" (passée en paramettre) lorsque la donnée est flaggée comme invalide
|
|
114
110
|
*/
|
|
115
111
|
offInvalidate(handler) {
|
|
112
|
+
if (typeof handler != "function")
|
|
113
|
+
return;
|
|
116
114
|
this._invalidateListeners_.delete(handler);
|
|
117
115
|
}
|
|
118
116
|
/**
|
|
119
117
|
* Flag les données comme étant invalides
|
|
120
118
|
*/
|
|
121
|
-
invalidate(
|
|
119
|
+
invalidate() {
|
|
122
120
|
this._publishInvalidation_();
|
|
123
121
|
}
|
|
124
122
|
/**
|
|
@@ -135,6 +133,8 @@ export class PublisherProxy {
|
|
|
135
133
|
* Stop les Appels de la fonction "handler" (passée en paramettre) lorsque quelque chose change la valeur gérée par le proxy quelque soit la profondeur de la donnée
|
|
136
134
|
*/
|
|
137
135
|
offInternalMutation(handler) {
|
|
136
|
+
if (typeof handler != "function")
|
|
137
|
+
return;
|
|
138
138
|
this._mutationListeners_.delete(handler);
|
|
139
139
|
}
|
|
140
140
|
/**
|
|
@@ -181,12 +181,14 @@ export class PublisherProxy {
|
|
|
181
181
|
* Assigne une nouvelle valeur au proxy ce qui déclenche la transmission de la donnée en fonction des "écouteurs" associés
|
|
182
182
|
*/
|
|
183
183
|
set(newValue, lockInternalMutationsTransmission = false) {
|
|
184
|
+
var _a;
|
|
184
185
|
/**
|
|
185
186
|
* On retounre tout de suite si la valeur n'a pas changé
|
|
186
187
|
*/
|
|
187
188
|
if (this._value_ === newValue)
|
|
188
189
|
return true;
|
|
189
|
-
if (this._value_
|
|
190
|
+
if ("hasOwnProperty" in this._value_ &&
|
|
191
|
+
this._value_.hasOwnProperty("__value") &&
|
|
190
192
|
newValue.hasOwnProperty("__value") &&
|
|
191
193
|
this._value_.__value === newValue.__value) {
|
|
192
194
|
return true;
|
|
@@ -194,7 +196,8 @@ export class PublisherProxy {
|
|
|
194
196
|
/**
|
|
195
197
|
* On assigne la nouvelle valeur
|
|
196
198
|
*/
|
|
197
|
-
this._value_
|
|
199
|
+
const prevValue = this._value_;
|
|
200
|
+
this._value_ = isComplex(newValue) ? newValue : { __value: newValue };
|
|
198
201
|
/**
|
|
199
202
|
* Si il s'agit d'une valeur primitive (un entier, une chaine ) la valeure en renseignée par un objet contenant la vaeur {__value}
|
|
200
203
|
* On publie juste et on sen va.
|
|
@@ -210,14 +213,31 @@ export class PublisherProxy {
|
|
|
210
213
|
* On met à jour leur valeur interne
|
|
211
214
|
* On publie les maj au fur et a mesure de modifications
|
|
212
215
|
*/
|
|
216
|
+
for (let key in this._value_) {
|
|
217
|
+
if (typeof this._value_[key] === "undefined")
|
|
218
|
+
delete this._value_[key];
|
|
219
|
+
}
|
|
213
220
|
Array.from(this._proxies_.keys()).forEach((key) => {
|
|
214
221
|
/**
|
|
215
222
|
* On supprime les proxys qui ne sont plus dans la nouvelle valeur si ils n'on pas d'écouteurs
|
|
216
223
|
**/
|
|
217
|
-
if (
|
|
218
|
-
this._proxies_.
|
|
224
|
+
if (typeof this._value_[key] === "undefined" && this._proxies_.has(key)) {
|
|
225
|
+
const subProxy = this._proxies_.get(key);
|
|
226
|
+
if (!(subProxy === null || subProxy === void 0 ? void 0 : subProxy.hasListener())) {
|
|
227
|
+
this._proxies_.delete(key);
|
|
228
|
+
}
|
|
229
|
+
else {
|
|
230
|
+
if (key != "_parent_") {
|
|
231
|
+
if (prevValue[key])
|
|
232
|
+
this._value_[key] = null;
|
|
233
|
+
}
|
|
234
|
+
}
|
|
219
235
|
}
|
|
220
236
|
});
|
|
237
|
+
/**
|
|
238
|
+
* On prévient les écouteurs que la valeur a changé
|
|
239
|
+
*/
|
|
240
|
+
this._publishAssignement_();
|
|
221
241
|
/**
|
|
222
242
|
* Si la donnée est complexe (objet, tableau)
|
|
223
243
|
* on crée les proxys pour les sous-éléments qui n'en on pas
|
|
@@ -230,17 +250,13 @@ export class PublisherProxy {
|
|
|
230
250
|
let valueV = isVComplex ? v : { __value: v };
|
|
231
251
|
if (!this._proxies_.has(key)) {
|
|
232
252
|
let newPublisher = new Publisher({}, this);
|
|
233
|
-
this._proxies_.set(key, newPublisher
|
|
253
|
+
this._proxies_.set(key, newPublisher);
|
|
234
254
|
newPublisher._proxies_.set("_parent_", this);
|
|
235
255
|
}
|
|
236
|
-
this._proxies_.get(key).set(valueV, true);
|
|
256
|
+
(_a = this._proxies_.get(key)) === null || _a === void 0 ? void 0 : _a.set(valueV, true);
|
|
237
257
|
this._publishDynamicFilling_(key, v);
|
|
238
258
|
}
|
|
239
259
|
}
|
|
240
|
-
/**
|
|
241
|
-
* On prévient les écouteurs que la valeur a changé
|
|
242
|
-
*/
|
|
243
|
-
this._publishAssignement_();
|
|
244
260
|
return true;
|
|
245
261
|
}
|
|
246
262
|
/**
|
|
@@ -261,10 +277,10 @@ export class PublisherProxy {
|
|
|
261
277
|
*/
|
|
262
278
|
export class PublisherManager {
|
|
263
279
|
constructor() {
|
|
280
|
+
this.publishers = new Map();
|
|
264
281
|
if (PublisherManager.instance != null)
|
|
265
282
|
throw "Singleton / use getInstance";
|
|
266
283
|
PublisherManager.instance = this;
|
|
267
|
-
this.publishers = new Map();
|
|
268
284
|
}
|
|
269
285
|
/**
|
|
270
286
|
* PublisherManager est un singleton
|
|
@@ -309,8 +325,8 @@ export class PublisherManager {
|
|
|
309
325
|
delete(id) {
|
|
310
326
|
if (!this.publishers.has(id))
|
|
311
327
|
return false;
|
|
312
|
-
const publisher = this.publishers.get(id);
|
|
313
328
|
this.publishers.delete(id);
|
|
329
|
+
return true;
|
|
314
330
|
}
|
|
315
331
|
}
|
|
316
332
|
PublisherManager.instance = null;
|
|
@@ -328,6 +344,7 @@ export default class Publisher extends PublisherProxy {
|
|
|
328
344
|
* Sinon un autre proxy qui a comme valeur interne la valeur corespondante à la clef dans l'objet.
|
|
329
345
|
*/
|
|
330
346
|
get: function (oTarget, sKey) {
|
|
347
|
+
oTarget;
|
|
331
348
|
if ([
|
|
332
349
|
"invalidate",
|
|
333
350
|
"onInvalidate",
|
|
@@ -373,6 +390,7 @@ export default class Publisher extends PublisherProxy {
|
|
|
373
390
|
* Les gestionnairs associés sopnt déclenchés en conséquence de manière profonde et remontante si nécessaire.
|
|
374
391
|
*/
|
|
375
392
|
set: function (oTarget, sKey, vValue) {
|
|
393
|
+
var _a;
|
|
376
394
|
//Fonctionnement pour la donnée interne pas de dispatch;
|
|
377
395
|
if (sKey == "_value_") {
|
|
378
396
|
oTarget._value_ = vValue;
|
|
@@ -389,7 +407,7 @@ export default class Publisher extends PublisherProxy {
|
|
|
389
407
|
if (prevValue !== vValue) {
|
|
390
408
|
that._value_[sKey] = vValue;
|
|
391
409
|
that._publishDynamicFilling_(sKey, vValue);
|
|
392
|
-
that._proxies_.get(sKey).set(isComplex(vValue) ? vValue : { __value: vValue });
|
|
410
|
+
(_a = that._proxies_.get(sKey)) === null || _a === void 0 ? void 0 : _a.set(isComplex(vValue) ? vValue : { __value: vValue });
|
|
393
411
|
}
|
|
394
412
|
//on retourne le proxy pour pouvoir chainer les assignements
|
|
395
413
|
return that._proxies_.get(sKey);
|
|
@@ -398,38 +416,46 @@ export default class Publisher extends PublisherProxy {
|
|
|
398
416
|
* Autres propriétés classiques d'un objet implémentées par le proxy
|
|
399
417
|
*/
|
|
400
418
|
deleteProperty: function (oTarget, sKey) {
|
|
419
|
+
oTarget;
|
|
401
420
|
// that._proxies_.get(sKey).set(null);
|
|
402
421
|
that._publishDynamicFilling_(sKey, null);
|
|
403
422
|
that._proxies_.delete(sKey);
|
|
404
423
|
return delete that._value_[sKey];
|
|
405
424
|
},
|
|
406
|
-
enumerate: function (oTarget, sKey) {
|
|
407
|
-
|
|
408
|
-
},
|
|
425
|
+
// enumerate: function (oTarget, sKey): any {
|
|
426
|
+
// return that._value_.keys();
|
|
427
|
+
// },
|
|
409
428
|
has: function (oTarget, sKey) {
|
|
429
|
+
oTarget;
|
|
410
430
|
return sKey in that._value_ && sKey != "_lockInternalMutationPublishing_";
|
|
411
431
|
},
|
|
412
432
|
defineProperty: function (oTarget, sKey, oDesc) {
|
|
433
|
+
oTarget;
|
|
413
434
|
if (oDesc && "value" in oDesc) {
|
|
414
435
|
that._value_[sKey] = oDesc.value;
|
|
415
436
|
}
|
|
416
437
|
return that._value_;
|
|
417
438
|
},
|
|
418
439
|
getOwnPropertyDescriptor: function (oTarget, sKey) {
|
|
419
|
-
|
|
440
|
+
oTarget;
|
|
441
|
+
sKey;
|
|
420
442
|
return {
|
|
421
443
|
enumerable: true,
|
|
422
444
|
configurable: true,
|
|
423
445
|
};
|
|
424
446
|
},
|
|
425
447
|
ownKeys: function (target) {
|
|
448
|
+
target;
|
|
426
449
|
if (that._value_.__value)
|
|
427
|
-
return Object.keys(
|
|
450
|
+
return Object.keys(that._value_.__value);
|
|
428
451
|
return Object.keys(that._value_);
|
|
429
452
|
},
|
|
430
453
|
});
|
|
431
454
|
return thisProxy;
|
|
432
455
|
}
|
|
456
|
+
getProperty(o, propertyName) {
|
|
457
|
+
return o[propertyName]; // o[propertyName] is of type T[K]
|
|
458
|
+
}
|
|
433
459
|
}
|
|
434
460
|
if (typeof module != "undefined")
|
|
435
461
|
module.exports = { Publisher: Publisher, PublisherManager: PublisherManager };
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
2
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
3
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
4
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
5
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
6
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
7
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
8
|
+
});
|
|
9
|
+
};
|
|
10
|
+
export default class Utils {
|
|
11
|
+
static delayPromise(timeoutMs) {
|
|
12
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
13
|
+
return new Promise((resolve) => {
|
|
14
|
+
setTimeout(resolve, timeoutMs);
|
|
15
|
+
});
|
|
16
|
+
});
|
|
17
|
+
}
|
|
18
|
+
}
|
package/core/utils/api.d.ts
CHANGED
|
@@ -4,8 +4,12 @@ export declare type APIConfiguration = {
|
|
|
4
4
|
userName: string | null;
|
|
5
5
|
password: string | null;
|
|
6
6
|
tokenProvider: string | null;
|
|
7
|
+
addHTTPResponse?: boolean;
|
|
8
|
+
credentials?: RequestCredentials;
|
|
7
9
|
};
|
|
8
|
-
declare class API {
|
|
10
|
+
declare class API<ResultType = any & {
|
|
11
|
+
_sonic_http_response_?: Response;
|
|
12
|
+
}, SendType = any> {
|
|
9
13
|
/**
|
|
10
14
|
* Ce tableau static permet de ne pas appeler plusieurs fois le même service lors d'appel concurrents en GET.
|
|
11
15
|
*/
|
|
@@ -30,16 +34,29 @@ declare class API {
|
|
|
30
34
|
* Le endPoint pour obtenir le bearer token qui sera concaténé à l'url du service
|
|
31
35
|
*/
|
|
32
36
|
tokenProvider: string | null;
|
|
37
|
+
/**
|
|
38
|
+
* credentials
|
|
39
|
+
*/
|
|
40
|
+
credentials?: RequestCredentials;
|
|
33
41
|
/**
|
|
34
42
|
* Tableau static des tokens stokés en memoire vive (comportement à revoir à l'occasion)
|
|
35
43
|
*/
|
|
36
44
|
static tokens: Map<string | null, string | null | undefined>;
|
|
45
|
+
/**
|
|
46
|
+
* Le endPoint pour obtenir le bearer token qui sera concaténé à l'url du service
|
|
47
|
+
*/
|
|
48
|
+
addHTTPResponse: Boolean;
|
|
49
|
+
lastResult?: Response;
|
|
37
50
|
constructor(config: APIConfiguration);
|
|
51
|
+
handleResult(fetchResult: Response): Promise<ResultType & {
|
|
52
|
+
_sonic_http_response_?: Response | undefined;
|
|
53
|
+
text?: string | undefined;
|
|
54
|
+
}>;
|
|
38
55
|
/**
|
|
39
56
|
* Basic auth
|
|
40
57
|
*/
|
|
41
58
|
auth(): Promise<void>;
|
|
42
|
-
get(path: String, additionalHeaders?: HeadersInit): Promise<
|
|
59
|
+
get(path: String, additionalHeaders?: HeadersInit): Promise<ResultType>;
|
|
43
60
|
/**
|
|
44
61
|
* Création du header, avec authentification si besoin
|
|
45
62
|
* ajout du language via le header accept-language qui contient le langue du navigateur
|
|
@@ -49,22 +66,37 @@ declare class API {
|
|
|
49
66
|
* Concatène le serviceURL et le endpoint donné en paramètre
|
|
50
67
|
*/
|
|
51
68
|
computeURL(path: String): string;
|
|
52
|
-
send(path: String, data:
|
|
69
|
+
send(path: String, data: SendType, method?: string, additionalHeaders?: HeadersInit): Promise<ResultType & {
|
|
70
|
+
_sonic_http_response_?: Response | undefined;
|
|
71
|
+
text?: string | undefined;
|
|
72
|
+
}>;
|
|
53
73
|
/**
|
|
54
74
|
* Agit comme une soumission de formulaire, mais attends un json en réponse
|
|
55
75
|
*/
|
|
56
|
-
submitFormData(path: String, data:
|
|
76
|
+
submitFormData(path: String, data: SendType | Record<string, string | Blob>, method?: string, additionalHeaders?: HeadersInit): Promise<ResultType & {
|
|
77
|
+
_sonic_http_response_?: Response | undefined;
|
|
78
|
+
text?: string | undefined;
|
|
79
|
+
}>;
|
|
57
80
|
/**
|
|
58
81
|
* Appel send en utilisant le méthode PUT
|
|
59
82
|
*/
|
|
60
|
-
put(path: String, data:
|
|
83
|
+
put(path: String, data: SendType, additionalHeaders?: HeadersInit): Promise<ResultType & {
|
|
84
|
+
_sonic_http_response_?: Response | undefined;
|
|
85
|
+
text?: string | undefined;
|
|
86
|
+
}>;
|
|
61
87
|
/**
|
|
62
88
|
* Appel send en utilisant le méthode POST
|
|
63
89
|
*/
|
|
64
|
-
post(path: String, data:
|
|
90
|
+
post(path: String, data: SendType, additionalHeaders?: HeadersInit): Promise<ResultType & {
|
|
91
|
+
_sonic_http_response_?: Response | undefined;
|
|
92
|
+
text?: string | undefined;
|
|
93
|
+
}>;
|
|
65
94
|
/**
|
|
66
95
|
* Appel send en utilisant le méthode delete
|
|
67
96
|
*/
|
|
68
|
-
delete(path: String, data:
|
|
97
|
+
delete(path: String, data: SendType, additionalHeaders?: HeadersInit): Promise<ResultType & {
|
|
98
|
+
_sonic_http_response_?: Response | undefined;
|
|
99
|
+
text?: string | undefined;
|
|
100
|
+
}>;
|
|
69
101
|
}
|
|
70
102
|
export default API;
|