Migrate to Typescript (not finished yet)

This commit is contained in:
Roman Hotsiy 2016-05-25 18:34:31 +03:00
parent 61d9a42477
commit 65bc8ef4e5
63 changed files with 2452 additions and 249 deletions

View File

@ -1,7 +1,7 @@
var path = require('path');
var paths = {
source: 'lib/**/*.js',
source: 'lib/**/*.ts',
html: 'lib/**/*.html',
scss: 'lib/**/*.scss',
sourceEntryPoint: 'lib/index.js',

View File

@ -13,6 +13,7 @@ var replace = require('gulp-replace');
var rename = require('gulp-rename');
var argv = require('yargs').argv;
var gulpIf = require('gulp-if');
var sassCopm = require('node-sass');
gulp.task('build', function (callback) {
if (argv.skipRebuild) {
@ -20,7 +21,7 @@ gulp.task('build', function (callback) {
return callback();
}
return runSequence(
'clean',
//'clean',
'concatPrism',
'bundle',
'concatDeps',
@ -46,11 +47,25 @@ gulp.task('rebuild', function(done) {
gulp.task('inlineTemplates', ['sass'], function() {
return gulp.src(paths.source, { base: './' })
.pipe(replace(/'(.*?\.css)'/g, '\'.tmp/$1\''))
.pipe(inlineNg2Template({ base: '/' }))
.pipe(replace(/'(.*?)\.css'/g, '\'$1.scss\''))
.pipe(inlineNg2Template({
base: '/',
useRelativePaths: true,
styleProcessor: compileSass
}))
.pipe(gulp.dest(paths.tmp));
});
function compileSass(ext, file) {
file = file.replace('../../shared/styles/variables', 'lib/shared/styles/variables');
file = file.replace('json-schema-common', 'lib/components/JsonSchema/json-schema-common');
file = file.replace('../../shared/styles/share-link', 'lib/shared/styles/share-link');
file = file.replace('../JsonSchema/lib/components/JsonSchema/json-schema-common', 'lib/components/JsonSchema/json-schema-common');
file = file.replace('../../styles/variables', 'lib/shared/styles/variables');
return sassCopm.renderSync({data: file}).css;
}
var JS_DEPS = argv.prod ? [
'lib/utils/browser-update.js',
'node_modules/zone.js/dist/zone.min.js',
@ -59,7 +74,7 @@ var JS_DEPS = argv.prod ? [
]: [
'lib/utils/browser-update.js',
'node_modules/zone.js/dist/zone.js',
'node_modules/zone.js/dist/long-stack-trace-zone.js',
//'node_modules/zone.js/dist/long-stack-trace-zone.js',
'node_modules/reflect-metadata/Reflect.js',
'node_modules/babel-polyfill/dist/polyfill.js'
];
@ -73,15 +88,15 @@ gulp.task('sass', function () {
});
// concatenate angular2 deps
gulp.task('concatDeps', function() {
return gulp.src(JS_DEPS.concat([outputFileName]))
gulp.task('concatDeps', ['concatPrism'], function() {
return gulp.src(JS_DEPS.concat([path.join(paths.tmp, 'prismjs-bundle.js'), outputFileName]))
.pipe(gulpIf(!argv.prod, sourcemaps.init({loadMaps: true})))
.pipe(concat(outputFileName))
.pipe(gulpIf(!argv.prod, sourcemaps.write('.')))
.pipe(gulp.dest('.'))
});
gulp.task('bundle', ['injectVersionFile', 'inlineTemplates'], function bundle(done) {
gulp.task('bundle', function bundle(done) {
fs.existsSync('dist') || fs.mkdirSync('dist');
var builder = new Builder('./', 'system.config.js');

View File

@ -12,13 +12,13 @@
<input id="schema-url-input" value='http://rebilly.github.io/SwaggerTemplateRepo/swagger.yaml'>
<button type="submit"> Explore </button>
</form>
<iframe src="https://ghbtns.com/github-btn.html?user=Rebilly&repo=ReDoc&type=star&count=true&size=large"
frameborder="0" scrolling="0" width="130px" height="30px"></iframe>
<!--<iframe src="https://ghbtns.com/github-btn.html?user=Rebilly&repo=ReDoc&type=star&count=true&size=large"
frameborder="0" scrolling="0" width="130px" height="30px"></iframe>-->
</nav>
<redoc scroll-y-offset="body > nav" spec-url='http://rebilly.github.io/SwaggerTemplateRepo/swagger.yaml'></redoc>
<redoc scroll-y-offset="body > nav" spec-url='swagger.yaml'></redoc>
<script src="main.js"> </script>
<script src="dist/redoc.min.js"> </script>
<script src="../dist/redoc.min.js"> </script>
</body>
</html>

View File

@ -1,5 +1,5 @@
@import url(http://fonts.googleapis.com/css?family=Roboto:300,400,700);
@import url(http://fonts.googleapis.com/css?family=Montserrat:300,400);
/*@import url(http://fonts.googleapis.com/css?family=Roboto:300,400,700);
@import url(http://fonts.googleapis.com/css?family=Montserrat:300,400);*/
body {
margin: 0;

828
demo/swagger.yaml Normal file
View File

@ -0,0 +1,828 @@
swagger: '2.0'
schemes:
- http
host: petstore.swagger.io
basePath: /v2
info:
description: 'This is a sample server Petstore server. You can find out more about Swagger at [http://swagger.io](http://swagger.io) or on [irc.freenode.net, #swagger](http://swagger.io/irc/). For this sample, you can use the api key `special-key` to test the authorization filters.'
version: 1.0.0
title: Swagger Petstore
termsOfService: 'http://swagger.io/terms/'
contact:
email: apiteam@swagger.io
x-logo:
url: 'https://rebilly.github.io/ReDoc/petstore-logo.png'
license:
name: Apache 2.0
url: 'http://www.apache.org/licenses/LICENSE-2.0.html'
externalDocs:
description: Find out more about Swagger
url: 'http://swagger.io'
tags:
- name: Pagination
x-traitTag: true
description: |-
Sometimes you just can't get enough. For this reason, we've provided a convenient way to access more data in any request for sequential data. Simply call the url in the next_url parameter and we'll respond with the next set of data.
```json
{
...
"pagination": {
"next_url":
"https://api.instagram.com/v1/tags/puppy/media/recent?access_token=fb2e77d.47a0479900504cb3ab4a1f626d174d2d&max_id=13872296",
"next_max_id": "13872296"
}
}
```
On views where pagination is present, we also support the `count`
parameter. Simply set this to the number of items you'd like to receive. Note that the default values should be fine for most applications - but if you decide to increase this number there is a maximum value defined on each endpoint.
externalDocs:
description: Find out more
url: 'http://swagger.io'
- name: JSONP
x-traitTag: true
description: "If you're writing an AJAX application, and you'd like to wrap our response with a callback, all you have to do is specify a callback parameter with any API call:\n```\n https://api.instagram.com/v1/tags/coffee/media/recent?access_token=fb2e77d.47a0479900504cb3ab4a1f626d174d2d&callback=callbackFunction\n```\nWould respond with:\n```js\ncallbackFunction({\n ...\n});\n``` \n > Example of markdown blockquote"
externalDocs:
description: Find out more
url: 'http://swagger.io'
- name: pet
description: Everything about your Pets
externalDocs:
description: Find out more
url: 'http://swagger.io'
- name: store
description: Access to Petstore orders
- name: user
description: Operations about user
externalDocs:
description: Find out more about our store
url: 'http://swagger.io'
securityDefinitions:
petstore_auth:
type: oauth2
authorizationUrl: 'http://petstore.swagger.io/api/oauth/dialog'
flow: implicit
scopes:
'write:pets': modify pets in your account
'read:pets': read your pets
api_key:
type: apiKey
name: api_key
in: header
paths:
/pet:
post:
tags:
- pet
summary: Add a new pet to the store
description: ''
operationId: addPet
consumes:
- application/json
- application/xml
produces:
- application/xml
- application/json
parameters:
- in: body
name: body
description: Pet object that needs to be added to the store
required: true
schema:
$ref: '#/definitions/Pet'
responses:
'405':
description: Invalid input
security:
- petstore_auth:
- 'write:pets'
- 'read:pets'
x-code-samples:
- lang: 'C#'
source: |
PetStore.v1.Pet pet = new PetStore.v1.Pet();
pet.setApiKey("your api key");
pet.petType = PetStore.v1.Pet.TYPE_DOG;
pet.name = "Rex";
// set other fields
PetStoreResponse response = pet.create();
if (response.statusCode == HttpStatusCode.Created)
{
// Successfully created
}
else
{
// Something wrong -- check response for errors
Console.WriteLine(response.getRawResponse());
}
- lang: PHP
source: "$form = new \\PetStore\\Entities\\Pet();\n$form->setPetType(\"Dog\");\n$form->setName(\"Rex\");\n// set other fields\ntry {\n $pet = $client->pets()->create($form);\n} catch (UnprocessableEntityException $e) {\n var_dump($e->getErrors());\n}\n"
put:
tags:
- pet
summary: Update an existing pet
description: ''
operationId: updatePet
consumes:
- application/json
- application/xml
produces:
- application/xml
- application/json
parameters:
- in: body
name: body
description: Pet object that needs to be added to the store
required: true
schema:
$ref: '#/definitions/Pet'
responses:
'400':
description: Invalid ID supplied
'404':
description: Pet not found
'405':
description: Validation exception
security:
- petstore_auth:
- 'write:pets'
- 'read:pets'
x-code-samples:
- lang: PHP
source: "$form = new \\PetStore\\Entities\\Pet();\n$form->setPetId(1);\n$form->setPetType(\"Dog\");\n$form->setName(\"Rex\");\n// set other fields\ntry {\n $pet = $client->pets()->update($form);\n} catch (UnprocessableEntityException $e) {\n var_dump($e->getErrors());\n}\n"
'/pet/{petId}':
get:
tags:
- pet
- JSONP
summary: Find pet by ID
description: Returns a single pet
operationId: getPetById
produces:
- application/xml
- application/json
parameters:
- name: petId
in: path
description: ID of pet to return
required: true
type: integer
format: int64
responses:
'200':
description: successful operation
schema:
$ref: '#/definitions/Pet'
'400':
description: Invalid ID supplied
'404':
description: Pet not found
security:
- api_key: []
post:
tags:
- pet
summary: Updates a pet in the store with form data
description: ''
operationId: updatePetWithForm
consumes:
- application/x-www-form-urlencoded
produces:
- application/xml
- application/json
parameters:
- name: petId
in: path
description: ID of pet that needs to be updated
required: true
type: integer
format: int64
- name: name
in: formData
description: Updated name of the pet
required: false
type: string
- name: status
in: formData
description: Updated status of the pet
required: false
type: string
responses:
'405':
description: Invalid input
security:
- petstore_auth:
- 'write:pets'
- 'read:pets'
delete:
tags:
- pet
summary: Deletes a pet
description: ''
operationId: deletePet
produces:
- application/xml
- application/json
parameters:
- name: api_key
in: header
required: false
type: string
- name: petId
in: path
description: Pet id to delete
required: true
type: integer
format: int64
responses:
'400':
description: Invalid pet value
security:
- petstore_auth:
- 'write:pets'
- 'read:pets'
'/pet/{petId}/uploadImage':
get:
tags:
- pet
summary: uploads an image
description: ''
operationId: uploadFile
consumes:
- image/jpeg
- image/png
produces:
- image/jpeg
- image/png
parameters:
- name: petId
in: path
description: ID of pet to update
required: true
type: integer
format: int64
- name: file
in: body
description: file to upload
required: false
schema:
type: file
responses:
'200':
description: successful operation
schema:
type: file
security:
- petstore_auth:
- 'write:pets'
- 'read:pets'
post:
tags:
- pet
summary: uploads an image
description: ''
operationId: uploadFile
consumes:
- multipart/form-data
produces:
- application/json
parameters:
- name: petId
in: path
description: ID of pet to update
required: true
type: integer
format: int64
- name: additionalMetadata
in: formData
description: Additional data to pass to server
required: false
type: string
- name: file
in: formData
description: file to upload
required: false
type: file
responses:
'200':
description: successful operation
schema:
$ref: '#/definitions/ApiResponse'
security:
- petstore_auth:
- 'write:pets'
- 'read:pets'
/pet/findByStatus:
get:
tags:
- pet
- Pagination
- JSONP
summary: Finds Pets by status
description: Multiple status values can be provided with comma seperated strings
operationId: findPetsByStatus
produces:
- application/xml
- application/json
parameters:
- name: status
in: query
description: Status values that need to be considered for filter
required: true
type: array
items:
type: string
enum:
- available
- pending
- sold
default: available
collectionFormat: csv
responses:
'200':
description: successful operation
schema:
type: array
items:
$ref: '#/definitions/Pet'
'400':
description: Invalid status value
security:
- petstore_auth:
- 'write:pets'
- 'read:pets'
/pet/findByTags:
get:
tags:
- pet
- Pagination
- JSONP
summary: Finds Pets by tags
description: 'Muliple tags can be provided with comma seperated strings. Use tag1, tag2, tag3 for testing.'
operationId: findPetsByTags
produces:
- application/xml
- application/json
parameters:
- name: tags
in: query
description: Tags to filter by
required: true
type: array
items:
type: string
collectionFormat: csv
responses:
'200':
description: successful operation
schema:
type: array
items:
$ref: '#/definitions/Pet'
'400':
description: Invalid tag value
security:
- petstore_auth:
- 'write:pets'
- 'read:pets'
/store/inventory:
get:
tags:
- store
- JSONP
summary: Returns pet inventories by status
description: Returns a map of status codes to quantities
operationId: getInventory
produces:
- application/json
parameters: []
responses:
'200':
description: successful operation
schema:
type: object
additionalProperties:
type: integer
format: int32
security:
- api_key: []
/store/order:
post:
tags:
- store
summary: Place an order for a pet
description: ''
operationId: placeOrder
produces:
- application/xml
- application/json
parameters:
- in: body
name: body
description: order placed for purchasing the pet
required: true
schema:
$ref: '#/definitions/Order'
responses:
'200':
description: successful operation
schema:
$ref: '#/definitions/Order'
'400':
description: Invalid Order
'/store/order/{orderId}':
get:
tags:
- store
- JSONP
summary: Find purchase order by ID
description: 'For valid response try integer IDs with value <= 5 or > 10. Other values will generated exceptions'
operationId: getOrderById
produces:
- application/xml
- application/json
parameters:
- name: orderId
in: path
description: ID of pet that needs to be fetched
required: true
type: integer
maximum: 5
minimum: 1
format: int64
responses:
'200':
description: successful operation
schema:
$ref: '#/definitions/Order'
'400':
description: Invalid ID supplied
'404':
description: Order not found
delete:
tags:
- store
summary: Delete purchase order by ID
description: For valid response try integer IDs with value < 1000. Anything above 1000 or nonintegers will generate API errors
operationId: deleteOrder
produces:
- application/xml
- application/json
parameters:
- name: orderId
in: path
description: ID of the order that needs to be deleted
required: true
type: string
minimum: 1
responses:
'400':
description: Invalid ID supplied
'404':
description: Order not found
/user:
post:
tags:
- user
summary: Create user
description: This can only be done by the logged in user.
operationId: createUser
produces:
- application/xml
- application/json
parameters:
- in: body
name: body
description: Created user object
required: true
schema:
$ref: '#/definitions/User'
responses:
default:
description: successful operation
'/user/{username}':
get:
tags:
- user
- JSONP
summary: Get user by user name
description: ''
operationId: getUserByName
produces:
- application/xml
- application/json
parameters:
- name: username
in: path
description: 'The name that needs to be fetched. Use user1 for testing. '
required: true
type: string
responses:
'200':
description: successful operation
schema:
$ref: '#/definitions/User'
'400':
description: Invalid username supplied
'404':
description: User not found
put:
tags:
- user
summary: Updated user
description: This can only be done by the logged in user.
operationId: updateUser
produces:
- application/xml
- application/json
parameters:
- name: username
in: path
description: name that need to be deleted
required: true
type: string
- in: body
name: body
description: Updated user object
required: true
schema:
$ref: '#/definitions/User'
responses:
'400':
description: Invalid user supplied
'404':
description: User not found
delete:
tags:
- user
summary: Delete user
description: This can only be done by the logged in user.
operationId: deleteUser
produces:
- application/xml
- application/json
parameters:
- name: username
in: path
description: The name that needs to be deleted
required: true
type: string
responses:
'400':
description: Invalid username supplied
'404':
description: User not found
/user/createWithArray:
post:
tags:
- user
summary: Creates list of users with given input array
description: ''
operationId: createUsersWithArrayInput
produces:
- application/xml
- application/json
parameters:
- in: body
name: body
description: List of user object
required: true
schema:
type: array
items:
$ref: '#/definitions/User'
responses:
default:
description: successful operation
/user/createWithList:
post:
tags:
- user
summary: Creates list of users with given input array
description: ''
operationId: createUsersWithListInput
produces:
- application/xml
- application/json
parameters:
- in: body
name: body
description: List of user object
required: true
schema:
type: array
items:
$ref: '#/definitions/User'
responses:
default:
description: successful operation
/user/login:
get:
tags:
- user
summary: Logs user into the system
description: ''
operationId: loginUser
produces:
- application/xml
- application/json
parameters:
- name: username
in: query
description: The user name for login
required: true
type: string
- name: password
in: query
description: The password for login in clear text
required: true
type: string
responses:
'200':
description: successful operation
schema:
type: string
headers:
X-Rate-Limit:
type: integer
format: int32
description: calls per hour allowed by the user
X-Expires-After:
type: string
format: date-time
description: date in UTC when toekn expires
'400':
description: Invalid username/password supplied
/user/logout:
get:
tags:
- user
summary: Logs out current logged in user session
description: ''
operationId: logoutUser
produces:
- application/xml
- application/json
parameters: []
responses:
default:
description: successful operation
definitions:
ApiResponse:
type: object
properties:
code:
type: integer
format: int32
type:
type: string
message:
type: string
Cat:
description: A representation of a cat
allOf:
- $ref: '#/definitions/Pet'
- type: object
properties:
huntingSkill:
type: string
description: The measured skill for hunting
default: lazy
enum:
- clueless
- lazy
- adventurous
- aggressive
required:
- huntingSkill
Category:
type: object
properties:
id:
type: integer
format: int64
name:
type: string
xml:
name: Category
Dog:
description: A representation of a dog
allOf:
- $ref: '#/definitions/Pet'
- type: object
properties:
packSize:
type: integer
format: int32
description: the size of the pack the dog is from
default: 0
minimum: 0
required:
- packSize
Order:
type: object
properties:
id:
type: integer
format: int64
petId:
type: integer
format: int64
quantity:
type: integer
format: int32
shipDate:
type: string
format: date-time
status:
type: string
description: Order Status
enum:
- placed
- approved
- delivered
complete:
type: boolean
default: false
xml:
name: Order
Pet:
type: object
required:
- name
- photoUrls
discriminator: petType
properties:
petType:
type: string
id:
type: integer
format: int64
category:
$ref: '#/definitions/Category'
name:
type: string
example: doggie
photoUrls:
type: array
xml:
name: photoUrl
wrapped: true
items:
type: string
tags:
type: array
xml:
name: tag
wrapped: true
items:
$ref: '#/definitions/Tag'
status:
type: string
description: pet status in the store
enum:
- available
- pending
- sold
xml:
name: Pet
Tag:
type: object
properties:
id:
type: integer
format: int64
name:
type: string
xml:
name: Tag
User:
type: object
properties:
id:
type: integer
format: int64
username:
type: string
firstName:
type: string
lastName:
type: string
email:
type: string
password:
type: string
phone:
type: string
userStatus:
type: integer
format: int32
description: User Status
xml:
name: User

View File

@ -5,16 +5,16 @@ import { OptionsService } from '../../services/index';
@RedocComponent({
selector: 'api-info',
styleUrls: ['./lib/components/ApiInfo/api-info.css'],
templateUrl: './lib/components/ApiInfo/api-info.html'
styleUrls: ['./api-info.css'],
templateUrl: './api-info.html'
})
@Reflect.metadata('parameters', [[SchemaManager], [OptionsService]])
export class ApiInfo extends BaseComponent {
constructor(schemaMgr, optionsService) {
data: any;
specUrl: String;
constructor(schemaMgr:SchemaManager, private optionsService:OptionsService) {
super(schemaMgr);
this.optionsService = optionsService;
}
prepareModel() {
this.data = this.componentSchema.info;
this.specUrl = this.optionsService.options.specUrl;

View File

@ -1,19 +1,20 @@
'use strict';
import {RedocComponent, BaseComponent} from '../base';
import {RedocComponent, BaseComponent, SchemaManager} from '../base';
@RedocComponent({
selector: 'api-logo',
styleUrls: ['./lib/components/ApiLogo/api-logo.css'],
templateUrl: './lib/components/ApiLogo/api-logo.html'
styleUrls: ['./api-logo.css'],
templateUrl: './api-logo.html'
})
export class ApiLogo extends BaseComponent {
constructor(schemaMgr) {
data:any = {};
constructor(schemaMgr:SchemaManager) {
super(schemaMgr);
}
prepareModel() {
this.data = {};
let logoInfo = this.componentSchema.info['x-logo'];
if (!logoInfo) return;
this.data.imgUrl = logoInfo.url;

View File

@ -2,11 +2,11 @@
import { Component, ElementRef, ViewContainerRef } from '@angular/core';
import { CORE_DIRECTIVES } from '@angular/common';
import { DynamicComponentLoader } from '@angular/core';
import { DynamicComponentLoader, Input } from '@angular/core';
import { JsonSchema } from './json-schema';
import { OptionsService } from '../../services/index';
import SchemaManager from '../../utils/SchemaManager';
import { OptionsService } from '../../services/options.service';
import { SchemaManager } from '../../utils/SchemaManager';
var cache = {};
@ -14,20 +14,16 @@ var cache = {};
@Component({
selector: 'json-schema-lazy',
inputs: ['pointer', 'auto', 'isRequestSchema'],
template: '',
directives: [CORE_DIRECTIVES]
})
@Reflect.metadata('parameters', [[SchemaManager], [ViewContainerRef], [
ElementRef], [DynamicComponentLoader], [OptionsService]])
export class JsonSchemaLazy {
constructor(schemaMgr, viewRef, elementRef, dcl, optionsService) {
this.viewRef = viewRef;
this.elementRef = elementRef;
this.dcl = dcl;
this.optionsService = optionsService;
this.schemaMgr = schemaMgr;
@Input() pointer: string;
@Input() auto: boolean;
@Input() isRequestSchema: boolean;
loaded: boolean = false;
constructor(private schemaMgr:SchemaManager, private viewRef:ViewContainerRef, private elementRef:ElementRef,
private dcl:DynamicComponentLoader, private optionsService:OptionsService) {
}
normalizePointer() {
@ -40,8 +36,6 @@ export class JsonSchemaLazy {
this.initComponent(compRef);
if (compRef.changeDetectorRef) {
compRef.changeDetectorRef.detectChanges();
} else {
compRef.hostView.changeDetectorRef.detectChanges();
}
return compRef;
});
@ -58,7 +52,7 @@ export class JsonSchemaLazy {
// cache JsonSchema view
loadCached() {
this.pointer = this.normalizePointer(this.pointer);
this.pointer = this.normalizePointer();
if (cache[this.pointer]) {
cache[this.pointer].then((compRef) => {
setTimeout( ()=> {

View File

@ -1,6 +1,6 @@
'use strict';
import { ElementRef } from '@angular/core';
import { ElementRef, Input } from '@angular/core';
import { RedocComponent, BaseComponent, SchemaManager } from '../base';
import { DropDown } from '../../shared/components/index';
@ -8,18 +8,24 @@ import JsonPointer from '../../utils/JsonPointer';
@RedocComponent({
selector: 'json-schema',
templateUrl: './lib/components/JsonSchema/json-schema.html',
styleUrls: ['./lib/components/JsonSchema/json-schema.css'],
templateUrl: './json-schema.html',
styleUrls: ['./json-schema.css'],
directives: [JsonSchema, DropDown],
inputs: ['isArray', 'final', 'nestOdd', 'childFor', 'isRequestSchema'],
detect: true
})
@Reflect.metadata('parameters', [[SchemaManager], [ElementRef]])
export class JsonSchema extends BaseComponent {
constructor(schemaMgr, elementRef) {
$element: any;
schema: any;
derivedEmtpy: boolean;
@Input() isArray: boolean;
@Input() final: boolean = false;
@Input() nestOdd: boolean;
@Input() childFor: string;
@Input() isRequestSchema: boolean;
constructor(schemaMgr:SchemaManager, elementRef:ElementRef) {
super(schemaMgr);
this.$element = elementRef.nativeElement;
this.final = false;
}
selectDerived(subClassIdx) {
@ -132,7 +138,7 @@ export class JsonSchema extends BaseComponent {
JsonPointer.join(addProps._pointer || schema._pointer || this.pointer, ['additionalProperties']));
}
static injectPropertyData(propertySchema, propertyName, propPointer, hostPointer) {
static injectPropertyData(propertySchema, propertyName, propPointer, hostPointer?) {
propertySchema = Object.assign({}, propertySchema);
propertySchema._name = propertyName;
@ -142,7 +148,7 @@ export class JsonSchema extends BaseComponent {
}
}
function runInjectors(injectTo, propertySchema, propertyPointer, hostPointer) {
function runInjectors(injectTo, propertySchema, propertyPointer, hostPointer?) {
for (var injName in injectors) {
let injector = injectors[injName];
if (injector.check(propertySchema)) {

View File

@ -1,7 +1,7 @@
'use strict';
import { JsonPointer } from '../../utils/JsonPointer';
import { RedocComponent, BaseComponent } from '../base';
import { Input } from '@angular/core';
import JsonPointer from '../../utils/JsonPointer';
import { RedocComponent, BaseComponent, SchemaManager} from '../base';
import { ParamsList } from '../ParamsList/params-list';
import { ResponsesList } from '../ResponsesList/responses-list';
@ -11,14 +11,15 @@ import { RequestSamples } from '../RequestSamples/request-samples';
@RedocComponent({
selector: 'method',
templateUrl: './lib/components/Method/method.html',
styleUrls: ['./lib/components/Method/method.css'],
templateUrl: './method.html',
styleUrls: ['./method.css'],
directives: [ ParamsList, ResponsesList, ResponsesSamples, SchemaSample, RequestSamples ],
inputs: ['tag'],
detect: true
})
export class Method extends BaseComponent {
constructor(schemaMgr) {
data:any;
@Input() tag:string;
constructor(schemaMgr:SchemaManager) {
super(schemaMgr);
}

View File

@ -1,21 +1,21 @@
'use strict';
import { forwardRef } from '@angular/core';
import { RedocComponent, BaseComponent } from '../base';
import { RedocComponent, BaseComponent, SchemaManager } from '../base';
import { Method } from '../Method/method';
import { EncodeURIComponentPipe } from '../../utils/pipes';
@RedocComponent({
selector: 'methods-list',
templateUrl: './lib/components/MethodsList/methods-list.html',
styleUrls: ['./lib/components/MethodsList/methods-list.css'],
templateUrl: './methods-list.html',
styleUrls: ['./methods-list.css'],
directives: [ forwardRef(() => Method) ],
pipes: [ EncodeURIComponentPipe ],
detect: true
})
export class MethodsList extends BaseComponent {
constructor(schemaMgr) {
data:any;
constructor(schemaMgr:SchemaManager) {
super(schemaMgr);
}
@ -25,7 +25,7 @@ export class MethodsList extends BaseComponent {
// duplicate methods
let menuStructure = this.schemaMgr.buildMenuTree();
let tags = Array.from(menuStructure.entries())
let tags = Array.from<any>(menuStructure.entries())
.map((entry) => {
let [tag, {description, methods}] = entry;
// inject tag name into method info

View File

@ -1,6 +1,6 @@
'use strict';
import { RedocComponent, BaseComponent } from '../base';
import { RedocComponent, BaseComponent, SchemaManager } from '../base';
import { JsonSchema } from '../JsonSchema/json-schema';
import {JsonSchemaLazy} from '../JsonSchema/json-schema-lazy';
@ -11,12 +11,15 @@ function safePush(obj, prop, item) {
@RedocComponent({
selector: 'params-list',
templateUrl: './lib/components/ParamsList/params-list.html',
styleUrls: ['./lib/components/ParamsList/params-list.css'],
templateUrl: './params-list.html',
styleUrls: ['./params-list.css'],
directives: [JsonSchema, JsonSchemaLazy]
})
export class ParamsList extends BaseComponent {
constructor(schemaMgr) {
data:any;
constructor(schemaMgr:SchemaManager) {
super(schemaMgr);
}
@ -62,7 +65,7 @@ export class ParamsList extends BaseComponent {
this.data.params = params;
}
orderParams(params) {
orderParams(params):any {
let res = {};
params.forEach((param) => safePush(res, param.in, param));
return res;

View File

@ -1,6 +1,6 @@
'use strict';
import { provide, enableProdMode, ElementRef } from '@angular/core';
import { provide, enableProdMode, ElementRef, ComponentRef } from '@angular/core';
import { bootstrap } from '@angular/platform-browser-dynamic';
import { BrowserDomAdapter } from '@angular/platform-browser/src/browser/browser_adapter';
import { RedocComponent, BaseComponent } from '../base';
@ -13,12 +13,12 @@ import { MethodsList } from '../MethodsList/methods-list';
import { SideMenu } from '../SideMenu/side-menu';
import { StickySidebar } from '../../shared/components/index';
import SchemaManager from '../../utils/SchemaManager';
import {SchemaManager} from '../../utils/SchemaManager';
import { OptionsService, RedocEventsService } from '../../services/index';
import redocVersion from '../../version.json!json';
//import redocVersion from '../../version.js';
import './redoc-initial-styles.css!css';
//import './redoc-initial-styles.css!css';
var dom = new BrowserDomAdapter();
var _modeLocked = false;
@ -30,16 +30,19 @@ var _modeLocked = false;
BrowserDomAdapter,
RedocEventsService
],
templateUrl: './lib/components/Redoc/redoc.html',
styleUrls: ['./lib/components/Redoc/redoc.css'],
templateUrl: './redoc.html',
styleUrls: ['./redoc.css'],
directives: [ ApiInfo, ApiLogo, MethodsList, SideMenu, StickySidebar ],
detect: true,
onPushOnly: false
})
@Reflect.metadata('parameters', [
[SchemaManager], [OptionsService], [ElementRef], [RedocEventsService]])
export class Redoc extends BaseComponent {
constructor(schemaMgr, optionsMgr, elementRef, events) {
private element: any;
options: any;
static appRef: ComponentRef<any>;
constructor(schemaMgr: SchemaManager, optionsMgr:OptionsService, elementRef:ElementRef,
public events:RedocEventsService) {
super(schemaMgr);
this.element = elementRef.nativeElement;
//parse options (top level component doesn't support inputs)
@ -51,7 +54,7 @@ export class Redoc extends BaseComponent {
ngAfterViewInit() {
setTimeout( () => {
this.events.bootstrapped.next();
this.events.bootstrapped.next({});
});
}
@ -69,7 +72,7 @@ export class Redoc extends BaseComponent {
}, 400);
}
static init(specUrl, options) {
static init(specUrl, options?) {
var optionsService = new OptionsService(dom);
optionsService.options = options;
optionsService.options.specUrl = optionsService.options.specUrl || specUrl;
@ -121,9 +124,9 @@ export class Redoc extends BaseComponent {
redocEl.innerHTML = erroHtml;
}
static get version() {
return redocVersion;
}
// static get version() {
// return redocVersion;
// }
static destroy() {
let el = dom.query('redoc');

View File

@ -1,6 +1,6 @@
'use strict';
import { ViewChildren, QueryList } from '@angular/core';
import { ViewChildren, QueryList, EventEmitter, Input} from '@angular/core';
import { RedocComponent, BaseComponent, SchemaManager } from '../base';
import JsonPointer from '../../utils/JsonPointer';
@ -11,22 +11,25 @@ import { RedocEventsService } from '../../services/index';
@RedocComponent({
selector: 'request-samples',
templateUrl: './lib/components/RequestSamples/request-samples.html',
styleUrls: ['./lib/components/RequestSamples/request-samples.css'],
templateUrl: './request-samples.html',
styleUrls: ['./request-samples.css'],
directives: [SchemaSample, Tabs, Tab],
inputs: ['schemaPointer'],
pipes: [PrismPipe],
detect: true,
onPushOnly: false
})
@Reflect.metadata('parameters', [[SchemaManager], [RedocEventsService], [new ViewChildren(Tabs), QueryList]])
export class RequestSamples extends BaseComponent {
constructor(schemaMgr, events, childQuery) {
childTabs: Tabs;
selectedLang: EventEmitter<any>;
data: any;
@Input() schemaPointer:string;
@ViewChildren(Tabs) childQuery:QueryList<Tabs>;
constructor(schemaMgr:SchemaManager, public events:RedocEventsService) {
super(schemaMgr);
childQuery.changes.subscribe(() => {
this.childTabs = childQuery.first;
this.childQuery.changes.subscribe(() => {
this.childTabs = this.childQuery.first;
});
this.events = events;
this.selectedLang = this.events.samplesLanguageChanged;
}

View File

@ -14,14 +14,15 @@ function isNumeric(n) {
@RedocComponent({
selector: 'responses-list',
templateUrl: './lib/components/ResponsesList/responses-list.html',
styleUrls: ['./lib/components/ResponsesList/responses-list.css'],
templateUrl: './responses-list.html',
styleUrls: ['./responses-list.css'],
directives: [JsonSchema, Zippy, JsonSchemaLazy],
detect: true
})
@Reflect.metadata('parameters', [[SchemaManager], [OptionsService]])
export class ResponsesList extends BaseComponent {
constructor(schemaMgr, optionsMgr) {
data: any;
options: any;
constructor(schemaMgr:SchemaManager, optionsMgr:OptionsService) {
super(schemaMgr);
this.options = optionsMgr.options;
}

View File

@ -1,7 +1,7 @@
'use strict';
import { forwardRef } from '@angular/core';
import { RedocComponent, BaseComponent } from '../base';
import { RedocComponent, BaseComponent, SchemaManager } from '../base';
import JsonPointer from '../../utils/JsonPointer';
import { Tabs, Tab } from '../../shared/components/index';
import { SchemaSample } from '../index';
@ -19,12 +19,13 @@ function hasExample(response) {
@RedocComponent({
selector: 'responses-samples',
templateUrl: './lib/components/ResponsesSamples/responses-samples.html',
styleUrls: ['./lib/components/ResponsesSamples/responses-samples.css'],
templateUrl: './responses-samples.html',
styleUrls: ['./responses-samples.css'],
directives: [forwardRef( ()=> SchemaSample), Tabs, Tab]
})
export class ResponsesSamples extends BaseComponent {
constructor(schemaMgr) {
data: any;
constructor(schemaMgr:SchemaManager) {
super(schemaMgr);
}

View File

@ -9,13 +9,14 @@ import { JsonFormatter } from '../../utils/JsonFormatterPipe';
@RedocComponent({
selector: 'schema-sample',
templateUrl: './lib/components/SchemaSample/schema-sample.html',
templateUrl: './schema-sample.html',
pipes: [JsonFormatter],
styleUrls: ['./lib/components/SchemaSample/schema-sample.css']
styleUrls: ['./schema-sample.css']
})
@Reflect.metadata('parameters', [[SchemaManager], [ElementRef]])
export class SchemaSample extends BaseComponent {
constructor(schemaMgr, elementRef) {
element: any;
data: any;
constructor(schemaMgr:SchemaManager, elementRef:ElementRef) {
super(schemaMgr);
this.element = elementRef.nativeElement;
}
@ -23,7 +24,7 @@ export class SchemaSample extends BaseComponent {
init() {
this.data = {};
let base = {};
let base:any = {};
let sample;
// got pointer not directly to the schema but e.g. to response obj

View File

@ -9,29 +9,31 @@ import { ScrollService, Hash, MenuService, OptionsService } from '../../services
@RedocComponent({
selector: 'side-menu',
templateUrl: './lib/components/SideMenu/side-menu.html',
templateUrl: './side-menu.html',
providers: [ScrollService, MenuService, Hash],
styleUrls: ['./lib/components/SideMenu/side-menu.css'],
styleUrls: ['./side-menu.css'],
detect: true,
onPushOnly: false
})
@Reflect.metadata('parameters', [[SchemaManager], [ElementRef], [BrowserDomAdapter],
[ScrollService], [MenuService], [Hash], [OptionsService], [ChangeDetectorRef]])
export class SideMenu extends BaseComponent {
constructor(schemaMgr, elementRef, dom, scrollService,
menuService, hash, optionsService, detectorRef) {
$element: any;
$mobileNav: any;
$resourcesNav: any;
$scrollParent: any;
activeCatCaption: string;
activeItemCaption: string;
options: any;
data: any;
constructor(schemaMgr:SchemaManager, elementRef:ElementRef, private dom:BrowserDomAdapter,
private scrollService:ScrollService, private menuService:MenuService, private hash:Hash,
optionsService:OptionsService, private detectorRef:ChangeDetectorRef) {
super(schemaMgr);
this.$element = elementRef.nativeElement;
this.dom = dom;
this.scrollService = scrollService;
this.menuService = menuService;
this.hash = hash;
this.activeCatCaption = '';
this.activeItemCaption = '';
this.options = optionsService.options;
this.detectorRef = detectorRef;
this.menuService.changed.subscribe((evt) => this.changed(evt));
}

View File

@ -1,7 +1,7 @@
'use strict';
import { Component, ChangeDetectionStrategy } from '@angular/core';
import { CORE_DIRECTIVES, JsonPipe, AsyncPipe } from '@angular/common';
import SchemaManager from '../utils/SchemaManager';
import { SchemaManager } from '../utils/SchemaManager';
import JsonPointer from '../utils/JsonPointer';
import { MarkedPipe, JsonPointerEscapePipe } from '../utils/pipes';
@ -94,10 +94,10 @@ export function RedocComponent(options) {
* Generic Component
* @class
*/
@Reflect.metadata('parameters', [[SchemaManager]])
export class BaseComponent {
constructor(schemaMgr) {
this.schemaMgr = schemaMgr;
componentSchema: any;
pointer: String;
constructor(public schemaMgr: SchemaManager) {
this.componentSchema = null;
}
@ -166,7 +166,7 @@ export class BaseComponent {
return schema;
};
this.componentSchema = snapshot(resolve(schema, 1));
this.componentSchema = snapshot(resolve(schema));
}
static joinAllOf(schema, opts) {

View File

@ -3,5 +3,5 @@
import {Redoc} from './components/index';
export var init = Redoc.init;
window.Redoc = Redoc;
window['Redoc'] = Redoc;
Redoc.autoInit();

View File

@ -1,10 +0,0 @@
'use strict';
import { EventEmitter } from '@angular/core';
export class RedocEventsService {
constructor() {
this.bootstrapped = new EventEmitter();
this.samplesLanguageChanged = new EventEmitter();
}
}

View File

@ -0,0 +1,8 @@
'use strict';
import { EventEmitter, Output } from '@angular/core';
export class RedocEventsService {
@Output() bootstrapped = new EventEmitter();
@Output() samplesLanguageChanged = new EventEmitter();
}

View File

@ -19,7 +19,7 @@ describe('Hash Service', () => {
it('should trigger changed event after ReDoc bootstrapped', (done) => {
spyOn(hashService.changed, 'next').and.callThrough();
events.bootstrapped.next();
events.bootstrapped.next({});
setTimeout(() => {
expect(hashService.changed.next).toHaveBeenCalled();
done();

View File

@ -1,16 +1,15 @@
'use strict';
import { Injectable, EventEmitter } from '@angular/core';
import { Injectable, EventEmitter, Output } from '@angular/core';
import { BrowserDomAdapter } from '@angular/platform-browser/src/browser/browser_adapter';
import { global } from '@angular/core/src/facade/lang';
import { RedocEventsService } from './events.service';
@Reflect.metadata('parameters', [[BrowserDomAdapter], [RedocEventsService]])
@Injectable()
export class Hash {
constructor(dom, events) {
this.changed = new EventEmitter();
this.dom = dom;
@Output() changed = new EventEmitter();
private _cancel: any;
constructor(private dom:BrowserDomAdapter, private events:RedocEventsService) {
this.bind();
events.bootstrapped.subscribe(() => this.changed.next(this.hash));

View File

@ -1,7 +0,0 @@
'use strict';
export * from './events.service.js';
export * from './options.service.js';
export * from './menu.service.js';
export * from './scroll.service.js';
export * from './hash.service.js';

7
lib/services/index.ts Normal file
View File

@ -0,0 +1,7 @@
'use strict';
export * from './events.service';
export * from './options.service';
export * from './menu.service';
export * from './scroll.service';
export * from './hash.service';

View File

@ -1,8 +1,8 @@
'use strict';
import { Injectable, EventEmitter } from '@angular/core';
import { ScrollService, INVIEW_POSITION } from './scroll.service.js';
import { Hash } from './hash.service.js';
import SchemaManager from '../utils/SchemaManager';
import { ScrollService, INVIEW_POSITION } from './scroll.service';
import { Hash } from './hash.service';
import { SchemaManager } from '../utils/SchemaManager';
const CHANGE = {
NEXT : 1,
@ -10,16 +10,17 @@ const CHANGE = {
INITIAL : 0
};
@Reflect.metadata('parameters', [[Hash], [ScrollService], [SchemaManager]])
@Injectable()
export class MenuService {
constructor(hash, scrollService, schemaMgr) {
this.hash = hash;
this.scrollService = scrollService;
changed: EventEmitter<any> = new EventEmitter();
categories: any;
activeCatIdx: number = 0;
activeMethodIdx: number = -1;
activeMethodPtr: string;
this.activeCatIdx = 0;
this.activeMethodIdx = -1;
this.changed = new EventEmitter();
constructor(private hash:Hash, private scrollService:ScrollService, schemaMgr:SchemaManager) {
this.hash = hash;
this.categories = Array.from(schemaMgr.buildMenuTree().entries()).map(
el => ({name: el[0], description: el[1].description, methods: el[1].methods})

View File

@ -7,15 +7,16 @@ import { global } from '@angular/core/src/facade/lang';
const defaults = {
scrollYOffset: 0,
disableLazySchemas: false,
debugMode: global && global.redocDebugMode
debugMode: false//global && global.redocDebugMode
};
const OPTION_NAMES = new Set(['scrollYOffset', 'disableLazySchemas', 'specUrl']);
@Injectable()
@Reflect.metadata('parameters', [[BrowserDomAdapter]])
export class OptionsService {
constructor(dom) {
private _options: any;
constructor(private dom:BrowserDomAdapter) {
this._options = defaults;
this.dom = dom;
}

View File

@ -1,7 +1,7 @@
'use strict';
import { Injectable, EventEmitter } from '@angular/core';
import { Injectable, EventEmitter, Output } from '@angular/core';
import { BrowserDomAdapter } from '@angular/platform-browser/src/browser/browser_adapter';
import { OptionsService } from './options.service.js';
import { OptionsService } from './options.service';
export const INVIEW_POSITION = {
ABOVE : 1,
@ -9,11 +9,14 @@ export const INVIEW_POSITION = {
INVIEW: 0
};
@Reflect.metadata('parameters', [
[BrowserDomAdapter], [OptionsService]])
@Injectable()
export class ScrollService {
constructor(dom, optionsService) {
scrollYOffset: any;
$scrollParent: any;
@Output() scroll = new EventEmitter();
private prevOffsetY: number;
private _cancel:any;
constructor(private dom:BrowserDomAdapter, optionsService:OptionsService) {
//events.bootstrapped.subscribe(() => this.hashScroll());
this.scrollYOffset = () => optionsService.options.scrollYOffset();
this.$scrollParent = optionsService.options.$scrollParent;

View File

@ -1,30 +1,30 @@
'use strict';
import {Component, EventEmitter, ElementRef} from '@angular/core';
import {Component, EventEmitter, ElementRef, Output} from '@angular/core';
import {CORE_DIRECTIVES} from '@angular/common';
import DropKick from 'Robdel12/DropKick';
import 'Robdel12/DropKick/build/css/dropkick.css!css';
import DropKick from 'dropkickjs';
//import 'Robdel12/DropKick/build/css/dropkick.css!css';
@Component({
selector: 'dropdown',
events: ['change'],
template: `
<select (change)=onChange($event.target.value)>
<ng-content></ng-content>
</select>
`,
directives: [CORE_DIRECTIVES],
styleUrls: ['./lib/shared/components/DropDown/drop-down.css']
styleUrls: ['./drop-down.css']
})
@Reflect.metadata('parameters', [[ElementRef]])
export class DropDown {
constructor(elem) {
this.change = new EventEmitter();
@Output() change = new EventEmitter();
elem: any;
inst: any;
constructor(elem:ElementRef) {
this.elem = elem.nativeElement;
}
ngAfterContentInit() {
this.inst = new DropKick(this.elem.firstElementChild, {autoWidth: true});
//this.inst = new DropKick(this.elem.firstElementChild, {autoWidth: true});
}
onChange(value) {

View File

@ -1,17 +1,21 @@
'use strict';
import {Directive, ElementRef} from '@angular/core';
import {Directive, ElementRef, Input} from '@angular/core';
import {BrowserDomAdapter} from '@angular/platform-browser/src/browser/browser_adapter';
@Directive({
selector: '[sticky-sidebar]',
inputs: ['scrollParent', 'scrollYOffset']
})
@Reflect.metadata('parameters', [[ElementRef], [BrowserDomAdapter]])
export class StickySidebar {
constructor(elementRef, dom) {
$element: any;
cancelScrollBinding: any;
$redocEl: any;
@Input() scrollParent:any;
@Input() scrollYOffset:any;
constructor(elementRef:ElementRef, private dom:BrowserDomAdapter) {
this.$element = elementRef.nativeElement;
this.dom = dom;
// initial styling
this.dom.setStyle(this.$element, 'position', 'absolute');
@ -44,7 +48,7 @@ export class StickySidebar {
unstick() {
this.dom.setStyle(this.$element, 'position', 'absolute');
this.dom.setStyle(this.$element, 'top', 0);
this.dom.setStyle(this.$element, 'top', '0');
}
get scrollY() {
@ -53,7 +57,7 @@ export class StickySidebar {
ngOnInit() {
// FIXME use more reliable code
this.$redocEl = this.$element.offsetParent;
this.$redocEl = this.$element.offsetParent || this.dom.defaultDoc().body;
this.bind();
}

View File

@ -1,13 +1,11 @@
'use strict';
import { Component, EventEmitter } from '@angular/core';
import { Component, EventEmitter, Input, Output } from '@angular/core';
import { CORE_DIRECTIVES } from '@angular/common';
import { ChangeDetectorRef, ChangeDetectionStrategy } from '@angular/core';
@Component({
selector: 'tabs',
events: ['change'],
inputs: ['selected'],
template: `
<ul>
<li *ngFor="let tab of tabs" [ngClass]="{active: tab.active}" (click)="selectTab(tab)"
@ -16,16 +14,14 @@ import { ChangeDetectorRef, ChangeDetectionStrategy } from '@angular/core';
<ng-content></ng-content>
`,
directives: [CORE_DIRECTIVES],
styleUrls: ['./lib/shared/components/Tabs/tabs.css'],
styleUrls: ['tabs.css'],
changeDetection: ChangeDetectionStrategy.OnPush
})
@Reflect.metadata('parameters', [[ChangeDetectorRef]])
export class Tabs {
constructor(changeDetector) {
this.tabs = [];
this.change = new EventEmitter();
this.changeDetector = changeDetector;
}
@Input() selected: any;
@Output() change = new EventEmitter();
tabs: Tab[] = [];
constructor(private changeDetector:ChangeDetectorRef) {}
selectTab(tab, notify = true) {
if (tab.active) return;
@ -69,7 +65,6 @@ export class Tabs {
@Component({
selector: 'tab',
inputs: ['tabTitle', 'tabStatus'],
template: `
<div class="tab-wrap" [ngClass]="{'active': active}">
<ng-content></ng-content>
@ -86,10 +81,11 @@ export class Tabs {
}`
]
})
@Reflect.metadata('parameters', [ [Tabs] ])
export class Tab {
constructor(tabs) {
this.active = false;
@Input() active: boolean = false;
@Input() tabTitle: string;
@Input() tabStatus: string;
constructor(tabs: Tabs) {
tabs.addTab(this);
}
}

View File

@ -0,0 +1,5 @@
/**
* This file is generated by the Angular 2 template compiler.
* Do not edit.
*/
export const styles:any[] = ['.zippy-title[_ngcontent-%COMP%]{padding:10px;border-radius:2px;margin:2px 0;line-height:1.5em;background-color:#f2f2f2;cursor:pointer}.zippy-success[_ngcontent-%COMP%]>.zippy-title[_ngcontent-%COMP%]{color:#00aa13;background-color:rgba(0,170,19,0.08)}.zippy-error[_ngcontent-%COMP%]>.zippy-title[_ngcontent-%COMP%]{color:#e53935;background-color:rgba(229,57,53,0.06)}.zippy-redirect[_ngcontent-%COMP%]>.zippy-title[_ngcontent-%COMP%]{color:#263238;background-color:rgba(38,50,56,0.08)}.zippy-info[_ngcontent-%COMP%]>.zippy-title[_ngcontent-%COMP%]{color:#0033a0;background-color:rgba(0,51,160,0.08)}span.zippy-indicator[_ngcontent-%COMP%]{font-size:1.2em;margin-right:0.2em;position:relative;top:0}.zippy-content[_ngcontent-%COMP%]{padding:15px 0}.zippy-empty[_ngcontent-%COMP%] .zippy-title[_ngcontent-%COMP%]{cursor:default}.zippy-empty[_ngcontent-%COMP%] .zippy-indicator[_ngcontent-%COMP%]{display:none}.zippy-empty[_ngcontent-%COMP%] .zippy-content[_ngcontent-%COMP%]{display:none}.zippy-hidden[_ngcontent-%COMP%]{overflow:hidden;visibility:hidden;height:0;padding:0}'];

View File

@ -1,29 +0,0 @@
'use strict';
import {Component, EventEmitter} from '@angular/core';
import {CORE_DIRECTIVES} from '@angular/common';
@Component({
selector: 'zippy',
events: ['open', 'close'],
inputs: ['title', 'visible', 'type', 'empty'],
templateUrl: './lib/shared/components/Zippy/zippy.html',
styleUrls: ['./lib/shared/components/Zippy/zippy.css'],
directives: [CORE_DIRECTIVES]
})
export class Zippy {
constructor() {
this.type = 'general';
this.visible = false;
this.empty = false;
this.open = new EventEmitter();
this.close = new EventEmitter();
}
toggle() {
this.visible = !this.visible;
if (this.empty) return;
(this.visible) ? this.open.next() : this.close.next();
}
}

View File

@ -0,0 +1,25 @@
'use strict';
import {Component, EventEmitter, Output, Input} from '@angular/core';
import {CORE_DIRECTIVES} from '@angular/common';
@Component({
selector: 'zippy',
templateUrl: './zippy.html',
styleUrls: ['./zippy.css'],
directives: [CORE_DIRECTIVES]
})
export class Zippy {
@Input() type = 'general';
@Input() visible = false;
@Input() empty = false;
@Input() title;
@Output() open = new EventEmitter();
@Output() close = new EventEmitter();
toggle() {
this.visible = !this.visible;
if (this.empty) return;
(this.visible) ? this.open.next({}) : this.close.next({});
}
}

View File

@ -1,10 +1,12 @@
'use strict';
import JsonPointerLib from 'json-pointer';
const origParse = JsonPointerLib.parse;
/**
* Wrapper for JsonPointer. Provides common operations
*/
export class JsonPointer extends JsonPointerLib {
class JsonPointer {
/**
* returns last JsonPointer token
* if level > 1 returns levels last (second last/third last)
@ -30,7 +32,7 @@ export class JsonPointer extends JsonPointerLib {
*/
static dirName(pointer, level=1) {
let tokens = JsonPointer.parse(pointer);
return JsonPointer.compile(tokens.slice(0, tokens.length - level));
return JsonPointerLib.compile(tokens.slice(0, tokens.length - level));
}
/**
@ -42,7 +44,7 @@ export class JsonPointer extends JsonPointerLib {
if (ptr.charAt(0) === '#') {
ptr = ptr.substring(1);
}
return JsonPointerLib._origParse(ptr);
return origParse(ptr);
}
/**
@ -56,13 +58,21 @@ export class JsonPointer extends JsonPointerLib {
// TODO: optimize
let baseTokens = JsonPointer.parse(base);
let resTokens = baseTokens.concat(tokens);
return JsonPointer.compile(resTokens);
return JsonPointerLib.compile(resTokens);
}
static get(object: Object, pointer:string) {
return JsonPointerLib.get(object, pointer);
}
static compile(tokens: string[]) {
return JsonPointerLib.compile(tokens);
}
static escape(pointer: string) {
return JsonPointerLib.escape(pointer);
}
}
JsonPointerLib._origParse = JsonPointerLib.parse;
JsonPointerLib.parse = JsonPointer.parse;
Object.assign(JsonPointer, JsonPointerLib);
export default JsonPointer;

View File

@ -1,17 +1,20 @@
'use strict';
import JsonSchemaRefParser from 'json-schema-ref-parser';
import JsonSchemaRefParser from 'json-schema-ref-parser/dist/ref-parser';
import JsonPointer from './JsonPointer';
import {methods as swaggerMethods} from './swagger-defs';
export default class SchemaManager {
export class SchemaManager {
private _schema:any = {};
private _instance:any;
apiUrl: string;
constructor() {
if (SchemaManager.prototype._instance) {
return SchemaManager.prototype._instance;
}
SchemaManager.prototype._instance = this;
this._schema = {};
}
static instance() {
@ -117,7 +120,7 @@ export default class SchemaManager {
}
/* returns ES6 Map */
buildMenuTree() {
buildMenuTree():Map<string, any> {
let tag2MethodMapping = new Map();
let definedTags = this._schema.tags || [];
@ -142,7 +145,7 @@ export default class SchemaManager {
tags = ['[Other]'];
}
let methodPointer = JsonPointer.compile(['paths', path, method]);
let methodSummary = methodInfo.summary;
let methodSummary = methodInfo.summary || methodInfo.operationId;
for (let tag of tags) {
let tagDetails = tag2MethodMapping.get(tag);
if (!tagDetails) {

View File

@ -7,4 +7,4 @@ function $buo_f(){
document.body.appendChild(e);
}
try {document.addEventListener('DOMContentLoaded', $buo_f, false);}
catch(e){window.attachEvent('onload', $buo_f);}
catch(e){window['attachEvent']('onload', $buo_f);}

View File

@ -3,19 +3,20 @@
import {Pipe} from '@angular/core';
import {isString, stringify, isBlank} from '@angular/core/src/facade/lang';
import {BaseException} from '@angular/core/src/facade/exceptions';
import {JsonPointer} from './JsonPointer';
import JsonPointer from './JsonPointer';
import Prism from '../../prismjs-bundle';
//import '../../prismjs-bundle';
declare var Prism: any;
import 'prismjs/themes/prism-dark.css!css';
import 'hint.css/hint.base.css!css';
//import 'prismjs/themes/prism-dark.css!css';
//import 'hint.css/hint.base.css!css';
import marked from 'marked';
// in gfm mode marked doesn't parse #Heading (without space after #) as heading
// https://github.com/chjj/marked/issues/642
marked.Lexer.rules.gfm.heading = marked.Lexer.rules.normal.heading;
marked.Lexer.rules.tables.heading = marked.Lexer.rules.normal.heading;
marked['Lexer'].rules.gfm.heading = marked['Lexer'].rules.normal.heading;
marked['Lexer'].rules.tables.heading = marked['Lexer'].rules.normal.heading;
marked.setOptions({
renderer: new marked.Renderer(),

View File

View File

@ -63,16 +63,39 @@
"overrides": {
"github:Robdel12/DropKick@2.1.7": {
"format": "global"
},
"npm:@angular/core@2.0.0-rc.1": {
"main": "esm/index.js",
"format": "esm"
},
"npm:@angular/common@2.0.0-rc.1": {
"main": "esm/index.js",
"format": "esm"
},
"npm:@angular/compiler@2.0.0-rc.1": {
"main": "esm/index.js",
"format": "esm"
},
"npm:@angular/platform-browser-dynamic@2.0.0-rc.1": {
"main": "esm/index.js",
"format": "esm"
},
"npm:@angular/platform-browser@2.0.0-rc.1": {
"main": "esm/index.js",
"format": "esm"
}
}
},
"devDependencies": {
"@angular/compiler-cli": "^0.2.0",
"@angular/platform-server": "^2.0.0-rc.1",
"babel-eslint": "^4.1.6",
"babel-polyfill": "^6.3.14",
"branch-release": "^0.3.2",
"browser-sync": "^2.10.1",
"del": "^2.2.0",
"deploy-to-gh-pages": "^1.0.0",
"dropkickjs": "github:robdel12/DropKick",
"gulp": "^3.9.1",
"gulp-concat": "^2.6.0",
"gulp-eslint": "^1.1.1",
@ -87,6 +110,7 @@
"istanbul": "github:gotwarlost/istanbul#source-map",
"jasmine-core": "^2.4.1",
"jasmine-spec-reporter": "^2.4.0",
"json-schema-instantiator": "^0.3.0",
"jspm": "^0.16.34",
"karma": "^0.13.15",
"karma-babel-preprocessor": "^5.2.2",
@ -101,17 +125,35 @@
"karma-regex-preprocessor": "github:makern/karma-regex-preprocessor",
"karma-should": "^1.0.0",
"karma-sinon": "^1.0.4",
"node-sass": "^3.7.0",
"phantomjs-prebuilt": "^2.1.7",
"protractor": "^3.0.0",
"reflect-metadata": "^0.1.2",
"require-dir": "^0.3.0",
"run-sequence": "^1.1.5",
"rxjs-es": "^5.0.0-beta.7",
"shelljs": "^0.7.0",
"should": "^8.0.2",
"sinon": "^1.17.2",
"systemjs-builder": "^0.15.16",
"typescript": "^1.8.10",
"vinyl-paths": "^2.0.0",
"yargs": "^4.7.1",
"zone.js": "^0.6.12"
},
"dependencies": {
"@angular/common": "^2.0.0-rc.1",
"@angular/compiler": "^2.0.0-rc.1",
"@angular/core": "^2.0.0-rc.1",
"@angular/platform-browser": "^2.0.0-rc.1",
"@angular/platform-browser-dynamic": "^2.0.0-rc.1",
"gulp-inline-ng2-template": "^1.1.4",
"json-pointer": "^0.5.0",
"json-schema-ref-parser": "^3.1.2",
"marked": "^0.3.5",
"rollup-plugin-commonjs": "^2.2.1",
"rxjs": "^5.0.0-beta.6",
"scrollparent": "^1.0.0",
"zone.js": "^0.6.12"
}
}

58
rollup.config.js Normal file
View File

@ -0,0 +1,58 @@
import nodeResolve from 'rollup-plugin-node-resolve';
import commonjs from 'rollup-plugin-commonjs';
class RollupNG2 {
constructor(options) {
this.options = options;
}
resolveId(id, from) {
if (id.startsWith('rxjs/')) {
return `${__dirname}/node_modules/rxjs-es/${id.replace('rxjs/', '')}.js`;
}
if(id.startsWith('@angular/core')){
if(id === '@angular/core'){
return `${__dirname}/node_modules/@angular/core/esm/index.js`;
}
return `${__dirname}/node_modules/@angular/core/esm/${id.split('@angular/core').pop()}.js`;
}
if(id.startsWith('@angular/common')){
if(id === '@angular/common'){
return `${__dirname}/node_modules/@angular/common/esm/index.js`;
}
return `${__dirname}/node_modules/@angular/common/esm/${id.split('@angular/common').pop()}.js`;
}
if(id.startsWith('@angular/platform-browser-dynamic')){
if(id === '@angular/platform-browser-dynamic'){
return `${__dirname}/node_modules/@angular/platform-browser-dynamic/esm/index.js`;
}
return `${__dirname}/node_modules/@angular/platform-browser-dynamic/esm/${id.split('@angular/platform-browser-dynamic').pop()}.js`;
}
if(id.startsWith('@angular/platform-browser')){
if(id === '@angular/platform-browser'){
return `${__dirname}/node_modules/@angular/platform-browser/esm/index.js`;
}
return `${__dirname}/node_modules/@angular/platform-browser/esm/${id.split('@angular/platform-browser').pop()}.js`;
}
}
}
const rollupNG2 = (config) => new RollupNG2(config);
export default {
entry: './.tmp-es/index.js',
dest: 'dist/vendor.es2015.js',
format: 'iife',
moduleName: 'ReDoc',
plugins: [
//typescript(),
rollupNG2(),
nodeResolve({ jsnext: true, main: true, browser: true }),
commonjs({
// non-CommonJS modules will be ignored, but you can also
// specifically include/exclude files
include: 'node_modules/**', // Default: undefined
exclude: [ 'node_modules/@angular/**', 'node_modules/rxjs/**', 'node_modules/rxjs-es/**' ], // Default: undefined
namedExports: { 'marked': ['marked'] } // Default: undefined
})
]
}

View File

@ -138,15 +138,12 @@ System.config({
"browserify-zlib": "npm:browserify-zlib@0.1.4"
},
"npm:@angular/common@2.0.0-rc.1": {
"@angular/core": "npm:@angular/core@2.0.0-rc.1",
"process": "github:jspm/nodelibs-process@0.1.2"
"@angular/core": "npm:@angular/core@2.0.0-rc.1"
},
"npm:@angular/compiler@2.0.0-rc.1": {
"@angular/core": "npm:@angular/core@2.0.0-rc.1",
"process": "github:jspm/nodelibs-process@0.1.2"
"@angular/core": "npm:@angular/core@2.0.0-rc.1"
},
"npm:@angular/core@2.0.0-rc.1": {
"process": "github:jspm/nodelibs-process@0.1.2",
"rxjs": "npm:rxjs@5.0.0-beta.6",
"zone.js": "npm:zone.js@0.6.12"
},
@ -154,14 +151,12 @@ System.config({
"@angular/common": "npm:@angular/common@2.0.0-rc.1",
"@angular/compiler": "npm:@angular/compiler@2.0.0-rc.1",
"@angular/core": "npm:@angular/core@2.0.0-rc.1",
"@angular/platform-browser": "npm:@angular/platform-browser@2.0.0-rc.1",
"process": "github:jspm/nodelibs-process@0.1.2"
"@angular/platform-browser": "npm:@angular/platform-browser@2.0.0-rc.1"
},
"npm:@angular/platform-browser@2.0.0-rc.1": {
"@angular/common": "npm:@angular/common@2.0.0-rc.1",
"@angular/compiler": "npm:@angular/compiler@2.0.0-rc.1",
"@angular/core": "npm:@angular/core@2.0.0-rc.1",
"process": "github:jspm/nodelibs-process@0.1.2"
"@angular/core": "npm:@angular/core@2.0.0-rc.1"
},
"npm:amdefine@1.0.0": {
"fs": "github:jspm/nodelibs-fs@0.1.2",

20
tsconfig.json Normal file
View File

@ -0,0 +1,20 @@
{
"compilerOptions": {
"experimentalDecorators": true,
"emitDecoratorMetadata": true,
"module": "es6",
"target": "es6",
"noImplicitAny": false,
"sourceMap": false,
"outDir": ".tmp-es/",
"moduleResolution": "node"
},
"exclude": [
"node_modules",
"lib",
"jspm_packages",
"build",
"docs",
"*.spec.js"
]
}

11
typings.json Normal file
View File

@ -0,0 +1,11 @@
{
"globalDevDependencies": {
"jasmine": "registry:dt/jasmine#2.2.0+20160505161446"
},
"globalDependencies": {
"marked": "registry:dt/marked#0.0.0+20160325085301"
},
"ambientDevDependencies": {
"es6-shim": "github:DefinitelyTyped/DefinitelyTyped/es6-shim/es6-shim.d.ts#6697d6f7dadbf5773cb40ecda35a76027e0783b2"
}
}

7
typings/dropkick.d.ts vendored Normal file
View File

@ -0,0 +1,7 @@
// Generated by typings
// Source: https://raw.githubusercontent.com/DefinitelyTyped/DefinitelyTyped/7de6c3dd94feaeb21f20054b9f30d5dabc5efabd/json-pointer/json-pointer.d.ts
declare module "dropkickjs" {
var x: any;
export default x;
}

501
typings/globals/jasmine/index.d.ts vendored Normal file
View File

@ -0,0 +1,501 @@
// Generated by typings
// Source: https://raw.githubusercontent.com/DefinitelyTyped/DefinitelyTyped/36a1be34dbe202c665b3ddafd50824f78c09eea3/jasmine/jasmine.d.ts
declare function describe(description: string, specDefinitions: () => void): void;
declare function fdescribe(description: string, specDefinitions: () => void): void;
declare function xdescribe(description: string, specDefinitions: () => void): void;
declare function it(expectation: string, assertion?: () => void, timeout?: number): void;
declare function it(expectation: string, assertion?: (done: DoneFn) => void, timeout?: number): void;
declare function fit(expectation: string, assertion?: () => void, timeout?: number): void;
declare function fit(expectation: string, assertion?: (done: DoneFn) => void, timeout?: number): void;
declare function xit(expectation: string, assertion?: () => void, timeout?: number): void;
declare function xit(expectation: string, assertion?: (done: DoneFn) => void, timeout?: number): void;
/** If you call the function pending anywhere in the spec body, no matter the expectations, the spec will be marked pending. */
declare function pending(reason?: string): void;
declare function beforeEach(action: () => void, timeout?: number): void;
declare function beforeEach(action: (done: DoneFn) => void, timeout?: number): void;
declare function afterEach(action: () => void, timeout?: number): void;
declare function afterEach(action: (done: DoneFn) => void, timeout?: number): void;
declare function beforeAll(action: () => void, timeout?: number): void;
declare function beforeAll(action: (done: DoneFn) => void, timeout?: number): void;
declare function afterAll(action: () => void, timeout?: number): void;
declare function afterAll(action: (done: DoneFn) => void, timeout?: number): void;
declare function expect(spy: Function): jasmine.Matchers;
declare function expect(actual: any): jasmine.Matchers;
declare function fail(e?: any): void;
/** Action method that should be called when the async work is complete */
interface DoneFn extends Function {
(): void;
/** fails the spec and indicates that it has completed. If the message is an Error, Error.message is used */
fail: (message?: Error|string) => void;
}
declare function spyOn(object: any, method: string): jasmine.Spy;
declare function runs(asyncMethod: Function): void;
declare function waitsFor(latchMethod: () => boolean, failureMessage?: string, timeout?: number): void;
declare function waits(timeout?: number): void;
declare namespace jasmine {
var clock: () => Clock;
function any(aclass: any): Any;
function anything(): Any;
function arrayContaining(sample: any[]): ArrayContaining;
function objectContaining(sample: any): ObjectContaining;
function createSpy(name: string, originalFn?: Function): Spy;
function createSpyObj(baseName: string, methodNames: any[]): any;
function createSpyObj<T>(baseName: string, methodNames: any[]): T;
function pp(value: any): string;
function getEnv(): Env;
function addCustomEqualityTester(equalityTester: CustomEqualityTester): void;
function addMatchers(matchers: CustomMatcherFactories): void;
function stringMatching(str: string): Any;
function stringMatching(str: RegExp): Any;
interface Any {
new (expectedClass: any): any;
jasmineMatches(other: any): boolean;
jasmineToString(): string;
}
// taken from TypeScript lib.core.es6.d.ts, applicable to CustomMatchers.contains()
interface ArrayLike<T> {
length: number;
[n: number]: T;
}
interface ArrayContaining {
new (sample: any[]): any;
asymmetricMatch(other: any): boolean;
jasmineToString(): string;
}
interface ObjectContaining {
new (sample: any): any;
jasmineMatches(other: any, mismatchKeys: any[], mismatchValues: any[]): boolean;
jasmineToString(): string;
}
interface Block {
new (env: Env, func: SpecFunction, spec: Spec): any;
execute(onComplete: () => void): void;
}
interface WaitsBlock extends Block {
new (env: Env, timeout: number, spec: Spec): any;
}
interface WaitsForBlock extends Block {
new (env: Env, timeout: number, latchFunction: SpecFunction, message: string, spec: Spec): any;
}
interface Clock {
install(): void;
uninstall(): void;
/** Calls to any registered callback are triggered when the clock is ticked forward via the jasmine.clock().tick function, which takes a number of milliseconds. */
tick(ms: number): void;
mockDate(date?: Date): void;
}
interface CustomEqualityTester {
(first: any, second: any): boolean;
}
interface CustomMatcher {
compare<T>(actual: T, expected: T): CustomMatcherResult;
compare(actual: any, expected: any): CustomMatcherResult;
}
interface CustomMatcherFactory {
(util: MatchersUtil, customEqualityTesters: Array<CustomEqualityTester>): CustomMatcher;
}
interface CustomMatcherFactories {
[index: string]: CustomMatcherFactory;
}
interface CustomMatcherResult {
pass: boolean;
message?: string;
}
interface MatchersUtil {
equals(a: any, b: any, customTesters?: Array<CustomEqualityTester>): boolean;
contains<T>(haystack: ArrayLike<T> | string, needle: any, customTesters?: Array<CustomEqualityTester>): boolean;
buildFailureMessage(matcherName: string, isNot: boolean, actual: any, ...expected: Array<any>): string;
}
interface Env {
setTimeout: any;
clearTimeout: void;
setInterval: any;
clearInterval: void;
updateInterval: number;
currentSpec: Spec;
matchersClass: Matchers;
version(): any;
versionString(): string;
nextSpecId(): number;
addReporter(reporter: Reporter): void;
execute(): void;
describe(description: string, specDefinitions: () => void): Suite;
// ddescribe(description: string, specDefinitions: () => void): Suite; Not a part of jasmine. Angular team adds these
beforeEach(beforeEachFunction: () => void): void;
beforeAll(beforeAllFunction: () => void): void;
currentRunner(): Runner;
afterEach(afterEachFunction: () => void): void;
afterAll(afterAllFunction: () => void): void;
xdescribe(desc: string, specDefinitions: () => void): XSuite;
it(description: string, func: () => void): Spec;
// iit(description: string, func: () => void): Spec; Not a part of jasmine. Angular team adds these
xit(desc: string, func: () => void): XSpec;
compareRegExps_(a: RegExp, b: RegExp, mismatchKeys: string[], mismatchValues: string[]): boolean;
compareObjects_(a: any, b: any, mismatchKeys: string[], mismatchValues: string[]): boolean;
equals_(a: any, b: any, mismatchKeys: string[], mismatchValues: string[]): boolean;
contains_(haystack: any, needle: any): boolean;
addCustomEqualityTester(equalityTester: CustomEqualityTester): void;
addMatchers(matchers: CustomMatcherFactories): void;
specFilter(spec: Spec): boolean;
}
interface FakeTimer {
new (): any;
reset(): void;
tick(millis: number): void;
runFunctionsWithinRange(oldMillis: number, nowMillis: number): void;
scheduleFunction(timeoutKey: any, funcToCall: () => void, millis: number, recurring: boolean): void;
}
interface HtmlReporter {
new (): any;
}
interface HtmlSpecFilter {
new (): any;
}
interface Result {
type: string;
}
interface NestedResults extends Result {
description: string;
totalCount: number;
passedCount: number;
failedCount: number;
skipped: boolean;
rollupCounts(result: NestedResults): void;
log(values: any): void;
getItems(): Result[];
addResult(result: Result): void;
passed(): boolean;
}
interface MessageResult extends Result {
values: any;
trace: Trace;
}
interface ExpectationResult extends Result {
matcherName: string;
passed(): boolean;
expected: any;
actual: any;
message: string;
trace: Trace;
}
interface Trace {
name: string;
message: string;
stack: any;
}
interface PrettyPrinter {
new (): any;
format(value: any): void;
iterateObject(obj: any, fn: (property: string, isGetter: boolean) => void): void;
emitScalar(value: any): void;
emitString(value: string): void;
emitArray(array: any[]): void;
emitObject(obj: any): void;
append(value: any): void;
}
interface StringPrettyPrinter extends PrettyPrinter {
}
interface Queue {
new (env: any): any;
env: Env;
ensured: boolean[];
blocks: Block[];
running: boolean;
index: number;
offset: number;
abort: boolean;
addBefore(block: Block, ensure?: boolean): void;
add(block: any, ensure?: boolean): void;
insertNext(block: any, ensure?: boolean): void;
start(onComplete?: () => void): void;
isRunning(): boolean;
next_(): void;
results(): NestedResults;
}
interface Matchers {
new (env: Env, actual: any, spec: Env, isNot?: boolean): any;
env: Env;
actual: any;
spec: Env;
isNot?: boolean;
message(): any;
toBe(expected: any, expectationFailOutput?: any): boolean;
toEqual(expected: any, expectationFailOutput?: any): boolean;
toMatch(expected: string | RegExp, expectationFailOutput?: any): boolean;
toBeDefined(expectationFailOutput?: any): boolean;
toBeUndefined(expectationFailOutput?: any): boolean;
toBeNull(expectationFailOutput?: any): boolean;
toBeNaN(): boolean;
toBeTruthy(expectationFailOutput?: any): boolean;
toBeFalsy(expectationFailOutput?: any): boolean;
toHaveBeenCalled(): boolean;
toHaveBeenCalledWith(...params: any[]): boolean;
toHaveBeenCalledTimes(expected: number): boolean;
toContain(expected: any, expectationFailOutput?: any): boolean;
toBeLessThan(expected: number, expectationFailOutput?: any): boolean;
toBeGreaterThan(expected: number, expectationFailOutput?: any): boolean;
toBeCloseTo(expected: number, precision: any, expectationFailOutput?: any): boolean;
toThrow(expected?: any): boolean;
toThrowError(message?: string | RegExp): boolean;
toThrowError(expected?: new (...args: any[]) => Error, message?: string | RegExp): boolean;
not: Matchers;
Any: Any;
}
interface Reporter {
reportRunnerStarting(runner: Runner): void;
reportRunnerResults(runner: Runner): void;
reportSuiteResults(suite: Suite): void;
reportSpecStarting(spec: Spec): void;
reportSpecResults(spec: Spec): void;
log(str: string): void;
}
interface MultiReporter extends Reporter {
addReporter(reporter: Reporter): void;
}
interface Runner {
new (env: Env): any;
execute(): void;
beforeEach(beforeEachFunction: SpecFunction): void;
afterEach(afterEachFunction: SpecFunction): void;
beforeAll(beforeAllFunction: SpecFunction): void;
afterAll(afterAllFunction: SpecFunction): void;
finishCallback(): void;
addSuite(suite: Suite): void;
add(block: Block): void;
specs(): Spec[];
suites(): Suite[];
topLevelSuites(): Suite[];
results(): NestedResults;
}
interface SpecFunction {
(spec?: Spec): void;
}
interface SuiteOrSpec {
id: number;
env: Env;
description: string;
queue: Queue;
}
interface Spec extends SuiteOrSpec {
new (env: Env, suite: Suite, description: string): any;
suite: Suite;
afterCallbacks: SpecFunction[];
spies_: Spy[];
results_: NestedResults;
matchersClass: Matchers;
getFullName(): string;
results(): NestedResults;
log(arguments: any): any;
runs(func: SpecFunction): Spec;
addToQueue(block: Block): void;
addMatcherResult(result: Result): void;
expect(actual: any): any;
waits(timeout: number): Spec;
waitsFor(latchFunction: SpecFunction, timeoutMessage?: string, timeout?: number): Spec;
fail(e?: any): void;
getMatchersClass_(): Matchers;
addMatchers(matchersPrototype: CustomMatcherFactories): void;
finishCallback(): void;
finish(onComplete?: () => void): void;
after(doAfter: SpecFunction): void;
execute(onComplete?: () => void): any;
addBeforesAndAftersToQueue(): void;
explodes(): void;
spyOn(obj: any, methodName: string, ignoreMethodDoesntExist: boolean): Spy;
removeAllSpies(): void;
}
interface XSpec {
id: number;
runs(): void;
}
interface Suite extends SuiteOrSpec {
new (env: Env, description: string, specDefinitions: () => void, parentSuite: Suite): any;
parentSuite: Suite;
getFullName(): string;
finish(onComplete?: () => void): void;
beforeEach(beforeEachFunction: SpecFunction): void;
afterEach(afterEachFunction: SpecFunction): void;
beforeAll(beforeAllFunction: SpecFunction): void;
afterAll(afterAllFunction: SpecFunction): void;
results(): NestedResults;
add(suiteOrSpec: SuiteOrSpec): void;
specs(): Spec[];
suites(): Suite[];
children(): any[];
execute(onComplete?: () => void): void;
}
interface XSuite {
execute(): void;
}
interface Spy {
(...params: any[]): any;
identity: string;
and: SpyAnd;
calls: Calls;
mostRecentCall: { args: any[]; };
argsForCall: any[];
wasCalled: boolean;
}
interface SpyAnd {
/** By chaining the spy with and.callThrough, the spy will still track all calls to it but in addition it will delegate to the actual implementation. */
callThrough(): Spy;
/** By chaining the spy with and.returnValue, all calls to the function will return a specific value. */
returnValue(val: any): Spy;
/** By chaining the spy with and.returnValues, all calls to the function will return specific values in order until it reaches the end of the return values list. */
returnValues(...values: any[]): Spy;
/** By chaining the spy with and.callFake, all calls to the spy will delegate to the supplied function. */
callFake(fn: Function): Spy;
/** By chaining the spy with and.throwError, all calls to the spy will throw the specified value. */
throwError(msg: string): Spy;
/** When a calling strategy is used for a spy, the original stubbing behavior can be returned at any time with and.stub. */
stub(): Spy;
}
interface Calls {
/** By chaining the spy with calls.any(), will return false if the spy has not been called at all, and then true once at least one call happens. **/
any(): boolean;
/** By chaining the spy with calls.count(), will return the number of times the spy was called **/
count(): number;
/** By chaining the spy with calls.argsFor(), will return the arguments passed to call number index **/
argsFor(index: number): any[];
/** By chaining the spy with calls.allArgs(), will return the arguments to all calls **/
allArgs(): any[];
/** By chaining the spy with calls.all(), will return the context (the this) and arguments passed all calls **/
all(): CallInfo[];
/** By chaining the spy with calls.mostRecent(), will return the context (the this) and arguments for the most recent call **/
mostRecent(): CallInfo;
/** By chaining the spy with calls.first(), will return the context (the this) and arguments for the first call **/
first(): CallInfo;
/** By chaining the spy with calls.reset(), will clears all tracking for a spy **/
reset(): void;
}
interface CallInfo {
/** The context (the this) for the call */
object: any;
/** All arguments passed to the call */
args: any[];
/** The return value of the call */
returnValue: any;
}
interface Util {
inherit(childClass: Function, parentClass: Function): any;
formatException(e: any): any;
htmlEscape(str: string): string;
argsToArray(args: any): any;
extend(destination: any, source: any): any;
}
interface JsApiReporter extends Reporter {
started: boolean;
finished: boolean;
result: any;
messages: any;
new (): any;
suites(): Suite[];
summarize_(suiteOrSpec: SuiteOrSpec): any;
results(): any;
resultsForSpec(specId: any): any;
log(str: any): any;
resultsForSpecs(specIds: any): any;
summarizeResult_(result: any): any;
}
interface Jasmine {
Spec: Spec;
clock: Clock;
util: Util;
}
export var HtmlReporter: HtmlReporter;
export var HtmlSpecFilter: HtmlSpecFilter;
export var DEFAULT_TIMEOUT_INTERVAL: number;
}

View File

@ -0,0 +1,8 @@
{
"resolution": "main",
"tree": {
"src": "https://raw.githubusercontent.com/DefinitelyTyped/DefinitelyTyped/36a1be34dbe202c665b3ddafd50824f78c09eea3/jasmine/jasmine.d.ts",
"raw": "registry:dt/jasmine#2.2.0+20160505161446",
"typings": "https://raw.githubusercontent.com/DefinitelyTyped/DefinitelyTyped/36a1be34dbe202c665b3ddafd50824f78c09eea3/jasmine/jasmine.d.ts"
}
}

80
typings/globals/json-pointer/index.d.ts vendored Normal file
View File

@ -0,0 +1,80 @@
// Generated by typings
// Source: https://raw.githubusercontent.com/DefinitelyTyped/DefinitelyTyped/7de6c3dd94feaeb21f20054b9f30d5dabc5efabd/json-pointer/json-pointer.d.ts
declare module "json-pointer" {
function JSON_Pointer(object: Object): JSON_Pointer.JSON_PointerWrap;
namespace JSON_Pointer {
/**
* Wrap an object with accessors
*/
/**
* Looks up a JSON pointer in an object.
*/
function get(object: Object, pointer: string): any;
/**
* Set a value for a JSON pointer on object.
*/
function set(object: Object, pointer: string, value: any): void;
/**
* Removes an attribute of object referenced by pointer
*/
function remove(object: Object, pointer: string): void;
/**
* Creates a dictionary object (pointer -> value).
*/
function dict(object: Object): Object;
/**
* Just like: each(pointer.dict(obj), iterator);
*/
function walk(object: Object, iterator: (value: any, key: string) => void): void;
/**
* Tests if an object has a value for a JSON pointer.
*/
function has(object: Object, pointer: string): boolean;
/**
* Escapes a reference token.
*/
function escape(str: string): string;
/**
* Unescape a reference token.
*/
function unescape(str: string): string;
/**
* Converts a JSON pointer into an array of reference tokens.
*/
function parse(str: string): string[];
/**
* Builds a json pointer from an array of reference tokens.
*/
function compile(str: string[]): string;
interface JSON_PointerWrap {
/**
* Looks up a JSON pointer in an object.
*/
get(pointer: string): any;
/**
* Set a value for a JSON pointer on object.
*/
set(pointer: string, value: any): void;
/**
* Removes an attribute of object referenced by pointer
*/
remove(pointer: string): void;
/**
* Creates a dictionary object (pointer -> value).
*/
dict(): Object;
/**
* Just like: each(pointer.dict(obj), iterator);
*/
walk(iterator: (value: any, key: string) => void): void;
/**
* Tests if an object has a value for a JSON pointer.
*/
has(pointer: string): boolean;
}
}
export default JSON_Pointer;
}

View File

@ -0,0 +1,8 @@
{
"resolution": "main",
"tree": {
"src": "https://raw.githubusercontent.com/DefinitelyTyped/DefinitelyTyped/7de6c3dd94feaeb21f20054b9f30d5dabc5efabd/json-pointer/json-pointer.d.ts",
"raw": "registry:dt/json-pointer#1.0.0+20160317120654",
"typings": "https://raw.githubusercontent.com/DefinitelyTyped/DefinitelyTyped/7de6c3dd94feaeb21f20054b9f30d5dabc5efabd/json-pointer/json-pointer.d.ts"
}
}

4
typings/index.d.ts vendored Normal file
View File

@ -0,0 +1,4 @@
/// <reference path="globals/jasmine/index.d.ts" />
/// <reference path="globals/json-pointer/index.d.ts" />
/// <reference path="modules/chai/index.d.ts" />

6
typings/json-schema-instantiator.d.ts vendored Normal file
View File

@ -0,0 +1,6 @@
// Generated by typings
// Source: https://raw.githubusercontent.com/DefinitelyTyped/DefinitelyTyped/7de6c3dd94feaeb21f20054b9f30d5dabc5efabd/json-pointer/json-pointer.d.ts
declare module "json-schema-instantiator" {
var x: any;
export default x;
}

6
typings/json-schema-ref-parser.d.ts vendored Normal file
View File

@ -0,0 +1,6 @@
// Generated by typings
// Source: https://raw.githubusercontent.com/DefinitelyTyped/DefinitelyTyped/7de6c3dd94feaeb21f20054b9f30d5dabc5efabd/json-pointer/json-pointer.d.ts
declare module "json-schema-ref-parser/dist/ref-parser" {
var x: any;
export default x;
}

7
typings/marked.d.ts vendored Normal file
View File

@ -0,0 +1,7 @@
// Generated by typings
// Source: https://raw.githubusercontent.com/DefinitelyTyped/DefinitelyTyped/7de6c3dd94feaeb21f20054b9f30d5dabc5efabd/json-pointer/json-pointer.d.ts
declare module "marked" {
var x: any;
export default x;
}

547
typings/modules/chai/index.d.ts vendored Normal file
View File

@ -0,0 +1,547 @@
// Generated by typings
// Source: https://raw.githubusercontent.com/typed-typings/npm-assertion-error/105841317bd2bdd5d110bfb763e49e482a77230d/main.d.ts
declare module '~chai~assertion-error/main' {
// Type definitions for assertion-error 1.0.0
// Project: https://github.com/chaijs/assertion-error
// Definitions by: Bart van der Schoor <https://github.com/Bartvds>
// Definitions: https://github.com/borisyankov/DefinitelyTyped
export class AssertionError implements Error {
constructor(message: string, props?: any, ssf?: Function);
public name: string;
public message: string;
public showDiff: boolean;
public stack: string;
/**
* Allow errors to be converted to JSON for static transfer.
*
* @param {Boolean} include stack (default: `true`)
* @return {Object} object that can be `JSON.stringify`
*/
public toJSON(stack: boolean): Object;
}
}
declare module '~chai~assertion-error' {
import alias = require('~chai~assertion-error/main');
export = alias;
}
// Generated by typings
// Source: https://raw.githubusercontent.com/typed-typings/npm-chai/793bee097a6a644e078a033603d88ac89eb7b560/lib/Assert.d.ts
declare module '~chai/lib/Assert' {
export interface AssertStatic extends Assert {
}
export interface Assert {
/**
* @param expression Expression to test for truthiness.
* @param message Message to display on error.
*/
(expression: any, message?: string): void;
(expression: any, messageCallback: () => string): void;
fail(actual?: any, expected?: any, msg?: string, operator?: string): void;
ok(val: any, msg?: string): void;
isOk(val: any, msg?: string): void;
notOk(val: any, msg?: string): void;
isNotOk(val: any, msg?: string): void;
equal(act: any, exp: any, msg?: string): void;
notEqual(act: any, exp: any, msg?: string): void;
strictEqual(act: any, exp: any, msg?: string): void;
notStrictEqual(act: any, exp: any, msg?: string): void;
deepEqual(act: any, exp: any, msg?: string): void;
notDeepEqual(act: any, exp: any, msg?: string): void;
isTrue(val: any, msg?: string): void;
isFalse(val: any, msg?: string): void;
isNotTrue(val: any, msg?: string): void;
isNotFalse(val: any, msg?: string): void;
isNull(val: any, msg?: string): void;
isNotNull(val: any, msg?: string): void;
isUndefined(val: any, msg?: string): void;
isDefined(val: any, msg?: string): void;
isNaN(val: any, msg?: string): void;
isNotNaN(val: any, msg?: string): void;
isAbove(val: number, abv: number, msg?: string): void;
isBelow(val: number, blw: number, msg?: string): void;
isAtLeast(val: number, atlst: number, msg?: string): void;
isAtMost(val: number, atmst: number, msg?: string): void;
isFunction(val: any, msg?: string): void;
isNotFunction(val: any, msg?: string): void;
isObject(val: any, msg?: string): void;
isNotObject(val: any, msg?: string): void;
isArray(val: any, msg?: string): void;
isNotArray(val: any, msg?: string): void;
isString(val: any, msg?: string): void;
isNotString(val: any, msg?: string): void;
isNumber(val: any, msg?: string): void;
isNotNumber(val: any, msg?: string): void;
isBoolean(val: any, msg?: string): void;
isNotBoolean(val: any, msg?: string): void;
typeOf(val: any, type: string, msg?: string): void;
notTypeOf(val: any, type: string, msg?: string): void;
instanceOf(val: any, type: Function, msg?: string): void;
notInstanceOf(val: any, type: Function, msg?: string): void;
include(exp: string, inc: any, msg?: string): void;
include(exp: any[], inc: any, msg?: string): void;
include(exp: Object, inc: Object, msg?: string): void;
notInclude(exp: string, inc: any, msg?: string): void;
notInclude(exp: any[], inc: any, msg?: string): void;
match(exp: any, re: RegExp, msg?: string): void;
notMatch(exp: any, re: RegExp, msg?: string): void;
property(obj: Object, prop: string, msg?: string): void;
notProperty(obj: Object, prop: string, msg?: string): void;
deepProperty(obj: Object, prop: string, msg?: string): void;
notDeepProperty(obj: Object, prop: string, msg?: string): void;
propertyVal(obj: Object, prop: string, val: any, msg?: string): void;
propertyNotVal(obj: Object, prop: string, val: any, msg?: string): void;
deepPropertyVal(obj: Object, prop: string, val: any, msg?: string): void;
deepPropertyNotVal(obj: Object, prop: string, val: any, msg?: string): void;
lengthOf(exp: any, len: number, msg?: string): void;
throw(fn: Function, msg?: string): void;
throw(fn: Function, regExp: RegExp): void;
throw(fn: Function, errType: Function, msg?: string): void;
throw(fn: Function, errType: Function, regExp: RegExp): void;
throws(fn: Function, msg?: string): void;
throws(fn: Function, regExp: RegExp): void;
throws(fn: Function, errType: Function, msg?: string): void;
throws(fn: Function, errType: Function, regExp: RegExp): void;
Throw(fn: Function, msg?: string): void;
Throw(fn: Function, regExp: RegExp): void;
Throw(fn: Function, errType: Function, msg?: string): void;
Throw(fn: Function, errType: Function, regExp: RegExp): void;
doesNotThrow(fn: Function, msg?: string): void;
doesNotThrow(fn: Function, regExp: RegExp): void;
doesNotThrow(fn: Function, errType: Function, msg?: string): void;
doesNotThrow(fn: Function, errType: Function, regExp: RegExp): void;
operator(val: any, operator: string, val2: any, msg?: string): void;
closeTo(act: number, exp: number, delta: number, msg?: string): void;
approximately(act: number, exp: number, delta: number, msg?: string): void;
sameMembers(set1: any[], set2: any[], msg?: string): void;
sameDeepMembers(set1: any[], set2: any[], msg?: string): void;
includeMembers(superset: any[], subset: any[], msg?: string): void;
includeDeepMembers(superset: any[], subset: any[], msg?: string): void;
ifError(val: any, msg?: string): void;
isExtensible(obj: {}, msg?: string): void;
extensible(obj: {}, msg?: string): void;
isNotExtensible(obj: {}, msg?: string): void;
notExtensible(obj: {}, msg?: string): void;
isSealed(obj: {}, msg?: string): void;
sealed(obj: {}, msg?: string): void;
isNotSealed(obj: {}, msg?: string): void;
notSealed(obj: {}, msg?: string): void;
isFrozen(obj: Object, msg?: string): void;
frozen(obj: Object, msg?: string): void;
isNotFrozen(obj: Object, msg?: string): void;
notFrozen(obj: Object, msg?: string): void;
oneOf(inList: any, list: any[], msg?: string): void;
changes(fn: Function, obj: {}, property: string): void;
doesNotChange(fn: Function, obj: {}, property: string): void;
increases(fn: Function, obj: {}, property: string): void;
doesNotIncrease(fn: Function, obj: {}, property: string): void;
decreases(fn: Function, obj: {}, property: string): void;
doesNotDecrease(fn: Function, obj: {}, property: string): void;
}
}
declare module 'chai/lib/Assert' {
import alias = require('~chai/lib/Assert');
export = alias;
}
// Generated by typings
// Source: https://raw.githubusercontent.com/typed-typings/npm-chai/793bee097a6a644e078a033603d88ac89eb7b560/lib/Assertion.d.ts
declare module '~chai/lib/Assertion' {
export interface AssertionStatic {
(target?: any, message?: string, stack?: Function): Assertion;
new (target?: any, message?: string, stack?: Function): Assertion;
}
export interface Assertion extends LanguageChains, NumericComparison, TypeComparison {
not: Assertion;
deep: Deep;
any: KeyFilter;
all: KeyFilter;
a: TypeComparison;
an: TypeComparison;
include: Include;
includes: Include;
contain: Include;
contains: Include;
ok: Assertion;
true: Assertion;
false: Assertion;
null: Assertion;
undefined: Assertion;
NaN: Assertion;
exist: Assertion;
empty: Assertion;
arguments: Assertion;
Arguments: Assertion;
equal: Equal;
equals: Equal;
eq: Equal;
eql: Equal;
eqls: Equal;
property: Property;
ownProperty: OwnProperty;
haveOwnProperty: OwnProperty;
ownPropertyDescriptor: OwnPropertyDescriptor;
haveOwnPropertyDescriptor: OwnPropertyDescriptor;
length: Length;
lengthOf: Length;
match: Match;
matches: Match;
string(str: string, message?: string): Assertion;
keys: Keys;
key(str: string): Assertion;
throw: Throw;
throws: Throw;
Throw: Throw;
respondTo: RespondTo;
respondsTo: RespondTo;
itself: Assertion;
satisfy: Satisfy;
satisfies: Satisfy;
closeTo: CloseTo;
approximately: CloseTo;
members: Members;
increase: PropertyChange;
increases: PropertyChange;
decrease: PropertyChange;
decreases: PropertyChange;
change: PropertyChange;
changes: PropertyChange;
extensible: Assertion;
sealed: Assertion;
frozen: Assertion;
oneOf(list: any[], message?: string): Assertion;
}
export interface LanguageChains {
to: Assertion;
be: Assertion;
been: Assertion;
is: Assertion;
that: Assertion;
which: Assertion;
and: Assertion;
has: Assertion;
have: Assertion;
with: Assertion;
at: Assertion;
of: Assertion;
same: Assertion;
}
export interface NumericComparison {
above: NumberComparer;
gt: NumberComparer;
greaterThan: NumberComparer;
least: NumberComparer;
gte: NumberComparer;
below: NumberComparer;
lt: NumberComparer;
lessThan: NumberComparer;
most: NumberComparer;
lte: NumberComparer;
within(start: number, finish: number, message?: string): Assertion;
}
export interface NumberComparer {
(value: number, message?: string): Assertion;
}
export interface TypeComparison {
(type: string, message?: string): Assertion;
instanceof: InstanceOf;
instanceOf: InstanceOf;
}
export interface InstanceOf {
(constructor: Object, message?: string): Assertion;
}
export interface CloseTo {
(expected: number, delta: number, message?: string): Assertion;
}
export interface Deep {
equal: Equal;
equals: Equal;
eq: Equal;
include: Include;
property: Property;
members: Members;
}
export interface KeyFilter {
keys: Keys;
}
export interface Equal {
(value: any, message?: string): Assertion;
}
export interface Property {
(name: string, value?: any, message?: string): Assertion;
}
export interface OwnProperty {
(name: string, message?: string): Assertion;
}
export interface OwnPropertyDescriptor {
(name: string, descriptor: PropertyDescriptor, message?: string): Assertion;
(name: string, message?: string): Assertion;
}
export interface Length extends LanguageChains, NumericComparison {
(length: number, message?: string): Assertion;
}
export interface Include {
(value: Object, message?: string): Assertion;
(value: string, message?: string): Assertion;
(value: number, message?: string): Assertion;
string(value: string, message?: string): Assertion;
keys: Keys;
members: Members;
any: KeyFilter;
all: KeyFilter;
}
export interface Match {
(regexp: RegExp | string, message?: string): Assertion;
}
export interface Keys {
(...keys: any[]): Assertion;
(keys: any[]): Assertion;
(keys: Object): Assertion;
}
export interface Throw {
(): Assertion;
(expected: string, message?: string): Assertion;
(expected: RegExp, message?: string): Assertion;
(constructor: Error, expected?: string, message?: string): Assertion;
(constructor: Error, expected?: RegExp, message?: string): Assertion;
(constructor: Function, expected?: string, message?: string): Assertion;
(constructor: Function, expected?: RegExp, message?: string): Assertion;
}
export interface RespondTo {
(method: string, message?: string): Assertion;
}
export interface Satisfy {
(matcher: Function, message?: string): Assertion;
}
export interface Members {
(set: any[], message?: string): Assertion;
}
export interface PropertyChange {
(object: Object, prop: string, msg?: string): Assertion;
}
}
declare module 'chai/lib/Assertion' {
import alias = require('~chai/lib/Assertion');
export = alias;
}
// Generated by typings
// Source: https://raw.githubusercontent.com/typed-typings/npm-chai/793bee097a6a644e078a033603d88ac89eb7b560/lib/Expect.d.ts
declare module '~chai/lib/Expect' {
import {AssertionStatic} from '~chai/lib/Assertion';
export interface ExpectStatic extends AssertionStatic {
fail(actual?: any, expected?: any, message?: string, operator?: string): void;
}
}
declare module 'chai/lib/Expect' {
import alias = require('~chai/lib/Expect');
export = alias;
}
// Generated by typings
// Source: https://raw.githubusercontent.com/typed-typings/npm-chai/793bee097a6a644e078a033603d88ac89eb7b560/lib/Should.d.ts
declare module '~chai/lib/Should' {
export interface Should extends ShouldAssertion {
not: ShouldAssertion;
fail(actual: any, expected: any, message?: string, operator?: string): void;
}
export interface ShouldAssertion {
Throw: ShouldThrow;
throw: ShouldThrow;
equal(value1: any, value2: any, message?: string): void;
exist(value: any, message?: string): void;
}
export interface ShouldThrow {
(actual: Function): void;
(actual: Function, expected: string | RegExp, message?: string): void;
(actual: Function, constructor: Error | Function, expected?: string | RegExp, message?: string): void;
}
}
declare module 'chai/lib/Should' {
import alias = require('~chai/lib/Should');
export = alias;
}
// Generated by typings
// Source: https://raw.githubusercontent.com/typed-typings/npm-chai/793bee097a6a644e078a033603d88ac89eb7b560/lib/Config.d.ts
declare module '~chai/lib/Config' {
export interface Config {
includeStack: boolean;
showDiff: boolean;
truncateThreshold: number;
}
}
declare module 'chai/lib/Config' {
import alias = require('~chai/lib/Config');
export = alias;
}
// Generated by typings
// Source: https://raw.githubusercontent.com/typed-typings/npm-chai/793bee097a6a644e078a033603d88ac89eb7b560/lib/Utils.d.ts
declare module '~chai/lib/Utils' {
import {Assertion} from '~chai/lib/Assertion';
export interface PathInfo {
parent: any;
name: number|string;
value: any;
exists: boolean;
}
export interface Utils {
addChainableMethod(ctx: any, name: string, chainingBehavior: (value: any) => void): void;
addMethod(ctx: any, name: string, method: (value: any) => void): void;
addProperty(ctx: any, name: string, getter: () => void): void;
expectTypes(obj: Object, types: string[]): void;
flag(obj: Object, key: string, value?: any): any;
getActual(obj: Object, actual?: any): any;
getEnumerableProperties(obj: Object): string[];
getMessage(obj: Object, params: any[]): string;
getMessage(obj: Object, message: string, negateMessage: string): string;
getName(func: Function): string;
getPathInfo(path: string, obj: Object): PathInfo;
getPathValue(path: string, obj: Object): any;
getProperties(obj: Object): string[];
hasProperty(obj: Object, name: string): boolean;
transferFlags(assertion: Assertion | any, obj: Object, includeAll?: boolean): void;
inspect(obj: any): any;
}
}
declare module 'chai/lib/Utils' {
import alias = require('~chai/lib/Utils');
export = alias;
}
// Generated by typings
// Source: https://raw.githubusercontent.com/typed-typings/npm-chai/793bee097a6a644e078a033603d88ac89eb7b560/lib/Chai.d.ts
declare module '~chai/lib/Chai' {
import * as AE from '~chai~assertion-error';
import * as Assert from '~chai/lib/Assert';
import * as A from '~chai/lib/Assertion';
import * as Expect from '~chai/lib/Expect';
import * as Should from '~chai/lib/Should';
import * as Config from '~chai/lib/Config';
import * as Utils from '~chai/lib/Utils';
namespace chai {
export interface AssertionStatic extends A.AssertionStatic {}
export class AssertionError extends AE.AssertionError {}
export var Assertion: A.AssertionStatic;
export var expect: Expect.ExpectStatic;
export var assert: Assert.AssertStatic;
export var config: Config.Config;
export var util: Utils.Utils;
export function should(): Should.Should;
export function Should(): Should.Should;
/**
* Provides a way to extend the internals of Chai
*/
export function use(fn: (chai: any, utils: Utils.Utils) => void): typeof chai;
}
export = chai;
/* tslint:disable:no-internal-module */
global {
interface Object {
should: A.Assertion;
}
}
}
declare module 'chai/lib/Chai' {
import alias = require('~chai/lib/Chai');
export = alias;
}
// Generated by typings
// Source: https://raw.githubusercontent.com/typed-typings/npm-chai/793bee097a6a644e078a033603d88ac89eb7b560/index.d.ts
declare module '~chai/index' {
// Type definitions for chai 3.4.0
// Project: http://chaijs.com/
// Original Definitions by: Jed Mao <https://github.com/jedmao/>,
// Bart van der Schoor <https://github.com/Bartvds>,
// Andrew Brown <https://github.com/AGBrown>,
// Olivier Chevet <https://github.com/olivr70>,
// Matt Wistrand <https://github.com/mwistrand>
import chai = require('~chai/lib/Chai');
export = chai;
}
declare module 'chai/index' {
import alias = require('~chai/index');
export = alias;
}
declare module 'chai' {
import alias = require('~chai/index');
export = alias;
}

View File

@ -0,0 +1,21 @@
{
"resolution": "main",
"tree": {
"src": "https://raw.githubusercontent.com/typed-typings/npm-chai/793bee097a6a644e078a033603d88ac89eb7b560/typings.json",
"raw": "registry:npm/chai#3.5.0+20160415060238",
"main": "index.d.ts",
"global": false,
"dependencies": {
"assertion-error": {
"src": "https://raw.githubusercontent.com/typed-typings/npm-assertion-error/105841317bd2bdd5d110bfb763e49e482a77230d/typings.json",
"raw": "github:typed-typings/npm-assertion-error#105841317bd2bdd5d110bfb763e49e482a77230d",
"main": "main.d.ts",
"global": false,
"name": "assertion-error",
"type": "typings"
}
},
"name": "chai",
"type": "typings"
}
}

6
typings/scrollparent.d.ts vendored Normal file
View File

@ -0,0 +1,6 @@
// Generated by typings
// Source: https://raw.githubusercontent.com/DefinitelyTyped/DefinitelyTyped/7de6c3dd94feaeb21f20054b9f30d5dabc5efabd/json-pointer/json-pointer.d.ts
declare module "scrollparent" {
var x: any;
export default x;
}