| 1 |
export interface Snippet { |
| 2 |
readonly id: number |
| 3 |
readonly name: string |
| 4 |
readonly desc: string |
| 5 |
readonly code: string |
| 6 |
readonly tags: string[] |
| 7 |
readonly scope: SnippetScope |
| 8 |
readonly priority: number |
| 9 |
readonly active: boolean |
| 10 |
readonly locked: boolean |
| 11 |
readonly trashed: boolean |
| 12 |
readonly network: boolean |
| 13 |
readonly shared_network?: boolean | null |
| 14 |
readonly modified?: string |
| 15 |
readonly conditionId: number |
| 16 |
readonly lastActive?: number |
| 17 |
readonly code_error?: readonly [string, number] | null |
| 18 |
readonly code_error_trace?: string | null |
| 19 |
} |
| 20 |
|
| 21 |
export const SNIPPET_TYPES = <const> ['php', 'html', 'css', 'js', 'cond'] |
| 22 |
export type SnippetType = typeof SNIPPET_TYPES[number] |
| 23 |
|
| 24 |
export type SnippetCodeType = 'php' | 'html' | 'css' | 'js' |
| 25 |
|
| 26 |
export type SnippetCodeScope = typeof SNIPPET_TYPE_SCOPES[SnippetCodeType][number] |
| 27 |
export type SnippetScope = typeof SNIPPET_TYPE_SCOPES[SnippetType][number] |
| 28 |
|
| 29 |
export const SNIPPET_TYPE_SCOPES = <const> { |
| 30 |
php: ['global', 'admin', 'front-end', 'single-use'], |
| 31 |
html: ['content', 'head-content', 'body-content', 'footer-content'], |
| 32 |
css: ['admin-css', 'site-css'], |
| 33 |
js: ['site-head-js', 'site-footer-js'], |
| 34 |
cond: ['condition'] |
| 35 |
} |
| 36 |
|