@proveanything/smartlinks 1.11.5 → 1.11.6
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/dist/docs/API_SUMMARY.md +1 -1
- package/dist/docs/app-objects.md +56 -0
- package/docs/API_SUMMARY.md +1 -1
- package/docs/app-objects.md +56 -0
- package/package.json +1 -1
package/dist/docs/API_SUMMARY.md
CHANGED
package/dist/docs/app-objects.md
CHANGED
|
@@ -85,6 +85,7 @@ Zones are **automatically filtered** based on the caller's role:
|
|
|
85
85
|
### Zone Writing Rules
|
|
86
86
|
|
|
87
87
|
- **Non-admin callers** attempting to write to the `admin` zone are silently ignored
|
|
88
|
+
- **Authenticated record owners** can write to `data` and `owner` by default; individual keys can be restricted via the `ownerEdit` app config policy (see [Owner Edit Policy](#owner-edit-policy) below)
|
|
88
89
|
- **Public callers** can write to `data` and `owner` (if visibility allows)
|
|
89
90
|
- **Admins** can write to all three zones
|
|
90
91
|
|
|
@@ -1098,6 +1099,61 @@ The `enforce` values are **merged over** the caller's request body, so you can l
|
|
|
1098
1099
|
|
|
1099
1100
|
---
|
|
1100
1101
|
|
|
1102
|
+
## Owner Edit Policy
|
|
1103
|
+
|
|
1104
|
+
Gives per-zone, field-level control over what an **authenticated record owner** can update via `PATCH /api/v1/public/collection/:collectionId/app/:appId/records/:recordId`.
|
|
1105
|
+
|
|
1106
|
+
Set the policy in the same app config document used for `publicCreate` (stored at `sites/{collectionId}/apps/{appId}`):
|
|
1107
|
+
|
|
1108
|
+
```json
|
|
1109
|
+
{
|
|
1110
|
+
"ownerEdit": {
|
|
1111
|
+
"records": {
|
|
1112
|
+
"data": { "allow": ["paypalEmail"] },
|
|
1113
|
+
"owner": { "allow": ["paypalEmail", "paypalEmailUpdatedAt"] }
|
|
1114
|
+
}
|
|
1115
|
+
}
|
|
1116
|
+
}
|
|
1117
|
+
```
|
|
1118
|
+
|
|
1119
|
+
### Zone visibility and write access
|
|
1120
|
+
|
|
1121
|
+
| Zone | Who can read | Who can write (owner) |
|
|
1122
|
+
|---------|------------------------|----------------------------------------------------------|
|
|
1123
|
+
| `data` | public | Allow-listed keys only (if policy set); all keys if not |
|
|
1124
|
+
| `owner` | owner + admin | Allow-listed keys only (if policy set); all keys if not |
|
|
1125
|
+
| `admin` | admin | Never — admin zone is always immutable to owners |
|
|
1126
|
+
|
|
1127
|
+
### Allow-list semantics
|
|
1128
|
+
|
|
1129
|
+
| Config | Behaviour |
|
|
1130
|
+
|----------------------------|-------------------------------------------------------------------------------|
|
|
1131
|
+
| No `ownerEdit` key | Default-allow — both zones fully writable (no change to existing behaviour) |
|
|
1132
|
+
| `allow` array with keys | Only the listed keys are accepted from the PATCH body; the rest are silently ignored and their existing values preserved |
|
|
1133
|
+
| `allow: []` (empty array) | Zone is effectively read-only for the owner |
|
|
1134
|
+
|
|
1135
|
+
Accepted keys are **merged** onto the existing zone blob — you do not need to re-send unchanged values.
|
|
1136
|
+
|
|
1137
|
+
### Example: commission record with protected fields
|
|
1138
|
+
|
|
1139
|
+
An app that lets owners update their payout email but not their commission total:
|
|
1140
|
+
|
|
1141
|
+
```json
|
|
1142
|
+
{
|
|
1143
|
+
"ownerEdit": {
|
|
1144
|
+
"records": {
|
|
1145
|
+
"owner": { "allow": ["paypalEmail", "paypalEmailUpdatedAt"] }
|
|
1146
|
+
}
|
|
1147
|
+
}
|
|
1148
|
+
}
|
|
1149
|
+
```
|
|
1150
|
+
|
|
1151
|
+
A PATCH body of `{ "owner": { "paypalEmail": "x@y.com", "totalCommission": 99 } }` will update `paypalEmail` only. `totalCommission` is silently ignored and its existing value is preserved.
|
|
1152
|
+
|
|
1153
|
+
> **App design note:** If your app creates records with sensitive fields that owners should never modify (e.g. computed totals, server-assigned fields), add an `ownerEdit` policy from the start. It is significantly easier to relax restrictions later than to tighten them after data has been mutated.
|
|
1154
|
+
|
|
1155
|
+
---
|
|
1156
|
+
|
|
1101
1157
|
## Anonymous Edit Tokens
|
|
1102
1158
|
|
|
1103
1159
|
Enables an anonymous caller to amend a record they just created — without authentication — by presenting a short-lived secret token.
|
package/docs/API_SUMMARY.md
CHANGED
package/docs/app-objects.md
CHANGED
|
@@ -85,6 +85,7 @@ Zones are **automatically filtered** based on the caller's role:
|
|
|
85
85
|
### Zone Writing Rules
|
|
86
86
|
|
|
87
87
|
- **Non-admin callers** attempting to write to the `admin` zone are silently ignored
|
|
88
|
+
- **Authenticated record owners** can write to `data` and `owner` by default; individual keys can be restricted via the `ownerEdit` app config policy (see [Owner Edit Policy](#owner-edit-policy) below)
|
|
88
89
|
- **Public callers** can write to `data` and `owner` (if visibility allows)
|
|
89
90
|
- **Admins** can write to all three zones
|
|
90
91
|
|
|
@@ -1098,6 +1099,61 @@ The `enforce` values are **merged over** the caller's request body, so you can l
|
|
|
1098
1099
|
|
|
1099
1100
|
---
|
|
1100
1101
|
|
|
1102
|
+
## Owner Edit Policy
|
|
1103
|
+
|
|
1104
|
+
Gives per-zone, field-level control over what an **authenticated record owner** can update via `PATCH /api/v1/public/collection/:collectionId/app/:appId/records/:recordId`.
|
|
1105
|
+
|
|
1106
|
+
Set the policy in the same app config document used for `publicCreate` (stored at `sites/{collectionId}/apps/{appId}`):
|
|
1107
|
+
|
|
1108
|
+
```json
|
|
1109
|
+
{
|
|
1110
|
+
"ownerEdit": {
|
|
1111
|
+
"records": {
|
|
1112
|
+
"data": { "allow": ["paypalEmail"] },
|
|
1113
|
+
"owner": { "allow": ["paypalEmail", "paypalEmailUpdatedAt"] }
|
|
1114
|
+
}
|
|
1115
|
+
}
|
|
1116
|
+
}
|
|
1117
|
+
```
|
|
1118
|
+
|
|
1119
|
+
### Zone visibility and write access
|
|
1120
|
+
|
|
1121
|
+
| Zone | Who can read | Who can write (owner) |
|
|
1122
|
+
|---------|------------------------|----------------------------------------------------------|
|
|
1123
|
+
| `data` | public | Allow-listed keys only (if policy set); all keys if not |
|
|
1124
|
+
| `owner` | owner + admin | Allow-listed keys only (if policy set); all keys if not |
|
|
1125
|
+
| `admin` | admin | Never — admin zone is always immutable to owners |
|
|
1126
|
+
|
|
1127
|
+
### Allow-list semantics
|
|
1128
|
+
|
|
1129
|
+
| Config | Behaviour |
|
|
1130
|
+
|----------------------------|-------------------------------------------------------------------------------|
|
|
1131
|
+
| No `ownerEdit` key | Default-allow — both zones fully writable (no change to existing behaviour) |
|
|
1132
|
+
| `allow` array with keys | Only the listed keys are accepted from the PATCH body; the rest are silently ignored and their existing values preserved |
|
|
1133
|
+
| `allow: []` (empty array) | Zone is effectively read-only for the owner |
|
|
1134
|
+
|
|
1135
|
+
Accepted keys are **merged** onto the existing zone blob — you do not need to re-send unchanged values.
|
|
1136
|
+
|
|
1137
|
+
### Example: commission record with protected fields
|
|
1138
|
+
|
|
1139
|
+
An app that lets owners update their payout email but not their commission total:
|
|
1140
|
+
|
|
1141
|
+
```json
|
|
1142
|
+
{
|
|
1143
|
+
"ownerEdit": {
|
|
1144
|
+
"records": {
|
|
1145
|
+
"owner": { "allow": ["paypalEmail", "paypalEmailUpdatedAt"] }
|
|
1146
|
+
}
|
|
1147
|
+
}
|
|
1148
|
+
}
|
|
1149
|
+
```
|
|
1150
|
+
|
|
1151
|
+
A PATCH body of `{ "owner": { "paypalEmail": "x@y.com", "totalCommission": 99 } }` will update `paypalEmail` only. `totalCommission` is silently ignored and its existing value is preserved.
|
|
1152
|
+
|
|
1153
|
+
> **App design note:** If your app creates records with sensitive fields that owners should never modify (e.g. computed totals, server-assigned fields), add an `ownerEdit` policy from the start. It is significantly easier to relax restrictions later than to tighten them after data has been mutated.
|
|
1154
|
+
|
|
1155
|
+
---
|
|
1156
|
+
|
|
1101
1157
|
## Anonymous Edit Tokens
|
|
1102
1158
|
|
|
1103
1159
|
Enables an anonymous caller to amend a record they just created — without authentication — by presenting a short-lived secret token.
|