openxiangda 1.0.164 → 1.0.165

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 (26) hide show
  1. package/README.md +2 -0
  2. package/lib/cli.js +1639 -98
  3. package/lib/utils.js +76 -2
  4. package/openxiangda-skills/SKILL.md +3 -1
  5. package/openxiangda-skills/references/resource-manifest-cheatsheet.md +24 -2
  6. package/openxiangda-skills/skills/openxiangda-core/SKILL.md +4 -0
  7. package/openxiangda-skills/skills/openxiangda-workflow-automation/SKILL.md +2 -0
  8. package/package.json +2 -1
  9. package/packages/sdk/dist/runtime/index.cjs +164 -48
  10. package/packages/sdk/dist/runtime/index.cjs.map +1 -1
  11. package/packages/sdk/dist/runtime/index.d.mts +1 -1
  12. package/packages/sdk/dist/runtime/index.d.ts +1 -1
  13. package/packages/sdk/dist/runtime/index.mjs +164 -48
  14. package/packages/sdk/dist/runtime/index.mjs.map +1 -1
  15. package/packages/sdk/dist/runtime/react.cjs +164 -48
  16. package/packages/sdk/dist/runtime/react.cjs.map +1 -1
  17. package/packages/sdk/dist/runtime/react.d.mts +79 -1
  18. package/packages/sdk/dist/runtime/react.d.ts +79 -1
  19. package/packages/sdk/dist/runtime/react.mjs +164 -48
  20. package/packages/sdk/dist/runtime/react.mjs.map +1 -1
  21. package/templates/openxiangda-react-spa/.cursor/rules/openxiangda-resources.mdc +1 -0
  22. package/templates/openxiangda-react-spa/.qoder/rules/openxiangda-resources.md +1 -0
  23. package/templates/openxiangda-react-spa/AGENTS.md +2 -0
  24. package/templates/sy-lowcode-app-workspace/.cursor/rules/openxiangda-resources.mdc +2 -0
  25. package/templates/sy-lowcode-app-workspace/.qoder/rules/openxiangda-resources.md +1 -0
  26. package/templates/sy-lowcode-app-workspace/AGENTS.md +2 -0
package/README.md CHANGED
@@ -423,6 +423,8 @@ const PublicAccessError = ({ error }: { error: { message?: string } }) => (
423
423
 
424
424
  后端业务逻辑优先声明为 App Function:源码放在 `src/functions/<functionCode>/index.ts`,资源 manifest 放在 `src/resources/functions/<functionCode>.json`。函数运行在 trusted_node 中,通过 `ctx.form.queryOne/queryMany/getById/createOne/updateOne/updateById`、`ctx.dataView`、`ctx.connector`、`ctx.notification`、`ctx.organization`、`ctx.platform.roles`、`ctx.platform.api` 等受控 API 访问平台能力;自动化、流程和运行时接口都可以调用同一个 function。角色查询和角色成员维护优先使用 `ctx.platform.roles.list/findByCode/addUsers/removeUser`,底层 `ctx.platform.api` 返回 HTTP 包装和平台 envelope,需要业务代码自行解包。运行时页面调用会在 `ctx.operator`、`ctx.currentUser`、`ctx.permissions` 中注入可信的 `roleCodes`、`currentRoleCode`、`hasFullAccess`、`isAppAdmin`、`isPlatformAdmin`,敏感动作必须读取这些服务端上下文做授权,不要信任页面 input 里传入的角色字段。`ctx.form.createOne/updateOne/updateById` 是后端受控写入,授权边界是函数 manifest 的 `resources.forms` 绑定和函数调用授权,不是页面用户对目标表单的直接提交入口;报名、签到、福利选择等内部多表写入应走 App Function,不要为了写内部表单给普通用户开放原始 submit 权限。JS_CODE V2 仍兼容,但新逻辑建议写成 function,再由 `function_call` 节点、`sdk.function.invoke(code, { input })` 或 `/:appType/v1/functions/:code/invoke.json` 调用。直接运行时接口默认要求调用者具备应用自动化管理权限;普通页面调用必须在函数 `definitionJson.runtimeInvoke.audience` 声明 `authenticated`、`page_permission_group`、`app_roles` 或 `scope_policy`,`roleCodes` 只用于当前应用角色精确匹配,不支持 `"*"` / `"all-app-roles"`。自动化/流程内部调用走服务端受控上下文。内部业务表单需要关闭原始写入接口时,在表单 settings 中设置 `runtimeWrite.mode="function_only"`。
425
425
 
426
+ App Function 访问第三方凭据时使用 `app_function_secrets_v1`:manifest 顶层只声明 `secretRefs: [{ "name": "dingtalk_org_app_key", "required": true }]`,同时使用 `definitionJson.version="function_v2"`、`runtimeContractVersion="trusted_node_v2"`;源码通过 `await ctx.secrets.get(name)` 解析,并通过 `ctx.utils.http` 访问受控公网 HTTPS(该桥接不会携带平台 Runtime token)。值只能经 `openxiangda secret create|rotate --value-stdin --change <id> --profile <name>` 或隐藏 TTY 输入,禁止进入 Git、manifest、源码、构建产物、plan、日志或异常。带 `secretRefs` 的 Function 必须走 `backend_release_v2`;需要整应用原子发布时先执行 `resource publish function --only <code> --stage-only`,再把返回的真实 `stagedResource` 交给 `release app-finalize --staged-resources-json ...` 完成 `atomic_staged_children_v2`。默认直接激活的 Backend Release 只返回 `activeResource`,不会伪装成 staged;旧平台 capability 不完整时 CLI 会失败关闭,绝不忽略绑定。
427
+
426
428
  平台部门和账号管理走 app-scoped organization 能力。调用者必须在目标应用拥有 `app:organization:manage`;平台管理员天然可用,普通应用角色需要显式授权。Runtime service principal 不会直接放行,`ctx.organization` 会按真实操作人 / audit actor 校验权限。新接口只提供创建、更新、查询和密码专用操作,不提供删除;`account-update` 不能携带 `password`,重置他人密码必须走 `account-reset-password`,当前用户改密用 SDK / `ctx.organization.accounts.changeMyPassword({ oldPassword, newPassword })`。
427
429
 
428
430
  CLI 写操作必须加 `--force`: