@cundi/refine-xaf 1.0.6 → 1.0.8

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 CHANGED
@@ -6,14 +6,19 @@ This is an SDK integrating XAF backend with Refine frontend, including core logi
6
6
 
7
7
  - **Auth Provider**: Handles login, logout, Token management, and permission checks.
8
8
  - **Data Provider**: Data access layer designed specifically for XAF OData.
9
+ - Supports `meta.expand` for OData `$expand` (navigation properties)
9
10
  - **UI Components**:
10
11
  - `Header`: Application header including user menu and theme toggle (Dark/Light Mode).
11
12
  - `LoginPage`: Standard login page.
12
13
  - `SmartList`, `RelatedList`: Highly encapsulated generic list and detail components. (**Note**: To use `defaultVisible` prop, import `@cundi/refine-xaf/dist/antd-column-ext` in your app entry)
13
14
  - `TiptapEditor`: Rich text editor with support for Images, Tables, Tasks, Math (LaTeX), YouTube, Emoji, Highlight, and Text Color.
14
15
  - `DrawioEditor`: Draw.io diagram editor with i18n language sync support.
16
+ - `Base64Upload`: Image upload component for XAF byte[] fields.
15
17
  - `ApplicationUser`: Complete user management (List, Create, Edit, Role Assignment).
16
18
  - `PermissionPolicyRole`: Complete role and permission management.
19
+ - `TriggerRule`: Webhook trigger rule management (List, Create, Edit).
20
+ - `TriggerLog`: Webhook execution log viewer with detail drawer.
21
+ - `MirrorTypeMappingConfig`: Data mirror type mapping configuration.
17
22
 
18
23
  ## How to use in a new project
19
24
 
@@ -220,6 +225,36 @@ export const DemoObjectList = () => {
220
225
  };
221
226
  ```
222
227
 
228
+ ### SmartList with Navigation Properties
229
+
230
+ To display data from related entities, use the `meta` prop with `expand` and nested `dataIndex`:
231
+
232
+ ```tsx
233
+ import { SmartList } from "@cundi/refine-xaf";
234
+ import { Table, Typography } from "antd";
235
+
236
+ const { Text } = Typography;
237
+
238
+ export const OrderList = () => {
239
+ return (
240
+ <SmartList
241
+ searchFields={["OrderNumber"]}
242
+ meta={{ expand: ["Customer"] }} // OData $expand
243
+ >
244
+ <Table.Column dataIndex="OrderNumber" title="Order #" defaultVisible />
245
+ {/* Nested dataIndex for navigation property */}
246
+ <Table.Column
247
+ dataIndex={["Customer", "Name"]}
248
+ title="Customer"
249
+ render={(value) => value ? <Text>{value}</Text> : '-'}
250
+ defaultVisible
251
+ />
252
+ <Table.Column dataIndex="Total" title="Total" />
253
+ </SmartList>
254
+ );
255
+ };
256
+ ```
257
+
223
258
  ### Create/Edit Page
224
259
 
225
260
  Use standard Refine hooks (`useForm`) combined with Ant Design Form components. For file uploads (like Images), use the `Base64Upload` component provided by the SDK.
@@ -326,7 +361,18 @@ console.log(claims.sub, claims.exp);
326
361
 
327
362
  ## Changelog
328
363
 
329
- ### v1.0.5 (Latest)
364
+ ### v1.0.8 (Latest)
365
+ - Added `TriggerRuleList`, `TriggerRuleCreate`, `TriggerRuleEdit` components
366
+ - Added `TriggerLogList` component with detail drawer
367
+ - Added `MirrorTypeMappingConfigList`, `MirrorTypeMappingConfigCreate`, `MirrorTypeMappingConfigEdit` components
368
+ - Added `meta` prop to `SmartList` for OData `$expand` support
369
+ - Added support for nested `dataIndex` (array format) in `SmartList`
370
+ - Added `getList` support for `meta.expand` in Data Provider
371
+ - Added `useModelTypes` hook for dynamic type selection
372
+ - Full i18n support for all new components (en, zh-TW)
373
+ - Filtered TriggerRule/TriggerLog from target type selection to prevent recursion
374
+
375
+ ### v1.0.5
330
376
  - Added `DrawioEditor` component for Draw.io diagram editing
331
377
  - DrawioEditor supports automatic i18n language synchronization
332
378
  - Added `react-drawio` dependency
package/dist/index.d.mts CHANGED
@@ -109,6 +109,95 @@ interface IJwtClaims {
109
109
  /** Allow additional claims */
110
110
  [key: string]: unknown;
111
111
  }
112
+ /**
113
+ * HTTP method types for webhook requests
114
+ */
115
+ declare enum HttpMethodType {
116
+ Post = "Post",
117
+ Get = "Get",
118
+ Put = "Put",
119
+ Patch = "Patch",
120
+ Delete = "Delete"
121
+ }
122
+ /**
123
+ * Trigger event types
124
+ */
125
+ declare enum TriggerEventType {
126
+ Create = "Create",
127
+ Update = "Update",
128
+ Delete = "Delete"
129
+ }
130
+ /**
131
+ * Trigger rule configuration for webhook automation
132
+ */
133
+ interface ITriggerRule extends IXafEntity {
134
+ /** Rule name */
135
+ Name: string;
136
+ /** Optional description */
137
+ Description?: string;
138
+ /** Full type name of the monitored object */
139
+ TargetTypeName?: string;
140
+ /** Trigger on object creation */
141
+ OnCreated: boolean;
142
+ /** Trigger on object modification */
143
+ OnModified: boolean;
144
+ /** Trigger on object deletion */
145
+ OnRemoved: boolean;
146
+ /** Whether the rule is active */
147
+ IsActive: boolean;
148
+ /** HTTP method for webhook */
149
+ HttpMethod: HttpMethodType;
150
+ /** Webhook URL */
151
+ WebhookUrl: string;
152
+ /** Custom headers in JSON format */
153
+ CustomHeaders?: string;
154
+ /** Only trigger if object matches criteria */
155
+ OnlyObjectFitsCriteria: boolean;
156
+ /** Criteria expression */
157
+ Criteria?: string;
158
+ /** Associated logs */
159
+ TriggerLogs?: ITriggerLog[];
160
+ }
161
+ /**
162
+ * Trigger execution log
163
+ */
164
+ interface ITriggerLog extends IXafEntity {
165
+ /** Associated trigger rule */
166
+ TriggerRule?: ITriggerRule;
167
+ /** Execution timestamp */
168
+ ExecutionTime: string;
169
+ /** Object type that triggered the webhook */
170
+ ObjectType: string;
171
+ /** Object primary key */
172
+ ObjectKey: string;
173
+ /** Event type */
174
+ EventType: TriggerEventType;
175
+ /** HTTP method used */
176
+ HttpMethod: HttpMethodType;
177
+ /** Whether execution was successful */
178
+ IsSuccess: boolean;
179
+ /** HTTP status code */
180
+ StatusCode?: number;
181
+ /** Response body */
182
+ ResponseBody?: string;
183
+ /** Error message if failed */
184
+ ErrorMessage?: string;
185
+ /** JSON payload sent */
186
+ Payload?: string;
187
+ }
188
+ /**
189
+ * Mirror type mapping configuration for cross-system data sync
190
+ */
191
+ interface IMirrorTypeMappingConfig extends IXafEntity {
192
+ /** Source system type name */
193
+ SourceTypeName: string;
194
+ /** Local type name */
195
+ LocalTypeName?: string;
196
+ /** Whether this mapping is active */
197
+ IsActive: boolean;
198
+ /** Optional description */
199
+ Description?: string;
200
+ }
112
201
 
113
202
  declare const TOKEN_KEY = "refine-auth";
114
203
  declare class HttpError extends Error {
@@ -293,6 +382,117 @@ declare const refineXafTranslations: {
293
382
  roles: string;
294
383
  settings: string;
295
384
  backgroundJobs: string;
385
+ triggerRules: string;
386
+ triggerLogs: string;
387
+ mirrorConfigs: string;
388
+ };
389
+ users: {
390
+ fields: {
391
+ photo: string;
392
+ displayName: string;
393
+ userName: string;
394
+ email: string;
395
+ isActive: string;
396
+ accessFailedCount: string;
397
+ };
398
+ actions: {
399
+ resetPassword: string;
400
+ };
401
+ resetPasswordModal: {
402
+ title: string;
403
+ newPassword: string;
404
+ inputPlaceholder: string;
405
+ inputRequired: string;
406
+ generatePassword: string;
407
+ };
408
+ };
409
+ roles: {
410
+ fields: {
411
+ name: string;
412
+ isAdministrative: string;
413
+ permissionPolicy: string;
414
+ typePermissions: string;
415
+ };
416
+ };
417
+ triggerRules: {
418
+ fields: {
419
+ name: string;
420
+ description: string;
421
+ targetTypeName: string;
422
+ onCreated: string;
423
+ onModified: string;
424
+ onRemoved: string;
425
+ isActive: string;
426
+ httpMethod: string;
427
+ webhookUrl: string;
428
+ customHeaders: string;
429
+ onlyObjectFitsCriteria: string;
430
+ criteria: string;
431
+ triggerEvents: string;
432
+ };
433
+ tooltips: {
434
+ targetTypeName: string;
435
+ customHeaders: string;
436
+ criteria: string;
437
+ };
438
+ placeholders: {
439
+ name: string;
440
+ description: string;
441
+ webhookUrl: string;
442
+ customHeaders: string;
443
+ criteria: string;
444
+ };
445
+ validation: {
446
+ nameRequired: string;
447
+ webhookUrlRequired: string;
448
+ webhookUrlInvalid: string;
449
+ };
450
+ };
451
+ triggerLogs: {
452
+ fields: {
453
+ executionTime: string;
454
+ status: string;
455
+ eventType: string;
456
+ objectType: string;
457
+ objectKey: string;
458
+ httpMethod: string;
459
+ statusCode: string;
460
+ error: string;
461
+ payload: string;
462
+ responseBody: string;
463
+ };
464
+ status: {
465
+ success: string;
466
+ failed: string;
467
+ };
468
+ drawer: {
469
+ title: string;
470
+ };
471
+ };
472
+ mirrorConfigs: {
473
+ fields: {
474
+ sourceTypeName: string;
475
+ localTypeName: string;
476
+ isActive: string;
477
+ description: string;
478
+ status: string;
479
+ };
480
+ tooltips: {
481
+ sourceTypeName: string;
482
+ localTypeName: string;
483
+ };
484
+ placeholders: {
485
+ sourceTypeName: string;
486
+ description: string;
487
+ };
488
+ validation: {
489
+ sourceTypeNameRequired: string;
490
+ localTypeNameRequired: string;
491
+ };
492
+ statusLabels: {
493
+ active: string;
494
+ inactive: string;
495
+ };
296
496
  };
297
497
  backgroundJobs: {
298
498
  title: string;
@@ -443,6 +643,117 @@ declare const refineXafTranslations: {
443
643
  roles: string;
444
644
  settings: string;
445
645
  backgroundJobs: string;
646
+ triggerRules: string;
647
+ triggerLogs: string;
648
+ mirrorConfigs: string;
649
+ };
650
+ users: {
651
+ fields: {
652
+ photo: string;
653
+ displayName: string;
654
+ userName: string;
655
+ email: string;
656
+ isActive: string;
657
+ accessFailedCount: string;
658
+ };
659
+ actions: {
660
+ resetPassword: string;
661
+ };
662
+ resetPasswordModal: {
663
+ title: string;
664
+ newPassword: string;
665
+ inputPlaceholder: string;
666
+ inputRequired: string;
667
+ generatePassword: string;
668
+ };
669
+ };
670
+ roles: {
671
+ fields: {
672
+ name: string;
673
+ isAdministrative: string;
674
+ permissionPolicy: string;
675
+ typePermissions: string;
676
+ };
677
+ };
678
+ triggerRules: {
679
+ fields: {
680
+ name: string;
681
+ description: string;
682
+ targetTypeName: string;
683
+ onCreated: string;
684
+ onModified: string;
685
+ onRemoved: string;
686
+ isActive: string;
687
+ httpMethod: string;
688
+ webhookUrl: string;
689
+ customHeaders: string;
690
+ onlyObjectFitsCriteria: string;
691
+ criteria: string;
692
+ triggerEvents: string;
693
+ };
694
+ tooltips: {
695
+ targetTypeName: string;
696
+ customHeaders: string;
697
+ criteria: string;
698
+ };
699
+ placeholders: {
700
+ name: string;
701
+ description: string;
702
+ webhookUrl: string;
703
+ customHeaders: string;
704
+ criteria: string;
705
+ };
706
+ validation: {
707
+ nameRequired: string;
708
+ webhookUrlRequired: string;
709
+ webhookUrlInvalid: string;
710
+ };
711
+ };
712
+ triggerLogs: {
713
+ fields: {
714
+ executionTime: string;
715
+ status: string;
716
+ eventType: string;
717
+ objectType: string;
718
+ objectKey: string;
719
+ httpMethod: string;
720
+ statusCode: string;
721
+ error: string;
722
+ payload: string;
723
+ responseBody: string;
724
+ };
725
+ status: {
726
+ success: string;
727
+ failed: string;
728
+ };
729
+ drawer: {
730
+ title: string;
731
+ };
732
+ };
733
+ mirrorConfigs: {
734
+ fields: {
735
+ sourceTypeName: string;
736
+ localTypeName: string;
737
+ isActive: string;
738
+ description: string;
739
+ status: string;
740
+ };
741
+ tooltips: {
742
+ sourceTypeName: string;
743
+ localTypeName: string;
744
+ };
745
+ placeholders: {
746
+ sourceTypeName: string;
747
+ description: string;
748
+ };
749
+ validation: {
750
+ sourceTypeNameRequired: string;
751
+ localTypeNameRequired: string;
752
+ };
753
+ statusLabels: {
754
+ active: string;
755
+ inactive: string;
756
+ };
446
757
  };
447
758
  backgroundJobs: {
448
759
  title: string;
@@ -503,8 +814,12 @@ interface SmartListProps {
503
814
  children?: React.ReactNode;
504
815
  resource?: string;
505
816
  searchFields?: string[];
817
+ meta?: {
818
+ expand?: string[];
819
+ [key: string]: any;
820
+ };
506
821
  }
507
- declare const SmartList: <T extends BaseRecord = BaseRecord>({ children, resource, searchFields, }: SmartListProps) => React.JSX.Element;
822
+ declare const SmartList: <T extends BaseRecord = BaseRecord>({ children, resource, searchFields, meta, }: SmartListProps) => React.JSX.Element;
508
823
 
509
824
  interface RelatedListProps<TItem extends BaseRecord> {
510
825
  resource: string;
@@ -589,6 +904,48 @@ interface BackgroundJobListProps {
589
904
  */
590
905
  declare const BackgroundJobList: React.FC<BackgroundJobListProps>;
591
906
 
907
+ /**
908
+ * TriggerRule list page component
909
+ * Displays webhook trigger rules with their configurations
910
+ */
911
+ declare const TriggerRuleList: React.FC<IResourceComponentsProps>;
912
+
913
+ /**
914
+ * TriggerRule create page component
915
+ * Form for creating new webhook trigger rules
916
+ */
917
+ declare const TriggerRuleCreate: React.FC<IResourceComponentsProps>;
918
+
919
+ /**
920
+ * TriggerRule edit page component
921
+ * Form for editing existing webhook trigger rules
922
+ */
923
+ declare const TriggerRuleEdit: React.FC<IResourceComponentsProps>;
924
+
925
+ /**
926
+ * TriggerLog list page component
927
+ * Displays webhook execution logs
928
+ */
929
+ declare const TriggerLogList: React.FC<IResourceComponentsProps>;
930
+
931
+ /**
932
+ * MirrorTypeMappingConfig list page component
933
+ * Displays type mapping configurations for cross-system data synchronization
934
+ */
935
+ declare const MirrorTypeMappingConfigList: React.FC<IResourceComponentsProps>;
936
+
937
+ /**
938
+ * MirrorTypeMappingConfig create page component
939
+ * Form for creating new type mapping configurations
940
+ */
941
+ declare const MirrorTypeMappingConfigCreate: React.FC<IResourceComponentsProps>;
942
+
943
+ /**
944
+ * MirrorTypeMappingConfig edit page component
945
+ * Form for editing existing type mapping configurations
946
+ */
947
+ declare const MirrorTypeMappingConfigEdit: React.FC<IResourceComponentsProps>;
948
+
592
949
  type ColorModeContextType = {
593
950
  mode: "light" | "dark";
594
951
  setMode: (mode: "light" | "dark") => void;
@@ -607,4 +964,4 @@ interface IModelType {
607
964
  }
608
965
  declare const useModelTypes: () => _tanstack_react_query.UseQueryResult<IModelType[], Error>;
609
966
 
610
- export { ApplicationUserCreate, ApplicationUserEdit, ApplicationUserList, AuthCallback, BackgroundJobList, type BackgroundJobListProps, Base64Upload, ColorModeContext, ColorModeContextProvider, DrawioEditor, type DrawioEditorProps, Header, HttpError, type IApplicationUser, type IJwtClaims, type IModelType, type IPermissionPolicyRole, type IPermissionPolicyTypePermissionObject, type IXafEntity, KeycloakLoginPage, type KeycloakTokenResponse, LoginPage, RelatedList, type RequestOptions, RoleCreate, RoleEdit, RoleList, SecurityPermissionPolicy, SecurityPermissionState, SmartList, TOKEN_KEY, TiptapEditor, type TiptapEditorProps, authProvider, authService, dataProvider, generatePassword, getBaseUrl, httpClient, keycloakService, parseJwt, refineXafTranslations, useColorMode, useModelTypes, validatePasswordStrength };
967
+ export { ApplicationUserCreate, ApplicationUserEdit, ApplicationUserList, AuthCallback, BackgroundJobList, type BackgroundJobListProps, Base64Upload, ColorModeContext, ColorModeContextProvider, DrawioEditor, type DrawioEditorProps, Header, HttpError, HttpMethodType, type IApplicationUser, type IJwtClaims, type IMirrorTypeMappingConfig, type IModelType, type IPermissionPolicyRole, type IPermissionPolicyTypePermissionObject, type ITriggerLog, type ITriggerRule, type IXafEntity, KeycloakLoginPage, type KeycloakTokenResponse, LoginPage, MirrorTypeMappingConfigCreate, MirrorTypeMappingConfigEdit, MirrorTypeMappingConfigList, RelatedList, type RequestOptions, RoleCreate, RoleEdit, RoleList, SecurityPermissionPolicy, SecurityPermissionState, SmartList, TOKEN_KEY, TiptapEditor, type TiptapEditorProps, TriggerEventType, TriggerLogList, TriggerRuleCreate, TriggerRuleEdit, TriggerRuleList, authProvider, authService, dataProvider, generatePassword, getBaseUrl, httpClient, keycloakService, parseJwt, refineXafTranslations, useColorMode, useModelTypes, validatePasswordStrength };