openxiangda-skill-kit 2.0.0-alpha.88 → 2.0.0-alpha.89
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/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "openxiangda-skill-kit",
|
|
3
|
-
"version": "2.0.0-alpha.
|
|
3
|
+
"version": "2.0.0-alpha.89",
|
|
4
4
|
"description": "Validation and deterministic packaging for OpenXiangda 2.0 AI skills.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "./dist/index.js",
|
|
@@ -17,7 +17,7 @@
|
|
|
17
17
|
"README.md"
|
|
18
18
|
],
|
|
19
19
|
"dependencies": {
|
|
20
|
-
"openxiangda-devkit-core": "2.0.0-alpha.
|
|
20
|
+
"openxiangda-devkit-core": "2.0.0-alpha.71"
|
|
21
21
|
},
|
|
22
22
|
"devDependencies": {
|
|
23
23
|
"tsx": "4.23.12",
|
package/skills/manifest.json
CHANGED
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
{
|
|
5
5
|
"name": "openxiangda-v2",
|
|
6
6
|
"description": "Use when researching, designing, building, testing, or delivering a complete OpenXiangda 2.0 application.",
|
|
7
|
-
"sha256": "
|
|
7
|
+
"sha256": "08bd64cb7f0dee4889fd34e9081b3b01dcafa714273c51bae57ee9e22ccfcf9e"
|
|
8
8
|
}
|
|
9
9
|
]
|
|
10
10
|
}
|
|
@@ -8,8 +8,10 @@ source. Do not create `platform/data` modules.
|
|
|
8
8
|
```ts
|
|
9
9
|
import {
|
|
10
10
|
currentUserDataPolicy,
|
|
11
|
+
dataPolicyExpression,
|
|
11
12
|
defineOpenXiangdaApp,
|
|
12
13
|
resourceCapabilityCodes,
|
|
14
|
+
resourceReadPolicy,
|
|
13
15
|
} from 'openxiangda/config';
|
|
14
16
|
|
|
15
17
|
const APP_CODE = 'visitor-center';
|
|
@@ -119,10 +121,50 @@ currentUserDataPolicy({
|
|
|
119
121
|
```
|
|
120
122
|
|
|
121
123
|
Put that value in `authz.dataPolicies`, declare both roles, and set the
|
|
122
|
-
resource `dataPolicyCode` to the same code. Do not invent `
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
124
|
+
resource `dataPolicyCode` to the same code. Do not invent `current_user: true`,
|
|
125
|
+
lowercase match modes, a dotted value path, or policy-level `roleCodes`. The
|
|
126
|
+
compiler and platform know that `user.*` fields compare their stable `value`;
|
|
127
|
+
`field` remains the declared field root code.
|
|
128
|
+
|
|
129
|
+
For portal visibility windows, use the typed SDK expression and keep it a
|
|
130
|
+
server-enforced read policy:
|
|
131
|
+
|
|
132
|
+
```ts
|
|
133
|
+
resourceReadPolicy({
|
|
134
|
+
code: 'published-articles',
|
|
135
|
+
name: '仅查看当前已发布内容',
|
|
136
|
+
resourceCode: 'articles',
|
|
137
|
+
matchMode: 'AND',
|
|
138
|
+
rules: [{ dimensionCode: 'organization', field: 'organizationId' }],
|
|
139
|
+
expression: dataPolicyExpression.allOf(
|
|
140
|
+
dataPolicyExpression.constant({
|
|
141
|
+
field: 'status', operator: 'eq', value: 'PUBLISHED',
|
|
142
|
+
}),
|
|
143
|
+
dataPolicyExpression.databaseNow({
|
|
144
|
+
field: 'publishAt', operator: 'lte',
|
|
145
|
+
}),
|
|
146
|
+
dataPolicyExpression.anyOf(
|
|
147
|
+
dataPolicyExpression.null({ field: 'expireAt', operator: 'is_null' }),
|
|
148
|
+
dataPolicyExpression.databaseNow({ field: 'expireAt', operator: 'gt' }),
|
|
149
|
+
),
|
|
150
|
+
),
|
|
151
|
+
})
|
|
152
|
+
```
|
|
153
|
+
|
|
154
|
+
`db_now` is platform-owned PostgreSQL statement time and only accepts a
|
|
155
|
+
`datetime` field. Missing/null values match only `is_null`; they do not match
|
|
156
|
+
negative constants or time comparisons. The same bounded expression can
|
|
157
|
+
combine `currentUser`, `dimension`, `relation`, `constant`, `null`, and
|
|
158
|
+
`databaseNow` leaves under `allOf`/`anyOf`. Never duplicate this expression in
|
|
159
|
+
a page `where` filter and call it authorization: UI filters are optional
|
|
160
|
+
display state and cannot weaken or replace Native RLS.
|
|
161
|
+
|
|
162
|
+
`readExpression` is always added on top of the base `matchMode`/`rules`; those
|
|
163
|
+
base rules continue to restrict create/update/delete. If writes truly need no
|
|
164
|
+
row scope beyond capability checks, say so explicitly with
|
|
165
|
+
`writeBoundary: 'capability_only'` instead of `matchMode`/`rules`. Never use an
|
|
166
|
+
empty base implicitly: `check` rejects it so an AI cannot accidentally remove
|
|
167
|
+
write authorization while adding a portal read window.
|
|
126
168
|
|
|
127
169
|
When a business membership resource is the durable source of a package role or
|
|
128
170
|
RelationshipGrant, declare the projection instead of calling authorization
|