Not
Bu sayfaya erişim yetkilendirme gerektiriyor. Oturum açmayı veya dizinleri değiştirmeyi deneyebilirsiniz.
Bu sayfaya erişim yetkilendirme gerektiriyor. Dizinleri değiştirmeyi deneyebilirsiniz.
Var olan bir Data API builder yapılandırma dosyasına yeni bir varlık tanımı ekleyin. ile dab initoluşturulmuş bir yapılandırmanız olmalıdır. Oluşturma işleminden sonra varlıkları değiştirmek için kullanın dab update .
İpucu
Yeni varlıklar oluşturmak ve dab update bunları geliştirmek için kullanındab add. Alan adı yeniden eşlemesi (--map), içinde değil yalnızca içinde updateaddkullanılabilir.
Sözdizimi
dab add <entity-name> [options]
Hızlı bakış
| Seçenek | Özet |
|---|---|
<entity-name> |
Gerekli konumsal bağımsız değişken. Mantıksal varlık adı. |
-c, --config |
Yapılandırma dosyası yolu. Varsayılan dab-config.json. |
--cache.enabled |
Varlık için önbelleğe almayı etkinleştirin/devre dışı bırakın. |
--cache.ttl |
Yaşam süresini saniyeler içinde önbelleğe alın. |
--description |
Varlık için serbest biçimli açıklama. |
--fields.exclude |
Virgülle ayrılmış dışlanan alanlar. |
--fields.include |
Virgülle ayrılmış izin verilen alanlar (* = tümü). |
--graphql |
GraphQL pozlaması: false, true, singularveya singular:plural. |
--graphql.operation |
Yalnızca saklı yordamlar.
query veya mutation (varsayılan mutasyon). |
--permissions |
Gerekli. Bir veya daha fazla role:actions çift. Tekrarlanabilir. |
--policy-database |
VERITABANı sorgusuna uygulanan OData stili filtre. |
--policy-request |
veritabanı çağrısı öncesinde değerlendirilen istek ilkesi. |
--rest |
REST pozlaması: false, trueveya özel yol. |
--rest.methods |
Yalnızca saklı yordamlar. İzin verilen HTTP fiilleri. Varsayılan POST. |
-s, --source |
Gerekli. Veritabanı nesne adı (tablo, görünüm veya saklı yordam). |
--source.key-fields |
Görünümler için veya PK çıkarılmadığında gereklidir. Procs için izin verilmiyor. |
--source.params |
Yalnızca saklı yordamlar. Varsayılan parametre değerleri. |
--source.type |
Kaynak türü: table, view, stored-procedure (varsayılan tablo). |
<entity-name>
Yapılandırmadaki varlığın mantıksal adı. Büyük/küçük harfe duyarlı.
Example
dab add Book --source dbo.Books --permissions "anonymous:read"
Sonuçta elde edilen yapılandırma
{
"entities": {
"Book": {
"source": {
"type": "table",
"object": "dbo.Books"
},
"permissions": [
{
"role": "anonymous",
"actions": [ "read" ]
}
]
}
}
}
-c, --config
Yapılandırma dosyası yolu. Varsayılan dab-config.json değeridir.
Example
dab add Book --config ./dab-config.mssql.json --source dbo.Books --permissions "anonymous:read"
--cache.enabled
Önbelleğe almayı etkinleştirin veya devre dışı bırakın.
Example
dab add Book --source dbo.Books --permissions "anonymous:read" --cache.enabled true
Sonuçta elde edilen yapılandırma
{
"entities": {
"Book": {
"source": {
"type": "table",
"object": "dbo.Books"
},
"permissions": [
{ "role": "anonymous", "actions": [ "read" ] }
],
"cache": {
"enabled": true
}
}
}
}
--cache.ttl
Yaşam süresini saniyeler içinde önbelleğe alın.
Example
dab add Book --source dbo.Books --permissions "anonymous:read" --cache.ttl 300
Sonuçta elde edilen yapılandırma
{
"entities": {
"Book": {
"source": {
"type": "table",
"object": "dbo.Books"
},
"permissions": [
{ "role": "anonymous", "actions": [ "read" ] }
],
"cache": {
"ttl-seconds": 300
}
}
}
}
--description
Varlığın serbest metin açıklaması.
Example
dab add Book --source dbo.Books --permissions "anonymous:read" --description "Entity for managing book inventory"
Sonuçta elde edilen yapılandırma
{
"entities": {
"Book": {
"source": {
"type": "table",
"object": "dbo.Books"
},
"permissions": [
{ "role": "anonymous", "actions": [ "read" ] }
],
"description": "Entity for managing book inventory"
}
}
}
--fields.exclude
Hariç tutulacak alanların virgülle ayrılmış listesi.
Example
dab add Book --source dbo.Books --permissions "anonymous:read" --fields.exclude "internal_flag,secret_note"
Sonuçta elde edilen yapılandırma
{
"entities": {
"Book": {
"source": { "type": "table", "object": "dbo.Books" },
"permissions": [
{ "role": "anonymous", "actions": [ "read" ] }
],
"graphql": {
"fields": {
"exclude": [ "internal_flag", "secret_note" ]
}
}
}
}
}
--fields.include
Kullanıma açık alanların virgülle ayrılmış listesi.
Example
dab add Book --source dbo.Books --permissions "anonymous:read" --fields.include "id,title,price"
Sonuçta elde edilen yapılandırma
{
"entities": {
"Book": {
"source": { "type": "table", "object": "dbo.Books" },
"permissions": [
{ "role": "anonymous", "actions": [ "read" ] }
],
"graphql": {
"fields": {
"include": [ "id", "title", "price" ]
}
}
}
}
}
--graphql
GraphQL pozlamayı denetleme.
Example
dab add Book --source dbo.Books --permissions "anonymous:read" --graphql book:books
Sonuçta elde edilen yapılandırma
{
"entities": {
"Book": {
"source": { "type": "table", "object": "dbo.Books" },
"permissions": [
{ "role": "anonymous", "actions": [ "read" ] }
],
"graphql": {
"singular": "book",
"plural": "books"
}
}
}
}
--graphql.operation
Yalnızca saklı yordamlar. GraphQL işlem türü. Varsayılan mutation değeridir.
Example
dab add BookProc --source dbo.MyProc --source.type stored-procedure --permissions "admin:execute" --graphql.operation query
Sonuçta elde edilen yapılandırma
{
"entities": {
"BookProc": {
"source": { "type": "stored-procedure", "object": "dbo.MyProc" },
"permissions": [
{ "role": "admin", "actions": [ "execute" ] }
],
"graphql": {
"operation": "query"
}
}
}
}
--permissions
Rol→actions çiftlerini tanımlar. Birden çok rol için yinelenen bayraklar kullanın.
Example
dab add Book --source dbo.Books --permissions "anonymous:read" --permissions "authenticated:create,read,update,delete"
Sonuçta elde edilen yapılandırma
{
"entities": {
"Book": {
"source": { "type": "table", "object": "dbo.Books" },
"permissions": [
{ "role": "anonymous", "actions": [ "read" ] },
{ "role": "authenticated", "actions": [ "create", "read", "update", "delete" ] }
]
}
}
}
--policy-database
Veritabanı düzeyinde ilke.
Example
dab add Book --source dbo.Books --permissions "anonymous:read" --policy-database "region eq 'US'"
Sonuçta elde edilen yapılandırma
{
"entities": {
"Book": {
"source": { "type": "table", "object": "dbo.Books" },
"permissions": [
{ "role": "anonymous", "actions": [ "read" ] }
],
"policies": {
"database": "region eq 'US'"
}
}
}
}
--policy-request
İstek düzeyi ilkesi.
Example
dab add Book --source dbo.Books --permissions "anonymous:read" --policy-request "@claims.role == 'admin'"
Sonuçta elde edilen yapılandırma
{
"entities": {
"Book": {
"source": { "type": "table", "object": "dbo.Books" },
"permissions": [
{ "role": "anonymous", "actions": [ "read" ] }
],
"policies": {
"request": "@claims.role == 'admin'"
}
}
}
}
--rest
REST pozlamayı kontrol edin.
Example
dab add Book --source dbo.Books --permissions "anonymous:read" --rest BooksApi
Sonuçta elde edilen yapılandırma
{
"entities": {
"Book": {
"source": { "type": "table", "object": "dbo.Books" },
"permissions": [
{ "role": "anonymous", "actions": [ "read" ] }
],
"rest": {
"path": "BooksApi"
}
}
}
}
--rest.methods
Yalnızca saklı yordamlar. Yürütme için izin verilen HTTP fiilleri. Varsayılan değer POST'tır. Tablolar/görünümler için yoksayılır.
Example
dab add BookProc --source dbo.MyProc --source.type stored-procedure --permissions "admin:execute" --rest true --rest.methods GET,POST
Sonuçta elde edilen yapılandırma
{
"entities": {
"BookProc": {
"source": { "type": "stored-procedure", "object": "dbo.MyProc" },
"permissions": [
{ "role": "admin", "actions": [ "execute" ] }
],
"rest": {
"path": "BookProc",
"methods": [ "GET", "POST" ]
}
}
}
}
-s, --source
Gerekli. Veritabanı nesnesinin adı: tablo, görünüm veya saklı yordam.
Example
dab add Book --source dbo.Books --permissions "anonymous:read"
Sonuçta elde edilen yapılandırma
{
"entities": {
"Book": {
"source": {
"type": "table",
"object": "dbo.Books"
},
"permissions": [
{ "role": "anonymous", "actions": [ "read" ] }
]
}
}
}
--source.key-fields
Görünümler için gereklidir. Çıkarılabilir PK'sı olmayan tablolar için de gereklidir. Saklı yordamlar için izin verilmez.
Example
dab add BookView --source dbo.MyView --source.type view --source.key-fields "id,region" --permissions "anonymous:read"
Sonuçta elde edilen yapılandırma
{
"entities": {
"BookView": {
"source": {
"type": "view",
"object": "dbo.MyView",
"keyFields": [ "id", "region" ]
},
"permissions": [
{ "role": "anonymous", "actions": [ "read" ] }
]
}
}
}
--source.params
Yalnızca saklı yordamlar. Virgülle ayrılmış name:value çiftler. Tablolar veya görünümler için izin verilmez.
Example
dab add BookProc --source dbo.MyProc --source.type stored-procedure --source.params "year:2024,active:true" --permissions "admin:execute"
Sonuçta elde edilen yapılandırma
{
"entities": {
"BookProc": {
"source": {
"type": "stored-procedure",
"object": "dbo.MyProc",
"params": {
"year": 2024,
"active": true
}
},
"permissions": [
{ "role": "admin", "actions": [ "execute" ] }
]
}
}
}
--source.type
Veritabanı nesnesinin türü. Varsayılan: table.
Example
dab add Book --source dbo.Books --source.type table --permissions "anonymous:read"
Sonuçta elde edilen yapılandırma
{
"entities": {
"Book": {
"source": {
"type": "table",
"object": "dbo.Books"
},
"permissions": [
{ "role": "anonymous", "actions": [ "read" ] }
]
}
}
}