mirror of
https://github.com/directus/directus.git
synced 2026-04-25 03:00:53 -04:00
SDK Update Collection Type (#19881)
* Updated SDK collection type and docs * fixed sort meta type on collections * Create big-peas-jump.md
This commit is contained in:
6
.changeset/big-peas-jump.md
Normal file
6
.changeset/big-peas-jump.md
Normal file
@@ -0,0 +1,6 @@
|
||||
---
|
||||
"docs": patch
|
||||
"@directus/sdk": patch
|
||||
---
|
||||
|
||||
Fixed the Collection Type shipped in the SDK
|
||||
@@ -342,9 +342,19 @@ const client = createDirectus('directus_project_url').with(rest());
|
||||
const result = await client.request(
|
||||
createCollection({
|
||||
collection: 'collection_name',
|
||||
field: {
|
||||
sub_field: 'value',
|
||||
},
|
||||
fields: [
|
||||
{
|
||||
field: 'title',
|
||||
type: 'string',
|
||||
meta: {
|
||||
icon: 'title'
|
||||
},
|
||||
schema: {
|
||||
is_primary_key: true,
|
||||
is_nullable: false
|
||||
}
|
||||
}
|
||||
],
|
||||
})
|
||||
);
|
||||
```
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import type { MergeCoreCollection } from '../index.js';
|
||||
import type { DirectusField, MergeCoreCollection, NestedPartial } from '../index.js';
|
||||
|
||||
export type DirectusCollection<Schema extends object> = {
|
||||
collection: string; // TODO keyof complete schema
|
||||
@@ -21,7 +21,7 @@ export type DirectusCollection<Schema extends object> = {
|
||||
accountability: string | null;
|
||||
color: string | null;
|
||||
item_duplication_fields: string[] | null;
|
||||
sort: string | null;
|
||||
sort: number | null;
|
||||
group: string | null;
|
||||
collapse: string;
|
||||
preview_url: string | null;
|
||||
@@ -32,6 +32,7 @@ export type DirectusCollection<Schema extends object> = {
|
||||
name: string;
|
||||
comment: string | null;
|
||||
} | null;
|
||||
fields?: NestedPartial<DirectusField<Schema>>[];
|
||||
};
|
||||
|
||||
export type CollectionMetaTranslationType = {
|
||||
|
||||
Reference in New Issue
Block a user