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:
Brainslug
2023-10-02 15:30:24 +02:00
committed by GitHub
parent 01f0a18147
commit a3787aaced
3 changed files with 22 additions and 5 deletions

View File

@@ -0,0 +1,6 @@
---
"docs": patch
"@directus/sdk": patch
---
Fixed the Collection Type shipped in the SDK

View File

@@ -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
}
}
],
})
);
```

View File

@@ -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 = {