-
Notifications
You must be signed in to change notification settings - Fork 2
/
typings.d.ts
67 lines (57 loc) · 1.79 KB
/
typings.d.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
declare module 'mongoose-slug-hero' {
import { Document, DocumentQuery, Model } from 'mongoose'
export interface SlugHeroGlobalOptions {
/**
* (global): The slug field name that will be added to the collection to store generated slug. Default: slug.
*/
slugField?: string
/**
* (global): The slugs field name that will be added to the collection to store slug history. Default: slugs.
*/
slugsField?: string
/**
* (global): Options for node-slug. Please refer to https://github.com/dodo/node-slug#options. Default: {lower: true}.
*/
slugOptions?: any
/**
* (global): The name of collection to store sequences data. Default: _slug_ctrs.
*/
counter?: string
}
export interface SlugHeroOptions extends SlugHeroGlobalOptions {
/**
* Name of slug-hero, this must be unique among collections. You can fill with the model name to make life easier.
*/
doc: string
/**
* Name of your field that slug will generate for.
*/
field: string
/**
* Array of field names for scope keys (see example: Scoped Slug).
*/
scope?: string | string[]
}
/**
* Model with mongoose slug hero functionalities.
*/
export interface SlugHeroModel<T extends Document> extends Model<T> {
/**
* Generate slug if it's not exists yet.
* @param callback done callback
*/
ensureSlugIsExists(callback?: (err: any) => void)
/**
* Find document by slug.
* @param slug slug value
* @param callback done callback
*/
findBySlug(
slug: string,
callback?: (err: any, result: T & Document) => void
): DocumentQuery<T[], T & Document>
}
import mongoose = require('mongoose')
const pluginFn: (schema: mongoose.Schema) => void
export default pluginFn
}