openxiangda 1.0.0

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 (121) hide show
  1. package/README.md +58 -0
  2. package/bin/openxiangda.js +11 -0
  3. package/lib/cli.js +2423 -0
  4. package/lib/config.js +121 -0
  5. package/lib/http.js +47 -0
  6. package/lib/skills.js +371 -0
  7. package/lib/utils.js +87 -0
  8. package/lib/workspace-init.js +139 -0
  9. package/openxiangda-skills/SKILL.md +128 -0
  10. package/openxiangda-skills/references/architecture-patterns.md +242 -0
  11. package/openxiangda-skills/references/automation-v3.md +129 -0
  12. package/openxiangda-skills/references/component-guide.md +198 -0
  13. package/openxiangda-skills/references/forms/component-registry.md +53 -0
  14. package/openxiangda-skills/references/forms/form-schema.md +109 -0
  15. package/openxiangda-skills/references/forms/layout-and-rules.md +24 -0
  16. package/openxiangda-skills/references/openxiangda-api.md +466 -0
  17. package/openxiangda-skills/references/pages/page-sdk.md +13 -0
  18. package/openxiangda-skills/references/pages/publish-flow.md +36 -0
  19. package/openxiangda-skills/references/pages/workspace-structure.md +38 -0
  20. package/openxiangda-skills/references/permissions-settings.md +147 -0
  21. package/openxiangda-skills/references/platform-data-model.md +305 -0
  22. package/openxiangda-skills/references/style-system.md +492 -0
  23. package/openxiangda-skills/references/troubleshooting.md +246 -0
  24. package/openxiangda-skills/references/workflow-v3.md +105 -0
  25. package/openxiangda-skills/references/workspace-state.md +45 -0
  26. package/openxiangda-skills/skills/openxiangda-app/SKILL.md +64 -0
  27. package/openxiangda-skills/skills/openxiangda-core/SKILL.md +143 -0
  28. package/openxiangda-skills/skills/openxiangda-form/SKILL.md +76 -0
  29. package/openxiangda-skills/skills/openxiangda-inspect/SKILL.md +40 -0
  30. package/openxiangda-skills/skills/openxiangda-page/SKILL.md +62 -0
  31. package/openxiangda-skills/skills/openxiangda-permission-settings/SKILL.md +95 -0
  32. package/openxiangda-skills/skills/openxiangda-workflow-automation/SKILL.md +97 -0
  33. package/package.json +126 -0
  34. package/packages/sdk/bin/lowcode-workspace.mjs +4 -0
  35. package/packages/sdk/dist/build/index.cjs +33 -0
  36. package/packages/sdk/dist/build/index.cjs.map +1 -0
  37. package/packages/sdk/dist/build/index.d.mts +40 -0
  38. package/packages/sdk/dist/build/index.d.ts +40 -0
  39. package/packages/sdk/dist/build/index.mjs +8 -0
  40. package/packages/sdk/dist/build/index.mjs.map +1 -0
  41. package/packages/sdk/dist/components/index.cjs +18700 -0
  42. package/packages/sdk/dist/components/index.cjs.map +1 -0
  43. package/packages/sdk/dist/components/index.d.mts +2094 -0
  44. package/packages/sdk/dist/components/index.d.ts +2094 -0
  45. package/packages/sdk/dist/components/index.mjs +18649 -0
  46. package/packages/sdk/dist/components/index.mjs.map +1 -0
  47. package/packages/sdk/dist/runtime/index.cjs +1469 -0
  48. package/packages/sdk/dist/runtime/index.cjs.map +1 -0
  49. package/packages/sdk/dist/runtime/index.d.mts +831 -0
  50. package/packages/sdk/dist/runtime/index.d.ts +831 -0
  51. package/packages/sdk/dist/runtime/index.mjs +1420 -0
  52. package/packages/sdk/dist/runtime/index.mjs.map +1 -0
  53. package/packages/sdk/dist/styles/antd-theme.cjs +60 -0
  54. package/packages/sdk/dist/styles/antd-theme.cjs.map +1 -0
  55. package/packages/sdk/dist/styles/antd-theme.d.mts +5 -0
  56. package/packages/sdk/dist/styles/antd-theme.d.ts +5 -0
  57. package/packages/sdk/dist/styles/antd-theme.mjs +35 -0
  58. package/packages/sdk/dist/styles/antd-theme.mjs.map +1 -0
  59. package/packages/sdk/dist/styles/tailwind-preset.cjs +2641 -0
  60. package/packages/sdk/dist/styles/tailwind-preset.cjs.map +1 -0
  61. package/packages/sdk/dist/styles/tailwind-preset.d.mts +75 -0
  62. package/packages/sdk/dist/styles/tailwind-preset.d.ts +75 -0
  63. package/packages/sdk/dist/styles/tailwind-preset.mjs +2618 -0
  64. package/packages/sdk/dist/styles/tailwind-preset.mjs.map +1 -0
  65. package/packages/sdk/dist/styles/tokens.css +73 -0
  66. package/packages/sdk/src/build-source/README.md +9 -0
  67. package/packages/sdk/src/build-source/bin/lowcode-workspace.mjs +7 -0
  68. package/packages/sdk/src/build-source/package.json +34 -0
  69. package/packages/sdk/src/build-source/scripts/build-forms.mjs +824 -0
  70. package/packages/sdk/src/build-source/scripts/build-forms.runtime-entry.test.ts +18 -0
  71. package/packages/sdk/src/build-source/scripts/build-pages.mjs +793 -0
  72. package/packages/sdk/src/build-source/scripts/build-workspace.mjs +64 -0
  73. package/packages/sdk/src/build-source/scripts/publish-all.mjs +127 -0
  74. package/packages/sdk/src/build-source/scripts/publish-oss.mjs +149 -0
  75. package/packages/sdk/src/build-source/scripts/register-bundle.mjs +1 -0
  76. package/packages/sdk/src/build-source/scripts/register.mjs +329 -0
  77. package/packages/sdk/src/build-source/scripts/sync-schema.mjs +301 -0
  78. package/packages/sdk/src/build-source/scripts/utils/form-api.mjs +639 -0
  79. package/packages/sdk/src/build-source/scripts/utils/form-api.test.ts +244 -0
  80. package/packages/sdk/src/build-source/scripts/utils/form-runtime-assets.mjs +57 -0
  81. package/packages/sdk/src/build-source/scripts/utils/form-runtime-assets.test.ts +135 -0
  82. package/packages/sdk/src/build-source/scripts/utils/incremental.mjs +210 -0
  83. package/packages/sdk/src/build-source/scripts/utils/load-config.mjs +257 -0
  84. package/packages/sdk/src/build-source/scripts/utils/load-config.test.ts +44 -0
  85. package/packages/sdk/src/build-source/scripts/utils/mime-types.mjs +70 -0
  86. package/packages/sdk/src/build-source/scripts/utils/namespace-css.mjs +61 -0
  87. package/packages/sdk/src/build-source/scripts/utils/oss-client.mjs +128 -0
  88. package/packages/sdk/src/build-source/scripts/utils/pages.mjs +80 -0
  89. package/packages/sdk/src/build-source/scripts/utils/progress.mjs +57 -0
  90. package/packages/sdk/src/build-source/scripts/utils/register-payload.mjs +89 -0
  91. package/packages/sdk/src/build-source/scripts/utils/register-payload.test.ts +76 -0
  92. package/packages/sdk/src/build-source/scripts/utils/runtime-css-check.mjs +44 -0
  93. package/packages/sdk/src/build-source/scripts/utils/runtime-css-check.test.ts +54 -0
  94. package/packages/sdk/src/build-source/scripts/utils/schema-transform.mjs +130 -0
  95. package/packages/sdk/src/build-source/scripts/utils/schema-transform.test.ts +141 -0
  96. package/packages/sdk/src/build-source/scripts/utils/tailwind-config.mjs +227 -0
  97. package/packages/sdk/src/build-source/scripts/utils/tailwind-config.test.ts +187 -0
  98. package/packages/sdk/src/build-source/src/cli.mjs +679 -0
  99. package/templates/sy-lowcode-app-workspace/app-workspace.config.ts +34 -0
  100. package/templates/sy-lowcode-app-workspace/examples/forms/customer/page.tsx +1 -0
  101. package/templates/sy-lowcode-app-workspace/examples/forms/customer/schema.ts +35 -0
  102. package/templates/sy-lowcode-app-workspace/index.html +12 -0
  103. package/templates/sy-lowcode-app-workspace/package.json +49 -0
  104. package/templates/sy-lowcode-app-workspace/postcss.config.cjs +6 -0
  105. package/templates/sy-lowcode-app-workspace/scripts/build-js-code.mjs +100 -0
  106. package/templates/sy-lowcode-app-workspace/src/dev/App.tsx +26 -0
  107. package/templates/sy-lowcode-app-workspace/src/forms/.gitkeep +1 -0
  108. package/templates/sy-lowcode-app-workspace/src/forms/README.md +48 -0
  109. package/templates/sy-lowcode-app-workspace/src/index.css +28 -0
  110. package/templates/sy-lowcode-app-workspace/src/js-code-nodes/.gitkeep +1 -0
  111. package/templates/sy-lowcode-app-workspace/src/js-code-nodes/types.d.ts +3 -0
  112. package/templates/sy-lowcode-app-workspace/src/main.tsx +36 -0
  113. package/templates/sy-lowcode-app-workspace/src/pages/.gitkeep +1 -0
  114. package/templates/sy-lowcode-app-workspace/src/shared/form-schema.ts +128 -0
  115. package/templates/sy-lowcode-app-workspace/src/types/app-workspace.types.ts +31 -0
  116. package/templates/sy-lowcode-app-workspace/tailwind.config.cjs +30 -0
  117. package/templates/sy-lowcode-app-workspace/tsconfig.app.json +24 -0
  118. package/templates/sy-lowcode-app-workspace/tsconfig.js-code-nodes.json +15 -0
  119. package/templates/sy-lowcode-app-workspace/tsconfig.json +7 -0
  120. package/templates/sy-lowcode-app-workspace/tsconfig.node.json +10 -0
  121. package/templates/sy-lowcode-app-workspace/vite.config.ts +32 -0
@@ -0,0 +1,466 @@
1
+ # OpenXiangda API
2
+
3
+ Base path: `/openxiangda-api/v1`
4
+
5
+ OpenXiangda APIs use `/openxiangda-api/v1`. Legacy `/dingtalk-api/v1.0` exists only for compatibility and should not be used for new AI workflow or automation work.
6
+
7
+ Standard private deployment public paths:
8
+
9
+ - Backend APIs: `<origin>/service/openxiangda-api/v1`
10
+ - Platform management and login UI: `<origin>/platform`
11
+ - App runtime pages: `<origin>/view`
12
+
13
+ CLI profiles store the backend API base, usually `<origin>/service`. Do not call `/openxiangda-api/v1` directly at the root origin.
14
+
15
+ Authentication:
16
+
17
+ - Normal CLI calls use `Authorization: Bearer <accessToken>`.
18
+ - Refresh calls use the `refreshToken` request body.
19
+ - Legacy `/dingtalk-api/v1.0` AK/SK authentication is not part of OpenXiangda.
20
+
21
+ ## Auth
22
+
23
+ ### POST `/auth/cli-sessions`
24
+
25
+ Creates a one-time CLI login session.
26
+
27
+ Response data:
28
+
29
+ ```json
30
+ {
31
+ "sessionId": "string",
32
+ "loginUrl": "https://platform/service/openxiangda-api/v1/auth/cli-sessions/:id/login",
33
+ "qrText": "string",
34
+ "expireIn": 300
35
+ }
36
+ ```
37
+
38
+ ### GET `/auth/cli-sessions/:sessionId`
39
+
40
+ Polls login state. Pending response:
41
+
42
+ ```json
43
+ {
44
+ "status": "pending",
45
+ "expireIn": 298
46
+ }
47
+ ```
48
+
49
+ Authorized response:
50
+
51
+ ```json
52
+ {
53
+ "status": "authorized",
54
+ "accessToken": "jwt",
55
+ "refreshToken": "jwt",
56
+ "accessTokenExpiresAt": 1770000000000,
57
+ "refreshTokenExpiresAt": 1772000000000,
58
+ "user": {},
59
+ "tenant": {}
60
+ }
61
+ ```
62
+
63
+ ### GET `/auth/whoami`
64
+
65
+ Requires Bearer token. Returns user, tenant, platform admin status, and manageable app scope.
66
+
67
+ ### POST `/auth/refresh`
68
+
69
+ Body:
70
+
71
+ ```json
72
+ {
73
+ "refreshToken": "jwt"
74
+ }
75
+ ```
76
+
77
+ ### POST `/auth/logout`
78
+
79
+ Requires Bearer token. Revokes the current CLI token session.
80
+
81
+ ## App Snapshot
82
+
83
+ ### GET `/apps/`
84
+
85
+ Requires Bearer token. Returns apps visible to the current user.
86
+
87
+ ### POST `/apps/`
88
+
89
+ Requires Bearer token. Creates an app with the current user's permissions.
90
+
91
+ ### GET `/apps/:appType`
92
+
93
+ Requires Bearer token. Returns app detail.
94
+
95
+ ### GET `/apps/:appType/forms`
96
+
97
+ Requires Bearer token. Returns forms under the app.
98
+
99
+ ### POST `/apps/:appType/forms`
100
+
101
+ Requires Bearer token. Creates a normal or workflow form shell.
102
+
103
+ This endpoint is not the AI page generation path. User-facing normal form pages and workflow form pages must be built from `sy-lowcode-app-workspace` and registered through workspace publish; otherwise the platform only has the legacy/default schema page.
104
+
105
+ ### GET `/apps/:appType/forms/:formUuid`
106
+
107
+ Requires Bearer token. Returns schema, packages, fields, runtime settings, and custom page publish settings.
108
+
109
+ ### PUT `/apps/:appType/forms/:formUuid`
110
+
111
+ Requires Bearer token. Updates lightweight form metadata such as name.
112
+
113
+ ### PUT `/apps/:appType/forms/:formUuid/schema`
114
+
115
+ Requires Bearer token. Updates the form schema and packages. The request may pass `schema` and `packages` as JSON values or JSON strings.
116
+
117
+ ### POST `/apps/:appType/forms/:formUuid/publish`
118
+
119
+ Requires Bearer token. Registers the built form bundle by writing custom page runtime settings to the form.
120
+
121
+ ### GET `/apps/:appType/forms/:formUuid/settings`
122
+
123
+ Requires Bearer token. Returns normalized form settings.
124
+
125
+ ### PUT `/apps/:appType/forms/:formUuid/settings`
126
+
127
+ Requires Bearer token. Deep-merges form settings.
128
+
129
+ ### GET `/apps/:appType/forms/:formUuid/field-indexes`
130
+
131
+ Requires Bearer token. Returns indexable fields, system indexes, and custom field index status.
132
+
133
+ ### PUT `/apps/:appType/forms/:formUuid/field-indexes`
134
+
135
+ Requires Bearer token. Saves custom field index definitions and reconciles database indexes.
136
+
137
+ Body:
138
+
139
+ ```json
140
+ {
141
+ "indexes": [
142
+ { "id": "idx_customer", "fields": ["customerName"] }
143
+ ]
144
+ }
145
+ ```
146
+
147
+ ### GET `/apps/:appType/forms/:formUuid/data-management`
148
+
149
+ Requires Bearer token. Returns data management page config.
150
+
151
+ ### PUT `/apps/:appType/forms/:formUuid/data-management`
152
+
153
+ Requires Bearer token. Saves data management page config.
154
+
155
+ Body:
156
+
157
+ ```json
158
+ {
159
+ "config": {
160
+ "columns": [],
161
+ "filters": [],
162
+ "actions": []
163
+ }
164
+ }
165
+ ```
166
+
167
+ ### GET `/apps/:appType/forms/:formUuid/public-access`
168
+
169
+ Requires Bearer token. Returns public/guest access config for the form.
170
+
171
+ ### PUT `/apps/:appType/forms/:formUuid/public-access`
172
+
173
+ Requires Bearer token. Creates or updates public/guest access config.
174
+
175
+ Body:
176
+
177
+ ```json
178
+ {
179
+ "isPublic": true,
180
+ "description": "公开填报"
181
+ }
182
+ ```
183
+
184
+ ### DELETE `/apps/:appType/forms/:formUuid/public-access`
185
+
186
+ Requires Bearer token. Deletes public/guest access config for the form.
187
+
188
+ ### GET `/apps/:appType/menus`
189
+
190
+ Requires Bearer token. Returns menu tree under the app.
191
+
192
+ ### POST `/apps/:appType/menus`
193
+
194
+ Requires Bearer token. Creates a menu item.
195
+
196
+ ### PUT `/apps/:appType/menus/:menuId`
197
+
198
+ Requires Bearer token. Updates a menu item.
199
+
200
+ ### DELETE `/apps/:appType/menus/:menuId`
201
+
202
+ Requires Bearer token. Deletes a menu item.
203
+
204
+ ### PUT `/apps/:appType/menus/actions/sort`
205
+
206
+ Requires Bearer token. Updates menu sorting and parent relationships in batch.
207
+
208
+ ### GET `/apps/:appType/workflows`
209
+
210
+ Requires Bearer token. Lists workflow definitions in the app. Supports `formUuid`, `isPublished`, `page`, and `pageSize` query parameters.
211
+
212
+ ### POST `/apps/:appType/workflows`
213
+
214
+ Requires Bearer token. Creates a workflow definition draft for a form.
215
+
216
+ Body:
217
+
218
+ ```json
219
+ {
220
+ "formUuid": "FORM_XXX",
221
+ "definitionJson": { "version": "v3", "nodes": [], "edges": [], "flowConfig": {} },
222
+ "viewJson": {}
223
+ }
224
+ ```
225
+
226
+ ### POST `/apps/:appType/workflows/definition/validate`
227
+
228
+ Requires Bearer token. Validates workflow v3 JSON before saving or publishing.
229
+
230
+ ### GET `/apps/:appType/workflows/:workflowId`
231
+
232
+ Requires Bearer token. Returns a workflow definition detail.
233
+
234
+ ### PUT `/apps/:appType/workflows/:workflowId`
235
+
236
+ Requires Bearer token. Updates a workflow draft. If the workflow is already published, the backend creates a new unpublished version.
237
+
238
+ ### POST `/apps/:appType/workflows/:workflowId/publish`
239
+
240
+ Requires Bearer token. Publishes the workflow definition. Pass `{ "isPublished": false }` to unpublish.
241
+
242
+ ### DELETE `/apps/:appType/workflows/:workflowId`
243
+
244
+ Requires Bearer token. Deletes an unpublished workflow definition.
245
+
246
+ ### GET `/apps/:appType/automations`
247
+
248
+ Requires Bearer token. Lists automations in the app. Supports `formUuid`, `isPublished`, `isEnabled`, `triggerType`, `keyword`, `page`, and `pageSize`.
249
+
250
+ ### POST `/apps/:appType/automations`
251
+
252
+ Requires Bearer token. Creates an automation draft.
253
+
254
+ Body:
255
+
256
+ ```json
257
+ {
258
+ "name": "客户提交后通知",
259
+ "description": "",
260
+ "formUuid": "FORM_XXX",
261
+ "triggerConfig": {
262
+ "type": "form_data_submitted",
263
+ "appType": "APP_XXX",
264
+ "formUuid": "FORM_XXX",
265
+ "enabled": true
266
+ },
267
+ "definitionJson": { "version": "v3", "nodes": [], "edges": [] },
268
+ "viewJson": {}
269
+ }
270
+ ```
271
+
272
+ ### POST `/apps/:appType/automations/definition/validate`
273
+
274
+ Requires Bearer token. Validates automation designer-v3 JSON and optional trigger config.
275
+
276
+ ### POST `/apps/:appType/automations/cron/validate`
277
+
278
+ Requires Bearer token. Validates a cron expression used by scheduled automations.
279
+
280
+ ### GET `/apps/:appType/automations/:automationId`
281
+
282
+ Requires Bearer token. Returns automation detail.
283
+
284
+ ### PUT `/apps/:appType/automations/:automationId`
285
+
286
+ Requires Bearer token. Updates automation draft metadata, trigger config, definition JSON, or view JSON. Published automations create a new draft version.
287
+
288
+ ### POST `/apps/:appType/automations/:automationId/publish`
289
+
290
+ Requires Bearer token. Publishes an automation.
291
+
292
+ ### POST `/apps/:appType/automations/:automationId/unpublish`
293
+
294
+ Requires Bearer token. Unpublishes and disables an automation.
295
+
296
+ ### POST `/apps/:appType/automations/:automationId/enable`
297
+
298
+ Requires Bearer token. Enables a published automation.
299
+
300
+ ### POST `/apps/:appType/automations/:automationId/disable`
301
+
302
+ Requires Bearer token. Disables an automation.
303
+
304
+ ### DELETE `/apps/:appType/automations/:automationId`
305
+
306
+ Requires Bearer token. Deletes an unpublished automation.
307
+
308
+ ### GET `/apps/:appType/automations/:automationId/versions`
309
+
310
+ Requires Bearer token. Lists versions in the same automation group.
311
+
312
+ ### GET `/apps/:appType/automations/:automationId/executions`
313
+
314
+ Requires Bearer token. Lists execution records for diagnosis.
315
+
316
+ ### GET `/apps/:appType/roles`
317
+
318
+ Requires Bearer token. Lists app roles visible to the current user.
319
+
320
+ ### POST `/apps/:appType/roles`
321
+
322
+ Requires Bearer token. Creates an app-scoped role.
323
+
324
+ Body:
325
+
326
+ ```json
327
+ {
328
+ "code": "sales",
329
+ "name": "销售",
330
+ "description": ""
331
+ }
332
+ ```
333
+
334
+ ### GET `/apps/:appType/roles/:roleId`
335
+
336
+ Requires Bearer token. Returns app role detail.
337
+
338
+ ### PUT `/apps/:appType/roles/:roleId`
339
+
340
+ Requires Bearer token. Updates app role metadata.
341
+
342
+ ### DELETE `/apps/:appType/roles/:roleId`
343
+
344
+ Requires Bearer token. Deletes a non-system app role.
345
+
346
+ ### GET `/apps/:appType/roles/:roleId/users`
347
+
348
+ Requires Bearer token. Lists users under an app role.
349
+
350
+ ### POST `/apps/:appType/roles/:roleId/users`
351
+
352
+ Requires Bearer token. Adds users to an app role.
353
+
354
+ ### DELETE `/apps/:appType/roles/:roleId/users/:userId`
355
+
356
+ Requires Bearer token. Removes one user from an app role.
357
+
358
+ ### GET `/apps/:appType/page-permission-groups`
359
+
360
+ Requires Bearer token. Lists page permission groups.
361
+
362
+ ### POST `/apps/:appType/page-permission-groups`
363
+
364
+ Requires Bearer token. Creates a page permission group.
365
+
366
+ Body:
367
+
368
+ ```json
369
+ {
370
+ "name": "销售可见页面",
371
+ "roles": ["sales"],
372
+ "menuFormUuids": ["FORM_XXX"]
373
+ }
374
+ ```
375
+
376
+ An empty `menuFormUuids` array means all menus/pages are visible to the matched roles.
377
+
378
+ ### GET `/apps/:appType/page-permission-groups/:groupId`
379
+
380
+ Requires Bearer token. Returns page permission group detail.
381
+
382
+ ### PUT `/apps/:appType/page-permission-groups/:groupId`
383
+
384
+ Requires Bearer token. Updates a page permission group.
385
+
386
+ ### DELETE `/apps/:appType/page-permission-groups/:groupId`
387
+
388
+ Requires Bearer token. Deletes a page permission group.
389
+
390
+ ### GET `/apps/:appType/page-permission-groups/user-menu-permissions`
391
+
392
+ Requires Bearer token. Returns the current user's menu visibility summary for the app.
393
+
394
+ ### GET `/apps/:appType/forms/:formUuid/permission-groups`
395
+
396
+ Requires Bearer token. Lists form permission groups.
397
+
398
+ ### POST `/apps/:appType/forms/:formUuid/permission-groups`
399
+
400
+ Requires Bearer token. Creates a form permission group.
401
+
402
+ Body:
403
+
404
+ ```json
405
+ {
406
+ "name": "销售查看",
407
+ "type": "view",
408
+ "roles": ["sales"],
409
+ "dataScope": [{ "type": "self" }],
410
+ "operations": ["view"],
411
+ "fieldPermissions": [],
412
+ "dataPermission": null
413
+ }
414
+ ```
415
+
416
+ ### GET `/apps/:appType/forms/:formUuid/permission-groups/:groupId`
417
+
418
+ Requires Bearer token. Returns form permission group detail.
419
+
420
+ ### PUT `/apps/:appType/forms/:formUuid/permission-groups/:groupId`
421
+
422
+ Requires Bearer token. Updates a form permission group.
423
+
424
+ ### DELETE `/apps/:appType/forms/:formUuid/permission-groups/:groupId`
425
+
426
+ Requires Bearer token. Deletes a form permission group.
427
+
428
+ ### GET `/apps/:appType/forms/:formUuid/permission-summary`
429
+
430
+ Requires Bearer token. Returns the merged current-user view permission summary for a form.
431
+
432
+ ### GET `/apps/:appType/forms/:formUuid/field-permissions`
433
+
434
+ Requires Bearer token. Returns merged current-user field permissions for a form.
435
+
436
+ ### GET `/apps/:appType/pages`
437
+
438
+ Requires Bearer token. Returns code page definitions.
439
+
440
+ ### POST `/apps/:appType/pages/manifest/import`
441
+
442
+ Requires Bearer token. Imports an application-level code page manifest.
443
+
444
+ ### GET `/apps/:appType/pages/releases`
445
+
446
+ Requires Bearer token. Returns application-level code page release summaries.
447
+
448
+ ### POST `/apps/:appType/pages/releases/activate`
449
+
450
+ Requires Bearer token. Activates a release by `version` and `buildId`.
451
+
452
+ ### POST `/apps/:appType/pages/publish`
453
+
454
+ Requires Bearer token. Publishes one or more code pages directly.
455
+
456
+ ### POST `/apps/:appType/pages/:pageCode/publish`
457
+
458
+ Requires Bearer token. Publishes one code page directly, using `pageCode` as the stable logical key.
459
+
460
+ ### GET `/apps/:appType/pages/:pageKey/bootstrap`
461
+
462
+ Requires Bearer token. Returns runtime bootstrap information for an existing code page.
463
+
464
+ ### GET `/apps/:appType/snapshot`
465
+
466
+ Requires Bearer token. Returns app metadata, forms, menus, code page definitions, code page releases, and permission hints.
@@ -0,0 +1,13 @@
1
+ # Page Runtime SDK
2
+
3
+ Use `openxiangda/runtime` for platform data access in code pages.
4
+
5
+ Guidelines:
6
+
7
+ - Do not hardcode `/openxiangda-api` calls inside end-user page components unless the page is explicitly an admin tool.
8
+ - Prefer SDK modules for form data, user context, permissions, and platform navigation.
9
+ - For the current user's department hierarchy, use `sdk.department.getCurrentUserParentDepartments()`; do not hardcode `GET /department/:id/parentDepartments` in page code.
10
+ - Keep API calls behind small local functions so generated UI stays testable.
11
+ - Treat user context and tenant context as runtime-provided values.
12
+
13
+ When the SDK lacks a capability, document the fallback and keep it isolated.
@@ -0,0 +1,36 @@
1
+ # Code Page Publish Flow
2
+
3
+ Preferred publish command:
4
+
5
+ ```bash
6
+ openxiangda workspace publish --profile <name>
7
+ ```
8
+
9
+ The CLI injects:
10
+
11
+ - `OPENXIANGDA_PROFILE`
12
+ - `OPENXIANGDA_BASE_URL`
13
+ - `OPENXIANGDA_ACCESS_TOKEN`
14
+ - `OPENXIANGDA_APP_TYPE`
15
+
16
+ Workspace tools then:
17
+
18
+ 1. Scan `src/forms/*/schema.ts` and `page.tsx` for normal and workflow form pages.
19
+ 2. Scan `src/pages/*/page.config.ts` and React entries for custom code pages.
20
+ 3. Create or bind platform form shells only as needed.
21
+ 4. Build shared form/page runtimes and per-form/per-page bundles.
22
+ 5. Upload assets to OSS.
23
+ 6. Sync form metadata and register form/page bundles through `/openxiangda-api/v1`.
24
+
25
+ Direct code page publish:
26
+
27
+ ```bash
28
+ openxiangda page publish <pageCode> \
29
+ --entry-url <url> \
30
+ --css-urls <url1,url2> \
31
+ --version <version> \
32
+ --build-id <buildId> \
33
+ --profile <name>
34
+ ```
35
+
36
+ Use direct publish only for already built assets or targeted repair. It is not the normal AI generation flow.
@@ -0,0 +1,38 @@
1
+ # App Workspace Structure
2
+
3
+ Form pages, workflow form pages, and custom code pages live in `sy-lowcode-app-workspace`.
4
+
5
+ Create a new workspace with:
6
+
7
+ ```bash
8
+ openxiangda workspace init ./my-app-workspace
9
+ cd ./my-app-workspace
10
+ pnpm install
11
+ openxiangda workspace bind --profile <name> --app-type APP_XXXX
12
+ ```
13
+
14
+ You can bind during initialization when the target app is already known:
15
+
16
+ ```bash
17
+ openxiangda workspace init ./my-app-workspace --profile <name> --app-type APP_XXXX
18
+ ```
19
+
20
+ Typical code page layout:
21
+
22
+ ```text
23
+ src/pages/<pageCode>/
24
+ ├── page.tsx
25
+ ├── index.tsx
26
+ ├── styles.css
27
+ └── assets/
28
+ ```
29
+
30
+ Rules:
31
+
32
+ - `pageCode` is the stable local key.
33
+ - Form pages use `src/forms/<formCode>/schema.ts` plus `src/forms/<formCode>/page.tsx`.
34
+ - Workflow form pages use the same form page structure; workflow v3 definitions are separate platform resources.
35
+ - Keep page-specific assets under the page directory.
36
+ - Shared components can live under `src/components/` when reused.
37
+ - Build artifacts under `dist/` are generated and should not be hand edited.
38
+ - Publish through `openxiangda workspace publish --profile <name>`.
@@ -0,0 +1,147 @@
1
+ # Permissions And Settings Reference
2
+
3
+ OpenXiangda permission APIs use ordinary user Bearer tokens. The effective permissions are the same as the current frontend user.
4
+
5
+ ## Role Codes
6
+
7
+ Use stable local role codes:
8
+
9
+ ```json
10
+ {
11
+ "code": "sales",
12
+ "name": "销售",
13
+ "description": "销售人员"
14
+ }
15
+ ```
16
+
17
+ Role IDs are platform-specific. Store them only in `.openxiangda/state.json` under the active profile.
18
+
19
+ ## Page Permission Groups
20
+
21
+ Page permission groups map role codes to visible menu `formUuid` values:
22
+
23
+ ```json
24
+ {
25
+ "name": "销售页面",
26
+ "roles": ["sales"],
27
+ "menuFormUuids": ["FORM_CUSTOMER", "FORM_ORDER"]
28
+ }
29
+ ```
30
+
31
+ Rules:
32
+
33
+ - `roles: []` means all roles can match.
34
+ - `menuFormUuids: []` means all menus/pages are visible to matched roles.
35
+ - Prefer `--form-codes` in CLI so each profile resolves its own form UUIDs.
36
+
37
+ ## Form Permission Groups
38
+
39
+ Submit group:
40
+
41
+ ```json
42
+ {
43
+ "name": "销售提交",
44
+ "type": "submit",
45
+ "roles": ["sales"],
46
+ "operations": ["submit"]
47
+ }
48
+ ```
49
+
50
+ View group:
51
+
52
+ ```json
53
+ {
54
+ "name": "销售查看",
55
+ "type": "view",
56
+ "roles": ["sales"],
57
+ "dataScope": [{ "type": "self" }],
58
+ "operations": ["view", "edit"],
59
+ "fieldPermissions": [
60
+ {
61
+ "componentName": "Text",
62
+ "fieldName": "客户名称",
63
+ "label": "customerName",
64
+ "value": "FORM_FILED_VIEW"
65
+ }
66
+ ]
67
+ }
68
+ ```
69
+
70
+ Field permission values:
71
+
72
+ - `FORM_FILED_EDIT`
73
+ - `FORM_FILED_VIEW`
74
+ - `FORM_FILED_HIDDEN`
75
+
76
+ Common data scopes:
77
+
78
+ - `all`
79
+ - `self`
80
+ - `current_department`
81
+ - `sub_departments`
82
+ - `same_level_departments`
83
+ - `custom_departments`
84
+
85
+ Condition-style data permission:
86
+
87
+ ```json
88
+ {
89
+ "type": "condition",
90
+ "condition": {
91
+ "logic": "AND",
92
+ "rules": [
93
+ {
94
+ "field": "owner",
95
+ "componentType": "Employee",
96
+ "op": "=",
97
+ "value": "${CURRENT_USER_ID}"
98
+ }
99
+ ]
100
+ }
101
+ }
102
+ ```
103
+
104
+ ## Settings
105
+
106
+ Form settings are deep-merged:
107
+
108
+ ```json
109
+ {
110
+ "customPage": {
111
+ "enabled": true,
112
+ "bundleUrl": "https://cdn.example.com/form.js"
113
+ }
114
+ }
115
+ ```
116
+
117
+ Field index config:
118
+
119
+ ```json
120
+ [
121
+ { "id": "idx_customer_name", "fields": ["customerName"] },
122
+ { "id": "idx_owner", "fields": ["owner"] }
123
+ ]
124
+ ```
125
+
126
+ Data management config is stored as an opaque JSON object by the platform. Keep it profile-neutral and avoid embedding form UUIDs from another platform:
127
+
128
+ ```json
129
+ {
130
+ "columns": [
131
+ { "fieldId": "customerName", "title": "客户名称", "visible": true }
132
+ ],
133
+ "filters": [],
134
+ "actions": []
135
+ }
136
+ ```
137
+
138
+ Public access config:
139
+
140
+ ```json
141
+ {
142
+ "isPublic": true,
143
+ "description": "公开填报"
144
+ }
145
+ ```
146
+
147
+ Public access is resolved by `appType + formUuid`; no local ID mapping is needed.