@plumile/backoffice-react 0.1.200 → 0.1.205
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 +4 -4
- package/lib/esm/auth/login/LoginFlow.js.map +1 -1
- package/lib/esm/auth/pages/AcceptInvitationScreen.js.map +1 -1
- package/lib/esm/auth/pages/PasswordResetCompleteScreen.js.map +1 -1
- package/lib/esm/auth/pages/PasswordResetRequestScreen.js.map +1 -1
- package/lib/esm/components/backoffice/actions/BackofficeEntityActionFormDialog.js.map +1 -1
- package/lib/esm/components/backoffice/detail/BackofficeEntitySummaryHeader.js +28 -28
- package/lib/esm/components/backoffice/detail/BackofficeEntitySummaryHeader.js.map +1 -1
- package/lib/esm/components/backoffice/layout/breadcrumb/buildBreadcrumbs.js.map +1 -1
- package/lib/esm/components/backoffice/layout/sidebarUtils.js.map +1 -1
- package/lib/esm/components/backoffice/pickers/EntityIdPickerDialog.js +1 -1
- package/lib/esm/components/backoffice/pickers/EntityIdPickerDialog.js.map +1 -1
- package/lib/esm/components/backoffice/scaffolds/BackofficeEntityListScaffold.js +183 -183
- package/lib/esm/components/backoffice/scaffolds/BackofficeEntityListScaffold.js.map +1 -1
- package/lib/esm/hooks/useAuth.js +56 -56
- package/lib/esm/hooks/useAuth.js.map +1 -1
- package/lib/esm/hooks/useConditionalSubscription.js +18 -18
- package/lib/esm/hooks/useConditionalSubscription.js.map +1 -1
- package/lib/esm/index.js +49 -57
- package/lib/esm/pages/BackofficeEntityDetailLayoutPage.js +1 -1
- package/lib/esm/pages/BackofficeEntityDetailLayoutPage.js.map +1 -1
- package/lib/esm/pages/BackofficeEntityDetailPage.helpers.js.map +1 -1
- package/lib/esm/pages/BackofficeEntityDetailPage.js +172 -172
- package/lib/esm/pages/BackofficeEntityDetailPage.js.map +1 -1
- package/lib/esm/pages/BackofficeEntityListDataPage.js +1 -1
- package/lib/esm/pages/BackofficeEntityListDataPage.js.map +1 -1
- package/lib/esm/pages/BackofficeEntityListPage.helpers.js.map +1 -1
- package/lib/esm/pages/BackofficeLayoutPage.js +19 -19
- package/lib/esm/pages/BackofficeLayoutPage.js.map +1 -1
- package/lib/esm/provider/BackofficeProvider.js +33 -33
- package/lib/esm/provider/entityRegistry.js +39 -36
- package/lib/esm/provider/entityRegistry.js.map +1 -1
- package/lib/esm/provider/useBackofficeAuthRouteGate.js +7 -7
- package/lib/esm/provider/useBackofficeAuthRouteGate.js.map +1 -1
- package/lib/esm/relay/createInlineReader.js.map +1 -1
- package/lib/esm/relay/typedRelayHooks.js +11 -2
- package/lib/esm/relay/typedRelayHooks.js.map +1 -1
- package/lib/esm/router/createBackofficeRoutes.js +26 -28
- package/lib/esm/router/createBackofficeRoutes.js.map +1 -1
- package/lib/esm/storybook/relay/RelayStory.js +32 -32
- package/lib/esm/storybook/relay/RelayStory.js.map +1 -1
- package/lib/esm/storybook/relay/mockResolvers.js.map +1 -1
- package/lib/esm/style.css +1 -1
- package/lib/types/components/backoffice/actions/BackofficeEntityActionFormDialog.d.ts +2 -2
- package/lib/types/components/backoffice/actions/BackofficeEntityActionFormDialog.d.ts.map +1 -1
- package/lib/types/components/backoffice/detail/BackofficeEntitySummaryHeader.d.ts +1 -1
- package/lib/types/components/backoffice/detail/BackofficeEntitySummaryHeader.d.ts.map +1 -1
- package/lib/types/components/backoffice/layout/sidebarUtils.d.ts.map +1 -1
- package/lib/types/components/backoffice/pickers/EntityIdPickerDialog.d.ts.map +1 -1
- package/lib/types/hooks/useAuth.d.ts.map +1 -1
- package/lib/types/hooks/useConditionalSubscription.d.ts.map +1 -1
- package/lib/types/i18n/locales/en/backofficeReact.d.ts +5 -0
- package/lib/types/i18n/locales/fr/backofficeReact.d.ts +5 -0
- package/lib/types/index.d.ts +2 -9
- package/lib/types/index.d.ts.map +1 -1
- package/lib/types/pages/BackofficeEntityDetailPage.d.ts.map +1 -1
- package/lib/types/pages/BackofficeEntityDetailPage.helpers.d.ts +3 -3
- package/lib/types/pages/BackofficeEntityDetailPage.helpers.d.ts.map +1 -1
- package/lib/types/pages/BackofficeEntityListPage.helpers.d.ts +2 -2
- package/lib/types/pages/BackofficeEntityListPage.helpers.d.ts.map +1 -1
- package/lib/types/pages/BackofficeLayoutPage.d.ts.map +1 -1
- package/lib/types/provider/entityRegistry.d.ts.map +1 -1
- package/lib/types/provider/types.d.ts +1 -1
- package/lib/types/provider/types.d.ts.map +1 -1
- package/lib/types/provider/useBackofficeAuthRouteGate.d.ts.map +1 -1
- package/lib/types/relay/createInlineReader.d.ts +4 -1
- package/lib/types/relay/createInlineReader.d.ts.map +1 -1
- package/lib/types/relay/typedRelayHooks.d.ts +15 -5
- package/lib/types/relay/typedRelayHooks.d.ts.map +1 -1
- package/lib/types/router/createBackofficeRoutes.d.ts +4 -4
- package/lib/types/router/createBackofficeRoutes.d.ts.map +1 -1
- package/lib/types/storybook/relay/RelayStory.d.ts +1 -1
- package/lib/types/storybook/relay/RelayStory.d.ts.map +1 -1
- package/lib/types/storybook/relay/mockResolvers.d.ts +9 -1
- package/lib/types/storybook/relay/mockResolvers.d.ts.map +1 -1
- package/package.json +12 -15
- package/lib/esm/_virtual/_rolldown/runtime.js +0 -7
- package/lib/esm/components/backoffice/detail/BackofficeDetailFlagTag.js +0 -13
- package/lib/esm/components/backoffice/detail/BackofficeDetailFlagTag.js.map +0 -1
- package/lib/esm/components/backoffice/detail/BackofficeDetailTaggedValue.js +0 -12
- package/lib/esm/components/backoffice/detail/BackofficeDetailTaggedValue.js.map +0 -1
- package/lib/esm/components/backoffice/detail/BackofficeEnumLabel.js +0 -16
- package/lib/esm/components/backoffice/detail/BackofficeEnumLabel.js.map +0 -1
- package/lib/esm/components/backoffice/detail/BackofficeReferenceValue.js +0 -17
- package/lib/esm/components/backoffice/detail/BackofficeReferenceValue.js.map +0 -1
- package/lib/esm/components/backoffice/detail/BackofficeStatusGroup.js +0 -8
- package/lib/esm/components/backoffice/detail/BackofficeStatusGroup.js.map +0 -1
- package/lib/esm/components/backoffice/detail/BackofficeStatusMetaBadge.js +0 -16
- package/lib/esm/components/backoffice/detail/BackofficeStatusMetaBadge.js.map +0 -1
- package/lib/esm/components/backoffice/detail/backofficeDetailRelationLink.css.js +0 -6
- package/lib/esm/components/backoffice/detail/backofficeDetailRelationLink.css.js.map +0 -1
- package/lib/esm/components/backoffice/refs/backofficeEntityIdRef.css.js +0 -6
- package/lib/esm/components/backoffice/refs/backofficeEntityIdRef.css.js.map +0 -1
- package/lib/esm/components/backoffice/routing/BackofficeRoutePendingBar.js +0 -12
- package/lib/esm/components/backoffice/routing/BackofficeRoutePendingBar.js.map +0 -1
- package/lib/esm/components/backoffice/routing/backofficeRoutePendingBar.css.js +0 -7
- package/lib/esm/components/backoffice/routing/backofficeRoutePendingBar.css.js.map +0 -1
- package/lib/esm/modules/base64.js +0 -21
- package/lib/esm/modules/base64.js.map +0 -1
- package/lib/esm/node_modules/@babel/runtime/helpers/arrayLikeToArray.js +0 -15
- package/lib/esm/node_modules/@babel/runtime/helpers/arrayLikeToArray.js.map +0 -1
- package/lib/esm/node_modules/@babel/runtime/helpers/arrayWithoutHoles.js +0 -15
- package/lib/esm/node_modules/@babel/runtime/helpers/arrayWithoutHoles.js.map +0 -1
- package/lib/esm/node_modules/@babel/runtime/helpers/defineProperty.js +0 -20
- package/lib/esm/node_modules/@babel/runtime/helpers/defineProperty.js.map +0 -1
- package/lib/esm/node_modules/@babel/runtime/helpers/interopRequireDefault.js +0 -13
- package/lib/esm/node_modules/@babel/runtime/helpers/interopRequireDefault.js.map +0 -1
- package/lib/esm/node_modules/@babel/runtime/helpers/iterableToArray.js +0 -13
- package/lib/esm/node_modules/@babel/runtime/helpers/iterableToArray.js.map +0 -1
- package/lib/esm/node_modules/@babel/runtime/helpers/nonIterableSpread.js +0 -13
- package/lib/esm/node_modules/@babel/runtime/helpers/nonIterableSpread.js.map +0 -1
- package/lib/esm/node_modules/@babel/runtime/helpers/objectSpread2.js +0 -33
- package/lib/esm/node_modules/@babel/runtime/helpers/objectSpread2.js.map +0 -1
- package/lib/esm/node_modules/@babel/runtime/helpers/objectWithoutPropertiesLoose.js +0 -19
- package/lib/esm/node_modules/@babel/runtime/helpers/objectWithoutPropertiesLoose.js.map +0 -1
- package/lib/esm/node_modules/@babel/runtime/helpers/toConsumableArray.js +0 -18
- package/lib/esm/node_modules/@babel/runtime/helpers/toConsumableArray.js.map +0 -1
- package/lib/esm/node_modules/@babel/runtime/helpers/toPrimitive.js +0 -22
- package/lib/esm/node_modules/@babel/runtime/helpers/toPrimitive.js.map +0 -1
- package/lib/esm/node_modules/@babel/runtime/helpers/toPropertyKey.js +0 -17
- package/lib/esm/node_modules/@babel/runtime/helpers/toPropertyKey.js.map +0 -1
- package/lib/esm/node_modules/@babel/runtime/helpers/typeof.js +0 -18
- package/lib/esm/node_modules/@babel/runtime/helpers/typeof.js.map +0 -1
- package/lib/esm/node_modules/@babel/runtime/helpers/unsupportedIterableToArray.js +0 -19
- package/lib/esm/node_modules/@babel/runtime/helpers/unsupportedIterableToArray.js.map +0 -1
- package/lib/esm/node_modules/fbjs/lib/areEqual.js +0 -42
- package/lib/esm/node_modules/fbjs/lib/areEqual.js.map +0 -1
- package/lib/esm/node_modules/invariant/browser.js +0 -30
- package/lib/esm/node_modules/invariant/browser.js.map +0 -1
- package/lib/esm/node_modules/relay-test-utils/index.js +0 -11
- package/lib/esm/node_modules/relay-test-utils/index.js.map +0 -1
- package/lib/esm/node_modules/relay-test-utils/lib/RelayMockPayloadGenerator.js +0 -288
- package/lib/esm/node_modules/relay-test-utils/lib/RelayMockPayloadGenerator.js.map +0 -1
- package/lib/esm/node_modules/relay-test-utils/lib/RelayModernMockEnvironment.js +0 -183
- package/lib/esm/node_modules/relay-test-utils/lib/RelayModernMockEnvironment.js.map +0 -1
- package/lib/esm/node_modules/relay-test-utils/lib/RelayResolverTestUtils.js +0 -19
- package/lib/esm/node_modules/relay-test-utils/lib/RelayResolverTestUtils.js.map +0 -1
- package/lib/esm/node_modules/relay-test-utils/lib/index.js +0 -21
- package/lib/esm/node_modules/relay-test-utils/lib/index.js.map +0 -1
- package/lib/esm/node_modules/relay-test-utils/lib/unwrapContainer.js +0 -16
- package/lib/esm/node_modules/relay-test-utils/lib/unwrapContainer.js.map +0 -1
- package/lib/esm/relay/RelayProvider.js +0 -2
- package/lib/esm/relay/envHelpers.js +0 -55
- package/lib/esm/relay/envHelpers.js.map +0 -1
- package/lib/esm/relay/environment.js +0 -2
- package/lib/esm/relay/shortAccessTokenEnvironment.js +0 -2
- package/lib/esm/relay/useRelayOperationActivity.js +0 -2
- package/lib/esm/storybook/relay/relay-test-utils.d.js +0 -0
- package/lib/types/auth/AuthFlows.stories.d.ts +0 -19
- package/lib/types/auth/AuthFlows.stories.d.ts.map +0 -1
- package/lib/types/components/backoffice/billing/BackofficeBillingUsageChart.stories.d.ts +0 -41
- package/lib/types/components/backoffice/billing/BackofficeBillingUsageChart.stories.d.ts.map +0 -1
- package/lib/types/components/backoffice/detail/BackofficeDetailFlagTag.d.ts +0 -11
- package/lib/types/components/backoffice/detail/BackofficeDetailFlagTag.d.ts.map +0 -1
- package/lib/types/components/backoffice/detail/BackofficeDetailPrimitives.stories.d.ts +0 -17
- package/lib/types/components/backoffice/detail/BackofficeDetailPrimitives.stories.d.ts.map +0 -1
- package/lib/types/components/backoffice/detail/BackofficeDetailTaggedValue.d.ts +0 -13
- package/lib/types/components/backoffice/detail/BackofficeDetailTaggedValue.d.ts.map +0 -1
- package/lib/types/components/backoffice/detail/BackofficeEnumLabel.d.ts +0 -9
- package/lib/types/components/backoffice/detail/BackofficeEnumLabel.d.ts.map +0 -1
- package/lib/types/components/backoffice/detail/BackofficeReferenceValue.d.ts +0 -10
- package/lib/types/components/backoffice/detail/BackofficeReferenceValue.d.ts.map +0 -1
- package/lib/types/components/backoffice/detail/BackofficeStatusGroup.d.ts +0 -8
- package/lib/types/components/backoffice/detail/BackofficeStatusGroup.d.ts.map +0 -1
- package/lib/types/components/backoffice/detail/BackofficeStatusMetaBadge.d.ts +0 -11
- package/lib/types/components/backoffice/detail/BackofficeStatusMetaBadge.d.ts.map +0 -1
- package/lib/types/components/backoffice/detail/backofficeDetailRelationLink.css.d.ts +0 -6
- package/lib/types/components/backoffice/detail/backofficeDetailRelationLink.css.d.ts.map +0 -1
- package/lib/types/components/backoffice/errors/BackofficeErrorBoundary.stories.d.ts +0 -12
- package/lib/types/components/backoffice/errors/BackofficeErrorBoundary.stories.d.ts.map +0 -1
- package/lib/types/components/backoffice/filters/EntityIdFilterField.stories.d.ts +0 -12
- package/lib/types/components/backoffice/filters/EntityIdFilterField.stories.d.ts.map +0 -1
- package/lib/types/components/backoffice/hub/BackofficeHubTemplate.stories.d.ts +0 -49
- package/lib/types/components/backoffice/hub/BackofficeHubTemplate.stories.d.ts.map +0 -1
- package/lib/types/components/backoffice/overview/BackofficeOverviewLayout.stories.d.ts +0 -11
- package/lib/types/components/backoffice/overview/BackofficeOverviewLayout.stories.d.ts.map +0 -1
- package/lib/types/components/backoffice/pickers/EntityIdPickerDialog.stories.d.ts +0 -12
- package/lib/types/components/backoffice/pickers/EntityIdPickerDialog.stories.d.ts.map +0 -1
- package/lib/types/components/backoffice/refs/backofficeEntityIdRef.css.d.ts +0 -2
- package/lib/types/components/backoffice/refs/backofficeEntityIdRef.css.d.ts.map +0 -1
- package/lib/types/components/backoffice/routing/BackofficeRoutePendingBar.d.ts +0 -4
- package/lib/types/components/backoffice/routing/BackofficeRoutePendingBar.d.ts.map +0 -1
- package/lib/types/components/backoffice/routing/backofficeRoutePendingBar.css.d.ts +0 -3
- package/lib/types/components/backoffice/routing/backofficeRoutePendingBar.css.d.ts.map +0 -1
- package/lib/types/components/backoffice/scaffolds/BackofficeTabbedDetailShell.stories.d.ts +0 -11
- package/lib/types/components/backoffice/scaffolds/BackofficeTabbedDetailShell.stories.d.ts.map +0 -1
- package/lib/types/components/backoffice/tools/BackofficeTools.stories.d.ts +0 -17
- package/lib/types/components/backoffice/tools/BackofficeTools.stories.d.ts.map +0 -1
- package/lib/types/modules/base64.d.ts +0 -3
- package/lib/types/modules/base64.d.ts.map +0 -1
- package/lib/types/pages/BackofficeDashboardPage.stories.d.ts +0 -9
- package/lib/types/pages/BackofficeDashboardPage.stories.d.ts.map +0 -1
- package/lib/types/relay/RelayProvider.d.ts +0 -2
- package/lib/types/relay/RelayProvider.d.ts.map +0 -1
- package/lib/types/relay/envHelpers.d.ts +0 -25
- package/lib/types/relay/envHelpers.d.ts.map +0 -1
- package/lib/types/relay/environment.d.ts +0 -2
- package/lib/types/relay/environment.d.ts.map +0 -1
- package/lib/types/relay/shortAccessTokenEnvironment.d.ts +0 -5
- package/lib/types/relay/shortAccessTokenEnvironment.d.ts.map +0 -1
- package/lib/types/relay/useRelayOperationActivity.d.ts +0 -2
- package/lib/types/relay/useRelayOperationActivity.d.ts.map +0 -1
|
@@ -12,12 +12,12 @@ import { StrictMode as d, useEffect as f, useMemo as p, useRef as m, useState as
|
|
|
12
12
|
import { jsx as g, jsxs as _ } from "react/jsx-runtime";
|
|
13
13
|
import { I18nextProvider as v } from "react-i18next";
|
|
14
14
|
import y from "@plumile/router/routing/RoutingContext.js";
|
|
15
|
-
import {
|
|
16
|
-
import
|
|
17
|
-
import
|
|
18
|
-
import
|
|
19
|
-
import {
|
|
20
|
-
import {
|
|
15
|
+
import { createInstance as b } from "i18next";
|
|
16
|
+
import x from "@plumile/router/routing/createRouter.js";
|
|
17
|
+
import S from "@plumile/router/routing/RouterRenderer.js";
|
|
18
|
+
import { BackofficeThemeProvider as C } from "@plumile/ui/admin/theme/BackofficeThemeProvider.js";
|
|
19
|
+
import { RoutePendingBar as w } from "@plumile/ui/components/routing/RoutePendingBar.js";
|
|
20
|
+
import { RelayProvider as T, configureRelayEnvironment as E, useRelayOperationActivity as D } from "@plumile/relay";
|
|
21
21
|
//#region src/provider/BackofficeProvider.tsx
|
|
22
22
|
var O = (e) => e.trim() === "" || e === "/" ? "/" : e.startsWith("/") ? e.endsWith("/") ? e.slice(0, -1) : e : `/${e}`, k = (e, t) => {
|
|
23
23
|
let n = O(t), r = O(e);
|
|
@@ -32,7 +32,7 @@ var O = (e) => e.trim() === "" || e === "/" ? "/" : e.startsWith("/") ? e.endsWi
|
|
|
32
32
|
}])), j = ({ routes: e, context: t, instrumentations: n }) => {
|
|
33
33
|
let [r, i] = h(null), a = m(null);
|
|
34
34
|
return f(() => {
|
|
35
|
-
let r =
|
|
35
|
+
let r = x(e, {
|
|
36
36
|
context: t,
|
|
37
37
|
instrumentations: n
|
|
38
38
|
});
|
|
@@ -45,41 +45,41 @@ var O = (e) => e.trim() === "" || e === "/" ? "/" : e.startsWith("/") ? e.endsWi
|
|
|
45
45
|
e
|
|
46
46
|
]), r;
|
|
47
47
|
}, M = ({ routes: e, instrumentations: t }) => {
|
|
48
|
-
let r = i(), a =
|
|
48
|
+
let r = i(), a = D(), o = j({
|
|
49
49
|
routes: e,
|
|
50
50
|
context: p(() => ({ relayEnvironment: r }), [r]),
|
|
51
51
|
instrumentations: t
|
|
52
52
|
});
|
|
53
53
|
return o == null ? /* @__PURE__ */ g(n, {}) : /* @__PURE__ */ g(y.Provider, {
|
|
54
54
|
value: o.context,
|
|
55
|
-
children: /* @__PURE__ */ g(
|
|
55
|
+
children: /* @__PURE__ */ g(S, {
|
|
56
56
|
enableTransition: !0,
|
|
57
57
|
externalPending: a.pendingCount > 0,
|
|
58
58
|
fallback: /* @__PURE__ */ g(n, {}),
|
|
59
|
-
pending: /* @__PURE__ */ g(
|
|
59
|
+
pending: /* @__PURE__ */ g(w, {})
|
|
60
60
|
})
|
|
61
61
|
});
|
|
62
62
|
}, N = (n) => {
|
|
63
|
-
let i = O(n.basePath ?? "/"), m = u(i), y = p(() => A(n.entityManifest, i), [i, n.entityManifest]),
|
|
63
|
+
let i = O(n.basePath ?? "/"), m = u(i), y = p(() => A(n.entityManifest, i), [i, n.entityManifest]), x = p(() => c(y, { basePath: i }), [i, y]), S = n.graphql, w = p(() => t(n.dashboards), [n.dashboards]);
|
|
64
64
|
f(() => {
|
|
65
|
-
let e =
|
|
66
|
-
|
|
65
|
+
let e = S.httpUrl ?? S.endpoint, t = S.wsUrl ?? S.wsEndpoint;
|
|
66
|
+
E({
|
|
67
67
|
httpUrl: e,
|
|
68
68
|
wsUrl: t,
|
|
69
|
-
getDataId:
|
|
70
|
-
logEvents:
|
|
71
|
-
getAuthHeaders:
|
|
69
|
+
getDataId: S.getDataId,
|
|
70
|
+
logEvents: S.logEvents,
|
|
71
|
+
getAuthHeaders: S.getAuthHeaders
|
|
72
72
|
});
|
|
73
73
|
}, [
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
74
|
+
S.endpoint,
|
|
75
|
+
S.getAuthHeaders,
|
|
76
|
+
S.getDataId,
|
|
77
|
+
S.httpUrl,
|
|
78
|
+
S.logEvents,
|
|
79
|
+
S.wsEndpoint,
|
|
80
|
+
S.wsUrl
|
|
81
81
|
]);
|
|
82
|
-
let D = p(() => o(n.i18n?.resources ?? {}), [n.i18n?.resources]), k = p(() => n.i18n?.instance ??
|
|
82
|
+
let D = p(() => o(n.i18n?.resources ?? {}), [n.i18n?.resources]), k = p(() => n.i18n?.instance ?? b(), [n.i18n?.instance]), [j, N] = h(k.isInitialized);
|
|
83
83
|
f(() => {
|
|
84
84
|
let e = !0, t = () => {
|
|
85
85
|
e && N(!0);
|
|
@@ -128,43 +128,43 @@ var O = (e) => e.trim() === "" || e === "/" ? "/" : e.startsWith("/") ? e.endsWi
|
|
|
128
128
|
basePath: i,
|
|
129
129
|
entities: y,
|
|
130
130
|
entityManifest: y,
|
|
131
|
-
entityRegistry:
|
|
131
|
+
entityRegistry: x,
|
|
132
132
|
filterColumnAliases: n.filterColumnAliases,
|
|
133
133
|
sidebar: n.sidebar,
|
|
134
134
|
dashboard: n.dashboard,
|
|
135
|
-
dashboards:
|
|
135
|
+
dashboards: w,
|
|
136
136
|
auth: n.auth,
|
|
137
137
|
graphql: n.graphql
|
|
138
138
|
}), [
|
|
139
139
|
i,
|
|
140
140
|
n.auth,
|
|
141
141
|
n.dashboard,
|
|
142
|
-
|
|
142
|
+
w,
|
|
143
143
|
y,
|
|
144
|
-
|
|
144
|
+
x,
|
|
145
145
|
n.filterColumnAliases,
|
|
146
146
|
n.graphql,
|
|
147
147
|
n.sidebar
|
|
148
148
|
]), F = p(() => s({
|
|
149
149
|
basePath: i,
|
|
150
150
|
entityManifest: y,
|
|
151
|
-
entityRegistry:
|
|
151
|
+
entityRegistry: x,
|
|
152
152
|
sidebar: n.sidebar,
|
|
153
153
|
auth: n.auth,
|
|
154
154
|
dashboard: n.dashboard,
|
|
155
|
-
dashboards:
|
|
155
|
+
dashboards: w,
|
|
156
156
|
toolsOperationPage: n.toolsOperationPage
|
|
157
157
|
}), [
|
|
158
158
|
i,
|
|
159
159
|
y,
|
|
160
|
-
|
|
160
|
+
x,
|
|
161
161
|
n.auth,
|
|
162
162
|
n.dashboard,
|
|
163
|
-
|
|
163
|
+
w,
|
|
164
164
|
n.toolsOperationPage,
|
|
165
165
|
n.sidebar
|
|
166
166
|
]), I = /* @__PURE__ */ g(r, { label: "Loading..." });
|
|
167
|
-
return j && m && (I = /* @__PURE__ */ g(
|
|
167
|
+
return j && m && (I = /* @__PURE__ */ g(C, { children: /* @__PURE__ */ g(T, { children: /* @__PURE__ */ _(e, {
|
|
168
168
|
value: P,
|
|
169
169
|
children: [n.overlay, /* @__PURE__ */ g(l, { children: /* @__PURE__ */ g(M, {
|
|
170
170
|
routes: F,
|
|
@@ -1,95 +1,98 @@
|
|
|
1
1
|
import { resolveBackofficeLoadedFacetModule as e } from "@plumile/backoffice-core/resolve.js";
|
|
2
2
|
//#region src/provider/entityRegistry.ts
|
|
3
|
-
var t = "cache-first", n = "detail-page", r = "detail-layout", i = "list", a = "picker", o = "tool", s = (e) => e.kind === "list-detail", c = (e) => e.kind === "tool", l = (e, t, r) => t === n ? `${e}:${t}:${r ?? ""}` : `${e}:${t}`, u = (e) => e instanceof Error ? e : Error(String(e)), d = (e) => e?.status !== "loaded" || e.module == null ? null : e.module,
|
|
3
|
+
var t = "cache-first", n = "detail-page", r = "detail-layout", i = "list", a = "picker", o = "tool", s = (e) => e.kind === "list-detail", c = (e) => e.kind === "tool", l = (e, t, r) => t === n ? `${e}:${t}:${r ?? ""}` : `${e}:${t}`, u = (e) => e instanceof Error ? e : Error(String(e)), d = (e, t) => e.kind === t, f = (e, t) => e?.status !== "loaded" || e.module == null ? null : d(e.module, t) ? e.module : null, p = (e, t) => {
|
|
4
4
|
let n = e[t];
|
|
5
5
|
if (n == null) throw Error(`Unknown backoffice entity: ${t}`);
|
|
6
6
|
return n;
|
|
7
|
-
},
|
|
8
|
-
let
|
|
9
|
-
if ((
|
|
10
|
-
let t =
|
|
7
|
+
}, m = (m, h) => {
|
|
8
|
+
let g = /* @__PURE__ */ new Map(), _ = (e) => m[e] ?? null, v = async (e, n, r, i) => {
|
|
9
|
+
if ((r?.mode ?? t) === "cache-first") {
|
|
10
|
+
let t = f(g.get(e), n);
|
|
11
11
|
if (t != null) return t;
|
|
12
|
-
let
|
|
13
|
-
if (
|
|
12
|
+
let r = g.get(e);
|
|
13
|
+
if (r?.status === "loading" && r.promise != null) return r.promise.then((e) => {
|
|
14
|
+
if (!d(e, n)) throw Error(`Cached backoffice facet kind mismatch: ${n}`);
|
|
15
|
+
return e;
|
|
16
|
+
});
|
|
14
17
|
}
|
|
15
|
-
let
|
|
18
|
+
let a = i().then((t) => (g.set(e, {
|
|
16
19
|
status: "loaded",
|
|
17
20
|
module: t
|
|
18
21
|
}), t)).catch((t) => {
|
|
19
22
|
let n = u(t);
|
|
20
|
-
throw
|
|
23
|
+
throw g.set(e, {
|
|
21
24
|
status: "error",
|
|
22
25
|
error: n
|
|
23
26
|
}), n;
|
|
24
27
|
});
|
|
25
|
-
return
|
|
28
|
+
return g.set(e, {
|
|
26
29
|
status: "loading",
|
|
27
|
-
promise:
|
|
28
|
-
}),
|
|
30
|
+
promise: a
|
|
31
|
+
}), a;
|
|
29
32
|
};
|
|
30
33
|
return {
|
|
31
|
-
getManifest:
|
|
32
|
-
getLoadedListEntity: (e) =>
|
|
33
|
-
getLoadedPickerEntity: (e) =>
|
|
34
|
-
getLoadedDetailLayoutEntity: (e) =>
|
|
35
|
-
getLoadedDetailPageEntity: (e, t) =>
|
|
36
|
-
getLoadedToolEntity: (e) =>
|
|
34
|
+
getManifest: _,
|
|
35
|
+
getLoadedListEntity: (e) => f(g.get(l(e, i)), i),
|
|
36
|
+
getLoadedPickerEntity: (e) => f(g.get(l(e, a)), a),
|
|
37
|
+
getLoadedDetailLayoutEntity: (e) => f(g.get(l(e, r)), r),
|
|
38
|
+
getLoadedDetailPageEntity: (e, t) => f(g.get(l(e, n, t)), n),
|
|
39
|
+
getLoadedToolEntity: (e) => f(g.get(l(e, o)), o),
|
|
37
40
|
loadListEntity: async (t, n) => {
|
|
38
|
-
let r =
|
|
41
|
+
let r = p(m, t);
|
|
39
42
|
if (!s(r)) throw Error(`Backoffice entity ${t} does not expose a list facet.`);
|
|
40
43
|
let a = r.facets.list;
|
|
41
44
|
if (a == null) throw Error(`Backoffice entity ${t} does not expose a list facet.`);
|
|
42
|
-
return
|
|
43
|
-
let n = await a(), o = e(r, n,
|
|
45
|
+
return v(l(t, i), i, n, async () => {
|
|
46
|
+
let n = await a(), o = e(r, n, h);
|
|
44
47
|
if (o.kind !== i) throw Error(`Backoffice entity ${t} did not resolve to a list facet.`);
|
|
45
48
|
return o;
|
|
46
49
|
});
|
|
47
50
|
},
|
|
48
51
|
loadPickerEntity: async (t, n) => {
|
|
49
|
-
let r =
|
|
52
|
+
let r = p(m, t);
|
|
50
53
|
if (!s(r)) throw Error(`Backoffice entity ${t} does not expose a picker facet.`);
|
|
51
54
|
let i = r.facets.picker;
|
|
52
55
|
if (i == null) throw Error(`Backoffice entity ${t} does not expose a picker facet.`);
|
|
53
|
-
return
|
|
54
|
-
let n = await i(), o = e(r, n,
|
|
56
|
+
return v(l(t, a), a, n, async () => {
|
|
57
|
+
let n = await i(), o = e(r, n, h);
|
|
55
58
|
if (o.kind !== a) throw Error(`Backoffice entity ${t} did not resolve to a picker facet.`);
|
|
56
59
|
return o;
|
|
57
60
|
});
|
|
58
61
|
},
|
|
59
62
|
loadDetailLayoutEntity: async (t, n) => {
|
|
60
|
-
let i =
|
|
63
|
+
let i = p(m, t);
|
|
61
64
|
if (!s(i)) throw Error(`Backoffice entity ${t} does not expose a detail-layout facet.`);
|
|
62
|
-
return
|
|
63
|
-
let n = await i.facets.detailLayout(), a = e(i, n,
|
|
65
|
+
return v(l(t, r), r, n, async () => {
|
|
66
|
+
let n = await i.facets.detailLayout(), a = e(i, n, h);
|
|
64
67
|
if (a.kind !== r) throw Error(`Backoffice entity ${t} did not resolve to a detail-layout facet.`);
|
|
65
68
|
return a;
|
|
66
69
|
});
|
|
67
70
|
},
|
|
68
71
|
loadDetailPageEntity: async (t, r, i) => {
|
|
69
|
-
let a =
|
|
72
|
+
let a = p(m, t);
|
|
70
73
|
if (!s(a)) throw Error(`Backoffice entity ${t} does not expose a detail-page facet.`);
|
|
71
|
-
return
|
|
72
|
-
let i = await a.facets.detailPage(r), o = e(a, i,
|
|
74
|
+
return v(l(t, n, r), n, i, async () => {
|
|
75
|
+
let i = await a.facets.detailPage(r), o = e(a, i, h);
|
|
73
76
|
if (o.kind !== n) throw Error(`Backoffice entity ${t} did not resolve to a detail-page facet.`);
|
|
74
77
|
return o;
|
|
75
78
|
});
|
|
76
79
|
},
|
|
77
80
|
loadToolEntity: async (t, n) => {
|
|
78
|
-
let r =
|
|
81
|
+
let r = p(m, t);
|
|
79
82
|
if (!c(r)) throw Error(`Backoffice entity ${t} does not expose a tool facet.`);
|
|
80
|
-
return
|
|
81
|
-
let n = await r.facets.tool(), i = e(r, n,
|
|
83
|
+
return v(l(t, o), o, n, async () => {
|
|
84
|
+
let n = await r.facets.tool(), i = e(r, n, h);
|
|
82
85
|
if (i.kind !== o) throw Error(`Backoffice entity ${t} did not resolve to a tool facet.`);
|
|
83
86
|
return i;
|
|
84
87
|
});
|
|
85
88
|
}
|
|
86
89
|
};
|
|
87
|
-
},
|
|
90
|
+
}, h = {
|
|
88
91
|
buildFacetCacheKey: l,
|
|
89
|
-
resolveManifest:
|
|
92
|
+
resolveManifest: p,
|
|
90
93
|
toError: u
|
|
91
94
|
};
|
|
92
95
|
//#endregion
|
|
93
|
-
export {
|
|
96
|
+
export { h as __test, m as createBackofficeEntityRegistry, m as default };
|
|
94
97
|
|
|
95
98
|
//# sourceMappingURL=entityRegistry.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"entityRegistry.js","names":[],"sources":["../../../src/provider/entityRegistry.ts"],"sourcesContent":["import {\n resolveBackofficeLoadedFacetModule,\n type ResolveBackofficeEntityOptions,\n} from '@plumile/backoffice-core/resolve.js';\nimport type {\n BackofficeEntityFacetModuleCacheEntry,\n BackofficeEntityLoadMode,\n BackofficeEntityManifestMap,\n BackofficeResolvedEntityFacetModule,\n BackofficeListDetailFacetLoaderMap,\n BackofficeToolFacetLoaderMap,\n BackofficeResolvedDetailLayoutFacetModule,\n BackofficeResolvedDetailPageFacetModule,\n BackofficeResolvedListFacetModule,\n BackofficeResolvedPickerFacetModule,\n BackofficeResolvedToolFacetModule,\n} from '@plumile/backoffice-core/types.js';\n\nexport type BackofficeEntityRegistry = {\n getManifest: (entityId: string) => BackofficeEntityManifestMap[string] | null;\n getLoadedListEntity: (\n entityId: string,\n ) => BackofficeResolvedListFacetModule | null;\n getLoadedPickerEntity: (\n entityId: string,\n ) => BackofficeResolvedPickerFacetModule | null;\n getLoadedDetailLayoutEntity: (\n entityId: string,\n ) => BackofficeResolvedDetailLayoutFacetModule | null;\n getLoadedDetailPageEntity: (\n entityId: string,\n pageId: string,\n ) => BackofficeResolvedDetailPageFacetModule | null;\n getLoadedToolEntity: (\n entityId: string,\n ) => BackofficeResolvedToolFacetModule | null;\n loadListEntity: (\n entityId: string,\n options?: { mode?: BackofficeEntityLoadMode },\n ) => Promise<BackofficeResolvedListFacetModule>;\n loadPickerEntity: (\n entityId: string,\n options?: { mode?: BackofficeEntityLoadMode },\n ) => Promise<BackofficeResolvedPickerFacetModule>;\n loadDetailLayoutEntity: (\n entityId: string,\n options?: { mode?: BackofficeEntityLoadMode },\n ) => Promise<BackofficeResolvedDetailLayoutFacetModule>;\n loadDetailPageEntity: (\n entityId: string,\n pageId: string,\n options?: { mode?: BackofficeEntityLoadMode },\n ) => Promise<BackofficeResolvedDetailPageFacetModule>;\n loadToolEntity: (\n entityId: string,\n options?: { mode?: BackofficeEntityLoadMode },\n ) => Promise<BackofficeResolvedToolFacetModule>;\n};\n\nconst DEFAULT_LOAD_MODE: BackofficeEntityLoadMode = 'cache-first';\nconst DETAIL_PAGE_FACET_KIND = 'detail-page';\nconst DETAIL_LAYOUT_FACET_KIND = 'detail-layout';\nconst LIST_FACET_KIND = 'list';\nconst PICKER_FACET_KIND = 'picker';\nconst TOOL_FACET_KIND = 'tool';\n\nconst hasListFacets = (\n manifestItem: BackofficeEntityManifestMap[string],\n): manifestItem is BackofficeEntityManifestMap[string] & {\n facets: BackofficeListDetailFacetLoaderMap;\n} => {\n return manifestItem.kind === 'list-detail';\n};\n\nconst hasToolFacet = (\n manifestItem: BackofficeEntityManifestMap[string],\n): manifestItem is BackofficeEntityManifestMap[string] & {\n facets: BackofficeToolFacetLoaderMap;\n} => {\n return manifestItem.kind === 'tool';\n};\n\nconst buildFacetCacheKey = (\n entityId: string,\n kind: 'list' | 'picker' | 'detail-layout' | 'detail-page' | 'tool',\n pageId?: string,\n): string => {\n if (kind === DETAIL_PAGE_FACET_KIND) {\n return `${entityId}:${kind}:${pageId ?? ''}`;\n }\n return `${entityId}:${kind}`;\n};\n\nconst toError = (error: unknown): Error => {\n if (error instanceof Error) {\n return error;\n }\n return new Error(String(error));\n};\n\nconst getLoadedModule = <TModule>(\n entry: BackofficeEntityFacetModuleCacheEntry | undefined,\n): TModule | null => {\n if (entry?.status !== 'loaded' || entry.module == null) {\n return null;\n }\n return entry.module as TModule;\n};\n\nconst resolveManifest = (\n manifest: BackofficeEntityManifestMap,\n entityId: string,\n): BackofficeEntityManifestMap[string] => {\n const manifestItem = manifest[entityId];\n if (manifestItem == null) {\n throw new Error(`Unknown backoffice entity: ${entityId}`);\n }\n return manifestItem;\n};\n\nexport const createBackofficeEntityRegistry = (\n manifest: BackofficeEntityManifestMap,\n options: ResolveBackofficeEntityOptions,\n): BackofficeEntityRegistry => {\n const cache = new Map<string, BackofficeEntityFacetModuleCacheEntry>();\n\n const getManifest: BackofficeEntityRegistry['getManifest'] = (entityId) => {\n return manifest[entityId] ?? null;\n };\n\n const loadFacet = async <TModule>(\n cacheKey: string,\n loadOptions: { mode?: BackofficeEntityLoadMode } | undefined,\n loader: () => Promise<TModule>,\n ): Promise<TModule> => {\n const resolvedMode = loadOptions?.mode ?? DEFAULT_LOAD_MODE;\n\n if (resolvedMode === 'cache-first') {\n const loadedModule = getLoadedModule<TModule>(cache.get(cacheKey));\n if (loadedModule != null) {\n return loadedModule;\n }\n\n const existing = cache.get(cacheKey);\n if (existing?.status === 'loading' && existing.promise != null) {\n return existing.promise as Promise<TModule>;\n }\n }\n\n const promise = loader()\n .then((module) => {\n cache.set(cacheKey, {\n status: 'loaded',\n module: module as unknown as BackofficeResolvedEntityFacetModule,\n });\n return module;\n })\n .catch((error: unknown) => {\n const resolvedError = toError(error);\n cache.set(cacheKey, {\n status: 'error',\n error: resolvedError,\n });\n throw resolvedError;\n });\n\n cache.set(cacheKey, {\n status: 'loading',\n promise: promise as Promise<BackofficeResolvedEntityFacetModule>,\n });\n\n return promise;\n };\n\n const getLoadedListEntity: BackofficeEntityRegistry['getLoadedListEntity'] = (\n entityId,\n ) => {\n return getLoadedModule(\n cache.get(buildFacetCacheKey(entityId, LIST_FACET_KIND)),\n );\n };\n\n const getLoadedPickerEntity: BackofficeEntityRegistry['getLoadedPickerEntity'] =\n (entityId) => {\n return getLoadedModule(\n cache.get(buildFacetCacheKey(entityId, PICKER_FACET_KIND)),\n );\n };\n\n const getLoadedDetailLayoutEntity: BackofficeEntityRegistry['getLoadedDetailLayoutEntity'] =\n (entityId) => {\n return getLoadedModule(\n cache.get(buildFacetCacheKey(entityId, DETAIL_LAYOUT_FACET_KIND)),\n );\n };\n\n const getLoadedDetailPageEntity: BackofficeEntityRegistry['getLoadedDetailPageEntity'] =\n (entityId, pageId) => {\n return getLoadedModule(\n cache.get(buildFacetCacheKey(entityId, DETAIL_PAGE_FACET_KIND, pageId)),\n );\n };\n\n const getLoadedToolEntity: BackofficeEntityRegistry['getLoadedToolEntity'] = (\n entityId,\n ) => {\n return getLoadedModule(\n cache.get(buildFacetCacheKey(entityId, TOOL_FACET_KIND)),\n );\n };\n\n const loadListEntity: BackofficeEntityRegistry['loadListEntity'] = async (\n entityId,\n loadOptions,\n ) => {\n const manifestItem = resolveManifest(manifest, entityId);\n if (!hasListFacets(manifestItem)) {\n throw new Error(\n `Backoffice entity ${entityId} does not expose a list facet.`,\n );\n }\n const facetLoader = manifestItem.facets.list;\n if (facetLoader == null) {\n throw new Error(\n `Backoffice entity ${entityId} does not expose a list facet.`,\n );\n }\n return loadFacet(\n buildFacetCacheKey(entityId, LIST_FACET_KIND),\n loadOptions,\n async () => {\n const loaded = await facetLoader();\n const resolved = resolveBackofficeLoadedFacetModule(\n manifestItem,\n loaded,\n options,\n );\n if (resolved.kind !== LIST_FACET_KIND) {\n throw new Error(\n `Backoffice entity ${entityId} did not resolve to a list facet.`,\n );\n }\n return resolved;\n },\n );\n };\n\n const loadPickerEntity: BackofficeEntityRegistry['loadPickerEntity'] = async (\n entityId,\n loadOptions,\n ) => {\n const manifestItem = resolveManifest(manifest, entityId);\n if (!hasListFacets(manifestItem)) {\n throw new Error(\n `Backoffice entity ${entityId} does not expose a picker facet.`,\n );\n }\n const facetLoader = manifestItem.facets.picker;\n if (facetLoader == null) {\n throw new Error(\n `Backoffice entity ${entityId} does not expose a picker facet.`,\n );\n }\n return loadFacet(\n buildFacetCacheKey(entityId, PICKER_FACET_KIND),\n loadOptions,\n async () => {\n const loaded = await facetLoader();\n const resolved = resolveBackofficeLoadedFacetModule(\n manifestItem,\n loaded,\n options,\n );\n if (resolved.kind !== PICKER_FACET_KIND) {\n throw new Error(\n `Backoffice entity ${entityId} did not resolve to a picker facet.`,\n );\n }\n return resolved;\n },\n );\n };\n\n const loadDetailLayoutEntity: BackofficeEntityRegistry['loadDetailLayoutEntity'] =\n async (entityId, loadOptions) => {\n const manifestItem = resolveManifest(manifest, entityId);\n if (!hasListFacets(manifestItem)) {\n throw new Error(\n `Backoffice entity ${entityId} does not expose a detail-layout facet.`,\n );\n }\n return loadFacet(\n buildFacetCacheKey(entityId, DETAIL_LAYOUT_FACET_KIND),\n loadOptions,\n async () => {\n const loaded = await manifestItem.facets.detailLayout();\n const resolved = resolveBackofficeLoadedFacetModule(\n manifestItem,\n loaded,\n options,\n );\n if (resolved.kind !== DETAIL_LAYOUT_FACET_KIND) {\n throw new Error(\n `Backoffice entity ${entityId} did not resolve to a detail-layout facet.`,\n );\n }\n return resolved;\n },\n );\n };\n\n const loadDetailPageEntity: BackofficeEntityRegistry['loadDetailPageEntity'] =\n async (entityId, pageId, loadOptions) => {\n const manifestItem = resolveManifest(manifest, entityId);\n if (!hasListFacets(manifestItem)) {\n throw new Error(\n `Backoffice entity ${entityId} does not expose a detail-page facet.`,\n );\n }\n return loadFacet(\n buildFacetCacheKey(entityId, DETAIL_PAGE_FACET_KIND, pageId),\n loadOptions,\n async () => {\n const loaded = await manifestItem.facets.detailPage(pageId);\n const resolved = resolveBackofficeLoadedFacetModule(\n manifestItem,\n loaded,\n options,\n );\n if (resolved.kind !== DETAIL_PAGE_FACET_KIND) {\n throw new Error(\n `Backoffice entity ${entityId} did not resolve to a detail-page facet.`,\n );\n }\n return resolved;\n },\n );\n };\n\n const loadToolEntity: BackofficeEntityRegistry['loadToolEntity'] = async (\n entityId,\n loadOptions,\n ) => {\n const manifestItem = resolveManifest(manifest, entityId);\n if (!hasToolFacet(manifestItem)) {\n throw new Error(\n `Backoffice entity ${entityId} does not expose a tool facet.`,\n );\n }\n return loadFacet(\n buildFacetCacheKey(entityId, TOOL_FACET_KIND),\n loadOptions,\n async () => {\n const loaded = await manifestItem.facets.tool();\n const resolved = resolveBackofficeLoadedFacetModule(\n manifestItem,\n loaded,\n options,\n );\n if (resolved.kind !== TOOL_FACET_KIND) {\n throw new Error(\n `Backoffice entity ${entityId} did not resolve to a tool facet.`,\n );\n }\n return resolved;\n },\n );\n };\n\n return {\n getManifest,\n getLoadedListEntity,\n getLoadedPickerEntity,\n getLoadedDetailLayoutEntity,\n getLoadedDetailPageEntity,\n getLoadedToolEntity,\n loadListEntity,\n loadPickerEntity,\n loadDetailLayoutEntity,\n loadDetailPageEntity,\n loadToolEntity,\n };\n};\n\nexport const __test = {\n buildFacetCacheKey,\n resolveManifest,\n toError,\n};\n\nexport default createBackofficeEntityRegistry;\n"],"mappings":";;AA2DA,IAAM,IAA8C,eAC9C,IAAyB,eACzB,IAA2B,iBAC3B,IAAkB,QAClB,IAAoB,UACpB,IAAkB,QAElB,KACJ,MAIO,EAAa,SAAS,eAGzB,KACJ,MAIO,EAAa,SAAS,QAGzB,KACJ,GACA,GACA,MAEI,MAAS,IACJ,GAAG,EAAS,GAAG,EAAK,GAAG,KAAU,OAEnC,GAAG,EAAS,GAAG,KAGlB,KAAW,MACX,aAAiB,QACZ,IAEE,MAAM,OAAO,CAAK,CAAC,GAG1B,KACJ,MAEI,GAAO,WAAW,YAAY,EAAM,UAAU,OACzC,OAEF,EAAM,QAGT,KACJ,GACA,MACwC;CACxC,IAAM,IAAe,EAAS;CAC9B,IAAI,KAAgB,MAClB,MAAU,MAAM,8BAA8B,GAAU;CAE1D,OAAO;AACT,GAEa,KACX,GACA,MAC6B;CAC7B,IAAM,oBAAQ,IAAI,IAAmD,GAE/D,KAAwD,MACrD,EAAS,MAAa,MAGzB,IAAY,OAChB,GACA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CAChC;IAEF,OAAO;GACT,CACF;EACF;EA2CA,uBAxCA,GACA,MACG;GACH,IAAM,IAAe,EAAgB,GAAU,CAAQ;GACvD,IAAI,CAAC,EAAa,CAAY,GAC5B,MAAU,MACR,qBAAqB,EAAS,+BAChC;GAEF,OAAO,EACL,EAAmB,GAAU,CAAe,GAC5C,GACA,YAAY;IACV,IAAM,IAAS,MAAM,EAAa,OAAO,KAAK,GACxC,IAAW,EACf,GACA,GACA,CACF;IACA,IAAI,EAAS,SAAS,GACpB,MAAU,MACR,qBAAqB,EAAS,kCAChC;IAEF,OAAO;GACT,CACF;EACF;CAcA;AACF,GAEa,IAAS;CACpB;CACA;CACA;AACF"}
|
|
1
|
+
{"version":3,"file":"entityRegistry.js","names":[],"sources":["../../../src/provider/entityRegistry.ts"],"sourcesContent":["import {\n resolveBackofficeLoadedFacetModule,\n type ResolveBackofficeEntityOptions,\n} from '@plumile/backoffice-core/resolve.js';\nimport type {\n BackofficeEntityFacetModuleCacheEntry,\n BackofficeEntityLoadMode,\n BackofficeEntityManifestMap,\n BackofficeResolvedEntityFacetModule,\n BackofficeListDetailFacetLoaderMap,\n BackofficeToolFacetLoaderMap,\n BackofficeResolvedDetailLayoutFacetModule,\n BackofficeResolvedDetailPageFacetModule,\n BackofficeResolvedListFacetModule,\n BackofficeResolvedPickerFacetModule,\n BackofficeResolvedToolFacetModule,\n} from '@plumile/backoffice-core/types.js';\n\nexport type BackofficeEntityRegistry = {\n getManifest: (entityId: string) => BackofficeEntityManifestMap[string] | null;\n getLoadedListEntity: (\n entityId: string,\n ) => BackofficeResolvedListFacetModule | null;\n getLoadedPickerEntity: (\n entityId: string,\n ) => BackofficeResolvedPickerFacetModule | null;\n getLoadedDetailLayoutEntity: (\n entityId: string,\n ) => BackofficeResolvedDetailLayoutFacetModule | null;\n getLoadedDetailPageEntity: (\n entityId: string,\n pageId: string,\n ) => BackofficeResolvedDetailPageFacetModule | null;\n getLoadedToolEntity: (\n entityId: string,\n ) => BackofficeResolvedToolFacetModule | null;\n loadListEntity: (\n entityId: string,\n options?: { mode?: BackofficeEntityLoadMode },\n ) => Promise<BackofficeResolvedListFacetModule>;\n loadPickerEntity: (\n entityId: string,\n options?: { mode?: BackofficeEntityLoadMode },\n ) => Promise<BackofficeResolvedPickerFacetModule>;\n loadDetailLayoutEntity: (\n entityId: string,\n options?: { mode?: BackofficeEntityLoadMode },\n ) => Promise<BackofficeResolvedDetailLayoutFacetModule>;\n loadDetailPageEntity: (\n entityId: string,\n pageId: string,\n options?: { mode?: BackofficeEntityLoadMode },\n ) => Promise<BackofficeResolvedDetailPageFacetModule>;\n loadToolEntity: (\n entityId: string,\n options?: { mode?: BackofficeEntityLoadMode },\n ) => Promise<BackofficeResolvedToolFacetModule>;\n};\n\nconst DEFAULT_LOAD_MODE: BackofficeEntityLoadMode = 'cache-first';\nconst DETAIL_PAGE_FACET_KIND = 'detail-page';\nconst DETAIL_LAYOUT_FACET_KIND = 'detail-layout';\nconst LIST_FACET_KIND = 'list';\nconst PICKER_FACET_KIND = 'picker';\nconst TOOL_FACET_KIND = 'tool';\n\nconst hasListFacets = (\n manifestItem: BackofficeEntityManifestMap[string],\n): manifestItem is BackofficeEntityManifestMap[string] & {\n facets: BackofficeListDetailFacetLoaderMap;\n} => {\n return manifestItem.kind === 'list-detail';\n};\n\nconst hasToolFacet = (\n manifestItem: BackofficeEntityManifestMap[string],\n): manifestItem is BackofficeEntityManifestMap[string] & {\n facets: BackofficeToolFacetLoaderMap;\n} => {\n return manifestItem.kind === 'tool';\n};\n\nconst buildFacetCacheKey = (\n entityId: string,\n kind: 'list' | 'picker' | 'detail-layout' | 'detail-page' | 'tool',\n pageId?: string,\n): string => {\n if (kind === DETAIL_PAGE_FACET_KIND) {\n return `${entityId}:${kind}:${pageId ?? ''}`;\n }\n return `${entityId}:${kind}`;\n};\n\nconst toError = (error: unknown): Error => {\n if (error instanceof Error) {\n return error;\n }\n return new Error(String(error));\n};\n\ntype BackofficeResolvedFacetKind = BackofficeResolvedEntityFacetModule['kind'];\ntype BackofficeResolvedFacetModule<Kind extends BackofficeResolvedFacetKind> =\n Extract<BackofficeResolvedEntityFacetModule, { kind: Kind }>;\n\nconst isResolvedFacetKind = <Kind extends BackofficeResolvedFacetKind>(\n module: BackofficeResolvedEntityFacetModule,\n kind: Kind,\n): module is BackofficeResolvedFacetModule<Kind> => {\n return module.kind === kind;\n};\n\nconst getLoadedModule = <Kind extends BackofficeResolvedFacetKind>(\n entry: BackofficeEntityFacetModuleCacheEntry | undefined,\n kind: Kind,\n): BackofficeResolvedFacetModule<Kind> | null => {\n if (entry?.status !== 'loaded' || entry.module == null) {\n return null;\n }\n if (isResolvedFacetKind(entry.module, kind)) {\n return entry.module;\n }\n return null;\n};\n\nconst resolveManifest = (\n manifest: BackofficeEntityManifestMap,\n entityId: string,\n): BackofficeEntityManifestMap[string] => {\n const manifestItem = manifest[entityId];\n if (manifestItem == null) {\n throw new Error(`Unknown backoffice entity: ${entityId}`);\n }\n return manifestItem;\n};\n\nexport const createBackofficeEntityRegistry = (\n manifest: BackofficeEntityManifestMap,\n options: ResolveBackofficeEntityOptions,\n): BackofficeEntityRegistry => {\n const cache = new Map<string, BackofficeEntityFacetModuleCacheEntry>();\n\n const getManifest: BackofficeEntityRegistry['getManifest'] = (entityId) => {\n return manifest[entityId] ?? null;\n };\n\n const loadFacet = async <Kind extends BackofficeResolvedFacetKind>(\n cacheKey: string,\n kind: Kind,\n loadOptions: { mode?: BackofficeEntityLoadMode } | undefined,\n loader: () => Promise<BackofficeResolvedFacetModule<Kind>>,\n ): Promise<BackofficeResolvedFacetModule<Kind>> => {\n const resolvedMode = loadOptions?.mode ?? DEFAULT_LOAD_MODE;\n\n if (resolvedMode === 'cache-first') {\n const loadedModule = getLoadedModule(cache.get(cacheKey), kind);\n if (loadedModule != null) {\n return loadedModule;\n }\n\n const existing = cache.get(cacheKey);\n if (existing?.status === 'loading' && existing.promise != null) {\n return existing.promise.then((module) => {\n if (!isResolvedFacetKind(module, kind)) {\n throw new Error(`Cached backoffice facet kind mismatch: ${kind}`);\n }\n return module;\n });\n }\n }\n\n const promise = loader()\n .then((module) => {\n cache.set(cacheKey, {\n status: 'loaded',\n module,\n });\n return module;\n })\n .catch((error: unknown) => {\n const resolvedError = toError(error);\n cache.set(cacheKey, {\n status: 'error',\n error: resolvedError,\n });\n throw resolvedError;\n });\n\n cache.set(cacheKey, {\n status: 'loading',\n promise,\n });\n\n return promise;\n };\n\n const getLoadedListEntity: BackofficeEntityRegistry['getLoadedListEntity'] = (\n entityId,\n ) => {\n return getLoadedModule(\n cache.get(buildFacetCacheKey(entityId, LIST_FACET_KIND)),\n LIST_FACET_KIND,\n );\n };\n\n const getLoadedPickerEntity: BackofficeEntityRegistry['getLoadedPickerEntity'] =\n (entityId) => {\n return getLoadedModule(\n cache.get(buildFacetCacheKey(entityId, PICKER_FACET_KIND)),\n PICKER_FACET_KIND,\n );\n };\n\n const getLoadedDetailLayoutEntity: BackofficeEntityRegistry['getLoadedDetailLayoutEntity'] =\n (entityId) => {\n return getLoadedModule(\n cache.get(buildFacetCacheKey(entityId, DETAIL_LAYOUT_FACET_KIND)),\n DETAIL_LAYOUT_FACET_KIND,\n );\n };\n\n const getLoadedDetailPageEntity: BackofficeEntityRegistry['getLoadedDetailPageEntity'] =\n (entityId, pageId) => {\n return getLoadedModule(\n cache.get(buildFacetCacheKey(entityId, DETAIL_PAGE_FACET_KIND, pageId)),\n DETAIL_PAGE_FACET_KIND,\n );\n };\n\n const getLoadedToolEntity: BackofficeEntityRegistry['getLoadedToolEntity'] = (\n entityId,\n ) => {\n return getLoadedModule(\n cache.get(buildFacetCacheKey(entityId, TOOL_FACET_KIND)),\n TOOL_FACET_KIND,\n );\n };\n\n const loadListEntity: BackofficeEntityRegistry['loadListEntity'] = async (\n entityId,\n loadOptions,\n ) => {\n const manifestItem = resolveManifest(manifest, entityId);\n if (!hasListFacets(manifestItem)) {\n throw new Error(\n `Backoffice entity ${entityId} does not expose a list facet.`,\n );\n }\n const facetLoader = manifestItem.facets.list;\n if (facetLoader == null) {\n throw new Error(\n `Backoffice entity ${entityId} does not expose a list facet.`,\n );\n }\n return loadFacet(\n buildFacetCacheKey(entityId, LIST_FACET_KIND),\n LIST_FACET_KIND,\n loadOptions,\n async () => {\n const loaded = await facetLoader();\n const resolved = resolveBackofficeLoadedFacetModule(\n manifestItem,\n loaded,\n options,\n );\n if (resolved.kind !== LIST_FACET_KIND) {\n throw new Error(\n `Backoffice entity ${entityId} did not resolve to a list facet.`,\n );\n }\n return resolved;\n },\n );\n };\n\n const loadPickerEntity: BackofficeEntityRegistry['loadPickerEntity'] = async (\n entityId,\n loadOptions,\n ) => {\n const manifestItem = resolveManifest(manifest, entityId);\n if (!hasListFacets(manifestItem)) {\n throw new Error(\n `Backoffice entity ${entityId} does not expose a picker facet.`,\n );\n }\n const facetLoader = manifestItem.facets.picker;\n if (facetLoader == null) {\n throw new Error(\n `Backoffice entity ${entityId} does not expose a picker facet.`,\n );\n }\n return loadFacet(\n buildFacetCacheKey(entityId, PICKER_FACET_KIND),\n PICKER_FACET_KIND,\n loadOptions,\n async () => {\n const loaded = await facetLoader();\n const resolved = resolveBackofficeLoadedFacetModule(\n manifestItem,\n loaded,\n options,\n );\n if (resolved.kind !== PICKER_FACET_KIND) {\n throw new Error(\n `Backoffice entity ${entityId} did not resolve to a picker facet.`,\n );\n }\n return resolved;\n },\n );\n };\n\n const loadDetailLayoutEntity: BackofficeEntityRegistry['loadDetailLayoutEntity'] =\n async (entityId, loadOptions) => {\n const manifestItem = resolveManifest(manifest, entityId);\n if (!hasListFacets(manifestItem)) {\n throw new Error(\n `Backoffice entity ${entityId} does not expose a detail-layout facet.`,\n );\n }\n return loadFacet(\n buildFacetCacheKey(entityId, DETAIL_LAYOUT_FACET_KIND),\n DETAIL_LAYOUT_FACET_KIND,\n loadOptions,\n async () => {\n const loaded = await manifestItem.facets.detailLayout();\n const resolved = resolveBackofficeLoadedFacetModule(\n manifestItem,\n loaded,\n options,\n );\n if (resolved.kind !== DETAIL_LAYOUT_FACET_KIND) {\n throw new Error(\n `Backoffice entity ${entityId} did not resolve to a detail-layout facet.`,\n );\n }\n return resolved;\n },\n );\n };\n\n const loadDetailPageEntity: BackofficeEntityRegistry['loadDetailPageEntity'] =\n async (entityId, pageId, loadOptions) => {\n const manifestItem = resolveManifest(manifest, entityId);\n if (!hasListFacets(manifestItem)) {\n throw new Error(\n `Backoffice entity ${entityId} does not expose a detail-page facet.`,\n );\n }\n return loadFacet(\n buildFacetCacheKey(entityId, DETAIL_PAGE_FACET_KIND, pageId),\n DETAIL_PAGE_FACET_KIND,\n loadOptions,\n async () => {\n const loaded = await manifestItem.facets.detailPage(pageId);\n const resolved = resolveBackofficeLoadedFacetModule(\n manifestItem,\n loaded,\n options,\n );\n if (resolved.kind !== DETAIL_PAGE_FACET_KIND) {\n throw new Error(\n `Backoffice entity ${entityId} did not resolve to a detail-page facet.`,\n );\n }\n return resolved;\n },\n );\n };\n\n const loadToolEntity: BackofficeEntityRegistry['loadToolEntity'] = async (\n entityId,\n loadOptions,\n ) => {\n const manifestItem = resolveManifest(manifest, entityId);\n if (!hasToolFacet(manifestItem)) {\n throw new Error(\n `Backoffice entity ${entityId} does not expose a tool facet.`,\n );\n }\n return loadFacet(\n buildFacetCacheKey(entityId, TOOL_FACET_KIND),\n TOOL_FACET_KIND,\n loadOptions,\n async () => {\n const loaded = await manifestItem.facets.tool();\n const resolved = resolveBackofficeLoadedFacetModule(\n manifestItem,\n loaded,\n options,\n );\n if (resolved.kind !== TOOL_FACET_KIND) {\n throw new Error(\n `Backoffice entity ${entityId} did not resolve to a tool facet.`,\n );\n }\n return resolved;\n },\n );\n };\n\n return {\n getManifest,\n getLoadedListEntity,\n getLoadedPickerEntity,\n getLoadedDetailLayoutEntity,\n getLoadedDetailPageEntity,\n getLoadedToolEntity,\n loadListEntity,\n loadPickerEntity,\n loadDetailLayoutEntity,\n loadDetailPageEntity,\n loadToolEntity,\n };\n};\n\nexport const __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IACA,IAAI,EAAS,SAAS,GACpB,MAAU,MACR,qBAAqB,EAAS,kCAChC;IAEF,OAAO;GACT,CACF;EACF;CAcA;AACF,GAEa,IAAS;CACpB;CACA;CACA;AACF"}
|
|
@@ -2,14 +2,14 @@ import { getBackofficeLoginPath as e, isBackofficeAuthPath as t } from "../route
|
|
|
2
2
|
import { useEffect as n, useState as r, useSyncExternalStore as i } from "react";
|
|
3
3
|
import { addAuthRefreshStateListener as a, getAuthRefreshState as o, getShortAccessToken as s } from "@plumile/auth/shortAccessToken.js";
|
|
4
4
|
//#region src/provider/useBackofficeAuthRouteGate.ts
|
|
5
|
-
var c = (e) => a(e), l = () => o(), u = () => typeof window > "u" ? "/" : window.location.pathname, d = (a) => {
|
|
6
|
-
let o = i(c, l, l), [
|
|
5
|
+
var c = (e) => a(e), l = () => o(), u = () => typeof window > "u" ? "/" : window.location.pathname, d = (e) => e.status === "authenticated" ? !0 : e.status === "refreshing" || e.status === "temporarily_unavailable" ? e.previousExpiresAtMs != null : !1, f = (a) => {
|
|
6
|
+
let o = i(c, l, l), [f, p] = r(u), m = t(a, f);
|
|
7
7
|
return n(() => {
|
|
8
|
-
if (
|
|
8
|
+
if (m || o.status === "authenticated") return;
|
|
9
9
|
if (o.status === "session_expired") {
|
|
10
10
|
if (typeof window < "u") {
|
|
11
11
|
let t = e(a);
|
|
12
|
-
window.history.replaceState(window.history.state, "", t),
|
|
12
|
+
window.history.replaceState(window.history.state, "", t), p(t);
|
|
13
13
|
}
|
|
14
14
|
return;
|
|
15
15
|
}
|
|
@@ -30,10 +30,10 @@ var c = (e) => a(e), l = () => o(), u = () => typeof window > "u" ? "/" : window
|
|
|
30
30
|
}, [
|
|
31
31
|
o,
|
|
32
32
|
a,
|
|
33
|
-
|
|
34
|
-
]),
|
|
33
|
+
m
|
|
34
|
+
]), m || d(o);
|
|
35
35
|
};
|
|
36
36
|
//#endregion
|
|
37
|
-
export {
|
|
37
|
+
export { f as useBackofficeAuthRouteGate };
|
|
38
38
|
|
|
39
39
|
//# sourceMappingURL=useBackofficeAuthRouteGate.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useBackofficeAuthRouteGate.js","names":[],"sources":["../../../src/provider/useBackofficeAuthRouteGate.ts"],"sourcesContent":["import { useEffect, useState, useSyncExternalStore } from 'react';\nimport {\n addAuthRefreshStateListener,\n getAuthRefreshState,\n getShortAccessToken,\n} from '@plumile/auth/shortAccessToken.js';\nimport type { AuthRefreshState } from '@plumile/auth/authRefreshState.js';\n\nimport {\n getBackofficeLoginPath,\n isBackofficeAuthPath,\n} from '../router/backofficeAuthPaths.js';\n\nconst subscribe = (onStoreChange: () => void): (() => void) => {\n return addAuthRefreshStateListener(onStoreChange);\n};\n\nconst getSnapshot = (): AuthRefreshState => {\n return getAuthRefreshState();\n};\n\nconst currentPathname = (): string => {\n if (typeof window === 'undefined') {\n return '/';\n }\n return window.location.pathname;\n};\n\nexport const useBackofficeAuthRouteGate = (basePath: string): boolean => {\n const authState = useSyncExternalStore(subscribe, getSnapshot, getSnapshot);\n const [pathname, setPathname] = useState(currentPathname);\n const isAuthPath = isBackofficeAuthPath(basePath, pathname);\n\n useEffect(() => {\n if (isAuthPath || authState.status === 'authenticated') {\n return undefined;\n }\n\n if (authState.status === 'session_expired') {\n if (typeof window !== 'undefined') {\n const loginPath = getBackofficeLoginPath(basePath);\n window.history.replaceState(window.history.state, '', loginPath);\n setPathname(loginPath);\n }\n return undefined;\n }\n\n if (authState.status === 'refreshing') {\n return undefined;\n }\n\n let cancelled = false;\n let retryTimer: ReturnType<typeof setTimeout> | undefined;\n const authenticate = (): void => {\n getShortAccessToken().catch(() => {\n // The shared auth state carries the typed failure and drives the next render.\n });\n };\n\n if (authState.status === 'temporarily_unavailable') {\n const { retryAtMs } = authState;\n if (retryAtMs == null) {\n return undefined;\n }\n retryTimer = setTimeout(\n () => {\n if (!cancelled) {\n authenticate();\n }\n },\n Math.max(0, retryAtMs - Date.now()),\n );\n } else {\n authenticate();\n }\n\n return () => {\n cancelled = true;\n if (retryTimer != null) {\n clearTimeout(retryTimer);\n }\n };\n }, [authState, basePath, isAuthPath]);\n\n return isAuthPath || authState
|
|
1
|
+
{"version":3,"file":"useBackofficeAuthRouteGate.js","names":[],"sources":["../../../src/provider/useBackofficeAuthRouteGate.ts"],"sourcesContent":["import { useEffect, useState, useSyncExternalStore } from 'react';\nimport {\n addAuthRefreshStateListener,\n getAuthRefreshState,\n getShortAccessToken,\n} from '@plumile/auth/shortAccessToken.js';\nimport type { AuthRefreshState } from '@plumile/auth/authRefreshState.js';\n\nimport {\n getBackofficeLoginPath,\n isBackofficeAuthPath,\n} from '../router/backofficeAuthPaths.js';\n\nconst subscribe = (onStoreChange: () => void): (() => void) => {\n return addAuthRefreshStateListener(onStoreChange);\n};\n\nconst getSnapshot = (): AuthRefreshState => {\n return getAuthRefreshState();\n};\n\nconst currentPathname = (): string => {\n if (typeof window === 'undefined') {\n return '/';\n }\n return window.location.pathname;\n};\n\nconst hasEstablishedSession = (authState: AuthRefreshState): boolean => {\n if (authState.status === 'authenticated') {\n return true;\n }\n\n if (\n authState.status === 'refreshing' ||\n authState.status === 'temporarily_unavailable'\n ) {\n return authState.previousExpiresAtMs != null;\n }\n\n return false;\n};\n\nexport const useBackofficeAuthRouteGate = (basePath: string): boolean => {\n const authState = useSyncExternalStore(subscribe, getSnapshot, getSnapshot);\n const [pathname, setPathname] = useState(currentPathname);\n const isAuthPath = isBackofficeAuthPath(basePath, pathname);\n\n useEffect(() => {\n if (isAuthPath || authState.status === 'authenticated') {\n return undefined;\n }\n\n if (authState.status === 'session_expired') {\n if (typeof window !== 'undefined') {\n const loginPath = getBackofficeLoginPath(basePath);\n window.history.replaceState(window.history.state, '', loginPath);\n setPathname(loginPath);\n }\n return undefined;\n }\n\n if (authState.status === 'refreshing') {\n return undefined;\n }\n\n let cancelled = false;\n let retryTimer: ReturnType<typeof setTimeout> | undefined;\n const authenticate = (): void => {\n getShortAccessToken().catch(() => {\n // The shared auth state carries the typed failure and drives the next render.\n });\n };\n\n if (authState.status === 'temporarily_unavailable') {\n const { retryAtMs } = authState;\n if (retryAtMs == null) {\n return undefined;\n }\n retryTimer = setTimeout(\n () => {\n if (!cancelled) {\n authenticate();\n }\n },\n Math.max(0, retryAtMs - Date.now()),\n );\n } else {\n authenticate();\n }\n\n return () => {\n cancelled = true;\n if (retryTimer != null) {\n clearTimeout(retryTimer);\n }\n };\n }, [authState, basePath, isAuthPath]);\n\n return isAuthPath || hasEstablishedSession(authState);\n};\n"],"mappings":";;;;AAaA,IAAM,KAAa,MACV,EAA4B,CAAa,GAG5C,UACG,EAAoB,GAGvB,UACA,OAAO,SAAW,MACb,MAEF,OAAO,SAAS,UAGnB,KAAyB,MACzB,EAAU,WAAW,kBAChB,KAIP,EAAU,WAAW,gBACrB,EAAU,WAAW,4BAEd,EAAU,uBAAuB,OAGnC,IAGI,KAA8B,MAA8B;CACvE,IAAM,IAAY,EAAqB,GAAW,GAAa,CAAW,GACpE,CAAC,GAAU,KAAe,EAAS,CAAe,GAClD,IAAa,EAAqB,GAAU,CAAQ;CAqD1D,OAnDA,QAAgB;EACd,IAAI,KAAc,EAAU,WAAW,iBACrC;EAGF,IAAI,EAAU,WAAW,mBAAmB;GAC1C,IAAI,OAAO,SAAW,KAAa;IACjC,IAAM,IAAY,EAAuB,CAAQ;IAEjD,AADA,OAAO,QAAQ,aAAa,OAAO,QAAQ,OAAO,IAAI,CAAS,GAC/D,EAAY,CAAS;GACvB;GACA;EACF;EAEA,IAAI,EAAU,WAAW,cACvB;EAGF,IAAI,IAAY,IACZ,GACE,UAA2B;GAC/B,EAAoB,CAAC,CAAC,YAAY,CAElC,CAAC;EACH;EAEA,IAAI,EAAU,WAAW,2BAA2B;GAClD,IAAM,EAAE,iBAAc;GACtB,IAAI,KAAa,MACf;GAEF,IAAa,iBACL;IACJ,AAAK,KACH,EAAa;GAEjB,GACA,KAAK,IAAI,GAAG,IAAY,KAAK,IAAI,CAAC,CACpC;EACF,OACE,EAAa;EAGf,aAAa;GAEX,AADA,IAAY,IACR,KAAc,QAChB,aAAa,CAAU;EAE3B;CACF,GAAG;EAAC;EAAW;EAAU;CAAU,CAAC,GAE7B,KAAc,EAAsB,CAAS;AACtD"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"createInlineReader.js","names":[],"sources":["../../../src/relay/createInlineReader.ts"],"sourcesContent":["import type { GraphQLTaggedNode } from 'relay-runtime';\nimport {
|
|
1
|
+
{"version":3,"file":"createInlineReader.js","names":[],"sources":["../../../src/relay/createInlineReader.ts"],"sourcesContent":["import type { GraphQLTaggedNode } from 'relay-runtime';\nimport {\n readBackofficeInlineData,\n type BackofficeRelayKey,\n type BackofficeRelayKeyData,\n} from './typedRelayHooks.js';\n\ntype ExactDataWitness<Actual, Expected> = [Actual] extends [Expected]\n ? [Expected] extends [Actual]\n ? unknown\n : never\n : never;\n\n// Reserved for non-React helpers that explicitly read `@inline` fragments.\nexport const createInlineDataReader = <\n TKey extends BackofficeRelayKey,\n TData extends BackofficeRelayKeyData<TKey> = BackofficeRelayKeyData<TKey>,\n>(\n fragment: GraphQLTaggedNode &\n ExactDataWitness<BackofficeRelayKeyData<TKey>, TData>,\n): ((ref: TKey) => BackofficeRelayKeyData<TKey>) => {\n return (ref: TKey) => {\n return readBackofficeInlineData(fragment, ref);\n };\n};\n"],"mappings":";;AAcA,IAAa,KAIX,OAGQ,MACC,EAAyB,GAAU,CAAG"}
|
|
@@ -1,7 +1,16 @@
|
|
|
1
1
|
import * as e from "react-relay";
|
|
2
2
|
//#region src/relay/typedRelayHooks.ts
|
|
3
|
-
|
|
3
|
+
function t(t, n) {
|
|
4
|
+
return e.useFragment(t, n);
|
|
5
|
+
}
|
|
6
|
+
function n(t, n) {
|
|
7
|
+
return e.usePaginationFragment(t, n);
|
|
8
|
+
}
|
|
9
|
+
var r = (t, n) => e.useFragment(t, n), i = (t, n) => e.usePaginationFragment(t, n), a = (t, n) => e.usePreloadedQuery(t, n);
|
|
10
|
+
function o(t, n) {
|
|
11
|
+
return e.readInlineData(t, n);
|
|
12
|
+
}
|
|
4
13
|
//#endregion
|
|
5
|
-
export {
|
|
14
|
+
export { o as readBackofficeInlineData, t as useBackofficeFragment, n as useBackofficePaginationFragment, a as useBackofficePreloadedQuery, r as useBackofficeRuntimeFragment, i as useBackofficeRuntimePaginationFragment };
|
|
6
15
|
|
|
7
16
|
//# sourceMappingURL=typedRelayHooks.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"typedRelayHooks.js","names":[],"sources":["../../../src/relay/typedRelayHooks.ts"],"sourcesContent":["import * as ReactRelay from 'react-relay';\nimport type { GraphQLTaggedNode, OperationType } from 'relay-runtime';\n\nexport type BackofficeFragmentInput = GraphQLTaggedNode;\n\nexport
|
|
1
|
+
{"version":3,"file":"typedRelayHooks.js","names":[],"sources":["../../../src/relay/typedRelayHooks.ts"],"sourcesContent":["import * as ReactRelay from 'react-relay';\nimport type { GraphQLTaggedNode, OperationType } from 'relay-runtime';\n\nexport type BackofficeRelayKey<TData = unknown> = Readonly<{\n ' $data'?: TData;\n ' $fragmentSpreads': unknown;\n}>;\n\nexport type BackofficeRelayKeyData<TKey extends BackofficeRelayKey> =\n Required<TKey>[' $data'];\n\nexport type BackofficeFragmentInput = GraphQLTaggedNode;\n\nexport function useBackofficeFragment<TKey extends BackofficeRelayKey>(\n fragment: BackofficeFragmentInput,\n ref: TKey,\n): BackofficeRelayKeyData<TKey>;\nexport function useBackofficeFragment<TKey extends BackofficeRelayKey>(\n fragment: BackofficeFragmentInput,\n ref: TKey | null | undefined,\n): BackofficeRelayKeyData<TKey> | null | undefined;\nexport function useBackofficeFragment<TKey extends BackofficeRelayKey>(\n fragment: BackofficeFragmentInput,\n ref: TKey | null | undefined,\n): BackofficeRelayKeyData<TKey> | null | undefined {\n return ReactRelay.useFragment(fragment, ref);\n}\n\nexport function useBackofficePaginationFragment<\n TQuery extends OperationType,\n TKey extends BackofficeRelayKey,\n>(fragment: BackofficeFragmentInput, ref: TKey) {\n return ReactRelay.usePaginationFragment<TQuery, TKey>(fragment, ref);\n}\n\n/**\n * Dynamic backoffice manifests erase the generated Relay key while crossing the\n * package boundary. Keep that unavoidable conversion in this adapter instead\n * of letting every renderer choose its own result type.\n */\nexport const useBackofficeRuntimeFragment = (\n fragment: BackofficeFragmentInput,\n ref: unknown,\n): unknown => {\n return ReactRelay.useFragment(fragment, ref as BackofficeRelayKey);\n};\n\nexport const useBackofficeRuntimePaginationFragment = <\n TQuery extends OperationType,\n>(\n fragment: BackofficeFragmentInput,\n ref: unknown,\n) => {\n return ReactRelay.usePaginationFragment<TQuery, BackofficeRelayKey>(\n fragment,\n ref as BackofficeRelayKey,\n );\n};\n\nexport const useBackofficePreloadedQuery = <TQuery extends OperationType>(\n query: GraphQLTaggedNode,\n preloadedQuery: Parameters<typeof ReactRelay.usePreloadedQuery<TQuery>>[1],\n): TQuery['response'] => {\n return ReactRelay.usePreloadedQuery<TQuery>(query, preloadedQuery);\n};\n\nexport function readBackofficeInlineData<TKey extends BackofficeRelayKey>(\n fragment: GraphQLTaggedNode,\n ref: TKey,\n): BackofficeRelayKeyData<TKey>;\nexport function readBackofficeInlineData<TKey extends BackofficeRelayKey>(\n fragment: GraphQLTaggedNode,\n ref: TKey | null | undefined,\n): BackofficeRelayKeyData<TKey> | null | undefined;\nexport function readBackofficeInlineData<TKey extends BackofficeRelayKey>(\n fragment: GraphQLTaggedNode,\n ref: TKey | null | undefined,\n): BackofficeRelayKeyData<TKey> | null | undefined {\n return ReactRelay.readInlineData(fragment, ref);\n}\n"],"mappings":";;AAqBA,SAAgB,EACd,GACA,GACiD;CACjD,OAAO,EAAW,YAAY,GAAU,CAAG;AAC7C;AAEA,SAAgB,EAGd,GAAmC,GAAW;CAC9C,OAAO,EAAW,sBAAoC,GAAU,CAAG;AACrE;AAOA,IAAa,KACX,GACA,MAEO,EAAW,YAAY,GAAU,CAAyB,GAGtD,KAGX,GACA,MAEO,EAAW,sBAChB,GACA,CACF,GAGW,KACX,GACA,MAEO,EAAW,kBAA0B,GAAO,CAAc;AAWnE,SAAgB,EACd,GACA,GACiD;CACjD,OAAO,EAAW,eAAe,GAAU,CAAG;AAChD"}
|
|
@@ -56,11 +56,11 @@ var { loadQuery: f, usePreloadedQuery: p } = c, m = u("WrapperPage", async () =>
|
|
|
56
56
|
return e.detailPages?.find((e) => I(e.pathSegment) === n) ?? null;
|
|
57
57
|
}, B = (e, t) => z(e, t)?.id ?? t, V = d;
|
|
58
58
|
function H(a) {
|
|
59
|
-
let { basePath: o, entityManifest: c, entityRegistry: l, sidebar: u, auth: d, dashboard: p } = a,
|
|
60
|
-
|
|
59
|
+
let { basePath: o, entityManifest: c, entityRegistry: l, sidebar: u, auth: d, dashboard: p } = a, m = r(a.dashboards), N = M(o), I = P(N, "login"), z = P(N, "login/reset"), H = P(N, "login/reset/complete"), U = P(N, "verify-email"), oe = P(N, "accept-invitation"), se = F(N, "login"), W = t(c, u), ce = n(W, u), le = e(W, u), G = /* @__PURE__ */ new Map();
|
|
60
|
+
le.forEach((e, t) => {
|
|
61
61
|
G.set(t, e.groupId);
|
|
62
62
|
});
|
|
63
|
-
let K = /* @__PURE__ */ new WeakMap(), q = /* @__PURE__ */ new WeakMap(), J = u?.permissionsQuery,
|
|
63
|
+
let K = /* @__PURE__ */ new WeakMap(), q = /* @__PURE__ */ new WeakMap(), J = u?.permissionsQuery, ue = async ({ context: e }) => {
|
|
64
64
|
let t = await d.session.load();
|
|
65
65
|
return {
|
|
66
66
|
permissionsQuery: J == null ? null : f(e.relayEnvironment, J, {}),
|
|
@@ -72,7 +72,7 @@ function H(a) {
|
|
|
72
72
|
}, X = () => p == null ? null : { dashboardId: "dashboard" }, Z = ({ prepared: e, Component: t }) => t == null ? null : /* @__PURE__ */ s(t, { prepared: e }), Q = ({ children: e, prepared: t, Component: n }) => n == null ? null : /* @__PURE__ */ s(n, {
|
|
73
73
|
prepared: t,
|
|
74
74
|
children: e
|
|
75
|
-
}),
|
|
75
|
+
}), de = V({
|
|
76
76
|
path: "",
|
|
77
77
|
resourcePage: T,
|
|
78
78
|
prepare: X,
|
|
@@ -83,7 +83,7 @@ function H(a) {
|
|
|
83
83
|
prepare: Y,
|
|
84
84
|
render: Z
|
|
85
85
|
})]
|
|
86
|
-
}),
|
|
86
|
+
}), fe = V({
|
|
87
87
|
path: "dashboard",
|
|
88
88
|
resourcePage: T,
|
|
89
89
|
prepare: X,
|
|
@@ -94,7 +94,7 @@ function H(a) {
|
|
|
94
94
|
prepare: Y,
|
|
95
95
|
render: Z
|
|
96
96
|
})]
|
|
97
|
-
}),
|
|
97
|
+
}), pe = m.map((e) => {
|
|
98
98
|
let t = V({
|
|
99
99
|
path: "",
|
|
100
100
|
resourcePage: w,
|
|
@@ -118,9 +118,9 @@ function H(a) {
|
|
|
118
118
|
render: Q,
|
|
119
119
|
children: [t]
|
|
120
120
|
});
|
|
121
|
-
}),
|
|
121
|
+
}), me = Object.values(c).filter((e) => e.kind === "list-detail"), he = ce.map((e) => {
|
|
122
122
|
let t = V({
|
|
123
|
-
path: L(e.hub.href,
|
|
123
|
+
path: L(e.hub.href, N),
|
|
124
124
|
resourcePage: D,
|
|
125
125
|
prepare: () => ({
|
|
126
126
|
hubId: e.hub.id,
|
|
@@ -129,8 +129,8 @@ function H(a) {
|
|
|
129
129
|
render: ({ prepared: e, Component: t }) => t == null ? null : /* @__PURE__ */ s(t, { prepared: e })
|
|
130
130
|
});
|
|
131
131
|
return e.groupId != null && q.set(t, e.groupId), t;
|
|
132
|
-
}),
|
|
133
|
-
let t = e.routes.list, n = L(t,
|
|
132
|
+
}), ge = me.map((e) => {
|
|
133
|
+
let t = e.routes.list, n = L(t, N), r = [], a = ({ match: t }) => {
|
|
134
134
|
let n = String(t?.params.id ?? ""), r = typeof t?.params.pagePath == "string" ? t.params.pagePath : null, a = r == null ? e.defaultDetailPageId : B(e, r);
|
|
135
135
|
return /* @__PURE__ */ s(i, {
|
|
136
136
|
entityManifest: e,
|
|
@@ -292,7 +292,6 @@ function H(a) {
|
|
|
292
292
|
children: [
|
|
293
293
|
V({
|
|
294
294
|
path: "",
|
|
295
|
-
resourcePage: m,
|
|
296
295
|
prepare: ({ variables: t }) => {
|
|
297
296
|
let n = String(t.id ?? "").trim();
|
|
298
297
|
return { redirectTo: n === "" ? null : e.routes.detailPage(n, e.defaultDetailPageId) };
|
|
@@ -385,11 +384,10 @@ function H(a) {
|
|
|
385
384
|
return K.set(d, e.id), r.push(d), V({
|
|
386
385
|
path: n,
|
|
387
386
|
children: r,
|
|
388
|
-
resourcePage: m,
|
|
389
387
|
suspenseBoundary: "segment"
|
|
390
388
|
});
|
|
391
|
-
}),
|
|
392
|
-
let t = L(e.routes.list,
|
|
389
|
+
}), _e = Object.values(c).filter((e) => e.kind === "tool").map((e) => {
|
|
390
|
+
let t = L(e.routes.list, N), n = V({
|
|
393
391
|
path: "",
|
|
394
392
|
resourcePage: a.toolsOperationPage ?? null,
|
|
395
393
|
prepare: async () => {
|
|
@@ -430,12 +428,12 @@ function H(a) {
|
|
|
430
428
|
children: [n]
|
|
431
429
|
});
|
|
432
430
|
return K.set(r, e.id), r;
|
|
433
|
-
}),
|
|
434
|
-
path:
|
|
431
|
+
}), ve = V({
|
|
432
|
+
path: N,
|
|
435
433
|
resourcePage: h,
|
|
436
434
|
prepareSearchBehavior: "path",
|
|
437
435
|
suspenseBoundary: "segment",
|
|
438
|
-
prepare:
|
|
436
|
+
prepare: ue,
|
|
439
437
|
render: ({ children: e, prepared: t, route: n, Component: r }) => {
|
|
440
438
|
if (r == null) return null;
|
|
441
439
|
let i = t, a = R(n, K), o = a == null ? R(n, q) : G.get(a) ?? null, c = r, l = d.session.get()?.authStatusQuery ?? null;
|
|
@@ -446,7 +444,7 @@ function H(a) {
|
|
|
446
444
|
activeGroupId: o,
|
|
447
445
|
authStatusQuery: l,
|
|
448
446
|
authStatusPrepared: i.authStatusQuery,
|
|
449
|
-
loginRedirectPath:
|
|
447
|
+
loginRedirectPath: se,
|
|
450
448
|
children: e
|
|
451
449
|
}) : /* @__PURE__ */ s(ae, {
|
|
452
450
|
Component: c,
|
|
@@ -457,16 +455,16 @@ function H(a) {
|
|
|
457
455
|
});
|
|
458
456
|
},
|
|
459
457
|
children: [
|
|
460
|
-
|
|
458
|
+
de,
|
|
459
|
+
...he,
|
|
461
460
|
...ge,
|
|
462
461
|
..._e,
|
|
463
|
-
...
|
|
464
|
-
|
|
465
|
-
pe
|
|
462
|
+
...pe,
|
|
463
|
+
fe
|
|
466
464
|
]
|
|
467
465
|
}), $ = [
|
|
468
466
|
V({
|
|
469
|
-
path:
|
|
467
|
+
path: I,
|
|
470
468
|
resourcePage: ne,
|
|
471
469
|
prepare: async ({ context: e }) => {
|
|
472
470
|
let t = await d.login.load();
|
|
@@ -475,30 +473,30 @@ function H(a) {
|
|
|
475
473
|
render: ({ prepared: e, Component: t }) => t == null ? null : /* @__PURE__ */ s(t, { prepared: e })
|
|
476
474
|
}),
|
|
477
475
|
V({
|
|
478
|
-
path:
|
|
476
|
+
path: z,
|
|
479
477
|
resourcePage: re,
|
|
480
478
|
prepare: async () => (await d.passwordResetRequest.load(), null),
|
|
481
479
|
render: ({ Component: e }) => e == null ? null : /* @__PURE__ */ s(e, {})
|
|
482
480
|
}),
|
|
483
481
|
V({
|
|
484
|
-
path:
|
|
482
|
+
path: H,
|
|
485
483
|
resourcePage: ie,
|
|
486
484
|
prepare: async () => (await d.passwordResetComplete.load(), null),
|
|
487
485
|
render: ({ Component: e }) => e == null ? null : /* @__PURE__ */ s(e, {})
|
|
488
486
|
}),
|
|
489
487
|
V({
|
|
490
|
-
path:
|
|
488
|
+
path: U,
|
|
491
489
|
resourcePage: O,
|
|
492
490
|
prepare: async () => (await d.verifyEmail.load(), null),
|
|
493
491
|
render: ({ Component: e }) => e == null ? null : /* @__PURE__ */ s(e, {})
|
|
494
492
|
})
|
|
495
493
|
];
|
|
496
494
|
return (d.hasAcceptInvitation === !0 || d.acceptInvitation != null) && $.push(V({
|
|
497
|
-
path:
|
|
495
|
+
path: oe,
|
|
498
496
|
resourcePage: k,
|
|
499
497
|
prepare: async () => (await d.acceptInvitation?.load(), null),
|
|
500
498
|
render: ({ Component: e }) => e == null ? null : /* @__PURE__ */ s(e, {})
|
|
501
|
-
})), $.push(
|
|
499
|
+
})), $.push(ve), $;
|
|
502
500
|
}
|
|
503
501
|
var U = {
|
|
504
502
|
normalizeBaseSegment: M,
|