Release 2.7.0: executable handbooks and native user-site workflows
This commit is contained in:
1 parent
aa0c4d0f55
commit
d9aef957f7
562 files changed
+21064
-20387
No files matched your search
@@ -0,0 +1,24 @@
|
||||
---
|
||||
markup: occlusion
|
||||
title: Native administration resource
|
||||
import:
|
||||
table: lib/table.mq.md
|
||||
---
|
||||
|
||||
This single-purpose resource enables the existing native administration surface on a prepared app. It does not construct a page or configure unrelated middleware. Attach real authentication afterwards so the native runtime adds its administration gate before listening. Custom Document desks remain ordinary declared routes and do not need this switch.
|
||||
|
||||
## enable
|
||||
|
||||
| 参数 | 类型 | 默认 | 说明 |
|
||||
|---|---|---|---|
|
||||
| app | map | required | Prepared application retaining its native admin_prefix, normally /admin |
|
||||
|
||||
| 返回 | 类型 | 说明 |
|
||||
|---|---|---|
|
||||
| result | map | Updated app with native administration enabled; no listener starts |
|
||||
|
||||
Use `app` before attaching authentication and before listen. This pure resource composition retains the app's database, discovered Documents and other bindings, and changes only the existing native admin flag. The runtime lists only the business tables associated with explicitly mounted forms, shows up to 100 current rows per table, and links to those actual form resources. It does not enumerate unrelated credential/session tables or expose arbitrary SQL. The native renderer owns this landing page and its reserved route namespace. It does not create a second application configuration API.
|
||||
|
||||
Authentication must be configured separately. When it is attached after enabling this surface, the existing native admin policy installs the default administration gate. The caller keeps the returned application and verifies both denied and accepted requests. Enabling a UI is not proof that credentials or database access have been authorized; the explicit server workflow supplies those dependencies.
|
||||
|
||||
Return *[Enable only the native administration surface](table.put(in=`app`, at="admin", value=True))*.
|
||||
@@ -0,0 +1,28 @@
|
||||
---
|
||||
markup: occlusion
|
||||
title: Read-only JSON query routes for a database-backed site
|
||||
import:
|
||||
plugin: lib/plugin.mq.md
|
||||
---
|
||||
|
||||
Use this leaf when a prepared web application needs native read-only database JSON routes. Database connections remain owned by db.mq.md; request tenant selection remains owned by the security tenant resource. This module only binds an explicit query table before listening. It does not introduce a second application configuration language.
|
||||
|
||||
## mount
|
||||
|
||||
| 参数 | 类型 | 默认 | 说明 |
|
||||
|---|---|---|---|
|
||||
| app | any | required | Prepared application with its database resource |
|
||||
| routes | any | required | GFM rows with path, method, table, order, limit and optional tenant_scope |
|
||||
|
||||
| 返回 | 类型 | 说明 |
|
||||
|---|---|---|
|
||||
| result | any | Updated app containing the selected JSON query route set |
|
||||
|
||||
Use `app` and `routes` with plugin. The table uses site-relative paths, database table names, a native order expression and row limits. This binding replaces the application's JSON query route set; supply all desired query routes in one readable table. Other middleware settings are retained. Keep the returned app for subsequent resource bindings and listen.
|
||||
|
||||
Set tenant_scope to True only together with tenant.attach from ext/security/tenant.mq.md. With tenant resolution enabled, a scoped query requires a resolved tenant and adds an equality filter on its configured column. Tenant selectors do not authenticate users or prove membership. Protect private data through real authentication and trusted tenant selection; a query-string demonstration deliberately permits choosing either demo tenant.
|
||||
|
||||
The native route surface selects rows and returns a JSON object with a rows list; it does not implement arbitrary SQL, write endpoints or form submission. Reading this source grants no network access and mounting does not listen. Extend native query behavior in the existing web middleware implementation, keep database policy visible in the route table, and test missing-tenant as well as cross-tenant responses.
|
||||
|
||||
We **native = [Resolve the maintained database/web boundary](plugin.native_path(name="web"))** and **[Load its existing route implementation](plugin.load(path=`native`))**.
|
||||
Return *[Bind this explicit JSON query route table](web_app_middleware(app=`app`, cors=None, security=None, compress=None, body_limit=None, json_routes=`routes`, access_log=None, cache_control=None, proxy=None, invoke=None))*.
|
||||
@@ -26,6 +26,51 @@ We retain **`p` = [Locate the installed native plugin](plugin.native_path(name="
|
||||
We **[End this run with the selected exit status](sys.exit(code=1))**.
|
||||
Return *None*.
|
||||
|
||||
|
||||
## reference
|
||||
|
||||
| 参数 | 类型 | 默认 | 说明 |
|
||||
|---|---|---|---|
|
||||
| id | text | required | Exact id explicitly registered with mount |
|
||||
|
||||
| 返回 | 类型 | 说明 |
|
||||
|---|---|---|
|
||||
| result | map | Pure form_ref Resource for component.resource |
|
||||
|
||||
Use `id` to reference the same mounted form that handles submissions. This constructor does not create a form, load a plugin or register a route. Serving resolves the id after preparing the request's actual CSRF token and return path. An unknown id is a real request error; it cannot become an empty successful form.
|
||||
|
||||
The form's field/rule resource remains the single source for rendering and validation. Error responses retain the current CSRF token so the user can correct a field and resubmit. Authorization belongs to mount's optional role gate and the server's authentication policy, not the visibility of this node.
|
||||
|
||||
`resource` =
|
||||
|
||||
| _type | id |
|
||||
|---|---|
|
||||
| form_ref | `id` |
|
||||
|
||||
Return *resource* for explicit placement in the existing View schema.
|
||||
|
||||
## mount
|
||||
|
||||
| 参数 | 类型 | 默认 | 说明 |
|
||||
|---|---|---|---|
|
||||
| app | any | required | Prepared web application with its actual database |
|
||||
| id | text | required | Explicit system-form identifier used by reference |
|
||||
| form | any | required | Form resource containing fields, rules and submission action |
|
||||
| roles | any | None | None keeps public form behavior; otherwise gate the actual system form route |
|
||||
|
||||
| 返回 | 类型 | 说明 |
|
||||
|---|---|---|
|
||||
| result | any | Updated app with this form and optional server role gate |
|
||||
|
||||
Use `app`, `id`, `form` and `roles`=None before listening. Keep the returned app. The native system form route uses the same resource to validate and submit; component.resource only places its reference in the readable page layout. No user route is implicitly registered. System endpoints remain visible through web.inspect.
|
||||
|
||||
For a private form, provide roles explicitly so the actual /_form/id GET and POST path is gated as well as any containing page. Merely hiding a form or gating its presentation URL is insufficient. Configure authentication separately. A public creation example can retain roles=None. Existing sessions must submit the correct CSRF token; field-validation retries keep that token in the response.
|
||||
|
||||
We **[Load the existing form implementation](_load())** and **mounted = [Bind this form to its explicit system id](web_app_mount_form(app=`app`, id=`id`, form=`form`))**.
|
||||
1. `roles` != None
|
||||
We **mounted = [Protect the actual system form endpoint](web_app_gate(app=`mounted`, path="/_form/" + id, roles=`roles`, permissions="", match="exact", on_deny="redirect", exclude=None))**.
|
||||
Return *mounted* after the explicit form resource and policy are attached.
|
||||
|
||||
# form
|
||||
|
||||
| 参数 | 类型 | 默认 | 说明 |
|
||||
|
||||
+13
-4
@@ -6,12 +6,18 @@ import:
|
||||
db_api: ext/data/db.mq.md
|
||||
fs: lib/fs.mq.md
|
||||
path: lib/path.mq.md
|
||||
result: lib/result.mq.md
|
||||
---
|
||||
|
||||
Start here when a program needs persistent records, short-lived values, object storage or forms.
|
||||
The public resource files remain the implementation: [database](db.mq.md) owns schemas and
|
||||
transactions, [cache](cache.mq.md) owns expiry, [storage](storage.mq.md) owns blobs and upload
|
||||
validation, and [forms](form.mq.md) separates validation, rendering and submission.
|
||||
[View queries](view.mq.md) (中文:[视图](视图.mq.md)) retain current records inside recursive View nodes.
|
||||
[Native administration](admin.mq.md) exposes only mounted forms and their business tables.
|
||||
中文作者可以使用[表单](表单.mq.md)构造、定义字段规则、引用与挂载资源,使用[后台](后台.mq.md)启用同一个原生管理入口。
|
||||
[JSON query routes](api.mq.md) bind read-only database responses to a prepared site;
|
||||
pair tenant-scoped queries with the explicit security tenant resource.
|
||||
|
||||
These modules use the native web plugin. In this source checkout build it with
|
||||
scripts/build-web-plugin.sh; installed packages follow the web package installation route.
|
||||
@@ -22,7 +28,7 @@ Neither example needs a cloud account, credentials or an external service.
|
||||
|
||||
```sh
|
||||
marqdo call ext/data/index.mq.md memory_cache 'key="manual"' 'value="ready"' --effects plugin --json
|
||||
marqdo call ext/data/index.mq.md transaction_roundtrip "root=\"$MQ_WORK\"" --effects plugin,fs.write --fs-root "$MQ_WORK" --json
|
||||
marqdo call ext/data/index.mq.md transaction_roundtrip --effects plugin,fs.write --fs-root "$MQ_WORK" --json
|
||||
```
|
||||
|
||||
A resource constructor creates an object; its methods need that actual receiver. Use the free
|
||||
@@ -62,19 +68,22 @@ so another operation does not inherit it. Return *stored* as observed, including
|
||||
|
||||
| 参数 | 类型 | 默认 | 说明 |
|
||||
|---|---|---|---|
|
||||
| root | text | required | Absolute disposable root, matching --fs-root; native resource URLs need an absolute path |
|
||||
| root | text | "." | Expected filesystem root; the default uses the actual --fs-root context |
|
||||
|
||||
| 返回 | 类型 | 说明 |
|
||||
|---|---|---|
|
||||
| result | map | The committed row list and native commit/rollback outcomes; the second insert is rolled back |
|
||||
|
||||
Use the absolute `root` supplied for --fs-root. This isolated-file example shows the whole ownership sequence: create a schema, begin a transaction,
|
||||
Use `root`="." for the actual --fs-root context, or pass the same absolute root explicitly. This isolated-file example shows the whole ownership sequence: create a schema, begin a transaction,
|
||||
write through its receiver, finish it, and read outside it. A second transaction is explicitly
|
||||
rolled back. The standalone txn constructor wraps the actual native identifier and connection URL;
|
||||
it does not begin another transaction or invent an identifier.
|
||||
|
||||
We **actual_root = [Resolve the actual granted filesystem root](fs.resolve(path="."))** and **expected_root = [Check the optional explicit root](fs.resolve(path=`root`))**.
|
||||
1. `actual_root` != `expected_root`
|
||||
Return *[Keep an inconsistent resource root explicit](result.error(code="data.root", message="root must match the granted filesystem root", operation="transaction_roundtrip"))*.
|
||||
First **directory = [Create an owned temporary directory under the granted root](fs.temp_dir(prefix="data-manual"))**.
|
||||
The filesystem helper returns a root-relative name. We retain **work_dir = [Resolve that owned name against the explicit root](path.join(a=`root`, b=`directory`))**
|
||||
The filesystem helper returns a root-relative name. We retain **work_dir = [Resolve the owned name through the actual filesystem context](fs.resolve(path=`directory`))**
|
||||
and **[Check that this absolute directory is inside the granted filesystem root](fs.stat(path=`work_dir`))**
|
||||
before giving any path to the native database. We select **database_path = [Choose the SQLite file inside that directory](path.join(a=`work_dir`, b="manual.db"))**
|
||||
and select **database_url = "sqlite:" + database_path** before creating
|
||||
|
||||
@@ -0,0 +1,40 @@
|
||||
---
|
||||
markup: occlusion
|
||||
title: Request-time database View resources
|
||||
---
|
||||
|
||||
Use this single-file resource handbook when a recursively composed page needs current database rows on each request. Construction is pure: it records a query without connecting, selecting or rendering HTML. Place the result in component.resource and retain view: main for startup layout assembly. The application supplies its actual database resource when serving.
|
||||
|
||||
Do not combine view: main with automatic data_source metadata. Ordinary Documents keep that metadata path; explicit View pages use this query Resource instead. A missing database, invalid condition or backend failure remains a request error, never a fabricated empty list. See [the request-resource design](../../doc/design/web-view-resources.md).
|
||||
|
||||
## query
|
||||
|
||||
| 参数 | 类型 | 默认 | 说明 |
|
||||
|---|---|---|---|
|
||||
| source | text | required | Existing table on the serving application's database |
|
||||
| where | any | None | Native condition map or list; route placeholders resolve from actual request params |
|
||||
| order | text | "" | Native database ordering, such as -created_at |
|
||||
| limit | number | 50 | Integer from 1 through 1000 |
|
||||
| detail | bool | False | False renders cards; True renders the first matching full article |
|
||||
| link_prefix | text | "/post/" | Site-relative prefix applied to row slugs, or empty for no prefix |
|
||||
| tenant_scope | bool | False | Require an attached tenant policy and current tenant filter |
|
||||
|
||||
| 返回 | 类型 | 说明 |
|
||||
|---|---|---|
|
||||
| result | map | Pure data_query Resource; no query has executed yet |
|
||||
|
||||
Use `source`, `where`=None, `order`="", `limit`=50, `detail`=False, `link_prefix`="/post/" and `tenant_scope`=False. The native renderer validates the contract before listening, then selects current records for each request. Card titles and summaries are escaped; article content uses the existing Markdown renderer. Detail mode prefers the complete body/content even when a summary exists.
|
||||
|
||||
Rows follow the current Document convention: title, slug or href, summary, body or content, optional created_at/meta and tag. This fixed projection preserves the native card/article surface without restoring a private binding-table DSL. Layout remains in parent components; this resource only supplies one dynamic content region. For a different domain projection, keep a separate documented resource rather than passing arbitrary page configuration.
|
||||
|
||||
Conditions are copied before replacing route placeholders, so one request cannot mutate another's retained definition. Path parameters take precedence over query keys. A requested tenant scope requires actual tenant configuration and context; direct selectors do not prove user membership. Link visibility and data filtering do not replace authentication or server authorization.
|
||||
|
||||
This constructor needs no effects. Serving needs the actual web/database plugin and the launcher grants. Rendering the Resource offline without request context reports that requirement explicitly. Reading this file does not authorize a query, write or network listener.
|
||||
|
||||
`resource` =
|
||||
|
||||
| _type | source | where | order | limit | detail | link_prefix | tenant_scope |
|
||||
|---|---|---|---|---|---|---|---|
|
||||
| data_query | `source` | `where` | `order` | `limit` | `detail` | `link_prefix` | `tenant_scope` |
|
||||
|
||||
Once its intended request behavior is explicit, return *resource* for placement in a View resource node.
|
||||
@@ -0,0 +1,24 @@
|
||||
---
|
||||
markup: occlusion
|
||||
title: 原生后台资源
|
||||
import:
|
||||
admin: ext/data/admin.mq.md
|
||||
---
|
||||
|
||||
本文件与 admin.mq.md 的原生后台开关对应。自定义后台 Document 继续显式声明自己的路由;这里仅启用已有的原生后台。先准备应用,再启用后台、附加鉴权,最后监听。它不承担任意页面配置或数据库管理语言。
|
||||
|
||||
## 启用
|
||||
|
||||
| 参数 | 类型 | 默认 | 说明 |
|
||||
|---|---|---|---|
|
||||
| 应用 | map | 必填 | 准备站点返回的应用,保留数据库和后台路径 |
|
||||
|
||||
| 返回 | 类型 | 说明 |
|
||||
|---|---|---|
|
||||
| 结果 | map | 只改变原生后台标志的新应用;未开始监听 |
|
||||
|
||||
输入`应用`,本操作是纯资源组合,无需插件,不创建路由服务器或新数据库。保留返回的新应用后再附加鉴权,使原生策略安装默认后台门禁。后台只列显式挂载表单关联的业务表,每表展示至多 100 条当前记录,并链接到真实表单。
|
||||
|
||||
它不枚举其他凭据、会话表,也不开放任意 SQL。启用展示能力不证明用户已经认证,应验证匿名拒绝与已登录访问两个方向。自定义内容布局继续由 View 与 Document 负责;不要为后台添加新的通用配置袋。
|
||||
|
||||
配置后返回 *[启用已有的原生后台能力](admin.enable(app=`应用`))*。
|
||||
@@ -0,0 +1,110 @@
|
||||
---
|
||||
markup: occlusion
|
||||
title: 表单资源:构造、规则、引用与挂载
|
||||
import:
|
||||
form: ext/data/form.mq.md
|
||||
---
|
||||
|
||||
本文件对应英文 form.mq.md 的服务端装配工作流,中文作者直接调用这些具名函数。独立校验、离线表单渲染与直接提交仍使用英文文件对象的 validate、render、submit,不把页面引用当成直接写入工具。字段与规则同属一个原生表单资源,页面只安放引用,服务入口显式挂载它。构造、字段更新、校验与提交需要 plugin;引用是纯计算。以下示例只构造引用,不打开数据库或提交记录。
|
||||
|
||||
```sh
|
||||
marqdo call ext/data/表单.mq.md 引用 '标识="article"' --json
|
||||
```
|
||||
|
||||
准备真实表单时按构造、字段、规则、文案的顺序保留每次返回的新资源,再挂载到已准备的应用。实际处理请求的是 /_form/标识 系统地址。只保护展示页面不能保护提交入口;私有表单应给挂载指定角色,并另行配置鉴权。
|
||||
|
||||
## 构造
|
||||
|
||||
| 参数 | 类型 | 默认 | 说明 |
|
||||
|---|---|---|---|
|
||||
| 表 | text | 必填 | 已存在的数据库业务表名 |
|
||||
| 动作 | text | "insert" | 原生提交动作,例如 insert 或 update |
|
||||
| 标识 | any | None | update 使用的记录标识;插入通常不指定 |
|
||||
|
||||
| 返回 | 类型 | 说明 |
|
||||
|---|---|---|
|
||||
| 结果 | any | 尚未提交的原生表单资源 |
|
||||
|
||||
输入`表`、`动作`="insert"与`标识`=None,调用需要 plugin。这里只创建表单资源,不建表、不插入记录,也不验证一次用户请求。继续调用字段与规则保留完整定义;实际数据库来自服务入口的应用资源。缺少原生插件或不支持的动作应保留真实诊断。
|
||||
|
||||
构造完成后返回 *[创建指定业务表的原生表单](form.form(table=`表`, action=`动作`, id=`标识`))*。
|
||||
|
||||
## 字段
|
||||
|
||||
| 参数 | 类型 | 默认 | 说明 |
|
||||
|---|---|---|---|
|
||||
| 资源 | any | 必填 | 构造返回的实际表单资源 |
|
||||
| 定义 | any | 必填 | name、label、type、required 等字段记录表 |
|
||||
|
||||
| 返回 | 类型 | 说明 |
|
||||
|---|---|---|
|
||||
| 结果 | any | 带字段定义的新表单资源 |
|
||||
|
||||
输入`资源`和`定义`。name 应对应业务表字段;label 是展示文案,type 选择原生输入类型,required 使用布尔值。记录表用 @ 首列保持逐行结构。更新需要 plugin,返回值供规则或挂载继续使用;不提交用户输入,也不改变数据库结构。
|
||||
|
||||
完成定义后返回 *[将字段绑定到同一个表单](> `资源`.fields fields=`定义`)*。
|
||||
|
||||
## 规则
|
||||
|
||||
| 参数 | 类型 | 默认 | 说明 |
|
||||
|---|---|---|---|
|
||||
| 资源 | any | 必填 | 已有字段定义的实际表单资源 |
|
||||
| 定义 | any | 必填 | field、rule、message 记录;例如 required 与 max:120 |
|
||||
|
||||
| 返回 | 类型 | 说明 |
|
||||
|---|---|---|
|
||||
| 结果 | any | 带原生校验规则的新表单资源 |
|
||||
|
||||
输入`资源`和`定义`。规则按字段名关联,message 是拒绝输入时显示的原因。服务端仍执行相同规则,不能只依赖浏览器必填属性。此步需要 plugin,但不会尝试插入或更新记录。保留返回值,避免挂载未携带新规则的旧资源。
|
||||
|
||||
规则明确后返回 *[绑定实际提交使用的校验规则](> `资源`.rules rules=`定义`)*。
|
||||
|
||||
## 文案
|
||||
|
||||
| 参数 | 类型 | 默认 | 说明 |
|
||||
|---|---|---|---|
|
||||
| 资源 | any | 必填 | 保留字段和规则的实际表单资源 |
|
||||
| 提交 | text | "提交" | 提交按钮文字 |
|
||||
| 取消 | text | "取消" | 取消链接文字 |
|
||||
| 返回地址 | text | "" | 取消目标;也是原生成功提交返回地址 |
|
||||
|
||||
| 返回 | 类型 | 说明 |
|
||||
|---|---|---|
|
||||
| 结果 | any | 带按钮文字和返回目标的新资源 |
|
||||
|
||||
输入`资源`、`提交`="提交"、`取消`="取消"和`返回地址`="",调用需要 plugin。文案是纯文本,不承载 HTML。显式返回地址用于成功后的跳转;没有指定时由原生请求返回路径决定。设置按钮文案本身既不授权提交,也不改变字段校验规则。
|
||||
|
||||
配置后返回 *[保留提交、取消与成功返回目标](> `资源`.labels submit=`提交` cancel=`取消` cancel_href=`返回地址`)*。
|
||||
|
||||
## 引用
|
||||
|
||||
| 参数 | 类型 | 默认 | 说明 |
|
||||
|---|---|---|---|
|
||||
| 标识 | text | 必填 | 服务入口通过挂载显式注册的系统表单标识 |
|
||||
|
||||
| 返回 | 类型 | 说明 |
|
||||
|---|---|---|
|
||||
| 结果 | map | 供组件请求资源节点安放的 form_ref 描述 |
|
||||
|
||||
使用`标识`引用实际挂载的表单。构造无需任何副作用,不加载插件、不注册路由,也不伪造字段或 CSRF。请求时才由原生服务读取当前会话、返回路径和同一份字段规则;未挂载的标识保留错误,不能变成空的成功表单。
|
||||
|
||||
声明后返回 *[引用请求时的同一个表单](form.reference(id=`标识`))*。
|
||||
|
||||
## 挂载
|
||||
|
||||
| 参数 | 类型 | 默认 | 说明 |
|
||||
|---|---|---|---|
|
||||
| 应用 | any | 必填 | 已准备、保留数据库与路由上下文的应用 |
|
||||
| 标识 | text | 必填 | 页面引用与系统 /_form/ 路径使用的标识 |
|
||||
| 资源 | any | 必填 | 保留字段、规则和文案的实际表单 |
|
||||
| 角色 | any | None | None 保持公开行为;否则保护实际系统表单 GET 与 POST |
|
||||
|
||||
| 返回 | 类型 | 说明 |
|
||||
|---|---|---|
|
||||
| 结果 | any | 挂载资源与可选角色门禁后的新应用 |
|
||||
|
||||
使用`应用`、`标识`、`资源`与`角色`=None,在监听前授予 plugin 并保留返回的应用。挂载绑定的是明确的系统地址,不暗中注册业务页面。私有表单应指定允许的角色并配置鉴权;仅隐藏控件或保护展示页不足以保护提交。
|
||||
|
||||
会话存在时提交必须携带真实 CSRF,字段失败的重试页面仍保留该令牌。系统路径可通过网页检视观察,但检视不能证明数据库可写或当前用户获准提交。公开示例可以保持角色为空,生产策略由调用者明确决定。
|
||||
|
||||
准备就绪后返回 *[绑定实际表单处理器及其访问策略](form.mount(app=`应用`, id=`标识`, form=`资源`, roles=`角色`))*。
|
||||
@@ -0,0 +1,40 @@
|
||||
---
|
||||
markup: occlusion
|
||||
title: 请求期间查询数据库的视图资源
|
||||
---
|
||||
|
||||
本文件是单文件资源手册。递归页面需要随请求变化的数据库记录时,构造这里的查询资源,再放入组件的资源节点。构造本身是纯计算,不连接数据库,也不生成 HTML;实际查询使用监听应用绑定的数据资源。
|
||||
|
||||
view: main 仍在启动时装配结构,不能混用自动 data_source 元数据。普通文档可继续使用元数据绑定;显式 View 用本资源表达动态内容。缺少数据库、条件错误或后端故障都保留请求诊断,不伪造空列表。
|
||||
|
||||
## 查询
|
||||
|
||||
| 参数 | 类型 | 默认 | 说明 |
|
||||
|---|---|---|---|
|
||||
| 源 | text | 必填 | 监听应用数据库中已有的业务表 |
|
||||
| 条件 | any | None | 原生条件记录或列表;路径占位来自实际请求参数 |
|
||||
| 排序 | text | "" | 数据库排序,例如 -created_at |
|
||||
| 上限 | number | 50 | 1 至 1000 之间的整数 |
|
||||
| 详情 | bool | False | False 显示卡片,True 显示首条完整文章 |
|
||||
| 链接前缀 | text | "/post/" | 加到短链前的站内路径前缀 |
|
||||
| 租户作用域 | bool | False | 要求显式租户策略及实际租户上下文 |
|
||||
|
||||
| 返回 | 类型 | 说明 |
|
||||
|---|---|---|
|
||||
| 结果 | map | 尚未查询的 data_query 资源,可放入资源节点 |
|
||||
|
||||
使用`源`、`条件`=None、`排序`=""、`上限`=50、`详情`=False、`链接前缀`="/post/"与`租户作用域`=False。服务器先检查资源契约,再在每个请求中查询当前记录。卡片标题与摘要经过转义,完整文章使用已有 Markdown 渲染器;有摘要时,详情仍应显示完整正文,空正文也不会被摘要替换。
|
||||
|
||||
返回记录沿用文档的数据约定:title、slug 或 href、summary、body 或 content,以及可选的 created_at/meta 与 tag。父组件继续决定布局,本资源只承担一个动态内容区域。它不恢复旧的页面绑定表,也不接受任意页面配置。需要其他领域投影时,应另立职责清楚的资源。
|
||||
|
||||
每次请求先复制条件,再替换实际路径参数,避免污染启动时保留的定义。路径参数优先于同名查询参数。租户作用域要求已有租户策略和已解析租户;请求中的选择值不证明用户属于该租户,数据过滤也不能替代鉴权。
|
||||
|
||||
构造不需要副作用权限;服务实际使用插件和监听入口的授权。离线渲染缺少请求上下文时明确报错,不声称已执行查询。阅读源码不会授权数据库访问、写入或启动网络监听。
|
||||
|
||||
`资源` =
|
||||
|
||||
| _type | source | where | order | limit | detail | link_prefix | tenant_scope |
|
||||
|---|---|---|---|---|---|---|---|
|
||||
| data_query | `源` | `条件` | `排序` | `上限` | `详情` | `链接前缀` | `租户作用域` |
|
||||
|
||||
请求行为交代清楚后,返回 *资源*,交给组件资源节点安放。
|
||||
Reference in new issue
Block a user