This commit is contained in:
ali-hamud 2017-08-20 16:03:26 +03:00
Родитель 70ebd2d5a6 582dee5d58
Коммит 0f2f1c5f58
8 изменённых файлов: 224 добавлений и 0 удалений

Просмотреть файл

@ -14,6 +14,12 @@ export const settingsSchema = require('./schemas/settings.json');
export const basicFilterSchema = require('./schemas/basicFilter.json');
export const createReportSchema = require('./schemas/reportCreateConfiguration.json');
export const saveAsParametersSchema = require('./schemas/saveAsParameters.json');
export const loadQnaConfigurationSchema = require('./schemas/loadQnaConfiguration.json');
export const qnaSettingsSchema = require('./schemas/qnaSettings.json');
export const qnaInterpretInputDataSchema = require('./schemas/qnaInterpretInputData.json');
export const customLayoutSchema = require('./schemas/customLayout.json');
export const pageSizeSchema = require('./schemas/pageSize.json');
export const customPageSizeSchema = require('./schemas/customPageSize.json');
/* tslint:enable:no-var-requires */
import * as jsen from 'jsen';
@ -81,11 +87,40 @@ export interface IExtensions {
menus?: IMenuExtensions;
}
export enum PageSizeType {
Widescreen,
Standard,
Cortana,
Letter,
Custom
}
export enum DisplayOption {
FitToPage,
FitToWidth,
ActualSize
}
export interface IPageSize {
type: PageSizeType;
}
export interface ICustomPageSize extends IPageSize {
width?: number;
height?: number;
}
export interface ICustomLayout {
pageSize?: IPageSize;
displayOption?: DisplayOption;
}
export interface ISettings {
filterPaneEnabled?: boolean;
navContentPaneEnabled?: boolean;
useCustomSaveAsDialog?: boolean;
extensions?: IExtensions;
customLayout?: ICustomLayout;
}
export const validateExtensions = validate(extensionsSchema, {
@ -99,12 +134,20 @@ export const validateSettings = validate(settingsSchema, {
schemas: {
basicFilter: basicFilterSchema,
advancedFilter: advancedFilterSchema,
customLayout: customLayoutSchema,
pageSize: pageSizeSchema,
extensions: extensionsSchema,
menuExtensions: menuExtensionsSchema,
customMenuItem: customMenuItemSchema,
}
});
export const validateCustomPageSize = validate(customPageSizeSchema, {
schemas: {
pageSize: pageSizeSchema,
}
});
export interface IReportLoadConfiguration {
accessToken: string;
id: string;
@ -121,6 +164,8 @@ export const validateReportLoad = validate(loadSchema, {
settings: settingsSchema,
basicFilter: basicFilterSchema,
advancedFilter: advancedFilterSchema,
customLayout: customLayoutSchema,
pageSize: pageSizeSchema,
extensions: extensionsSchema,
menuExtensions: menuExtensionsSchema,
customMenuItem: customMenuItemSchema,
@ -506,3 +551,39 @@ export interface ISaveAsParameters {
}
export const validateSaveAsParameters = validate(saveAsParametersSchema);
export interface IQnaSettings {
filterPaneEnabled?: boolean;
}
export interface ILoadQnaConfiguration {
accessToken: string;
datasetIds: string[];
utterance?: string;
viewMode?: QnAMode;
settings?: IQnaSettings;
tokenType?: TokenType;
}
export const validateLoadQnaConfiguration = validate(loadQnaConfigurationSchema, {
schemas: {
qnaSettings: qnaSettingsSchema,
}
});
export enum QnAMode {
Interactive,
NonInteractive,
}
export interface IQnaInterpretInputData {
utterance: string;
datasetIds?: string[];
}
export const validateQnaInterpretInputData = validate(qnaInterpretInputDataSchema);
export interface IQnaVisualRenderedEvent {
utterance: string;
normalizedUtterance?: string;
}

Просмотреть файл

@ -0,0 +1,15 @@
{
"$schema": "http://json-schema.org/draft-04/schema#",
"type": "object",
"properties": {
"pageSize": {
"$ref": "#pageSize"
},
"displayOption": {
"type": "number",
"enum": [0, 1, 2],
"default": 0,
"invalidMessage": "displayOption property is invalid"
}
}
}

Просмотреть файл

@ -0,0 +1,25 @@
{
"$schema": "http://json-schema.org/draft-04/schema#",
"type": "object",
"allOf": [
{
"$ref": "#pageSize"
},
{
"properties": {
"width": {
"type": "number",
"messages": {
"type": "width must be a number"
}
},
"height": {
"type": "number",
"messages": {
"type": "height must be a number"
}
}
}
}
]
}

Просмотреть файл

@ -0,0 +1,48 @@
{
"$schema": "http://json-schema.org/draft-04/schema#",
"type": "object",
"properties": {
"accessToken": {
"type": "string",
"messages": {
"type": "accessToken must be a string",
"required": "accessToken is required"
}
},
"datasetIds": {
"type": "array",
"items": {
"type": "string"
},
"messages": {
"type": "datasetIds must be an array of strings",
"required": "datasetIds is required"
}
},
"utterance": {
"type": "string",
"messages": {
"type": "utterance must be a string"
}
},
"viewMode": {
"type": "number",
"enum": [ 0, 1 ],
"default": 0,
"invalidMessage": "viewMode property is invalid"
},
"settings": {
"$ref": "#qnaSettings"
},
"tokenType": {
"type": "number",
"enum": [ 0, 1 ],
"default": 0,
"invalidMessage": "tokenType property is invalid"
}
},
"required": [
"accessToken",
"datasetIds"
]
}

15
src/schemas/pageSize.json Normal file
Просмотреть файл

@ -0,0 +1,15 @@
{
"$schema": "http://json-schema.org/draft-04/schema#",
"type": "object",
"properties": {
"type": {
"type": "number",
"enum": [0, 1, 2, 3, 4, 5],
"default": 0,
"invalidMessage": "type property is invalid"
}
},
"required": [
"type"
]
}

Просмотреть файл

@ -0,0 +1,25 @@
{
"$schema": "http://json-schema.org/draft-04/schema#",
"type": "object",
"properties": {
"datasetIds": {
"type": "array",
"items": {
"type": "string"
},
"messages": {
"type": "datasetIds must be an array of strings"
}
},
"utterance": {
"type": "string",
"messages": {
"type": "utterance must be a string",
"required": "utterance is required"
}
}
},
"required": [
"utterance"
]
}

Просмотреть файл

@ -0,0 +1,12 @@
{
"$schema": "http://json-schema.org/draft-04/schema#",
"type": "object",
"properties": {
"filterPaneEnabled": {
"type": "boolean",
"messages": {
"type": "filterPaneEnabled must be a boolean"
}
}
}
}

Просмотреть файл

@ -22,6 +22,9 @@
},
"extensions": {
"$ref": "#extensions"
},
"customLayout": {
"$ref": "#customLayout"
}
}
}