zion-mcp 2.8.0 → 2.8.1
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/README.md +3 -4
- package/dist/{chunk-CAF64CO7.js → chunk-M5JIBLJM.js} +5 -51
- package/dist/{chunk-3KE7DBBZ.js → chunk-PZVJXEVM.js} +1 -1
- package/dist/{chunk-UNPVTOSR.js → chunk-UM6ENMTM.js} +1 -1
- package/dist/{chunk-OHILD5KP.js → chunk-WXFOSPKR.js} +1 -1
- package/dist/{chunk-4RMPLI2R.js → chunk-XHFWXEZR.js} +1 -1
- package/dist/{chunk-U2LHS4U2.js → chunk-Y7ELFXER.js} +1 -1
- package/dist/{cli-BJFYETZJ.js → cli-KNWMEEXE.js} +4 -4
- package/dist/{corpus-XVQ4ZV2V.js → corpus-5HA6PGP5.js} +1 -1
- package/dist/{index.cjs-JL7FJKD6.js → index.cjs-Q57TQ2R4.js} +1 -1
- package/dist/{json-crdt-322RBKNB.js → json-crdt-5Q5CWOET.js} +1 -1
- package/dist/{json-crdt-patch-X2W6V7VS.js → json-crdt-patch-FOT7IATI.js} +1 -1
- package/dist/server.js +1 -1
- package/dist/{surface-S5OGOVQV.js → surface-EKEYXH5K.js} +1 -1
- package/dist/{ztype-BFQK2PDI.js → ztype-GT63RGA2.js} +4 -4
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -20,7 +20,7 @@ Zion MCP Server 是 [FunctorZ (Zion)](https://functorz.com) 提供的官方 [Mod
|
|
|
20
20
|
4. 填写以下信息:
|
|
21
21
|
- **Name**: Zion MCP
|
|
22
22
|
- **Type**: command
|
|
23
|
-
- **Command**: `npx -y zion-mcp@2.8.
|
|
23
|
+
- **Command**: `npx -y zion-mcp@2.8.1`
|
|
24
24
|
5. 保存并重启 Cursor (如果需要)。
|
|
25
25
|
|
|
26
26
|
### 在 Claude Desktop 中使用
|
|
@@ -32,7 +32,7 @@ Zion MCP Server 是 [FunctorZ (Zion)](https://functorz.com) 提供的官方 [Mod
|
|
|
32
32
|
"mcpServers": {
|
|
33
33
|
"zion": {
|
|
34
34
|
"command": "npx",
|
|
35
|
-
"args": ["-y", "zion-mcp@2.8.
|
|
35
|
+
"args": ["-y", "zion-mcp@2.8.1"]
|
|
36
36
|
}
|
|
37
37
|
}
|
|
38
38
|
}
|
|
@@ -75,7 +75,7 @@ Zion MCP Server 是 [FunctorZ (Zion)](https://functorz.com) 提供的官方 [Mod
|
|
|
75
75
|
- `schema_get_tpa_config_detail` — op: `GET_TPA_CONFIG_DETAIL`
|
|
76
76
|
- `schema_overview` — op: `GET_ENTITY_RELATION_GRAPH` / `GET_PROJECT_OVERVIEW`
|
|
77
77
|
- `schema_payment` — op: `ACTIVATE_PAYMENT` / `GET_PAYMENT_CONFIGS`
|
|
78
|
-
- `schema_permission` — op: `ACTIVATE_ROLE_PERMISSION` / `ADD_ROLES` / `DELETE_ROLES` / `GET_ALL_ROLES_INFO` / `GET_ROLE_DETAIL` / `GET_TABLE_PERMISSION` / `
|
|
78
|
+
- `schema_permission` — op: `ACTIVATE_ROLE_PERMISSION` / `ADD_ROLES` / `DELETE_ROLES` / `GET_ALL_ROLES_INFO` / `GET_ROLE_DETAIL` / `GET_TABLE_PERMISSION` / `SET_ROLE_PERMISSION_CHECK` / `UPDATE_ROLE` / `UPDATE_ROLE_ACTION_FLOW_PERMISSION` / `UPDATE_ROLE_API_PERMISSION` / `UPDATE_ROLE_PAYMENT_PERMISSION` / `UPDATE_ROLE_TABLE_PERMISSION` / `UPDATE_ROLE_TPA_PERMISSION` / `UPDATE_ROLE_ZAI_PERMISSION`
|
|
79
79
|
- `schema_request_filter` — op: `ADD_FILTER` / `ADD_CONDITION` / `ADD_SORT` / `DELETE_FILTER` / `DELETE_CONDITION` / `DELETE_SORT` / `DUPLICATE_REQUEST_CONDITIONAL_FILTER` / `CONTEXT` / `NEST_CONDITION` / `REORDER_FILTERS` / `REORDER_SORT` / `SET_UPDATE_COLUMN_ARITHMETIC` / `TOGGLE_CONDITION_AND_OR` / `TOGGLE_CONDITION_NOT` / `UPDATE_FILTER` / `SET_CONDITION_OPERATOR` / `UPDATE_SORT`
|
|
80
80
|
- `schema_secret` — op: `ADD_SECRET_CONFIGS` / `DELETE_SECRET_CONFIGS` / `GET_ALL_SECRET_CONFIGS` / `UPDATE_SECRET_CONFIG`
|
|
81
81
|
- `schema_set_tpa_config_paging` — op: `SET_TPA_CONFIG_PAGING`
|
|
@@ -88,7 +88,6 @@ Zion MCP Server 是 [FunctorZ (Zion)](https://functorz.com) 提供的官方 [Mod
|
|
|
88
88
|
- `schema_update_tpa_parameter_child` — op: `UPDATE_TPA_PARAMETER_CHILD`
|
|
89
89
|
- `schema_update_tpa_response_data` — op: `UPDATE_TPA_RESPONSE_DATA`
|
|
90
90
|
- `schema_update_tpa_response_data_child` — op: `UPDATE_TPA_RESPONSE_DATA_CHILD`
|
|
91
|
-
- `schema_view` — op: `ADD` / `ANALYZE_SQL` / `DELETE` / `GET_INFOS` / `UPDATE`
|
|
92
91
|
- `schema_zai_config` — op: `ADD_ZAI_CONFIGS` / `ADD_ZAI_CONFIG_API_CONTEXTS` / `ADD_ZAI_CONFIG_DB_CONTEXTS` / `ADD_ZAI_CONFIG_INPUT_ARGS` / `ADD_ZAI_CONFIG_OUTPUT_FIELDS` / `ADD_ZAI_CONFIG_TOOLS` / `ADD_ZAI_CONFIG_TPA_CONTEXTS` / `DELETE_ZAI_CONFIGS` / `DELETE_ZAI_CONFIG_API_CONTEXTS` / `DELETE_ZAI_CONFIG_DB_CONTEXTS` / `DELETE_ZAI_CONFIG_INPUT_ARGS` / `DELETE_ZAI_CONFIG_OUTPUT_FIELDS` / `DELETE_ZAI_CONFIG_TOOLS` / `DELETE_ZAI_CONFIG_TPA_CONTEXTS` / `DUPLICATE_ZAI_CONFIG` / `GET_ALL_ZAI_CONFIGS_INFO` / `GET_ZAI_CONFIG_DETAIL` / `GET_ZAI_CONFIG_SELECTABLE_TYPES` / `GET_ZAI_MODEL_OPTIONS` / `UPDATE_ZAI_CONFIG` / `UPDATE_ZAI_CONFIG_API_CONTEXT` / `UPDATE_ZAI_CONFIG_DB_CONTEXT` / `UPDATE_ZAI_CONFIG_INPUT_ARGS` / `UPDATE_ZAI_CONFIG_OUTPUT` / `UPDATE_ZAI_CONFIG_OUTPUT_FIELD` / `UPDATE_ZAI_CONFIG_OUTPUT_MODE` / `UPDATE_ZAI_CONFIG_TOOL` / `UPDATE_ZAI_CONFIG_TOOL_DESCRIPTION_CONFIGS` / `UPDATE_ZAI_CONFIG_TOOL_FIELD_DESCRIPTIONS` / `UPDATE_ZAI_CONFIG_TPA_CONTEXT`
|
|
93
92
|
<!-- GENERATED-ZTYPE-TOOLS:END -->
|
|
94
93
|
- **Schema 编辑 — 底层**: `ztype_tool_calls`。
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { createRequire as __nodeCreateRequire } from 'node:module';
|
|
2
2
|
const require = __nodeCreateRequire(import.meta.url);
|
|
3
|
-
import{d as Lr,e as zn,i as Ou,j as Su}from"./chunk-4RMPLI2R.js";import{c as N,d as ks,e as vu,g as u}from"./chunk-OHILD5KP.js";var tr=N(te=>{"use strict";u();Object.defineProperty(te,"__esModule",{value:!0});te.regexpCode=te.getEsmExportName=te.getProperty=te.safeStringify=te.stringify=te.strConcat=te.addCodeArg=te.str=te._=te.nil=te._Code=te.Name=te.IDENTIFIER=te._CodeOrName=void 0;var Qa=class{};te._CodeOrName=Qa;te.IDENTIFIER=/^[a-z$_][a-z$_0-9]*$/i;var In=class extends Qa{constructor(e){if(super(),!te.IDENTIFIER.test(e))throw new Error("CodeGen: name must be a valid identifier");this.str=e}toString(){return this.str}emptyStr(){return!1}get names(){return{[this.str]:1}}};te.Name=In;var tt=class extends Qa{constructor(e){super(),this._items=typeof e=="string"?[e]:e}toString(){return this.str}emptyStr(){if(this._items.length>1)return!1;let e=this._items[0];return e===""||e==='""'}get str(){var e;return(e=this._str)!==null&&e!==void 0?e:this._str=this._items.reduce((n,a)=>`${n}${a}`,"")}get names(){var e;return(e=this._names)!==null&&e!==void 0?e:this._names=this._items.reduce((n,a)=>(a instanceof In&&(n[a.str]=(n[a.str]||0)+1),n),{})}};te._Code=tt;te.nil=new tt("");function Sm(t,...e){let n=[t[0]],a=0;for(;a<e.length;)bl(n,e[a]),n.push(t[++a]);return new tt(n)}te._=Sm;var Tl=new tt("+");function Nm(t,...e){let n=[er(t[0])],a=0;for(;a<e.length;)n.push(Tl),bl(n,e[a]),n.push(Tl,er(t[++a]));return TA(n),new tt(n)}te.str=Nm;function bl(t,e){e instanceof tt?t.push(...e._items):e instanceof In?t.push(e):t.push(AA(e))}te.addCodeArg=bl;function TA(t){let e=1;for(;e<t.length-1;){if(t[e]===Tl){let n=bA(t[e-1],t[e+1]);if(n!==void 0){t.splice(e-1,3,n);continue}t[e++]="+"}e++}}function bA(t,e){if(e==='""')return t;if(t==='""')return e;if(typeof t=="string")return e instanceof In||t[t.length-1]!=='"'?void 0:typeof e!="string"?`${t.slice(0,-1)}${e}"`:e[0]==='"'?t.slice(0,-1)+e.slice(1):void 0;if(typeof e=="string"&&e[0]==='"'&&!(t instanceof In))return`"${t}${e.slice(1)}`}function wA(t,e){return e.emptyStr()?t:t.emptyStr()?e:Nm`${t}${e}`}te.strConcat=wA;function AA(t){return typeof t=="number"||typeof t=="boolean"||t===null?t:er(Array.isArray(t)?t.join(","):t)}function IA(t){return new tt(er(t))}te.stringify=IA;function er(t){return JSON.stringify(t).replace(/\u2028/g,"\\u2028").replace(/\u2029/g,"\\u2029")}te.safeStringify=er;function vA(t){return typeof t=="string"&&te.IDENTIFIER.test(t)?new tt(`.${t}`):Sm`[${t}]`}te.getProperty=vA;function OA(t){if(typeof t=="string"&&te.IDENTIFIER.test(t))return new tt(`${t}`);throw new Error(`CodeGen: invalid export name: ${t}, use explicit $id name mapping`)}te.getEsmExportName=OA;function SA(t){return new tt(t.toString())}te.regexpCode=SA});var Il=N(Be=>{"use strict";u();Object.defineProperty(Be,"__esModule",{value:!0});Be.ValueScope=Be.ValueScopeName=Be.Scope=Be.varKinds=Be.UsedValueState=void 0;var je=tr(),wl=class extends Error{constructor(e){super(`CodeGen: "code" for ${e} not defined`),this.value=e.value}},Mo;(function(t){t[t.Started=0]="Started",t[t.Completed=1]="Completed"})(Mo||(Be.UsedValueState=Mo={}));Be.varKinds={const:new je.Name("const"),let:new je.Name("let"),var:new je.Name("var")};var zo=class{constructor({prefixes:e,parent:n}={}){this._names={},this._prefixes=e,this._parent=n}toName(e){return e instanceof je.Name?e:this.name(e)}name(e){return new je.Name(this._newName(e))}_newName(e){let n=this._names[e]||this._nameGroup(e);return`${e}${n.index++}`}_nameGroup(e){var n,a;if(!((a=(n=this._parent)===null||n===void 0?void 0:n._prefixes)===null||a===void 0)&&a.has(e)||this._prefixes&&!this._prefixes.has(e))throw new Error(`CodeGen: prefix "${e}" is not allowed in this scope`);return this._names[e]={prefix:e,index:0}}};Be.Scope=zo;var Fo=class extends je.Name{constructor(e,n){super(n),this.prefix=e}setValue(e,{property:n,itemIndex:a}){this.value=e,this.scopePath=(0,je._)`.${new je.Name(n)}[${a}]`}};Be.ValueScopeName=Fo;var NA=(0,je._)`\n`,Al=class extends zo{constructor(e){super(e),this._values={},this._scope=e.scope,this.opts={...e,_n:e.lines?NA:je.nil}}get(){return this._scope}name(e){return new Fo(e,this._newName(e))}value(e,n){var a;if(n.ref===void 0)throw new Error("CodeGen: ref must be passed in value");let r=this.toName(e),{prefix:o}=r,s=(a=n.key)!==null&&a!==void 0?a:n.ref,i=this._values[o];if(i){let h=i.get(s);if(h)return h}else i=this._values[o]=new Map;i.set(s,r);let l=this._scope[o]||(this._scope[o]=[]),d=l.length;return l[d]=n.ref,r.setValue(n,{property:o,itemIndex:d}),r}getValue(e,n){let a=this._values[e];if(a)return a.get(n)}scopeRefs(e,n=this._values){return this._reduceValues(n,a=>{if(a.scopePath===void 0)throw new Error(`CodeGen: name "${a}" has no value`);return(0,je._)`${e}${a.scopePath}`})}scopeCode(e=this._values,n,a){return this._reduceValues(e,r=>{if(r.value===void 0)throw new Error(`CodeGen: name "${r}" has no value`);return r.value.code},n,a)}_reduceValues(e,n,a={},r){let o=je.nil;for(let s in e){let i=e[s];if(!i)continue;let l=a[s]=a[s]||new Map;i.forEach(d=>{if(l.has(d))return;l.set(d,Mo.Started);let h=n(d);if(h){let p=this.opts.es5?Be.varKinds.var:Be.varKinds.const;o=(0,je._)`${o}${p} ${d} = ${h};${this.opts._n}`}else if(h=r?.(d))o=(0,je._)`${o}${h}${this.opts._n}`;else throw new wl(d);l.set(d,Mo.Completed)})}return o}};Be.ValueScope=Al});var q=N(V=>{"use strict";u();Object.defineProperty(V,"__esModule",{value:!0});V.or=V.and=V.not=V.CodeGen=V.operators=V.varKinds=V.ValueScopeName=V.ValueScope=V.Scope=V.Name=V.regexpCode=V.stringify=V.getProperty=V.nil=V.strConcat=V.str=V._=void 0;var X=tr(),lt=Il(),Zt=tr();Object.defineProperty(V,"_",{enumerable:!0,get:function(){return Zt._}});Object.defineProperty(V,"str",{enumerable:!0,get:function(){return Zt.str}});Object.defineProperty(V,"strConcat",{enumerable:!0,get:function(){return Zt.strConcat}});Object.defineProperty(V,"nil",{enumerable:!0,get:function(){return Zt.nil}});Object.defineProperty(V,"getProperty",{enumerable:!0,get:function(){return Zt.getProperty}});Object.defineProperty(V,"stringify",{enumerable:!0,get:function(){return Zt.stringify}});Object.defineProperty(V,"regexpCode",{enumerable:!0,get:function(){return Zt.regexpCode}});Object.defineProperty(V,"Name",{enumerable:!0,get:function(){return Zt.Name}});var Zo=Il();Object.defineProperty(V,"Scope",{enumerable:!0,get:function(){return Zo.Scope}});Object.defineProperty(V,"ValueScope",{enumerable:!0,get:function(){return Zo.ValueScope}});Object.defineProperty(V,"ValueScopeName",{enumerable:!0,get:function(){return Zo.ValueScopeName}});Object.defineProperty(V,"varKinds",{enumerable:!0,get:function(){return Zo.varKinds}});V.operators={GT:new X._Code(">"),GTE:new X._Code(">="),LT:new X._Code("<"),LTE:new X._Code("<="),EQ:new X._Code("==="),NEQ:new X._Code("!=="),NOT:new X._Code("!"),OR:new X._Code("||"),AND:new X._Code("&&"),ADD:new X._Code("+")};var Nt=class{optimizeNodes(){return this}optimizeNames(e,n){return this}},vl=class extends Nt{constructor(e,n,a){super(),this.varKind=e,this.name=n,this.rhs=a}render({es5:e,_n:n}){let a=e?lt.varKinds.var:this.varKind,r=this.rhs===void 0?"":` = ${this.rhs}`;return`${a} ${this.name}${r};`+n}optimizeNames(e,n){if(e[this.name.str])return this.rhs&&(this.rhs=oa(this.rhs,e,n)),this}get names(){return this.rhs instanceof X._CodeOrName?this.rhs.names:{}}},Go=class extends Nt{constructor(e,n,a){super(),this.lhs=e,this.rhs=n,this.sideEffects=a}render({_n:e}){return`${this.lhs} = ${this.rhs};`+e}optimizeNames(e,n){if(!(this.lhs instanceof X.Name&&!e[this.lhs.str]&&!this.sideEffects))return this.rhs=oa(this.rhs,e,n),this}get names(){let e=this.lhs instanceof X.Name?{}:{...this.lhs.names};return Bo(e,this.rhs)}},Ol=class extends Go{constructor(e,n,a,r){super(e,a,r),this.op=n}render({_n:e}){return`${this.lhs} ${this.op}= ${this.rhs};`+e}},Sl=class extends Nt{constructor(e){super(),this.label=e,this.names={}}render({_n:e}){return`${this.label}:`+e}},Nl=class extends Nt{constructor(e){super(),this.label=e,this.names={}}render({_n:e}){return`break${this.label?` ${this.label}`:""};`+e}},Pl=class extends Nt{constructor(e){super(),this.error=e}render({_n:e}){return`throw ${this.error};`+e}get names(){return this.error.names}},Cl=class extends Nt{constructor(e){super(),this.code=e}render({_n:e}){return`${this.code};`+e}optimizeNodes(){return`${this.code}`?this:void 0}optimizeNames(e,n){return this.code=oa(this.code,e,n),this}get names(){return this.code instanceof X._CodeOrName?this.code.names:{}}},nr=class extends Nt{constructor(e=[]){super(),this.nodes=e}render(e){return this.nodes.reduce((n,a)=>n+a.render(e),"")}optimizeNodes(){let{nodes:e}=this,n=e.length;for(;n--;){let a=e[n].optimizeNodes();Array.isArray(a)?e.splice(n,1,...a):a?e[n]=a:e.splice(n,1)}return e.length>0?this:void 0}optimizeNames(e,n){let{nodes:a}=this,r=a.length;for(;r--;){let o=a[r];o.optimizeNames(e,n)||(PA(e,o.names),a.splice(r,1))}return a.length>0?this:void 0}get names(){return this.nodes.reduce((e,n)=>Sn(e,n.names),{})}},Pt=class extends nr{render(e){return"{"+e._n+super.render(e)+"}"+e._n}},Dl=class extends nr{},ra=class extends Pt{};ra.kind="else";var vn=class t extends Pt{constructor(e,n){super(n),this.condition=e}render(e){let n=`if(${this.condition})`+super.render(e);return this.else&&(n+="else "+this.else.render(e)),n}optimizeNodes(){super.optimizeNodes();let e=this.condition;if(e===!0)return this.nodes;let n=this.else;if(n){let a=n.optimizeNodes();n=this.else=Array.isArray(a)?new ra(a):a}if(n)return e===!1?n instanceof t?n:n.nodes:this.nodes.length?this:new t(Pm(e),n instanceof t?[n]:n.nodes);if(!(e===!1||!this.nodes.length))return this}optimizeNames(e,n){var a;if(this.else=(a=this.else)===null||a===void 0?void 0:a.optimizeNames(e,n),!!(super.optimizeNames(e,n)||this.else))return this.condition=oa(this.condition,e,n),this}get names(){let e=super.names;return Bo(e,this.condition),this.else&&Sn(e,this.else.names),e}};vn.kind="if";var On=class extends Pt{};On.kind="for";var Rl=class extends On{constructor(e){super(),this.iteration=e}render(e){return`for(${this.iteration})`+super.render(e)}optimizeNames(e,n){if(super.optimizeNames(e,n))return this.iteration=oa(this.iteration,e,n),this}get names(){return Sn(super.names,this.iteration.names)}},Ll=class extends On{constructor(e,n,a,r){super(),this.varKind=e,this.name=n,this.from=a,this.to=r}render(e){let n=e.es5?lt.varKinds.var:this.varKind,{name:a,from:r,to:o}=this;return`for(${n} ${a}=${r}; ${a}<${o}; ${a}++)`+super.render(e)}get names(){let e=Bo(super.names,this.from);return Bo(e,this.to)}},jo=class extends On{constructor(e,n,a,r){super(),this.loop=e,this.varKind=n,this.name=a,this.iterable=r}render(e){return`for(${this.varKind} ${this.name} ${this.loop} ${this.iterable})`+super.render(e)}optimizeNames(e,n){if(super.optimizeNames(e,n))return this.iterable=oa(this.iterable,e,n),this}get names(){return Sn(super.names,this.iterable.names)}},ar=class extends Pt{constructor(e,n,a){super(),this.name=e,this.args=n,this.async=a}render(e){return`${this.async?"async ":""}function ${this.name}(${this.args})`+super.render(e)}};ar.kind="func";var rr=class extends nr{render(e){return"return "+super.render(e)}};rr.kind="return";var kl=class extends Pt{render(e){let n="try"+super.render(e);return this.catch&&(n+=this.catch.render(e)),this.finally&&(n+=this.finally.render(e)),n}optimizeNodes(){var e,n;return super.optimizeNodes(),(e=this.catch)===null||e===void 0||e.optimizeNodes(),(n=this.finally)===null||n===void 0||n.optimizeNodes(),this}optimizeNames(e,n){var a,r;return super.optimizeNames(e,n),(a=this.catch)===null||a===void 0||a.optimizeNames(e,n),(r=this.finally)===null||r===void 0||r.optimizeNames(e,n),this}get names(){let e=super.names;return this.catch&&Sn(e,this.catch.names),this.finally&&Sn(e,this.finally.names),e}},or=class extends Pt{constructor(e){super(),this.error=e}render(e){return`catch(${this.error})`+super.render(e)}};or.kind="catch";var sr=class extends Pt{render(e){return"finally"+super.render(e)}};sr.kind="finally";var xl=class{constructor(e,n={}){this._values={},this._blockStarts=[],this._constants={},this.opts={...n,_n:n.lines?`
|
|
3
|
+
import{d as Lr,e as zn,i as Ou,j as Su}from"./chunk-XHFWXEZR.js";import{c as N,d as ks,e as vu,g as u}from"./chunk-WXFOSPKR.js";var tr=N(te=>{"use strict";u();Object.defineProperty(te,"__esModule",{value:!0});te.regexpCode=te.getEsmExportName=te.getProperty=te.safeStringify=te.stringify=te.strConcat=te.addCodeArg=te.str=te._=te.nil=te._Code=te.Name=te.IDENTIFIER=te._CodeOrName=void 0;var Qa=class{};te._CodeOrName=Qa;te.IDENTIFIER=/^[a-z$_][a-z$_0-9]*$/i;var In=class extends Qa{constructor(e){if(super(),!te.IDENTIFIER.test(e))throw new Error("CodeGen: name must be a valid identifier");this.str=e}toString(){return this.str}emptyStr(){return!1}get names(){return{[this.str]:1}}};te.Name=In;var tt=class extends Qa{constructor(e){super(),this._items=typeof e=="string"?[e]:e}toString(){return this.str}emptyStr(){if(this._items.length>1)return!1;let e=this._items[0];return e===""||e==='""'}get str(){var e;return(e=this._str)!==null&&e!==void 0?e:this._str=this._items.reduce((n,a)=>`${n}${a}`,"")}get names(){var e;return(e=this._names)!==null&&e!==void 0?e:this._names=this._items.reduce((n,a)=>(a instanceof In&&(n[a.str]=(n[a.str]||0)+1),n),{})}};te._Code=tt;te.nil=new tt("");function Sm(t,...e){let n=[t[0]],a=0;for(;a<e.length;)bl(n,e[a]),n.push(t[++a]);return new tt(n)}te._=Sm;var Tl=new tt("+");function Nm(t,...e){let n=[er(t[0])],a=0;for(;a<e.length;)n.push(Tl),bl(n,e[a]),n.push(Tl,er(t[++a]));return TA(n),new tt(n)}te.str=Nm;function bl(t,e){e instanceof tt?t.push(...e._items):e instanceof In?t.push(e):t.push(AA(e))}te.addCodeArg=bl;function TA(t){let e=1;for(;e<t.length-1;){if(t[e]===Tl){let n=bA(t[e-1],t[e+1]);if(n!==void 0){t.splice(e-1,3,n);continue}t[e++]="+"}e++}}function bA(t,e){if(e==='""')return t;if(t==='""')return e;if(typeof t=="string")return e instanceof In||t[t.length-1]!=='"'?void 0:typeof e!="string"?`${t.slice(0,-1)}${e}"`:e[0]==='"'?t.slice(0,-1)+e.slice(1):void 0;if(typeof e=="string"&&e[0]==='"'&&!(t instanceof In))return`"${t}${e.slice(1)}`}function wA(t,e){return e.emptyStr()?t:t.emptyStr()?e:Nm`${t}${e}`}te.strConcat=wA;function AA(t){return typeof t=="number"||typeof t=="boolean"||t===null?t:er(Array.isArray(t)?t.join(","):t)}function IA(t){return new tt(er(t))}te.stringify=IA;function er(t){return JSON.stringify(t).replace(/\u2028/g,"\\u2028").replace(/\u2029/g,"\\u2029")}te.safeStringify=er;function vA(t){return typeof t=="string"&&te.IDENTIFIER.test(t)?new tt(`.${t}`):Sm`[${t}]`}te.getProperty=vA;function OA(t){if(typeof t=="string"&&te.IDENTIFIER.test(t))return new tt(`${t}`);throw new Error(`CodeGen: invalid export name: ${t}, use explicit $id name mapping`)}te.getEsmExportName=OA;function SA(t){return new tt(t.toString())}te.regexpCode=SA});var Il=N(Be=>{"use strict";u();Object.defineProperty(Be,"__esModule",{value:!0});Be.ValueScope=Be.ValueScopeName=Be.Scope=Be.varKinds=Be.UsedValueState=void 0;var je=tr(),wl=class extends Error{constructor(e){super(`CodeGen: "code" for ${e} not defined`),this.value=e.value}},Mo;(function(t){t[t.Started=0]="Started",t[t.Completed=1]="Completed"})(Mo||(Be.UsedValueState=Mo={}));Be.varKinds={const:new je.Name("const"),let:new je.Name("let"),var:new je.Name("var")};var zo=class{constructor({prefixes:e,parent:n}={}){this._names={},this._prefixes=e,this._parent=n}toName(e){return e instanceof je.Name?e:this.name(e)}name(e){return new je.Name(this._newName(e))}_newName(e){let n=this._names[e]||this._nameGroup(e);return`${e}${n.index++}`}_nameGroup(e){var n,a;if(!((a=(n=this._parent)===null||n===void 0?void 0:n._prefixes)===null||a===void 0)&&a.has(e)||this._prefixes&&!this._prefixes.has(e))throw new Error(`CodeGen: prefix "${e}" is not allowed in this scope`);return this._names[e]={prefix:e,index:0}}};Be.Scope=zo;var Fo=class extends je.Name{constructor(e,n){super(n),this.prefix=e}setValue(e,{property:n,itemIndex:a}){this.value=e,this.scopePath=(0,je._)`.${new je.Name(n)}[${a}]`}};Be.ValueScopeName=Fo;var NA=(0,je._)`\n`,Al=class extends zo{constructor(e){super(e),this._values={},this._scope=e.scope,this.opts={...e,_n:e.lines?NA:je.nil}}get(){return this._scope}name(e){return new Fo(e,this._newName(e))}value(e,n){var a;if(n.ref===void 0)throw new Error("CodeGen: ref must be passed in value");let r=this.toName(e),{prefix:o}=r,s=(a=n.key)!==null&&a!==void 0?a:n.ref,i=this._values[o];if(i){let h=i.get(s);if(h)return h}else i=this._values[o]=new Map;i.set(s,r);let l=this._scope[o]||(this._scope[o]=[]),d=l.length;return l[d]=n.ref,r.setValue(n,{property:o,itemIndex:d}),r}getValue(e,n){let a=this._values[e];if(a)return a.get(n)}scopeRefs(e,n=this._values){return this._reduceValues(n,a=>{if(a.scopePath===void 0)throw new Error(`CodeGen: name "${a}" has no value`);return(0,je._)`${e}${a.scopePath}`})}scopeCode(e=this._values,n,a){return this._reduceValues(e,r=>{if(r.value===void 0)throw new Error(`CodeGen: name "${r}" has no value`);return r.value.code},n,a)}_reduceValues(e,n,a={},r){let o=je.nil;for(let s in e){let i=e[s];if(!i)continue;let l=a[s]=a[s]||new Map;i.forEach(d=>{if(l.has(d))return;l.set(d,Mo.Started);let h=n(d);if(h){let p=this.opts.es5?Be.varKinds.var:Be.varKinds.const;o=(0,je._)`${o}${p} ${d} = ${h};${this.opts._n}`}else if(h=r?.(d))o=(0,je._)`${o}${h}${this.opts._n}`;else throw new wl(d);l.set(d,Mo.Completed)})}return o}};Be.ValueScope=Al});var q=N(V=>{"use strict";u();Object.defineProperty(V,"__esModule",{value:!0});V.or=V.and=V.not=V.CodeGen=V.operators=V.varKinds=V.ValueScopeName=V.ValueScope=V.Scope=V.Name=V.regexpCode=V.stringify=V.getProperty=V.nil=V.strConcat=V.str=V._=void 0;var X=tr(),lt=Il(),Zt=tr();Object.defineProperty(V,"_",{enumerable:!0,get:function(){return Zt._}});Object.defineProperty(V,"str",{enumerable:!0,get:function(){return Zt.str}});Object.defineProperty(V,"strConcat",{enumerable:!0,get:function(){return Zt.strConcat}});Object.defineProperty(V,"nil",{enumerable:!0,get:function(){return Zt.nil}});Object.defineProperty(V,"getProperty",{enumerable:!0,get:function(){return Zt.getProperty}});Object.defineProperty(V,"stringify",{enumerable:!0,get:function(){return Zt.stringify}});Object.defineProperty(V,"regexpCode",{enumerable:!0,get:function(){return Zt.regexpCode}});Object.defineProperty(V,"Name",{enumerable:!0,get:function(){return Zt.Name}});var Zo=Il();Object.defineProperty(V,"Scope",{enumerable:!0,get:function(){return Zo.Scope}});Object.defineProperty(V,"ValueScope",{enumerable:!0,get:function(){return Zo.ValueScope}});Object.defineProperty(V,"ValueScopeName",{enumerable:!0,get:function(){return Zo.ValueScopeName}});Object.defineProperty(V,"varKinds",{enumerable:!0,get:function(){return Zo.varKinds}});V.operators={GT:new X._Code(">"),GTE:new X._Code(">="),LT:new X._Code("<"),LTE:new X._Code("<="),EQ:new X._Code("==="),NEQ:new X._Code("!=="),NOT:new X._Code("!"),OR:new X._Code("||"),AND:new X._Code("&&"),ADD:new X._Code("+")};var Nt=class{optimizeNodes(){return this}optimizeNames(e,n){return this}},vl=class extends Nt{constructor(e,n,a){super(),this.varKind=e,this.name=n,this.rhs=a}render({es5:e,_n:n}){let a=e?lt.varKinds.var:this.varKind,r=this.rhs===void 0?"":` = ${this.rhs}`;return`${a} ${this.name}${r};`+n}optimizeNames(e,n){if(e[this.name.str])return this.rhs&&(this.rhs=oa(this.rhs,e,n)),this}get names(){return this.rhs instanceof X._CodeOrName?this.rhs.names:{}}},Go=class extends Nt{constructor(e,n,a){super(),this.lhs=e,this.rhs=n,this.sideEffects=a}render({_n:e}){return`${this.lhs} = ${this.rhs};`+e}optimizeNames(e,n){if(!(this.lhs instanceof X.Name&&!e[this.lhs.str]&&!this.sideEffects))return this.rhs=oa(this.rhs,e,n),this}get names(){let e=this.lhs instanceof X.Name?{}:{...this.lhs.names};return Bo(e,this.rhs)}},Ol=class extends Go{constructor(e,n,a,r){super(e,a,r),this.op=n}render({_n:e}){return`${this.lhs} ${this.op}= ${this.rhs};`+e}},Sl=class extends Nt{constructor(e){super(),this.label=e,this.names={}}render({_n:e}){return`${this.label}:`+e}},Nl=class extends Nt{constructor(e){super(),this.label=e,this.names={}}render({_n:e}){return`break${this.label?` ${this.label}`:""};`+e}},Pl=class extends Nt{constructor(e){super(),this.error=e}render({_n:e}){return`throw ${this.error};`+e}get names(){return this.error.names}},Cl=class extends Nt{constructor(e){super(),this.code=e}render({_n:e}){return`${this.code};`+e}optimizeNodes(){return`${this.code}`?this:void 0}optimizeNames(e,n){return this.code=oa(this.code,e,n),this}get names(){return this.code instanceof X._CodeOrName?this.code.names:{}}},nr=class extends Nt{constructor(e=[]){super(),this.nodes=e}render(e){return this.nodes.reduce((n,a)=>n+a.render(e),"")}optimizeNodes(){let{nodes:e}=this,n=e.length;for(;n--;){let a=e[n].optimizeNodes();Array.isArray(a)?e.splice(n,1,...a):a?e[n]=a:e.splice(n,1)}return e.length>0?this:void 0}optimizeNames(e,n){let{nodes:a}=this,r=a.length;for(;r--;){let o=a[r];o.optimizeNames(e,n)||(PA(e,o.names),a.splice(r,1))}return a.length>0?this:void 0}get names(){return this.nodes.reduce((e,n)=>Sn(e,n.names),{})}},Pt=class extends nr{render(e){return"{"+e._n+super.render(e)+"}"+e._n}},Dl=class extends nr{},ra=class extends Pt{};ra.kind="else";var vn=class t extends Pt{constructor(e,n){super(n),this.condition=e}render(e){let n=`if(${this.condition})`+super.render(e);return this.else&&(n+="else "+this.else.render(e)),n}optimizeNodes(){super.optimizeNodes();let e=this.condition;if(e===!0)return this.nodes;let n=this.else;if(n){let a=n.optimizeNodes();n=this.else=Array.isArray(a)?new ra(a):a}if(n)return e===!1?n instanceof t?n:n.nodes:this.nodes.length?this:new t(Pm(e),n instanceof t?[n]:n.nodes);if(!(e===!1||!this.nodes.length))return this}optimizeNames(e,n){var a;if(this.else=(a=this.else)===null||a===void 0?void 0:a.optimizeNames(e,n),!!(super.optimizeNames(e,n)||this.else))return this.condition=oa(this.condition,e,n),this}get names(){let e=super.names;return Bo(e,this.condition),this.else&&Sn(e,this.else.names),e}};vn.kind="if";var On=class extends Pt{};On.kind="for";var Rl=class extends On{constructor(e){super(),this.iteration=e}render(e){return`for(${this.iteration})`+super.render(e)}optimizeNames(e,n){if(super.optimizeNames(e,n))return this.iteration=oa(this.iteration,e,n),this}get names(){return Sn(super.names,this.iteration.names)}},Ll=class extends On{constructor(e,n,a,r){super(),this.varKind=e,this.name=n,this.from=a,this.to=r}render(e){let n=e.es5?lt.varKinds.var:this.varKind,{name:a,from:r,to:o}=this;return`for(${n} ${a}=${r}; ${a}<${o}; ${a}++)`+super.render(e)}get names(){let e=Bo(super.names,this.from);return Bo(e,this.to)}},jo=class extends On{constructor(e,n,a,r){super(),this.loop=e,this.varKind=n,this.name=a,this.iterable=r}render(e){return`for(${this.varKind} ${this.name} ${this.loop} ${this.iterable})`+super.render(e)}optimizeNames(e,n){if(super.optimizeNames(e,n))return this.iterable=oa(this.iterable,e,n),this}get names(){return Sn(super.names,this.iterable.names)}},ar=class extends Pt{constructor(e,n,a){super(),this.name=e,this.args=n,this.async=a}render(e){return`${this.async?"async ":""}function ${this.name}(${this.args})`+super.render(e)}};ar.kind="func";var rr=class extends nr{render(e){return"return "+super.render(e)}};rr.kind="return";var kl=class extends Pt{render(e){let n="try"+super.render(e);return this.catch&&(n+=this.catch.render(e)),this.finally&&(n+=this.finally.render(e)),n}optimizeNodes(){var e,n;return super.optimizeNodes(),(e=this.catch)===null||e===void 0||e.optimizeNodes(),(n=this.finally)===null||n===void 0||n.optimizeNodes(),this}optimizeNames(e,n){var a,r;return super.optimizeNames(e,n),(a=this.catch)===null||a===void 0||a.optimizeNames(e,n),(r=this.finally)===null||r===void 0||r.optimizeNames(e,n),this}get names(){let e=super.names;return this.catch&&Sn(e,this.catch.names),this.finally&&Sn(e,this.finally.names),e}},or=class extends Pt{constructor(e){super(),this.error=e}render(e){return`catch(${this.error})`+super.render(e)}};or.kind="catch";var sr=class extends Pt{render(e){return"finally"+super.render(e)}};sr.kind="finally";var xl=class{constructor(e,n={}){this._values={},this._blockStarts=[],this._constants={},this.opts={...n,_n:n.lines?`
|
|
4
4
|
`:""},this._extScope=e,this._scope=new lt.Scope({parent:e}),this._nodes=[new Dl]}toString(){return this._root.render(this.opts)}name(e){return this._scope.name(e)}scopeName(e){return this._extScope.name(e)}scopeValue(e,n){let a=this._extScope.value(e,n);return(this._values[a.prefix]||(this._values[a.prefix]=new Set)).add(a),a}getScopeValue(e,n){return this._extScope.getValue(e,n)}scopeRefs(e){return this._extScope.scopeRefs(e,this._values)}scopeCode(){return this._extScope.scopeCode(this._values)}_def(e,n,a,r){let o=this._scope.toName(n);return a!==void 0&&r&&(this._constants[o.str]=a),this._leafNode(new vl(e,o,a)),o}const(e,n,a){return this._def(lt.varKinds.const,e,n,a)}let(e,n,a){return this._def(lt.varKinds.let,e,n,a)}var(e,n,a){return this._def(lt.varKinds.var,e,n,a)}assign(e,n,a){return this._leafNode(new Go(e,n,a))}add(e,n){return this._leafNode(new Ol(e,V.operators.ADD,n))}code(e){return typeof e=="function"?e():e!==X.nil&&this._leafNode(new Cl(e)),this}object(...e){let n=["{"];for(let[a,r]of e)n.length>1&&n.push(","),n.push(a),(a!==r||this.opts.es5)&&(n.push(":"),(0,X.addCodeArg)(n,r));return n.push("}"),new X._Code(n)}if(e,n,a){if(this._blockNode(new vn(e)),n&&a)this.code(n).else().code(a).endIf();else if(n)this.code(n).endIf();else if(a)throw new Error('CodeGen: "else" body without "then" body');return this}elseIf(e){return this._elseNode(new vn(e))}else(){return this._elseNode(new ra)}endIf(){return this._endBlockNode(vn,ra)}_for(e,n){return this._blockNode(e),n&&this.code(n).endFor(),this}for(e,n){return this._for(new Rl(e),n)}forRange(e,n,a,r,o=this.opts.es5?lt.varKinds.var:lt.varKinds.let){let s=this._scope.toName(e);return this._for(new Ll(o,s,n,a),()=>r(s))}forOf(e,n,a,r=lt.varKinds.const){let o=this._scope.toName(e);if(this.opts.es5){let s=n instanceof X.Name?n:this.var("_arr",n);return this.forRange("_i",0,(0,X._)`${s}.length`,i=>{this.var(o,(0,X._)`${s}[${i}]`),a(o)})}return this._for(new jo("of",r,o,n),()=>a(o))}forIn(e,n,a,r=this.opts.es5?lt.varKinds.var:lt.varKinds.const){if(this.opts.ownProperties)return this.forOf(e,(0,X._)`Object.keys(${n})`,a);let o=this._scope.toName(e);return this._for(new jo("in",r,o,n),()=>a(o))}endFor(){return this._endBlockNode(On)}label(e){return this._leafNode(new Sl(e))}break(e){return this._leafNode(new Nl(e))}return(e){let n=new rr;if(this._blockNode(n),this.code(e),n.nodes.length!==1)throw new Error('CodeGen: "return" should have one node');return this._endBlockNode(rr)}try(e,n,a){if(!n&&!a)throw new Error('CodeGen: "try" without "catch" and "finally"');let r=new kl;if(this._blockNode(r),this.code(e),n){let o=this.name("e");this._currNode=r.catch=new or(o),n(o)}return a&&(this._currNode=r.finally=new sr,this.code(a)),this._endBlockNode(or,sr)}throw(e){return this._leafNode(new Pl(e))}block(e,n){return this._blockStarts.push(this._nodes.length),e&&this.code(e).endBlock(n),this}endBlock(e){let n=this._blockStarts.pop();if(n===void 0)throw new Error("CodeGen: not in self-balancing block");let a=this._nodes.length-n;if(a<0||e!==void 0&&a!==e)throw new Error(`CodeGen: wrong number of nodes: ${a} vs ${e} expected`);return this._nodes.length=n,this}func(e,n=X.nil,a,r){return this._blockNode(new ar(e,n,a)),r&&this.code(r).endFunc(),this}endFunc(){return this._endBlockNode(ar)}optimize(e=1){for(;e-- >0;)this._root.optimizeNodes(),this._root.optimizeNames(this._root.names,this._constants)}_leafNode(e){return this._currNode.nodes.push(e),this}_blockNode(e){this._currNode.nodes.push(e),this._nodes.push(e)}_endBlockNode(e,n){let a=this._currNode;if(a instanceof e||n&&a instanceof n)return this._nodes.pop(),this;throw new Error(`CodeGen: not in block "${n?`${e.kind}/${n.kind}`:e.kind}"`)}_elseNode(e){let n=this._currNode;if(!(n instanceof vn))throw new Error('CodeGen: "else" without "if"');return this._currNode=n.else=e,this}get _root(){return this._nodes[0]}get _currNode(){let e=this._nodes;return e[e.length-1]}set _currNode(e){let n=this._nodes;n[n.length-1]=e}};V.CodeGen=xl;function Sn(t,e){for(let n in e)t[n]=(t[n]||0)+(e[n]||0);return t}function Bo(t,e){return e instanceof X._CodeOrName?Sn(t,e.names):t}function oa(t,e,n){if(t instanceof X.Name)return a(t);if(!r(t))return t;return new X._Code(t._items.reduce((o,s)=>(s instanceof X.Name&&(s=a(s)),s instanceof X._Code?o.push(...s._items):o.push(s),o),[]));function a(o){let s=n[o.str];return s===void 0||e[o.str]!==1?o:(delete e[o.str],s)}function r(o){return o instanceof X._Code&&o._items.some(s=>s instanceof X.Name&&e[s.str]===1&&n[s.str]!==void 0)}}function PA(t,e){for(let n in e)t[n]=(t[n]||0)-(e[n]||0)}function Pm(t){return typeof t=="boolean"||typeof t=="number"||t===null?!t:(0,X._)`!${$l(t)}`}V.not=Pm;var CA=Cm(V.operators.AND);function DA(...t){return t.reduce(CA)}V.and=DA;var RA=Cm(V.operators.OR);function LA(...t){return t.reduce(RA)}V.or=LA;function Cm(t){return(e,n)=>e===X.nil?n:n===X.nil?e:(0,X._)`${$l(e)} ${t} ${$l(n)}`}function $l(t){return t instanceof X.Name?t:(0,X._)`(${t})`}});var Q=N(W=>{"use strict";u();Object.defineProperty(W,"__esModule",{value:!0});W.checkStrictMode=W.getErrorPath=W.Type=W.useFunc=W.setEvaluated=W.evaluatedPropsToName=W.mergeEvaluated=W.eachItem=W.unescapeJsonPointer=W.escapeJsonPointer=W.escapeFragment=W.unescapeFragment=W.schemaRefOrVal=W.schemaHasRulesButRef=W.schemaHasRules=W.checkUnknownRules=W.alwaysValidSchema=W.toHash=void 0;var oe=q(),kA=tr();function xA(t){let e={};for(let n of t)e[n]=!0;return e}W.toHash=xA;function $A(t,e){return typeof e=="boolean"?e:Object.keys(e).length===0?!0:(Lm(t,e),!km(e,t.self.RULES.all))}W.alwaysValidSchema=$A;function Lm(t,e=t.schema){let{opts:n,self:a}=t;if(!n.strictSchema||typeof e=="boolean")return;let r=a.RULES.keywords;for(let o in e)r[o]||Um(t,`unknown keyword: "${o}"`)}W.checkUnknownRules=Lm;function km(t,e){if(typeof t=="boolean")return!t;for(let n in t)if(e[n])return!0;return!1}W.schemaHasRules=km;function UA(t,e){if(typeof t=="boolean")return!t;for(let n in t)if(n!=="$ref"&&e.all[n])return!0;return!1}W.schemaHasRulesButRef=UA;function MA({topSchemaRef:t,schemaPath:e},n,a,r){if(!r){if(typeof n=="number"||typeof n=="boolean")return n;if(typeof n=="string")return(0,oe._)`${n}`}return(0,oe._)`${t}${e}${(0,oe.getProperty)(a)}`}W.schemaRefOrVal=MA;function zA(t){return xm(decodeURIComponent(t))}W.unescapeFragment=zA;function FA(t){return encodeURIComponent(Ml(t))}W.escapeFragment=FA;function Ml(t){return typeof t=="number"?`${t}`:t.replace(/~/g,"~0").replace(/\//g,"~1")}W.escapeJsonPointer=Ml;function xm(t){return t.replace(/~1/g,"/").replace(/~0/g,"~")}W.unescapeJsonPointer=xm;function GA(t,e){if(Array.isArray(t))for(let n of t)e(n);else e(t)}W.eachItem=GA;function Dm({mergeNames:t,mergeToName:e,mergeValues:n,resultToName:a}){return(r,o,s,i)=>{let l=s===void 0?o:s instanceof oe.Name?(o instanceof oe.Name?t(r,o,s):e(r,o,s),s):o instanceof oe.Name?(e(r,s,o),o):n(o,s);return i===oe.Name&&!(l instanceof oe.Name)?a(r,l):l}}W.mergeEvaluated={props:Dm({mergeNames:(t,e,n)=>t.if((0,oe._)`${n} !== true && ${e} !== undefined`,()=>{t.if((0,oe._)`${e} === true`,()=>t.assign(n,!0),()=>t.assign(n,(0,oe._)`${n} || {}`).code((0,oe._)`Object.assign(${n}, ${e})`))}),mergeToName:(t,e,n)=>t.if((0,oe._)`${n} !== true`,()=>{e===!0?t.assign(n,!0):(t.assign(n,(0,oe._)`${n} || {}`),zl(t,n,e))}),mergeValues:(t,e)=>t===!0?!0:{...t,...e},resultToName:$m}),items:Dm({mergeNames:(t,e,n)=>t.if((0,oe._)`${n} !== true && ${e} !== undefined`,()=>t.assign(n,(0,oe._)`${e} === true ? true : ${n} > ${e} ? ${n} : ${e}`)),mergeToName:(t,e,n)=>t.if((0,oe._)`${n} !== true`,()=>t.assign(n,e===!0?!0:(0,oe._)`${n} > ${e} ? ${n} : ${e}`)),mergeValues:(t,e)=>t===!0?!0:Math.max(t,e),resultToName:(t,e)=>t.var("items",e)})};function $m(t,e){if(e===!0)return t.var("props",!0);let n=t.var("props",(0,oe._)`{}`);return e!==void 0&&zl(t,n,e),n}W.evaluatedPropsToName=$m;function zl(t,e,n){Object.keys(n).forEach(a=>t.assign((0,oe._)`${e}${(0,oe.getProperty)(a)}`,!0))}W.setEvaluated=zl;var Rm={};function jA(t,e){return t.scopeValue("func",{ref:e,code:Rm[e.code]||(Rm[e.code]=new kA._Code(e.code))})}W.useFunc=jA;var Ul;(function(t){t[t.Num=0]="Num",t[t.Str=1]="Str"})(Ul||(W.Type=Ul={}));function BA(t,e,n){if(t instanceof oe.Name){let a=e===Ul.Num;return n?a?(0,oe._)`"[" + ${t} + "]"`:(0,oe._)`"['" + ${t} + "']"`:a?(0,oe._)`"/" + ${t}`:(0,oe._)`"/" + ${t}.replace(/~/g, "~0").replace(/\\//g, "~1")`}return n?(0,oe.getProperty)(t).toString():"/"+Ml(t)}W.getErrorPath=BA;function Um(t,e,n=t.opts.strictSchema){if(n){if(e=`strict mode: ${e}`,n===!0)throw new Error(e);t.self.logger.warn(e)}}W.checkStrictMode=Um});var Ct=N(Fl=>{"use strict";u();Object.defineProperty(Fl,"__esModule",{value:!0});var Ce=q(),ZA={data:new Ce.Name("data"),valCxt:new Ce.Name("valCxt"),instancePath:new Ce.Name("instancePath"),parentData:new Ce.Name("parentData"),parentDataProperty:new Ce.Name("parentDataProperty"),rootData:new Ce.Name("rootData"),dynamicAnchors:new Ce.Name("dynamicAnchors"),vErrors:new Ce.Name("vErrors"),errors:new Ce.Name("errors"),this:new Ce.Name("this"),self:new Ce.Name("self"),scope:new Ce.Name("scope"),json:new Ce.Name("json"),jsonPos:new Ce.Name("jsonPos"),jsonLen:new Ce.Name("jsonLen"),jsonPart:new Ce.Name("jsonPart")};Fl.default=ZA});var ir=N(De=>{"use strict";u();Object.defineProperty(De,"__esModule",{value:!0});De.extendErrors=De.resetErrorsCount=De.reportExtraError=De.reportError=De.keyword$DataError=De.keywordError=void 0;var ee=q(),qo=Q(),$e=Ct();De.keywordError={message:({keyword:t})=>(0,ee.str)`must pass "${t}" keyword validation`};De.keyword$DataError={message:({keyword:t,schemaType:e})=>e?(0,ee.str)`"${t}" keyword must be ${e} ($data)`:(0,ee.str)`"${t}" keyword is invalid ($data)`};function qA(t,e=De.keywordError,n,a){let{it:r}=t,{gen:o,compositeRule:s,allErrors:i}=r,l=Fm(t,e,n);a??(s||i)?Mm(o,l):zm(r,(0,ee._)`[${l}]`)}De.reportError=qA;function VA(t,e=De.keywordError,n){let{it:a}=t,{gen:r,compositeRule:o,allErrors:s}=a,i=Fm(t,e,n);Mm(r,i),o||s||zm(a,$e.default.vErrors)}De.reportExtraError=VA;function WA(t,e){t.assign($e.default.errors,e),t.if((0,ee._)`${$e.default.vErrors} !== null`,()=>t.if(e,()=>t.assign((0,ee._)`${$e.default.vErrors}.length`,e),()=>t.assign($e.default.vErrors,null)))}De.resetErrorsCount=WA;function HA({gen:t,keyword:e,schemaValue:n,data:a,errsCount:r,it:o}){if(r===void 0)throw new Error("ajv implementation error");let s=t.name("err");t.forRange("i",r,$e.default.errors,i=>{t.const(s,(0,ee._)`${$e.default.vErrors}[${i}]`),t.if((0,ee._)`${s}.instancePath === undefined`,()=>t.assign((0,ee._)`${s}.instancePath`,(0,ee.strConcat)($e.default.instancePath,o.errorPath))),t.assign((0,ee._)`${s}.schemaPath`,(0,ee.str)`${o.errSchemaPath}/${e}`),o.opts.verbose&&(t.assign((0,ee._)`${s}.schema`,n),t.assign((0,ee._)`${s}.data`,a))})}De.extendErrors=HA;function Mm(t,e){let n=t.const("err",e);t.if((0,ee._)`${$e.default.vErrors} === null`,()=>t.assign($e.default.vErrors,(0,ee._)`[${n}]`),(0,ee._)`${$e.default.vErrors}.push(${n})`),t.code((0,ee._)`${$e.default.errors}++`)}function zm(t,e){let{gen:n,validateName:a,schemaEnv:r}=t;r.$async?n.throw((0,ee._)`new ${t.ValidationError}(${e})`):(n.assign((0,ee._)`${a}.errors`,e),n.return(!1))}var Nn={keyword:new ee.Name("keyword"),schemaPath:new ee.Name("schemaPath"),params:new ee.Name("params"),propertyName:new ee.Name("propertyName"),message:new ee.Name("message"),schema:new ee.Name("schema"),parentSchema:new ee.Name("parentSchema")};function Fm(t,e,n){let{createErrors:a}=t.it;return a===!1?(0,ee._)`{}`:YA(t,e,n)}function YA(t,e,n={}){let{gen:a,it:r}=t,o=[KA(r,n),JA(t,n)];return XA(t,e,o),a.object(...o)}function KA({errorPath:t},{instancePath:e}){let n=e?(0,ee.str)`${t}${(0,qo.getErrorPath)(e,qo.Type.Str)}`:t;return[$e.default.instancePath,(0,ee.strConcat)($e.default.instancePath,n)]}function JA({keyword:t,it:{errSchemaPath:e}},{schemaPath:n,parentSchema:a}){let r=a?e:(0,ee.str)`${e}/${t}`;return n&&(r=(0,ee.str)`${r}${(0,qo.getErrorPath)(n,qo.Type.Str)}`),[Nn.schemaPath,r]}function XA(t,{params:e,message:n},a){let{keyword:r,data:o,schemaValue:s,it:i}=t,{opts:l,propertyName:d,topSchemaRef:h,schemaPath:p}=i;a.push([Nn.keyword,r],[Nn.params,typeof e=="function"?e(t):e||(0,ee._)`{}`]),l.messages&&a.push([Nn.message,typeof n=="function"?n(t):n]),l.verbose&&a.push([Nn.schema,s],[Nn.parentSchema,(0,ee._)`${h}${p}`],[$e.default.data,o]),d&&a.push([Nn.propertyName,d])}});var jm=N(sa=>{"use strict";u();Object.defineProperty(sa,"__esModule",{value:!0});sa.boolOrEmptySchema=sa.topBoolOrEmptySchema=void 0;var QA=ir(),eI=q(),tI=Ct(),nI={message:"boolean schema is false"};function aI(t){let{gen:e,schema:n,validateName:a}=t;n===!1?Gm(t,!1):typeof n=="object"&&n.$async===!0?e.return(tI.default.data):(e.assign((0,eI._)`${a}.errors`,null),e.return(!0))}sa.topBoolOrEmptySchema=aI;function rI(t,e){let{gen:n,schema:a}=t;a===!1?(n.var(e,!1),Gm(t)):n.var(e,!0)}sa.boolOrEmptySchema=rI;function Gm(t,e){let{gen:n,data:a}=t,r={gen:n,keyword:"false schema",data:a,schema:!1,schemaCode:!1,schemaValue:!1,params:{},it:t};(0,QA.reportError)(r,nI,void 0,e)}});var Gl=N(ia=>{"use strict";u();Object.defineProperty(ia,"__esModule",{value:!0});ia.getRules=ia.isJSONType=void 0;var oI=["string","number","integer","boolean","null","object","array"],sI=new Set(oI);function iI(t){return typeof t=="string"&&sI.has(t)}ia.isJSONType=iI;function cI(){let t={number:{type:"number",rules:[]},string:{type:"string",rules:[]},array:{type:"array",rules:[]},object:{type:"object",rules:[]}};return{types:{...t,integer:!0,boolean:!0,null:!0},rules:[{rules:[]},t.number,t.string,t.array,t.object],post:{rules:[]},all:{},keywords:{}}}ia.getRules=cI});var jl=N(qt=>{"use strict";u();Object.defineProperty(qt,"__esModule",{value:!0});qt.shouldUseRule=qt.shouldUseGroup=qt.schemaHasRulesForType=void 0;function lI({schema:t,self:e},n){let a=e.RULES.types[n];return a&&a!==!0&&Bm(t,a)}qt.schemaHasRulesForType=lI;function Bm(t,e){return e.rules.some(n=>Zm(t,n))}qt.shouldUseGroup=Bm;function Zm(t,e){var n;return t[e.keyword]!==void 0||((n=e.definition.implements)===null||n===void 0?void 0:n.some(a=>t[a]!==void 0))}qt.shouldUseRule=Zm});var cr=N(Re=>{"use strict";u();Object.defineProperty(Re,"__esModule",{value:!0});Re.reportTypeError=Re.checkDataTypes=Re.checkDataType=Re.coerceAndCheckDataType=Re.getJSONTypes=Re.getSchemaTypes=Re.DataType=void 0;var dI=Gl(),uI=jl(),hI=ir(),B=q(),qm=Q(),ca;(function(t){t[t.Correct=0]="Correct",t[t.Wrong=1]="Wrong"})(ca||(Re.DataType=ca={}));function pI(t){let e=Vm(t.type);if(e.includes("null")){if(t.nullable===!1)throw new Error("type: null contradicts nullable: false")}else{if(!e.length&&t.nullable!==void 0)throw new Error('"nullable" cannot be used without "type"');t.nullable===!0&&e.push("null")}return e}Re.getSchemaTypes=pI;function Vm(t){let e=Array.isArray(t)?t:t?[t]:[];if(e.every(dI.isJSONType))return e;throw new Error("type must be JSONType or JSONType[]: "+e.join(","))}Re.getJSONTypes=Vm;function mI(t,e){let{gen:n,data:a,opts:r}=t,o=fI(e,r.coerceTypes),s=e.length>0&&!(o.length===0&&e.length===1&&(0,uI.schemaHasRulesForType)(t,e[0]));if(s){let i=Zl(e,a,r.strictNumbers,ca.Wrong);n.if(i,()=>{o.length?_I(t,e,o):ql(t)})}return s}Re.coerceAndCheckDataType=mI;var Wm=new Set(["string","number","integer","boolean","null"]);function fI(t,e){return e?t.filter(n=>Wm.has(n)||e==="array"&&n==="array"):[]}function _I(t,e,n){let{gen:a,data:r,opts:o}=t,s=a.let("dataType",(0,B._)`typeof ${r}`),i=a.let("coerced",(0,B._)`undefined`);o.coerceTypes==="array"&&a.if((0,B._)`${s} == 'object' && Array.isArray(${r}) && ${r}.length == 1`,()=>a.assign(r,(0,B._)`${r}[0]`).assign(s,(0,B._)`typeof ${r}`).if(Zl(e,r,o.strictNumbers),()=>a.assign(i,r))),a.if((0,B._)`${i} !== undefined`);for(let d of n)(Wm.has(d)||d==="array"&&o.coerceTypes==="array")&&l(d);a.else(),ql(t),a.endIf(),a.if((0,B._)`${i} !== undefined`,()=>{a.assign(r,i),gI(t,i)});function l(d){switch(d){case"string":a.elseIf((0,B._)`${s} == "number" || ${s} == "boolean"`).assign(i,(0,B._)`"" + ${r}`).elseIf((0,B._)`${r} === null`).assign(i,(0,B._)`""`);return;case"number":a.elseIf((0,B._)`${s} == "boolean" || ${r} === null
|
|
5
5
|
|| (${s} == "string" && ${r} && ${r} == +${r})`).assign(i,(0,B._)`+${r}`);return;case"integer":a.elseIf((0,B._)`${s} === "boolean" || ${r} === null
|
|
6
6
|
|| (${s} === "string" && ${r} && ${r} == +${r} && !(${r} % 1))`).assign(i,(0,B._)`+${r}`);return;case"boolean":a.elseIf((0,B._)`${r} === "false" || ${r} === 0 || ${r} === null`).assign(i,!1).elseIf((0,B._)`${r} === "true" || ${r} === 1`).assign(i,!0);return;case"null":a.elseIf((0,B._)`${r} === "" || ${r} === 0 || ${r} === false`),a.assign(i,null);return;case"array":a.elseIf((0,B._)`${s} === "string" || ${s} === "number"
|
|
@@ -490,25 +490,6 @@ To unique-constrain a relation field, use the FK field name ("user_id"), not the
|
|
|
490
490
|
### Geographic Location
|
|
491
491
|
Use GEO_POINT for coordinates. Never split into separate latitude/longitude fields. A GEO_POINT field auto-generates a companion DECIMAL hack field named "fz_distance_from_<apiName>", where <apiName> is the geo_point's apiName (may differ from its displayName). At request time it returns the distance from the stored geo_point to the user-supplied location in the request. Treat it as a distance-calculation hack \u2014 future migration: this will be replaced by formula fields.
|
|
492
492
|
|
|
493
|
-
### Data Views
|
|
494
|
-
A view is a saved SELECT over this project's tables, exposed as a READ-ONLY table of its own: it has a displayName like any table, it shows up in reads and data bindings, and it is queried the same way. Reach for one when the SAME joined or aggregated result is needed in more than one place \u2014 "Number of orders and total amount per user" \u2014 so the definition lives once instead of being rebuilt in every query, component and action flow that needs it.
|
|
495
|
-
|
|
496
|
-
A view is a definition, not a copy: it holds no data of its own and is recomputed on every read, so it is never stale. It costs what the query costs, every time it is read.
|
|
497
|
-
|
|
498
|
-
Write the SQL against the API (snake_case) names, quoted and case-sensitive \u2014 the same names GET_TABLES_INFO reports. Everything else on this plugin is addressed by displayName; the SQL body is the one place that is not, because it is PostgreSQL rather than a tool argument.
|
|
499
|
-
|
|
500
|
-
Always ANALYZE_VIEW_SQL first and fix what it reports before creating or updating a view. It returns the exact columns the view would expose, so it is also how you learn what a view you are about to build on actually gives you. Creating or updating a view with SQL that does not analyse is rejected, not stored.
|
|
501
|
-
|
|
502
|
-
You CANNOT:
|
|
503
|
-
- Write through a view. There is no insert, update or delete, and no by-id lookup: a view has no primary key.
|
|
504
|
-
- Use the whole of SQL. One SELECT only: JOIN with ON, WHERE, GROUP BY, HAVING, ORDER BY, LIMIT, UNION, CTEs, CASE, COALESCE, casts and the aggregate functions. NOT available: subqueries, window functions, query parameters, and anything that is not a single SELECT statement.
|
|
505
|
-
- Parameterise a view. It is a stored definition with no request context, so there is no "current user" inside it and no placeholder to bind. Expose the user column and filter when you QUERY the view instead.
|
|
506
|
-
- Omit a column alias. Every output column needs an explicit \`AS alias\`, and that alias is the field name the view exposes.
|
|
507
|
-
- Read an IMAGE_LIST column. Every other type works, but a media column is read under its database name \u2014 an IMAGE/VIDEO/FILE field called "avatar" is \`avatar_id\` in the SQL, and aliasing it \`AS cover_id\` exposes it as a media field named "cover". Keep the \`_id\` suffix or it comes back as a plain number.
|
|
508
|
-
- Delete a view another view still reads. Delete or rewrite the reader first.
|
|
509
|
-
|
|
510
|
-
Views take effect online only after "Sync Backend", like every other data-model change.
|
|
511
|
-
|
|
512
493
|
### Constraints
|
|
513
494
|
Only unique constraints supported. Constraint name: lowercase English snake_case, no uppercase. Reference fields by their displayName \u2014 for a relation's foreign key use the generated FK field ("user_id"). Uniqueness is fixed when a field is created and cannot be turned on afterwards (existing rows could already hold duplicates), so to make an existing field unique, add a constraint over it. Use a constraint to span multiple fields (composite unique): list the fields' displayNames. Unique constraints are also the only DB-enforced invariant writers can lean on for atomic insert-if-absent / toggle semantics (insert with on_conflict): whenever the design has "at most one row per X" semantics (a join/like/save table, an idempotency key), create the unique constraint up front \u2014 read-check-then-insert cannot be made race-safe without it.
|
|
514
495
|
|
|
@@ -591,25 +572,6 @@ Enum types are created and edited via the 'type' plugin, not here. To use an enu
|
|
|
591
572
|
### Geographic Location
|
|
592
573
|
Use s:p:geo_point for coordinates. Never split into separate latitude/longitude fields. A s:p:geo_point field auto-generates a companion s:p:decimal hack field named "fz_distance_from_<apiName>", where <apiName> is the geo_point's apiName (may differ from its displayName). At request time it returns the distance from the stored geo_point to the user-supplied location in the request. Treat it as a distance-calculation hack \u2014 future migration: this will be replaced by formula fields.
|
|
593
574
|
|
|
594
|
-
### Data Views
|
|
595
|
-
A view is a saved SELECT over this project's tables, exposed as a READ-ONLY table of its own: it has a displayName like any table, it shows up in reads and data bindings, and it is queried the same way. Reach for one when the SAME joined or aggregated result is needed in more than one place \u2014 "Number of orders and total amount per user" \u2014 so the definition lives once instead of being rebuilt in every query, component and action flow that needs it.
|
|
596
|
-
|
|
597
|
-
A view is a definition, not a copy: it holds no data of its own and is recomputed on every read, so it is never stale. It costs what the query costs, every time it is read.
|
|
598
|
-
|
|
599
|
-
Write the SQL against the API (snake_case) names, quoted and case-sensitive \u2014 the same names GET_TABLES_INFO reports. Everything else on this plugin is addressed by displayName; the SQL body is the one place that is not, because it is PostgreSQL rather than a tool argument.
|
|
600
|
-
|
|
601
|
-
Always ANALYZE_VIEW_SQL first and fix what it reports before creating or updating a view. It returns the exact columns the view would expose, so it is also how you learn what a view you are about to build on actually gives you. Creating or updating a view with SQL that does not analyse is rejected, not stored.
|
|
602
|
-
|
|
603
|
-
You CANNOT:
|
|
604
|
-
- Write through a view. There is no insert, update or delete, and no by-id lookup: a view has no primary key.
|
|
605
|
-
- Use the whole of SQL. One SELECT only: JOIN with ON, WHERE, GROUP BY, HAVING, ORDER BY, LIMIT, UNION, CTEs, CASE, COALESCE, casts and the aggregate functions. NOT available: subqueries, window functions, query parameters, and anything that is not a single SELECT statement.
|
|
606
|
-
- Parameterise a view. It is a stored definition with no request context, so there is no "current user" inside it and no placeholder to bind. Expose the user column and filter when you QUERY the view instead.
|
|
607
|
-
- Omit a column alias. Every output column needs an explicit \`AS alias\`, and that alias is the field name the view exposes.
|
|
608
|
-
- Read an IMAGE_LIST column. Every other type works, but a media column is read under its database name \u2014 an IMAGE/VIDEO/FILE field called "avatar" is \`avatar_id\` in the SQL, and aliasing it \`AS cover_id\` exposes it as a media field named "cover". Keep the \`_id\` suffix or it comes back as a plain number.
|
|
609
|
-
- Delete a view another view still reads. Delete or rewrite the reader first.
|
|
610
|
-
|
|
611
|
-
Views take effect online only after "Sync Backend", like every other data-model change.
|
|
612
|
-
|
|
613
575
|
### Constraints
|
|
614
576
|
Only unique constraints supported. Constraint name: lowercase English snake_case, no uppercase. Reference fields by their displayName \u2014 for a relation's foreign key use the generated FK field ("user_id"). Uniqueness is fixed when a field is created and cannot be turned on afterwards (existing rows could already hold duplicates), so to make an existing field unique, add a constraint over it. Use a constraint to span multiple fields (composite unique): list the fields' displayNames. Unique constraints are also the only DB-enforced invariant writers can lean on for atomic insert-if-absent / toggle semantics (insert with on_conflict): whenever the design has "at most one row per X" semantics (a join/like/save table, an idempotency key), create the unique constraint up front \u2014 read-check-then-insert cannot be made race-safe without it.
|
|
615
577
|
|
|
@@ -699,7 +661,7 @@ unfamiliar project, and treat its answer as the census: the per-domain \`list_*\
|
|
|
699
661
|
subsets of it, so calling one after this buys nothing.
|
|
700
662
|
- GET_ENTITY_RELATION_GRAPH \u2014 the relation graph around one entity: who reads / writes / calls / governs it, expanded a bounded number of hops. Use it before changing or deleting an entity to see what depends on it.
|
|
701
663
|
|
|
702
|
-
Both are read-only; neither mutates the schema.`}},payments:{pre:{available:!0,prompt:"## Payment System Domain Knowledge\nZion's payment system is built around a developer-owned **order table** plus a set of platform-managed payment records and **auto-generated Actionflows** that react to gateway callbacks. On Zion the gateways are WeChat Pay (mini-program and H5/JSAPI) and Alipay (PC web; one-time plus recurring \"agreement\" subscriptions). Enabling and configuring payments splits in two: you activate the module with ACTIVATE_PAYMENT; the gateway credentials, the brand assets and the Pro-plan upgrade are the user's own, in the editor (Settings \u2192 Payment).\n\n### Prerequisites (in order)\n1. The user upgrades the project to the Pro plan or higher (payments are gated by plan; an expired plan breaks live payments and blocks publishing).\n2. Create the **order table** (see below) with its required fields.\n3. Call ACTIVATE_PAYMENT with the order table's display name. Read `overview.project` first \u2014 it reports whether payments are already enabled and which types are active, and the order table is fixed by the first activation and ignored afterwards. The call appends the type's generated flows/callbacks/jobs and grants the logged-in user role permission to pay with it; a first activation also inserts the payment tables, which every role then carries in its table permissions though only the logged-in user role can read them. It names what it created; say so in your answer, since in AUTO_ACCEPT the user was not asked.\n4. Configure the gateway credentials \u2014 WeChat Pay (merchant ID, APIv2 key, the linked Mini Program AppID, plus the apiclient_cert.p12 for refunds) and/or Alipay (app ID and an RSA2 key pair) and/or Airwallex (client ID, API key and webhook secret) \u2014 plus brand name, logo, slogan.\n5. Confirm the auto-generated payment/refund callback flows are wired.\n\n### The Order Table (you design this \u2014 follow database conventions)\nThe order table is a normal business table you create; the payment engine references one of its rows by its primary-key id (the `orderId` everywhere below). At minimum it needs:\n- an **amount/price** column \u2014 type `DECIMAL`, the authoritative price computed server-side.\n- a **status** column \u2014 model it as a `TEXT` column holding the lifecycle value (e.g.\n `pending`, `paid`, `cancelled`, `refunded`); your fulfillment flow updates it. Custom\n enums are unavailable in this project, so use TEXT here.\n- a **buyer link** \u2014 do NOT add a raw `user_id`/`account_id` column. Create a 1:n RELATION from `account` to the order table so the buyer FK is generated automatically (the same manual-foreign-key rule the database plugin enforces). Add product/quantity links as relations too. Naming follows the usual rules: `snake_case` system names, no manual `id`/`created_at` columns (the runner mints the PK).\n\n**Irreversibility warning:** once the order table is linked to the payment module it CANNOT be unlinked, replaced, or deleted. Always confirm the table design with the user and warn them of this before they bind it. Choose the table deliberately.\n\n### Platform-Managed Tables (do NOT create or model these)\nEnabling payments auto-creates three system tables \u2014 never recreate them as user tables and never write to them directly:\n- the **payment** table (`fz_payment` / `fz_payment_record`, 1:N from the order table) \u2014 one row per payment attempt, carrying `orderId`, `accountId`, `type`, `status`, `currency`, `grandTotalValue`, `transactionId`.\n- the **recurring_payment** table \u2014 Alipay agreement subscriptions and their billing cycle.\n- the **refund** table (1:N from payment) \u2014 refund transactions. The internal payment `status` is a fixed lifecycle enum: `PENDING`, `CANCELLED`, `SUCCESSFUL`, `FAILED`, `PARTIALLY_REFUNDED`, `REFUNDING`, `REFUNDED`. Your order table's own status column is separate from this \u2014 your fulfillment flow translates one into the other.\n\n### Auto-Created Callback Actionflows (WeChat Pay / Alipay)\nEnabling payments auto-generates the backend callback Actionflows the editor wires to each payment action. They have no fixed English name (they are the \"preset\" flows for the channel you enabled); don't delete or rename them. You edit their bodies to run business logic:\n- the **payment** flow \u2014 triggered automatically after a charge resolves.\n- the **refund** flow \u2014 triggered automatically after a refund resolves.\n- the Alipay **recurring-deduction** flow \u2014 a daily scheduled loop that charges due agreements.\n\n### Editing the payment flow (the one you almost always modify)\nThe flow has a built-in \"parse payment result\" code block that outputs four values:\n- `orderId` \u2014 the order-table row you passed to the payment action; use it to find and update the order.\n- `paymentFound` \u2014 whether a matching payment record was found.\n- `paymentStatus` \u2014 `SUCCESSFUL` or `FAILED`.\n- `alreadyProcessed` \u2014 boolean; `false` on the first trigger, `true` on a re-delivery. **Idempotency contract (critical):** the same payment can trigger the flow more than once. Only run fulfillment / mark the order paid when `paymentFound` is true, `paymentStatus` is the expected value, AND `alreadyProcessed == false`. Guard the fulfillment branch with Condition nodes on these, otherwise duplicate callbacks double-fulfill (double-ship, double-credit). For safety, also add a branch that re-checks the actual paid amount against the order's amount before fulfilling. The refund flow works the same way: its parser returns `orderId`, `refundFound`, `paymentStatus` (`REFUNDED` or `FAILED`), and `alreadyProcessed`.\n\n### Creating an Order (the secure-transaction pattern)\nNever let the client decide the price. Order creation must run server-side:\n1. Frontend triggers a backend Actionflow passing only identifiers (e.g. `product_id`, quantity) \u2014 never the price.\n2. The flow queries the product/price server-side, computes the authoritative amount, inserts a new order row with status `pending`, and returns the generated `orderId` and verified amount.\n3. The frontend maps the *returned* `orderId` and amount into the WeChat Pay / Alipay / Airwallex payment action. This is the Zero-Trust pattern: the price the customer is charged is the one the server computed and stored on the order, not anything the browser sent.\n\n### Amounts & Currency\nThe WeChat Pay and Alipay payment actions take the amount in **yuan (\u5143) as a `DECIMAL` with at most two decimal places, and it must be greater than 0.01** \u2014 pass the order's server-computed price directly; do NOT convert to cents/\u5206.\n\n### Airwallex (only where enabled for the project)\nAirwallex is activated like any other type and takes both one-time payments and subscriptions. It generates two backend Actionflows; don't delete or rename them:\n1. **Airwallex Payment** \u2014 receives every Airwallex webhook as `fz_payment_callback_input` and branches on the event type: payment status changed (`payment_intent.succeeded` / `payment_intent.cancelled`), refund (`refund.accepted` / `refund.failed`), subscription status changes, and `invoice.finalized`. In the payment branch the built-in \"Sync payment status\" block outputs `orderId`, `paymentStatus` (`SUCCESSFUL` or `CANCELLED`) and `alreadyProcessed`; in the refund branch \"Sync refund status\" outputs `orderId`, `status` (`REFUNDED` or `FAILED`) and `alreadyProcessed`. Put fulfillment after those blocks under the same idempotency contract: act only on the expected status AND `alreadyProcessed == false`.\n2. **Airwallex Subscription Renewal** \u2014 called by Airwallex Payment with the invoice id to create the order and payment for a subscription renewal.\nAirwallex amounts are decimals in the currency's major unit (10.00, not 1000): pass the order's server-computed decimal price directly.\n\n### Recurring Payments (Alipay)\nAlipay supports subscriptions via a signed agreement. The start action takes `orderId`, a price (Alipay caps recurring amounts at \xA5100), a product name, a deduction interval (\u2265 7 days), and an Alipay scene code (a user can subscribe to the same scene only once); the cancel action takes the recurring-payment row id. Deductions run in the auto-generated daily loop flow: for each due agreement you must create a NEW order inside the loop and bind its id to the deduction node's `orderId` input. Note: a full Alipay refund does not re-trigger the payment flow.\n\n### Scope Note\nACTIVATE_PAYMENT turns the module on one type at a time, and the actionflow plugin edits the generated flows' bodies. What you cannot do is the user's own editor work (Settings \u2192 Payment): the gateway credentials, the brand assets and the plan upgrade. Design the order table first (via the database plugin), then activate, then wire the secure order-creation flow and add the `alreadyProcessed` idempotency guard in the payment flow."},post:{available:!0,prompt:"## Payment System Domain Knowledge\nZion's payment system is built around a developer-owned **order table** plus a set of platform-managed payment records and **auto-generated Actionflows** that react to gateway callbacks. On Zion the gateways are WeChat Pay (mini-program and H5/JSAPI) and Alipay (PC web; one-time plus recurring \"agreement\" subscriptions). Enabling and configuring payments splits in two: you activate the module with ACTIVATE_PAYMENT; the gateway credentials, the brand assets and the Pro-plan upgrade are the user's own, in the editor (Action \u2192 Payment).\n\n### Prerequisites (in order)\n1. The user upgrades the project to the Pro plan or higher (payments are gated by plan; an expired plan breaks live payments and blocks publishing).\n2. Create the **order table** (see below) with its required fields.\n3. Call ACTIVATE_PAYMENT with the order table's display name. Read `overview.project` first \u2014 it reports whether payments are already enabled and which types are active, and the order table is fixed by the first activation and ignored afterwards. The call appends the type's generated flows/callbacks/jobs and grants the logged-in user role permission to pay with it; a first activation also inserts the payment tables, which every role then carries in its table permissions though only the logged-in user role can read them. It names what it created; say so in your answer, since in AUTO_ACCEPT the user was not asked.\n4. Configure the gateway credentials \u2014 WeChat Pay (merchant ID, APIv2 key, the linked Mini Program AppID, plus the apiclient_cert.p12 for refunds) and/or Alipay (app ID and an RSA2 key pair) and/or Airwallex (client ID, API key and webhook secret) \u2014 plus brand name, logo, slogan.\n5. Confirm the auto-generated payment/refund callback flows are wired.\n\n### The Order Table (you design this \u2014 follow database conventions)\nThe order table is a normal business table you create; the payment engine references one of its rows by its primary-key id (the `orderId` everywhere below). At minimum it needs:\n- an **amount/price** column \u2014 type `s:p:decimal`, the authoritative price computed server-side.\n- a **status** column \u2014 create a custom enum whose options mirror the payment lifecycle\n (e.g. `pending`, `paid`, `cancelled`, `refunded`), then use the exact\n `u:e:<enumId>` returned by the type plugin as the column type; your fulfillment flow\n updates it.\n- a **buyer link** \u2014 do NOT add a raw `user_id`/`account_id` column. Create a 1:n RELATION from `account` to the order table so the buyer FK is generated automatically (the same manual-foreign-key rule the database plugin enforces). Add product/quantity links as relations too. Naming follows the usual rules: `snake_case` system names, no manual `id`/`created_at` columns (the runner mints the PK).\n\n**Irreversibility warning:** once the order table is linked to the payment module it CANNOT be unlinked, replaced, or deleted. Always confirm the table design with the user and warn them of this before they bind it. Choose the table deliberately.\n\n### Platform-Managed Tables (do NOT create or model these)\nEnabling payments auto-creates three system tables \u2014 never recreate them as user tables and never write to them directly:\n- the **payment** table (`fz_payment` / `fz_payment_record`, 1:N from the order table) \u2014 one row per payment attempt, carrying `orderId`, `accountId`, `type`, `status`, `currency`, `grandTotalValue`, `transactionId`.\n- the **recurring_payment** table \u2014 Alipay agreement subscriptions and their billing cycle.\n- the **refund** table (1:N from payment) \u2014 refund transactions. The internal payment `status` is a fixed lifecycle enum: `PENDING`, `CANCELLED`, `SUCCESSFUL`, `FAILED`, `PARTIALLY_REFUNDED`, `REFUNDING`, `REFUNDED`. Your order table's own status column is separate from this \u2014 your fulfillment flow translates one into the other.\n\n### Auto-Created Callback Actionflows (WeChat Pay / Alipay)\nEnabling payments auto-generates the backend callback Actionflows the editor wires to each payment action. They have no fixed English name (they are the \"preset\" flows for the channel you enabled); don't delete or rename them. You edit their bodies to run business logic:\n- the **payment** flow \u2014 triggered automatically after a charge resolves.\n- the **refund** flow \u2014 triggered automatically after a refund resolves.\n- the Alipay **recurring-deduction** flow \u2014 a daily scheduled loop that charges due agreements.\n\n### Editing the payment flow (the one you almost always modify)\nThe flow has a built-in \"parse payment result\" code block that outputs four values:\n- `orderId` \u2014 the order-table row you passed to the payment action; use it to find and update the order.\n- `paymentFound` \u2014 whether a matching payment record was found.\n- `paymentStatus` \u2014 `SUCCESSFUL` or `FAILED`.\n- `alreadyProcessed` \u2014 boolean; `false` on the first trigger, `true` on a re-delivery. **Idempotency contract (critical):** the same payment can trigger the flow more than once. Only run fulfillment / mark the order paid when `paymentFound` is true, `paymentStatus` is the expected value, AND `alreadyProcessed == false`. Guard the fulfillment branch with Condition nodes on these, otherwise duplicate callbacks double-fulfill (double-ship, double-credit). For safety, also add a branch that re-checks the actual paid amount against the order's amount before fulfilling. The refund flow works the same way: its parser returns `orderId`, `refundFound`, `paymentStatus` (`REFUNDED` or `FAILED`), and `alreadyProcessed`.\n\n### Creating an Order (the secure-transaction pattern)\nNever let the client decide the price. Order creation must run server-side:\n1. Frontend triggers a backend Actionflow passing only identifiers (e.g. `product_id`, quantity) \u2014 never the price.\n2. The flow queries the product/price server-side, computes the authoritative amount, inserts a new order row with status `pending`, and returns the generated `orderId` and verified amount.\n3. The frontend maps the *returned* `orderId` and amount into the WeChat Pay / Alipay / Airwallex payment action. This is the Zero-Trust pattern: the price the customer is charged is the one the server computed and stored on the order, not anything the browser sent.\n\n### Amounts & Currency\nThe WeChat Pay and Alipay payment actions take the amount in **yuan (\u5143) as a `s:p:decimal` with at most two decimal places, and it must be greater than 0.01** \u2014 pass the order's server-computed price directly; do NOT convert to cents/\u5206.\n\n### Airwallex (only where enabled for the project)\nAirwallex is activated like any other type and takes both one-time payments and subscriptions. It generates two backend Actionflows; don't delete or rename them:\n1. **Airwallex Payment** \u2014 receives every Airwallex webhook as `fz_payment_callback_input` and branches on the event type: payment status changed (`payment_intent.succeeded` / `payment_intent.cancelled`), refund (`refund.accepted` / `refund.failed`), subscription status changes, and `invoice.finalized`. In the payment branch the built-in \"Sync payment status\" block outputs `orderId`, `paymentStatus` (`SUCCESSFUL` or `CANCELLED`) and `alreadyProcessed`; in the refund branch \"Sync refund status\" outputs `orderId`, `status` (`REFUNDED` or `FAILED`) and `alreadyProcessed`. Put fulfillment after those blocks under the same idempotency contract: act only on the expected status AND `alreadyProcessed == false`.\n2. **Airwallex Subscription Renewal** \u2014 called by Airwallex Payment with the invoice id to create the order and payment for a subscription renewal.\nAirwallex amounts are decimals in the currency's major unit (10.00, not 1000): pass the order's server-computed decimal price directly.\n\n### Recurring Payments (Alipay)\nAlipay supports subscriptions via a signed agreement. The start action takes `orderId`, a price (Alipay caps recurring amounts at \xA5100), a product name, a deduction interval (\u2265 7 days), and an Alipay scene code (a user can subscribe to the same scene only once); the cancel action takes the recurring-payment row id. Deductions run in the auto-generated daily loop flow: for each due agreement you must create a NEW order inside the loop and bind its id to the deduction node's `orderId` input. Note: a full Alipay refund does not re-trigger the payment flow.\n\n### Scope Note\nACTIVATE_PAYMENT turns the module on one type at a time, and the actionflow plugin edits the generated flows' bodies. What you cannot do is the user's own editor work (Action \u2192 Payment): the gateway credentials, the brand assets and the plan upgrade. Design the order table first (via the database plugin), then activate, then wire the secure order-creation flow and add the `alreadyProcessed` idempotency guard in the payment flow."}},permissions:{pre:{available:!0,prompt:'## Permission System Domain Knowledge\nZion secures data and actions with RBAC (roles) plus ABAC (per-row conditions). Every tool in this plugin edits the project schema only \u2014 the change reaches the deployed backend when "Sync Backend" runs, which is the last step of any permission task.\n\n### Model\n- **Role**: a named collection of users. Two are predefined and cannot be renamed or deleted: **Logged-in User** (held by every authenticated user) and **Anonymous User** (unauthenticated requests). Custom roles can then be created, renamed, and deleted, up to the project\'s role limit \u2014 but **`Admin` is a reserved name**: a role is treated as system-defined by *name*, so one created or renamed to `Admin` could never be renamed or deleted again. Both tools refuse it; pick another name.\n- **Data Permission**: what a role may read or write, at table, column and row level.\n- **Action Permission**: which Third-Party API configurations, Actionflows, AI agents and payment operations a role may invoke.\n- Each action block is allow-all or an explicit allow-list. On top of those grants, per-target conditional checks are available for Actionflows and AI agents; payments take allow-all or a payment-type/billing-method map.\n- **Roles only ever add.** A user\'s effective permissions are the union of every role they hold; a restrictive role never subtracts what a permissive one granted. To take access away, narrow or unassign the permissive role \u2014 never "add a limited role".\n\n### Activate first\nRole names come from `GET_PROJECT_OVERVIEW`\'s `roles` section, which also reports whether role permission is activated; `GET_ALL_ROLES_INFO` is the fallback when you have not run it. When either reports that role permission is not activated:\n- In BUILD or AUTO_ACCEPT mode, you MUST immediately call `ACTIVATE_ROLE_PERMISSION`, which seeds the predefined roles. BUILD uses the normal user-confirmation gate; AUTO_ACCEPT applies it immediately.\n- In RESEARCH mode, do not attempt a mutation; tell the user to look into permissions in \u8BBE\u7F6E \u2192 \u6743\u9650\u7BA1\u7406.\n\n### Grant\nData permissions are configured coarse \u2192 fine:\n1. **Table**: which operations (select / insert / update / delete / count / aggregate) the role may run.\n2. **Column**: which fields each operation covers.\n3. **Row**: a per-operation condition \u2014 a filter over existing rows for select, update and delete, a check on the incoming row for insert. Each one starts always-true, so a fresh grant is open until narrowed.\n\nRead before writing: `GET_ROLE_DETAIL`, naming every role the task will edit; the role names are already in `GET_PROJECT_OVERVIEW`. It reports each table by exception \u2014 the operations granted, the ones under `rowConditions` whose row condition has been narrowed, and `restrictedColumns` only where a grant covers less than the whole table, so an operation listed as granted and mentioned nowhere else is open on every column and every row. Tables the role cannot touch at all are named together in `tablesWithNoGrants`. Pass `blocks` when the task is about one block (the table block is nearly the whole payload). It does not carry the row conditions\' schema paths \u2014 when you are narrowing one, read `GET_TABLE_PERMISSION` instead: it names the tables you are about to change, reports each operation\'s condition path, and satisfies the same gate, so the path arrives in the call right before the one that uses it. Edit with `ADD_ROLES`, `UPDATE_ROLE`, `DELETE_ROLES` and the per-block setters `UPDATE_ROLE_TABLE_PERMISSION`, `UPDATE_ROLE_ACTION_FLOW_PERMISSION`, `UPDATE_ROLE_ZAI_PERMISSION`, `UPDATE_ROLE_PAYMENT_PERMISSION`, `UPDATE_ROLE_TPA_PERMISSION` for Third-Party API configurations. Account insert/delete is unavailable, and `id` is pinned into every table SELECT grant.\n\nViews (the read-only saved queries the database plugin manages) are granted separately with `UPDATE_ROLE_VIEW_PERMISSION`: only select / count / aggregate exist, each with its column set and row condition, and a view no role has been granted cannot be queried by anyone. `GET_VIEW_PERMISSION` reports a view\'s condition paths the way `GET_TABLE_PERMISSION` does for tables.\n\n`allowAll` on `tpaPermission`, `actionflowPermission` or `zAiPermission` also covers resources added later \u2014 prefer explicit allow-lists unless broad access is intentional.\n\n**Role, or a field on Account?** Use a role for static functional boundaries: who may run a flow, read a table, see a column. Add a field on the Account table for per-user state: VIP status, nickname, bio.\n\n**Never create one role per group.** For departments, stores, tenants or any other segmentation, use the relation-first pattern: create a `1:n` relation from the context table (e.g. `department`) to `Account`, and a second one from that same table to the business table (e.g. `sales_record`). Both foreign-key columns are generated and non-editable \u2014 never declare them as raw integer fields. Then define one generic role (`Sales_Staff`) and compare those two columns in its row conditions.\n\nSimple single-table CRUD may run directly from the frontend when table, column, and row permissions fully express the authorization policy \u2014 do not wrap it in an Actionflow. Reach for a Backend Actionflow only when the rule cannot be expressed that way at all: it needs server-held secrets, cross-table atomicity, or multi-step state transitions.\n\n### Row conditions (ABAC)\nNarrowing those conditions is a two-plugin job: this plugin has no tool that edits one \u2014 they live in the **bindings** area, whose tools are the `INSERT_CONDITION_BOOL_EXP` family, addressed by the condition path `GET_TABLE_PERMISSION` reports. The check `SET_ROLE_PERMISSION_CHECK` seeds for an Actionflow or AI agent works the same way.\n\nNever hand-build a permission schema path. It embeds the role\'s index in the schema and the table\'s internal id, neither of which any read reports on its own, so a path assembled from what a read did show resolves to nothing \u2014 copy the one a read returned.\n\nEach operation has its own condition node and its own row branch to compare against, so reusing the select recipe on another op fails:\n- `select` \u2192 path ends `/select/filter` \u2192 the branch holding the row being read\n- `insert` \u2192 path ends `/insert/check`, not `filter` \u2192 the branch holding the row being inserted\n- `update` \u2192 path ends `/update/filter` \u2192 the branch holding the row as stored, or the one holding the incoming values\n- `delete` \u2192 path ends `/delete/filter` \u2192 the branch holding the row being deleted\n- `count` / `aggregate` \u2192 no row branch exists, only the logged-in user and the current time, so they cannot be row-scoped. Whenever you narrow `select`, send `count` and `aggregate` `{enabled: false}` too, unless a whole-table count is meant to be public: a row-scoped `select` beside an open `count` still tells any user how many rows everyone else has.\n\nNarrowing one condition:\n1. `GET_TABLE_PERMISSION` for that table (or the result of `UPDATE_ROLE_TABLE_PERMISSION`, which reports the same paths for the grants it just made, or of `SET_ROLE_PERMISSION_CHECK` for a flow/agent check) \u2192 that operation\'s condition schema path. `GET_ROLE_DETAIL` does not carry them.\n2. `INSERT_CONDITION_BOOL_EXP` at that path \u2192 returns a `conditionSchemaPath`. Copy it verbatim; never hand-build one.\n3. `GET_EXPRESSION_CONDITION_OPERATORS` at that path, then `UPDATE_EXPRESSION_CONDITION_OPERATOR` with an operator copied verbatim. The `target` and `value` operand slots do not exist until the operator is set \u2014 binding first fails with "has no binding site at \u2026/target".\n4. Fill both operands at `<conditionSchemaPath>/target` and `<conditionSchemaPath>/value`, addressed by `pathInHierarchicalMenu`. Read that path \u2014 branch label included \u2014 from `BROWSE_DATA_BINDING_OPTIONS` at the operand\'s own schema path and copy it verbatim; never hand-build one. Relations traverse, so a child table can compare against its parent\'s owner \u2014 that path is four segments deep: context root, row branch, relation, column. Every segment is a label from the tree, including the root.\n5. Delete the always-true placeholder the grant started with: `DELETE_CONDITION_BOOL_EXP` at `<step 1\'s condition schema path>/_and/[0]` \u2014 the filter\'s own path, not the comparison path step 2 returned. Harmless at runtime, but the editor renders it as an empty condition row, so the user sees a half-configured rule.\n6. Shape multi-clause predicates with `NEST_CONDITION_BOOL_EXP`, `TOGGLE_CONDITION_BOOL_EXP_AND_OR`, `TOGGLE_CONDITION_BOOL_EXP_NOT`.\n7. Sync Backend.\n\nExample \u2014 "a staff member only ever touches their own department\'s sales records" \u2014 after granting `Sales_Staff` select, insert, update and delete on `sales_record`, configure four conditions, each comparing that operation\'s own row branch `department_id` against the logged-in user\'s `department_id`. Configuring only select leaves the writes unrestricted.\n\nA batch of tool calls is all-or-nothing: one bad call discards every change in that batch. Send exploratory reads on their own \u2014 especially the first `BROWSE_DATA_BINDING_OPTIONS` for an operation whose context branch you have not seen \u2014 then batch the writes.\n\n### Assign the role\nA custom role does nothing until an account holds it. Two ways:\n- Manual: assign in the editor, under \u8BBE\u7F6E \u2192 \u6743\u9650\u7BA1\u7406.\n- Automatic: the Permissions node inside an Actionflow (e.g. grant VIP after purchase). These grants and revocations take effect immediately \u2014 no backend sync required.\n\n### Definition of done\nA permission task is finished only when all of these hold. Check them before reporting:\n1. Every operation you enabled is listed under its table\'s `rowConditions` in `GET_ROLE_DETAIL`, or is deliberately open.\n2. `GET_ROLE_DETAIL` on **Anonymous User** *and* **Logged-in User** shows no unintended grant on the tables you touched. A newly created table lands in every role automatically, with select, insert, update, delete, count and aggregate all granted and unconditioned \u2014 the two predefined roles included. Observed on a deployed project: an unauthenticated request could read every row, and after only SELECT was revoked it could still INSERT. Checking Anonymous User alone leaves every logged-in user holding the same open grant.\n3. Any custom role you created is actually assigned to someone.\n4. "Sync Backend" has run.\nIf you stop short of any of these, say so explicitly and name which grants are still open. Never report the permission work as complete.\n\n### Troubleshooting 403\n403s surface in runtime logs and client responses:\n```json\n{\n "errorCode": 403,\n "extensions": { "classification": "TABLE_ACCESS" },\n "message": "User 1 has no permission for SELECT on order"\n}\n```\n"User 1" is the user whose internal id ends in 1 (1000000000000001). Then:\n1. Confirm the user holds the role you expect.\n2. Read that role with `GET_TABLE_PERMISSION` on the table the 403 names: is the operation enabled, is the column inside its grant, and does its row condition match the row the user expected?\n3. Confirm "Sync Backend" ran after the last permission change.'},post:{available:!0,prompt:'## Permission System Domain Knowledge\nZion secures data and actions with RBAC (roles) plus ABAC (per-row conditions). Every tool in this plugin edits the project schema only \u2014 the change reaches the deployed backend when "Sync Backend" runs, which is the last step of any permission task.\n\n### Model\n- **Role**: a named collection of users. Two are predefined and cannot be renamed or deleted: **Logged-in User** (held by every authenticated user) and **Anonymous User** (unauthenticated requests). Custom roles can then be created, renamed, and deleted, up to the project\'s role limit \u2014 but **`Admin` is a reserved name**: a role is treated as system-defined by *name*, so one created or renamed to `Admin` could never be renamed or deleted again. Both tools refuse it; pick another name.\n- **Data Permission**: what a role may read or write, at table, column and row level.\n- **Action Permission**: which workspace HTTP APIs, Actionflows, AI agents and payment operations a role may invoke.\n- Each action block is allow-all or an explicit allow-list. On top of those grants, per-target conditional checks are available for Actionflows and AI agents; payments take allow-all or a payment-type/billing-method map.\n- **Roles only ever add.** A user\'s effective permissions are the union of every role they hold; a restrictive role never subtracts what a permissive one granted. To take access away, narrow or unassign the permissive role \u2014 never "add a limited role".\n\n### Activate first\nRole names come from `GET_PROJECT_OVERVIEW`\'s `roles` section, which also reports whether role permission is activated; `GET_ALL_ROLES_INFO` is the fallback when you have not run it. When either reports that role permission is not activated:\n- In BUILD or AUTO_ACCEPT mode, you MUST immediately call `ACTIVATE_ROLE_PERMISSION`, which seeds the predefined roles. BUILD uses the normal user-confirmation gate; AUTO_ACCEPT applies it immediately.\n- In RESEARCH mode, do not attempt a mutation; tell the user to look into permissions in \u8BBE\u7F6E \u2192 \u6743\u9650\u7BA1\u7406.\n\n### Grant\nData permissions are configured coarse \u2192 fine:\n1. **Table**: which operations (select / insert / update / delete / count / aggregate) the role may run.\n2. **Column**: which fields each operation covers.\n3. **Row**: a per-operation condition \u2014 a filter over existing rows for select, update and delete, a check on the incoming row for insert. Each one starts always-true, so a fresh grant is open until narrowed.\n\nRead before writing: `GET_ROLE_DETAIL`, naming every role the task will edit; the role names are already in `GET_PROJECT_OVERVIEW`. It reports each table by exception \u2014 the operations granted, the ones under `rowConditions` whose row condition has been narrowed, and `restrictedColumns` only where a grant covers less than the whole table, so an operation listed as granted and mentioned nowhere else is open on every column and every row. Tables the role cannot touch at all are named together in `tablesWithNoGrants`. Pass `blocks` when the task is about one block (the table block is nearly the whole payload). It does not carry the row conditions\' schema paths \u2014 when you are narrowing one, read `GET_TABLE_PERMISSION` instead: it names the tables you are about to change, reports each operation\'s condition path, and satisfies the same gate, so the path arrives in the call right before the one that uses it. Edit with `ADD_ROLES`, `UPDATE_ROLE`, `DELETE_ROLES` and the per-block setters `UPDATE_ROLE_TABLE_PERMISSION`, `UPDATE_ROLE_ACTION_FLOW_PERMISSION`, `UPDATE_ROLE_ZAI_PERMISSION`, `UPDATE_ROLE_PAYMENT_PERMISSION`, `UPDATE_ROLE_API_PERMISSION` for workspace HTTP APIs. Account insert/delete is unavailable, and `id` is pinned into every table SELECT grant.\n\nViews (the read-only saved queries the database plugin manages) are granted separately with `UPDATE_ROLE_VIEW_PERMISSION`: only select / count / aggregate exist, each with its column set and row condition, and a view no role has been granted cannot be queried by anyone. `GET_VIEW_PERMISSION` reports a view\'s condition paths the way `GET_TABLE_PERMISSION` does for tables.\n\n`allowAll` on `apiPermission`, `actionflowPermission` or `zAiPermission` also covers resources added later \u2014 prefer explicit allow-lists unless broad access is intentional.\n\n**Role, or a field on Account?** Use a role for static functional boundaries: who may run a flow, read a table, see a column. Add a field on the Account table for per-user state: VIP status, nickname, bio.\n\n**Never create one role per group.** For departments, stores, tenants or any other segmentation, use the relation-first pattern: create a `1:n` relation from the context table (e.g. `department`) to `Account`, and a second one from that same table to the business table (e.g. `sales_record`). Both foreign-key columns are generated and non-editable \u2014 never declare them as raw integer fields. Then define one generic role (`Sales_Staff`) and compare those two columns in its row conditions.\n\nSimple single-table CRUD may run directly from the frontend when table, column, and row permissions fully express the authorization policy \u2014 do not wrap it in an Actionflow. Reach for a Backend Actionflow only when the rule cannot be expressed that way at all: it needs server-held secrets, cross-table atomicity, or multi-step state transitions.\n\n### Row conditions (ABAC)\nNarrowing those conditions is a two-plugin job: this plugin has no tool that edits one \u2014 they live in the **bindings** area, whose tools are the `INSERT_CONDITION_BOOL_EXP` family, addressed by the condition path `GET_TABLE_PERMISSION` reports. The check `SET_ROLE_PERMISSION_CHECK` seeds for an Actionflow or AI agent works the same way.\n\nNever hand-build a permission schema path. It embeds the role\'s index in the schema and the table\'s internal id, neither of which any read reports on its own, so a path assembled from what a read did show resolves to nothing \u2014 copy the one a read returned.\n\nEach operation has its own condition node and its own row branch to compare against, so reusing the select recipe on another op fails:\n- `select` \u2192 path ends `/select/filter` \u2192 the branch holding the row being read\n- `insert` \u2192 path ends `/insert/check`, not `filter` \u2192 the branch holding the row being inserted\n- `update` \u2192 path ends `/update/filter` \u2192 the branch holding the row as stored, or the one holding the incoming values\n- `delete` \u2192 path ends `/delete/filter` \u2192 the branch holding the row being deleted\n- `count` / `aggregate` \u2192 no row branch exists, only the logged-in user and the current time, so they cannot be row-scoped. Whenever you narrow `select`, send `count` and `aggregate` `{enabled: false}` too, unless a whole-table count is meant to be public: a row-scoped `select` beside an open `count` still tells any user how many rows everyone else has.\n\nNarrowing one condition:\n1. `GET_TABLE_PERMISSION` for that table (or the result of `UPDATE_ROLE_TABLE_PERMISSION`, which reports the same paths for the grants it just made, or of `SET_ROLE_PERMISSION_CHECK` for a flow/agent check) \u2192 that operation\'s condition schema path. `GET_ROLE_DETAIL` does not carry them.\n2. `INSERT_CONDITION_BOOL_EXP` at that path \u2192 returns a `conditionSchemaPath`. Copy it verbatim; never hand-build one.\n3. `GET_EXPRESSION_CONDITION_OPERATORS` at that path, then `UPDATE_EXPRESSION_CONDITION_OPERATOR` with an operator copied verbatim. The `target` and `value` operand slots do not exist until the operator is set \u2014 binding first fails with "has no binding site at \u2026/target".\n4. Fill both operands at `<conditionSchemaPath>/target` and `<conditionSchemaPath>/value`, addressed by `pathInHierarchicalMenu`. Read that path \u2014 branch label included \u2014 from `BROWSE_DATA_BINDING_OPTIONS` at the operand\'s own schema path and copy it verbatim; never hand-build one. Relations traverse, so a child table can compare against its parent\'s owner \u2014 that path is four segments deep: context root, row branch, relation, column. Every segment is a label from the tree, including the root.\n5. Delete the always-true placeholder the grant started with: `DELETE_CONDITION_BOOL_EXP` at `<step 1\'s condition schema path>/_and/[0]` \u2014 the filter\'s own path, not the comparison path step 2 returned. Harmless at runtime, but the editor renders it as an empty condition row, so the user sees a half-configured rule.\n6. Shape multi-clause predicates with `NEST_CONDITION_BOOL_EXP`, `TOGGLE_CONDITION_BOOL_EXP_AND_OR`, `TOGGLE_CONDITION_BOOL_EXP_NOT`.\n7. Sync Backend.\n\nExample \u2014 "a staff member only ever touches their own department\'s sales records" \u2014 after granting `Sales_Staff` select, insert, update and delete on `sales_record`, configure four conditions, each comparing that operation\'s own row branch `department_id` against the logged-in user\'s `department_id`. Configuring only select leaves the writes unrestricted.\n\nA batch of tool calls is all-or-nothing: one bad call discards every change in that batch. Send exploratory reads on their own \u2014 especially the first `BROWSE_DATA_BINDING_OPTIONS` for an operation whose context branch you have not seen \u2014 then batch the writes.\n\n### Assign the role\nA custom role does nothing until an account holds it. Two ways:\n- Manual: assign in the editor, under \u8BBE\u7F6E \u2192 \u6743\u9650\u7BA1\u7406.\n- Automatic: the Permissions node inside an Actionflow (e.g. grant VIP after purchase). These grants and revocations take effect immediately \u2014 no backend sync required.\n\n### Definition of done\nA permission task is finished only when all of these hold. Check them before reporting:\n1. Every operation you enabled is listed under its table\'s `rowConditions` in `GET_ROLE_DETAIL`, or is deliberately open.\n2. `GET_ROLE_DETAIL` on **Anonymous User** *and* **Logged-in User** shows no unintended grant on the tables you touched. A newly created table lands in every role automatically, with select, insert, update, delete, count and aggregate all granted and unconditioned \u2014 the two predefined roles included. Observed on a deployed project: an unauthenticated request could read every row, and after only SELECT was revoked it could still INSERT. Checking Anonymous User alone leaves every logged-in user holding the same open grant.\n3. Any custom role you created is actually assigned to someone.\n4. "Sync Backend" has run.\nIf you stop short of any of these, say so explicitly and name which grants are still open. Never report the permission work as complete.\n\n### Troubleshooting 403\n403s surface in runtime logs and client responses:\n```json\n{\n "errorCode": 403,\n "extensions": { "classification": "TABLE_ACCESS" },\n "message": "User 1 has no permission for SELECT on order"\n}\n```\n"User 1" is the user whose internal id ends in 1 (1000000000000001). Then:\n1. Confirm the user holds the role you expect.\n2. Read that role with `GET_TABLE_PERMISSION` on the table the 403 names: is the operation enabled, is the column inside its grant, and does its row condition match the row the user expected?\n3. Confirm "Sync Backend" ran after the last permission change.'}},runtime:{pre:{available:!0,prompt:'## Verifying your own work\nThese tools run against the project\'s REAL backend. There is no staging copy, so prefer the primitives that undo themselves and reach for the ones that do not only when the check genuinely requires them.\n\nDraft versus deployed, which is the distinction that decides whether a green result means anything:\n- `runtime.debug_flow` and `runtime.run_code` execute the DRAFT \u2014 what you just edited \u2014 and revert their database writes by default. This is the verification loop.\n- `runtime.invoke_flow` executes the DEPLOYED version with permissions enforced and reverts nothing. A green invoke on a project with pending changes proves nothing about your edits; the result says so when that is the case.\n\nWhat "done" means here:\n- an action flow you built or changed is not done until `runtime.debug_flow` has run it and you have read the terminal node\'s output;\n- a permission change is not done until you have watched the rule act on data whose existence you are sure of. Reading once as a user proves nothing on its own: an empty result means either "the rule hid it" or "there was nothing there", and those need different fixes. Get a second observation, in this order of preference:\n 1. `runtime.login` with credentials the user gives you \u2014 a real account with its real roles, and the only way to test a rule that keys on a named role without permission to edit the project\'s backend. Ask for them; do not guess them.\n 2. `as: "admin"` alongside `as: "<role>"`, if this session has it. `admin` bypasses row and column permissions, so the pair reads as ground-truth-versus-user over data you did not create. Cheapest when it is available, and unavailable to a session that cannot edit the project\'s backend.\nNeither is open to a session with no credentials to hand, so say which rule you could not verify and why instead of reporting it done;\n- the identity tiers are not one axis, and a rule usually keys on which tier you are in rather than on who you are. Read the same data as each tier the rule is supposed to distinguish, and compare: `as: "anonymous"` sends no credential at all \u2014 a logged-out visitor, the only identity carrying the Anonymous User role, and where public data leaks; an account from `runtime.login` is signed in, carrying Logged-in User plus the project\'s own custom roles, which is a different rung and usually a different answer. Signed-out versus signed-in is the pair most often wrong, so run it whenever a rule claims to require a login;\n- if a check cannot be run, say which one and why. Never report work as verified because it looked right.\n\nWhen a run fails, its nodes carry a `traceId`: pass it to `logs.search` as `traceId: "\u2026"` to get the server-side detail.\n\n### Two filter grammars \u2014 do not mix them\nThe operator-first grammar documented above (`{"_eq": {"bigint_operand": {\u2026}}}`) is the RAW shape, for documents you hand-write and send with `runtime.graphql`. The typed tools \u2014 `runtime.query`, `runtime.aggregate`, `runtime.update`, `runtime.delete` \u2014 take the SIMPLIFIED shape instead: `{"column": {"_op": value}}`, e.g. `{"status": {"_eq": "PAID"}}`. Feeding the raw grammar to a typed tool, or the simplified one to a hand-written document, fails validation at the runtime rather than in the tool.\n\n### Names here are API names, never display names\nThe runtime GraphQL schema is generated from **API names** \u2014 `tableName`, every column in a field list, every key in a filter or a `set`. Every editor read gives you both: `database.get_tables_info` returns each column\'s `apiName` AND its `displayName`, and only the `apiName` is valid here. They diverge the moment anyone renames a column in the editor, which is routine and leaves no trace in the runtime, so a name you read in a UI, a page binding or a conversation is the wrong one until you have checked it against `apiName`. A display name sent here comes back as `Field \'<name>\' in type \'<table>\' is undefined`.\n\n### An enum column takes the option NAME\nIn the schema an enum option has an id and a name, and a binding stores the id. The runtime stores and matches the **name**: filter with `{"status": {"_eq": "PAID"}}`, never the `o1`-style option id you would write into a schema binding. Sending the id is rejected with `Invalid option: <id>, available option: \u2026`, which lists the names \u2014 use one of those verbatim.\n\n### Binary assets are ids, on the way in and on the way out\nImages, videos and files live in object storage; a table column holds only the asset id, never a URL or a path. That changes every side of a runtime call:\n- **Reading**: the column is an object in GraphQL, not a scalar, so selecting `cover_image` bare fails with "Subselection required for type \'FZ_Image\'". Ask for `cover_image_id`, or select a subfield \u2014 `cover_image { id url }`. The typed tools do this for you when they default a field list; hand-written `runtime.graphql` selections have to get it right. The list-valued media types are deprecated; if a project still has one, it reads as a `[col]_ids` array.\n- **Writing**: `runtime.insert` and `runtime.update` take the id column too \u2014 `{"cover_image_id": 1030\u2026}`, never `{"cover_image": "https://\u2026"}`. A URL in a media column is rejected, and a plausible-looking id you invented points at someone else\'s asset or at nothing.\n- **Getting an id**: an asset does not exist until its bytes have been uploaded, which is a two-step flow \u2014 request a presigned URL (`imagePresignedUrlV2` / `videoPresignedUrlV2` / `filePresignedUrlV2`, keyed by the file\'s Base64 MD5), then HTTP PUT the bytes to it. You can do the first step through `runtime.graphql` but **not the second**: no runtime tool sends raw bytes. Three ways to get a storable id, in order of preference: `web.import_asset` with `mode: RUNTIME`, which does both steps server-side from a public URL and hands back the numeric id; `runtime.query` on `fz_images` / `fz_videos` / `fz_files`, which lists the ids the app already holds; or asking the user. Never fabricate one \u2014 a plausible number points at another project\'s asset or at nothing, and the row looks written until someone opens it.\n- **Which id, though**: a data row stores the id the RUNNING APP holds, which is what those tables list and what `mode: RUNTIME` returns. Editor-side asset ids are a different space \u2014 an id taken from the editor and written into a row, or an app id bound to a component, resolves to nothing and reports no error either way.\n- **Importing at run time is a different problem**: `web.import_asset` runs now, while you are building. An app that has to turn a URL into an asset while it runs needs the **Files** action flow node, which does the same import inside a flow. Build that node into the flow rather than importing the file yourself and writing the id in.\n- `url` is a rendering detail: read it when you want to show or check an asset, and store the id everywhere else.\n\n### What runtime.graphql can reach\n`runtime.graphql` runs against the app\'s own API \u2014 the generated table operations, `fz_invoke_action_flow*`, `fz_action_flow_result`, the ZAI conversation operations, asset upload. The debug operations behind `runtime.debug_flow`, `runtime.run_code` and `zai.debug_chat` live on a separate admin surface those tools reach for you; asking for them through `runtime.graphql` reports the field as undefined. Subscriptions are unavailable from every tool here \u2014 poll the documented query counterpart instead.\n\n### Triggers\nThere is no fire-a-trigger tool, for anyone \u2014 the editor cannot do it either. A database trigger fires when a matching row is really written **and the transaction commits**, so a rollback debug run cannot fire one: the notification the runtime listens for is rolled back with everything else. To exercise a database trigger, write a row with `runtime.insert` or `runtime.update` that matches the trigger\'s table, operation and condition, then read what it did with `runtime.query` and `logs.search`. Your write is recorded so you can report it; the rows the trigger\'s own flow wrote in response are not, so name the trigger as well when you hand the run over. `runtime.status` lists the project\'s triggers with the table and operation each one watches, and a write to a triggered table says so in its confirmation.\n\nA schedule cannot be fired on demand at all. Verify the flow it points at with `runtime.debug_flow`, check the cron expression and end date as configuration, and tell the user the schedule itself is unverified.\n\n### What you leave behind\nNothing you write here can be taken back. There is no undo tool and no cleanup tool: a row from `runtime.insert`, an account from `runtime.as_user`, an overwritten column, a deleted row, and whatever a trigger did in response are all simply in the user\'s app now. That is the reason to reach for a rollback debug run first and to write only the fixtures a check genuinely needs.\n\nWhat you do owe the user is an account of it. Rows you inserted and accounts you created are recorded with their ids, and you are reminded of them as you work \u2014 finish a verification run by saying what you created and in which table, so they can delete it from the data table if they want to. "I added some test data" is not a handover; "I added order#41 and order#42, and account 9931 with role Customer" is.\n\nThe wire protocol for each of these calls \u2014 the query language, filter grammar, aggregations, action-flow and AI invocation, third-party calls and asset upload \u2014 is documented in the `baas-*` capabilities.'},post:{available:!0,prompt:'## Verifying your own work\nThese tools run against the project\'s REAL backend. There is no staging copy, so prefer the primitives that undo themselves and reach for the ones that do not only when the check genuinely requires them.\n\nDraft versus deployed, which is the distinction that decides whether a green result means anything:\n- `runtime.debug_flow` and `runtime.run_code` execute the DRAFT \u2014 what you just edited \u2014 and revert their database writes by default. This is the verification loop.\n- `runtime.invoke_flow` executes the DEPLOYED version with permissions enforced and reverts nothing. A green invoke on a project with pending changes proves nothing about your edits; the result says so when that is the case.\n\nWhat "done" means here:\n- an action flow you built or changed is not done until `runtime.debug_flow` has run it and you have read the terminal node\'s output;\n- a permission change is not done until you have watched the rule act on data whose existence you are sure of. Reading once as a user proves nothing on its own: an empty result means either "the rule hid it" or "there was nothing there", and those need different fixes. Get a second observation, in this order of preference:\n 1. `runtime.login` with credentials the user gives you \u2014 a real account with its real roles, and the only way to test a rule that keys on a named role without permission to edit the project\'s backend. Ask for them; do not guess them.\n 2. `as: "admin"` alongside `as: "<role>"`, if this session has it. `admin` bypasses row and column permissions, so the pair reads as ground-truth-versus-user over data you did not create. Cheapest when it is available, and unavailable to a session that cannot edit the project\'s backend.\nNeither is open to a session with no credentials to hand, so say which rule you could not verify and why instead of reporting it done;\n- the identity tiers are not one axis, and a rule usually keys on which tier you are in rather than on who you are. Read the same data as each tier the rule is supposed to distinguish, and compare: `as: "anonymous"` sends no credential at all \u2014 a logged-out visitor, the only identity carrying the Anonymous User role, and where public data leaks; an account from `runtime.login` is signed in, carrying Logged-in User plus the project\'s own custom roles, which is a different rung and usually a different answer. Signed-out versus signed-in is the pair most often wrong, so run it whenever a rule claims to require a login;\n- if a check cannot be run, say which one and why. Never report work as verified because it looked right.\n\nWhen a run fails, its nodes carry a `traceId`: pass it to `logs.search` as `traceId: "\u2026"` to get the server-side detail.\n\n### Two filter grammars \u2014 do not mix them\nThe operator-first grammar documented above (`{"_eq": {"bigint_operand": {\u2026}}}`) is the RAW shape, for documents you hand-write and send with `runtime.graphql`. The typed tools \u2014 `runtime.query`, `runtime.aggregate`, `runtime.update`, `runtime.delete` \u2014 take the SIMPLIFIED shape instead: `{"column": {"_op": value}}`, e.g. `{"status": {"_eq": "PAID"}}`. Feeding the raw grammar to a typed tool, or the simplified one to a hand-written document, fails validation at the runtime rather than in the tool.\n\n### Names here are API names, never display names\nThe runtime GraphQL schema is generated from **API names** \u2014 `tableName`, every column in a field list, every key in a filter or a `set`. Every editor read gives you both: `database.get_tables_info` returns each column\'s `apiName` AND its `displayName`, and only the `apiName` is valid here. They diverge the moment anyone renames a column in the editor, which is routine and leaves no trace in the runtime, so a name you read in a UI, a page binding or a conversation is the wrong one until you have checked it against `apiName`. A display name sent here comes back as `Field \'<name>\' in type \'<table>\' is undefined`.\n\n### An enum column takes the option NAME\nIn the schema an enum option has an id and a name, and a binding stores the id. The runtime stores and matches the **name**: filter with `{"status": {"_eq": "PAID"}}`, never the `o1`-style option id you would write into a schema binding. Sending the id is rejected with `Invalid option: <id>, available option: \u2026`, which lists the names \u2014 use one of those verbatim.\n\n### Binary assets are ids, on the way in and on the way out\nImages, videos and files live in object storage; a table column holds only the asset id, never a URL or a path. That changes every side of a runtime call:\n- **Reading**: the column is an object in GraphQL, not a scalar, so selecting `cover_image` bare fails with "Subselection required for type \'FZ_Image\'". Ask for `cover_image_id`, or select a subfield \u2014 `cover_image { id url }`. The typed tools do this for you when they default a field list; hand-written `runtime.graphql` selections have to get it right. The list-valued media types are deprecated; if a project still has one, it reads as a `[col]_ids` array.\n- **Writing**: `runtime.insert` and `runtime.update` take the id column too \u2014 `{"cover_image_id": 1030\u2026}`, never `{"cover_image": "https://\u2026"}`. A URL in a media column is rejected, and a plausible-looking id you invented points at someone else\'s asset or at nothing.\n- **Getting an id**: an asset does not exist until its bytes have been uploaded, which is a two-step flow \u2014 request a presigned URL (`imagePresignedUrlV2` / `videoPresignedUrlV2` / `filePresignedUrlV2`, keyed by the file\'s Base64 MD5), then HTTP PUT the bytes to it. You can do the first step through `runtime.graphql` but **not the second**: no runtime tool sends raw bytes. Three ways to get a storable id, in order of preference: `web.import_asset` with `mode: RUNTIME`, which does both steps server-side from a public URL and hands back the numeric id; `runtime.query` on `fz_images` / `fz_videos` / `fz_files`, which lists the ids the app already holds; or asking the user. Never fabricate one \u2014 a plausible number points at another project\'s asset or at nothing, and the row looks written until someone opens it.\n- **Which id, though**: a data row stores the id the RUNNING APP holds, which is what those tables list and what `mode: RUNTIME` returns. Editor-side asset ids are a different space \u2014 an id taken from the editor and written into a row, or an app id bound to a component, resolves to nothing and reports no error either way.\n- **Importing at run time is a different problem**: `web.import_asset` runs now, while you are building. An app that has to turn a URL into an asset while it runs needs the **Files** action flow node, which does the same import inside a flow. Build that node into the flow rather than importing the file yourself and writing the id in.\n- `url` is a rendering detail: read it when you want to show or check an asset, and store the id everywhere else.\n\n### What runtime.graphql can reach\n`runtime.graphql` runs against the app\'s own API \u2014 the generated table operations, `fz_invoke_action_flow*`, `fz_action_flow_result`, the ZAI conversation operations, asset upload. The debug operations behind `runtime.debug_flow`, `runtime.run_code` and `zai.debug_chat` live on a separate admin surface those tools reach for you; asking for them through `runtime.graphql` reports the field as undefined. Subscriptions are unavailable from every tool here \u2014 poll the documented query counterpart instead.\n\n### Triggers\nThere is no fire-a-trigger tool, for anyone \u2014 the editor cannot do it either. A database trigger fires when a matching row is really written **and the transaction commits**, so a rollback debug run cannot fire one: the notification the runtime listens for is rolled back with everything else. To exercise a database trigger, write a row with `runtime.insert` or `runtime.update` that matches the trigger\'s table, operation and condition, then read what it did with `runtime.query` and `logs.search`. Your write is recorded so you can report it; the rows the trigger\'s own flow wrote in response are not, so name the trigger as well when you hand the run over. `runtime.status` lists the project\'s triggers with the table and operation each one watches, and a write to a triggered table says so in its confirmation.\n\nA schedule cannot be fired on demand at all. Verify the flow it points at with `runtime.debug_flow`, check the cron expression and end date as configuration, and tell the user the schedule itself is unverified.\n\n### What you leave behind\nNothing you write here can be taken back. There is no undo tool and no cleanup tool: a row from `runtime.insert`, an account from `runtime.as_user`, an overwritten column, a deleted row, and whatever a trigger did in response are all simply in the user\'s app now. That is the reason to reach for a rollback debug run first and to write only the fixtures a check genuinely needs.\n\nWhat you do owe the user is an account of it. Rows you inserted and accounts you created are recorded with their ids, and you are reminded of them as you work \u2014 finish a verification run by saying what you created and in which table, so they can delete it from the data table if they want to. "I added some test data" is not a handover; "I added order#41 and order#42, and account 9931 with role Customer" is.\n\nThe wire protocol for each of these calls \u2014 the query language, filter grammar, aggregations, action-flow and AI invocation, third-party calls and asset upload \u2014 is documented in the `baas-*` capabilities.'}},secret:{pre:{available:!0,prompt:`## Secret Domain Knowledge
|
|
664
|
+
Both are read-only; neither mutates the schema.`}},payments:{pre:{available:!0,prompt:"## Payment System Domain Knowledge\nZion's payment system is built around a developer-owned **order table** plus a set of platform-managed payment records and **auto-generated Actionflows** that react to gateway callbacks. On Zion the gateways are WeChat Pay (mini-program and H5/JSAPI) and Alipay (PC web; one-time plus recurring \"agreement\" subscriptions). Enabling and configuring payments splits in two: you activate the module with ACTIVATE_PAYMENT; the gateway credentials, the brand assets and the Pro-plan upgrade are the user's own, in the editor (Settings \u2192 Payment).\n\n### Prerequisites (in order)\n1. The user upgrades the project to the Pro plan or higher (payments are gated by plan; an expired plan breaks live payments and blocks publishing).\n2. Create the **order table** (see below) with its required fields.\n3. Call ACTIVATE_PAYMENT with the order table's display name. Read `overview.project` first \u2014 it reports whether payments are already enabled and which types are active, and the order table is fixed by the first activation and ignored afterwards. The call appends the type's generated flows/callbacks/jobs and grants the logged-in user role permission to pay with it; a first activation also inserts the payment tables, which every role then carries in its table permissions though only the logged-in user role can read them. It names what it created; say so in your answer, since in AUTO_ACCEPT the user was not asked.\n4. Configure the gateway credentials \u2014 WeChat Pay (merchant ID, APIv2 key, the linked Mini Program AppID, plus the apiclient_cert.p12 for refunds) and/or Alipay (app ID and an RSA2 key pair) and/or Airwallex (client ID, API key and webhook secret) \u2014 plus brand name, logo, slogan.\n5. Confirm the auto-generated payment/refund callback flows are wired.\n\n### The Order Table (you design this \u2014 follow database conventions)\nThe order table is a normal business table you create; the payment engine references one of its rows by its primary-key id (the `orderId` everywhere below). At minimum it needs:\n- an **amount/price** column \u2014 type `DECIMAL`, the authoritative price computed server-side.\n- a **status** column \u2014 model it as a `TEXT` column holding the lifecycle value (e.g.\n `pending`, `paid`, `cancelled`, `refunded`); your fulfillment flow updates it. Custom\n enums are unavailable in this project, so use TEXT here.\n- a **buyer link** \u2014 do NOT add a raw `user_id`/`account_id` column. Create a 1:n RELATION from `account` to the order table so the buyer FK is generated automatically (the same manual-foreign-key rule the database plugin enforces). Add product/quantity links as relations too. Naming follows the usual rules: `snake_case` system names, no manual `id`/`created_at` columns (the runner mints the PK).\n\n**Irreversibility warning:** once the order table is linked to the payment module it CANNOT be unlinked, replaced, or deleted. Always confirm the table design with the user and warn them of this before they bind it. Choose the table deliberately.\n\n### Platform-Managed Tables (do NOT create or model these)\nEnabling payments auto-creates three system tables \u2014 never recreate them as user tables and never write to them directly:\n- the **payment** table (`fz_payment` / `fz_payment_record`, 1:N from the order table) \u2014 one row per payment attempt, carrying `orderId`, `accountId`, `type`, `status`, `currency`, `grandTotalValue`, `transactionId`.\n- the **recurring_payment** table \u2014 Alipay agreement subscriptions and their billing cycle.\n- the **refund** table (1:N from payment) \u2014 refund transactions. The internal payment `status` is a fixed lifecycle enum: `PENDING`, `CANCELLED`, `SUCCESSFUL`, `FAILED`, `PARTIALLY_REFUNDED`, `REFUNDING`, `REFUNDED`. Your order table's own status column is separate from this \u2014 your fulfillment flow translates one into the other.\n\n### Auto-Created Callback Actionflows (WeChat Pay / Alipay)\nEnabling payments auto-generates the backend callback Actionflows the editor wires to each payment action. They have no fixed English name (they are the \"preset\" flows for the channel you enabled); don't delete or rename them. You edit their bodies to run business logic:\n- the **payment** flow \u2014 triggered automatically after a charge resolves.\n- the **refund** flow \u2014 triggered automatically after a refund resolves.\n- the Alipay **recurring-deduction** flow \u2014 a daily scheduled loop that charges due agreements.\n\n### Editing the payment flow (the one you almost always modify)\nThe flow has a built-in \"parse payment result\" code block that outputs four values:\n- `orderId` \u2014 the order-table row you passed to the payment action; use it to find and update the order.\n- `paymentFound` \u2014 whether a matching payment record was found.\n- `paymentStatus` \u2014 `SUCCESSFUL` or `FAILED`.\n- `alreadyProcessed` \u2014 boolean; `false` on the first trigger, `true` on a re-delivery. **Idempotency contract (critical):** the same payment can trigger the flow more than once. Only run fulfillment / mark the order paid when `paymentFound` is true, `paymentStatus` is the expected value, AND `alreadyProcessed == false`. Guard the fulfillment branch with Condition nodes on these, otherwise duplicate callbacks double-fulfill (double-ship, double-credit). For safety, also add a branch that re-checks the actual paid amount against the order's amount before fulfilling. The refund flow works the same way: its parser returns `orderId`, `refundFound`, `paymentStatus` (`REFUNDED` or `FAILED`), and `alreadyProcessed`.\n\n### Creating an Order (the secure-transaction pattern)\nNever let the client decide the price. Order creation must run server-side:\n1. Frontend triggers a backend Actionflow passing only identifiers (e.g. `product_id`, quantity) \u2014 never the price.\n2. The flow queries the product/price server-side, computes the authoritative amount, inserts a new order row with status `pending`, and returns the generated `orderId` and verified amount.\n3. The frontend maps the *returned* `orderId` and amount into the WeChat Pay / Alipay / Airwallex payment action. This is the Zero-Trust pattern: the price the customer is charged is the one the server computed and stored on the order, not anything the browser sent.\n\n### Amounts & Currency\nThe WeChat Pay and Alipay payment actions take the amount in **yuan (\u5143) as a `DECIMAL` with at most two decimal places, and it must be greater than 0.01** \u2014 pass the order's server-computed price directly; do NOT convert to cents/\u5206.\n\n### Airwallex (only where enabled for the project)\nAirwallex is activated like any other type and takes both one-time payments and subscriptions. It generates two backend Actionflows; don't delete or rename them:\n1. **Airwallex Payment** \u2014 receives every Airwallex webhook as `fz_payment_callback_input` and branches on the event type: payment status changed (`payment_intent.succeeded` / `payment_intent.cancelled`), refund (`refund.accepted` / `refund.failed`), subscription status changes, and `invoice.finalized`. In the payment branch the built-in \"Sync payment status\" block outputs `orderId`, `paymentStatus` (`SUCCESSFUL` or `CANCELLED`) and `alreadyProcessed`; in the refund branch \"Sync refund status\" outputs `orderId`, `status` (`REFUNDED` or `FAILED`) and `alreadyProcessed`. Put fulfillment after those blocks under the same idempotency contract: act only on the expected status AND `alreadyProcessed == false`.\n2. **Airwallex Subscription Renewal** \u2014 called by Airwallex Payment with the invoice id to create the order and payment for a subscription renewal.\nAirwallex amounts are decimals in the currency's major unit (10.00, not 1000): pass the order's server-computed decimal price directly.\n\n### Recurring Payments (Alipay)\nAlipay supports subscriptions via a signed agreement. The start action takes `orderId`, a price (Alipay caps recurring amounts at \xA5100), a product name, a deduction interval (\u2265 7 days), and an Alipay scene code (a user can subscribe to the same scene only once); the cancel action takes the recurring-payment row id. Deductions run in the auto-generated daily loop flow: for each due agreement you must create a NEW order inside the loop and bind its id to the deduction node's `orderId` input. Note: a full Alipay refund does not re-trigger the payment flow.\n\n### Scope Note\nACTIVATE_PAYMENT turns the module on one type at a time, and the actionflow plugin edits the generated flows' bodies. What you cannot do is the user's own editor work (Settings \u2192 Payment): the gateway credentials, the brand assets and the plan upgrade. Design the order table first (via the database plugin), then activate, then wire the secure order-creation flow and add the `alreadyProcessed` idempotency guard in the payment flow."},post:{available:!0,prompt:"## Payment System Domain Knowledge\nZion's payment system is built around a developer-owned **order table** plus a set of platform-managed payment records and **auto-generated Actionflows** that react to gateway callbacks. On Zion the gateways are WeChat Pay (mini-program and H5/JSAPI) and Alipay (PC web; one-time plus recurring \"agreement\" subscriptions). Enabling and configuring payments splits in two: you activate the module with ACTIVATE_PAYMENT; the gateway credentials, the brand assets and the Pro-plan upgrade are the user's own, in the editor (Action \u2192 Payment).\n\n### Prerequisites (in order)\n1. The user upgrades the project to the Pro plan or higher (payments are gated by plan; an expired plan breaks live payments and blocks publishing).\n2. Create the **order table** (see below) with its required fields.\n3. Call ACTIVATE_PAYMENT with the order table's display name. Read `overview.project` first \u2014 it reports whether payments are already enabled and which types are active, and the order table is fixed by the first activation and ignored afterwards. The call appends the type's generated flows/callbacks/jobs and grants the logged-in user role permission to pay with it; a first activation also inserts the payment tables, which every role then carries in its table permissions though only the logged-in user role can read them. It names what it created; say so in your answer, since in AUTO_ACCEPT the user was not asked.\n4. Configure the gateway credentials \u2014 WeChat Pay (merchant ID, APIv2 key, the linked Mini Program AppID, plus the apiclient_cert.p12 for refunds) and/or Alipay (app ID and an RSA2 key pair) and/or Airwallex (client ID, API key and webhook secret) \u2014 plus brand name, logo, slogan.\n5. Confirm the auto-generated payment/refund callback flows are wired.\n\n### The Order Table (you design this \u2014 follow database conventions)\nThe order table is a normal business table you create; the payment engine references one of its rows by its primary-key id (the `orderId` everywhere below). At minimum it needs:\n- an **amount/price** column \u2014 type `s:p:decimal`, the authoritative price computed server-side.\n- a **status** column \u2014 create a custom enum whose options mirror the payment lifecycle\n (e.g. `pending`, `paid`, `cancelled`, `refunded`), then use the exact\n `u:e:<enumId>` returned by the type plugin as the column type; your fulfillment flow\n updates it.\n- a **buyer link** \u2014 do NOT add a raw `user_id`/`account_id` column. Create a 1:n RELATION from `account` to the order table so the buyer FK is generated automatically (the same manual-foreign-key rule the database plugin enforces). Add product/quantity links as relations too. Naming follows the usual rules: `snake_case` system names, no manual `id`/`created_at` columns (the runner mints the PK).\n\n**Irreversibility warning:** once the order table is linked to the payment module it CANNOT be unlinked, replaced, or deleted. Always confirm the table design with the user and warn them of this before they bind it. Choose the table deliberately.\n\n### Platform-Managed Tables (do NOT create or model these)\nEnabling payments auto-creates three system tables \u2014 never recreate them as user tables and never write to them directly:\n- the **payment** table (`fz_payment` / `fz_payment_record`, 1:N from the order table) \u2014 one row per payment attempt, carrying `orderId`, `accountId`, `type`, `status`, `currency`, `grandTotalValue`, `transactionId`.\n- the **recurring_payment** table \u2014 Alipay agreement subscriptions and their billing cycle.\n- the **refund** table (1:N from payment) \u2014 refund transactions. The internal payment `status` is a fixed lifecycle enum: `PENDING`, `CANCELLED`, `SUCCESSFUL`, `FAILED`, `PARTIALLY_REFUNDED`, `REFUNDING`, `REFUNDED`. Your order table's own status column is separate from this \u2014 your fulfillment flow translates one into the other.\n\n### Auto-Created Callback Actionflows (WeChat Pay / Alipay)\nEnabling payments auto-generates the backend callback Actionflows the editor wires to each payment action. They have no fixed English name (they are the \"preset\" flows for the channel you enabled); don't delete or rename them. You edit their bodies to run business logic:\n- the **payment** flow \u2014 triggered automatically after a charge resolves.\n- the **refund** flow \u2014 triggered automatically after a refund resolves.\n- the Alipay **recurring-deduction** flow \u2014 a daily scheduled loop that charges due agreements.\n\n### Editing the payment flow (the one you almost always modify)\nThe flow has a built-in \"parse payment result\" code block that outputs four values:\n- `orderId` \u2014 the order-table row you passed to the payment action; use it to find and update the order.\n- `paymentFound` \u2014 whether a matching payment record was found.\n- `paymentStatus` \u2014 `SUCCESSFUL` or `FAILED`.\n- `alreadyProcessed` \u2014 boolean; `false` on the first trigger, `true` on a re-delivery. **Idempotency contract (critical):** the same payment can trigger the flow more than once. Only run fulfillment / mark the order paid when `paymentFound` is true, `paymentStatus` is the expected value, AND `alreadyProcessed == false`. Guard the fulfillment branch with Condition nodes on these, otherwise duplicate callbacks double-fulfill (double-ship, double-credit). For safety, also add a branch that re-checks the actual paid amount against the order's amount before fulfilling. The refund flow works the same way: its parser returns `orderId`, `refundFound`, `paymentStatus` (`REFUNDED` or `FAILED`), and `alreadyProcessed`.\n\n### Creating an Order (the secure-transaction pattern)\nNever let the client decide the price. Order creation must run server-side:\n1. Frontend triggers a backend Actionflow passing only identifiers (e.g. `product_id`, quantity) \u2014 never the price.\n2. The flow queries the product/price server-side, computes the authoritative amount, inserts a new order row with status `pending`, and returns the generated `orderId` and verified amount.\n3. The frontend maps the *returned* `orderId` and amount into the WeChat Pay / Alipay / Airwallex payment action. This is the Zero-Trust pattern: the price the customer is charged is the one the server computed and stored on the order, not anything the browser sent.\n\n### Amounts & Currency\nThe WeChat Pay and Alipay payment actions take the amount in **yuan (\u5143) as a `s:p:decimal` with at most two decimal places, and it must be greater than 0.01** \u2014 pass the order's server-computed price directly; do NOT convert to cents/\u5206.\n\n### Airwallex (only where enabled for the project)\nAirwallex is activated like any other type and takes both one-time payments and subscriptions. It generates two backend Actionflows; don't delete or rename them:\n1. **Airwallex Payment** \u2014 receives every Airwallex webhook as `fz_payment_callback_input` and branches on the event type: payment status changed (`payment_intent.succeeded` / `payment_intent.cancelled`), refund (`refund.accepted` / `refund.failed`), subscription status changes, and `invoice.finalized`. In the payment branch the built-in \"Sync payment status\" block outputs `orderId`, `paymentStatus` (`SUCCESSFUL` or `CANCELLED`) and `alreadyProcessed`; in the refund branch \"Sync refund status\" outputs `orderId`, `status` (`REFUNDED` or `FAILED`) and `alreadyProcessed`. Put fulfillment after those blocks under the same idempotency contract: act only on the expected status AND `alreadyProcessed == false`.\n2. **Airwallex Subscription Renewal** \u2014 called by Airwallex Payment with the invoice id to create the order and payment for a subscription renewal.\nAirwallex amounts are decimals in the currency's major unit (10.00, not 1000): pass the order's server-computed decimal price directly.\n\n### Recurring Payments (Alipay)\nAlipay supports subscriptions via a signed agreement. The start action takes `orderId`, a price (Alipay caps recurring amounts at \xA5100), a product name, a deduction interval (\u2265 7 days), and an Alipay scene code (a user can subscribe to the same scene only once); the cancel action takes the recurring-payment row id. Deductions run in the auto-generated daily loop flow: for each due agreement you must create a NEW order inside the loop and bind its id to the deduction node's `orderId` input. Note: a full Alipay refund does not re-trigger the payment flow.\n\n### Scope Note\nACTIVATE_PAYMENT turns the module on one type at a time, and the actionflow plugin edits the generated flows' bodies. What you cannot do is the user's own editor work (Action \u2192 Payment): the gateway credentials, the brand assets and the plan upgrade. Design the order table first (via the database plugin), then activate, then wire the secure order-creation flow and add the `alreadyProcessed` idempotency guard in the payment flow."}},permissions:{pre:{available:!0,prompt:'## Permission System Domain Knowledge\nZion secures data and actions with RBAC (roles) plus ABAC (per-row conditions). Every tool in this plugin edits the project schema only \u2014 the change reaches the deployed backend when "Sync Backend" runs, which is the last step of any permission task.\n\n### Model\n- **Role**: a named collection of users. Two are predefined and cannot be renamed or deleted: **Logged-in User** (held by every authenticated user) and **Anonymous User** (unauthenticated requests). Custom roles can then be created, renamed, and deleted, up to the project\'s role limit \u2014 but **`Admin` is a reserved name**: a role is treated as system-defined by *name*, so one created or renamed to `Admin` could never be renamed or deleted again. Both tools refuse it; pick another name.\n- **Data Permission**: what a role may read or write, at table, column and row level.\n- **Action Permission**: which Third-Party API configurations, Actionflows, AI agents and payment operations a role may invoke.\n- Each action block is allow-all or an explicit allow-list. On top of those grants, per-target conditional checks are available for Actionflows and AI agents; payments take allow-all or a payment-type/billing-method map.\n- **Roles only ever add.** A user\'s effective permissions are the union of every role they hold; a restrictive role never subtracts what a permissive one granted. To take access away, narrow or unassign the permissive role \u2014 never "add a limited role".\n\n### Activate first\nRole names come from `GET_PROJECT_OVERVIEW`\'s `roles` section, which also reports whether role permission is activated; `GET_ALL_ROLES_INFO` is the fallback when you have not run it. When either reports that role permission is not activated:\n- In BUILD or AUTO_ACCEPT mode, you MUST immediately call `ACTIVATE_ROLE_PERMISSION`, which seeds the predefined roles. BUILD uses the normal user-confirmation gate; AUTO_ACCEPT applies it immediately.\n- In RESEARCH mode, do not attempt a mutation; tell the user to look into permissions in \u8BBE\u7F6E \u2192 \u6743\u9650\u7BA1\u7406.\n\n### Grant\nData permissions are configured coarse \u2192 fine:\n1. **Table**: which operations (select / insert / update / delete / count / aggregate) the role may run.\n2. **Column**: which fields each operation covers.\n3. **Row**: a per-operation condition \u2014 a filter over existing rows for select, update and delete, a check on the incoming row for insert. Each one starts always-true, so a fresh grant is open until narrowed.\n\nRead before writing: `GET_ROLE_DETAIL`, naming every role the task will edit; the role names are already in `GET_PROJECT_OVERVIEW`. It reports each table by exception \u2014 the operations granted, the ones under `rowConditions` whose row condition has been narrowed, and `restrictedColumns` only where a grant covers less than the whole table, so an operation listed as granted and mentioned nowhere else is open on every column and every row. Tables the role cannot touch at all are named together in `tablesWithNoGrants`. Pass `blocks` when the task is about one block (the table block is nearly the whole payload). It does not carry the row conditions\' schema paths \u2014 when you are narrowing one, read `GET_TABLE_PERMISSION` instead: it names the tables you are about to change, reports each operation\'s condition path, and satisfies the same gate, so the path arrives in the call right before the one that uses it. Edit with `ADD_ROLES`, `UPDATE_ROLE`, `DELETE_ROLES` and the per-block setters `UPDATE_ROLE_TABLE_PERMISSION`, `UPDATE_ROLE_ACTION_FLOW_PERMISSION`, `UPDATE_ROLE_ZAI_PERMISSION`, `UPDATE_ROLE_PAYMENT_PERMISSION`, `UPDATE_ROLE_TPA_PERMISSION` for Third-Party API configurations. Account insert/delete is unavailable, and `id` is pinned into every table SELECT grant.\n\n`allowAll` on `tpaPermission`, `actionflowPermission` or `zAiPermission` also covers resources added later \u2014 prefer explicit allow-lists unless broad access is intentional.\n\n**Role, or a field on Account?** Use a role for static functional boundaries: who may run a flow, read a table, see a column. Add a field on the Account table for per-user state: VIP status, nickname, bio.\n\n**Never create one role per group.** For departments, stores, tenants or any other segmentation, use the relation-first pattern: create a `1:n` relation from the context table (e.g. `department`) to `Account`, and a second one from that same table to the business table (e.g. `sales_record`). Both foreign-key columns are generated and non-editable \u2014 never declare them as raw integer fields. Then define one generic role (`Sales_Staff`) and compare those two columns in its row conditions.\n\nSimple single-table CRUD may run directly from the frontend when table, column, and row permissions fully express the authorization policy \u2014 do not wrap it in an Actionflow. Reach for a Backend Actionflow only when the rule cannot be expressed that way at all: it needs server-held secrets, cross-table atomicity, or multi-step state transitions.\n\n### Row conditions (ABAC)\nNarrowing those conditions is a two-plugin job: this plugin has no tool that edits one \u2014 they live in the **bindings** area, whose tools are the `INSERT_CONDITION_BOOL_EXP` family, addressed by the condition path `GET_TABLE_PERMISSION` reports. The check `SET_ROLE_PERMISSION_CHECK` seeds for an Actionflow or AI agent works the same way.\n\nNever hand-build a permission schema path. It embeds the role\'s index in the schema and the table\'s internal id, neither of which any read reports on its own, so a path assembled from what a read did show resolves to nothing \u2014 copy the one a read returned.\n\nEach operation has its own condition node and its own row branch to compare against, so reusing the select recipe on another op fails:\n- `select` \u2192 path ends `/select/filter` \u2192 the branch holding the row being read\n- `insert` \u2192 path ends `/insert/check`, not `filter` \u2192 the branch holding the row being inserted\n- `update` \u2192 path ends `/update/filter` \u2192 the branch holding the row as stored, or the one holding the incoming values\n- `delete` \u2192 path ends `/delete/filter` \u2192 the branch holding the row being deleted\n- `count` / `aggregate` \u2192 no row branch exists, only the logged-in user and the current time, so they cannot be row-scoped. Whenever you narrow `select`, send `count` and `aggregate` `{enabled: false}` too, unless a whole-table count is meant to be public: a row-scoped `select` beside an open `count` still tells any user how many rows everyone else has.\n\nNarrowing one condition:\n1. `GET_TABLE_PERMISSION` for that table (or the result of `UPDATE_ROLE_TABLE_PERMISSION`, which reports the same paths for the grants it just made, or of `SET_ROLE_PERMISSION_CHECK` for a flow/agent check) \u2192 that operation\'s condition schema path. `GET_ROLE_DETAIL` does not carry them.\n2. `INSERT_CONDITION_BOOL_EXP` at that path \u2192 returns a `conditionSchemaPath`. Copy it verbatim; never hand-build one.\n3. `GET_EXPRESSION_CONDITION_OPERATORS` at that path, then `UPDATE_EXPRESSION_CONDITION_OPERATOR` with an operator copied verbatim. The `target` and `value` operand slots do not exist until the operator is set \u2014 binding first fails with "has no binding site at \u2026/target".\n4. Fill both operands at `<conditionSchemaPath>/target` and `<conditionSchemaPath>/value`, addressed by `pathInHierarchicalMenu`. Read that path \u2014 branch label included \u2014 from `BROWSE_DATA_BINDING_OPTIONS` at the operand\'s own schema path and copy it verbatim; never hand-build one. Relations traverse, so a child table can compare against its parent\'s owner \u2014 that path is four segments deep: context root, row branch, relation, column. Every segment is a label from the tree, including the root.\n5. Delete the always-true placeholder the grant started with: `DELETE_CONDITION_BOOL_EXP` at `<step 1\'s condition schema path>/_and/[0]` \u2014 the filter\'s own path, not the comparison path step 2 returned. Harmless at runtime, but the editor renders it as an empty condition row, so the user sees a half-configured rule.\n6. Shape multi-clause predicates with `NEST_CONDITION_BOOL_EXP`, `TOGGLE_CONDITION_BOOL_EXP_AND_OR`, `TOGGLE_CONDITION_BOOL_EXP_NOT`.\n7. Sync Backend.\n\nExample \u2014 "a staff member only ever touches their own department\'s sales records" \u2014 after granting `Sales_Staff` select, insert, update and delete on `sales_record`, configure four conditions, each comparing that operation\'s own row branch `department_id` against the logged-in user\'s `department_id`. Configuring only select leaves the writes unrestricted.\n\nA batch of tool calls is all-or-nothing: one bad call discards every change in that batch. Send exploratory reads on their own \u2014 especially the first `BROWSE_DATA_BINDING_OPTIONS` for an operation whose context branch you have not seen \u2014 then batch the writes.\n\n### Assign the role\nA custom role does nothing until an account holds it. Two ways:\n- Manual: assign in the editor, under \u8BBE\u7F6E \u2192 \u6743\u9650\u7BA1\u7406.\n- Automatic: the Permissions node inside an Actionflow (e.g. grant VIP after purchase). These grants and revocations take effect immediately \u2014 no backend sync required.\n\n### Definition of done\nA permission task is finished only when all of these hold. Check them before reporting:\n1. Every operation you enabled is listed under its table\'s `rowConditions` in `GET_ROLE_DETAIL`, or is deliberately open.\n2. `GET_ROLE_DETAIL` on **Anonymous User** *and* **Logged-in User** shows no unintended grant on the tables you touched. A newly created table lands in every role automatically, with select, insert, update, delete, count and aggregate all granted and unconditioned \u2014 the two predefined roles included. Observed on a deployed project: an unauthenticated request could read every row, and after only SELECT was revoked it could still INSERT. Checking Anonymous User alone leaves every logged-in user holding the same open grant.\n3. Any custom role you created is actually assigned to someone.\n4. "Sync Backend" has run.\nIf you stop short of any of these, say so explicitly and name which grants are still open. Never report the permission work as complete.\n\n### Troubleshooting 403\n403s surface in runtime logs and client responses:\n```json\n{\n "errorCode": 403,\n "extensions": { "classification": "TABLE_ACCESS" },\n "message": "User 1 has no permission for SELECT on order"\n}\n```\n"User 1" is the user whose internal id ends in 1 (1000000000000001). Then:\n1. Confirm the user holds the role you expect.\n2. Read that role with `GET_TABLE_PERMISSION` on the table the 403 names: is the operation enabled, is the column inside its grant, and does its row condition match the row the user expected?\n3. Confirm "Sync Backend" ran after the last permission change.'},post:{available:!0,prompt:'## Permission System Domain Knowledge\nZion secures data and actions with RBAC (roles) plus ABAC (per-row conditions). Every tool in this plugin edits the project schema only \u2014 the change reaches the deployed backend when "Sync Backend" runs, which is the last step of any permission task.\n\n### Model\n- **Role**: a named collection of users. Two are predefined and cannot be renamed or deleted: **Logged-in User** (held by every authenticated user) and **Anonymous User** (unauthenticated requests). Custom roles can then be created, renamed, and deleted, up to the project\'s role limit \u2014 but **`Admin` is a reserved name**: a role is treated as system-defined by *name*, so one created or renamed to `Admin` could never be renamed or deleted again. Both tools refuse it; pick another name.\n- **Data Permission**: what a role may read or write, at table, column and row level.\n- **Action Permission**: which workspace HTTP APIs, Actionflows, AI agents and payment operations a role may invoke.\n- Each action block is allow-all or an explicit allow-list. On top of those grants, per-target conditional checks are available for Actionflows and AI agents; payments take allow-all or a payment-type/billing-method map.\n- **Roles only ever add.** A user\'s effective permissions are the union of every role they hold; a restrictive role never subtracts what a permissive one granted. To take access away, narrow or unassign the permissive role \u2014 never "add a limited role".\n\n### Activate first\nRole names come from `GET_PROJECT_OVERVIEW`\'s `roles` section, which also reports whether role permission is activated; `GET_ALL_ROLES_INFO` is the fallback when you have not run it. When either reports that role permission is not activated:\n- In BUILD or AUTO_ACCEPT mode, you MUST immediately call `ACTIVATE_ROLE_PERMISSION`, which seeds the predefined roles. BUILD uses the normal user-confirmation gate; AUTO_ACCEPT applies it immediately.\n- In RESEARCH mode, do not attempt a mutation; tell the user to look into permissions in \u8BBE\u7F6E \u2192 \u6743\u9650\u7BA1\u7406.\n\n### Grant\nData permissions are configured coarse \u2192 fine:\n1. **Table**: which operations (select / insert / update / delete / count / aggregate) the role may run.\n2. **Column**: which fields each operation covers.\n3. **Row**: a per-operation condition \u2014 a filter over existing rows for select, update and delete, a check on the incoming row for insert. Each one starts always-true, so a fresh grant is open until narrowed.\n\nRead before writing: `GET_ROLE_DETAIL`, naming every role the task will edit; the role names are already in `GET_PROJECT_OVERVIEW`. It reports each table by exception \u2014 the operations granted, the ones under `rowConditions` whose row condition has been narrowed, and `restrictedColumns` only where a grant covers less than the whole table, so an operation listed as granted and mentioned nowhere else is open on every column and every row. Tables the role cannot touch at all are named together in `tablesWithNoGrants`. Pass `blocks` when the task is about one block (the table block is nearly the whole payload). It does not carry the row conditions\' schema paths \u2014 when you are narrowing one, read `GET_TABLE_PERMISSION` instead: it names the tables you are about to change, reports each operation\'s condition path, and satisfies the same gate, so the path arrives in the call right before the one that uses it. Edit with `ADD_ROLES`, `UPDATE_ROLE`, `DELETE_ROLES` and the per-block setters `UPDATE_ROLE_TABLE_PERMISSION`, `UPDATE_ROLE_ACTION_FLOW_PERMISSION`, `UPDATE_ROLE_ZAI_PERMISSION`, `UPDATE_ROLE_PAYMENT_PERMISSION`, `UPDATE_ROLE_API_PERMISSION` for workspace HTTP APIs. Account insert/delete is unavailable, and `id` is pinned into every table SELECT grant.\n\n`allowAll` on `apiPermission`, `actionflowPermission` or `zAiPermission` also covers resources added later \u2014 prefer explicit allow-lists unless broad access is intentional.\n\n**Role, or a field on Account?** Use a role for static functional boundaries: who may run a flow, read a table, see a column. Add a field on the Account table for per-user state: VIP status, nickname, bio.\n\n**Never create one role per group.** For departments, stores, tenants or any other segmentation, use the relation-first pattern: create a `1:n` relation from the context table (e.g. `department`) to `Account`, and a second one from that same table to the business table (e.g. `sales_record`). Both foreign-key columns are generated and non-editable \u2014 never declare them as raw integer fields. Then define one generic role (`Sales_Staff`) and compare those two columns in its row conditions.\n\nSimple single-table CRUD may run directly from the frontend when table, column, and row permissions fully express the authorization policy \u2014 do not wrap it in an Actionflow. Reach for a Backend Actionflow only when the rule cannot be expressed that way at all: it needs server-held secrets, cross-table atomicity, or multi-step state transitions.\n\n### Row conditions (ABAC)\nNarrowing those conditions is a two-plugin job: this plugin has no tool that edits one \u2014 they live in the **bindings** area, whose tools are the `INSERT_CONDITION_BOOL_EXP` family, addressed by the condition path `GET_TABLE_PERMISSION` reports. The check `SET_ROLE_PERMISSION_CHECK` seeds for an Actionflow or AI agent works the same way.\n\nNever hand-build a permission schema path. It embeds the role\'s index in the schema and the table\'s internal id, neither of which any read reports on its own, so a path assembled from what a read did show resolves to nothing \u2014 copy the one a read returned.\n\nEach operation has its own condition node and its own row branch to compare against, so reusing the select recipe on another op fails:\n- `select` \u2192 path ends `/select/filter` \u2192 the branch holding the row being read\n- `insert` \u2192 path ends `/insert/check`, not `filter` \u2192 the branch holding the row being inserted\n- `update` \u2192 path ends `/update/filter` \u2192 the branch holding the row as stored, or the one holding the incoming values\n- `delete` \u2192 path ends `/delete/filter` \u2192 the branch holding the row being deleted\n- `count` / `aggregate` \u2192 no row branch exists, only the logged-in user and the current time, so they cannot be row-scoped. Whenever you narrow `select`, send `count` and `aggregate` `{enabled: false}` too, unless a whole-table count is meant to be public: a row-scoped `select` beside an open `count` still tells any user how many rows everyone else has.\n\nNarrowing one condition:\n1. `GET_TABLE_PERMISSION` for that table (or the result of `UPDATE_ROLE_TABLE_PERMISSION`, which reports the same paths for the grants it just made, or of `SET_ROLE_PERMISSION_CHECK` for a flow/agent check) \u2192 that operation\'s condition schema path. `GET_ROLE_DETAIL` does not carry them.\n2. `INSERT_CONDITION_BOOL_EXP` at that path \u2192 returns a `conditionSchemaPath`. Copy it verbatim; never hand-build one.\n3. `GET_EXPRESSION_CONDITION_OPERATORS` at that path, then `UPDATE_EXPRESSION_CONDITION_OPERATOR` with an operator copied verbatim. The `target` and `value` operand slots do not exist until the operator is set \u2014 binding first fails with "has no binding site at \u2026/target".\n4. Fill both operands at `<conditionSchemaPath>/target` and `<conditionSchemaPath>/value`, addressed by `pathInHierarchicalMenu`. Read that path \u2014 branch label included \u2014 from `BROWSE_DATA_BINDING_OPTIONS` at the operand\'s own schema path and copy it verbatim; never hand-build one. Relations traverse, so a child table can compare against its parent\'s owner \u2014 that path is four segments deep: context root, row branch, relation, column. Every segment is a label from the tree, including the root.\n5. Delete the always-true placeholder the grant started with: `DELETE_CONDITION_BOOL_EXP` at `<step 1\'s condition schema path>/_and/[0]` \u2014 the filter\'s own path, not the comparison path step 2 returned. Harmless at runtime, but the editor renders it as an empty condition row, so the user sees a half-configured rule.\n6. Shape multi-clause predicates with `NEST_CONDITION_BOOL_EXP`, `TOGGLE_CONDITION_BOOL_EXP_AND_OR`, `TOGGLE_CONDITION_BOOL_EXP_NOT`.\n7. Sync Backend.\n\nExample \u2014 "a staff member only ever touches their own department\'s sales records" \u2014 after granting `Sales_Staff` select, insert, update and delete on `sales_record`, configure four conditions, each comparing that operation\'s own row branch `department_id` against the logged-in user\'s `department_id`. Configuring only select leaves the writes unrestricted.\n\nA batch of tool calls is all-or-nothing: one bad call discards every change in that batch. Send exploratory reads on their own \u2014 especially the first `BROWSE_DATA_BINDING_OPTIONS` for an operation whose context branch you have not seen \u2014 then batch the writes.\n\n### Assign the role\nA custom role does nothing until an account holds it. Two ways:\n- Manual: assign in the editor, under \u8BBE\u7F6E \u2192 \u6743\u9650\u7BA1\u7406.\n- Automatic: the Permissions node inside an Actionflow (e.g. grant VIP after purchase). These grants and revocations take effect immediately \u2014 no backend sync required.\n\n### Definition of done\nA permission task is finished only when all of these hold. Check them before reporting:\n1. Every operation you enabled is listed under its table\'s `rowConditions` in `GET_ROLE_DETAIL`, or is deliberately open.\n2. `GET_ROLE_DETAIL` on **Anonymous User** *and* **Logged-in User** shows no unintended grant on the tables you touched. A newly created table lands in every role automatically, with select, insert, update, delete, count and aggregate all granted and unconditioned \u2014 the two predefined roles included. Observed on a deployed project: an unauthenticated request could read every row, and after only SELECT was revoked it could still INSERT. Checking Anonymous User alone leaves every logged-in user holding the same open grant.\n3. Any custom role you created is actually assigned to someone.\n4. "Sync Backend" has run.\nIf you stop short of any of these, say so explicitly and name which grants are still open. Never report the permission work as complete.\n\n### Troubleshooting 403\n403s surface in runtime logs and client responses:\n```json\n{\n "errorCode": 403,\n "extensions": { "classification": "TABLE_ACCESS" },\n "message": "User 1 has no permission for SELECT on order"\n}\n```\n"User 1" is the user whose internal id ends in 1 (1000000000000001). Then:\n1. Confirm the user holds the role you expect.\n2. Read that role with `GET_TABLE_PERMISSION` on the table the 403 names: is the operation enabled, is the column inside its grant, and does its row condition match the row the user expected?\n3. Confirm "Sync Backend" ran after the last permission change.'}},runtime:{pre:{available:!0,prompt:'## Verifying your own work\nThese tools run against the project\'s REAL backend. There is no staging copy, so prefer the primitives that undo themselves and reach for the ones that do not only when the check genuinely requires them.\n\nDraft versus deployed, which is the distinction that decides whether a green result means anything:\n- `runtime.debug_flow` and `runtime.run_code` execute the DRAFT \u2014 what you just edited \u2014 and revert their database writes by default. This is the verification loop.\n- `runtime.invoke_flow` executes the DEPLOYED version with permissions enforced and reverts nothing. A green invoke on a project with pending changes proves nothing about your edits; the result says so when that is the case.\n\nWhat "done" means here:\n- an action flow you built or changed is not done until `runtime.debug_flow` has run it and you have read the terminal node\'s output;\n- a permission change is not done until you have watched the rule act on data whose existence you are sure of. Reading once as a user proves nothing on its own: an empty result means either "the rule hid it" or "there was nothing there", and those need different fixes. Get a second observation, in this order of preference:\n 1. `runtime.login` with credentials the user gives you \u2014 a real account with its real roles, and the only way to test a rule that keys on a named role without permission to edit the project\'s backend. Ask for them; do not guess them.\n 2. `as: "admin"` alongside `as: "<role>"`, if this session has it. `admin` bypasses row and column permissions, so the pair reads as ground-truth-versus-user over data you did not create. Cheapest when it is available, and unavailable to a session that cannot edit the project\'s backend.\nNeither is open to a session with no credentials to hand, so say which rule you could not verify and why instead of reporting it done;\n- the identity tiers are not one axis, and a rule usually keys on which tier you are in rather than on who you are. Read the same data as each tier the rule is supposed to distinguish, and compare: `as: "anonymous"` sends no credential at all \u2014 a logged-out visitor, the only identity carrying the Anonymous User role, and where public data leaks; an account from `runtime.login` is signed in, carrying Logged-in User plus the project\'s own custom roles, which is a different rung and usually a different answer. Signed-out versus signed-in is the pair most often wrong, so run it whenever a rule claims to require a login;\n- if a check cannot be run, say which one and why. Never report work as verified because it looked right.\n\nWhen a run fails, its nodes carry a `traceId`: pass it to `logs.search` as `traceId: "\u2026"` to get the server-side detail.\n\n### Two filter grammars \u2014 do not mix them\nThe operator-first grammar documented above (`{"_eq": {"bigint_operand": {\u2026}}}`) is the RAW shape, for documents you hand-write and send with `runtime.graphql`. The typed tools \u2014 `runtime.query`, `runtime.aggregate`, `runtime.update`, `runtime.delete` \u2014 take the SIMPLIFIED shape instead: `{"column": {"_op": value}}`, e.g. `{"status": {"_eq": "PAID"}}`. Feeding the raw grammar to a typed tool, or the simplified one to a hand-written document, fails validation at the runtime rather than in the tool.\n\n### Names here are API names, never display names\nThe runtime GraphQL schema is generated from **API names** \u2014 `tableName`, every column in a field list, every key in a filter or a `set`. Every editor read gives you both: `database.get_tables_info` returns each column\'s `apiName` AND its `displayName`, and only the `apiName` is valid here. They diverge the moment anyone renames a column in the editor, which is routine and leaves no trace in the runtime, so a name you read in a UI, a page binding or a conversation is the wrong one until you have checked it against `apiName`. A display name sent here comes back as `Field \'<name>\' in type \'<table>\' is undefined`.\n\n### An enum column takes the option NAME\nIn the schema an enum option has an id and a name, and a binding stores the id. The runtime stores and matches the **name**: filter with `{"status": {"_eq": "PAID"}}`, never the `o1`-style option id you would write into a schema binding. Sending the id is rejected with `Invalid option: <id>, available option: \u2026`, which lists the names \u2014 use one of those verbatim.\n\n### Binary assets are ids, on the way in and on the way out\nImages, videos and files live in object storage; a table column holds only the asset id, never a URL or a path. That changes every side of a runtime call:\n- **Reading**: the column is an object in GraphQL, not a scalar, so selecting `cover_image` bare fails with "Subselection required for type \'FZ_Image\'". Ask for `cover_image_id`, or select a subfield \u2014 `cover_image { id url }`. The typed tools do this for you when they default a field list; hand-written `runtime.graphql` selections have to get it right. The list-valued media types are deprecated; if a project still has one, it reads as a `[col]_ids` array.\n- **Writing**: `runtime.insert` and `runtime.update` take the id column too \u2014 `{"cover_image_id": 1030\u2026}`, never `{"cover_image": "https://\u2026"}`. A URL in a media column is rejected, and a plausible-looking id you invented points at someone else\'s asset or at nothing.\n- **Getting an id**: an asset does not exist until its bytes have been uploaded, which is a two-step flow \u2014 request a presigned URL (`imagePresignedUrlV2` / `videoPresignedUrlV2` / `filePresignedUrlV2`, keyed by the file\'s Base64 MD5), then HTTP PUT the bytes to it. You can do the first step through `runtime.graphql` but **not the second**: no runtime tool sends raw bytes. Three ways to get a storable id, in order of preference: `web.import_asset` with `mode: RUNTIME`, which does both steps server-side from a public URL and hands back the numeric id; `runtime.query` on `fz_images` / `fz_videos` / `fz_files`, which lists the ids the app already holds; or asking the user. Never fabricate one \u2014 a plausible number points at another project\'s asset or at nothing, and the row looks written until someone opens it.\n- **Which id, though**: a data row stores the id the RUNNING APP holds, which is what those tables list and what `mode: RUNTIME` returns. Editor-side asset ids are a different space \u2014 an id taken from the editor and written into a row, or an app id bound to a component, resolves to nothing and reports no error either way.\n- **Importing at run time is a different problem**: `web.import_asset` runs now, while you are building. An app that has to turn a URL into an asset while it runs needs the **Files** action flow node, which does the same import inside a flow. Build that node into the flow rather than importing the file yourself and writing the id in.\n- `url` is a rendering detail: read it when you want to show or check an asset, and store the id everywhere else.\n\n### What runtime.graphql can reach\n`runtime.graphql` runs against the app\'s own API \u2014 the generated table operations, `fz_invoke_action_flow*`, `fz_action_flow_result`, the ZAI conversation operations, asset upload. The debug operations behind `runtime.debug_flow`, `runtime.run_code` and `zai.debug_chat` live on a separate admin surface those tools reach for you; asking for them through `runtime.graphql` reports the field as undefined. Subscriptions are unavailable from every tool here \u2014 poll the documented query counterpart instead.\n\n### Triggers\nThere is no fire-a-trigger tool, for anyone \u2014 the editor cannot do it either. A database trigger fires when a matching row is really written **and the transaction commits**, so a rollback debug run cannot fire one: the notification the runtime listens for is rolled back with everything else. To exercise a database trigger, write a row with `runtime.insert` or `runtime.update` that matches the trigger\'s table, operation and condition, then read what it did with `runtime.query` and `logs.search`. Your write is recorded so you can report it; the rows the trigger\'s own flow wrote in response are not, so name the trigger as well when you hand the run over. `runtime.status` lists the project\'s triggers with the table and operation each one watches, and a write to a triggered table says so in its confirmation.\n\nA schedule cannot be fired on demand at all. Verify the flow it points at with `runtime.debug_flow`, check the cron expression and end date as configuration, and tell the user the schedule itself is unverified.\n\n### What you leave behind\nNothing you write here can be taken back. There is no undo tool and no cleanup tool: a row from `runtime.insert`, an account from `runtime.as_user`, an overwritten column, a deleted row, and whatever a trigger did in response are all simply in the user\'s app now. That is the reason to reach for a rollback debug run first and to write only the fixtures a check genuinely needs.\n\nWhat you do owe the user is an account of it. Rows you inserted and accounts you created are recorded with their ids, and you are reminded of them as you work \u2014 finish a verification run by saying what you created and in which table, so they can delete it from the data table if they want to. "I added some test data" is not a handover; "I added order#41 and order#42, and account 9931 with role Customer" is.\n\nThe wire protocol for each of these calls \u2014 the query language, filter grammar, aggregations, action-flow and AI invocation, third-party calls and asset upload \u2014 is documented in the `baas-*` capabilities.'},post:{available:!0,prompt:'## Verifying your own work\nThese tools run against the project\'s REAL backend. There is no staging copy, so prefer the primitives that undo themselves and reach for the ones that do not only when the check genuinely requires them.\n\nDraft versus deployed, which is the distinction that decides whether a green result means anything:\n- `runtime.debug_flow` and `runtime.run_code` execute the DRAFT \u2014 what you just edited \u2014 and revert their database writes by default. This is the verification loop.\n- `runtime.invoke_flow` executes the DEPLOYED version with permissions enforced and reverts nothing. A green invoke on a project with pending changes proves nothing about your edits; the result says so when that is the case.\n\nWhat "done" means here:\n- an action flow you built or changed is not done until `runtime.debug_flow` has run it and you have read the terminal node\'s output;\n- a permission change is not done until you have watched the rule act on data whose existence you are sure of. Reading once as a user proves nothing on its own: an empty result means either "the rule hid it" or "there was nothing there", and those need different fixes. Get a second observation, in this order of preference:\n 1. `runtime.login` with credentials the user gives you \u2014 a real account with its real roles, and the only way to test a rule that keys on a named role without permission to edit the project\'s backend. Ask for them; do not guess them.\n 2. `as: "admin"` alongside `as: "<role>"`, if this session has it. `admin` bypasses row and column permissions, so the pair reads as ground-truth-versus-user over data you did not create. Cheapest when it is available, and unavailable to a session that cannot edit the project\'s backend.\nNeither is open to a session with no credentials to hand, so say which rule you could not verify and why instead of reporting it done;\n- the identity tiers are not one axis, and a rule usually keys on which tier you are in rather than on who you are. Read the same data as each tier the rule is supposed to distinguish, and compare: `as: "anonymous"` sends no credential at all \u2014 a logged-out visitor, the only identity carrying the Anonymous User role, and where public data leaks; an account from `runtime.login` is signed in, carrying Logged-in User plus the project\'s own custom roles, which is a different rung and usually a different answer. Signed-out versus signed-in is the pair most often wrong, so run it whenever a rule claims to require a login;\n- if a check cannot be run, say which one and why. Never report work as verified because it looked right.\n\nWhen a run fails, its nodes carry a `traceId`: pass it to `logs.search` as `traceId: "\u2026"` to get the server-side detail.\n\n### Two filter grammars \u2014 do not mix them\nThe operator-first grammar documented above (`{"_eq": {"bigint_operand": {\u2026}}}`) is the RAW shape, for documents you hand-write and send with `runtime.graphql`. The typed tools \u2014 `runtime.query`, `runtime.aggregate`, `runtime.update`, `runtime.delete` \u2014 take the SIMPLIFIED shape instead: `{"column": {"_op": value}}`, e.g. `{"status": {"_eq": "PAID"}}`. Feeding the raw grammar to a typed tool, or the simplified one to a hand-written document, fails validation at the runtime rather than in the tool.\n\n### Names here are API names, never display names\nThe runtime GraphQL schema is generated from **API names** \u2014 `tableName`, every column in a field list, every key in a filter or a `set`. Every editor read gives you both: `database.get_tables_info` returns each column\'s `apiName` AND its `displayName`, and only the `apiName` is valid here. They diverge the moment anyone renames a column in the editor, which is routine and leaves no trace in the runtime, so a name you read in a UI, a page binding or a conversation is the wrong one until you have checked it against `apiName`. A display name sent here comes back as `Field \'<name>\' in type \'<table>\' is undefined`.\n\n### An enum column takes the option NAME\nIn the schema an enum option has an id and a name, and a binding stores the id. The runtime stores and matches the **name**: filter with `{"status": {"_eq": "PAID"}}`, never the `o1`-style option id you would write into a schema binding. Sending the id is rejected with `Invalid option: <id>, available option: \u2026`, which lists the names \u2014 use one of those verbatim.\n\n### Binary assets are ids, on the way in and on the way out\nImages, videos and files live in object storage; a table column holds only the asset id, never a URL or a path. That changes every side of a runtime call:\n- **Reading**: the column is an object in GraphQL, not a scalar, so selecting `cover_image` bare fails with "Subselection required for type \'FZ_Image\'". Ask for `cover_image_id`, or select a subfield \u2014 `cover_image { id url }`. The typed tools do this for you when they default a field list; hand-written `runtime.graphql` selections have to get it right. The list-valued media types are deprecated; if a project still has one, it reads as a `[col]_ids` array.\n- **Writing**: `runtime.insert` and `runtime.update` take the id column too \u2014 `{"cover_image_id": 1030\u2026}`, never `{"cover_image": "https://\u2026"}`. A URL in a media column is rejected, and a plausible-looking id you invented points at someone else\'s asset or at nothing.\n- **Getting an id**: an asset does not exist until its bytes have been uploaded, which is a two-step flow \u2014 request a presigned URL (`imagePresignedUrlV2` / `videoPresignedUrlV2` / `filePresignedUrlV2`, keyed by the file\'s Base64 MD5), then HTTP PUT the bytes to it. You can do the first step through `runtime.graphql` but **not the second**: no runtime tool sends raw bytes. Three ways to get a storable id, in order of preference: `web.import_asset` with `mode: RUNTIME`, which does both steps server-side from a public URL and hands back the numeric id; `runtime.query` on `fz_images` / `fz_videos` / `fz_files`, which lists the ids the app already holds; or asking the user. Never fabricate one \u2014 a plausible number points at another project\'s asset or at nothing, and the row looks written until someone opens it.\n- **Which id, though**: a data row stores the id the RUNNING APP holds, which is what those tables list and what `mode: RUNTIME` returns. Editor-side asset ids are a different space \u2014 an id taken from the editor and written into a row, or an app id bound to a component, resolves to nothing and reports no error either way.\n- **Importing at run time is a different problem**: `web.import_asset` runs now, while you are building. An app that has to turn a URL into an asset while it runs needs the **Files** action flow node, which does the same import inside a flow. Build that node into the flow rather than importing the file yourself and writing the id in.\n- `url` is a rendering detail: read it when you want to show or check an asset, and store the id everywhere else.\n\n### What runtime.graphql can reach\n`runtime.graphql` runs against the app\'s own API \u2014 the generated table operations, `fz_invoke_action_flow*`, `fz_action_flow_result`, the ZAI conversation operations, asset upload. The debug operations behind `runtime.debug_flow`, `runtime.run_code` and `zai.debug_chat` live on a separate admin surface those tools reach for you; asking for them through `runtime.graphql` reports the field as undefined. Subscriptions are unavailable from every tool here \u2014 poll the documented query counterpart instead.\n\n### Triggers\nThere is no fire-a-trigger tool, for anyone \u2014 the editor cannot do it either. A database trigger fires when a matching row is really written **and the transaction commits**, so a rollback debug run cannot fire one: the notification the runtime listens for is rolled back with everything else. To exercise a database trigger, write a row with `runtime.insert` or `runtime.update` that matches the trigger\'s table, operation and condition, then read what it did with `runtime.query` and `logs.search`. Your write is recorded so you can report it; the rows the trigger\'s own flow wrote in response are not, so name the trigger as well when you hand the run over. `runtime.status` lists the project\'s triggers with the table and operation each one watches, and a write to a triggered table says so in its confirmation.\n\nA schedule cannot be fired on demand at all. Verify the flow it points at with `runtime.debug_flow`, check the cron expression and end date as configuration, and tell the user the schedule itself is unverified.\n\n### What you leave behind\nNothing you write here can be taken back. There is no undo tool and no cleanup tool: a row from `runtime.insert`, an account from `runtime.as_user`, an overwritten column, a deleted row, and whatever a trigger did in response are all simply in the user\'s app now. That is the reason to reach for a rollback debug run first and to write only the fixtures a check genuinely needs.\n\nWhat you do owe the user is an account of it. Rows you inserted and accounts you created are recorded with their ids, and you are reminded of them as you work \u2014 finish a verification run by saying what you created and in which table, so they can delete it from the data table if they want to. "I added some test data" is not a handover; "I added order#41 and order#42, and account 9931 with role Customer" is.\n\nThe wire protocol for each of these calls \u2014 the query language, filter grammar, aggregations, action-flow and AI invocation, third-party calls and asset upload \u2014 is documented in the `baas-*` capabilities.'}},secret:{pre:{available:!0,prompt:`## Secret Domain Knowledge
|
|
703
665
|
A secret is a named reference to a sensitive value (an API key, token, \u2026) that action flows
|
|
704
666
|
and API/TPA configs consume by handle rather than inlining the plaintext. Changes take effect
|
|
705
667
|
online only after "Sync Backend".
|
|
@@ -1228,7 +1190,6 @@ Changes apply immediately; use schema_undo to revert the last change. Ops:
|
|
|
1228
1190
|
- op=GET_ALL_ROLES_INFO
|
|
1229
1191
|
- op=GET_ROLE_DETAIL \u2014 One role's grants across every permission block, reported by exception: per table, the operations granted, which of them carry a narrowed row condition, and only the column sets that cover less than the whole table \u2014 an operation listed as granted and nowhere else covers every column and every row. Tables the role cannot touch at all are named together in tablesWithNoGrants. Narrow the read with \`blocks\` when the task is about one of them. It carries no row-condition schema paths \u2014 take those from GET_TABLE_PERMISSION for the tables you are narrowing, since a whole-role read would carry one path per operation per table and almost none of them are ever used. FULL returns the raw RoleConfig.
|
|
1230
1192
|
- op=GET_TABLE_PERMISSION \u2014 One role's grants on named tables, each operation with its row-condition schema path for the condition tools. The drill-in for GET_ROLE_DETAIL: name only the tables you are about to change.
|
|
1231
|
-
- op=GET_VIEW_PERMISSION \u2014 One role's grants on named views, each operation with its row-condition schema path for the condition tools. A view is read-only, so only select, count and aggregate exist.
|
|
1232
1193
|
- op=SET_ROLE_PERMISSION_CHECK \u2014 Seed (or reset) a role's conditional check on one action flow / AI agent: writes an always-true condition and returns its schema path \u2014 then narrow the condition via the condition tools at that path. The check gates calls to the target on top of the allow-list.
|
|
1233
1194
|
- op=UPDATE_ROLE \u2014 Edit a custom role's description. Renaming is not available here: a role's name is fixed once it has been deployed to the backend, and only the editor can tell whether it has \u2014 to use a different name, create another role with ADD_ROLES and delete the old one with DELETE_ROLES.
|
|
1234
1195
|
- op=UPDATE_ROLE_ACTION_FLOW_PERMISSION (req: roleName)
|
|
@@ -1236,15 +1197,14 @@ Changes apply immediately; use schema_undo to revert the last change. Ops:
|
|
|
1236
1197
|
- op=UPDATE_ROLE_PAYMENT_PERMISSION (req: roleName)
|
|
1237
1198
|
- op=UPDATE_ROLE_TABLE_PERMISSION \u2014 Grant or revoke one role's operations across any number of tables, with per-operation column sets. Newly granted operations get an always-true row condition; the result reports every addressed table's resulting grant and the schema path of each condition, so narrowing one needs no further read.
|
|
1238
1199
|
- op=UPDATE_ROLE_TPA_PERMISSION (req: roleName) [pre-type-system-refactor only]
|
|
1239
|
-
- op=
|
|
1240
|
-
- op=UPDATE_ROLE_ZAI_PERMISSION (req: roleName)`,ops:{ACTIVATE_ROLE_PERMISSION:"ACTIVATE_ROLE_PERMISSION",ADD_ROLES:"ADD_ROLES",DELETE_ROLES:"DELETE_ROLES",GET_ALL_ROLES_INFO:"GET_ALL_ROLES_INFO",GET_ROLE_DETAIL:"GET_ROLE_DETAIL",GET_TABLE_PERMISSION:"GET_TABLE_PERMISSION",GET_VIEW_PERMISSION:"GET_VIEW_PERMISSION",SET_ROLE_PERMISSION_CHECK:"SET_ROLE_PERMISSION_CHECK",UPDATE_ROLE:"UPDATE_ROLE",UPDATE_ROLE_ACTION_FLOW_PERMISSION:"UPDATE_ROLE_ACTION_FLOW_PERMISSION",UPDATE_ROLE_API_PERMISSION:"UPDATE_ROLE_API_PERMISSION",UPDATE_ROLE_PAYMENT_PERMISSION:"UPDATE_ROLE_PAYMENT_PERMISSION",UPDATE_ROLE_TABLE_PERMISSION:"UPDATE_ROLE_TABLE_PERMISSION",UPDATE_ROLE_TPA_PERMISSION:"UPDATE_ROLE_TPA_PERMISSION",UPDATE_ROLE_VIEW_PERMISSION:"UPDATE_ROLE_VIEW_PERMISSION",UPDATE_ROLE_ZAI_PERMISSION:"UPDATE_ROLE_ZAI_PERMISSION"},inputSchema:{allowAll:c.boolean().optional(),allowedActionFlowIds:c.array(c.any()).optional(),allowedApiIds:c.array(c.any()).optional(),allowedPaymentTypeAndMethod:c.record(c.any()).optional(),allowedTpaConfigIds:c.array(c.any()).optional(),allowedZAiIds:c.array(c.any()).optional(),blocks:c.array(c.any()).optional(),category:c.enum(["ACTION_FLOW","ZAI"]).optional(),denyAllTables:c.boolean().optional(),denyAllViews:c.boolean().optional(),description:c.string().optional(),detail:c.enum(["SUMMARY","FULL"]).optional(),items:c.array(c.any()).optional(),roleName:c.string().optional(),roleNames:c.array(c.any()).optional(),tableDisplayNames:c.array(c.any()).optional(),tables:c.array(c.any()).optional(),targetId:c.string().optional(),viewDisplayNames:c.array(c.any()).optional(),views:c.array(c.any()).optional()}},{name:"schema_request_filter",tier:"core",description:"Request filters (conditional filters / where-conditions / sort) addressed by schemaPath. Start from op=CONTEXT for selectable columns and sub-paths \u2014 never hand-build paths. Condition values are DataBindings (fill with schema_create_binding).\nChanges apply immediately; use schema_undo to revert the last change. Ops:\n- op=ADD_FILTER \u2014 Add a conditional filter to the request's list. A new filter starts empty on the column-comparison `where` by default; pass `whereTrack: WHERE_CONDITION` only when the user explicitly asks for the condition-expression (`whereCondition`) track. The echo's `whereTrack` is the track you passed. Result echoes the new filter's id and its whereSchemaPath / sortConfigsSchemaPath anchors.\n- op=ADD_CONDITION \u2014 Result echoes the new condition's schema path and its value binding's schema path (for the CREATE_*_BINDING tools).\n- op=ADD_SORT (req: field, schemaPath)\n- op=DELETE_FILTER (req: id, schemaPath)\n- op=DELETE_CONDITION (req: schemaPath)\n- op=DELETE_SORT (req: index, schemaPath)\n- op=DUPLICATE_REQUEST_CONDITIONAL_FILTER \u2014 Copy one conditional filter \u2014 its gating condition together with the where/sort it turns on \u2014 onto another query or mutation. The copy keeps the source's where track, so the echo's `whereTrack` is the source's, not the target's. Columns the target's table does not have are blanked rather than carried over, so re-check the copy's conditions when the two requests read different tables. The result echoes the copy's id and schema paths.\n- op=CONTEXT \u2014 Entry point for editing a query/mutation request's conditions and sorting. Pass the request's or owning node's schema path (e.g. from GET_ACTION_FLOW_NODE_DETAIL, or a ZAI db-context's querySchemaPath); returns the conditional filters with their whereSchemaPath / sortConfigsSchemaPath anchors, selectableColumns with allowed operators, and updateColumnArithmetic modes \u2014 everything the *_REQUEST_* tools take. `whereTrack` picks the track every reported whereSchemaPath addresses; it is a caller choice, not a read of the stored shape. COLUMN_WHERE (the default) addresses the column-comparison `where`, edited with the *_REQUEST_FILTER_CONDITION tools from the selectableColumns pathComponents. WHERE_CONDITION addresses `whereCondition`: a condition tree edited with the condition tools (a bare always-true condition, which is what an emptied tree holds, takes UPDATE_EXPRESSION_CONDITION_OPERATOR directly, and INSERT_CONDITION_BOOL_EXP seeds an absent tree or fills the bare one in place), with selectableColumns omitted because those tools reject that track. Each filter's `whereTrack` echoes the requested track. On an un-migrated request still holding a bare top-level `where`, conditionalFilters is empty and whereSchemaPath addresses that where \u2014 edit it in place; requesting WHERE_CONDITION there is rejected. An aggregate value binding (a relation's count/sum/... \u2014 its path ends in an aggregation) carries its own row filter: pass the binding's schema path to get that where the same way (no conditional filters, no sort), and the same track decides whether its whereSchemaPath addresses `where` or `whereCondition`.\n- op=NEST_CONDITION (req: schemaPath)\n- op=REORDER_FILTERS (req: reorderedIds, schemaPath)\n- op=REORDER_SORT (req: reorderedIndexes, schemaPath)\n- op=SET_UPDATE_COLUMN_ARITHMETIC (req: columnDisplayName, mode, schemaPath)\n- op=TOGGLE_CONDITION_AND_OR (req: schemaPath)\n- op=TOGGLE_CONDITION_NOT (req: schemaPath)\n- op=UPDATE_FILTER (req: id, name, schemaPath)\n- op=SET_CONDITION_OPERATOR (req: operator, schemaPath)\n- op=UPDATE_SORT (req: index, schemaPath)",ops:{ADD_FILTER:"ADD_REQUEST_CONDITIONAL_FILTER",ADD_CONDITION:"ADD_REQUEST_FILTER_CONDITION",ADD_SORT:"ADD_REQUEST_SORT_CONFIG",DELETE_FILTER:"DELETE_REQUEST_CONDITIONAL_FILTER",DELETE_CONDITION:"DELETE_REQUEST_FILTER_CONDITION",DELETE_SORT:"DELETE_REQUEST_SORT_CONFIG",DUPLICATE_REQUEST_CONDITIONAL_FILTER:"DUPLICATE_REQUEST_CONDITIONAL_FILTER",CONTEXT:"GET_REQUEST_FILTER_CONTEXT",NEST_CONDITION:"NEST_REQUEST_FILTER_CONDITION",REORDER_FILTERS:"REORDER_REQUEST_CONDITIONAL_FILTERS",REORDER_SORT:"REORDER_REQUEST_SORT_CONFIGS",SET_UPDATE_COLUMN_ARITHMETIC:"SET_UPDATE_COLUMN_ARITHMETIC",TOGGLE_CONDITION_AND_OR:"TOGGLE_REQUEST_FILTER_CONDITION_AND_OR",TOGGLE_CONDITION_NOT:"TOGGLE_REQUEST_FILTER_CONDITION_NOT",UPDATE_FILTER:"UPDATE_REQUEST_CONDITIONAL_FILTER",SET_CONDITION_OPERATOR:"UPDATE_REQUEST_FILTER_CONDITION_OPERATOR",UPDATE_SORT:"UPDATE_REQUEST_SORT_CONFIG"},inputSchema:{afterId:c.string().optional(),columnDisplayName:c.string().optional(),columnPathComponents:c.array(c.any()).optional(),field:c.array(c.any()).optional(),id:c.string().optional(),index:c.number().optional(),mode:c.enum(["set","increment","decrement"]).optional(),name:c.string().optional(),operator:c.string().optional(),reorderedIds:c.array(c.any()).optional(),reorderedIndexes:c.array(c.any()).optional(),schemaPath:c.array(c.any()).optional(),sort:c.enum(["descending","ascending"]).optional(),sourceId:c.string().optional(),sourceSchemaPath:c.array(c.any()).optional(),value:c.record(c.any()).optional(),whereTrack:c.enum(["COLUMN_WHERE","WHERE_CONDITION"]).optional()}},{name:"schema_secret",tier:"catalog",description:"\nChanges apply immediately; use schema_undo to revert the last change. Ops:\n- op=ADD_SECRET_CONFIGS \u2014 Registers secret entries in the schema. The plaintext value is NOT passed here and never stored in the schema: you must first upload the value out of band (the backend `saveSecret` mutation) to obtain its opaque `secretKey` handle, then pass that handle. A secret added without a `secretKey` has no value set and stays incomplete until one is supplied via UPDATE_SECRET_CONFIG. Result echoes each new secret's id.\n- op=DELETE_SECRET_CONFIGS (req: secretIds)\n- op=GET_ALL_SECRET_CONFIGS \u2014 Lists every secret: id, displayName, description, and `hasValue` (whether its value handle is set). The stored value handle itself is withheld.\n- op=UPDATE_SECRET_CONFIG \u2014 Updates a secret's metadata and/or value handle (incremental \u2014 omitted fields are left unchanged). You cannot set a plaintext value here: to change the value, re-upload it out of band (the backend `saveSecret` mutation) to obtain a new `secretKey` handle, then pass it as `secretKey`.",ops:{ADD_SECRET_CONFIGS:"ADD_SECRET_CONFIGS",DELETE_SECRET_CONFIGS:"DELETE_SECRET_CONFIGS",GET_ALL_SECRET_CONFIGS:"GET_ALL_SECRET_CONFIGS",UPDATE_SECRET_CONFIG:"UPDATE_SECRET_CONFIG"},inputSchema:{description:c.string().optional(),displayName:c.string().optional(),items:c.array(c.any()).optional(),secretId:c.string().optional(),secretIds:c.array(c.any()).optional(),secretKey:c.string().optional()}},{name:"schema_set_tpa_config_paging",tier:"catalog",description:`
|
|
1200
|
+
- op=UPDATE_ROLE_ZAI_PERMISSION (req: roleName)`,ops:{ACTIVATE_ROLE_PERMISSION:"ACTIVATE_ROLE_PERMISSION",ADD_ROLES:"ADD_ROLES",DELETE_ROLES:"DELETE_ROLES",GET_ALL_ROLES_INFO:"GET_ALL_ROLES_INFO",GET_ROLE_DETAIL:"GET_ROLE_DETAIL",GET_TABLE_PERMISSION:"GET_TABLE_PERMISSION",SET_ROLE_PERMISSION_CHECK:"SET_ROLE_PERMISSION_CHECK",UPDATE_ROLE:"UPDATE_ROLE",UPDATE_ROLE_ACTION_FLOW_PERMISSION:"UPDATE_ROLE_ACTION_FLOW_PERMISSION",UPDATE_ROLE_API_PERMISSION:"UPDATE_ROLE_API_PERMISSION",UPDATE_ROLE_PAYMENT_PERMISSION:"UPDATE_ROLE_PAYMENT_PERMISSION",UPDATE_ROLE_TABLE_PERMISSION:"UPDATE_ROLE_TABLE_PERMISSION",UPDATE_ROLE_TPA_PERMISSION:"UPDATE_ROLE_TPA_PERMISSION",UPDATE_ROLE_ZAI_PERMISSION:"UPDATE_ROLE_ZAI_PERMISSION"},inputSchema:{allowAll:c.boolean().optional(),allowedActionFlowIds:c.array(c.any()).optional(),allowedApiIds:c.array(c.any()).optional(),allowedPaymentTypeAndMethod:c.record(c.any()).optional(),allowedTpaConfigIds:c.array(c.any()).optional(),allowedZAiIds:c.array(c.any()).optional(),blocks:c.array(c.any()).optional(),category:c.enum(["ACTION_FLOW","ZAI"]).optional(),denyAllTables:c.boolean().optional(),description:c.string().optional(),detail:c.enum(["SUMMARY","FULL"]).optional(),items:c.array(c.any()).optional(),roleName:c.string().optional(),roleNames:c.array(c.any()).optional(),tableDisplayNames:c.array(c.any()).optional(),tables:c.array(c.any()).optional(),targetId:c.string().optional()}},{name:"schema_request_filter",tier:"core",description:"Request filters (conditional filters / where-conditions / sort) addressed by schemaPath. Start from op=CONTEXT for selectable columns and sub-paths \u2014 never hand-build paths. Condition values are DataBindings (fill with schema_create_binding).\nChanges apply immediately; use schema_undo to revert the last change. Ops:\n- op=ADD_FILTER \u2014 Add a conditional filter to the request's list. A new filter starts empty on the column-comparison `where` by default; pass `whereTrack: WHERE_CONDITION` only when the user explicitly asks for the condition-expression (`whereCondition`) track. The echo's `whereTrack` is the track you passed. Result echoes the new filter's id and its whereSchemaPath / sortConfigsSchemaPath anchors.\n- op=ADD_CONDITION \u2014 Result echoes the new condition's schema path and its value binding's schema path (for the CREATE_*_BINDING tools).\n- op=ADD_SORT (req: field, schemaPath)\n- op=DELETE_FILTER (req: id, schemaPath)\n- op=DELETE_CONDITION (req: schemaPath)\n- op=DELETE_SORT (req: index, schemaPath)\n- op=DUPLICATE_REQUEST_CONDITIONAL_FILTER \u2014 Copy one conditional filter \u2014 its gating condition together with the where/sort it turns on \u2014 onto another query or mutation. The copy keeps the source's where track, so the echo's `whereTrack` is the source's, not the target's. Columns the target's table does not have are blanked rather than carried over, so re-check the copy's conditions when the two requests read different tables. The result echoes the copy's id and schema paths.\n- op=CONTEXT \u2014 Entry point for editing a query/mutation request's conditions and sorting. Pass the request's or owning node's schema path (e.g. from GET_ACTION_FLOW_NODE_DETAIL, or a ZAI db-context's querySchemaPath); returns the conditional filters with their whereSchemaPath / sortConfigsSchemaPath anchors, selectableColumns with allowed operators, and updateColumnArithmetic modes \u2014 everything the *_REQUEST_* tools take. `whereTrack` picks the track every reported whereSchemaPath addresses; it is a caller choice, not a read of the stored shape. COLUMN_WHERE (the default) addresses the column-comparison `where`, edited with the *_REQUEST_FILTER_CONDITION tools from the selectableColumns pathComponents. WHERE_CONDITION addresses `whereCondition`: a condition tree edited with the condition tools (a bare always-true condition, which is what an emptied tree holds, takes UPDATE_EXPRESSION_CONDITION_OPERATOR directly, and INSERT_CONDITION_BOOL_EXP seeds an absent tree or fills the bare one in place), with selectableColumns omitted because those tools reject that track. Each filter's `whereTrack` echoes the requested track. On an un-migrated request still holding a bare top-level `where`, conditionalFilters is empty and whereSchemaPath addresses that where \u2014 edit it in place; requesting WHERE_CONDITION there is rejected. An aggregate value binding (a relation's count/sum/... \u2014 its path ends in an aggregation) carries its own row filter: pass the binding's schema path to get that where the same way (no conditional filters, no sort), and the same track decides whether its whereSchemaPath addresses `where` or `whereCondition`.\n- op=NEST_CONDITION (req: schemaPath)\n- op=REORDER_FILTERS (req: reorderedIds, schemaPath)\n- op=REORDER_SORT (req: reorderedIndexes, schemaPath)\n- op=SET_UPDATE_COLUMN_ARITHMETIC (req: columnDisplayName, mode, schemaPath)\n- op=TOGGLE_CONDITION_AND_OR (req: schemaPath)\n- op=TOGGLE_CONDITION_NOT (req: schemaPath)\n- op=UPDATE_FILTER (req: id, name, schemaPath)\n- op=SET_CONDITION_OPERATOR (req: operator, schemaPath)\n- op=UPDATE_SORT (req: index, schemaPath)",ops:{ADD_FILTER:"ADD_REQUEST_CONDITIONAL_FILTER",ADD_CONDITION:"ADD_REQUEST_FILTER_CONDITION",ADD_SORT:"ADD_REQUEST_SORT_CONFIG",DELETE_FILTER:"DELETE_REQUEST_CONDITIONAL_FILTER",DELETE_CONDITION:"DELETE_REQUEST_FILTER_CONDITION",DELETE_SORT:"DELETE_REQUEST_SORT_CONFIG",DUPLICATE_REQUEST_CONDITIONAL_FILTER:"DUPLICATE_REQUEST_CONDITIONAL_FILTER",CONTEXT:"GET_REQUEST_FILTER_CONTEXT",NEST_CONDITION:"NEST_REQUEST_FILTER_CONDITION",REORDER_FILTERS:"REORDER_REQUEST_CONDITIONAL_FILTERS",REORDER_SORT:"REORDER_REQUEST_SORT_CONFIGS",SET_UPDATE_COLUMN_ARITHMETIC:"SET_UPDATE_COLUMN_ARITHMETIC",TOGGLE_CONDITION_AND_OR:"TOGGLE_REQUEST_FILTER_CONDITION_AND_OR",TOGGLE_CONDITION_NOT:"TOGGLE_REQUEST_FILTER_CONDITION_NOT",UPDATE_FILTER:"UPDATE_REQUEST_CONDITIONAL_FILTER",SET_CONDITION_OPERATOR:"UPDATE_REQUEST_FILTER_CONDITION_OPERATOR",UPDATE_SORT:"UPDATE_REQUEST_SORT_CONFIG"},inputSchema:{afterId:c.string().optional(),columnDisplayName:c.string().optional(),columnPathComponents:c.array(c.any()).optional(),field:c.array(c.any()).optional(),id:c.string().optional(),index:c.number().optional(),mode:c.enum(["set","increment","decrement"]).optional(),name:c.string().optional(),operator:c.string().optional(),reorderedIds:c.array(c.any()).optional(),reorderedIndexes:c.array(c.any()).optional(),schemaPath:c.array(c.any()).optional(),sort:c.enum(["descending","ascending"]).optional(),sourceId:c.string().optional(),sourceSchemaPath:c.array(c.any()).optional(),value:c.record(c.any()).optional(),whereTrack:c.enum(["COLUMN_WHERE","WHERE_CONDITION"]).optional()}},{name:"schema_secret",tier:"catalog",description:"\nChanges apply immediately; use schema_undo to revert the last change. Ops:\n- op=ADD_SECRET_CONFIGS \u2014 Registers secret entries in the schema. The plaintext value is NOT passed here and never stored in the schema: you must first upload the value out of band (the backend `saveSecret` mutation) to obtain its opaque `secretKey` handle, then pass that handle. A secret added without a `secretKey` has no value set and stays incomplete until one is supplied via UPDATE_SECRET_CONFIG. Result echoes each new secret's id.\n- op=DELETE_SECRET_CONFIGS (req: secretIds)\n- op=GET_ALL_SECRET_CONFIGS \u2014 Lists every secret: id, displayName, description, and `hasValue` (whether its value handle is set). The stored value handle itself is withheld.\n- op=UPDATE_SECRET_CONFIG \u2014 Updates a secret's metadata and/or value handle (incremental \u2014 omitted fields are left unchanged). You cannot set a plaintext value here: to change the value, re-upload it out of band (the backend `saveSecret` mutation) to obtain a new `secretKey` handle, then pass it as `secretKey`.",ops:{ADD_SECRET_CONFIGS:"ADD_SECRET_CONFIGS",DELETE_SECRET_CONFIGS:"DELETE_SECRET_CONFIGS",GET_ALL_SECRET_CONFIGS:"GET_ALL_SECRET_CONFIGS",UPDATE_SECRET_CONFIG:"UPDATE_SECRET_CONFIG"},inputSchema:{description:c.string().optional(),displayName:c.string().optional(),items:c.array(c.any()).optional(),secretId:c.string().optional(),secretIds:c.array(c.any()).optional(),secretKey:c.string().optional()}},{name:"schema_set_tpa_config_paging",tier:"catalog",description:`
|
|
1241
1201
|
Changes apply immediately; use schema_undo to revert the last change. Ops:
|
|
1242
1202
|
- op=SET_TPA_CONFIG_PAGING (req: tpaConfigId) [pre-type-system-refactor only]`,ops:{SET_TPA_CONFIG_PAGING:"SET_TPA_CONFIG_PAGING"},inputSchema:{pageIndexPath:c.array(c.any()).optional(),pageIndexStartValue:c.number().optional(),pageSizePath:c.array(c.any()).optional(),tpaConfigId:c.string().optional()}},{name:"schema_tab_bar",tier:"catalog",description:`
|
|
1243
1203
|
Changes apply immediately; use schema_undo to revert the last change. Ops:
|
|
1244
1204
|
- op=GET_TAB_BAR_INFO \u2014 The native tab bar of this client: whether it is on, its colours, and each slot with the page it opens, its label and whether it has icons. Take this before changing anything about the bottom navigation \u2014 the slot count is fixed and a page can be opened by only one tab, so the slots are what a change has to be expressed against.
|
|
1245
1205
|
- op=SET_TAB_BAR_ENABLED \u2014 Show or hide this client's native tab bar \u2014 the bottom navigation the mini-program draws itself, not components on a page. Turning it on for the first time creates empty slots and shows none of them, so pair it with UPDATE_TAB_BAR_ITEMS in the same batch or the user sees no change.
|
|
1246
1206
|
- op=UPDATE_TAB_BAR_ITEMS \u2014 Point a tab-bar slot at a page and give it a label and icons. A slot with no page is hidden, and emptying one hides it again, which is how a tab is removed \u2014 the slot count itself never changes. A shown slot needs both icons or the project reports an error, so take the exIds from get_tab_bar_icons first: an icon is addressed by the exId of a stored image, never by its name, and a value that cannot be an exId is rejected. A mini-program tab bar has to show between two and five tabs, so bind at least two pages.
|
|
1247
|
-
- op=UPDATE_TAB_BAR_STYLE`,ops:{GET_TAB_BAR_INFO:"GET_TAB_BAR_INFO",SET_TAB_BAR_ENABLED:"SET_TAB_BAR_ENABLED",UPDATE_TAB_BAR_ITEMS:"UPDATE_TAB_BAR_ITEMS",UPDATE_TAB_BAR_STYLE:"UPDATE_TAB_BAR_STYLE"},inputSchema:{backgroundColor:c.string().optional(),color:c.string().optional(),enabled:c.boolean().optional(),items:c.array(c.any()).optional(),selectedColor:c.string().optional()}},{name:"schema_table",tier:"core",description:`Database tables, fields, relations, and constraints in the loaded schema. A field type is copied verbatim from op=SELECTABLE_TYPES into \`typeIdentifier\`, never hand-built.
|
|
1207
|
+
- op=UPDATE_TAB_BAR_STYLE`,ops:{GET_TAB_BAR_INFO:"GET_TAB_BAR_INFO",SET_TAB_BAR_ENABLED:"SET_TAB_BAR_ENABLED",UPDATE_TAB_BAR_ITEMS:"UPDATE_TAB_BAR_ITEMS",UPDATE_TAB_BAR_STYLE:"UPDATE_TAB_BAR_STYLE"},inputSchema:{backgroundColor:c.string().optional(),color:c.string().optional(),enabled:c.boolean().optional(),items:c.array(c.any()).optional(),selectedColor:c.string().optional()}},{name:"schema_table",tier:"core",description:`Database tables, fields, relations, and constraints in the loaded schema. A field type is copied verbatim from op=SELECTABLE_TYPES into \`typeIdentifier\`, never hand-built.
|
|
1248
1208
|
Changes apply immediately; use schema_undo to revert the last change. Ops:
|
|
1249
1209
|
- op=ADD_CONSTRAINTS (req: constraints)
|
|
1250
1210
|
- op=ADD_DATABASE_INDEX \u2014 Declare a database index on a table field. indexType 'BM25': keyword full-text relevance ranking over a TEXT field, exposed as the fz_<field>_bm25 order-by field of the project GraphQL API, with fz_<field>_bm25_score and fz_<field>_bm25_snippet fields reading each row's relevance and a highlighted excerpt. Only rows that actually match the query come back, most relevant first, so the result can be shorter than the limit and a query matching nothing returns nothing \u2014 no extra filter is needed. An empty query orders by id instead. An index is addressed by the field it covers; its parameters are fixed once it exists, so changing them means deleting it and declaring it again.
|
|
@@ -1317,13 +1277,7 @@ Changes apply immediately; use schema_undo to revert the last change. Ops:
|
|
|
1317
1277
|
Changes apply immediately; use schema_undo to revert the last change. Ops:
|
|
1318
1278
|
- op=UPDATE_TPA_RESPONSE_DATA (req: responseBranch, tpaConfigId) [pre-type-system-refactor only]`,ops:{UPDATE_TPA_RESPONSE_DATA:"UPDATE_TPA_RESPONSE_DATA"},inputSchema:{defaultValue:c.string().optional(),itemType:c.string().optional(),name:c.string().optional(),required:c.boolean().optional(),responseBranch:c.enum(["2xx","4xx","5xx"]).optional(),tpaConfigId:c.string().optional(),type:c.string().optional()}},{name:"schema_update_tpa_response_data_child",tier:"catalog",description:`
|
|
1319
1279
|
Changes apply immediately; use schema_undo to revert the last change. Ops:
|
|
1320
|
-
- op=UPDATE_TPA_RESPONSE_DATA_CHILD (req: dataUniqueId, responseBranch, tpaConfigId) [pre-type-system-refactor only]`,ops:{UPDATE_TPA_RESPONSE_DATA_CHILD:"UPDATE_TPA_RESPONSE_DATA_CHILD"},inputSchema:{dataUniqueId:c.string().optional(),defaultValue:c.string().optional(),itemType:c.string().optional(),name:c.string().optional(),required:c.boolean().optional(),responseBranch:c.enum(["2xx","4xx","5xx"]).optional(),tpaConfigId:c.string().optional(),type:c.string().optional()}},{name:"
|
|
1321
|
-
Changes apply immediately; use schema_undo to revert the last change. Ops:
|
|
1322
|
-
- op=ADD \u2014 Create read-only views: a saved SELECT exposed as a table of its own, for a joined or aggregated result that more than one place needs. A view holds no data and cannot be written through. SQL that does not analyse is rejected rather than stored.
|
|
1323
|
-
- op=ANALYZE_SQL \u2014 Dry-run a view definition: reports the columns the SQL would expose and every problem found in it, without changing anything. Call this while writing the SQL: creating or updating a view refuses a definition that does not analyse.
|
|
1324
|
-
- op=DELETE \u2014 Delete views by display name. No stored data is lost -- a view holds none -- but anything bound to its columns breaks. Refused while another view still reads one of them.
|
|
1325
|
-
- op=GET_INFOS \u2014 Each view's SQL plus the columns it exposes, derived by analysing that SQL -- a view stores a definition, not a column list, so this is the only place its shape is reported. Reading a view here is what lets you edit it.
|
|
1326
|
-
- op=UPDATE \u2014 Omitted fields keep their current value. Replacing the SQL replaces the columns the view exposes, so anything bound to a column that disappears breaks; SQL that does not analyse is rejected rather than stored.`,ops:{ADD:"ADD_VIEWS",ANALYZE_SQL:"ANALYZE_VIEW_SQL",DELETE:"DELETE_VIEWS",GET_INFOS:"GET_VIEWS_INFO",UPDATE:"UPDATE_VIEWS"},inputSchema:{items:c.array(c.any()).optional(),sql:c.string().optional(),viewDisplayName:c.string().optional(),viewDisplayNames:c.array(c.any()).optional()}},{name:"schema_zai_config",tier:"catalog",description:`
|
|
1280
|
+
- op=UPDATE_TPA_RESPONSE_DATA_CHILD (req: dataUniqueId, responseBranch, tpaConfigId) [pre-type-system-refactor only]`,ops:{UPDATE_TPA_RESPONSE_DATA_CHILD:"UPDATE_TPA_RESPONSE_DATA_CHILD"},inputSchema:{dataUniqueId:c.string().optional(),defaultValue:c.string().optional(),itemType:c.string().optional(),name:c.string().optional(),required:c.boolean().optional(),responseBranch:c.enum(["2xx","4xx","5xx"]).optional(),tpaConfigId:c.string().optional(),type:c.string().optional()}},{name:"schema_zai_config",tier:"catalog",description:`
|
|
1327
1281
|
Changes apply immediately; use schema_undo to revert the last change. Ops:
|
|
1328
1282
|
- op=ADD_ZAI_CONFIGS \u2014 Result echoes each new agent's config id.
|
|
1329
1283
|
- op=ADD_ZAI_CONFIG_API_CONTEXTS (req: apiIds, configId) [post-type-system-refactor only]
|