openxiangda 1.0.85 → 1.0.87

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 (31) hide show
  1. package/README.md +28 -0
  2. package/lib/cli.js +482 -10
  3. package/openxiangda-skills/SKILL.md +5 -1
  4. package/openxiangda-skills/references/architecture-design.md +29 -0
  5. package/openxiangda-skills/references/openxiangda-api.md +105 -3
  6. package/openxiangda-skills/references/pages/page-sdk.md +35 -0
  7. package/openxiangda-skills/references/permissions-settings.md +39 -2
  8. package/openxiangda-skills/references/resource-manifest-cheatsheet.md +70 -4
  9. package/package.json +2 -1
  10. package/packages/sdk/dist/runtime/index.cjs +3590 -3388
  11. package/packages/sdk/dist/runtime/index.cjs.map +1 -1
  12. package/packages/sdk/dist/runtime/index.d.mts +4 -1001
  13. package/packages/sdk/dist/runtime/index.d.ts +4 -1001
  14. package/packages/sdk/dist/runtime/index.mjs +3049 -2849
  15. package/packages/sdk/dist/runtime/index.mjs.map +1 -1
  16. package/packages/sdk/dist/runtime/react.cjs +2793 -116
  17. package/packages/sdk/dist/runtime/react.cjs.map +1 -1
  18. package/packages/sdk/dist/runtime/react.d.mts +1394 -2
  19. package/packages/sdk/dist/runtime/react.d.ts +1394 -2
  20. package/packages/sdk/dist/runtime/react.mjs +2749 -84
  21. package/packages/sdk/dist/runtime/react.mjs.map +1 -1
  22. package/templates/openxiangda-react-spa/AGENTS.md +29 -0
  23. package/templates/openxiangda-react-spa/src/app/router.tsx +21 -1
  24. package/templates/openxiangda-react-spa/src/pages/public/PublicRegisterPage.tsx +15 -0
  25. package/templates/openxiangda-react-spa/src/resources/permissions/page-groups/public-visitor.json +8 -0
  26. package/templates/openxiangda-react-spa/src/resources/public-access/public-register.json +14 -0
  27. package/templates/openxiangda-react-spa/src/resources/routes/public-register.json +8 -0
  28. package/templates/openxiangda-react-spa/tsconfig.app.json +1 -1
  29. package/templates/openxiangda-react-spa/vite.config.ts +1 -1
  30. package/packages/sdk/dist/openxiangdaProvider-CaXMpsnK.d.mts +0 -328
  31. package/packages/sdk/dist/openxiangdaProvider-CaXMpsnK.d.ts +0 -328
@@ -1,2 +1,1394 @@
1
- import 'react';
2
- export { A as AppAuthClient, a as AuthClientError, c as AuthMethod, d as AuthMethodType, e as AuthTokenData, D as DingTalkLoginInput, G as GuestLoginInput, L as LoginMethodsResult, g as LoginPage, h as LoginPageProps, O as OpenXiangdaProvider, i as OpenXiangdaProviderProps, P as PasswordLoginInput, j as PermissionBoundary, k as PermissionBoundaryFallback, l as PermissionBoundaryFallbackState, m as PermissionBoundaryProps, n as PhoneCodeInput, o as PhoneCodeLoginInput, p as PhoneCodeRegisterInput, q as PhoneCodeSendResult, R as RefreshInput, r as ResolveLoginUrlInput, s as RouteAccessResult, t as RuntimeBootstrap, u as RuntimeErrorSnapshot, v as RuntimeErrorType, w as RuntimeHttpError, x as RuntimeLogoutOptions, y as RuntimeMenuItem, z as RuntimePagePermissions, B as RuntimeRedirectLoginOptions, C as RuntimeRequestError, E as RuntimeRequestState, F as RuntimeResolveLoginOptions, S as SsoLoginUrlInput, H as SsoLoginUrlResult, U as UseAuthOptions, I as UseCanAccessRouteInput, J as UseLoginMethodsState, K as createAuthClient, M as useAppMenus, N as useAuth, Q as useCanAccessRoute, T as useLoginMethods, V as useOpenXiangda, W as usePermission, X as useRuntimeAuth, Y as useRuntimeBootstrap } from '../openxiangdaProvider-CaXMpsnK.mjs';
1
+ import React__default, { Dispatch, SetStateAction, CSSProperties } from 'react';
2
+
3
+ type PageQueryValue = string | string[];
4
+ type PageHttpMethod = "get" | "post" | "put" | "delete" | "patch";
5
+ type PageScope = "platform" | "app";
6
+ type PageUiPermissionType = "route" | "button";
7
+ interface FieldPermissionDto {
8
+ componentName: string;
9
+ fieldName: string;
10
+ label: string;
11
+ value: "FORM_FILED_EDIT" | "FORM_FILED_VIEW" | "FORM_FILED_HIDDEN";
12
+ }
13
+ type FieldAccessLevel = "edit" | "readonly" | "hidden";
14
+ interface FieldAccessPolicyItemDto {
15
+ fieldId: string;
16
+ access: FieldAccessLevel;
17
+ }
18
+ interface FieldAccessPolicyDto {
19
+ defaultAccess: FieldAccessLevel;
20
+ fields?: FieldAccessPolicyItemDto[];
21
+ }
22
+ type ViewFieldPermissionValue = "FORM_FILED_EDIT" | "FORM_FILED_VIEW" | "FORM_FILED_HIDDEN";
23
+ interface DataPermissionRuleDto {
24
+ field: string;
25
+ componentType?: string;
26
+ op: string;
27
+ value: unknown;
28
+ }
29
+ interface DataPermissionConditionDto {
30
+ logic: "AND" | "OR";
31
+ rules?: DataPermissionRuleDto[];
32
+ conditions?: DataPermissionConditionDto[];
33
+ }
34
+ interface DataPermissionDto {
35
+ type: "condition" | "sql";
36
+ condition?: DataPermissionConditionDto;
37
+ logic?: "AND" | "OR";
38
+ rules?: DataPermissionRuleDto[];
39
+ expression?: string;
40
+ }
41
+ type SearchLogic = "AND" | "OR";
42
+ type SearchOperator = "EQ" | "NEQ" | "LIKE" | "ILIKE" | "MATCH" | "CONTAINS" | "NOT_CONTAINS" | "IN" | "IS_NULL" | "IS_NOT_NULL" | "GT" | "GTE" | "GE" | "LT" | "LTE" | "LE" | "BETWEEN" | "EXISTS" | "NOT_EXISTS" | "PATH_EQ" | string;
43
+ type SearchComponentName = "TextField" | "TextareaField" | "EditorField" | "SerialNumberField" | "NumberField" | "DateField" | "CascadeDateField" | "SelectField" | "RadioField" | "MultiSelectField" | "CheckboxField" | "CascadeSelectField" | "DepartmentSelectField" | "EmployeeSelectField" | "UserSelectField" | "JSONField" | "SubFormField" | string;
44
+ type SearchSystemField = "createTime" | "modifiedTime" | "processInstanceId" | "processInstanceTitle" | "originator" | "originatorName" | "originatorCorp" | "created_at" | "updated_at" | "form_instance_id" | "instance_title" | "created_by" | "created_by_name" | "created_by_department_id";
45
+ type SearchFieldKey = SearchSystemField | string;
46
+ type InstanceStatus = "pending" | "running" | "completed" | "terminated" | "waiting" | "withdrawn";
47
+ interface PageAppInfo {
48
+ appType: string;
49
+ tenantId: string;
50
+ }
51
+ interface PageRouteInfo {
52
+ pathname: string;
53
+ fullPath: string;
54
+ params: Record<string, string | undefined>;
55
+ query: Record<string, PageQueryValue>;
56
+ hash: string;
57
+ }
58
+ interface PageDepartmentInfo {
59
+ id?: string;
60
+ name?: string;
61
+ externalId?: string | null;
62
+ }
63
+ interface PageDepartmentRecord extends PageDepartmentInfo {
64
+ id: string;
65
+ parentId?: string | null;
66
+ key?: string;
67
+ title?: string;
68
+ hasChildren?: boolean;
69
+ isLeaf?: boolean;
70
+ children?: PageDepartmentRecord[];
71
+ supervisorUserIds?: string[];
72
+ supervisors?: Array<{
73
+ id: string;
74
+ name: string;
75
+ }>;
76
+ createdAt?: string | Date;
77
+ updatedAt?: string | Date;
78
+ [key: string]: unknown;
79
+ }
80
+ interface GetParentDepartmentsOptions {
81
+ includeSelf?: boolean;
82
+ }
83
+ interface CurrentUserDepartmentParents {
84
+ department: PageDepartmentInfo;
85
+ parents: PageDepartmentRecord[];
86
+ }
87
+ type PageUserType = "normal" | "guest";
88
+ interface PageUserInfo {
89
+ id: string;
90
+ username: string;
91
+ name?: string;
92
+ jobNumber?: string;
93
+ phone?: string | null;
94
+ email?: string | null;
95
+ avatar?: string | null;
96
+ departments?: PageDepartmentInfo[];
97
+ affiliatedDepartmentId?: string | null;
98
+ affiliatedDepartment?: PageDepartmentInfo | null;
99
+ tenantId: string;
100
+ isGuest?: boolean;
101
+ userType?: PageUserType;
102
+ [key: string]: unknown;
103
+ }
104
+ interface PagePermissionInfo {
105
+ canView: boolean;
106
+ hasFullAccess: boolean;
107
+ [key: string]: unknown;
108
+ }
109
+ interface SearchSortItem {
110
+ id: string;
111
+ isAsc: "y" | "n";
112
+ }
113
+ interface SearchRule {
114
+ key: SearchFieldKey;
115
+ componentName?: Exclude<SearchComponentName, "SubFormField">;
116
+ operator?: Exclude<SearchOperator, "EXISTS" | "NOT_EXISTS">;
117
+ value?: unknown;
118
+ type?: string;
119
+ }
120
+ interface SearchGroup {
121
+ logic?: SearchLogic;
122
+ rules?: Array<SearchRule | SubFormRule>;
123
+ conditions?: SearchGroup[];
124
+ }
125
+ interface SubFormRule {
126
+ key: string;
127
+ componentName: "SubFormField";
128
+ operator?: "EXISTS" | "NOT_EXISTS" | "IS_NULL" | "IS_NOT_NULL";
129
+ value?: SearchGroup;
130
+ type?: string;
131
+ }
132
+ type SearchExpression = SearchRule | SubFormRule | Array<SearchRule | SubFormRule> | Array<Record<string, unknown>> | SearchGroup | Record<string, unknown>;
133
+ interface PageDataSourceDescriptor {
134
+ key: string;
135
+ type: string;
136
+ formUuid?: string;
137
+ fields?: string[];
138
+ permission?: "read" | "write" | string;
139
+ defaultFilter?: SearchExpression | string;
140
+ [key: string]: unknown;
141
+ }
142
+ type CustomPageEntryMode = "app-shell" | "plain-page";
143
+ interface CustomPageEntryConfig {
144
+ mode?: CustomPageEntryMode | string;
145
+ hidePlatformNav?: boolean;
146
+ defaultRoute?: string;
147
+ [key: string]: unknown;
148
+ }
149
+ interface PageInfo {
150
+ id: string;
151
+ code: string;
152
+ name: string;
153
+ type: string;
154
+ rendererType: string;
155
+ routeKey: string;
156
+ legacyFormUuid?: string;
157
+ status: string;
158
+ props: Record<string, unknown>;
159
+ route: Record<string, unknown> | object;
160
+ entry?: CustomPageEntryConfig;
161
+ dataSources: PageDataSourceDescriptor[];
162
+ capabilities: Record<string, unknown>;
163
+ version?: string;
164
+ buildId?: string;
165
+ [key: string]: unknown;
166
+ }
167
+ interface PageMessageApi {
168
+ success(text: string): void;
169
+ error(text: string): void;
170
+ warning(text: string): void;
171
+ info(text: string): void;
172
+ loading(text: string): () => void;
173
+ }
174
+ interface PageModalApi {
175
+ confirm(input: {
176
+ title: string;
177
+ content: string;
178
+ }): Promise<boolean>;
179
+ }
180
+ interface PageNavigationApi {
181
+ /**
182
+ * pageKey accepts legacy formUuid, routeKey, or pageCode.
183
+ * Custom pages should prefer routeKey/pageCode over hard-coded legacy formUuid.
184
+ */
185
+ pushPage(pageKey: string, query?: Record<string, unknown>): void;
186
+ replacePage(pageKey: string, query?: Record<string, unknown>): void;
187
+ pushRoute(route: string, query?: Record<string, unknown>): void;
188
+ replaceRoute(route: string, query?: Record<string, unknown>): void;
189
+ updateQuery(query: Record<string, unknown>): void;
190
+ setHash(hash: string): void;
191
+ back(): void;
192
+ }
193
+ interface PageBridgeApi {
194
+ invoke<T = unknown>(method: string, payload?: unknown): Promise<T>;
195
+ subscribe?(event: string, listener: (payload: unknown) => void): () => void;
196
+ }
197
+ interface PageSdkMeta {
198
+ packageName?: string;
199
+ version?: string | null;
200
+ supportedBridgeMethods?: string[];
201
+ }
202
+ interface PageApiResponse<TResult = unknown, TRaw = TResult> {
203
+ code: number;
204
+ success: boolean;
205
+ message?: string;
206
+ result: TResult | null;
207
+ data?: TRaw;
208
+ raw?: unknown;
209
+ }
210
+ interface PageBinaryResponse {
211
+ blob: Blob;
212
+ fileName?: string;
213
+ contentType?: string;
214
+ headers?: Record<string, string | undefined>;
215
+ raw?: unknown;
216
+ }
217
+ interface PageListResult<TItem = unknown> {
218
+ currentPage: number;
219
+ data: TItem[];
220
+ totalCount: number;
221
+ }
222
+ interface PageOffsetListResult<TItem = unknown> {
223
+ items: TItem[];
224
+ total: number;
225
+ page: number;
226
+ limit: number;
227
+ }
228
+ interface PageContext {
229
+ protocolVersion: string;
230
+ app: PageAppInfo;
231
+ page: PageInfo;
232
+ user: PageUserInfo;
233
+ route: PageRouteInfo;
234
+ env: Record<string, unknown>;
235
+ permissions: PagePermissionInfo;
236
+ capabilities: string[];
237
+ ui: {
238
+ message: PageMessageApi;
239
+ modal: PageModalApi;
240
+ };
241
+ navigation: PageNavigationApi;
242
+ bridge: PageBridgeApi;
243
+ sdk?: PageSdkMeta;
244
+ }
245
+ interface PageRequestOptions<TQuery = Record<string, unknown>, TBody = unknown> {
246
+ path: string;
247
+ method: PageHttpMethod;
248
+ query?: TQuery;
249
+ body?: TBody;
250
+ headers?: Record<string, string>;
251
+ }
252
+ interface PageTransportRequestPayload<TBody = unknown> {
253
+ path: string;
254
+ method: PageHttpMethod;
255
+ query?: string;
256
+ body?: TBody;
257
+ headers?: Record<string, string>;
258
+ }
259
+ interface PageTransportDownloadPayload<TBody = unknown> {
260
+ path: string;
261
+ method: PageHttpMethod;
262
+ query?: string;
263
+ body?: TBody;
264
+ headers?: Record<string, string>;
265
+ }
266
+ interface PageSdkError extends Error {
267
+ method?: string;
268
+ path?: string;
269
+ response?: PageApiResponse<unknown>;
270
+ raw?: unknown;
271
+ }
272
+ interface FormGetDetailParams {
273
+ formUuid: string;
274
+ formInstId?: string;
275
+ formInstanceId?: string;
276
+ appType?: string;
277
+ }
278
+ interface FormCreateParams {
279
+ formUuid: string;
280
+ appType?: string;
281
+ data: Record<string, unknown>;
282
+ }
283
+ interface FormUpdateParams {
284
+ formUuid: string;
285
+ appType?: string;
286
+ formInstId?: string;
287
+ formInstanceId?: string;
288
+ data?: Record<string, unknown>;
289
+ updateFormDataJson?: string;
290
+ }
291
+ interface FormRemoveParams {
292
+ formUuid: string;
293
+ appType?: string;
294
+ formInstId?: string;
295
+ formInstanceId?: string;
296
+ }
297
+ interface FormChangeRecordParams {
298
+ formUuid: string;
299
+ appType?: string;
300
+ formInstId?: string;
301
+ formInstanceId?: string;
302
+ page?: number;
303
+ pageSize?: number;
304
+ }
305
+ interface FormSearchParams {
306
+ formUuid: string;
307
+ appType?: string;
308
+ search?: SearchExpression;
309
+ currentPage?: number;
310
+ pageSize?: number;
311
+ originatorId?: string;
312
+ createFrom?: string;
313
+ createTo?: string;
314
+ modifiedFrom?: string;
315
+ modifiedTo?: string;
316
+ dynamicOrder?: string | SearchSortItem;
317
+ instanceStatus?: InstanceStatus;
318
+ }
319
+ interface FormAdvancedSearchParams {
320
+ formUuid: string;
321
+ appType?: string;
322
+ filters?: SearchExpression;
323
+ conditionType?: SearchLogic;
324
+ searchKeyWord?: string;
325
+ currentPage?: number;
326
+ pageSize?: number;
327
+ order?: SearchSortItem | SearchSortItem[];
328
+ instanceStatus?: InstanceStatus;
329
+ }
330
+ interface DataViewQueryParams {
331
+ appType?: string;
332
+ fields?: string[];
333
+ filters?: SearchExpression | string;
334
+ conditionType?: SearchLogic;
335
+ searchKeyWord?: string;
336
+ currentPage?: number;
337
+ pageSize?: number;
338
+ order?: SearchSortItem | SearchSortItem[];
339
+ }
340
+ interface DataViewStatsParams extends DataViewQueryParams {
341
+ having?: SearchExpression | string;
342
+ }
343
+ interface DataViewQueryResult<TItem = unknown> extends PageListResult<TItem> {
344
+ pageSize: number;
345
+ storageMode?: "materialized" | "live";
346
+ lastRefreshedAt?: string | null;
347
+ }
348
+ interface FunctionInvokeParams<TInput = unknown> {
349
+ appType?: string;
350
+ input?: TInput;
351
+ }
352
+ interface FunctionInvokeResult<TResult = unknown> {
353
+ invocationId: string;
354
+ functionCode: string;
355
+ result: TResult;
356
+ output?: TResult;
357
+ variables?: Record<string, unknown>;
358
+ logs?: unknown[];
359
+ duration?: number;
360
+ }
361
+ interface FormExportParams extends FormAdvancedSearchParams {
362
+ exportAll?: "y" | "n";
363
+ embedImages?: "y" | "n";
364
+ exportFields?: string[];
365
+ }
366
+ interface FormImportParams {
367
+ formUuid: string;
368
+ appType?: string;
369
+ fileBase64: string;
370
+ fileName?: string;
371
+ }
372
+ interface ImportExportRecordQuery {
373
+ formUuid: string;
374
+ appType?: string;
375
+ currentPage?: number;
376
+ pageSize?: number;
377
+ }
378
+ interface ImportExportRecordDownloadParams {
379
+ appType?: string;
380
+ recordId: string;
381
+ }
382
+ interface DataManagementFilterState {
383
+ filters?: SearchExpression;
384
+ conditionType?: SearchLogic;
385
+ searchKeyWord?: string;
386
+ }
387
+ interface PageDataManagementConfig {
388
+ sort?: SearchSortItem[];
389
+ showFields?: string[];
390
+ filter?: DataManagementFilterState;
391
+ widths?: Record<string, number>;
392
+ lockFieldIds?: string[];
393
+ lineHeight?: number;
394
+ [key: string]: unknown;
395
+ }
396
+ interface DataManagementConfigParams {
397
+ formUuid: string;
398
+ appType?: string;
399
+ }
400
+ interface SaveDataManagementConfigParams extends DataManagementConfigParams {
401
+ config: PageDataManagementConfig;
402
+ }
403
+ interface PageUserRecord extends PageUserInfo {
404
+ phone?: string | null;
405
+ email?: string | null;
406
+ avatar?: string | null;
407
+ status?: string;
408
+ createdAt?: string;
409
+ updatedAt?: string;
410
+ validFrom?: string | null;
411
+ validTo?: string | null;
412
+ }
413
+ interface CreateUserParams {
414
+ id?: string;
415
+ username?: string;
416
+ password?: string;
417
+ phone?: string;
418
+ email?: string;
419
+ name: string;
420
+ avatar?: string;
421
+ departmentIds?: string[];
422
+ validFrom?: string | Date | null;
423
+ validTo?: string | Date | null;
424
+ }
425
+ interface UpdateUserParams extends Partial<CreateUserParams> {
426
+ id: string;
427
+ }
428
+ interface UserListParams {
429
+ ids?: string[];
430
+ departmentIds?: string[];
431
+ name?: string;
432
+ username?: string;
433
+ phone?: string;
434
+ email?: string;
435
+ page?: number;
436
+ pageSize?: number;
437
+ }
438
+ interface ValidateUserParams {
439
+ username: string;
440
+ password: string;
441
+ }
442
+ interface PageRoleRecord {
443
+ id: string;
444
+ name: string;
445
+ code: string;
446
+ scope: PageScope;
447
+ appType?: string;
448
+ description?: string;
449
+ createdAt?: string;
450
+ updatedAt?: string;
451
+ }
452
+ interface CreateRoleParams {
453
+ name: string;
454
+ code: string;
455
+ scope: PageScope;
456
+ appType?: string;
457
+ description?: string;
458
+ }
459
+ type UpdateRoleParams = Partial<CreateRoleParams>;
460
+ interface RoleListParams {
461
+ appType?: string;
462
+ name?: string;
463
+ code?: string;
464
+ page?: number;
465
+ limit?: number;
466
+ scope?: PageScope;
467
+ }
468
+ interface RoleUsersParams {
469
+ page?: number;
470
+ limit?: number;
471
+ keyword?: string;
472
+ }
473
+ interface AssignRolesParams {
474
+ userId: string;
475
+ roleIds: string[];
476
+ }
477
+ interface ChangeUserRoleParams {
478
+ userId: string;
479
+ roleId: string;
480
+ }
481
+ interface BatchAddUsersToRoleParams {
482
+ roleId: string;
483
+ userIds: string[];
484
+ }
485
+ interface GetUserRolesParams {
486
+ scope?: PageScope;
487
+ appType?: string;
488
+ }
489
+ interface SwitchPlatformRoleParams {
490
+ roleId: string;
491
+ }
492
+ interface SwitchAppRoleParams {
493
+ roleId: string;
494
+ appType?: string;
495
+ }
496
+ interface PageApiPermissionRecord {
497
+ id: string;
498
+ name: string;
499
+ code: string;
500
+ scope: PageScope;
501
+ method?: "GET" | "POST" | "PUT" | "DELETE" | "ANY";
502
+ path?: string;
503
+ appType?: string;
504
+ description?: string;
505
+ parentId?: string;
506
+ children?: PageApiPermissionRecord[];
507
+ }
508
+ interface PageUiPermissionRecord {
509
+ id: string;
510
+ name: string;
511
+ code: string;
512
+ type: PageUiPermissionType;
513
+ scope: PageScope;
514
+ appType?: string;
515
+ description?: string;
516
+ parentId?: string;
517
+ children?: PageUiPermissionRecord[];
518
+ }
519
+ interface CreateApiPermissionParams {
520
+ name: string;
521
+ code: string;
522
+ scope: PageScope;
523
+ method?: "GET" | "POST" | "PUT" | "DELETE" | "ANY";
524
+ path: string;
525
+ description?: string;
526
+ parentId?: string;
527
+ appType?: string;
528
+ }
529
+ type UpdateApiPermissionParams = Partial<CreateApiPermissionParams>;
530
+ interface ApiPermissionListParams {
531
+ code?: string;
532
+ scope?: PageScope;
533
+ appType?: string;
534
+ page?: number;
535
+ limit?: number;
536
+ }
537
+ interface AssignPermissionsParams {
538
+ roleId: string;
539
+ permissionIds: string[];
540
+ }
541
+ interface CreateUiPermissionParams {
542
+ name: string;
543
+ code: string;
544
+ type: PageUiPermissionType;
545
+ scope: PageScope;
546
+ appType?: string;
547
+ description?: string;
548
+ parentId?: string;
549
+ }
550
+ type UpdateUiPermissionParams = Partial<CreateUiPermissionParams>;
551
+ interface UiPermissionListParams extends ApiPermissionListParams {
552
+ type?: PageUiPermissionType;
553
+ }
554
+ interface FormPermissionGroup {
555
+ id: string;
556
+ appType: string;
557
+ formUuid: string;
558
+ name: string;
559
+ type: "submit" | "view";
560
+ roles: string[];
561
+ dataScope?: "all" | "self";
562
+ operations?: string[];
563
+ fieldPermissions?: FieldPermissionDto[];
564
+ fieldAccessPolicy?: FieldAccessPolicyDto | null;
565
+ dataPermission?: DataPermissionDto;
566
+ createdAt?: string;
567
+ updatedAt?: string;
568
+ }
569
+ type ViewOperationPermission = "view" | "edit" | "delete" | "change_records" | "workflow";
570
+ interface ViewPermissionSummary {
571
+ fieldPermissions: Record<string, ViewFieldPermissionValue>;
572
+ operations: ViewOperationPermission[];
573
+ }
574
+ interface CreateFormPermissionGroupDto {
575
+ appType: string;
576
+ formUuid: string;
577
+ name: string;
578
+ type: "submit" | "view";
579
+ roles: string[];
580
+ dataScope?: "all" | "self";
581
+ operations?: string[];
582
+ fieldPermissions?: FieldPermissionDto[];
583
+ fieldAccessPolicy?: FieldAccessPolicyDto | null;
584
+ dataPermission?: DataPermissionDto;
585
+ }
586
+ interface UpdateFormPermissionGroupDto {
587
+ appType?: string;
588
+ formUuid?: string;
589
+ name?: string;
590
+ type?: "submit" | "view";
591
+ roles?: string[];
592
+ dataScope?: "all" | "self";
593
+ operations?: string[];
594
+ fieldPermissions?: FieldPermissionDto[];
595
+ fieldAccessPolicy?: FieldAccessPolicyDto | null;
596
+ dataPermission?: DataPermissionDto;
597
+ }
598
+ interface QueryFormPermissionGroupDto {
599
+ appType?: string;
600
+ formUuid?: string;
601
+ type?: "submit" | "view";
602
+ name?: string;
603
+ page?: number;
604
+ limit?: number;
605
+ }
606
+ interface PagePermissionGroup {
607
+ id: string;
608
+ appType: string;
609
+ name: string;
610
+ roles: string[];
611
+ menuFormUuids: string[];
612
+ createdAt?: string;
613
+ updatedAt?: string;
614
+ }
615
+ interface CreatePagePermissionGroupDto {
616
+ appType: string;
617
+ name: string;
618
+ roles: string[];
619
+ menuFormUuids: string[];
620
+ }
621
+ interface UpdatePagePermissionGroupDto {
622
+ appType?: string;
623
+ name?: string;
624
+ roles?: string[];
625
+ menuFormUuids?: string[];
626
+ }
627
+ interface QueryPagePermissionGroupDto {
628
+ appType?: string;
629
+ name?: string;
630
+ page?: number;
631
+ limit?: number;
632
+ }
633
+ interface UserMenuPermissionsResponse {
634
+ appType: string;
635
+ menuFormUuids: string[];
636
+ hasFullAccess: boolean;
637
+ }
638
+ type NotificationChannel = "inapp" | "email" | "dingding" | "wechat" | "thirdparty_todo";
639
+ interface SendNotificationByTypeParams {
640
+ notificationType: string;
641
+ recipientId: string;
642
+ appType?: string;
643
+ formUuid?: string;
644
+ payload: Record<string, unknown>;
645
+ channels?: NotificationChannel[];
646
+ }
647
+ interface BatchSendNotificationByTypeParams {
648
+ notificationType: string;
649
+ appType?: string;
650
+ formUuid?: string;
651
+ recipients: Array<{
652
+ recipientId: string;
653
+ payload: Record<string, unknown>;
654
+ channels?: NotificationChannel[];
655
+ }>;
656
+ }
657
+ interface NotificationChannelConfig {
658
+ enabled?: boolean;
659
+ title?: string;
660
+ content?: string;
661
+ config?: Record<string, unknown>;
662
+ [key: string]: unknown;
663
+ }
664
+ interface NotificationChannelsConfig {
665
+ inapp?: NotificationChannelConfig;
666
+ email?: NotificationChannelConfig;
667
+ dingding?: NotificationChannelConfig;
668
+ wechat?: NotificationChannelConfig;
669
+ thirdparty_todo?: NotificationChannelConfig;
670
+ [key: string]: NotificationChannelConfig | undefined;
671
+ }
672
+ type NotificationConfigLevel = "platform" | "app" | "form";
673
+ interface NotificationTemplate {
674
+ id?: string;
675
+ code: string;
676
+ name: string;
677
+ content?: string;
678
+ description?: string;
679
+ level?: NotificationConfigLevel;
680
+ appType?: string;
681
+ formUuid?: string;
682
+ priority?: number;
683
+ enabled?: boolean;
684
+ variables?: string[];
685
+ channelsConfig?: NotificationChannelsConfig;
686
+ [key: string]: unknown;
687
+ }
688
+ interface NotificationTypeConfig {
689
+ id?: string;
690
+ notificationType: string;
691
+ level?: NotificationConfigLevel;
692
+ appType?: string;
693
+ formUuid?: string;
694
+ templateId?: string;
695
+ template?: NotificationTemplate;
696
+ enabled?: boolean;
697
+ priority?: number;
698
+ description?: string;
699
+ [key: string]: unknown;
700
+ }
701
+ interface PreviewNotificationTemplateParams {
702
+ appType?: string;
703
+ templateId?: string;
704
+ templateCode?: string;
705
+ code?: string;
706
+ level?: "app" | "form";
707
+ formUuid?: string;
708
+ payload?: Record<string, unknown>;
709
+ }
710
+ interface NotificationTemplatePreview {
711
+ defaultContent?: string;
712
+ channelPreviews?: Record<string, string>;
713
+ enabledChannels?: Array<NotificationChannel | string>;
714
+ [key: string]: unknown;
715
+ }
716
+ interface FindNotificationConfigParams {
717
+ appType?: string;
718
+ formUuid?: string;
719
+ }
720
+ interface NotificationMessageRecord {
721
+ id?: string;
722
+ messageId?: string;
723
+ channel?: NotificationChannel | string;
724
+ status?: "pending" | "sent" | "failed" | string;
725
+ recipientId?: string;
726
+ [key: string]: unknown;
727
+ }
728
+ interface SendNotificationResult {
729
+ messages: NotificationMessageRecord[];
730
+ }
731
+ type ProcessApproveAction = "approved" | "rejected" | "returned";
732
+ interface GetProcessInstanceParams {
733
+ appType?: string;
734
+ instanceId: string;
735
+ }
736
+ interface TerminateProcessInstanceParams {
737
+ appType?: string;
738
+ processInstanceId: string;
739
+ reason?: string;
740
+ }
741
+ interface ApproveTaskParams {
742
+ instanceId: string;
743
+ action: ProcessApproveAction;
744
+ comments?: string;
745
+ formUuid: string;
746
+ appType?: string;
747
+ updateFormDataJson?: string;
748
+ }
749
+ interface TriggerCallbackTaskParams {
750
+ appType?: string;
751
+ taskId: string;
752
+ payload?: unknown;
753
+ }
754
+ type ConnectorRequestBodyType = "json" | "form-data" | "x-www-form-urlencoded" | "text" | "raw";
755
+ type ConnectorResponseType = "json" | "text" | "binary";
756
+ interface ConnectorInvokeParams<TBody = unknown> {
757
+ appType?: string;
758
+ connector: string;
759
+ api: string;
760
+ pathParams?: Record<string, unknown>;
761
+ query?: Record<string, unknown>;
762
+ body?: TBody;
763
+ headers?: Record<string, string>;
764
+ requestBodyType?: ConnectorRequestBodyType;
765
+ responseType?: ConnectorResponseType;
766
+ }
767
+ interface ConnectorInvokeResult<TResult = unknown> {
768
+ status: number;
769
+ duration: number;
770
+ data: TResult;
771
+ headers?: Record<string, unknown>;
772
+ contentType?: string;
773
+ encoding?: "base64";
774
+ }
775
+ interface ConnectorCallParams<TBody = unknown> extends Omit<ConnectorInvokeParams<TBody>, "connector" | "api"> {
776
+ }
777
+ interface AuthLogoutRedirectOptions {
778
+ loginUrl?: string;
779
+ callbackUrl?: string;
780
+ callbackParamName?: string;
781
+ replace?: boolean;
782
+ continueOnLogoutError?: boolean;
783
+ fallback?: "reload" | "none";
784
+ redirect?: (url: string) => void;
785
+ }
786
+ interface PageSdk {
787
+ context: PageContext;
788
+ request<TResult = unknown, TRaw = TResult>(options: PageRequestOptions): Promise<PageApiResponse<TResult, TRaw>>;
789
+ download(options: PageRequestOptions): Promise<PageBinaryResponse>;
790
+ transport: {
791
+ request<TResult = unknown, TRaw = TResult>(options: PageRequestOptions): Promise<PageApiResponse<TResult, TRaw>>;
792
+ download(options: PageRequestOptions): Promise<PageBinaryResponse>;
793
+ };
794
+ auth: {
795
+ logout<T = boolean>(): Promise<PageApiResponse<T>>;
796
+ logoutAndRedirect<T = boolean>(options?: AuthLogoutRedirectOptions): Promise<PageApiResponse<T> | null>;
797
+ };
798
+ connector: {
799
+ invoke<TResult = unknown, TBody = unknown>(params: ConnectorInvokeParams<TBody>): Promise<PageApiResponse<ConnectorInvokeResult<TResult>>>;
800
+ call<TResult = unknown, TBody = unknown>(name: string, params?: ConnectorCallParams<TBody>): Promise<PageApiResponse<ConnectorInvokeResult<TResult>>>;
801
+ download<TBody = unknown>(params: ConnectorInvokeParams<TBody>): Promise<PageBinaryResponse>;
802
+ };
803
+ form: {
804
+ getDetail<T = unknown>(params: FormGetDetailParams): Promise<PageApiResponse<T>>;
805
+ create<T = unknown, TRaw = unknown>(params: FormCreateParams): Promise<PageApiResponse<T, TRaw>>;
806
+ update<T = unknown, TRaw = unknown>(params: FormUpdateParams): Promise<PageApiResponse<T, TRaw>>;
807
+ remove<T = unknown, TRaw = unknown>(params: FormRemoveParams): Promise<PageApiResponse<T, TRaw>>;
808
+ getChangeRecords<T = unknown>(params: FormChangeRecordParams): Promise<PageApiResponse<T>>;
809
+ search<T = unknown>(params: FormSearchParams): Promise<PageApiResponse<PageListResult<T>>>;
810
+ searchIds<T = string>(params: FormSearchParams): Promise<PageApiResponse<PageListResult<T>>>;
811
+ advancedSearch<T = unknown>(params: FormAdvancedSearchParams): Promise<PageApiResponse<PageListResult<T>>>;
812
+ advancedExport(params: FormExportParams): Promise<PageBinaryResponse>;
813
+ downloadImportTemplate(params: DataManagementConfigParams): Promise<PageBinaryResponse>;
814
+ importPreview<T = unknown>(params: FormImportParams): Promise<PageApiResponse<T>>;
815
+ importExcel<T = unknown>(params: FormImportParams): Promise<PageApiResponse<T>>;
816
+ getImportRecords<T = unknown>(params: ImportExportRecordQuery): Promise<PageApiResponse<T>>;
817
+ getExportRecords<T = unknown>(params: ImportExportRecordQuery): Promise<PageApiResponse<T>>;
818
+ downloadImportSource(params: ImportExportRecordDownloadParams): Promise<PageBinaryResponse>;
819
+ downloadImportFailed(params: ImportExportRecordDownloadParams): Promise<PageBinaryResponse>;
820
+ downloadExportRecord(params: ImportExportRecordDownloadParams): Promise<PageBinaryResponse>;
821
+ getDataManagementConfig<T = PageDataManagementConfig | null>(params: DataManagementConfigParams): Promise<PageApiResponse<T>>;
822
+ saveDataManagementConfig<T = PageDataManagementConfig>(params: SaveDataManagementConfigParams): Promise<PageApiResponse<T>>;
823
+ };
824
+ user: {
825
+ create<T = PageUserRecord>(params: CreateUserParams): Promise<PageApiResponse<T>>;
826
+ update<T = PageUserRecord>(params: UpdateUserParams): Promise<PageApiResponse<T>>;
827
+ remove<T = boolean>(id: string): Promise<PageApiResponse<T>>;
828
+ get<T = PageUserRecord>(id?: string): Promise<PageApiResponse<T>>;
829
+ getCurrent<T = PageUserRecord>(): Promise<PageApiResponse<T>>;
830
+ getByUsername<T = PageUserRecord>(username: string): Promise<PageApiResponse<T>>;
831
+ list<T = PageOffsetListResult<PageUserRecord>>(params?: UserListParams): Promise<PageApiResponse<T>>;
832
+ search<T = PageUserRecord[]>(keyword?: string): Promise<PageApiResponse<T>>;
833
+ listAll<T = PageUserRecord[]>(): Promise<PageApiResponse<T>>;
834
+ listByDepartment<T = PageUserRecord[]>(departmentId: string): Promise<PageApiResponse<T>>;
835
+ validate<T = unknown>(params: ValidateUserParams): Promise<PageApiResponse<T>>;
836
+ };
837
+ department: {
838
+ getParentDepartments<T = PageDepartmentRecord[]>(departmentId: string, options?: GetParentDepartmentsOptions): Promise<PageApiResponse<T>>;
839
+ getCurrentUserParentDepartments(options?: GetParentDepartmentsOptions): Promise<CurrentUserDepartmentParents[]>;
840
+ };
841
+ role: {
842
+ create<T = PageRoleRecord>(params: CreateRoleParams): Promise<PageApiResponse<T>>;
843
+ update<T = PageRoleRecord>(id: string, params: UpdateRoleParams): Promise<PageApiResponse<T>>;
844
+ remove<T = boolean>(id: string): Promise<PageApiResponse<T>>;
845
+ get<T = PageRoleRecord | null>(id: string): Promise<PageApiResponse<T>>;
846
+ list<T = PageOffsetListResult<PageRoleRecord>>(params?: RoleListParams): Promise<PageApiResponse<T>>;
847
+ listUsers<T = PageOffsetListResult<PageUserRecord>>(roleId: string, params?: RoleUsersParams): Promise<PageApiResponse<T>>;
848
+ assignRoles<T = PageUserRecord>(params: AssignRolesParams): Promise<PageApiResponse<T>>;
849
+ addUserRole<T = boolean>(params: ChangeUserRoleParams): Promise<PageApiResponse<T>>;
850
+ removeUserRole<T = boolean>(params: ChangeUserRoleParams): Promise<PageApiResponse<T>>;
851
+ batchAddUsers<T = unknown>(params: BatchAddUsersToRoleParams): Promise<PageApiResponse<T>>;
852
+ getMyRoles<T = PageRoleRecord[]>(params?: GetUserRolesParams): Promise<PageApiResponse<T>>;
853
+ getCurrentRole<T = PageRoleRecord | null>(params?: GetUserRolesParams): Promise<PageApiResponse<T>>;
854
+ switchPlatformRole<T = boolean>(params: SwitchPlatformRoleParams): Promise<PageApiResponse<T>>;
855
+ switchAppRole<T = boolean>(params: SwitchAppRoleParams): Promise<PageApiResponse<T>>;
856
+ };
857
+ permission: {
858
+ formGroup: {
859
+ create<T = FormPermissionGroup>(params: CreateFormPermissionGroupDto): Promise<PageApiResponse<T>>;
860
+ update<T = FormPermissionGroup>(id: string, params: UpdateFormPermissionGroupDto): Promise<PageApiResponse<T>>;
861
+ remove<T = boolean>(id: string): Promise<PageApiResponse<T>>;
862
+ get<T = FormPermissionGroup | null>(id: string): Promise<PageApiResponse<T>>;
863
+ list<T = PageOffsetListResult<FormPermissionGroup>>(params?: QueryFormPermissionGroupDto): Promise<PageApiResponse<T>>;
864
+ getViewFieldPermissions<T = Record<string, ViewFieldPermissionValue>>(params: {
865
+ appType?: string;
866
+ formUuid: string;
867
+ }): Promise<PageApiResponse<T>>;
868
+ getViewPermissionSummary<T = ViewPermissionSummary>(params: {
869
+ appType?: string;
870
+ formUuid: string;
871
+ }): Promise<PageApiResponse<T>>;
872
+ };
873
+ pageGroup: {
874
+ create<T = PagePermissionGroup>(params: CreatePagePermissionGroupDto): Promise<PageApiResponse<T>>;
875
+ update<T = PagePermissionGroup>(id: string, params: UpdatePagePermissionGroupDto): Promise<PageApiResponse<T>>;
876
+ remove<T = boolean>(id: string): Promise<PageApiResponse<T>>;
877
+ get<T = PagePermissionGroup | null>(id: string): Promise<PageApiResponse<T>>;
878
+ list<T = PageOffsetListResult<PagePermissionGroup>>(params?: QueryPagePermissionGroupDto): Promise<PageApiResponse<T>>;
879
+ getUserMenuPermissions<T = UserMenuPermissionsResponse>(appType?: string): Promise<PageApiResponse<T>>;
880
+ };
881
+ api: {
882
+ create<T = PageApiPermissionRecord>(params: CreateApiPermissionParams): Promise<PageApiResponse<T>>;
883
+ update<T = PageApiPermissionRecord>(id: string, params: UpdateApiPermissionParams): Promise<PageApiResponse<T>>;
884
+ remove<T = boolean>(id: string): Promise<PageApiResponse<T>>;
885
+ list<T = PageOffsetListResult<PageApiPermissionRecord>>(params?: ApiPermissionListParams): Promise<PageApiResponse<T>>;
886
+ assign<T = boolean>(params: AssignPermissionsParams): Promise<PageApiResponse<T>>;
887
+ getByRole<T = PageApiPermissionRecord[]>(roleId: string): Promise<PageApiResponse<T>>;
888
+ getRolesByPermission<T = PageRoleRecord[]>(permissionId: string): Promise<PageApiResponse<T>>;
889
+ };
890
+ ui: {
891
+ create<T = PageUiPermissionRecord>(params: CreateUiPermissionParams): Promise<PageApiResponse<T>>;
892
+ update<T = PageUiPermissionRecord>(id: string, params: UpdateUiPermissionParams): Promise<PageApiResponse<T>>;
893
+ remove<T = boolean>(id: string): Promise<PageApiResponse<T>>;
894
+ list<T = PageOffsetListResult<PageUiPermissionRecord>>(params?: UiPermissionListParams): Promise<PageApiResponse<T>>;
895
+ assign<T = boolean>(params: AssignPermissionsParams): Promise<PageApiResponse<T>>;
896
+ getMyPlatform<T = PageUiPermissionRecord[]>(): Promise<PageApiResponse<T>>;
897
+ getMyApp<T = PageUiPermissionRecord[]>(appType?: string): Promise<PageApiResponse<T>>;
898
+ };
899
+ };
900
+ process: {
901
+ getInstance<T = unknown>(params: GetProcessInstanceParams): Promise<PageApiResponse<T>>;
902
+ terminateInstance<T = unknown>(params: TerminateProcessInstanceParams): Promise<PageApiResponse<T>>;
903
+ approveTask<T = unknown>(params: ApproveTaskParams): Promise<PageApiResponse<T>>;
904
+ triggerCallbackTask<T = unknown>(params: TriggerCallbackTaskParams): Promise<PageApiResponse<T>>;
905
+ };
906
+ dataSource: {
907
+ run<TResult = unknown, TRaw = TResult>(name: string, params?: Record<string, unknown>): Promise<PageApiResponse<TResult, TRaw>>;
908
+ };
909
+ dataView: {
910
+ query<T = unknown>(code: string, params?: DataViewQueryParams): Promise<PageApiResponse<DataViewQueryResult<T>>>;
911
+ stats<T = unknown>(code: string, params?: DataViewStatsParams): Promise<PageApiResponse<DataViewQueryResult<T>>>;
912
+ };
913
+ function: {
914
+ invoke<TResult = unknown, TInput = unknown>(code: string, params?: FunctionInvokeParams<TInput>): Promise<PageApiResponse<FunctionInvokeResult<TResult>>>;
915
+ };
916
+ notification: {
917
+ sendByType<T = SendNotificationResult>(params: SendNotificationByTypeParams): Promise<PageApiResponse<T>>;
918
+ batchSendByType<T = SendNotificationResult>(params: BatchSendNotificationByTypeParams): Promise<PageApiResponse<T>>;
919
+ findConfig<T = NotificationTypeConfig | null>(notificationType: string, params?: FindNotificationConfigParams): Promise<PageApiResponse<T>>;
920
+ previewTemplate<T = NotificationTemplatePreview>(params: PreviewNotificationTemplateParams): Promise<PageApiResponse<T>>;
921
+ };
922
+ navigation: PageNavigationApi;
923
+ ui: PageContext["ui"];
924
+ }
925
+
926
+ declare const createPageSdk: (context: PageContext) => PageSdk;
927
+
928
+ type AuthMethodType = "password" | "dingtalk" | "sso" | "guest" | "phone_code" | string;
929
+ interface AuthMethod {
930
+ type: AuthMethodType;
931
+ enabled?: boolean;
932
+ label?: string;
933
+ protocol?: string;
934
+ [key: string]: unknown;
935
+ }
936
+ interface LoginMethodsResult {
937
+ appType: string;
938
+ configCode?: string;
939
+ methods: AuthMethod[];
940
+ registration?: {
941
+ mode?: string;
942
+ [key: string]: unknown;
943
+ };
944
+ security?: {
945
+ hideFailureReason?: boolean;
946
+ [key: string]: unknown;
947
+ };
948
+ defaultRedirectUrl?: string;
949
+ }
950
+ interface AuthUser {
951
+ id: string;
952
+ username?: string;
953
+ name?: string;
954
+ phone?: string | null;
955
+ email?: string | null;
956
+ avatar?: string | null;
957
+ jobNumber?: string | null;
958
+ departments?: Array<Record<string, unknown>>;
959
+ affiliatedDepartmentId?: string | null;
960
+ affiliatedDepartment?: Record<string, unknown> | null;
961
+ [key: string]: unknown;
962
+ }
963
+ interface AuthTokenData {
964
+ accessToken: string;
965
+ refreshToken: string;
966
+ token?: string;
967
+ accessTokenExpiresAt?: number;
968
+ refreshTokenExpiresAt?: number;
969
+ user?: AuthUser;
970
+ guestUser?: AuthUser;
971
+ [key: string]: unknown;
972
+ }
973
+ interface PhoneCodeSendResult {
974
+ challengeId: string;
975
+ expiresAt?: string | Date;
976
+ ttlSeconds?: number;
977
+ message?: string;
978
+ }
979
+ interface SsoLoginUrlResult {
980
+ loginUrl: string;
981
+ protocol?: string;
982
+ }
983
+ interface AuthClientOptions {
984
+ appType: string;
985
+ servicePrefix?: string;
986
+ fetchImpl?: typeof fetch;
987
+ }
988
+ interface PasswordLoginInput {
989
+ username: string;
990
+ password: string;
991
+ clientFingerprint?: string;
992
+ challengeId?: string;
993
+ challengeAnswer?: string;
994
+ }
995
+ interface DingTalkLoginInput {
996
+ code: string;
997
+ corpId?: string;
998
+ }
999
+ interface GuestLoginInput {
1000
+ guestIdentifier?: string;
1001
+ domain?: string;
1002
+ ipAddress?: string;
1003
+ userAgent?: string;
1004
+ formUuid?: string;
1005
+ }
1006
+ interface PhoneCodeInput {
1007
+ phone: string;
1008
+ purpose?: "login" | "register" | string;
1009
+ }
1010
+ interface PhoneCodeLoginInput {
1011
+ phone: string;
1012
+ code: string;
1013
+ challengeId?: string;
1014
+ }
1015
+ interface PhoneCodeRegisterInput extends PhoneCodeLoginInput {
1016
+ name?: string;
1017
+ email?: string;
1018
+ }
1019
+ interface SsoLoginUrlInput {
1020
+ protocol?: string;
1021
+ redirectUri?: string;
1022
+ }
1023
+ interface RefreshInput {
1024
+ refreshToken?: string;
1025
+ }
1026
+ interface ResolveLoginUrlInput {
1027
+ callbackUrl?: string;
1028
+ callbackParamName?: string;
1029
+ loginUrl?: string;
1030
+ }
1031
+ interface AppAuthClient {
1032
+ appType: string;
1033
+ servicePrefix: string;
1034
+ getMethods: () => Promise<LoginMethodsResult>;
1035
+ passwordLogin: (input: PasswordLoginInput) => Promise<AuthTokenData>;
1036
+ dingtalkLogin: (input: DingTalkLoginInput) => Promise<AuthTokenData>;
1037
+ guestLogin: (input?: GuestLoginInput) => Promise<AuthTokenData>;
1038
+ sendPhoneCode: (input: PhoneCodeInput) => Promise<PhoneCodeSendResult>;
1039
+ phoneCodeLogin: (input: PhoneCodeLoginInput) => Promise<AuthTokenData>;
1040
+ registerWithPhoneCode: (input: PhoneCodeRegisterInput) => Promise<AuthTokenData>;
1041
+ getSsoLoginUrl: (input?: SsoLoginUrlInput) => Promise<SsoLoginUrlResult>;
1042
+ refresh: (input?: RefreshInput) => Promise<AuthTokenData>;
1043
+ logout: () => Promise<void>;
1044
+ resolveLoginUrl: (input?: ResolveLoginUrlInput) => string;
1045
+ }
1046
+ declare class AuthClientError extends Error {
1047
+ status?: number;
1048
+ code?: number | string;
1049
+ payload?: unknown;
1050
+ constructor(message: string, options?: {
1051
+ status?: number;
1052
+ code?: number | string;
1053
+ payload?: unknown;
1054
+ });
1055
+ }
1056
+ declare const createAuthClient: ({ appType, servicePrefix, fetchImpl, }: AuthClientOptions) => AppAuthClient;
1057
+
1058
+ interface PublicAccessClaim {
1059
+ type: "openxiangda_public";
1060
+ appType: string;
1061
+ policyCode: string;
1062
+ routeCode?: string;
1063
+ pathPattern?: string;
1064
+ mode: "guest" | "ticket";
1065
+ externalRoleCodes: string[];
1066
+ grants: {
1067
+ forms?: string[];
1068
+ dataViews?: string[];
1069
+ functions?: string[];
1070
+ connectors?: string[];
1071
+ };
1072
+ issuedAt: string;
1073
+ expiresAt?: string | null;
1074
+ ticketId?: string | null;
1075
+ }
1076
+ interface PublicAccessSessionInput {
1077
+ policyCode?: string;
1078
+ routeCode?: string;
1079
+ path?: string;
1080
+ ticket?: string;
1081
+ guestIdentifier?: string;
1082
+ domain?: string;
1083
+ ipAddress?: string;
1084
+ userAgent?: string;
1085
+ }
1086
+ interface PublicAccessSessionData extends AuthTokenData {
1087
+ publicAccess?: PublicAccessClaim | null;
1088
+ raw?: unknown;
1089
+ }
1090
+ interface PublicAccessClientOptions {
1091
+ appType: string;
1092
+ servicePrefix?: string;
1093
+ fetchImpl?: typeof fetch;
1094
+ }
1095
+ interface PublicAccessClient {
1096
+ appType: string;
1097
+ servicePrefix: string;
1098
+ startSession: (input?: PublicAccessSessionInput) => Promise<PublicAccessSessionData>;
1099
+ }
1100
+ declare class PublicAccessClientError extends Error {
1101
+ status?: number;
1102
+ code?: number | string;
1103
+ payload?: unknown;
1104
+ constructor(message: string, options?: {
1105
+ status?: number;
1106
+ code?: number | string;
1107
+ payload?: unknown;
1108
+ });
1109
+ }
1110
+ declare const createPublicAccessClient: ({ appType, servicePrefix, fetchImpl, }: PublicAccessClientOptions) => PublicAccessClient;
1111
+
1112
+ declare const createReactPage: (AppComponent: React__default.ComponentType) => {
1113
+ mount: (el: HTMLElement, context: PageContext) => void;
1114
+ update: (el: HTMLElement, context: PageContext) => void;
1115
+ unmount: () => void;
1116
+ };
1117
+
1118
+ interface PageProviderProps {
1119
+ context: PageContext;
1120
+ children: React__default.ReactNode;
1121
+ }
1122
+ declare const PageProvider: React__default.FC<PageProviderProps>;
1123
+
1124
+ interface CurrentUserState {
1125
+ user: PageUserInfo & {
1126
+ userType: PageUserType;
1127
+ isGuest: boolean;
1128
+ };
1129
+ isGuest: boolean;
1130
+ isInternalUser: boolean;
1131
+ displayName: string;
1132
+ primaryDepartment: NonNullable<PageUserInfo["departments"]>[number] | null;
1133
+ affiliatedDepartment: PageUserInfo["affiliatedDepartment"] | null;
1134
+ }
1135
+ declare const useCurrentUser: () => CurrentUserState;
1136
+
1137
+ interface UseDataSourceOptions<TResult = unknown, TData = TResult, TParams extends Record<string, unknown> = Record<string, unknown>> {
1138
+ params?: TParams;
1139
+ immediate?: boolean;
1140
+ transform?: (result: TResult, response: PageApiResponse<TResult>) => TData;
1141
+ }
1142
+ interface UseDataSourceResult<TResult = unknown, TData = TResult, TParams extends Record<string, unknown> = Record<string, unknown>> {
1143
+ response: PageApiResponse<TResult> | null;
1144
+ result: TResult | null;
1145
+ data: TData | null;
1146
+ loading: boolean;
1147
+ error: Error | null;
1148
+ refresh: (params?: TParams) => Promise<PageApiResponse<TResult> | null>;
1149
+ run: (params?: TParams) => Promise<PageApiResponse<TResult> | null>;
1150
+ setResponse: Dispatch<SetStateAction<PageApiResponse<TResult> | null>>;
1151
+ setResult: Dispatch<SetStateAction<TResult | null>>;
1152
+ setData: Dispatch<SetStateAction<TData | null>>;
1153
+ }
1154
+ declare const useDataSource: <TResult = unknown, TData = TResult, TParams extends Record<string, unknown> = Record<string, unknown>>(name: string, options?: UseDataSourceOptions<TResult, TData, TParams>) => UseDataSourceResult<TResult, TData, TParams>;
1155
+
1156
+ interface UseFormViewPermissionsOptions {
1157
+ appType?: string;
1158
+ immediate?: boolean;
1159
+ }
1160
+ interface UseFormViewPermissionsState {
1161
+ summary: ViewPermissionSummary;
1162
+ response: PageApiResponse<ViewPermissionSummary> | null;
1163
+ loading: boolean;
1164
+ error: Error | null;
1165
+ refresh: () => Promise<PageApiResponse<ViewPermissionSummary> | null>;
1166
+ can: (operation: ViewOperationPermission) => boolean;
1167
+ getFieldPermission: (fieldName: string) => ViewFieldPermissionValue | null;
1168
+ }
1169
+ declare const useFormViewPermissions: (formUuid: string, options?: UseFormViewPermissionsOptions) => UseFormViewPermissionsState;
1170
+
1171
+ declare const useMessage: () => PageMessageApi;
1172
+
1173
+ declare const useModal: () => PageModalApi;
1174
+
1175
+ declare const useNavigation: () => PageNavigationApi;
1176
+
1177
+ declare const usePageContext: () => PageContext;
1178
+
1179
+ declare const usePageProps: <T extends object = Record<string, unknown>>() => T;
1180
+
1181
+ declare const usePageRoute: () => PageRouteInfo;
1182
+
1183
+ declare const usePageSdk: () => PageSdk;
1184
+
1185
+ interface UseAuthOptions extends Partial<AuthClientOptions> {
1186
+ }
1187
+ interface UseLoginMethodsState {
1188
+ data: LoginMethodsResult | null;
1189
+ methods: AuthMethod[];
1190
+ loading: boolean;
1191
+ error: Error | null;
1192
+ reload: () => Promise<void>;
1193
+ }
1194
+ interface LoginPageProps extends UseAuthOptions {
1195
+ title?: React__default.ReactNode;
1196
+ subtitle?: React__default.ReactNode;
1197
+ className?: string;
1198
+ style?: CSSProperties;
1199
+ defaultMethod?: "password" | "phone_code";
1200
+ redirectUrl?: string;
1201
+ redirectOnSuccess?: boolean;
1202
+ onSuccess?: (data: AuthTokenData) => void | Promise<void>;
1203
+ }
1204
+ declare const useAuth: (options?: UseAuthOptions) => {
1205
+ client: AppAuthClient;
1206
+ getMethods: () => Promise<LoginMethodsResult>;
1207
+ passwordLogin: (input: PasswordLoginInput) => Promise<AuthTokenData>;
1208
+ dingtalkLogin: (input: DingTalkLoginInput) => Promise<AuthTokenData>;
1209
+ guestLogin: (input?: GuestLoginInput) => Promise<AuthTokenData>;
1210
+ sendPhoneCode: (input: PhoneCodeInput) => Promise<PhoneCodeSendResult>;
1211
+ phoneCodeLogin: (input: PhoneCodeLoginInput) => Promise<AuthTokenData>;
1212
+ registerWithPhoneCode: (input: PhoneCodeRegisterInput) => Promise<AuthTokenData>;
1213
+ getSsoLoginUrl: (input?: SsoLoginUrlInput) => Promise<SsoLoginUrlResult>;
1214
+ refresh: (input?: RefreshInput) => Promise<AuthTokenData>;
1215
+ logout: () => Promise<void>;
1216
+ resolveLoginUrl: (input?: ResolveLoginUrlInput) => string;
1217
+ };
1218
+ declare const useLoginMethods: (options?: UseAuthOptions) => UseLoginMethodsState;
1219
+ declare const LoginPage: React__default.FC<LoginPageProps>;
1220
+
1221
+ type RuntimeErrorType = "unauthenticated" | "forbidden" | "network" | "unknown";
1222
+ type RuntimeRequestError = Error & {
1223
+ type?: RuntimeErrorType;
1224
+ status?: number;
1225
+ code?: number | string;
1226
+ payload?: unknown;
1227
+ };
1228
+ interface RuntimeErrorSnapshot {
1229
+ type: RuntimeErrorType;
1230
+ status?: number;
1231
+ code?: number | string;
1232
+ message: string;
1233
+ payload?: unknown;
1234
+ }
1235
+ interface RuntimeMenuItem {
1236
+ id: string;
1237
+ name: string;
1238
+ resourceCode?: string | null;
1239
+ routeCode?: string | null;
1240
+ path?: string | null;
1241
+ type?: string;
1242
+ formUuid?: string | null;
1243
+ pageId?: string | null;
1244
+ parentId?: string | null;
1245
+ sortOrder?: number;
1246
+ isHidden?: boolean;
1247
+ icon?: string | null;
1248
+ children?: RuntimeMenuItem[];
1249
+ [key: string]: unknown;
1250
+ }
1251
+ interface RuntimePagePermissions {
1252
+ appType: string;
1253
+ hasFullAccess: boolean;
1254
+ roleCodes: string[];
1255
+ roleSource?: string;
1256
+ menuFormUuids: string[];
1257
+ menuCodes: string[];
1258
+ routeCodes: string[];
1259
+ pathPatterns: string[];
1260
+ }
1261
+ interface RuntimeBootstrap {
1262
+ appType: string;
1263
+ app?: Record<string, unknown> | null;
1264
+ user?: Record<string, unknown> | null;
1265
+ runtime?: {
1266
+ mode?: "legacy" | "react-spa" | string;
1267
+ settings?: Record<string, unknown>;
1268
+ activeReleaseId?: string | null;
1269
+ activeBuildId?: string | null;
1270
+ indexUrl?: string | null;
1271
+ assetBaseUrl?: string | null;
1272
+ };
1273
+ permissions?: RuntimePagePermissions;
1274
+ menus?: RuntimeMenuItem[];
1275
+ servicePrefix?: string;
1276
+ }
1277
+ interface RouteAccessResult {
1278
+ appType: string;
1279
+ canAccess: boolean;
1280
+ routeCode?: string;
1281
+ menuCode?: string;
1282
+ path?: string;
1283
+ status?: number;
1284
+ code?: number | string;
1285
+ message?: string;
1286
+ errorType?: RuntimeErrorType;
1287
+ payload?: unknown;
1288
+ permissions?: RuntimePagePermissions;
1289
+ }
1290
+ interface RuntimeRequestState<T> {
1291
+ data: T | null;
1292
+ loading: boolean;
1293
+ error: RuntimeRequestError | null;
1294
+ }
1295
+ interface OpenXiangdaProviderProps {
1296
+ appType?: string;
1297
+ servicePrefix?: string;
1298
+ fetchImpl?: typeof fetch;
1299
+ children: React__default.ReactNode;
1300
+ }
1301
+ interface OpenXiangdaRuntimeStore extends RuntimeRequestState<RuntimeBootstrap> {
1302
+ appType: string;
1303
+ servicePrefix: string;
1304
+ fetchImpl: typeof fetch;
1305
+ reload: () => Promise<void>;
1306
+ }
1307
+ declare const OpenXiangdaProvider: React__default.FC<OpenXiangdaProviderProps>;
1308
+ declare const useOpenXiangda: () => OpenXiangdaRuntimeStore;
1309
+ declare const useRuntimeBootstrap: () => OpenXiangdaRuntimeStore;
1310
+ declare const useAppMenus: () => {
1311
+ data: RuntimeMenuItem[];
1312
+ appType: string;
1313
+ servicePrefix: string;
1314
+ fetchImpl: typeof fetch;
1315
+ reload: () => Promise<void>;
1316
+ loading: boolean;
1317
+ error: RuntimeRequestError | null;
1318
+ };
1319
+ declare const usePermission: () => {
1320
+ data: RuntimePagePermissions | null;
1321
+ appType: string;
1322
+ servicePrefix: string;
1323
+ fetchImpl: typeof fetch;
1324
+ reload: () => Promise<void>;
1325
+ loading: boolean;
1326
+ error: RuntimeRequestError | null;
1327
+ };
1328
+ interface UseCanAccessRouteInput {
1329
+ routeCode?: string;
1330
+ menuCode?: string;
1331
+ path?: string;
1332
+ }
1333
+ declare const useCanAccessRoute: (input: UseCanAccessRouteInput) => {
1334
+ canAccess: boolean;
1335
+ data: RouteAccessResult | null;
1336
+ loading: boolean;
1337
+ error: RuntimeRequestError | null;
1338
+ };
1339
+ interface PermissionBoundaryProps extends UseCanAccessRouteInput {
1340
+ children: React__default.ReactNode;
1341
+ fallback?: React__default.ReactNode | PermissionBoundaryFallback;
1342
+ loadingFallback?: React__default.ReactNode | PermissionBoundaryFallback;
1343
+ }
1344
+ interface PermissionBoundaryFallbackState {
1345
+ access: ReturnType<typeof useCanAccessRoute>;
1346
+ runtime: ReturnType<typeof useOpenXiangda>;
1347
+ error: RuntimeRequestError | null;
1348
+ errorType: RuntimeErrorType;
1349
+ status?: number;
1350
+ code?: number | string;
1351
+ message: string;
1352
+ }
1353
+ type PermissionBoundaryFallback = (state: PermissionBoundaryFallbackState) => React__default.ReactNode;
1354
+ declare const PermissionBoundary: React__default.FC<PermissionBoundaryProps>;
1355
+ interface RuntimeResolveLoginOptions {
1356
+ redirectUri?: string;
1357
+ loginUrl?: string;
1358
+ domain?: string;
1359
+ }
1360
+ interface RuntimeRedirectLoginOptions extends RuntimeResolveLoginOptions {
1361
+ replace?: boolean;
1362
+ }
1363
+ interface RuntimeLogoutOptions extends RuntimeRedirectLoginOptions {
1364
+ continueOnError?: boolean;
1365
+ }
1366
+ declare const useRuntimeAuth: () => {
1367
+ logout: () => Promise<any>;
1368
+ logoutAndRedirect: (options?: RuntimeLogoutOptions) => Promise<string>;
1369
+ redirectToLogin: (options?: RuntimeRedirectLoginOptions) => Promise<string>;
1370
+ resolveLoginUrl: (options?: RuntimeResolveLoginOptions) => Promise<string>;
1371
+ };
1372
+
1373
+ interface UsePublicAccessOptions extends PublicAccessSessionInput {
1374
+ appType?: string;
1375
+ servicePrefix?: string;
1376
+ fetchImpl?: typeof fetch;
1377
+ autoStart?: boolean;
1378
+ }
1379
+ interface UsePublicAccessState {
1380
+ loading: boolean;
1381
+ error: PublicAccessClientError | null;
1382
+ session: PublicAccessSessionData | null;
1383
+ publicAccess: PublicAccessClaim | null;
1384
+ startSession: (input?: PublicAccessSessionInput) => Promise<PublicAccessSessionData>;
1385
+ }
1386
+ declare const usePublicAccess: (options?: UsePublicAccessOptions) => UsePublicAccessState;
1387
+ interface PublicAccessGateProps extends UsePublicAccessOptions {
1388
+ children: React__default.ReactNode;
1389
+ fallback?: React__default.ReactNode;
1390
+ errorFallback?: React__default.ReactNode | ((error: PublicAccessClientError) => React__default.ReactNode);
1391
+ }
1392
+ declare const PublicAccessGate: React__default.FC<PublicAccessGateProps>;
1393
+
1394
+ export { type ApiPermissionListParams, type AppAuthClient, type ApproveTaskParams, type AssignPermissionsParams, type AssignRolesParams, AuthClientError, type AuthClientOptions, type AuthLogoutRedirectOptions, type AuthMethod, type AuthMethodType, type AuthTokenData, type AuthUser, type BatchAddUsersToRoleParams, type BatchSendNotificationByTypeParams, type ChangeUserRoleParams, type ConnectorCallParams, type ConnectorInvokeParams, type ConnectorInvokeResult, type ConnectorRequestBodyType, type ConnectorResponseType, type CreateApiPermissionParams, type CreateFormPermissionGroupDto, type CreatePagePermissionGroupDto, type CreateRoleParams, type CreateUiPermissionParams, type CreateUserParams, type CurrentUserDepartmentParents, type CustomPageEntryConfig, type CustomPageEntryMode, type DataManagementConfigParams, type DataManagementFilterState, type DataPermissionConditionDto, type DataPermissionDto, type DataPermissionRuleDto, type DataViewQueryParams, type DataViewQueryResult, type DataViewStatsParams, type DingTalkLoginInput, type FieldAccessLevel, type FieldAccessPolicyDto, type FieldAccessPolicyItemDto, type FieldPermissionDto, type FindNotificationConfigParams, type FormAdvancedSearchParams, type FormChangeRecordParams, type FormCreateParams, type FormExportParams, type FormGetDetailParams, type FormImportParams, type FormPermissionGroup, type FormRemoveParams, type FormSearchParams, type FormUpdateParams, type FunctionInvokeParams, type FunctionInvokeResult, type GetParentDepartmentsOptions, type GetProcessInstanceParams, type GetUserRolesParams, type GuestLoginInput, type ImportExportRecordDownloadParams, type ImportExportRecordQuery, type InstanceStatus, type LoginMethodsResult, LoginPage, type LoginPageProps, type NotificationChannel, type NotificationChannelConfig, type NotificationChannelsConfig, type NotificationConfigLevel, type NotificationMessageRecord, type NotificationTemplate, type NotificationTemplatePreview, type NotificationTypeConfig, OpenXiangdaProvider, type OpenXiangdaProviderProps, type PageApiPermissionRecord, type PageApiResponse, type PageAppInfo, type PageBinaryResponse, type PageBridgeApi, type PageContext, type PageDataManagementConfig, type PageDataSourceDescriptor, type PageDepartmentInfo, type PageDepartmentRecord, type PageHttpMethod, type PageInfo, type PageListResult, type PageMessageApi, type PageModalApi, type PageNavigationApi, type PageOffsetListResult, type PagePermissionGroup, type PagePermissionInfo, PageProvider, type PageQueryValue, type PageRequestOptions, type PageRoleRecord, type PageRouteInfo, type PageScope, type PageSdk, type PageSdkError, type PageSdkMeta, type PageTransportDownloadPayload, type PageTransportRequestPayload, type PageUiPermissionRecord, type PageUiPermissionType, type PageUserInfo, type PageUserRecord, type PageUserType, type PasswordLoginInput, PermissionBoundary, type PermissionBoundaryFallback, type PermissionBoundaryFallbackState, type PermissionBoundaryProps, type PhoneCodeInput, type PhoneCodeLoginInput, type PhoneCodeRegisterInput, type PhoneCodeSendResult, type PreviewNotificationTemplateParams, type ProcessApproveAction, type PublicAccessClaim, type PublicAccessClient, PublicAccessClientError, type PublicAccessClientOptions, PublicAccessGate, type PublicAccessGateProps, type PublicAccessSessionData, type PublicAccessSessionInput, type QueryFormPermissionGroupDto, type QueryPagePermissionGroupDto, type RefreshInput, type ResolveLoginUrlInput, type RoleListParams, type RoleUsersParams, type RouteAccessResult, type RuntimeBootstrap, type RuntimeErrorSnapshot, type RuntimeErrorType, type RuntimeLogoutOptions, type RuntimeMenuItem, type RuntimePagePermissions, type RuntimeRedirectLoginOptions, type RuntimeRequestError, type RuntimeRequestState, type RuntimeResolveLoginOptions, type SaveDataManagementConfigParams, type SearchComponentName, type SearchExpression, type SearchFieldKey, type SearchGroup, type SearchLogic, type SearchOperator, type SearchRule, type SearchSortItem, type SearchSystemField, type SendNotificationByTypeParams, type SendNotificationResult, type SsoLoginUrlInput, type SsoLoginUrlResult, type SubFormRule, type SwitchAppRoleParams, type SwitchPlatformRoleParams, type TerminateProcessInstanceParams, type TriggerCallbackTaskParams, type UiPermissionListParams, type UpdateApiPermissionParams, type UpdateFormPermissionGroupDto, type UpdatePagePermissionGroupDto, type UpdateRoleParams, type UpdateUiPermissionParams, type UpdateUserParams, type UseAuthOptions, type UseCanAccessRouteInput, type UseLoginMethodsState, type UsePublicAccessOptions, type UsePublicAccessState, type UserListParams, type UserMenuPermissionsResponse, type ValidateUserParams, type ViewFieldPermissionValue, type ViewOperationPermission, type ViewPermissionSummary, createAuthClient, createPageSdk, createPublicAccessClient, createReactPage, useAppMenus, useAuth, useCanAccessRoute, useCurrentUser, useDataSource, useFormViewPermissions, useLoginMethods, useMessage, useModal, useNavigation, useOpenXiangda, usePageContext, usePageProps, usePageRoute, usePageSdk, usePermission, usePublicAccess, useRuntimeAuth, useRuntimeBootstrap };