@hortiview/modulebase 1.1.2-alpha.a0b1047e.1 → 2.0.0-alpha.e897c28d.1
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/IsRestoringProvider-Dc5Evyjr.js +6 -0
- package/dist/QueryClientProvider-DZI32rjZ.js +21 -0
- package/dist/api-CSxWxEZl.js +148 -0
- package/dist/{chunk-EVOBXE3Y-B43QN6RE.js → chunk-EVOBXE3Y-BRmUxtwH.js} +126 -127
- package/dist/components/ModuleBase.js +13 -17
- package/dist/components/ModuleCore.js +11398 -9
- package/dist/constants.js +1 -2
- package/dist/defaultQueryClient-Cfsorhtn.js +620 -0
- package/dist/hooks/useBreadcrumbTranslation.js +13 -16
- package/dist/hooks/useCustom.js +1 -1
- package/dist/hooks/useCustomMutation.js +5 -5
- package/dist/hooks/useEntity.js +1 -1
- package/dist/hooks/useOffline.js +1 -1
- package/dist/hooks/useOption.js +2 -2
- package/dist/hooks/useSignalRMessages.js +1 -1
- package/dist/lib/components/ModuleBase.d.ts +3 -22
- package/dist/lib/components/ModuleCore.d.ts +3 -17
- package/dist/lib/main.d.ts +0 -3
- package/dist/lib/module-router.d.ts +1 -1
- package/dist/lib/provider/SignalR/SignalRProvider.d.ts +0 -4
- package/dist/lib/types/BaseProps.d.ts +38 -1
- package/dist/lib/utils/defaultQueryClient.d.ts +2 -0
- package/dist/lib/utils/defaultSignalRClient.d.ts +4 -0
- package/dist/lib/utils/helper.d.ts +1 -2
- package/dist/main.js +56 -187
- package/dist/module-router.js +2 -2
- package/dist/provider/SignalR/SignalRProvider.js +22 -5966
- package/dist/{IsRestoringProvider-SzKJZczp.js → query-DZDIN635.js} +211 -232
- package/dist/stores/BasePropsStore.js +1 -0
- package/dist/{useCustomMutation-9VUQ7NbQ.js → useCustomMutation-C1aVbjpt.js} +13 -12
- package/dist/{useQuery-DUDyh33-.js → useQuery-CUSHkb38.js} +33 -31
- package/dist/utils/api.js +1 -1
- package/dist/utils/baseFetches.js +1 -1
- package/dist/utils/defaultQueryClient.js +4 -0
- package/dist/utils/defaultSignalRClient.js +5949 -0
- package/dist/utils/helper.js +9 -10
- package/package.json +1 -1
- package/dist/ModuleCore-DRMqZO8r.js +0 -12017
- package/dist/api-COabZnyn.js +0 -147
- package/dist/lib/types/ServiceBus.d.ts +0 -17
- package/dist/types/ServiceBus.js +0 -1
package/dist/api-COabZnyn.js
DELETED
|
@@ -1,147 +0,0 @@
|
|
|
1
|
-
import { g as w } from "./_commonjsHelpers-ByX85dGu.js";
|
|
2
|
-
import { r as b, a as j, b as v, c as I, d as M, e as R, f as _, g as B, h as C } from "./isTypedArray-SkhznY1k.js";
|
|
3
|
-
import { RETRY_HTTP_STATUS_CODES as z } from "./constants.js";
|
|
4
|
-
import { useBasePropsStore as c } from "./stores/BasePropsStore.js";
|
|
5
|
-
var h, g;
|
|
6
|
-
function O() {
|
|
7
|
-
if (g) return h;
|
|
8
|
-
g = 1;
|
|
9
|
-
var e = b();
|
|
10
|
-
function t(s, r, o) {
|
|
11
|
-
var n = s == null ? void 0 : e(s, r);
|
|
12
|
-
return n === void 0 ? o : n;
|
|
13
|
-
}
|
|
14
|
-
return h = t, h;
|
|
15
|
-
}
|
|
16
|
-
var U = O();
|
|
17
|
-
const $ = /* @__PURE__ */ w(U);
|
|
18
|
-
var d, y;
|
|
19
|
-
function G() {
|
|
20
|
-
if (y) return d;
|
|
21
|
-
y = 1;
|
|
22
|
-
var e = j(), t = v(), s = I(), r = M(), o = R(), n = _(), i = C(), f = B(), k = "[object Map]", q = "[object Set]", S = Object.prototype, x = S.hasOwnProperty;
|
|
23
|
-
function A(a) {
|
|
24
|
-
if (a == null)
|
|
25
|
-
return !0;
|
|
26
|
-
if (o(a) && (r(a) || typeof a == "string" || typeof a.splice == "function" || n(a) || f(a) || s(a)))
|
|
27
|
-
return !a.length;
|
|
28
|
-
var l = t(a);
|
|
29
|
-
if (l == k || l == q)
|
|
30
|
-
return !a.size;
|
|
31
|
-
if (i(a))
|
|
32
|
-
return !e(a).length;
|
|
33
|
-
for (var P in a)
|
|
34
|
-
if (x.call(a, P))
|
|
35
|
-
return !1;
|
|
36
|
-
return !0;
|
|
37
|
-
}
|
|
38
|
-
return d = A, d;
|
|
39
|
-
}
|
|
40
|
-
var H = G();
|
|
41
|
-
const D = /* @__PURE__ */ w(H), Y = (e, t, s, r = "GET", o) => {
|
|
42
|
-
const n = new Headers();
|
|
43
|
-
return n.append("Content-Type", "application/json"), t && n.append("orgId", t), s && n.append("languageId", s), e && n.append("Authorization", `Bearer ${e}`), o && o.forEach((i, f) => {
|
|
44
|
-
n.set(f, i);
|
|
45
|
-
}), {
|
|
46
|
-
redirect: "follow",
|
|
47
|
-
credentials: "omit",
|
|
48
|
-
method: r,
|
|
49
|
-
headers: n
|
|
50
|
-
};
|
|
51
|
-
};
|
|
52
|
-
let u = "moduleTokenIsFresh";
|
|
53
|
-
const p = async (e, t, s = !0) => {
|
|
54
|
-
for (; u === "isModuleTokenRefreshing"; )
|
|
55
|
-
await m(100);
|
|
56
|
-
const r = c.getState().throwError;
|
|
57
|
-
if (u === "unableToRefreshModuleToken") throw r?.("Unauthorized", 401);
|
|
58
|
-
let o = await Promise.resolve();
|
|
59
|
-
try {
|
|
60
|
-
const i = { ...t };
|
|
61
|
-
o = await fetch(e, i);
|
|
62
|
-
} catch {
|
|
63
|
-
s || r?.("Network error", 500);
|
|
64
|
-
}
|
|
65
|
-
if (K(o, e, t), o?.ok)
|
|
66
|
-
return T(o);
|
|
67
|
-
if (u === "isModuleTokenRefreshing")
|
|
68
|
-
return await p(e, t, s);
|
|
69
|
-
if (o?.status === 401)
|
|
70
|
-
return await F(e, t);
|
|
71
|
-
const n = Object.values(z);
|
|
72
|
-
return s && n.includes(o?.status) ? (await m(5e3), p(e, t, !1)) : T(o);
|
|
73
|
-
}, F = async (e, t) => {
|
|
74
|
-
const s = c.getState().throwError, r = c.getState().refreshModulePermissionToken;
|
|
75
|
-
if (r == null || typeof r != "function")
|
|
76
|
-
throw s?.("refreshModulePermissionToken is not a function or was not found", 401);
|
|
77
|
-
u = "isModuleTokenRefreshing";
|
|
78
|
-
const o = await r();
|
|
79
|
-
if (o === void 0)
|
|
80
|
-
throw u = "unableToRefreshModuleToken", s?.("Unauthorized", 401);
|
|
81
|
-
const n = {
|
|
82
|
-
...t,
|
|
83
|
-
headers: {
|
|
84
|
-
...t.headers,
|
|
85
|
-
Authorization: `Bearer ${o}`
|
|
86
|
-
}
|
|
87
|
-
};
|
|
88
|
-
return u = "moduleTokenIsFresh", p(e, n);
|
|
89
|
-
}, E = async (e) => {
|
|
90
|
-
const t = await e.text();
|
|
91
|
-
let s;
|
|
92
|
-
try {
|
|
93
|
-
s = JSON.parse(t);
|
|
94
|
-
} catch {
|
|
95
|
-
s = {
|
|
96
|
-
value: t
|
|
97
|
-
};
|
|
98
|
-
}
|
|
99
|
-
return s;
|
|
100
|
-
}, K = async (e, t, s) => {
|
|
101
|
-
const r = e.clone(), o = c.getState().logEvent, n = c.getState().logError;
|
|
102
|
-
try {
|
|
103
|
-
const i = {
|
|
104
|
-
requestUrl: t,
|
|
105
|
-
requestHeaders: { ...s.headers, Authorization: void 0 },
|
|
106
|
-
requestMethod: s.method,
|
|
107
|
-
requestBody: $(s, "body"),
|
|
108
|
-
responseStatus: r?.status.toString(),
|
|
109
|
-
responseStatusText: r?.statusText,
|
|
110
|
-
responseBody: await E(r)
|
|
111
|
-
};
|
|
112
|
-
e.ok && o ? o({
|
|
113
|
-
name: `request: ${r?.status.toString()} - ${t}`,
|
|
114
|
-
properties: i
|
|
115
|
-
}) : n?.({
|
|
116
|
-
exception: {
|
|
117
|
-
name: `request: ${r?.status.toString()} - ${t}`,
|
|
118
|
-
message: r?.statusText
|
|
119
|
-
},
|
|
120
|
-
properties: i
|
|
121
|
-
});
|
|
122
|
-
} catch {
|
|
123
|
-
console.error("Error while tracking event or exception in AppInsights");
|
|
124
|
-
}
|
|
125
|
-
}, T = async (e) => {
|
|
126
|
-
if (e.ok)
|
|
127
|
-
return E(e);
|
|
128
|
-
const t = {
|
|
129
|
-
detail: e.statusText,
|
|
130
|
-
status: e.status,
|
|
131
|
-
stack: void 0,
|
|
132
|
-
title: "BaseError"
|
|
133
|
-
}, s = c.getState().throwError;
|
|
134
|
-
try {
|
|
135
|
-
const r = await e.json();
|
|
136
|
-
D(r) || (t.title = r.title ?? "UnexpectedError", t.stack = r.message ?? r.title ?? e.statusText, t.detail = r.detail);
|
|
137
|
-
} catch {
|
|
138
|
-
t.detail = e.statusText;
|
|
139
|
-
}
|
|
140
|
-
throw s?.(t.detail, t.status);
|
|
141
|
-
}, m = (e) => new Promise((t) => setTimeout(t, e));
|
|
142
|
-
export {
|
|
143
|
-
Y as a,
|
|
144
|
-
p as f,
|
|
145
|
-
$ as g,
|
|
146
|
-
T as h
|
|
147
|
-
};
|
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
export type AlertServiceBusMessage = {
|
|
2
|
-
farmOrganizationId: string;
|
|
3
|
-
alertRulesDefinitionId: string;
|
|
4
|
-
farmId: string;
|
|
5
|
-
fieldId: string;
|
|
6
|
-
blockId: string;
|
|
7
|
-
/**
|
|
8
|
-
* needs to be an ID that can be received from the common data/api
|
|
9
|
-
*/
|
|
10
|
-
criteriaId: string;
|
|
11
|
-
moduleId: string;
|
|
12
|
-
description: string;
|
|
13
|
-
};
|
|
14
|
-
export type ServiceBusMessage = AlertServiceBusMessage & {
|
|
15
|
-
deviceId: '62ac8dbc-45bc-407d-9fb4-8efe9747abe0';
|
|
16
|
-
scope: 'FarmOrgMembers';
|
|
17
|
-
};
|
package/dist/types/ServiceBus.js
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
|