@burdenoff/microfe-channel 2026.510.112
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 +147 -0
- package/dist/channel/ChannelRoot.d.ts +32 -0
- package/dist/channel/ChannelRoot.d.ts.map +1 -0
- package/dist/channel/ChannelRoot.js +81 -0
- package/dist/channel/ChannelRoot.js.map +1 -0
- package/dist/channel/ChannelRoutes.d.ts +10 -0
- package/dist/channel/ChannelRoutes.d.ts.map +1 -0
- package/dist/channel/ChannelRoutes.js +104 -0
- package/dist/channel/ChannelRoutes.js.map +1 -0
- package/dist/channel/components/AdapterCredentialsForm.d.ts +20 -0
- package/dist/channel/components/AdapterCredentialsForm.d.ts.map +1 -0
- package/dist/channel/components/AdapterCredentialsForm.js +230 -0
- package/dist/channel/components/AdapterCredentialsForm.js.map +1 -0
- package/dist/channel/components/FeatureNotEnabled.d.ts +10 -0
- package/dist/channel/components/FeatureNotEnabled.d.ts.map +1 -0
- package/dist/channel/components/FeatureNotEnabled.js +32 -0
- package/dist/channel/components/FeatureNotEnabled.js.map +1 -0
- package/dist/channel/components/PermissionGuard.d.ts +15 -0
- package/dist/channel/components/PermissionGuard.d.ts.map +1 -0
- package/dist/channel/components/PermissionGuard.js +23 -0
- package/dist/channel/components/PermissionGuard.js.map +1 -0
- package/dist/channel/config/adapterCredentials.d.ts +44 -0
- package/dist/channel/config/adapterCredentials.d.ts.map +1 -0
- package/dist/channel/config/adapterCredentials.js +946 -0
- package/dist/channel/config/adapterCredentials.js.map +1 -0
- package/dist/channel/constants/permissions.d.ts +32 -0
- package/dist/channel/constants/permissions.d.ts.map +1 -0
- package/dist/channel/constants/permissions.js +30 -0
- package/dist/channel/constants/permissions.js.map +1 -0
- package/dist/channel/graphql/global-client.d.ts +11 -0
- package/dist/channel/graphql/global-client.d.ts.map +1 -0
- package/dist/channel/graphql/global-client.js +56 -0
- package/dist/channel/graphql/global-client.js.map +1 -0
- package/dist/channel/hooks/useChannelOrgSettings.d.ts +22 -0
- package/dist/channel/hooks/useChannelOrgSettings.d.ts.map +1 -0
- package/dist/channel/hooks/useChannelOrgSettings.js +61 -0
- package/dist/channel/hooks/useChannelOrgSettings.js.map +1 -0
- package/dist/channel/hooks/useChannelSubscription.d.ts +36 -0
- package/dist/channel/hooks/useChannelSubscription.d.ts.map +1 -0
- package/dist/channel/hooks/useChannelSubscription.js +111 -0
- package/dist/channel/hooks/useChannelSubscription.js.map +1 -0
- package/dist/channel/hooks/useChannels.d.ts +214 -0
- package/dist/channel/hooks/useChannels.d.ts.map +1 -0
- package/dist/channel/hooks/useChannels.js +416 -0
- package/dist/channel/hooks/useChannels.js.map +1 -0
- package/dist/channel/index.d.ts +12 -0
- package/dist/channel/index.d.ts.map +1 -0
- package/dist/channel/index.js +2 -0
- package/dist/channel/modules/channels/hooks/useExport.d.ts +45 -0
- package/dist/channel/modules/channels/hooks/useExport.d.ts.map +1 -0
- package/dist/channel/modules/channels/hooks/useExport.js +195 -0
- package/dist/channel/modules/channels/hooks/useExport.js.map +1 -0
- package/dist/channel/modules/channels/i18n.d.ts +14 -0
- package/dist/channel/modules/channels/i18n.d.ts.map +1 -0
- package/dist/channel/modules/channels/i18n.js +110 -0
- package/dist/channel/modules/channels/i18n.js.map +1 -0
- package/dist/channel/modules/channels/pages/ChannelDashboardPage.d.ts +14 -0
- package/dist/channel/modules/channels/pages/ChannelDashboardPage.d.ts.map +1 -0
- package/dist/channel/modules/channels/pages/ChannelDashboardPage.js +680 -0
- package/dist/channel/modules/channels/pages/ChannelDashboardPage.js.map +1 -0
- package/dist/channel/modules/channels/pages/ChannelDetailsPage.d.ts +7 -0
- package/dist/channel/modules/channels/pages/ChannelDetailsPage.d.ts.map +1 -0
- package/dist/channel/modules/channels/pages/ChannelDetailsPage.js +949 -0
- package/dist/channel/modules/channels/pages/ChannelDetailsPage.js.map +1 -0
- package/dist/channel/modules/channels/pages/ChannelSettingsPage.d.ts +7 -0
- package/dist/channel/modules/channels/pages/ChannelSettingsPage.d.ts.map +1 -0
- package/dist/channel/modules/channels/pages/ChannelSettingsPage.js +404 -0
- package/dist/channel/modules/channels/pages/ChannelSettingsPage.js.map +1 -0
- package/dist/channel/modules/channels/pages/ChannelUsersPage.d.ts +7 -0
- package/dist/channel/modules/channels/pages/ChannelUsersPage.d.ts.map +1 -0
- package/dist/channel/modules/channels/pages/ChannelUsersPage.js +315 -0
- package/dist/channel/modules/channels/pages/ChannelUsersPage.js.map +1 -0
- package/dist/channel/modules/channels/pages/ChannelsListPage.d.ts +7 -0
- package/dist/channel/modules/channels/pages/ChannelsListPage.d.ts.map +1 -0
- package/dist/channel/modules/channels/pages/ChannelsListPage.js +604 -0
- package/dist/channel/modules/channels/pages/ChannelsListPage.js.map +1 -0
- package/dist/channel/modules/channels/pages/ConnectionDetailsPage.d.ts +7 -0
- package/dist/channel/modules/channels/pages/ConnectionDetailsPage.d.ts.map +1 -0
- package/dist/channel/modules/channels/pages/ConnectionDetailsPage.js +323 -0
- package/dist/channel/modules/channels/pages/ConnectionDetailsPage.js.map +1 -0
- package/dist/channel/modules/channels/pages/ConnectionsListPage.d.ts +7 -0
- package/dist/channel/modules/channels/pages/ConnectionsListPage.d.ts.map +1 -0
- package/dist/channel/modules/channels/pages/ConnectionsListPage.js +276 -0
- package/dist/channel/modules/channels/pages/ConnectionsListPage.js.map +1 -0
- package/dist/channel/modules/channels/pages/CreateChannelPage.d.ts +12 -0
- package/dist/channel/modules/channels/pages/CreateChannelPage.d.ts.map +1 -0
- package/dist/channel/modules/channels/pages/CreateChannelPage.js +456 -0
- package/dist/channel/modules/channels/pages/CreateChannelPage.js.map +1 -0
- package/dist/channel/modules/channels/pages/CreateConnectionPage.d.ts +11 -0
- package/dist/channel/modules/channels/pages/CreateConnectionPage.d.ts.map +1 -0
- package/dist/channel/modules/channels/pages/CreateConnectionPage.js +219 -0
- package/dist/channel/modules/channels/pages/CreateConnectionPage.js.map +1 -0
- package/dist/channel/modules/channels/pages/DeliveryHistoryPage.d.ts +7 -0
- package/dist/channel/modules/channels/pages/DeliveryHistoryPage.d.ts.map +1 -0
- package/dist/channel/modules/channels/pages/DeliveryHistoryPage.js +375 -0
- package/dist/channel/modules/channels/pages/DeliveryHistoryPage.js.map +1 -0
- package/dist/channel/modules/channels/pages/EditChannelPage.d.ts +8 -0
- package/dist/channel/modules/channels/pages/EditChannelPage.d.ts.map +1 -0
- package/dist/channel/modules/channels/pages/EditChannelPage.js +459 -0
- package/dist/channel/modules/channels/pages/EditChannelPage.js.map +1 -0
- package/dist/channel/modules/channels/pages/EditConnectionPage.d.ts +10 -0
- package/dist/channel/modules/channels/pages/EditConnectionPage.d.ts.map +1 -0
- package/dist/channel/modules/channels/pages/EditConnectionPage.js +199 -0
- package/dist/channel/modules/channels/pages/EditConnectionPage.js.map +1 -0
- package/dist/channel/modules/channels/pages/SendMessagePage.d.ts +8 -0
- package/dist/channel/modules/channels/pages/SendMessagePage.d.ts.map +1 -0
- package/dist/channel/modules/channels/pages/SendMessagePage.js +403 -0
- package/dist/channel/modules/channels/pages/SendMessagePage.js.map +1 -0
- package/dist/channel/modules/channels/pages/WebhookEventsPage.d.ts +7 -0
- package/dist/channel/modules/channels/pages/WebhookEventsPage.d.ts.map +1 -0
- package/dist/channel/modules/channels/pages/WebhookEventsPage.js +303 -0
- package/dist/channel/modules/channels/pages/WebhookEventsPage.js.map +1 -0
- package/dist/channel/modules/channels/pages/index.d.ts +18 -0
- package/dist/channel/modules/channels/pages/index.d.ts.map +1 -0
- package/dist/channel/modules/channels/pages/index.js +14 -0
- package/dist/channel/pages/ChannelLandingPage.d.ts +9 -0
- package/dist/channel/pages/ChannelLandingPage.d.ts.map +1 -0
- package/dist/channel/pages/ChannelLandingPage.js +72 -0
- package/dist/channel/pages/ChannelLandingPage.js.map +1 -0
- package/dist/channel/providers/ChannelProvider.d.ts +16 -0
- package/dist/channel/providers/ChannelProvider.d.ts.map +1 -0
- package/dist/channel/providers/ChannelProvider.js +35 -0
- package/dist/channel/providers/ChannelProvider.js.map +1 -0
- package/dist/channel/types/index.d.ts +89 -0
- package/dist/channel/types/index.d.ts.map +1 -0
- package/dist/channel/utils/shellBridge.d.ts +59 -0
- package/dist/channel/utils/shellBridge.d.ts.map +1 -0
- package/dist/channel/utils/shellBridge.js +36 -0
- package/dist/channel/utils/shellBridge.js.map +1 -0
- package/dist/dev/App.d.ts +6 -0
- package/dist/dev/App.d.ts.map +1 -0
- package/dist/dev/main.d.ts +2 -0
- package/dist/dev/main.d.ts.map +1 -0
- package/dist/generated/global-operations.d.ts +1547 -0
- package/dist/generated/global-operations.d.ts.map +1 -0
- package/dist/generated/global-operations.js +466 -0
- package/dist/generated/global-operations.js.map +1 -0
- package/dist/generated/global-types.d.ts +21289 -0
- package/dist/generated/global-types.d.ts.map +1 -0
- package/dist/generated/global-types.js +14 -0
- package/dist/generated/global-types.js.map +1 -0
- package/dist/generated/wspace-operations.d.ts +2 -0
- package/dist/generated/wspace-operations.d.ts.map +1 -0
- package/dist/generated/wspace-types.d.ts +55214 -0
- package/dist/generated/wspace-types.d.ts.map +1 -0
- package/dist/index.d.ts +5 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +4 -0
- package/dist/node_modules/@apollo/client/errors/CombinedGraphQLErrors.js +24 -0
- package/dist/node_modules/@apollo/client/errors/CombinedGraphQLErrors.js.map +1 -0
- package/dist/node_modules/@apollo/client/errors/utils.js +16 -0
- package/dist/node_modules/@apollo/client/errors/utils.js.map +1 -0
- package/dist/utils/nativeBridge.d.ts +3 -0
- package/dist/utils/nativeBridge.d.ts.map +1 -0
- package/dist/utils/nativeBridge.js +2 -0
- package/package.json +116 -0
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ChannelProvider.js","names":[],"sources":["../../../src/channel/providers/ChannelProvider.tsx"],"sourcesContent":["import type { FC, PropsWithChildren } from 'react';\nimport { createContext, useContext } from 'react';\nimport { MemoryRouter } from 'react-router-dom';\nimport { PermissionProvider } from '@burdenoff/fe-libs/shared/providers/shell';\nimport type { ChannelRootProps } from '../types';\n\n/**\n * Context value for Channel microfrontend\n */\ntype ChannelContextValue = ChannelRootProps;\n\nconst ChannelContext = createContext<ChannelContextValue | null>(null);\n\n/**\n * Hook to access Channel context\n */\nexport const useChannel = () => {\n const context = useContext(ChannelContext);\n if (!context) {\n throw new Error('useChannel must be used within ChannelProvider');\n }\n return context;\n};\n\n/**\n * Provider component for Channel microfrontend\n * Sets up routing and context\n *\n * When integrated into a shell (basePath provided), the shell already has a router\n * so we don't create another one. When standalone (no basePath), use MemoryRouter.\n */\nexport const ChannelProvider: FC<PropsWithChildren<ChannelRootProps>> = ({\n children,\n basePath,\n navigate,\n currentUser,\n workspaceId,\n organizationId,\n tenantId,\n apiGatewayUrl,\n authToken,\n registerNavItems,\n registerFooterItems,\n}) => {\n const contextValue: ChannelContextValue = {\n basePath,\n navigate,\n currentUser,\n workspaceId,\n organizationId,\n tenantId,\n apiGatewayUrl,\n authToken,\n registerNavItems,\n registerFooterItems,\n };\n\n // PermissionProvider requires the shell's AuthProvider — only mount it in integrated mode.\n // In standalone/dev mode (MemoryRouter path), there's no AuthProvider, so we skip it.\n const isIntegrated = !!basePath;\n\n const content = (\n <ChannelContext.Provider value={contextValue}>\n {isIntegrated ? (\n <PermissionProvider scopeId={organizationId ?? null} gateway=\"global\">\n {children}\n </PermissionProvider>\n ) : (\n children\n )}\n </ChannelContext.Provider>\n );\n\n // When integrated into a shell (basePath provided), the shell already has a router\n // so we don't create another one. When standalone (no basePath), use MemoryRouter.\n if (isIntegrated) {\n return content;\n }\n\n // Standalone mode: create MemoryRouter for independent operation\n return <MemoryRouter>{content}</MemoryRouter>;\n};\n"],"mappings":";;;;;AAWA,IAAM,IAAiB,EAA0C,KAAK,EAKzD,UAAmB;CAC9B,IAAM,IAAU,EAAW,EAAe;AAC1C,KAAI,CAAC,EACH,OAAU,MAAM,iDAAiD;AAEnE,QAAO;GAUI,KAA4D,EACvE,aACA,aACA,aACA,gBACA,gBACA,mBACA,aACA,kBACA,cACA,qBACA,6BACI;CACJ,IAAM,IAAoC;EACxC;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACD,EAIK,IAAe,CAAC,CAAC,GAEjB,IACJ,kBAAC,EAAe,UAAhB;EAAyB,OAAO;YAC7B,IACC,kBAAC,GAAD;GAAoB,SAAS,KAAkB;GAAM,SAAQ;GAC1D;GACkB,CAAA,GAErB;EAEsB,CAAA;AAU5B,QALI,IACK,IAIF,kBAAC,GAAD,EAAA,UAAe,GAAuB,CAAA"}
|
|
@@ -0,0 +1,89 @@
|
|
|
1
|
+
import { ReactNode } from 'react';
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* Navigation item for shell integration
|
|
5
|
+
*/
|
|
6
|
+
export interface NavItem {
|
|
7
|
+
id: string;
|
|
8
|
+
label: string;
|
|
9
|
+
icon?: ReactNode;
|
|
10
|
+
path: string;
|
|
11
|
+
badge?: number;
|
|
12
|
+
order?: number;
|
|
13
|
+
group?: string;
|
|
14
|
+
visible?: boolean;
|
|
15
|
+
children?: NavItem[];
|
|
16
|
+
}
|
|
17
|
+
/**
|
|
18
|
+
* Footer item for shell integration
|
|
19
|
+
*/
|
|
20
|
+
export interface FooterItem {
|
|
21
|
+
id: string;
|
|
22
|
+
label: string;
|
|
23
|
+
icon?: string;
|
|
24
|
+
onClick?: () => void;
|
|
25
|
+
type?: 'status' | 'action' | 'info';
|
|
26
|
+
order?: number;
|
|
27
|
+
badge?: string;
|
|
28
|
+
section?: 'left' | 'center' | 'right';
|
|
29
|
+
visible?: boolean;
|
|
30
|
+
}
|
|
31
|
+
/**
|
|
32
|
+
* Base user type
|
|
33
|
+
*/
|
|
34
|
+
export interface User {
|
|
35
|
+
id: string;
|
|
36
|
+
email: string;
|
|
37
|
+
firstName?: string;
|
|
38
|
+
lastName?: string;
|
|
39
|
+
avatar?: string;
|
|
40
|
+
username?: string;
|
|
41
|
+
name?: string;
|
|
42
|
+
role?: string;
|
|
43
|
+
}
|
|
44
|
+
/**
|
|
45
|
+
* Props for the ChannelRoot component
|
|
46
|
+
*/
|
|
47
|
+
export interface ChannelRootProps {
|
|
48
|
+
/**
|
|
49
|
+
* Base path for the microfrontend (e.g., '/channels')
|
|
50
|
+
*/
|
|
51
|
+
basePath: string;
|
|
52
|
+
/**
|
|
53
|
+
* Navigation function injected by the host shell
|
|
54
|
+
*/
|
|
55
|
+
navigate: (path: string) => void;
|
|
56
|
+
/**
|
|
57
|
+
* Current authenticated user
|
|
58
|
+
*/
|
|
59
|
+
currentUser?: User;
|
|
60
|
+
/**
|
|
61
|
+
* Workspace ID for Channel context
|
|
62
|
+
*/
|
|
63
|
+
workspaceId?: string;
|
|
64
|
+
/**
|
|
65
|
+
* Organization ID for Channel context
|
|
66
|
+
*/
|
|
67
|
+
organizationId?: string;
|
|
68
|
+
/**
|
|
69
|
+
* Tenant ID for RBAC permission checks (global gateway scope)
|
|
70
|
+
*/
|
|
71
|
+
tenantId?: string;
|
|
72
|
+
/**
|
|
73
|
+
* API Gateway URL
|
|
74
|
+
*/
|
|
75
|
+
apiGatewayUrl?: string;
|
|
76
|
+
/**
|
|
77
|
+
* Authentication token
|
|
78
|
+
*/
|
|
79
|
+
authToken?: string;
|
|
80
|
+
/**
|
|
81
|
+
* Optional function to register navigation items with the shell
|
|
82
|
+
*/
|
|
83
|
+
registerNavItems?: (items: NavItem | NavItem[]) => () => void;
|
|
84
|
+
/**
|
|
85
|
+
* Optional function to register footer items with the shell
|
|
86
|
+
*/
|
|
87
|
+
registerFooterItems?: (items: FooterItem | FooterItem[]) => () => void;
|
|
88
|
+
}
|
|
89
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/channel/types/index.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AAEvC;;GAEG;AACH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W,CAAC,EAAE,IAAI,CAAC;IAEnB;;OAEG;IACH,WAAW,CAAC,EAAE,MAAM,CAAC;IAErB;;OAEG;IACH,cAAc,CAAC,EAAE,MAAM,CAAC;IAExB;;OAEG;IACH,QAAQ,CAAC,EAAE,MAAM,CAAC;IAElB;;OAEG;IACH,aAAa,CAAC,EAAE,MAAM,CAAC;IAEvB;;OAEG;IACH,SAAS,CAAC,EAAE,MAAM,CAAC;IAEnB;;OAEG;IACH,gBAAgB,CAAC,EAAE,CAAC,KAAK,EAAE,OAAO,GAAG,OAAO,EAAE,KAAK,MAAM,IAAI,CAAC;IAE9D;;OAEG;IACH,mBAAmB,CAAC,EAAE,CAAC,KAAK,EAAE,UAAU,GAAG,UAAU,EAAE,KAAK,MAAM,IAAI,CAAC;CACxE"}
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Shell bridge — unified accessor for capabilities exposed by the host app
|
|
3
|
+
* shell on `globalThis.__burdenoffShell`. Each accessor is fully optional:
|
|
4
|
+
* the MFE must work in isolation (Storybook/standalone Vite dev) when the
|
|
5
|
+
* shell global is absent.
|
|
6
|
+
*
|
|
7
|
+
* Capabilities consumed:
|
|
8
|
+
* - `eventBus` — cross-MFE pub/sub bus per spec MFE-047
|
|
9
|
+
* - `reportError` — central SRE error sink (Rybbit + backend forward)
|
|
10
|
+
* - `graphqlWsClient` — graphql-ws Client instance (probe-only; subs falls
|
|
11
|
+
* back to polling when absent)
|
|
12
|
+
*/
|
|
13
|
+
export interface ShellEventBus {
|
|
14
|
+
/** Emit a domain event onto the shell bus. */
|
|
15
|
+
emit?: (name: string, payload?: unknown, options?: Record<string, unknown>) => void;
|
|
16
|
+
/** Subscribe; returns an unsubscribe function. */
|
|
17
|
+
on?: (name: string, handler: (event: unknown) => void) => () => void;
|
|
18
|
+
}
|
|
19
|
+
export interface ShellReportErrorMeta {
|
|
20
|
+
module: string;
|
|
21
|
+
context?: Record<string, unknown>;
|
|
22
|
+
componentStack?: string;
|
|
23
|
+
}
|
|
24
|
+
/**
|
|
25
|
+
* Minimal subset of a graphql-ws Client we rely on.
|
|
26
|
+
* https://the-guild.dev/graphql/ws/recipes#use-the-client-without-apollo
|
|
27
|
+
*/
|
|
28
|
+
export interface GraphqlWsLike {
|
|
29
|
+
subscribe: (payload: {
|
|
30
|
+
query: string;
|
|
31
|
+
variables?: Record<string, unknown>;
|
|
32
|
+
operationName?: string;
|
|
33
|
+
}, sink: {
|
|
34
|
+
next: (value: {
|
|
35
|
+
data?: unknown;
|
|
36
|
+
errors?: readonly unknown[];
|
|
37
|
+
}) => void;
|
|
38
|
+
error: (err: unknown) => void;
|
|
39
|
+
complete: () => void;
|
|
40
|
+
}) => () => void;
|
|
41
|
+
}
|
|
42
|
+
/**
|
|
43
|
+
* Emit a domain event onto the shell bus. Safe no-op when the shell or bus
|
|
44
|
+
* is absent. `name` follows `<domain>.<entity>.<verb>` (per spec 47).
|
|
45
|
+
*/
|
|
46
|
+
export declare function emitShellEvent(name: string, payload?: unknown): void;
|
|
47
|
+
/**
|
|
48
|
+
* Subscribe to a shell-bus event; returns an unsubscribe function. Returns a
|
|
49
|
+
* no-op unsubscribe when the bus is absent.
|
|
50
|
+
*/
|
|
51
|
+
export declare function subscribeShellEvent(name: string, handler: (event: unknown) => void): () => void;
|
|
52
|
+
/**
|
|
53
|
+
* Forward an error to the shell's central error sink. Falls back to
|
|
54
|
+
* `console.error` only when the sink is missing — mirrors the pattern in
|
|
55
|
+
* `microfe-tags/src/tags/components/RouteHelpers.tsx`.
|
|
56
|
+
*/
|
|
57
|
+
export declare function reportShellError(error: unknown, meta: ShellReportErrorMeta, fallbackLabel?: string): void;
|
|
58
|
+
export declare function getGraphqlWsClient(): GraphqlWsLike | undefined;
|
|
59
|
+
//# sourceMappingURL=shellBridge.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"shellBridge.d.ts","sourceRoot":"","sources":["../../../src/channel/utils/shellBridge.ts"],"names":[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AAC,KAAK,EAAE,OAAO,KAAK,IAAI,GAAG,MAAM,IAAI,CAQ/F;AAED;;;;GAIG;AACH,wBAAgB,gBAAgB,CAC9B,KAAK,EAAE,OAAO,EACd,IAAI,EAAE,oBAAoB,EAC1B,aAAa,CAAC,EAAE,MAAM,GACrB,IAAI,CAkBN;AAED,wBAAgB,kBAAkB,IAAI,aAAa,GAAG,SAAS,CAE9D"}
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
//#region src/channel/utils/shellBridge.ts
|
|
2
|
+
function e() {
|
|
3
|
+
return globalThis.__burdenoffShell;
|
|
4
|
+
}
|
|
5
|
+
function t() {
|
|
6
|
+
return e()?.eventBus;
|
|
7
|
+
}
|
|
8
|
+
function n(e, n) {
|
|
9
|
+
try {
|
|
10
|
+
t()?.emit?.(e, n, { component: "microfe-channel" });
|
|
11
|
+
} catch {}
|
|
12
|
+
}
|
|
13
|
+
function r(e, n) {
|
|
14
|
+
let r = t();
|
|
15
|
+
if (!r?.on) return () => {};
|
|
16
|
+
try {
|
|
17
|
+
return r.on(e, n) ?? (() => {});
|
|
18
|
+
} catch {
|
|
19
|
+
return () => {};
|
|
20
|
+
}
|
|
21
|
+
}
|
|
22
|
+
function i(t, n, r) {
|
|
23
|
+
let i = t instanceof Error ? t : Error(String(t)), a = e();
|
|
24
|
+
if (a?.reportError) try {
|
|
25
|
+
a.reportError(i, n);
|
|
26
|
+
return;
|
|
27
|
+
} catch {}
|
|
28
|
+
console.error(r || `[${n.module}]`, i, n.context ?? {});
|
|
29
|
+
}
|
|
30
|
+
function a() {
|
|
31
|
+
return e()?.graphqlWsClient;
|
|
32
|
+
}
|
|
33
|
+
//#endregion
|
|
34
|
+
export { n as emitShellEvent, a as getGraphqlWsClient, i as reportShellError, r as subscribeShellEvent };
|
|
35
|
+
|
|
36
|
+
//# sourceMappingURL=shellBridge.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"shellBridge.js","names":[],"sources":["../../../src/channel/utils/shellBridge.ts"],"sourcesContent":["/**\n * Shell bridge — unified accessor for capabilities exposed by the host app\n * shell on `globalThis.__burdenoffShell`. Each accessor is fully optional:\n * the MFE must work in isolation (Storybook/standalone Vite dev) when the\n * shell global is absent.\n *\n * Capabilities consumed:\n * - `eventBus` — cross-MFE pub/sub bus per spec MFE-047\n * - `reportError` — central SRE error sink (Rybbit + backend forward)\n * - `graphqlWsClient` — graphql-ws Client instance (probe-only; subs falls\n * back to polling when absent)\n */\n\nexport interface ShellEventBus {\n /** Emit a domain event onto the shell bus. */\n emit?: (name: string, payload?: unknown, options?: Record<string, unknown>) => void;\n /** Subscribe; returns an unsubscribe function. */\n on?: (name: string, handler: (event: unknown) => void) => () => void;\n}\n\nexport interface ShellReportErrorMeta {\n module: string;\n context?: Record<string, unknown>;\n componentStack?: string;\n}\n\n/**\n * Minimal subset of a graphql-ws Client we rely on.\n * https://the-guild.dev/graphql/ws/recipes#use-the-client-without-apollo\n */\nexport interface GraphqlWsLike {\n subscribe: (\n payload: { query: string; variables?: Record<string, unknown>; operationName?: string },\n sink: {\n next: (value: { data?: unknown; errors?: readonly unknown[] }) => void;\n error: (err: unknown) => void;\n complete: () => void;\n }\n ) => () => void;\n}\n\ninterface BurdenoffShell {\n eventBus?: ShellEventBus;\n reportError?: (\n sourceOrError: string | Error,\n errorOrMeta?: Error | ShellReportErrorMeta,\n meta?: ShellReportErrorMeta | Record<string, unknown>\n ) => void;\n graphqlWsClient?: GraphqlWsLike;\n}\n\nfunction getShell(): BurdenoffShell | undefined {\n return (globalThis as unknown as { __burdenoffShell?: BurdenoffShell }).__burdenoffShell;\n}\n\nfunction getEventBus(): ShellEventBus | undefined {\n return getShell()?.eventBus;\n}\n\n/**\n * Emit a domain event onto the shell bus. Safe no-op when the shell or bus\n * is absent. `name` follows `<domain>.<entity>.<verb>` (per spec 47).\n */\nexport function emitShellEvent(name: string, payload?: unknown): void {\n try {\n getEventBus()?.emit?.(name, payload, { component: 'microfe-channel' });\n } catch {\n /* sink failures must never break the emitter */\n }\n}\n\n/**\n * Subscribe to a shell-bus event; returns an unsubscribe function. Returns a\n * no-op unsubscribe when the bus is absent.\n */\nexport function subscribeShellEvent(name: string, handler: (event: unknown) => void): () => void {\n const bus = getEventBus();\n if (!bus?.on) return () => {};\n try {\n return bus.on(name, handler) ?? (() => {});\n } catch {\n return () => {};\n }\n}\n\n/**\n * Forward an error to the shell's central error sink. Falls back to\n * `console.error` only when the sink is missing — mirrors the pattern in\n * `microfe-tags/src/tags/components/RouteHelpers.tsx`.\n */\nexport function reportShellError(\n error: unknown,\n meta: ShellReportErrorMeta,\n fallbackLabel?: string\n): void {\n const err = error instanceof Error ? error : new Error(String(error));\n const sink = getShell();\n if (sink?.reportError) {\n try {\n sink.reportError(err, meta);\n return;\n } catch {\n /* fall through to console */\n }\n }\n // Fallback path: shell missing or sink threw. Preserves observability in\n // standalone dev.\n if (fallbackLabel) {\n console.error(fallbackLabel, err, meta.context ?? {});\n } else {\n console.error(`[${meta.module}]`, err, meta.context ?? {});\n }\n}\n\nexport function getGraphqlWsClient(): GraphqlWsLike | undefined {\n return getShell()?.graphqlWsClient;\n}\n"],"mappings":";AAmDA,SAAS,IAAuC;AAC9C,QAAQ,WAAgE;;AAG1E,SAAS,IAAyC;AAChD,QAAO,GAAU,EAAE;;AAOrB,SAAgB,EAAe,GAAc,GAAyB;AACpE,KAAI;AACF,KAAa,EAAE,OAAO,GAAM,GAAS,EAAE,WAAW,mBAAmB,CAAC;SAChE;;AASV,SAAgB,EAAoB,GAAc,GAA+C;CAC/F,IAAM,IAAM,GAAa;AACzB,KAAI,CAAC,GAAK,GAAI,cAAa;AAC3B,KAAI;AACF,SAAO,EAAI,GAAG,GAAM,EAAQ,WAAW;SACjC;AACN,eAAa;;;AASjB,SAAgB,EACd,GACA,GACA,GACM;CACN,IAAM,IAAM,aAAiB,QAAQ,IAAY,MAAM,OAAO,EAAM,CAAC,EAC/D,IAAO,GAAU;AACvB,KAAI,GAAM,YACR,KAAI;AACF,IAAK,YAAY,GAAK,EAAK;AAC3B;SACM;AAMV,CACE,QAAQ,MADN,KAGY,IAAI,EAAK,OAAO,IAFD,GAAK,EAAK,WAAW,EAAE,CAEM;;AAI9D,SAAgB,IAAgD;AAC9D,QAAO,GAAU,EAAE"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"App.d.ts","sourceRoot":"","sources":["../../src/dev/App.tsx"],"names":[],"mappings":"AAAA;;;GAGG;AA8CH,wBAAgB,GAAG,4CAMlB"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"main.d.ts","sourceRoot":"","sources":["../../src/dev/main.tsx"],"names":[],"mappings":"AAAA;;;GAGG;AAKH,OAAO,aAAa,CAAC"}
|