openxiangda 2.0.0-alpha.21 → 2.0.0-alpha.23

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",
3
- "version": "2.0.0-alpha.21",
3
+ "version": "2.0.0-alpha.23",
4
4
  "description": "Unified OpenXiangda 2.0 CLI, SDK, React runtime, NestJS integration and AI skill distribution.",
5
5
  "type": "module",
6
6
  "main": "./dist/index.js",
@@ -49,12 +49,12 @@
49
49
  "dependencies": {
50
50
  "dayjs": "1.11.18",
51
51
  "docx-preview": "0.3.7",
52
- "openxiangda-cli": "2.0.0-alpha.108",
53
- "openxiangda-contracts": "2.0.0-alpha.50",
54
- "openxiangda-devkit-core": "2.0.0-alpha.67",
55
- "openxiangda-mcp": "2.0.0-alpha.67",
56
- "openxiangda-nest": "2.0.0-alpha.61",
57
- "openxiangda-skill-kit": "2.0.0-alpha.85",
52
+ "openxiangda-cli": "2.0.0-alpha.110",
53
+ "openxiangda-contracts": "2.0.0-alpha.52",
54
+ "openxiangda-devkit-core": "2.0.0-alpha.69",
55
+ "openxiangda-mcp": "2.0.0-alpha.69",
56
+ "openxiangda-nest": "2.0.0-alpha.63",
57
+ "openxiangda-skill-kit": "2.0.0-alpha.87",
58
58
  "xlsx": "https://cdn.sheetjs.com/xlsx-0.20.3/xlsx-0.20.3.tgz"
59
59
  },
60
60
  "peerDependencies": {
@@ -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": "4e79de2626b4fe8ec1049cba8354db8447b2d93160957237df8ba6a3d547bc93"
7
+ "sha256": "0d7a537bb7af5b79bc9e9b78de2a078cfc39201d65cecffd78231086cfa2bf55"
8
8
  }
9
9
  ]
10
10
  }
@@ -10,14 +10,14 @@ Treat requirement discovery, architecture, authorization, development, testing a
10
10
  Before a workspace exists, use this Skill's exact npm version:
11
11
 
12
12
  ```bash
13
- pnpm dlx openxiangda@2.0.0-alpha.21 login --base-url <platform>
14
- pnpm dlx openxiangda@2.0.0-alpha.21 create <directory>
13
+ pnpm dlx openxiangda@2.0.0-alpha.23 login --base-url <platform>
14
+ pnpm dlx openxiangda@2.0.0-alpha.23 create <directory>
15
15
  ```
16
16
 
17
17
  Inside an application, use only its locked executable through `pnpm openxiangda`. Never invoke a bare global `openxiangda`, because that executable may belong to stable 1.x. Moving tags such as `latest` and `alpha` are forbidden. To install or refresh this same Skill from the package, run:
18
18
 
19
19
  ```bash
20
- pnpm dlx openxiangda@2.0.0-alpha.21 skill install --force
20
+ pnpm dlx openxiangda@2.0.0-alpha.23 skill install --force
21
21
  ```
22
22
 
23
23
  Use this order:
@@ -157,6 +157,9 @@ contract:
157
157
 
158
158
  - every guard has a stable `OPENXIANGDA_*` `errorCode`;
159
159
  - `query-empty` protects a business-key uniqueness rule;
160
+ - `record-exists` requires one visible record without forcing a mutation of it;
161
+ - `record-match` requires one visible record plus typed value/field assertions,
162
+ and may protect a mutation of another resource;
160
163
  - `record-assert` locks one exact record and checks declared field values or
161
164
  declared field-to-field comparisons;
162
165
  - `increment` targets one declared integer field and must have a matching
@@ -124,4 +124,50 @@ resource `dataPolicyCode` to the same code. Do not invent `operator`, `value`,
124
124
  policy-level `roleCodes`. The compiler and platform know that `user.*` fields
125
125
  compare their stable `value`; `field` remains the declared field root code.
126
126
 
127
+ When a business membership resource is the durable source of a package role or
128
+ RelationshipGrant, declare the projection instead of calling authorization
129
+ management endpoints from application code:
130
+
131
+ ```ts
132
+ authz: {
133
+ // ...capabilities, roles and policies...
134
+ roleMembershipSources: [{
135
+ code: 'venue-managers',
136
+ name: '场馆管理员角色成员',
137
+ resourceCode: 'venue-manager-relations',
138
+ userIdField: 'manager.value',
139
+ roleCode: 'venue_admin',
140
+ enabledField: 'enabled',
141
+ failureMode: 'strict',
142
+ }],
143
+ relationshipGrantSources: [{
144
+ code: 'venue-member-grants',
145
+ name: '场馆成员关系授权',
146
+ resourceCode: 'venue-manager-relations',
147
+ subject: { type: 'user', userIdField: 'manager.value' },
148
+ relationCode: 'member',
149
+ targetResourceCode: 'venues',
150
+ resourceIdField: 'venue.value',
151
+ operations: ['read', 'update'],
152
+ enabledField: 'enabled',
153
+ failureMode: 'strict',
154
+ }],
155
+ }
156
+ ```
157
+
158
+ The user path must be `user.single.value`; the target path is `id` only when the
159
+ source resource is also the target resource, or a `resource-ref.single.value`
160
+ that points at the declared target resource.
161
+ Operations are a bounded constant list. Create/update/delete the relationship
162
+ resource through the standard Data API; the platform converges and revokes only
163
+ the facts owned by that source. Projection failure is always strict because a
164
+ last-known-good grant could defeat revocation.
165
+
166
+ Use the SDK projection health call after deployment. A platform operator with
167
+ the existing authorization-management capability may run rebuild for historical
168
+ rows or recover a dead-letter job. Rebuild/recovery are idempotent and accept an
169
+ `operationId`; they never accept a user token, user id override or impersonation
170
+ input. Do not write `sourceCode`, canonical membership rows or relationship
171
+ grant rows yourself.
172
+
127
173
  Run `pnpm openxiangda check` after every declaration or permission change.