@lowdefy/docs-content 7.0.0 → 7.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/content/actions/login.md +1 -1
- package/content/actions/posthoginit.md +1 -1
- package/content/actions/resetvalidation.md +2 -0
- package/content/actions/setstate.md +0 -2
- package/content/actions/validate.md +1 -1
- package/content/adapter-reference/mongodbauthadapter.md +2 -2
- package/content/agents/agents-introduction.md +41 -1
- package/content/callback-reference/auth0logoutcallback.md +1 -1
- package/content/concepts/ai-agent-docs.md +118 -110
- package/content/concepts/blocks.md +1 -1
- package/content/concepts/connections-and-requests.md +8 -8
- package/content/concepts/custom-html.md +1 -1
- package/content/concepts/dynamic-page-content.md +26 -15
- package/content/concepts/events-and-actions.md +24 -0
- package/content/concepts/logger.md +1 -1
- package/content/concepts/lowdefy-api.md +81 -14
- package/content/concepts/lowdefy-schema.md +11 -0
- package/content/concepts/mobile-apps.md +110 -0
- package/content/concepts/page-and-app-state.md +2 -2
- package/content/concepts/theming.md +1 -1
- package/content/connections/axioshttp.md +1 -1
- package/content/connections/mongodb.md +22 -6
- package/content/controls/reject.md +2 -2
- package/content/deployment/vercel.md +1 -1
- package/content/display-blocks/aggrid.md +4 -4
- package/content/display-blocks/search.md +86 -2
- package/content/display-blocks/table.md +154 -9
- package/content/input-blocks/tableinput.md +12 -4
- package/content/input-blocks/tiptapinput.md +3 -2
- package/content/input-blocks/tiptapmentioninput.md +3 -2
- package/content/migration/v3-to-v4.md +2 -2
- package/content/operators/_base64.md +2 -2
- package/content/operators/_log.md +1 -1
- package/content/operators/_ref.md +6 -6
- package/content/plugins/plugins-introduction.md +13 -0
- package/content/plugins/posthog.md +1 -1
- package/content/provider-reference/auth-js-providers.md +2 -2
- package/content/provider-reference/openidconnectprovider.md +1 -1
- package/content/reference/cli.md +164 -0
- package/content/testing/config-tests.md +4 -4
- package/content/testing/journey-data-sets.md +21 -21
- package/content/tutorial/tutorial-create-page.md +1 -1
- package/content/tutorial/tutorial-requests-api.md +1 -1
- package/content/tutorial/tutorial-requests-sql.md +1 -1
- package/content/tutorial/tutorial-start.md +1 -1
- package/content/user-authentication/auth-configuration.md +9 -9
- package/content/user-authentication/auth-steps.md +4 -2
- package/content/user-authentication/organizations.md +57 -0
- package/content/user-authentication/protected-pages-apis.md +4 -4
- package/content/user-authentication/roles.md +2 -2
- package/content/user-authentication/user-object.md +1 -1
- package/content/websockets/websocket-publish.md +1 -1
- package/content/websockets/websockets-introduction.md +1 -1
- package/hazards.json +0 -12
- package/index.json +365 -117
- package/package.json +3 -2
- package/scripts/collectImportedFiles.js +80 -0
- package/scripts/recordSourceHashes.js +9 -6
- package/content/learn/showcase.md +0 -8
|
@@ -28,11 +28,14 @@ An app that sets nothing gets `pinned` with one auto-seeded organization, invite
|
|
|
28
28
|
| `create` | `auto` \| `operator` | **tenant only** | `tenant` → `auto` | How a tenant organization comes into being: `auto` mints one for a user at first session; `operator` leaves creation to your own config (the `CreateOrganization` step). |
|
|
29
29
|
| `invitationExpiresIn` | integer (seconds, min 60) | both | `172800` (48h) | How long an invitation stays acceptable. Re-sending an invitation refreshes its expiry. |
|
|
30
30
|
| `membershipLimit` | integer (min 1) | both | `1000000` (effectively open) | The most members one organization may have. Once an organization has this many, accepting an invitation and adding a member are refused (a 403). Set it to cap organization size, for example per tenant. It is also the default page size of `ListMembers` when no `limit` is given. |
|
|
31
|
+
| `invitationLimit` | integer (min 1) | both | `1000000` (effectively open) | The most open invitations one organization may have. Once an organization has this many pending, unexpired invitations, inviting another is refused (a 403 with code `INVITATION_LIMIT_REACHED`). Expired, accepted and cancelled invitations don't count, and re-inviting an address replaces its open invitation rather than adding one. |
|
|
32
|
+
| `creatorAppRoles` | array of role ids | both | `[]` | App roles the owner of a new organization gets on their membership. See [App roles for a new organization's owner](#app-roles-for-a-new-organizations-owner). |
|
|
31
33
|
|
|
32
34
|
The build cross-checks these, and the errors are worth knowing before you hit them:
|
|
33
35
|
|
|
34
36
|
- **`org` is required under `pinned`** and **rejected under `tenant`** — under `tenant` there is no single organization to pin; organizations are created per user.
|
|
35
37
|
- **`create` is rejected under `pinned`** — the active organization is ensured at startup, so there is nothing to create on demand.
|
|
38
|
+
- **Every `creatorAppRoles` id must be declared in `auth.roles`**, the same as the roles a page or API gate names.
|
|
36
39
|
- **Renaming `org` strands the existing membership.** The startup ensure is by slug, so changing `org` mints a *fresh* organization rather than renaming the old one, and every existing `member` row still points at the old id. Treat the pinned slug as permanent.
|
|
37
40
|
|
|
38
41
|
Defaults line up with intent: `pinned` defaults to a closed, invite-only internal app; `tenant` defaults to self-serve SaaS (`signup: open`, `create: auto`).
|
|
@@ -54,6 +57,31 @@ An equivalent unique index you created yourself, under any name, is accepted. If
|
|
|
54
57
|
|
|
55
58
|
An invitation is how someone joins an organization, never how a membership changes. Accepting an invitation into an organization you already belong to (you joined another way after it was sent) succeeds and marks the invitation accepted, but leaves your membership exactly as it is: the invitation's role, app roles and attributes are not applied, and no second membership is written. If your session had no active organization, the accepted organization becomes active. To change an existing membership, use the [auth steps](/auth-steps) (`UpdateMemberOrgRole`, `UpdateMemberRoles`, `UpdateMemberAttributes`), which check the caller's authority at the time of the change.
|
|
56
59
|
|
|
60
|
+
### Suspending a member
|
|
61
|
+
|
|
62
|
+
Suspending takes a person out of one organization while keeping their membership on record. `BanUser` bans the login, which covers every organization and every app sharing the auth database. `RemoveMember` deletes the membership, so the app's own queries stop finding the person and the roles they held. A suspended membership keeps its row, its `appRoles`, org tier and attributes, but admits nobody. Lowdefy treats it as no membership everywhere it decides who the caller is:
|
|
63
|
+
|
|
64
|
+
- The person's session resolves unauthenticated (`_user` is `null`), so protected pages, requests and API endpoints give them what they give a non-member. Their MCP access tokens and [member tokens](/mcp-oauth#tokens-for-scripts) stop working, and an MCP client's refresh is refused.
|
|
65
|
+
- Signing in to a `pinned` app is refused with `MEMBERSHIP_REQUIRED`, the code a refused non-member gets. Under `signup: open` they are not joined again, and a pending invitation does not let them in either.
|
|
66
|
+
- Under `tenant`, sign-in makes the oldest organization they are not suspended in active. With none, sign-in goes as it does for someone with no membership, so under `create: auto` they get a new organization of their own. `ListOrganizations` leaves the organization out, and `SetActiveOrganization` and the other organization endpoints refuse it as they refuse a non-member.
|
|
67
|
+
- A suspended membership grants no [auth-step](/auth-steps) authority. Administrators can still manage the suspended member, with `UnsuspendMember`, `RemoveMember`, `BanUser` and the other steps.
|
|
68
|
+
- Accepting an invitation does not lift a suspension or make the organization active (see [Invitations for existing members](#invitations-for-existing-members)).
|
|
69
|
+
|
|
70
|
+
The `SuspendMember` and `UnsuspendMember` auth steps set and lift it, and need the `member: [suspend]` permission, which `owner` and `admin` hold. An `owner` cannot be suspended: change their org tier with `UpdateMemberOrgRole` first, which only an owner can do. A suspended member cannot be made an `owner` either, so every owner of an organization is a member who can sign in.
|
|
71
|
+
|
|
72
|
+
```yaml
|
|
73
|
+
id: suspend-member
|
|
74
|
+
type: Api
|
|
75
|
+
routine:
|
|
76
|
+
- id: suspend
|
|
77
|
+
type: SuspendMember
|
|
78
|
+
properties:
|
|
79
|
+
memberId:
|
|
80
|
+
_payload: memberId
|
|
81
|
+
```
|
|
82
|
+
|
|
83
|
+
The membership row stores it as `suspended: true` in the `user-members` collection. Rows without the field, including every row written before it existed, are not suspended. `ListMembers` returns `suspended` on each row. A report that finds people by role reads suspended members too; to leave them out, filter on `suspended: { $ne: true }`.
|
|
84
|
+
|
|
57
85
|
## The `owner` / `admin` / `member` tier vs app roles
|
|
58
86
|
|
|
59
87
|
A membership carries **two** independent role authorities, and keeping them apart is the whole point:
|
|
@@ -63,6 +91,35 @@ A membership carries **two** independent role authorities, and keeping them apar
|
|
|
63
91
|
|
|
64
92
|
So an app that wants a page for organization administrators does **not** gate it on the `admin` tier — it gates on one of its own app roles, and lets the write authority answer the administration question separately, at the step. See [Roles](/roles) for page and API gating, and [Auth Steps](/auth-steps) for the administration model.
|
|
65
93
|
|
|
94
|
+
### App roles for a new organization's owner
|
|
95
|
+
|
|
96
|
+
When Lowdefy creates an organization and makes someone its owner, that person gets the `owner` tier and, by default, no app roles. In an app whose pages, endpoints and menus are gated on app roles, a new signup's own organization is then closed to them. `creatorAppRoles` lists the app roles the owner gets as well:
|
|
97
|
+
|
|
98
|
+
```yaml
|
|
99
|
+
auth:
|
|
100
|
+
roles:
|
|
101
|
+
- id: billing-admin
|
|
102
|
+
- id: editor
|
|
103
|
+
organizations:
|
|
104
|
+
policy: tenant
|
|
105
|
+
creatorAppRoles:
|
|
106
|
+
- billing-admin
|
|
107
|
+
- editor
|
|
108
|
+
pages:
|
|
109
|
+
roles:
|
|
110
|
+
billing-admin:
|
|
111
|
+
- billing
|
|
112
|
+
```
|
|
113
|
+
|
|
114
|
+
Here a new signup under `create: auto` becomes the `owner` of their own organization with `_user.roles` `[billing-admin, editor]`, so the `billing` page opens for them. The owner's tier stays `owner`; only the membership's `appRoles` is added.
|
|
115
|
+
|
|
116
|
+
It applies wherever Lowdefy itself makes someone the owner of a new organization:
|
|
117
|
+
|
|
118
|
+
- the organization a tenant signup mints under `create: auto`;
|
|
119
|
+
- the [`CreateOrganization`](/auth-steps) step, when it is given a creator (`userId`). An organization created without a creator has no owner to grant roles to.
|
|
120
|
+
|
|
121
|
+
It does not apply to anyone who joins an existing organization: invited members get the app roles their invitation carries, and users auto-joined to a pinned organization under `signup: open` join as `member` with none. Changing the setting leaves existing memberships as they are; use `UpdateMemberRoles` for those.
|
|
122
|
+
|
|
66
123
|
## Bootstrapping the first administrator
|
|
67
124
|
|
|
68
125
|
Nothing grants organization authority implicitly — not even to the first user. On a fresh `pinned` + `invite-only` deployment that is a closed loop: nobody can invite (inviting needs authority nobody holds) and nobody can sign up (the gate admits only members and pending invitees). Breaking the loop is a single invitation document inserted by hand into the `user-invitations` collection, seeded with the `owner` tier. The full recipe — the exact document, why the key must be `_id`, why the role must be `owner`, and how to deliver the accept link — is in the [Auth Upgrade guide](/auth-upgrade#bootstrapping-the-first-administrator).
|
|
@@ -14,7 +14,7 @@ The 404 page (used to indicate that a requested page cannot be found) is always
|
|
|
14
14
|
|
|
15
15
|
###### List specific public pages and APIs:
|
|
16
16
|
```yaml
|
|
17
|
-
lowdefy:
|
|
17
|
+
lowdefy: 7.1.0
|
|
18
18
|
auth:
|
|
19
19
|
pages:
|
|
20
20
|
protected: true
|
|
@@ -31,7 +31,7 @@ auth:
|
|
|
31
31
|
|
|
32
32
|
###### List specific protected pages and APIs:
|
|
33
33
|
```yaml
|
|
34
|
-
lowdefy:
|
|
34
|
+
lowdefy: 7.1.0
|
|
35
35
|
auth:
|
|
36
36
|
pages:
|
|
37
37
|
public: true
|
|
@@ -47,7 +47,7 @@ auth:
|
|
|
47
47
|
|
|
48
48
|
###### Mixed configuration:
|
|
49
49
|
```yaml
|
|
50
|
-
lowdefy:
|
|
50
|
+
lowdefy: 7.1.0
|
|
51
51
|
auth:
|
|
52
52
|
# Protect specific pages while keeping most public
|
|
53
53
|
pages:
|
|
@@ -75,7 +75,7 @@ Exact page IDs still work: `home`, `team-users/users-list`.
|
|
|
75
75
|
|
|
76
76
|
###### Wildcard pattern example:
|
|
77
77
|
```yaml
|
|
78
|
-
lowdefy:
|
|
78
|
+
lowdefy: 7.1.0
|
|
79
79
|
auth:
|
|
80
80
|
pages:
|
|
81
81
|
protected: true
|
|
@@ -7,7 +7,7 @@ Roles are read from the `roles` field on the [user object](/user-object) — an
|
|
|
7
7
|
Declare the role names your app uses in `auth.roles` (id, optional label and description) so tooling can list them:
|
|
8
8
|
|
|
9
9
|
```yaml
|
|
10
|
-
lowdefy:
|
|
10
|
+
lowdefy: 7.1.0
|
|
11
11
|
auth:
|
|
12
12
|
roles:
|
|
13
13
|
- id: user-admin
|
|
@@ -24,7 +24,7 @@ Similarly, the API endpoints that are protected by roles are configured in the `
|
|
|
24
24
|
|
|
25
25
|
###### Protect pages and API endpoints using roles:
|
|
26
26
|
```yaml
|
|
27
|
-
lowdefy:
|
|
27
|
+
lowdefy: 7.1.0
|
|
28
28
|
auth:
|
|
29
29
|
pages:
|
|
30
30
|
public: true
|
|
@@ -24,7 +24,7 @@ Its shape is **fixed**. Unlike the old provider-claim mapping, there is no `user
|
|
|
24
24
|
|
|
25
25
|
> **`_user.role` (singular) carries nothing.** Lowdefy never writes it; it sits one character from `roles`, so gating on `_user.role` is gating on a constant. Read `roles`.
|
|
26
26
|
|
|
27
|
-
A caller resolved from an [API strategy](/auth-configuration) (`apiKey`, `jwt`) sits outside the membership boundary: it carries `id`, `roles`, `attributes` and `auth_method`, but no organization, `name`, `image`, `profile` or `two_factor_enrolled`. A signed-in user who holds only a pending invitation (before they accept
|
|
27
|
+
A caller resolved from an [API strategy](/auth-configuration) (`apiKey`, `jwt`) sits outside the membership boundary: it carries `id`, `roles`, `attributes` and `auth_method`, but no organization, `name`, `image`, `profile` or `two_factor_enrolled`. A signed-in user who holds only a pending invitation (before they accept) is an *awaiting-organization* caller — known to the always-public accept page, refused everywhere else. Under `pinned`, only an invitation to the app's organization counts.
|
|
28
28
|
|
|
29
29
|
## Examples
|
|
30
30
|
|
package/hazards.json
CHANGED
|
@@ -40,17 +40,5 @@
|
|
|
40
40
|
"appliesTo": { "types": [":reject"] },
|
|
41
41
|
"message": ":reject is the routine's reply, not an exception. A :catch never runs for it, :finally does, and :throw is the caught path.",
|
|
42
42
|
"see": "controls/reject"
|
|
43
|
-
},
|
|
44
|
-
{
|
|
45
|
-
"id": "setstate-parent-keeps-hidden-inputs",
|
|
46
|
-
"appliesTo": { "types": ["SetState"] },
|
|
47
|
-
"message": "Setting a parent object to {} or null does not clear an input that is hidden at that moment: the input keeps its last value and writes it back to state when it shows again. Set each input's own key to null instead.",
|
|
48
|
-
"see": "actions/setstate"
|
|
49
|
-
},
|
|
50
|
-
{
|
|
51
|
-
"id": "validate-no-cascade",
|
|
52
|
-
"appliesTo": { "types": ["Validate", "ResetValidation"] },
|
|
53
|
-
"message": "blockIds match exact block IDs and do not cascade to child blocks. A container's ID, or an ID that matches no block, validates nothing and succeeds. Match the inputs instead, for example regex: ^contact\\. for the inputs under contact.",
|
|
54
|
-
"see": "actions/validate"
|
|
55
43
|
}
|
|
56
44
|
]
|