This repository has been archived by the owner on Jan 1, 2020. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathindex.d.ts
76 lines (63 loc) · 1.6 KB
/
index.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
68
69
70
71
72
73
74
75
76
import fs from 'fs'
import Ajv from 'ajv'
declare namespace contributes {
interface INodeData {
/**
* Settings description
*/
description: string,
/**
* Settings type
*/
type: string,
/**
* Settings default value
*/
default?: any
}
interface INodeSchema extends INodeData {
/**
* Settings name (key)
*/
name: string
}
export class Contributes {
/**
* Creates an instance for a particular package schema
*
* Note: the schema will be validated, potentially causing this to throw an Error
* @param packagePath path to package.json
*/
public static from (packagePath: string) : Contributes
/**
* The package name from which settings are contributed
*/
public name : string
/**
* The package version (semver) from which settings are contributed
*/
public version : string
/**
* The title for the contributed settings
*/
public title : string
/**
* Map the contributes settings to something new (transforming the dataset)
* @param it iterator function
*/
public map<T> (it: (node: INodeSchema) => T) : T
/**
* The data containing contributed settings
*/
public data : INodeSchema[]
/**
* Validate some settings object against the schema
*
* Note: this will coerce types, if possible, to match the schema
* Note: if validation fails, this throws an Error
* @param data settings data to validate
*/
public validate (data?: any) : Contributes
}
}
export = contributes.Contributes