dochub-sdk 0.1.55 → 0.1.57
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/index.ts +2 -0
- package/interfaces/ui.ts +2 -1
- package/package.json +1 -1
- package/schemas/basetypes.ts +28 -0
- package/schemas/dochub-yaml.ts +102 -0
package/index.ts
CHANGED
@@ -17,6 +17,8 @@ export * from './interfaces/eventbus';
|
|
17
17
|
export * from './interfaces/router';
|
18
18
|
export * from './interfaces/settings';
|
19
19
|
export * from './interfaces/problems';
|
20
|
+
export * from './schemas/basetypes';
|
21
|
+
export * from './schemas/dochub-yaml';
|
20
22
|
|
21
23
|
export const DocHub: IDocHubCore = window['DocHub'];
|
22
24
|
export const Vue2 = () => window['Vue'];
|
package/interfaces/ui.ts
CHANGED
package/package.json
CHANGED
@@ -0,0 +1,28 @@
|
|
1
|
+
/**
|
2
|
+
* Базовые типы схем
|
3
|
+
*/
|
4
|
+
export enum BaseTypes {
|
5
|
+
object = 'object',
|
6
|
+
string = 'string'
|
7
|
+
}
|
8
|
+
|
9
|
+
/**
|
10
|
+
* Свойства объекта
|
11
|
+
*/
|
12
|
+
export interface IDocHubSchemaProperties {
|
13
|
+
[key: string]: IDocHubSchema;
|
14
|
+
}
|
15
|
+
|
16
|
+
/**
|
17
|
+
* JSON Schema
|
18
|
+
*/
|
19
|
+
export interface IDocHubSchema {
|
20
|
+
title: string;
|
21
|
+
type: BaseTypes;
|
22
|
+
properties?: IDocHubSchemaProperties;
|
23
|
+
patternProperties?: IDocHubSchemaProperties;
|
24
|
+
required?: string[];
|
25
|
+
pattern?: string;
|
26
|
+
additionalProperties?: boolean;
|
27
|
+
}
|
28
|
+
|
@@ -0,0 +1,102 @@
|
|
1
|
+
import {
|
2
|
+
IDocHubSchema,
|
3
|
+
BaseTypes,
|
4
|
+
} from './basetypes';
|
5
|
+
|
6
|
+
/**
|
7
|
+
* RegEx используемые в корневом манифесте
|
8
|
+
*/
|
9
|
+
export enum DocHubYamlPatterns {
|
10
|
+
packageID = '^[a-z0-9_\\-]{2,128}$',
|
11
|
+
packageVer = '^[0-9]{1,6}\\.[0-9]{1,6}\\.[0-9]{1,6}$',
|
12
|
+
packageRequest = '^.{1,128}$',
|
13
|
+
packageName = '^.{2,128}$',
|
14
|
+
packageDescription = '^.{2,512}$',
|
15
|
+
packageStructSpace = '^(\/[^\/|^\n|^\r|^\t]{1,}){1,}$',
|
16
|
+
packageStructPattern = '^.*$'
|
17
|
+
}
|
18
|
+
|
19
|
+
/**
|
20
|
+
* Схема зависимостей пакета
|
21
|
+
*/
|
22
|
+
export const dochubYamlDependencies: IDocHubSchema = {
|
23
|
+
title: 'Зависимости пакета',
|
24
|
+
type: BaseTypes.object,
|
25
|
+
patternProperties: {
|
26
|
+
[DocHubYamlPatterns.packageID]: {
|
27
|
+
title: 'Выражение требуемой версии зависимости',
|
28
|
+
type: BaseTypes.string,
|
29
|
+
pattern: DocHubYamlPatterns.packageRequest
|
30
|
+
}
|
31
|
+
},
|
32
|
+
additionalProperties: false
|
33
|
+
}
|
34
|
+
|
35
|
+
/**
|
36
|
+
* Структура репозитория
|
37
|
+
*/
|
38
|
+
export const dochubYamlStructure: IDocHubSchema = {
|
39
|
+
title: 'Структура репозитория',
|
40
|
+
type: BaseTypes.object,
|
41
|
+
patternProperties: {
|
42
|
+
[DocHubYamlPatterns.packageStructPattern]: {
|
43
|
+
title: 'Пространство репозитория',
|
44
|
+
type: BaseTypes.object,
|
45
|
+
properties: {
|
46
|
+
title: {
|
47
|
+
title: 'Описание пространства',
|
48
|
+
type: BaseTypes.string
|
49
|
+
},
|
50
|
+
location: {
|
51
|
+
title: 'Размещение в репозитории',
|
52
|
+
type: BaseTypes.string,
|
53
|
+
pattern: DocHubYamlPatterns.packageStructSpace
|
54
|
+
}
|
55
|
+
},
|
56
|
+
required: ['title', 'location']
|
57
|
+
}
|
58
|
+
},
|
59
|
+
additionalProperties: false
|
60
|
+
}
|
61
|
+
|
62
|
+
/**
|
63
|
+
* Схема корневого манифеста
|
64
|
+
*/
|
65
|
+
export const dochubYaml: IDocHubSchema = {
|
66
|
+
title: 'Схема файла dochub.yaml',
|
67
|
+
type: BaseTypes.object,
|
68
|
+
properties: {
|
69
|
+
$package: {
|
70
|
+
title: 'Манифест пакета',
|
71
|
+
type: BaseTypes.object,
|
72
|
+
patternProperties: {
|
73
|
+
[DocHubYamlPatterns.packageID]: {
|
74
|
+
title: 'Декларируемый пакет',
|
75
|
+
type: BaseTypes.object,
|
76
|
+
properties: {
|
77
|
+
version: {
|
78
|
+
title: 'Версия пакета',
|
79
|
+
type: BaseTypes.string,
|
80
|
+
pattern: DocHubYamlPatterns.packageVer
|
81
|
+
},
|
82
|
+
name: {
|
83
|
+
title: 'Наименование пакета',
|
84
|
+
type: BaseTypes.string,
|
85
|
+
pattern: DocHubYamlPatterns.packageName
|
86
|
+
},
|
87
|
+
description: {
|
88
|
+
title: 'Описание пакета',
|
89
|
+
type: BaseTypes.string,
|
90
|
+
pattern: DocHubYamlPatterns.packageDescription
|
91
|
+
},
|
92
|
+
dependencies: dochubYamlDependencies,
|
93
|
+
structure: dochubYamlStructure
|
94
|
+
},
|
95
|
+
required: ['version', 'name', 'description']
|
96
|
+
}
|
97
|
+
},
|
98
|
+
additionalProperties: false
|
99
|
+
}
|
100
|
+
},
|
101
|
+
required: ['$package']
|
102
|
+
}
|