@tailor-platform/sdk 1.73.2 → 1.73.3
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/CHANGELOG.md +19 -0
- package/dist/application-BAo_zFA4.mjs +3 -0
- package/dist/{application-Bb9NNp5m.mjs → application-DgTCDMZY.mjs} +177 -140
- package/dist/application-DgTCDMZY.mjs.map +1 -0
- package/dist/cli/index.mjs +3 -3
- package/dist/cli/lib.mjs +2 -2
- package/dist/completion/zsh-worker.zsh +1 -1
- package/dist/{runtime-B8O6JFS2.mjs → runtime-SxHHEzVb.mjs} +3 -3
- package/dist/{runtime-B8O6JFS2.mjs.map → runtime-SxHHEzVb.mjs.map} +1 -1
- package/docs/services/tailordb.md +23 -0
- package/package.json +1 -1
- package/dist/application-BXdCl6bp.mjs +0 -3
- package/dist/application-Bb9NNp5m.mjs.map +0 -1
|
@@ -254,6 +254,29 @@ type User {
|
|
|
254
254
|
- `toward.as` - Customizes the field name for accessing the related type from this type
|
|
255
255
|
- `backward` - Customizes the field name for accessing this type from the related type
|
|
256
256
|
|
|
257
|
+
Relation names share the same GraphQL field namespace as fields, files, and other relations on
|
|
258
|
+
the type. The SDK rejects duplicate or empty relation names. Use `toward.as` when multiple fields
|
|
259
|
+
on the same type point to the same target type, because their default forward names are derived
|
|
260
|
+
from the target type name:
|
|
261
|
+
|
|
262
|
+
```typescript
|
|
263
|
+
const post = db.type("Post", {
|
|
264
|
+
authorID: db.uuid().relation({
|
|
265
|
+
type: "n-1",
|
|
266
|
+
toward: { type: user, as: "author" },
|
|
267
|
+
backward: "authoredPosts",
|
|
268
|
+
}),
|
|
269
|
+
reviewerID: db.uuid().relation({
|
|
270
|
+
type: "n-1",
|
|
271
|
+
toward: { type: user, as: "reviewer" },
|
|
272
|
+
backward: "reviewedPosts",
|
|
273
|
+
}),
|
|
274
|
+
});
|
|
275
|
+
```
|
|
276
|
+
|
|
277
|
+
Use `toward.as` or `backward` when a generated relation name would conflict with an existing
|
|
278
|
+
field, files entry, or relation on the same type.
|
|
279
|
+
|
|
257
280
|
### Hooks
|
|
258
281
|
|
|
259
282
|
Add hooks to execute functions during data creation or update. Hooks receive three arguments:
|
package/package.json
CHANGED