openxiangda 1.0.136 → 1.0.138
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/lib/cli.js +687 -5
- package/lib/design-gates.js +16 -3
- package/openxiangda-skills/references/best-practices.md +18 -7
- package/openxiangda-skills/references/component-guide.md +7 -1
- package/openxiangda-skills/references/permission-design-patterns.md +95 -5
- package/openxiangda-skills/references/permissions-settings.md +165 -0
- package/openxiangda-skills/references/resource-manifest-cheatsheet.md +87 -0
- package/package.json +1 -1
- package/packages/sdk/dist/{ProcessPreview-Ci8_UsbN.d.mts → ProcessPreview-CZJP8n3e.d.mts} +6 -0
- package/packages/sdk/dist/{ProcessPreview-Ci8_UsbN.d.ts → ProcessPreview-CZJP8n3e.d.ts} +6 -0
- package/packages/sdk/dist/components/index.cjs +143 -16
- package/packages/sdk/dist/components/index.cjs.map +1 -1
- package/packages/sdk/dist/components/index.d.mts +8 -2
- package/packages/sdk/dist/components/index.d.ts +8 -2
- package/packages/sdk/dist/components/index.mjs +143 -16
- package/packages/sdk/dist/components/index.mjs.map +1 -1
- package/packages/sdk/dist/runtime/index.cjs +169 -25
- package/packages/sdk/dist/runtime/index.cjs.map +1 -1
- package/packages/sdk/dist/runtime/index.d.mts +1 -1
- package/packages/sdk/dist/runtime/index.d.ts +1 -1
- package/packages/sdk/dist/runtime/index.mjs +169 -25
- package/packages/sdk/dist/runtime/index.mjs.map +1 -1
- package/packages/sdk/dist/runtime/react.cjs +26 -9
- package/packages/sdk/dist/runtime/react.cjs.map +1 -1
- package/packages/sdk/dist/runtime/react.d.mts +13 -3
- package/packages/sdk/dist/runtime/react.d.ts +13 -3
- package/packages/sdk/dist/runtime/react.mjs +26 -9
- package/packages/sdk/dist/runtime/react.mjs.map +1 -1
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import React__default, { Dispatch, SetStateAction, CSSProperties } from 'react';
|
|
2
|
-
import { a as FormRuntimeApi, o as InitiatorSelectRequirement, I as InitiatorSelectCandidate, b0 as ProcessPreviewProps, ai as ApprovalTimelineProps } from '../ProcessPreview-
|
|
2
|
+
import { a as FormRuntimeApi, o as InitiatorSelectRequirement, I as InitiatorSelectCandidate, b0 as ProcessPreviewProps, ai as ApprovalTimelineProps } from '../ProcessPreview-CZJP8n3e.mjs';
|
|
3
3
|
|
|
4
4
|
type PageQueryValue = string | string[];
|
|
5
5
|
type PageHttpMethod = "get" | "post" | "put" | "delete" | "patch";
|
|
@@ -33,11 +33,13 @@ interface DataPermissionConditionDto {
|
|
|
33
33
|
conditions?: DataPermissionConditionDto[];
|
|
34
34
|
}
|
|
35
35
|
interface DataPermissionDto {
|
|
36
|
-
type: "condition" | "sql";
|
|
36
|
+
type: "condition" | "sql" | "scope_policy";
|
|
37
37
|
condition?: DataPermissionConditionDto;
|
|
38
38
|
logic?: "AND" | "OR";
|
|
39
39
|
rules?: DataPermissionRuleDto[];
|
|
40
40
|
expression?: string;
|
|
41
|
+
policyCode?: string;
|
|
42
|
+
scopePolicyCode?: string;
|
|
41
43
|
}
|
|
42
44
|
type SearchLogic = "AND" | "OR";
|
|
43
45
|
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;
|
|
@@ -830,16 +832,23 @@ interface FormPermissionGroup {
|
|
|
830
832
|
roles: string[];
|
|
831
833
|
dataScope?: "all" | "self";
|
|
832
834
|
operations?: string[];
|
|
835
|
+
actions?: string[];
|
|
833
836
|
fieldPermissions?: FieldPermissionDto[];
|
|
834
837
|
fieldAccessPolicy?: FieldAccessPolicyDto | null;
|
|
835
838
|
dataPermission?: DataPermissionDto;
|
|
836
839
|
createdAt?: string;
|
|
837
840
|
updatedAt?: string;
|
|
838
841
|
}
|
|
839
|
-
type ViewOperationPermission = "view" | "edit" | "delete" | "change_records" | "workflow";
|
|
842
|
+
type ViewOperationPermission = "view" | "create" | "edit" | "delete" | "export" | "import" | "change_records" | "workflow";
|
|
840
843
|
interface ViewPermissionSummary {
|
|
841
844
|
fieldPermissions: Record<string, ViewFieldPermissionValue>;
|
|
842
845
|
operations: ViewOperationPermission[];
|
|
846
|
+
actions?: ViewOperationPermission[];
|
|
847
|
+
can?: Record<ViewOperationPermission, boolean>;
|
|
848
|
+
fieldAccessPolicy?: FieldAccessPolicyDto | null;
|
|
849
|
+
hasFullAccess?: boolean;
|
|
850
|
+
resourceType?: "form" | string;
|
|
851
|
+
matchedGroupCodes?: string[];
|
|
843
852
|
}
|
|
844
853
|
interface CreateFormPermissionGroupDto {
|
|
845
854
|
appType: string;
|
|
@@ -849,6 +858,7 @@ interface CreateFormPermissionGroupDto {
|
|
|
849
858
|
roles: string[];
|
|
850
859
|
dataScope?: "all" | "self";
|
|
851
860
|
operations?: string[];
|
|
861
|
+
actions?: string[];
|
|
852
862
|
fieldPermissions?: FieldPermissionDto[];
|
|
853
863
|
fieldAccessPolicy?: FieldAccessPolicyDto | null;
|
|
854
864
|
dataPermission?: DataPermissionDto;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import React__default, { Dispatch, SetStateAction, CSSProperties } from 'react';
|
|
2
|
-
import { a as FormRuntimeApi, o as InitiatorSelectRequirement, I as InitiatorSelectCandidate, b0 as ProcessPreviewProps, ai as ApprovalTimelineProps } from '../ProcessPreview-
|
|
2
|
+
import { a as FormRuntimeApi, o as InitiatorSelectRequirement, I as InitiatorSelectCandidate, b0 as ProcessPreviewProps, ai as ApprovalTimelineProps } from '../ProcessPreview-CZJP8n3e.js';
|
|
3
3
|
|
|
4
4
|
type PageQueryValue = string | string[];
|
|
5
5
|
type PageHttpMethod = "get" | "post" | "put" | "delete" | "patch";
|
|
@@ -33,11 +33,13 @@ interface DataPermissionConditionDto {
|
|
|
33
33
|
conditions?: DataPermissionConditionDto[];
|
|
34
34
|
}
|
|
35
35
|
interface DataPermissionDto {
|
|
36
|
-
type: "condition" | "sql";
|
|
36
|
+
type: "condition" | "sql" | "scope_policy";
|
|
37
37
|
condition?: DataPermissionConditionDto;
|
|
38
38
|
logic?: "AND" | "OR";
|
|
39
39
|
rules?: DataPermissionRuleDto[];
|
|
40
40
|
expression?: string;
|
|
41
|
+
policyCode?: string;
|
|
42
|
+
scopePolicyCode?: string;
|
|
41
43
|
}
|
|
42
44
|
type SearchLogic = "AND" | "OR";
|
|
43
45
|
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;
|
|
@@ -830,16 +832,23 @@ interface FormPermissionGroup {
|
|
|
830
832
|
roles: string[];
|
|
831
833
|
dataScope?: "all" | "self";
|
|
832
834
|
operations?: string[];
|
|
835
|
+
actions?: string[];
|
|
833
836
|
fieldPermissions?: FieldPermissionDto[];
|
|
834
837
|
fieldAccessPolicy?: FieldAccessPolicyDto | null;
|
|
835
838
|
dataPermission?: DataPermissionDto;
|
|
836
839
|
createdAt?: string;
|
|
837
840
|
updatedAt?: string;
|
|
838
841
|
}
|
|
839
|
-
type ViewOperationPermission = "view" | "edit" | "delete" | "change_records" | "workflow";
|
|
842
|
+
type ViewOperationPermission = "view" | "create" | "edit" | "delete" | "export" | "import" | "change_records" | "workflow";
|
|
840
843
|
interface ViewPermissionSummary {
|
|
841
844
|
fieldPermissions: Record<string, ViewFieldPermissionValue>;
|
|
842
845
|
operations: ViewOperationPermission[];
|
|
846
|
+
actions?: ViewOperationPermission[];
|
|
847
|
+
can?: Record<ViewOperationPermission, boolean>;
|
|
848
|
+
fieldAccessPolicy?: FieldAccessPolicyDto | null;
|
|
849
|
+
hasFullAccess?: boolean;
|
|
850
|
+
resourceType?: "form" | string;
|
|
851
|
+
matchedGroupCodes?: string[];
|
|
843
852
|
}
|
|
844
853
|
interface CreateFormPermissionGroupDto {
|
|
845
854
|
appType: string;
|
|
@@ -849,6 +858,7 @@ interface CreateFormPermissionGroupDto {
|
|
|
849
858
|
roles: string[];
|
|
850
859
|
dataScope?: "all" | "self";
|
|
851
860
|
operations?: string[];
|
|
861
|
+
actions?: string[];
|
|
852
862
|
fieldPermissions?: FieldPermissionDto[];
|
|
853
863
|
fieldAccessPolicy?: FieldAccessPolicyDto | null;
|
|
854
864
|
dataPermission?: DataPermissionDto;
|
|
@@ -2487,7 +2487,27 @@ var useDataSource = (name, options = {}) => {
|
|
|
2487
2487
|
import { useCallback as useCallback2, useEffect as useEffect2, useMemo as useMemo3, useState as useState2 } from "react";
|
|
2488
2488
|
var EMPTY_SUMMARY = {
|
|
2489
2489
|
fieldPermissions: {},
|
|
2490
|
-
operations: []
|
|
2490
|
+
operations: [],
|
|
2491
|
+
actions: []
|
|
2492
|
+
};
|
|
2493
|
+
var normalizeSummary = (summary) => {
|
|
2494
|
+
const actions = Array.from(
|
|
2495
|
+
/* @__PURE__ */ new Set([...summary?.actions || [], ...summary?.operations || []])
|
|
2496
|
+
);
|
|
2497
|
+
const can = actions.reduce(
|
|
2498
|
+
(result, operation) => {
|
|
2499
|
+
result[operation] = Boolean(summary?.can?.[operation] ?? true);
|
|
2500
|
+
return result;
|
|
2501
|
+
},
|
|
2502
|
+
{}
|
|
2503
|
+
);
|
|
2504
|
+
return {
|
|
2505
|
+
...summary,
|
|
2506
|
+
fieldPermissions: summary?.fieldPermissions || {},
|
|
2507
|
+
operations: actions,
|
|
2508
|
+
actions,
|
|
2509
|
+
can
|
|
2510
|
+
};
|
|
2491
2511
|
};
|
|
2492
2512
|
var toError = (error) => {
|
|
2493
2513
|
if (error instanceof Error) {
|
|
@@ -2521,10 +2541,7 @@ var useFormViewPermissions = (formUuid, options = {}) => {
|
|
|
2521
2541
|
});
|
|
2522
2542
|
const nextSummary = nextResponse.result || EMPTY_SUMMARY;
|
|
2523
2543
|
setResponse(nextResponse);
|
|
2524
|
-
setSummary(
|
|
2525
|
-
fieldPermissions: nextSummary.fieldPermissions || {},
|
|
2526
|
-
operations: nextSummary.operations || []
|
|
2527
|
-
});
|
|
2544
|
+
setSummary(normalizeSummary(nextSummary));
|
|
2528
2545
|
return nextResponse;
|
|
2529
2546
|
} catch (requestError) {
|
|
2530
2547
|
const nextError = toError(requestError);
|
|
@@ -2543,12 +2560,12 @@ var useFormViewPermissions = (formUuid, options = {}) => {
|
|
|
2543
2560
|
void refresh();
|
|
2544
2561
|
}, [immediate, refresh]);
|
|
2545
2562
|
const operationSet = useMemo3(
|
|
2546
|
-
() => new Set(summary.operations),
|
|
2547
|
-
[summary.operations]
|
|
2563
|
+
() => new Set(summary.actions || summary.operations),
|
|
2564
|
+
[summary.actions, summary.operations]
|
|
2548
2565
|
);
|
|
2549
2566
|
const can = useCallback2(
|
|
2550
|
-
(operation) => operationSet.has(operation),
|
|
2551
|
-
[operationSet]
|
|
2567
|
+
(operation) => Boolean(summary.can?.[operation] ?? operationSet.has(operation)),
|
|
2568
|
+
[operationSet, summary.can]
|
|
2552
2569
|
);
|
|
2553
2570
|
const getFieldPermission = useCallback2(
|
|
2554
2571
|
(fieldName) => summary.fieldPermissions[fieldName] || null,
|