@isi-ui7/bos7-shared 0.2.0

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.
Files changed (108) hide show
  1. package/dist/api.d.ts +4 -0
  2. package/dist/auth7/client.d.ts +26 -0
  3. package/dist/auth7/delegated-proxy.d.ts +33 -0
  4. package/dist/auth7/hooks/useAuth.d.ts +10 -0
  5. package/dist/auth7/hooks/useSession.d.ts +12 -0
  6. package/dist/auth7/index.d.ts +12 -0
  7. package/dist/auth7/provider.d.ts +13 -0
  8. package/dist/auth7/scope-guard.d.ts +5 -0
  9. package/dist/auth7/service-account.d.ts +2 -0
  10. package/dist/auth7/token-exchange.d.ts +11 -0
  11. package/dist/auth7/types.d.ts +63 -0
  12. package/dist/backend.d.ts +20 -0
  13. package/dist/crud-components.d.ts +47 -0
  14. package/dist/crud-hooks.d.ts +15 -0
  15. package/dist/crud-types.d.ts +86 -0
  16. package/dist/data-table/cursor-adapter.d.ts +74 -0
  17. package/dist/event-bus/index.d.ts +20 -0
  18. package/dist/event-bus/useEventBus.d.ts +21 -0
  19. package/dist/event-bus.d.ts +1 -0
  20. package/dist/export.d.ts +7 -0
  21. package/dist/form-layout.d.ts +39 -0
  22. package/dist/form-numeric.d.ts +35 -0
  23. package/dist/form-renderer-utils.d.ts +10 -0
  24. package/dist/form-renderer.d.ts +18 -0
  25. package/dist/form-rules.d.ts +12 -0
  26. package/dist/form-types.d.ts +130 -0
  27. package/dist/html2canvas.esm-d2sM-0Wm.js +4870 -0
  28. package/dist/i18n.d.ts +35 -0
  29. package/dist/index.d.ts +18 -0
  30. package/dist/index.es-Bylk5fh-.js +5649 -0
  31. package/dist/index.js +20779 -0
  32. package/dist/jspdf.es.min-Dzm5j8wC.js +9977 -0
  33. package/dist/jspdf.plugin.autotable-DcntYaes.js +1078 -0
  34. package/dist/modal-layout.d.ts +45 -0
  35. package/dist/nats/client.d.ts +54 -0
  36. package/dist/notif7.d.ts +21 -0
  37. package/dist/notification/routing.d.ts +4 -0
  38. package/dist/notifications-bff.d.ts +22 -0
  39. package/dist/observability/otel-init.d.ts +1 -0
  40. package/dist/page-layout.d.ts +24 -0
  41. package/dist/purify.es-CiEWEeUM.js +605 -0
  42. package/dist/shell/app-shell-layout.d.ts +70 -0
  43. package/dist/shell/branch.d.ts +6 -0
  44. package/dist/shell/interaction.d.ts +2 -0
  45. package/dist/shell/provider.d.ts +15 -0
  46. package/dist/style-contract.d.ts +72 -0
  47. package/dist/types/core.d.ts +39 -0
  48. package/dist/types/notification.d.ts +30 -0
  49. package/dist/workflow/api-client.d.ts +2 -0
  50. package/dist/workflow/backend.d.ts +9 -0
  51. package/dist/workflow/crud-client.d.ts +3 -0
  52. package/dist/workflow/notif7.d.ts +6 -0
  53. package/dist/workflow/starter.d.ts +44 -0
  54. package/dist/workflow/use-crud-form.d.ts +27 -0
  55. package/dist/workflow/use-workflow-tracker.d.ts +40 -0
  56. package/package.json +92 -0
  57. package/src/api.ts +40 -0
  58. package/src/auth7/client.ts +248 -0
  59. package/src/auth7/delegated-proxy.ts +80 -0
  60. package/src/auth7/hooks/useAuth.ts +21 -0
  61. package/src/auth7/hooks/useSession.ts +75 -0
  62. package/src/auth7/index.ts +14 -0
  63. package/src/auth7/provider.tsx +256 -0
  64. package/src/auth7/scope-guard.ts +54 -0
  65. package/src/auth7/service-account.ts +71 -0
  66. package/src/auth7/token-exchange.ts +125 -0
  67. package/src/auth7/types.ts +72 -0
  68. package/src/backend.ts +96 -0
  69. package/src/crud-components.tsx +580 -0
  70. package/src/crud-hooks.test.ts +32 -0
  71. package/src/crud-hooks.ts +31 -0
  72. package/src/crud-types.ts +64 -0
  73. package/src/data-table/cursor-adapter.ts +239 -0
  74. package/src/event-bus/index.ts +90 -0
  75. package/src/event-bus/useEventBus.ts +93 -0
  76. package/src/event-bus.ts +1 -0
  77. package/src/export.ts +62 -0
  78. package/src/form-contract.css +52 -0
  79. package/src/form-layout.tsx +90 -0
  80. package/src/form-numeric.ts +173 -0
  81. package/src/form-renderer-utils.ts +139 -0
  82. package/src/form-renderer.tsx +624 -0
  83. package/src/form-rules.ts +54 -0
  84. package/src/form-types.ts +126 -0
  85. package/src/i18n.tsx +92 -0
  86. package/src/index.ts +20 -0
  87. package/src/modal-layout.tsx +60 -0
  88. package/src/nats/client.ts +130 -0
  89. package/src/notif7.ts +76 -0
  90. package/src/notification/routing.ts +64 -0
  91. package/src/notifications-bff.ts +273 -0
  92. package/src/observability/otel-init.ts +41 -0
  93. package/src/page-layout.tsx +69 -0
  94. package/src/shell/app-shell-layout.tsx +494 -0
  95. package/src/shell/branch.ts +48 -0
  96. package/src/shell/interaction.ts +17 -0
  97. package/src/shell/provider.tsx +34 -0
  98. package/src/style-contract.test.ts +59 -0
  99. package/src/style-contract.ts +132 -0
  100. package/src/types/core.ts +46 -0
  101. package/src/types/notification.ts +35 -0
  102. package/src/workflow/api-client.ts +7 -0
  103. package/src/workflow/backend.ts +53 -0
  104. package/src/workflow/crud-client.ts +43 -0
  105. package/src/workflow/notif7.ts +28 -0
  106. package/src/workflow/starter.ts +153 -0
  107. package/src/workflow/use-crud-form.ts +176 -0
  108. package/src/workflow/use-workflow-tracker.ts +109 -0
@@ -0,0 +1,45 @@
1
+ import { ReactNode } from 'react';
2
+
3
+ /**
4
+ * Modal-flavoured counterpart to ./page-layout.
5
+ *
6
+ * PageLayout assumes its parent provides an explicit height (full-page shell),
7
+ * so `.page__body { flex: 1; overflow-y: auto }` resolves correctly. Inside a
8
+ * modal dialog the height is content-driven (capped at 90vh by the dialog),
9
+ * which means `flex: 1` collapses to 0 and the scroll behaviour breaks.
10
+ *
11
+ * These components mirror the same UX (sticky title + sticky footer + scrolling
12
+ * body) but use explicit `max-height` on the wrapper so they work in an
13
+ * auto-sized modal. Designed to be used alongside `<PageComponent>.modalTitle`
14
+ * (which renders the dialog header bar with × close + edge-to-edge border).
15
+ *
16
+ * All visual styles live in `@isi-ui7/corporate-themes/dist/globals.css` under
17
+ * the `.modal-layout`, `.modal-layout__body`, `.modal-layout__footer` selectors
18
+ * (and the `.modal-layout--{size}` size modifiers) so the dialog header
19
+ * border-bottom and footer border-top align edge-to-edge.
20
+ *
21
+ * Pattern:
22
+ * <ModalLayout>
23
+ * <ModalBody>...form fields / detail rows...</ModalBody>
24
+ * <ModalFooter>
25
+ * <Button kind="primary">Save</Button>
26
+ * <Button kind="ghost">Cancel</Button>
27
+ * </ModalFooter>
28
+ * </ModalLayout>
29
+ */
30
+ export type ModalSize = "sm" | "md" | "lg" | "xl";
31
+ export type ModalLayoutProps = {
32
+ /** Width preset matching @isi-ui7/modal-manager size names. Default: md. */
33
+ size?: ModalSize;
34
+ children: ReactNode;
35
+ };
36
+ export declare function ModalLayout({ size, children }: ModalLayoutProps): import("react/jsx-runtime").JSX.Element;
37
+ export declare function ModalBody({ children }: {
38
+ children: ReactNode;
39
+ }): import("react/jsx-runtime").JSX.Element;
40
+ export declare function ModalFooter({ children, spread, }: {
41
+ /** Action buttons. */
42
+ children: ReactNode;
43
+ /** If true, the first child is pushed to the left edge (e.g. Back left, Next right). */
44
+ spread?: boolean;
45
+ }): import("react/jsx-runtime").JSX.Element;
@@ -0,0 +1,54 @@
1
+ export interface NatsConfig {
2
+ url: string;
3
+ name?: string;
4
+ timeout?: number;
5
+ maxReconnect?: number;
6
+ }
7
+ export interface Message {
8
+ subject: string;
9
+ data: Uint8Array | string | null;
10
+ reply?: string;
11
+ }
12
+ export interface JetStreamMessage extends Message {
13
+ meta?: JetStreamMeta;
14
+ }
15
+ export interface JetStreamMeta {
16
+ stream: string;
17
+ sequence: number;
18
+ timestamp: Date;
19
+ redelivered: boolean;
20
+ }
21
+ export type MessageHandler = (msg: Message) => void | Promise<void>;
22
+ export type JetStreamHandler = (msg: JetStreamMessage) => void | Promise<void>;
23
+ export interface Subscription {
24
+ subject: string;
25
+ unsubscribe: () => void;
26
+ }
27
+ export interface NatsClient {
28
+ publish(subject: string, data: Uint8Array | string): Promise<void>;
29
+ subscribe(subject: string, handler: MessageHandler): Promise<Subscription>;
30
+ request(subject: string, data: Uint8Array | string, timeout: number): Promise<Message>;
31
+ close(): void;
32
+ isConnected(): boolean;
33
+ }
34
+ export interface JetStreamClient extends NatsClient {
35
+ publishAsync(subject: string, data: Uint8Array | string): Promise<void>;
36
+ subscribeStream(stream: string, subject: string, handler: JetStreamHandler): Promise<Subscription>;
37
+ createStream(name: string, subjects: string[]): Promise<void>;
38
+ streamExists(name: string): Promise<boolean>;
39
+ }
40
+ export declare class NatsClientImpl implements NatsClient {
41
+ private conn;
42
+ private config;
43
+ private subscriptions;
44
+ constructor(config: NatsConfig);
45
+ connect(): Promise<void>;
46
+ publish(subject: string, data: Uint8Array | string): Promise<void>;
47
+ subscribe(subject: string): Promise<Subscription>;
48
+ request(_subject: string, _data: Uint8Array | string, _timeout: number): Promise<Message>;
49
+ close(): void;
50
+ isConnected(): boolean;
51
+ }
52
+ export declare function createClient(config: NatsConfig): Promise<NatsClient>;
53
+ export declare function getClient(): NatsClient | null;
54
+ export declare function isConnected(): boolean;
@@ -0,0 +1,21 @@
1
+ export declare const NOTIF7_URL: string;
2
+ export declare const NOTIF7_JWT_SECRET: string;
3
+ export declare const DEFAULT_USER_ID = "b0000000-0000-0000-0000-000000000001";
4
+ export declare const DEFAULT_BRANCH_ID = "c0000000-0000-0000-0000-000000000001";
5
+ type RequestLike = Request & {
6
+ cookies?: {
7
+ get?: (name: string) => {
8
+ value?: string;
9
+ } | undefined;
10
+ };
11
+ };
12
+ export declare function getUserIDFromRequest(req: RequestLike | Request): string;
13
+ export declare function mintJWT(userID: string): Promise<string>;
14
+ export interface Notif7Options {
15
+ userID?: string;
16
+ accessToken?: string;
17
+ query?: URLSearchParams;
18
+ body?: string;
19
+ }
20
+ export declare function notif7Fetch(method: string, path: string, opts?: Notif7Options): Promise<Response>;
21
+ export {};
@@ -0,0 +1,4 @@
1
+ export declare const DEFAULT_WORKFLOW_BASE_URL = "https://workflow.bos7.local";
2
+ export declare function openPortalNotificationsWindow(url: string): void;
3
+ export declare function openWorkflowNotificationTarget(actionHref: string | undefined, workflowBaseUrl?: string): boolean;
4
+ export declare function resolveNotificationHref(href: string | undefined, push: (path: string) => void, workflowBaseUrl?: string): void;
@@ -0,0 +1,22 @@
1
+ export interface NotificationBffOptions {
2
+ workflowBaseUrl?: string;
3
+ taskEventTypes?: Set<string>;
4
+ includeUserID?: boolean;
5
+ graceful?: boolean;
6
+ tableActionField?: 'action_url' | 'ref_url';
7
+ bellTitleMap?: Record<string, string>;
8
+ bellTimestampLocale?: boolean;
9
+ }
10
+ export declare function handleNotificationsGet(req: Request, options?: NotificationBffOptions): Promise<Response>;
11
+ export declare function handleNotificationsMarkAllRead(req: Request, options?: {
12
+ includeUserID?: boolean;
13
+ path?: string;
14
+ graceful?: boolean;
15
+ }): Promise<Response>;
16
+ export declare function handleNotificationsReadOne(req: Request, id: string, options?: {
17
+ includeUserID?: boolean;
18
+ graceful?: boolean;
19
+ }): Promise<Response>;
20
+ export declare function handleNotificationsStream(req: Request, options?: {
21
+ preferAccessToken?: boolean;
22
+ }): Promise<Response>;
@@ -0,0 +1 @@
1
+ export declare function initOtel(serviceName?: string): Promise<void>;
@@ -0,0 +1,24 @@
1
+ import { ReactNode } from 'react';
2
+
3
+ type BreadcrumbItem = {
4
+ label: string;
5
+ href?: string;
6
+ };
7
+ export declare function PageLayout({ children }: {
8
+ children: ReactNode;
9
+ }): import("react/jsx-runtime").JSX.Element;
10
+ export declare function PageHeader({ title, subtitle, titleExtra, breadcrumbs, children, }: {
11
+ title: string;
12
+ subtitle?: string;
13
+ titleExtra?: ReactNode;
14
+ breadcrumbs?: BreadcrumbItem[];
15
+ children?: ReactNode;
16
+ }): import("react/jsx-runtime").JSX.Element;
17
+ export declare function PageBody({ children }: {
18
+ children: ReactNode;
19
+ }): import("react/jsx-runtime").JSX.Element;
20
+ export declare function PageFooter({ children, spread, }: {
21
+ children: ReactNode;
22
+ spread?: boolean;
23
+ }): import("react/jsx-runtime").JSX.Element;
24
+ export {};