Skip to content

Latest commit

 

History

History
768 lines (426 loc) · 17 KB

class.VersionsService.md

File metadata and controls

768 lines (426 loc) · 17 KB

directus-monorepo ( Readme | API )


directus-monorepo > VersionsService

Class: VersionsService

Extends

Constructors

constructor()

new VersionsService(options): VersionsService

Parameters

Parameter Type
options AbstractServiceOptions

Returns

VersionsService

Overrides

ItemsService.constructor

Source

api/src/services/versions.ts:21

Properties

accountability

accountability: any

Source

api/src/services/items.ts:43

Inherited from

ItemsService.accountability


authorizationService

authorizationService: AuthorizationService

Source

api/src/services/versions.ts:19


cache

cache: null | Keyv< any, Record< string, unknown > >

Source

api/src/services/items.ts:46

Inherited from

ItemsService.cache


collection

collection: string

Source

api/src/services/items.ts:41

Inherited from

ItemsService.collection


eventScope

eventScope: string

Source

api/src/services/items.ts:44

Inherited from

ItemsService.eventScope


knex

knex: Knex< any, any[] >

Source

api/src/services/items.ts:42

Inherited from

ItemsService.knex


schema

schema: SchemaOverview

Source

api/src/services/items.ts:45

Inherited from

ItemsService.schema

Methods

createMany()

createMany(data, opts?): Promise< PrimaryKey[] >

Create multiple new items at once. Inserts all provided records sequentially wrapped in a transaction.

Parameters

Parameter Type
data Item[]
opts? MutationOptions

Returns

Promise< PrimaryKey[] >

Overrides

ItemsService.createMany

Source

api/src/services/versions.ts:141


createMutationTracker()

createMutationTracker(initialCount = 0): MutationTracker

Parameters

Parameter Type Default value
initialCount number 0

Returns

MutationTracker

Inherited from

ItemsService.createMutationTracker

Source

api/src/services/items.ts:59


createOne()

createOne(data, opts?): Promise< PrimaryKey >

Create a single new item.

Parameters

Parameter Type
data Item
opts? MutationOptions

Returns

Promise< PrimaryKey >

Overrides

ItemsService.createOne

Source

api/src/services/versions.ts:131


deleteByQuery()

deleteByQuery(query, opts?): Promise< PrimaryKey[] >

Delete multiple items by query

Parameters

Parameter Type
query Query
opts? MutationOptions

Returns

Promise< PrimaryKey[] >

Inherited from

ItemsService.deleteByQuery

Source

api/src/services/items.ts:859


deleteMany()

deleteMany(keys, opts = {}): Promise< PrimaryKey[] >

Delete multiple items by primary key

Parameters

Parameter Type
keys PrimaryKey[]
opts MutationOptions

Returns

Promise< PrimaryKey[] >

Inherited from

ItemsService.deleteMany

Source

api/src/services/items.ts:882


deleteOne()

deleteOne(key, opts?): Promise< PrimaryKey >

Delete a single item by primary key

Parameters

Parameter Type
key PrimaryKey
opts? MutationOptions

Returns

Promise< PrimaryKey >

Inherited from

ItemsService.deleteOne

Source

api/src/services/items.ts:871


getKeysByQuery()

getKeysByQuery(query): Promise< PrimaryKey[] >

Parameters

Parameter Type
query Query

Returns

Promise< PrimaryKey[] >

Inherited from

ItemsService.getKeysByQuery

Source

api/src/services/items.ts:76


getMainItem()

getMainItem( collection, item, query?): Promise< Item >

Parameters

Parameter Type
collection string
item PrimaryKey
query? any

Returns

Promise< Item >

Source

api/src/services/versions.ts:74


getVersionSaves()

getVersionSaves( key, collection, item): Promise< null | Item[] >

Parameters

Parameter Type
key string
collection string
item undefined | string

Returns

Promise< null | Item[] >

Source

api/src/services/versions.ts:112


getVersionSavesById()

getVersionSavesById(id): Promise< Item[] >

Parameters

Parameter Type
id PrimaryKey

Returns

Promise< Item[] >

Source

api/src/services/versions.ts:99


promote()

promote( version, mainHash, fields?): Promise< PrimaryKey >

Parameters

Parameter Type
version PrimaryKey
mainHash string
fields? string[]

Returns

Promise< PrimaryKey >

Source

api/src/services/versions.ts:263


readByQuery()

readByQuery(query, opts?): Promise< Item[] >

Get items by query

Parameters

Parameter Type
query Query
opts? QueryOptions

Returns

Promise< Item[] >

Inherited from

ItemsService.readByQuery

Source

api/src/services/items.ts:395


readMany()

readMany( keys, query = {}, opts?): Promise< Item[] >

Get multiple items by primary keys

Parameters

Parameter Type
keys PrimaryKey[]
query Query
opts? QueryOptions

Returns

Promise< Item[] >

Inherited from

ItemsService.readMany

Source

api/src/services/items.ts:501


readOne()

readOne( key, query = {}, opts?): Promise< Item >

Get single item by primary key

Parameters

Parameter Type
key PrimaryKey
query Query
opts? QueryOptions

Returns

Promise< Item >

Inherited from

ItemsService.readOne

Source

api/src/services/items.ts:482


readSingleton()

readSingleton(query, opts?): Promise< Partial< Item > >

Read/treat collection as singleton

Parameters

Parameter Type
query Query
opts? QueryOptions

Returns

Promise< Partial< Item > >

Inherited from

ItemsService.readSingleton

Source

api/src/services/items.ts:982


save()

save(key, data): Promise< Item >

Parameters

Parameter Type
key PrimaryKey
data Item

Returns

Promise< Item >

Source

api/src/services/versions.ts:214


updateBatch()

updateBatch(data, opts = {}): Promise< PrimaryKey[] >

Update multiple items in a single transaction

Parameters

Parameter Type
data Partial< Item >[]
opts MutationOptions

Returns

Promise< PrimaryKey[] >

Inherited from

ItemsService.updateBatch

Source

api/src/services/items.ts:544


updateByQuery()

updateByQuery( query, data, opts?): Promise< PrimaryKey[] >

Update multiple items by query

Parameters

Parameter Type
query Query
data Partial< Item >
opts? MutationOptions

Returns

Promise< PrimaryKey[] >

Inherited from

ItemsService.updateByQuery

Source

api/src/services/items.ts:521


updateMany()

updateMany( keys, data, opts?): Promise< PrimaryKey[] >

Update many items by primary key, setting all items to the same change

Parameters

Parameter Type
keys PrimaryKey[]
data Item
opts? MutationOptions

Returns

Promise< PrimaryKey[] >

Overrides

ItemsService.updateMany

Source

api/src/services/versions.ts:169


updateOne()

updateOne( key, data, opts?): Promise< PrimaryKey >

Update a single item by primary key

Parameters

Parameter Type
key PrimaryKey
data Partial< Item >
opts? MutationOptions

Returns

Promise< PrimaryKey >

Inherited from

ItemsService.updateOne

Source

api/src/services/items.ts:533


upsertMany()

upsertMany(payloads, opts = {}): Promise< PrimaryKey[] >

Upsert many items

Parameters

Parameter Type
payloads Partial< Item >[]
opts MutationOptions

Returns

Promise< PrimaryKey[] >

Inherited from

ItemsService.upsertMany

Source

api/src/services/items.ts:829


upsertOne()

upsertOne(payload, opts?): Promise< PrimaryKey >

Upsert a single item

Parameters

Parameter Type
payload Partial< Item >
opts? MutationOptions

Returns

Promise< PrimaryKey >

Inherited from

ItemsService.upsertOne

Source

api/src/services/items.ts:803


upsertSingleton()

upsertSingleton(data, opts?): Promise< PrimaryKey >

Upsert/treat collection as singleton

Parameters

Parameter Type
data Partial< Item >
opts? MutationOptions

Returns

Promise< PrimaryKey >

Inherited from

ItemsService.upsertSingleton

Source

api/src/services/items.ts:1018


validateCreateData()

private validateCreateData(data): Promise< void >

Parameters

Parameter Type
data Item

Returns

Promise< void >

Source

api/src/services/versions.ts:31


verifyHash()

verifyHash( collection, item, hash): Promise< {mainHash: string; outdated: boolean;} >

Parameters

Parameter Type
collection string
item PrimaryKey
hash string

Returns

Promise< {mainHash: string; outdated: boolean;} >

Source

api/src/services/versions.ts:87


Generated using TypeDoc and typedoc-plugin-markdown