├── .babelrc ├── .codeclimate.yml ├── .eslintrc ├── .gitignore ├── LICENSE ├── README.md ├── bin └── server.js ├── circle.yml ├── config ├── index.js └── passport.js ├── db ├── bookshelf.js └── knex.js ├── docs ├── api_data.js ├── api_data.json ├── api_project.js ├── api_project.json ├── css │ └── style.css ├── fonts │ ├── glyphicons-halflings-regular.eot │ ├── glyphicons-halflings-regular.svg │ ├── glyphicons-halflings-regular.ttf │ ├── glyphicons-halflings-regular.woff │ └── glyphicons-halflings-regular.woff2 ├── img │ └── favicon.ico ├── index.html ├── locales │ ├── ca.js │ ├── de.js │ ├── es.js │ ├── fr.js │ ├── it.js │ ├── locale.js │ ├── nl.js │ ├── pl.js │ ├── pt_br.js │ ├── ro.js │ ├── ru.js │ ├── zh.js │ └── zh_cn.js ├── main.js ├── utils │ ├── handlebars_helper.js │ └── send_sample_request.js └── vendor │ ├── bootstrap.min.css │ ├── bootstrap.min.js │ ├── diff_match_patch.min.js │ ├── handlebars.min.js │ ├── jquery.min.js │ ├── list.min.js │ ├── lodash.custom.min.js │ ├── path-to-regexp │ ├── LICENSE │ └── index.js │ ├── polyfill.js │ ├── prettify.css │ ├── prettify │ ├── lang-Splus.js │ ├── lang-aea.js │ ├── lang-agc.js │ ├── lang-apollo.js │ ├── lang-basic.js │ ├── lang-cbm.js │ ├── lang-cl.js │ ├── lang-clj.js │ ├── lang-css.js │ ├── lang-dart.js │ ├── lang-el.js │ ├── lang-erl.js │ ├── lang-erlang.js │ ├── lang-fs.js │ ├── lang-go.js │ ├── lang-hs.js │ ├── lang-lasso.js │ ├── lang-lassoscript.js │ ├── lang-latex.js │ ├── lang-lgt.js │ ├── lang-lisp.js │ ├── lang-ll.js │ ├── lang-llvm.js │ ├── lang-logtalk.js │ ├── lang-ls.js │ ├── lang-lsp.js │ ├── lang-lua.js │ ├── lang-matlab.js │ ├── lang-ml.js │ ├── lang-mumps.js │ ├── lang-n.js │ ├── lang-nemerle.js │ ├── lang-pascal.js │ ├── lang-proto.js │ ├── lang-r.js │ ├── lang-rd.js │ ├── lang-rkt.js │ ├── lang-rust.js │ ├── lang-s.js │ ├── lang-scala.js │ ├── lang-scm.js │ ├── lang-sql.js │ ├── lang-ss.js │ ├── lang-swift.js │ ├── lang-tcl.js │ ├── lang-tex.js │ ├── lang-vb.js │ ├── lang-vbs.js │ ├── lang-vhd.js │ ├── lang-vhdl.js │ ├── lang-wiki.js │ ├── lang-xq.js │ ├── lang-xquery.js │ ├── lang-yaml.js │ ├── lang-yml.js │ ├── prettify.css │ ├── prettify.js │ └── run_prettify.js │ ├── require.min.js │ ├── semver.min.js │ └── webfontloader.js ├── index.js ├── knexfile.js ├── lib └── aws.js ├── migrations └── 20160327170518_create_user_table.js ├── package.json ├── seeds ├── common │ └── index.js ├── development │ ├── admin.js │ └── users.js └── production │ └── admin.js ├── src ├── middleware │ ├── error.js │ └── validators.js ├── models │ ├── helpers │ │ └── index.js │ └── users.js └── modules │ ├── auth │ ├── controller.js │ ├── helpers.js │ └── router.js │ ├── index.js │ └── users │ ├── controller.js │ └── router.js ├── test-results.xml └── test ├── auth └── post.js ├── index.js ├── users ├── delete.js ├── facebook.js ├── get.js ├── post.js └── put.js └── utils.js /.babelrc: -------------------------------------------------------------------------------- 1 | { 2 | "presets": [ 3 | [ 4 | "env", 5 | { 6 | "targets": { 7 | "node": "current" 8 | } 9 | } 10 | ], 11 | "stage-0" 12 | ], 13 | "plugins": [ 14 | ["module-resolver", { 15 | "root": ["./"], 16 | "alias": { 17 | "lib": "./lib", 18 | "db": "./db", 19 | "config": "./config", 20 | "middleware": "./src/middleware", 21 | "models": "./src/models", 22 | "modules": "./src/modules", 23 | } 24 | }] 25 | ] 26 | } 27 | -------------------------------------------------------------------------------- /.codeclimate.yml: -------------------------------------------------------------------------------- 1 | engines: 2 | duplication: 3 | enabled: true 4 | config: 5 | languages: 6 | - javascript 7 | eslint: 8 | enabled: true 9 | fixme: 10 | enabled: true 11 | ratings: 12 | paths: 13 | - "**.css" 14 | - "**.inc" 15 | - "**.js" 16 | - "**.jsx" 17 | - "**.module" 18 | - "**.php" 19 | - "**.py" 20 | - "**.rb" 21 | exclude_paths: 22 | - config/ 23 | - db/ 24 | - test/ 25 | - docs/ -------------------------------------------------------------------------------- /.eslintrc: -------------------------------------------------------------------------------- 1 | { 2 | "parser": "babel-eslint", 3 | "extends": "standard", 4 | "env": { 5 | "node": true, 6 | "mocha": true 7 | }, 8 | "rules": { 9 | "semi" : [2, "never"], 10 | "space-before-function-paren": ["error", "never"] 11 | } 12 | } 13 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | # Logs 2 | logs 3 | *.log 4 | npm-debug.log* 5 | 6 | # Runtime data 7 | pids 8 | *.pid 9 | *.seed 10 | 11 | # Directory for instrumented libs generated by jscoverage/JSCover 12 | lib-cov 13 | 14 | # Coverage directory used by tools like istanbul 15 | coverage 16 | 17 | # nyc test coverage 18 | .nyc_output 19 | 20 | # Grunt intermediate storage (http://gruntjs.com/creating-plugins#storing-task-files) 21 | .grunt 22 | 23 | # node-waf configuration 24 | .lock-wscript 25 | 26 | # Compiled binary addons (http://nodejs.org/api/addons.html) 27 | build/Release 28 | 29 | # Dependency directories 30 | node_modules 31 | jspm_packages 32 | 33 | # Optional npm cache directory 34 | .npm 35 | 36 | # Optional REPL history 37 | .node_repl_history 38 | 39 | test-results.xml -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | The MIT License (MIT) 2 | Copyright (c) 2016 Adrian Obelmejias 3 | 4 | Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: 5 | 6 | The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. 7 | 8 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | ## Node API Starter [![CircleCI](https://circleci.com/gh/lorenzopicoli/node-api-starter.svg?style=svg)](https://circleci.com/gh/lorenzopicoli/node-api-starter) 2 | [![Dependencies](https://david-dm.org/lorenzopicoli/node-api-starter.svg)](https://david-dm.org/lorenzopicoli/node-api-starter) 3 | [![codecov](https://codecov.io/gh/lorenzopicoli/node-api-starter/branch/master/graph/badge.svg)](https://codecov.io/gh/lorenzopicoli/node-api-starter) 4 | [![Code Climate](https://codeclimate.com/github/lorenzopicoli/node-api-starter/badges/gpa.svg)](https://codeclimate.com/github/lorenzopicoli/node-api-starter) 5 | 6 | ## Stack 7 | - [Koa2](https://github.com/koajs/koa) 8 | - [Knex](https://github.com/tgriesser/knex) 9 | - [Bookshelf](https://github.com/tgriesser/bookshelf/) 10 | - [PostgreSQL](https://www.postgresql.org/) 11 | - Node > 7.6.0 12 | - [Babel (stage-0)](https://github.com/babel/babel) 13 | - [Mocha](https://github.com/mochajs/mocha/) 14 | - [JSONDoc](http://jsondoc.org/) 15 | 16 | ## Getting started 17 | 18 | Clone the repository: 19 | ``` 20 | git clone https://github.com/lorenzopicoli/node-api-starter.git 21 | ``` 22 | Navigate to the repo folder and install the dependencies: 23 | ``` 24 | npm i 25 | ``` 26 | Env variables will be loaded from a `.env` file (see Environment section) 27 | ``` 28 | touch .env 29 | ``` 30 | You can make sure the code is working by running the server on development mode: 31 | ``` 32 | ➜ npm run dev 33 | ``` 34 | You should get back: 35 | ``` 36 | > node-starter@1.0.0 dev /Users/lorenzopicoli/WebDev/node-api-boilerplate 37 | > NODE_ENV=development ./node_modules/.bin/nodemon index.js 38 | 39 | [nodemon] 1.11.0 40 | [nodemon] to restart at any time, enter `rs` 41 | [nodemon] watching: *.* 42 | [nodemon] starting `node index.js` 43 | Server running on 5000 44 | ``` 45 | 46 | ## Creating new modules 47 | 48 | Let's call it `places`: 49 | ``` 50 | # Create the module folder 51 | mkdir src/modules/places 52 | touch src/modules/places/controller.js 53 | touch src/modules/places/router.js 54 | 55 | # Create the bookshelf model file 56 | touch src/models/places.js 57 | 58 | # Create the database migration file 59 | knex migrate:make create_places_table 60 | 61 | # Run the new migration 62 | npm run db:migrate 63 | ``` 64 | 65 | ## Environment variables 66 | 67 | .env example: 68 | ``` 69 | PORT=5000 70 | DATABASE_URL=postgresql://localhost:5432/ 71 | AWS_BUCKET=xxxxxxx 72 | AWS_ACCESS_KEY_ID=XXXXXXXX 73 | AWS_SECRET_ACCESS_KEY=xxxxxxxxxxxx 74 | CODECOV_TOKEN=xxxxxxxxxxx 75 | ADMIN_PASS=xxxxxxxx (admin password for seeding) 76 | FACEBOOK_ID=xxxxxxxxx 77 | FACEBOOK_SECRET=xxxxxxx 78 | ``` 79 | ## NPM scripts 80 | 81 | ### Start the server on live mode (and migrate the database) 82 | ``` 83 | npm start 84 | ``` 85 | 86 | ### Start the server for development (live reload) 87 | ``` 88 | npm run dev 89 | ``` 90 | 91 | ### Before commit (lint and execute tests) 92 | ``` 93 | npm run commit 94 | ``` 95 | 96 | ### Generate documentation 97 | ``` 98 | npm run docs 99 | ``` 100 | 101 | ### Run tests 102 | ``` 103 | npm test 104 | ``` 105 | 106 | 107 | ## Documentation 108 | API documentation is written inline and generated by [jsondoc](http://apidocjs.com/). 109 | 110 | Example: https://lorenzopicoli.github.io/node-api-starter 111 | 112 | 113 | ## Migrations & Seeding 114 | 115 | ### Generate new migration 116 | ``` 117 | knex migrate:make migration_name 118 | ``` 119 | 120 | ### Run migrations 121 | ``` 122 | knex migrate:latest 123 | ``` 124 | 125 | ### Roll back migration 126 | 127 | ``` 128 | knex migrate:rollback 129 | ``` 130 | 131 | ### Run seeds 132 | ```sh 133 | # development or production environment 134 | NODE_ENV=development knex seed:run 135 | ``` 136 | 137 | See knex [docs](http://knexjs.org/#Installation-migrations) for details 138 | 139 | ## License 140 | MIT 141 | -------------------------------------------------------------------------------- /bin/server.js: -------------------------------------------------------------------------------- 1 | import Koa from 'koa' 2 | import bodyParser from 'koa-bodyparser' 3 | import convert from 'koa-convert' 4 | import logger from 'koa-logger' 5 | import cors from 'koa-cors' 6 | import session from 'koa-generic-session' 7 | import passport from 'koa-passport' 8 | 9 | import config from 'config' 10 | import errorMiddleware from 'middleware/error' 11 | 12 | const app = new Koa() 13 | app.keys = [config.jwt.session] 14 | 15 | app.use(logger()) 16 | app.use(bodyParser()) 17 | 18 | app.use(convert(cors())) 19 | app.use(convert(session())) 20 | app.use(errorMiddleware()) 21 | 22 | require('../config/passport') 23 | app.use(passport.initialize()) 24 | app.use(passport.session()) 25 | 26 | const modules = require('../src/modules') 27 | modules(app) 28 | 29 | app.listen(config.port, () => { 30 | console.log(`Server running on ${config.port}`) 31 | }) 32 | 33 | export default app 34 | -------------------------------------------------------------------------------- /circle.yml: -------------------------------------------------------------------------------- 1 | machine: 2 | node: 3 | version: 7.6.0 4 | services: 5 | - redis 6 | environment: 7 | REDIS_HOST: localhost 8 | REDIS_PORT: 6379 9 | DATABASE_URL: postgres://ubuntu:@127.0.0.1:5432/circle_test 10 | NODE_ENV: test 11 | 12 | database: 13 | post: 14 | - psql -c "CREATE EXTENSION postgis;" -d circle_test 15 | 16 | test: 17 | override: 18 | - npm install -g knex 19 | - knex migrate:latest 20 | - npm test 21 | - if [[ -e test-results.xml ]]; then cp test-results.xml $CIRCLE_TEST_REPORTS/test-results.xml; fi 22 | -------------------------------------------------------------------------------- /config/index.js: -------------------------------------------------------------------------------- 1 | require('dotenv').config({ silent: true }) 2 | 3 | export default { 4 | port: process.env.PORT || 5000, 5 | jwt: { 6 | session: process.env.JWT_SESSION || 'secret-boilerplate-token', 7 | token: process.env.JWT_TOKEN || 'secret-jwt-token' 8 | }, 9 | aws: { 10 | Bucket: process.env.AWS_BUCKET, 11 | thumbBucket: process.env.AWS_THUMB_BUCKET 12 | }, 13 | database: { 14 | client: 'pg', 15 | connection: process.env.DATABASE_URL || 'postgresql://localhost:5432/feather', 16 | debug: process.env.NODE_ENV !== 'test' && process.env.NODE_ENV !== 'production', 17 | seeds: { 18 | directory: `./seeds/${process.env.NODE_ENV}` 19 | } 20 | }, 21 | facebook: { 22 | clientID: process.env.FACEBOOK_ID, 23 | clientSecret: process.env.FACEBOOK_SECRET, 24 | profileFields: ['name', 'email', 'friends', 'picture.type(large)'] 25 | // passReqToCallback: true 26 | } 27 | } 28 | -------------------------------------------------------------------------------- /config/passport.js: -------------------------------------------------------------------------------- 1 | import { User } from 'models/users' 2 | import { Strategy as LocalStrategy } from 'passport-local' 3 | import FacebookTokenStrategy from 'passport-facebook-token' 4 | import passport from 'koa-passport' 5 | import config from './index' 6 | 7 | passport.serializeUser((user, done) => { 8 | done(null, user.id) 9 | }) 10 | 11 | passport.deserializeUser(async (id, done) => { 12 | try { 13 | const user = await User.where({ id }).fetch() 14 | done(null, user) 15 | } catch (err) { 16 | done(err) 17 | } 18 | }) 19 | 20 | passport.use('local', new LocalStrategy({ 21 | usernameField: 'email', 22 | passwordField: 'password' 23 | }, async (email, password, done) => { 24 | try { 25 | const user = await User.where({ email }).fetch() 26 | 27 | if (!user) { 28 | return done(false) 29 | } 30 | 31 | try { 32 | const match = await user.validatePassword(password) 33 | 34 | if (!match) { 35 | return done(false) 36 | } 37 | 38 | done(user) 39 | } catch (err) { 40 | done(err) 41 | } 42 | } catch (err) { 43 | return done(err) 44 | } 45 | })) 46 | 47 | passport.use('facebook-token', new FacebookTokenStrategy(config.facebook, async (accessToken, refreshToken, profile, done) => { 48 | if (!accessToken || !profile.id) { 49 | return done('something', null) 50 | } 51 | return done(null, {'profile': profile, 'facebook_token': accessToken}) 52 | })) 53 | -------------------------------------------------------------------------------- /db/bookshelf.js: -------------------------------------------------------------------------------- 1 | import { knex } from './knex' 2 | const bookshelf = require('bookshelf')(knex) 3 | 4 | bookshelf.plugin('visibility') 5 | bookshelf.plugin('pagination') 6 | 7 | export default bookshelf 8 | -------------------------------------------------------------------------------- /db/knex.js: -------------------------------------------------------------------------------- 1 | import config from 'config' 2 | 3 | const knex = require('knex')(config.database) 4 | const st = require('knex-postgis')(knex) 5 | 6 | export { knex, st } 7 | -------------------------------------------------------------------------------- /docs/api_project.js: -------------------------------------------------------------------------------- 1 | define({ "name": "node-starter", "version": "1.0.0", "description": "Node.js API server starter using Koa2 and Bookshelf", "sampleUrl": false, "defaultVersion": "0.0.0", "apidoc": "0.3.0", "generator": { "name": "apidoc", "time": "2017-03-19T03:46:13.535Z", "url": "http://apidocjs.com", "version": "0.17.5" } }); 2 | -------------------------------------------------------------------------------- /docs/api_project.json: -------------------------------------------------------------------------------- 1 | { "name": "node-starter", "version": "1.0.0", "description": "Node.js API server starter using Koa2 and Bookshelf", "sampleUrl": false, "defaultVersion": "0.0.0", "apidoc": "0.3.0", "generator": { "name": "apidoc", "time": "2017-03-19T03:46:13.535Z", "url": "http://apidocjs.com", "version": "0.17.5" } } 2 | -------------------------------------------------------------------------------- /docs/fonts/glyphicons-halflings-regular.eot: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lorenzopicoli/node-api-starter/1f84545665096ed73afc99e3285c24ae2edabffd/docs/fonts/glyphicons-halflings-regular.eot -------------------------------------------------------------------------------- /docs/fonts/glyphicons-halflings-regular.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lorenzopicoli/node-api-starter/1f84545665096ed73afc99e3285c24ae2edabffd/docs/fonts/glyphicons-halflings-regular.ttf -------------------------------------------------------------------------------- /docs/fonts/glyphicons-halflings-regular.woff: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lorenzopicoli/node-api-starter/1f84545665096ed73afc99e3285c24ae2edabffd/docs/fonts/glyphicons-halflings-regular.woff -------------------------------------------------------------------------------- /docs/fonts/glyphicons-halflings-regular.woff2: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lorenzopicoli/node-api-starter/1f84545665096ed73afc99e3285c24ae2edabffd/docs/fonts/glyphicons-halflings-regular.woff2 -------------------------------------------------------------------------------- /docs/img/favicon.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lorenzopicoli/node-api-starter/1f84545665096ed73afc99e3285c24ae2edabffd/docs/img/favicon.ico -------------------------------------------------------------------------------- /docs/locales/ca.js: -------------------------------------------------------------------------------- 1 | define({ 2 | ca: { 3 | 'Allowed values:' : 'Valors permesos:', 4 | 'Compare all with predecessor': 'Comparar tot amb versió anterior', 5 | 'compare changes to:' : 'comparar canvis amb:', 6 | 'compared to' : 'comparat amb', 7 | 'Default value:' : 'Valor per defecte:', 8 | 'Description' : 'Descripció', 9 | 'Field' : 'Camp', 10 | 'General' : 'General', 11 | 'Generated with' : 'Generat amb', 12 | 'Name' : 'Nom', 13 | 'No response values.' : 'Sense valors en la resposta.', 14 | 'optional' : 'opcional', 15 | 'Parameter' : 'Paràmetre', 16 | 'Permission:' : 'Permisos:', 17 | 'Response' : 'Resposta', 18 | 'Send' : 'Enviar', 19 | 'Send a Sample Request' : 'Enviar una petició d\'exemple', 20 | 'show up to version:' : 'mostrar versió:', 21 | 'Size range:' : 'Tamany de rang:', 22 | 'Type' : 'Tipus', 23 | 'url' : 'url' 24 | } 25 | }); 26 | -------------------------------------------------------------------------------- /docs/locales/de.js: -------------------------------------------------------------------------------- 1 | define({ 2 | de: { 3 | 'Allowed values:' : 'Erlaubte Werte:', 4 | 'Compare all with predecessor': 'Vergleiche alle mit ihren Vorgängern', 5 | 'compare changes to:' : 'vergleiche Änderungen mit:', 6 | 'compared to' : 'verglichen mit', 7 | 'Default value:' : 'Standardwert:', 8 | 'Description' : 'Beschreibung', 9 | 'Field' : 'Feld', 10 | 'General' : 'Allgemein', 11 | 'Generated with' : 'Erstellt mit', 12 | 'Name' : 'Name', 13 | 'No response values.' : 'Keine Rückgabewerte.', 14 | 'optional' : 'optional', 15 | 'Parameter' : 'Parameter', 16 | 'Permission:' : 'Berechtigung:', 17 | 'Response' : 'Antwort', 18 | 'Send' : 'Senden', 19 | 'Send a Sample Request' : 'Eine Beispielanfrage senden', 20 | 'show up to version:' : 'zeige bis zur Version:', 21 | 'Size range:' : 'Größenbereich:', 22 | 'Type' : 'Typ', 23 | 'url' : 'url' 24 | } 25 | }); 26 | -------------------------------------------------------------------------------- /docs/locales/es.js: -------------------------------------------------------------------------------- 1 | define({ 2 | es: { 3 | 'Allowed values:' : 'Valores permitidos:', 4 | 'Compare all with predecessor': 'Comparar todo con versión anterior', 5 | 'compare changes to:' : 'comparar cambios con:', 6 | 'compared to' : 'comparado con', 7 | 'Default value:' : 'Valor por defecto:', 8 | 'Description' : 'Descripción', 9 | 'Field' : 'Campo', 10 | 'General' : 'General', 11 | 'Generated with' : 'Generado con', 12 | 'Name' : 'Nombre', 13 | 'No response values.' : 'Sin valores en la respuesta.', 14 | 'optional' : 'opcional', 15 | 'Parameter' : 'Parámetro', 16 | 'Permission:' : 'Permisos:', 17 | 'Response' : 'Respuesta', 18 | 'Send' : 'Enviar', 19 | 'Send a Sample Request' : 'Enviar una petición de ejemplo', 20 | 'show up to version:' : 'mostrar a versión:', 21 | 'Size range:' : 'Tamaño de rango:', 22 | 'Type' : 'Tipo', 23 | 'url' : 'url' 24 | } 25 | }); 26 | -------------------------------------------------------------------------------- /docs/locales/fr.js: -------------------------------------------------------------------------------- 1 | define({ 2 | fr: { 3 | 'Allowed values:' : 'Valeurs autorisées :', 4 | 'Compare all with predecessor': 'Tout comparer avec ...', 5 | 'compare changes to:' : 'comparer les changements à :', 6 | 'compared to' : 'comparer à', 7 | 'Default value:' : 'Valeur par défaut :', 8 | 'Description' : 'Description', 9 | 'Field' : 'Champ', 10 | 'General' : 'Général', 11 | 'Generated with' : 'Généré avec', 12 | 'Name' : 'Nom', 13 | 'No response values.' : 'Aucune valeur de réponse.', 14 | 'optional' : 'optionnel', 15 | 'Parameter' : 'Paramètre', 16 | 'Permission:' : 'Permission :', 17 | 'Response' : 'Réponse', 18 | 'Send' : 'Envoyer', 19 | 'Send a Sample Request' : 'Envoyer une requête représentative', 20 | 'show up to version:' : 'Montrer à partir de la version :', 21 | 'Size range:' : 'Ordre de grandeur :', 22 | 'Type' : 'Type', 23 | 'url' : 'url' 24 | } 25 | }); 26 | -------------------------------------------------------------------------------- /docs/locales/it.js: -------------------------------------------------------------------------------- 1 | define({ 2 | it: { 3 | 'Allowed values:' : 'Valori permessi:', 4 | 'Compare all with predecessor': 'Confronta tutto con versioni precedenti', 5 | 'compare changes to:' : 'confronta modifiche con:', 6 | 'compared to' : 'confrontato con', 7 | 'Default value:' : 'Valore predefinito:', 8 | 'Description' : 'Descrizione', 9 | 'Field' : 'Campo', 10 | 'General' : 'Generale', 11 | 'Generated with' : 'Creato con', 12 | 'Name' : 'Nome', 13 | 'No response values.' : 'Nessun valore di risposta.', 14 | 'optional' : 'opzionale', 15 | 'Parameter' : 'Parametro', 16 | 'Permission:' : 'Permessi:', 17 | 'Response' : 'Risposta', 18 | 'Send' : 'Invia', 19 | 'Send a Sample Request' : 'Invia una richiesta di esempio', 20 | 'show up to version:' : 'mostra alla versione:', 21 | 'Size range:' : 'Intervallo dimensione:', 22 | 'Type' : 'Tipo', 23 | 'url' : 'url' 24 | } 25 | }); 26 | -------------------------------------------------------------------------------- /docs/locales/locale.js: -------------------------------------------------------------------------------- 1 | define([ 2 | './locales/ca.js', 3 | './locales/de.js', 4 | './locales/es.js', 5 | './locales/fr.js', 6 | './locales/it.js', 7 | './locales/nl.js', 8 | './locales/pl.js', 9 | './locales/pt_br.js', 10 | './locales/ro.js', 11 | './locales/ru.js', 12 | './locales/zh.js', 13 | './locales/zh_cn.js' 14 | ], function() { 15 | var langId = (navigator.language || navigator.userLanguage).toLowerCase().replace('-', '_'); 16 | var language = langId.substr(0, 2); 17 | var locales = {}; 18 | 19 | for (index in arguments) { 20 | for (property in arguments[index]) 21 | locales[property] = arguments[index][property]; 22 | } 23 | if ( ! locales['en']) 24 | locales['en'] = {}; 25 | 26 | if ( ! locales[langId] && ! locales[language]) 27 | language = 'en'; 28 | 29 | var locale = (locales[langId] ? locales[langId] : locales[language]); 30 | 31 | function __(text) { 32 | var index = locale[text]; 33 | if (index === undefined) 34 | return text; 35 | return index; 36 | }; 37 | 38 | function setLanguage(language) { 39 | locale = locales[language]; 40 | } 41 | 42 | return { 43 | __ : __, 44 | locales : locales, 45 | locale : locale, 46 | setLanguage: setLanguage 47 | }; 48 | }); 49 | -------------------------------------------------------------------------------- /docs/locales/nl.js: -------------------------------------------------------------------------------- 1 | define({ 2 | nl: { 3 | 'Allowed values:' : 'Toegestane waarden:', 4 | 'Compare all with predecessor': 'Vergelijk alle met voorgaande versie', 5 | 'compare changes to:' : 'vergelijk veranderingen met:', 6 | 'compared to' : 'vergelijk met', 7 | 'Default value:' : 'Standaard waarde:', 8 | 'Description' : 'Omschrijving', 9 | 'Field' : 'Veld', 10 | 'General' : 'Algemeen', 11 | 'Generated with' : 'Gegenereerd met', 12 | 'Name' : 'Naam', 13 | 'No response values.' : 'Geen response waardes.', 14 | 'optional' : 'optioneel', 15 | 'Parameter' : 'Parameter', 16 | 'Permission:' : 'Permissie:', 17 | 'Response' : 'Antwoorden', 18 | 'Send' : 'Sturen', 19 | 'Send a Sample Request' : 'Stuur een sample aanvragen', 20 | 'show up to version:' : 'toon tot en met versie:', 21 | 'Size range:' : 'Maatbereik:', 22 | 'Type' : 'Type', 23 | 'url' : 'url' 24 | } 25 | }); 26 | -------------------------------------------------------------------------------- /docs/locales/pl.js: -------------------------------------------------------------------------------- 1 | define({ 2 | pl: { 3 | 'Allowed values:' : 'Dozwolone wartości:', 4 | 'Compare all with predecessor': 'Porównaj z poprzednimi wersjami', 5 | 'compare changes to:' : 'porównaj zmiany do:', 6 | 'compared to' : 'porównaj do:', 7 | 'Default value:' : 'Wartość domyślna:', 8 | 'Description' : 'Opis', 9 | 'Field' : 'Pole', 10 | 'General' : 'Generalnie', 11 | 'Generated with' : 'Wygenerowano z', 12 | 'Name' : 'Nazwa', 13 | 'No response values.' : 'Brak odpowiedzi.', 14 | 'optional' : 'opcjonalny', 15 | 'Parameter' : 'Parametr', 16 | 'Permission:' : 'Uprawnienia:', 17 | 'Response' : 'Odpowiedź', 18 | 'Send' : 'Wyślij', 19 | 'Send a Sample Request' : 'Wyślij przykładowe żądanie', 20 | 'show up to version:' : 'pokaż do wersji:', 21 | 'Size range:' : 'Zakres rozmiaru:', 22 | 'Type' : 'Typ', 23 | 'url' : 'url' 24 | } 25 | }); 26 | -------------------------------------------------------------------------------- /docs/locales/pt_br.js: -------------------------------------------------------------------------------- 1 | define({ 2 | 'pt_br': { 3 | 'Allowed values:' : 'Valores permitidos:', 4 | 'Compare all with predecessor': 'Compare todos com antecessores', 5 | 'compare changes to:' : 'comparar alterações com:', 6 | 'compared to' : 'comparado com', 7 | 'Default value:' : 'Valor padrão:', 8 | 'Description' : 'Descrição', 9 | 'Field' : 'Campo', 10 | 'General' : 'Geral', 11 | 'Generated with' : 'Gerado com', 12 | 'Name' : 'Nome', 13 | 'No response values.' : 'Sem valores de resposta.', 14 | 'optional' : 'opcional', 15 | 'Parameter' : 'Parâmetro', 16 | 'Permission:' : 'Permissão:', 17 | 'Response' : 'Resposta', 18 | 'Send' : 'Enviar', 19 | 'Send a Sample Request' : 'Enviar um Exemplo de Pedido', 20 | 'show up to version:' : 'aparecer para a versão:', 21 | 'Size range:' : 'Faixa de tamanho:', 22 | 'Type' : 'Tipo', 23 | 'url' : 'url' 24 | } 25 | }); 26 | -------------------------------------------------------------------------------- /docs/locales/ro.js: -------------------------------------------------------------------------------- 1 | define({ 2 | ro: { 3 | 'Allowed values:' : 'Valori permise:', 4 | 'Compare all with predecessor': 'Compară toate cu versiunea precedentă', 5 | 'compare changes to:' : 'compară cu versiunea:', 6 | 'compared to' : 'comparat cu', 7 | 'Default value:' : 'Valoare implicită:', 8 | 'Description' : 'Descriere', 9 | 'Field' : 'Câmp', 10 | 'General' : 'General', 11 | 'Generated with' : 'Generat cu', 12 | 'Name' : 'Nume', 13 | 'No response values.' : 'Nici o valoare returnată.', 14 | 'optional' : 'opțional', 15 | 'Parameter' : 'Parametru', 16 | 'Permission:' : 'Permisiune:', 17 | 'Response' : 'Răspuns', 18 | 'Send' : 'Trimite', 19 | 'Send a Sample Request' : 'Trimite o cerere de probă', 20 | 'show up to version:' : 'arată până la versiunea:', 21 | 'Size range:' : 'Interval permis:', 22 | 'Type' : 'Tip', 23 | 'url' : 'url' 24 | } 25 | }); 26 | -------------------------------------------------------------------------------- /docs/locales/ru.js: -------------------------------------------------------------------------------- 1 | define({ 2 | ru: { 3 | 'Allowed values:' : 'Допустимые значения:', 4 | 'Compare all with predecessor': 'Сравнить с предыдущей версией', 5 | 'compare changes to:' : 'сравнить с:', 6 | 'compared to' : 'в сравнении с', 7 | 'Default value:' : 'По умолчанию:', 8 | 'Description' : 'Описание', 9 | 'Field' : 'Название', 10 | 'General' : 'Общая информация', 11 | 'Generated with' : 'Сгенерировано с помощью', 12 | 'Name' : 'Название', 13 | 'No response values.' : 'Нет значений для ответа.', 14 | 'optional' : 'необязательный', 15 | 'Parameter' : 'Параметр', 16 | 'Permission:' : 'Разрешено:', 17 | 'Response' : 'Ответ', 18 | 'Send' : 'Отправить', 19 | 'Send a Sample Request' : 'Отправить тестовый запрос', 20 | 'show up to version:' : 'показать версию:', 21 | 'Size range:' : 'Ограничения:', 22 | 'Type' : 'Тип', 23 | 'url' : 'URL' 24 | } 25 | }); 26 | -------------------------------------------------------------------------------- /docs/locales/zh.js: -------------------------------------------------------------------------------- 1 | define({ 2 | zh: { 3 | 'Allowed values​​:' : '允許值:', 4 | 'Compare all with predecessor': '預先比較所有', 5 | 'compare changes to:' : '比較變更:', 6 | 'compared to' : '對比', 7 | 'Default value:' : '默認值:', 8 | 'Description' : '描述', 9 | 'Field' : '字段', 10 | 'General' : '概括', 11 | 'Generated with' : '生成工具', 12 | 'Name' : '名稱', 13 | 'No response values​​.' : '無對應資料.', 14 | 'optional' : '選項', 15 | 'Parameter' : '參數', 16 | 'Permission:' : '允許:', 17 | 'Response' : '回應', 18 | 'Send' : '發送', 19 | 'Send a Sample Request' : '發送試用需求', 20 | 'show up to version:' : '顯示到版本:', 21 | 'Size range:' : '尺寸範圍:', 22 | 'Type' : '類型', 23 | 'url' : '網址' 24 | } 25 | }); 26 | -------------------------------------------------------------------------------- /docs/locales/zh_cn.js: -------------------------------------------------------------------------------- 1 | define({ 2 | 'zh_cn': { 3 | 'Allowed values:' : '允许值:', 4 | 'Compare all with predecessor': '与所有较早的比较', 5 | 'compare changes to:' : '将当前版本与指定版本比较:', 6 | 'compared to' : '相比于', 7 | 'Default value:' : '默认值:', 8 | 'Description' : '描述', 9 | 'Field' : '字段', 10 | 'General' : '概要', 11 | 'Generated with' : '基于', 12 | 'Name' : '名称', 13 | 'No response values.' : '无返回值.', 14 | 'optional' : '可选', 15 | 'Parameter' : '参数', 16 | 'Permission:' : '权限:', 17 | 'Response' : '返回', 18 | 'Send' : '发送', 19 | 'Send a Sample Request' : '发送示例请求', 20 | 'show up to version:' : '显示到指定版本:', 21 | 'Size range:' : '取值范围:', 22 | 'Type' : '类型', 23 | 'url' : '网址' 24 | } 25 | }); 26 | -------------------------------------------------------------------------------- /docs/utils/handlebars_helper.js: -------------------------------------------------------------------------------- 1 | define([ 2 | 'locales', 3 | 'handlebars', 4 | 'diffMatchPatch' 5 | ], function(locale, Handlebars, DiffMatchPatch) { 6 | 7 | /** 8 | * Return a text as markdown. 9 | * Currently only a little helper to replace apidoc-inline Links (#Group:Name). 10 | * Should be replaced with a full markdown lib. 11 | * @param string text 12 | */ 13 | Handlebars.registerHelper('markdown', function(text) { 14 | if ( ! text ) { 15 | return text; 16 | } 17 | text = text.replace(/((\[(.*?)\])?\(#)((.+?):(.+?))(\))/mg, function(match, p1, p2, p3, p4, p5, p6) { 18 | var link = p3 || p5 + '/' + p6; 19 | return '' + link + ''; 20 | }); 21 | return text; 22 | }); 23 | 24 | /** 25 | * start/stop timer for simple performance check. 26 | */ 27 | var timer; 28 | Handlebars.registerHelper('startTimer', function(text) { 29 | timer = new Date(); 30 | return ''; 31 | }); 32 | 33 | Handlebars.registerHelper('stopTimer', function(text) { 34 | console.log(new Date() - timer); 35 | return ''; 36 | }); 37 | 38 | /** 39 | * Return localized Text. 40 | * @param string text 41 | */ 42 | Handlebars.registerHelper('__', function(text) { 43 | return locale.__(text); 44 | }); 45 | 46 | /** 47 | * Console log. 48 | * @param mixed obj 49 | */ 50 | Handlebars.registerHelper('cl', function(obj) { 51 | console.log(obj); 52 | return ''; 53 | }); 54 | 55 | /** 56 | * Replace underscore with space. 57 | * @param string text 58 | */ 59 | Handlebars.registerHelper('underscoreToSpace', function(text) { 60 | return text.replace(/(_+)/g, ' '); 61 | }); 62 | 63 | /** 64 | * 65 | */ 66 | Handlebars.registerHelper('assign', function(name) { 67 | if(arguments.length > 0) { 68 | var type = typeof(arguments[1]); 69 | var arg = null; 70 | if(type === 'string' || type === 'number' || type === 'boolean') arg = arguments[1]; 71 | Handlebars.registerHelper(name, function() { return arg; }); 72 | } 73 | return ''; 74 | }); 75 | 76 | /** 77 | * 78 | */ 79 | Handlebars.registerHelper('nl2br', function(text) { 80 | return _handlebarsNewlineToBreak(text); 81 | }); 82 | 83 | /** 84 | * 85 | */ 86 | Handlebars.registerHelper('if_eq', function(context, options) { 87 | var compare = context; 88 | // Get length if context is an object 89 | if (context instanceof Object && ! (options.hash.compare instanceof Object)) 90 | compare = Object.keys(context).length; 91 | 92 | if (compare === options.hash.compare) 93 | return options.fn(this); 94 | 95 | return options.inverse(this); 96 | }); 97 | 98 | /** 99 | * 100 | */ 101 | Handlebars.registerHelper('if_gt', function(context, options) { 102 | var compare = context; 103 | // Get length if context is an object 104 | if (context instanceof Object && ! (options.hash.compare instanceof Object)) 105 | compare = Object.keys(context).length; 106 | 107 | if(compare > options.hash.compare) 108 | return options.fn(this); 109 | 110 | return options.inverse(this); 111 | }); 112 | 113 | /** 114 | * 115 | */ 116 | var templateCache = {}; 117 | Handlebars.registerHelper('subTemplate', function(name, sourceContext) { 118 | if ( ! templateCache[name]) 119 | templateCache[name] = Handlebars.compile($('#template-' + name).html()); 120 | 121 | var template = templateCache[name]; 122 | var templateContext = $.extend({}, this, sourceContext.hash); 123 | return new Handlebars.SafeString( template(templateContext) ); 124 | }); 125 | 126 | /** 127 | * 128 | */ 129 | Handlebars.registerHelper('toLowerCase', function(value) { 130 | return (value && typeof value === 'string') ? value.toLowerCase() : ''; 131 | }); 132 | 133 | /** 134 | * 135 | */ 136 | Handlebars.registerHelper('splitFill', function(value, splitChar, fillChar) { 137 | var splits = value.split(splitChar); 138 | return new Array(splits.length).join(fillChar) + splits[splits.length - 1]; 139 | }); 140 | 141 | /** 142 | * Convert Newline to HTML-Break (nl2br). 143 | * 144 | * @param {String} text 145 | * @returns {String} 146 | */ 147 | function _handlebarsNewlineToBreak(text) { 148 | return ('' + text).replace(/([^>\r\n]?)(\r\n|\n\r|\r|\n)/g, '$1' + '
' + '$2'); 149 | } 150 | 151 | /** 152 | * 153 | */ 154 | Handlebars.registerHelper('each_compare_list_field', function(source, compare, options) { 155 | var fieldName = options.hash.field; 156 | var newSource = []; 157 | if (source) { 158 | source.forEach(function(entry) { 159 | var values = entry; 160 | values['key'] = entry[fieldName]; 161 | newSource.push(values); 162 | }); 163 | } 164 | 165 | var newCompare = []; 166 | if (compare) { 167 | compare.forEach(function(entry) { 168 | var values = entry; 169 | values['key'] = entry[fieldName]; 170 | newCompare.push(values); 171 | }); 172 | } 173 | return _handlebarsEachCompared('key', newSource, newCompare, options); 174 | }); 175 | 176 | /** 177 | * 178 | */ 179 | Handlebars.registerHelper('each_compare_keys', function(source, compare, options) { 180 | var newSource = []; 181 | if (source) { 182 | var sourceFields = Object.keys(source); 183 | sourceFields.forEach(function(name) { 184 | var values = {}; 185 | values['value'] = source[name]; 186 | values['key'] = name; 187 | newSource.push(values); 188 | }); 189 | } 190 | 191 | var newCompare = []; 192 | if (compare) { 193 | var compareFields = Object.keys(compare); 194 | compareFields.forEach(function(name) { 195 | var values = {}; 196 | values['value'] = compare[name]; 197 | values['key'] = name; 198 | newCompare.push(values); 199 | }); 200 | } 201 | return _handlebarsEachCompared('key', newSource, newCompare, options); 202 | }); 203 | 204 | /** 205 | * 206 | */ 207 | Handlebars.registerHelper('each_compare_field', function(source, compare, options) { 208 | return _handlebarsEachCompared('field', source, compare, options); 209 | }); 210 | 211 | /** 212 | * 213 | */ 214 | Handlebars.registerHelper('each_compare_title', function(source, compare, options) { 215 | return _handlebarsEachCompared('title', source, compare, options); 216 | }); 217 | 218 | /** 219 | * 220 | */ 221 | Handlebars.registerHelper('reformat', function(source, type){ 222 | if (type == 'json') 223 | try { 224 | return JSON.stringify(JSON.parse(source.trim()),null, " "); 225 | } catch(e) { 226 | 227 | } 228 | return source 229 | }); 230 | 231 | /** 232 | * 233 | */ 234 | Handlebars.registerHelper('showDiff', function(source, compare, options) { 235 | var ds = ''; 236 | if(source === compare) { 237 | ds = source; 238 | } else { 239 | if( ! source) 240 | return compare; 241 | 242 | if( ! compare) 243 | return source; 244 | 245 | var d = diffMatchPatch.diff_main(compare, source); 246 | diffMatchPatch.diff_cleanupSemantic(d); 247 | ds = diffMatchPatch.diff_prettyHtml(d); 248 | ds = ds.replace(/¶/gm, ''); 249 | } 250 | if(options === 'nl2br') 251 | ds = _handlebarsNewlineToBreak(ds); 252 | 253 | return ds; 254 | }); 255 | 256 | /** 257 | * 258 | */ 259 | function _handlebarsEachCompared(fieldname, source, compare, options) 260 | { 261 | var dataList = []; 262 | var index = 0; 263 | if(source) { 264 | source.forEach(function(sourceEntry) { 265 | var found = false; 266 | if (compare) { 267 | compare.forEach(function(compareEntry) { 268 | if(sourceEntry[fieldname] === compareEntry[fieldname]) { 269 | var data = { 270 | typeSame: true, 271 | source: sourceEntry, 272 | compare: compareEntry, 273 | index: index 274 | }; 275 | dataList.push(data); 276 | found = true; 277 | index++; 278 | } 279 | }); 280 | } 281 | if ( ! found) { 282 | var data = { 283 | typeIns: true, 284 | source: sourceEntry, 285 | index: index 286 | }; 287 | dataList.push(data); 288 | index++; 289 | } 290 | }); 291 | } 292 | 293 | if (compare) { 294 | compare.forEach(function(compareEntry) { 295 | var found = false; 296 | if (source) { 297 | source.forEach(function(sourceEntry) { 298 | if(sourceEntry[fieldname] === compareEntry[fieldname]) 299 | found = true; 300 | }); 301 | } 302 | if ( ! found) { 303 | var data = { 304 | typeDel: true, 305 | compare: compareEntry, 306 | index: index 307 | }; 308 | dataList.push(data); 309 | index++; 310 | } 311 | }); 312 | } 313 | 314 | var ret = ''; 315 | var length = dataList.length; 316 | for (var index in dataList) { 317 | if(index == (length - 1)) 318 | dataList[index]['_last'] = true; 319 | ret = ret + options.fn(dataList[index]); 320 | } 321 | return ret; 322 | } 323 | 324 | var diffMatchPatch = new DiffMatchPatch(); 325 | 326 | /** 327 | * Overwrite Colors 328 | */ 329 | DiffMatchPatch.prototype.diff_prettyHtml = function(diffs) { 330 | var html = []; 331 | var pattern_amp = /&/g; 332 | var pattern_lt = //g; 334 | var pattern_para = /\n/g; 335 | for (var x = 0; x < diffs.length; x++) { 336 | var op = diffs[x][0]; // Operation (insert, delete, equal) 337 | var data = diffs[x][1]; // Text of change. 338 | var text = data.replace(pattern_amp, '&').replace(pattern_lt, '<') 339 | .replace(pattern_gt, '>').replace(pattern_para, '¶
'); 340 | switch (op) { 341 | case DIFF_INSERT: 342 | html[x] = '' + text + ''; 343 | break; 344 | case DIFF_DELETE: 345 | html[x] = '' + text + ''; 346 | break; 347 | case DIFF_EQUAL: 348 | html[x] = '' + text + ''; 349 | break; 350 | } 351 | } 352 | return html.join(''); 353 | }; 354 | 355 | // Exports 356 | return Handlebars; 357 | }); 358 | -------------------------------------------------------------------------------- /docs/utils/send_sample_request.js: -------------------------------------------------------------------------------- 1 | define([ 2 | 'jquery', 3 | 'lodash' 4 | ], function($, _) { 5 | 6 | var initDynamic = function() { 7 | // Button send 8 | $(".sample-request-send").off("click"); 9 | $(".sample-request-send").on("click", function(e) { 10 | e.preventDefault(); 11 | var $root = $(this).parents("article"); 12 | var group = $root.data("group"); 13 | var name = $root.data("name"); 14 | var version = $root.data("version"); 15 | sendSampleRequest(group, name, version, $(this).data("sample-request-type")); 16 | }); 17 | 18 | // Button clear 19 | $(".sample-request-clear").off("click"); 20 | $(".sample-request-clear").on("click", function(e) { 21 | e.preventDefault(); 22 | var $root = $(this).parents("article"); 23 | var group = $root.data("group"); 24 | var name = $root.data("name"); 25 | var version = $root.data("version"); 26 | clearSampleRequest(group, name, version); 27 | }); 28 | }; // initDynamic 29 | 30 | function sendSampleRequest(group, name, version, type) 31 | { 32 | var $root = $('article[data-group="' + group + '"][data-name="' + name + '"][data-version="' + version + '"]'); 33 | 34 | // Optional header 35 | var header = {}; 36 | $root.find(".sample-request-header:checked").each(function(i, element) { 37 | var group = $(element).data("sample-request-header-group-id"); 38 | $root.find("[data-sample-request-header-group=\"" + group + "\"]").each(function(i, element) { 39 | var key = $(element).data("sample-request-header-name"); 40 | var value = element.value; 41 | if ( ! element.optional && element.defaultValue !== '') { 42 | value = element.defaultValue; 43 | } 44 | header[key] = value; 45 | }); 46 | }); 47 | 48 | // create JSON dictionary of parameters 49 | var param = {}; 50 | var paramType = {}; 51 | $root.find(".sample-request-param:checked").each(function(i, element) { 52 | var group = $(element).data("sample-request-param-group-id"); 53 | $root.find("[data-sample-request-param-group=\"" + group + "\"]").each(function(i, element) { 54 | var key = $(element).data("sample-request-param-name"); 55 | var value = element.value; 56 | if ( ! element.optional && element.defaultValue !== '') { 57 | value = element.defaultValue; 58 | } 59 | param[key] = value; 60 | paramType[key] = $(element).next().text(); 61 | }); 62 | }); 63 | 64 | // grab user-inputted URL 65 | var url = $root.find(".sample-request-url").val(); 66 | 67 | // Insert url parameter 68 | var pattern = pathToRegexp(url, null); 69 | var matches = pattern.exec(url); 70 | for (var i = 1; i < matches.length; i++) { 71 | var key = matches[i].substr(1); 72 | if (param[key] !== undefined) { 73 | url = url.replace(matches[i], encodeURIComponent(param[key])); 74 | 75 | // remove URL parameters from list 76 | delete param[key]; 77 | } 78 | } // for 79 | 80 | $root.find(".sample-request-response").fadeTo(250, 1); 81 | $root.find(".sample-request-response-json").html("Loading..."); 82 | refreshScrollSpy(); 83 | 84 | _.each( param, function( val, key ) { 85 | var t = paramType[ key ].toLowerCase(); 86 | if ( t === 'object' || t === 'array' ) { 87 | try { 88 | param[ key ] = JSON.parse( val ); 89 | } catch (e) { 90 | } 91 | } 92 | }); 93 | 94 | // send AJAX request, catch success or error callback 95 | var ajaxRequest = { 96 | url : url, 97 | headers : header, 98 | data : param, 99 | type : type.toUpperCase(), 100 | success : displaySuccess, 101 | error : displayError 102 | }; 103 | 104 | $.ajax(ajaxRequest); 105 | 106 | 107 | function displaySuccess(data, status, jqXHR) { 108 | var jsonResponse; 109 | try { 110 | jsonResponse = JSON.parse(jqXHR.responseText); 111 | jsonResponse = JSON.stringify(jsonResponse, null, 4); 112 | } catch (e) { 113 | jsonResponse = data; 114 | } 115 | $root.find(".sample-request-response-json").html(jsonResponse); 116 | refreshScrollSpy(); 117 | }; 118 | 119 | function displayError(jqXHR, textStatus, error) { 120 | var message = "Error " + jqXHR.status + ": " + error; 121 | var jsonResponse; 122 | try { 123 | jsonResponse = JSON.parse(jqXHR.responseText); 124 | jsonResponse = JSON.stringify(jsonResponse, null, 4); 125 | } catch (e) { 126 | jsonResponse = escape(jqXHR.responseText); 127 | } 128 | 129 | if (jsonResponse) 130 | message += "
" + jsonResponse; 131 | 132 | // flicker on previous error to make clear that there is a new response 133 | if($root.find(".sample-request-response").is(":visible")) 134 | $root.find(".sample-request-response").fadeTo(1, 0.1); 135 | 136 | $root.find(".sample-request-response").fadeTo(250, 1); 137 | $root.find(".sample-request-response-json").html(message); 138 | refreshScrollSpy(); 139 | }; 140 | } 141 | 142 | function clearSampleRequest(group, name, version) 143 | { 144 | var $root = $('article[data-group="' + group + '"][data-name="' + name + '"][data-version="' + version + '"]'); 145 | 146 | // hide sample response 147 | $root.find(".sample-request-response-json").html(""); 148 | $root.find(".sample-request-response").hide(); 149 | 150 | // reset value of parameters 151 | $root.find(".sample-request-param").each(function(i, element) { 152 | element.value = ""; 153 | }); 154 | 155 | // restore default URL 156 | var $urlElement = $root.find(".sample-request-url"); 157 | $urlElement.val($urlElement.prop("defaultValue")); 158 | 159 | refreshScrollSpy(); 160 | } 161 | 162 | function refreshScrollSpy() 163 | { 164 | $('[data-spy="scroll"]').each(function () { 165 | $(this).scrollspy("refresh"); 166 | }); 167 | } 168 | 169 | function escapeHtml(str) { 170 | var div = document.createElement("div"); 171 | div.appendChild(document.createTextNode(str)); 172 | return div.innerHTML; 173 | } 174 | 175 | /** 176 | * Exports. 177 | */ 178 | return { 179 | initDynamic: initDynamic 180 | }; 181 | 182 | }); 183 | -------------------------------------------------------------------------------- /docs/vendor/path-to-regexp/LICENSE: -------------------------------------------------------------------------------- 1 | The MIT License (MIT) 2 | 3 | Copyright (c) 2014 Blake Embrey (hello@blakeembrey.com) 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in 13 | all copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 21 | THE SOFTWARE. 22 | -------------------------------------------------------------------------------- /docs/vendor/path-to-regexp/index.js: -------------------------------------------------------------------------------- 1 | var isArray = Array.isArray || function (arr) { 2 | return Object.prototype.toString.call(arr) == '[object Array]'; 3 | }; 4 | 5 | /** 6 | * Expose `pathToRegexp`. 7 | */ 8 | // module.exports = pathToRegexp 9 | 10 | /** 11 | * The main path matching regexp utility. 12 | * 13 | * @type {RegExp} 14 | */ 15 | var PATH_REGEXP = new RegExp([ 16 | // Match escaped characters that would otherwise appear in future matches. 17 | // This allows the user to escape special characters that won't transform. 18 | '(\\\\.)', 19 | // Match Express-style parameters and un-named parameters with a prefix 20 | // and optional suffixes. Matches appear as: 21 | // 22 | // "/:test(\\d+)?" => ["/", "test", "\d+", undefined, "?"] 23 | // "/route(\\d+)" => [undefined, undefined, undefined, "\d+", undefined] 24 | '([\\/.])?(?:\\:(\\w+)(?:\\(((?:\\\\.|[^)])*)\\))?|\\(((?:\\\\.|[^)])*)\\))([+*?])?', 25 | // Match regexp special characters that are always escaped. 26 | '([.+*?=^!:${}()[\\]|\\/])' 27 | ].join('|'), 'g'); 28 | 29 | /** 30 | * Escape the capturing group by escaping special characters and meaning. 31 | * 32 | * @param {String} group 33 | * @return {String} 34 | */ 35 | function escapeGroup (group) { 36 | return group.replace(/([=!:$\/()])/g, '\\$1'); 37 | } 38 | 39 | /** 40 | * Attach the keys as a property of the regexp. 41 | * 42 | * @param {RegExp} re 43 | * @param {Array} keys 44 | * @return {RegExp} 45 | */ 46 | function attachKeys (re, keys) { 47 | re.keys = keys; 48 | return re; 49 | } 50 | 51 | /** 52 | * Get the flags for a regexp from the options. 53 | * 54 | * @param {Object} options 55 | * @return {String} 56 | */ 57 | function flags (options) { 58 | return options.sensitive ? '' : 'i'; 59 | } 60 | 61 | /** 62 | * Pull out keys from a regexp. 63 | * 64 | * @param {RegExp} path 65 | * @param {Array} keys 66 | * @return {RegExp} 67 | */ 68 | function regexpToRegexp (path, keys) { 69 | // Use a negative lookahead to match only capturing groups. 70 | var groups = path.source.match(/\((?!\?)/g); 71 | 72 | if (groups) { 73 | for (var i = 0; i < groups.length; i++) { 74 | keys.push({ 75 | name: i, 76 | delimiter: null, 77 | optional: false, 78 | repeat: false 79 | }); 80 | } 81 | } 82 | 83 | return attachKeys(path, keys); 84 | } 85 | 86 | /** 87 | * Transform an array into a regexp. 88 | * 89 | * @param {Array} path 90 | * @param {Array} keys 91 | * @param {Object} options 92 | * @return {RegExp} 93 | */ 94 | function arrayToRegexp (path, keys, options) { 95 | var parts = []; 96 | 97 | for (var i = 0; i < path.length; i++) { 98 | parts.push(pathToRegexp(path[i], keys, options).source); 99 | } 100 | 101 | var regexp = new RegExp('(?:' + parts.join('|') + ')', flags(options)); 102 | return attachKeys(regexp, keys); 103 | } 104 | 105 | /** 106 | * Replace the specific tags with regexp strings. 107 | * 108 | * @param {String} path 109 | * @param {Array} keys 110 | * @return {String} 111 | */ 112 | function replacePath (path, keys) { 113 | var index = 0; 114 | 115 | function replace (_, escaped, prefix, key, capture, group, suffix, escape) { 116 | if (escaped) { 117 | return escaped; 118 | } 119 | 120 | if (escape) { 121 | return '\\' + escape; 122 | } 123 | 124 | var repeat = suffix === '+' || suffix === '*'; 125 | var optional = suffix === '?' || suffix === '*'; 126 | 127 | keys.push({ 128 | name: key || index++, 129 | delimiter: prefix || '/', 130 | optional: optional, 131 | repeat: repeat 132 | }); 133 | 134 | prefix = prefix ? ('\\' + prefix) : ''; 135 | capture = escapeGroup(capture || group || '[^' + (prefix || '\\/') + ']+?'); 136 | 137 | if (repeat) { 138 | capture = capture + '(?:' + prefix + capture + ')*'; 139 | } 140 | 141 | if (optional) { 142 | return '(?:' + prefix + '(' + capture + '))?'; 143 | } 144 | 145 | // Basic parameter support. 146 | return prefix + '(' + capture + ')'; 147 | } 148 | 149 | return path.replace(PATH_REGEXP, replace); 150 | } 151 | 152 | /** 153 | * Normalize the given path string, returning a regular expression. 154 | * 155 | * An empty array can be passed in for the keys, which will hold the 156 | * placeholder key descriptions. For example, using `/user/:id`, `keys` will 157 | * contain `[{ name: 'id', delimiter: '/', optional: false, repeat: false }]`. 158 | * 159 | * @param {(String|RegExp|Array)} path 160 | * @param {Array} [keys] 161 | * @param {Object} [options] 162 | * @return {RegExp} 163 | */ 164 | function pathToRegexp (path, keys, options) { 165 | keys = keys || []; 166 | 167 | if (!isArray(keys)) { 168 | options = keys; 169 | keys = []; 170 | } else if (!options) { 171 | options = {}; 172 | } 173 | 174 | if (path instanceof RegExp) { 175 | return regexpToRegexp(path, keys, options); 176 | } 177 | 178 | if (isArray(path)) { 179 | return arrayToRegexp(path, keys, options); 180 | } 181 | 182 | var strict = options.strict; 183 | var end = options.end !== false; 184 | var route = replacePath(path, keys); 185 | var endsWithSlash = path.charAt(path.length - 1) === '/'; 186 | 187 | // In non-strict mode we allow a slash at the end of match. If the path to 188 | // match already ends with a slash, we remove it for consistency. The slash 189 | // is valid at the end of a path match, not in the middle. This is important 190 | // in non-ending mode, where "/test/" shouldn't match "/test//route". 191 | if (!strict) { 192 | route = (endsWithSlash ? route.slice(0, -2) : route) + '(?:\\/(?=$))?'; 193 | } 194 | 195 | if (end) { 196 | route += '$'; 197 | } else { 198 | // In non-ending mode, we need the capturing groups to match as much as 199 | // possible by using a positive lookahead to the end or next path segment. 200 | route += strict && endsWithSlash ? '' : '(?=\\/|$)'; 201 | } 202 | 203 | return attachKeys(new RegExp('^' + route, flags(options)), keys); 204 | } 205 | -------------------------------------------------------------------------------- /docs/vendor/polyfill.js: -------------------------------------------------------------------------------- 1 | // From https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/keys 2 | if (!Object.keys) { 3 | Object.keys = (function () { 4 | 'use strict'; 5 | var hasOwnProperty = Object.prototype.hasOwnProperty, 6 | hasDontEnumBug = !({toString: null}).propertyIsEnumerable('toString'), 7 | dontEnums = [ 8 | 'toString', 9 | 'toLocaleString', 10 | 'valueOf', 11 | 'hasOwnProperty', 12 | 'isPrototypeOf', 13 | 'propertyIsEnumerable', 14 | 'constructor' 15 | ], 16 | dontEnumsLength = dontEnums.length; 17 | 18 | return function (obj) { 19 | if (typeof obj !== 'object' && (typeof obj !== 'function' || obj === null)) { 20 | throw new TypeError('Object.keys called on non-object'); 21 | } 22 | 23 | var result = [], prop, i; 24 | 25 | for (prop in obj) { 26 | if (hasOwnProperty.call(obj, prop)) { 27 | result.push(prop); 28 | } 29 | } 30 | 31 | if (hasDontEnumBug) { 32 | for (i = 0; i < dontEnumsLength; i++) { 33 | if (hasOwnProperty.call(obj, dontEnums[i])) { 34 | result.push(dontEnums[i]); 35 | } 36 | } 37 | } 38 | return result; 39 | }; 40 | }()); 41 | } 42 | 43 | //Production steps of ECMA-262, Edition 5, 15.4.4.18 44 | //Reference: http://es5.github.com/#x15.4.4.18 45 | if (!Array.prototype.forEach) { 46 | Array.prototype.forEach = function (callback, thisArg) { 47 | var T, k; 48 | 49 | if (this == null) { 50 | throw new TypeError(' this is null or not defined'); 51 | } 52 | 53 | // 1. Let O be the result of calling ToObject passing the |this| value as the argument. 54 | var O = Object(this); 55 | 56 | // 2. Let lenValue be the result of calling the Get internal method of O with the argument "length". 57 | // 3. Let len be ToUint32(lenValue). 58 | var len = O.length >>> 0; 59 | 60 | // 4. If IsCallable(callback) is false, throw a TypeError exception. 61 | // See: http://es5.github.com/#x9.11 62 | if (typeof callback !== "function") { 63 | throw new TypeError(callback + " is not a function"); 64 | } 65 | 66 | // 5. If thisArg was supplied, let T be thisArg; else let T be undefined. 67 | if (arguments.length > 1) { 68 | T = thisArg; 69 | } 70 | 71 | // 6. Let k be 0 72 | k = 0; 73 | 74 | // 7. Repeat, while k < len 75 | while (k < len) { 76 | var kValue; 77 | 78 | // a. Let Pk be ToString(k). 79 | // This is implicit for LHS operands of the in operator 80 | // b. Let kPresent be the result of calling the HasProperty internal method of O with argument Pk. 81 | // This step can be combined with c 82 | // c. If kPresent is true, then 83 | if (k in O) { 84 | // i. Let kValue be the result of calling the Get internal method of O with argument Pk. 85 | kValue = O[k]; 86 | 87 | // ii. Call the Call internal method of callback with T as the this value and 88 | // argument list containing kValue, k, and O. 89 | callback.call(T, kValue, k, O); 90 | } 91 | // d. Increase k by 1. 92 | k++; 93 | } 94 | // 8. return undefined 95 | }; 96 | } 97 | -------------------------------------------------------------------------------- /docs/vendor/prettify.css: -------------------------------------------------------------------------------- 1 | /* Pretty printing styles. Used with prettify.js. */ 2 | /* Vim sunburst theme by David Leibovic */ 3 | 4 | pre .str, code .str { color: #65B042; } /* string - green */ 5 | pre .kwd, code .kwd { color: #E28964; } /* keyword - dark pink */ 6 | pre .com, code .com { color: #AEAEAE; font-style: italic; } /* comment - gray */ 7 | pre .typ, code .typ { color: #89bdff; } /* type - light blue */ 8 | pre .lit, code .lit { color: #3387CC; } /* literal - blue */ 9 | pre .pun, code .pun { color: #fff; } /* punctuation - white */ 10 | pre .pln, code .pln { color: #fff; } /* plaintext - white */ 11 | pre .tag, code .tag { color: #89bdff; } /* html/xml tag - light blue */ 12 | pre .atn, code .atn { color: #bdb76b; } /* html/xml attribute name - khaki */ 13 | pre .atv, code .atv { color: #65B042; } /* html/xml attribute value - green */ 14 | pre .dec, code .dec { color: #3387CC; } /* decimal - blue */ 15 | 16 | pre.prettyprint, code.prettyprint { 17 | background-color: #000; 18 | -moz-border-radius: 8px; 19 | -webkit-border-radius: 8px; 20 | -o-border-radius: 8px; 21 | -ms-border-radius: 8px; 22 | -khtml-border-radius: 8px; 23 | border-radius: 8px; 24 | } 25 | 26 | pre.prettyprint { 27 | width: 95%; 28 | margin: 1em auto; 29 | padding: 1em; 30 | white-space: pre-wrap; 31 | } 32 | 33 | 34 | /* Specify class=linenums on a pre to get line numbering */ 35 | ol.linenums { margin-top: 0; margin-bottom: 0; color: #AEAEAE; } /* IE indents via margin-left */ 36 | li.L0,li.L1,li.L2,li.L3,li.L5,li.L6,li.L7,li.L8 { list-style-type: none } 37 | /* Alternate shading for lines */ 38 | li.L1,li.L3,li.L5,li.L7,li.L9 { } 39 | 40 | @media print { 41 | pre .str, code .str { color: #060; } 42 | pre .kwd, code .kwd { color: #006; font-weight: bold; } 43 | pre .com, code .com { color: #600; font-style: italic; } 44 | pre .typ, code .typ { color: #404; font-weight: bold; } 45 | pre .lit, code .lit { color: #044; } 46 | pre .pun, code .pun { color: #440; } 47 | pre .pln, code .pln { color: #000; } 48 | pre .tag, code .tag { color: #006; font-weight: bold; } 49 | pre .atn, code .atn { color: #404; } 50 | pre .atv, code .atv { color: #060; } 51 | } 52 | -------------------------------------------------------------------------------- /docs/vendor/prettify/lang-Splus.js: -------------------------------------------------------------------------------- 1 | /* 2 | 3 | Copyright (C) 2012 Jeffrey B. Arnold 4 | 5 | Licensed under the Apache License, Version 2.0 (the "License"); 6 | you may not use this file except in compliance with the License. 7 | You may obtain a copy of the License at 8 | 9 | http://www.apache.org/licenses/LICENSE-2.0 10 | 11 | Unless required by applicable law or agreed to in writing, software 12 | distributed under the License is distributed on an "AS IS" BASIS, 13 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | See the License for the specific language governing permissions and 15 | limitations under the License. 16 | */ 17 | PR.registerLangHandler(PR.createSimpleLexer([["pln",/^[\t\n\r \xA0]+/,null,"\t\n\r \u00a0"],["str",/^\"(?:[^\"\\]|\\[\s\S])*(?:\"|$)/,null,'"'],["str",/^\'(?:[^\'\\]|\\[\s\S])*(?:\'|$)/,null,"'"]],[["com",/^#.*/],["kwd",/^(?:if|else|for|while|repeat|in|next|break|return|switch|function)(?![A-Za-z0-9_.])/],["lit",/^0[xX][a-fA-F0-9]+([pP][0-9]+)?[Li]?/],["lit",/^[+-]?([0-9]+(\.[0-9]+)?|\.[0-9]+)([eE][+-]?[0-9]+)?[Li]?/],["lit",/^(?:NULL|NA(?:_(?:integer|real|complex|character)_)?|Inf|TRUE|FALSE|NaN|\.\.(?:\.|[0-9]+))(?![A-Za-z0-9_.])/], 18 | ["pun",/^(?:<>?|-|==|<=|>=|<|>|&&?|!=|\|\|?|\*|\+|\^|\/|!|%.*?%|=|~|\$|@|:{1,3}|[\[\](){};,?])/],["pln",/^(?:[A-Za-z]+[A-Za-z0-9_.]*|\.[a-zA-Z_][0-9a-zA-Z\._]*)(?![A-Za-z0-9_.])/],["str",/^`.+`/]]),["r","s","R","S","Splus"]); 19 | -------------------------------------------------------------------------------- /docs/vendor/prettify/lang-aea.js: -------------------------------------------------------------------------------- 1 | /* 2 | 3 | Copyright (C) 2009 Onno Hommes. 4 | 5 | Licensed under the Apache License, Version 2.0 (the "License"); 6 | you may not use this file except in compliance with the License. 7 | You may obtain a copy of the License at 8 | 9 | http://www.apache.org/licenses/LICENSE-2.0 10 | 11 | Unless required by applicable law or agreed to in writing, software 12 | distributed under the License is distributed on an "AS IS" BASIS, 13 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | See the License for the specific language governing permissions and 15 | limitations under the License. 16 | */ 17 | PR.registerLangHandler(PR.createSimpleLexer([["com",/^#[^\r\n]*/,null,"#"],["pln",/^[\t\n\r \xA0]+/,null,"\t\n\r \u00a0"],["str",/^\"(?:[^\"\\]|\\[\s\S])*(?:\"|$)/,null,'"']],[["kwd",/^(?:ADS|AD|AUG|BZF|BZMF|CAE|CAF|CA|CCS|COM|CS|DAS|DCA|DCOM|DCS|DDOUBL|DIM|DOUBLE|DTCB|DTCF|DV|DXCH|EDRUPT|EXTEND|INCR|INDEX|NDX|INHINT|LXCH|MASK|MSK|MP|MSU|NOOP|OVSK|QXCH|RAND|READ|RELINT|RESUME|RETURN|ROR|RXOR|SQUARE|SU|TCR|TCAA|OVSK|TCF|TC|TS|WAND|WOR|WRITE|XCH|XLQ|XXALQ|ZL|ZQ|ADD|ADZ|SUB|SUZ|MPY|MPR|MPZ|DVP|COM|ABS|CLA|CLZ|LDQ|STO|STQ|ALS|LLS|LRS|TRA|TSQ|TMI|TOV|AXT|TIX|DLY|INP|OUT)\s/, 18 | null],["typ",/^(?:-?GENADR|=MINUS|2BCADR|VN|BOF|MM|-?2CADR|-?[1-6]DNADR|ADRES|BBCON|[SE]?BANK\=?|BLOCK|BNKSUM|E?CADR|COUNT\*?|2?DEC\*?|-?DNCHAN|-?DNPTR|EQUALS|ERASE|MEMORY|2?OCT|REMADR|SETLOC|SUBRO|ORG|BSS|BES|SYN|EQU|DEFINE|END)\s/,null],["lit",/^\'(?:-*(?:\w|\\[\x21-\x7e])(?:[\w-]*|\\[\x21-\x7e])[=!?]?)?/],["pln",/^-*(?:[!-z_]|\\[\x21-\x7e])(?:[\w-]*|\\[\x21-\x7e])[=!?]?/i],["pun",/^[^\w\t\n\r \xA0()\"\\\';]+/]]),["apollo","agc","aea"]); 19 | -------------------------------------------------------------------------------- /docs/vendor/prettify/lang-agc.js: -------------------------------------------------------------------------------- 1 | /* 2 | 3 | Copyright (C) 2009 Onno Hommes. 4 | 5 | Licensed under the Apache License, Version 2.0 (the "License"); 6 | you may not use this file except in compliance with the License. 7 | You may obtain a copy of the License at 8 | 9 | http://www.apache.org/licenses/LICENSE-2.0 10 | 11 | Unless required by applicable law or agreed to in writing, software 12 | distributed under the License is distributed on an "AS IS" BASIS, 13 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | See the License for the specific language governing permissions and 15 | limitations under the License. 16 | */ 17 | PR.registerLangHandler(PR.createSimpleLexer([["com",/^#[^\r\n]*/,null,"#"],["pln",/^[\t\n\r \xA0]+/,null,"\t\n\r \u00a0"],["str",/^\"(?:[^\"\\]|\\[\s\S])*(?:\"|$)/,null,'"']],[["kwd",/^(?:ADS|AD|AUG|BZF|BZMF|CAE|CAF|CA|CCS|COM|CS|DAS|DCA|DCOM|DCS|DDOUBL|DIM|DOUBLE|DTCB|DTCF|DV|DXCH|EDRUPT|EXTEND|INCR|INDEX|NDX|INHINT|LXCH|MASK|MSK|MP|MSU|NOOP|OVSK|QXCH|RAND|READ|RELINT|RESUME|RETURN|ROR|RXOR|SQUARE|SU|TCR|TCAA|OVSK|TCF|TC|TS|WAND|WOR|WRITE|XCH|XLQ|XXALQ|ZL|ZQ|ADD|ADZ|SUB|SUZ|MPY|MPR|MPZ|DVP|COM|ABS|CLA|CLZ|LDQ|STO|STQ|ALS|LLS|LRS|TRA|TSQ|TMI|TOV|AXT|TIX|DLY|INP|OUT)\s/, 18 | null],["typ",/^(?:-?GENADR|=MINUS|2BCADR|VN|BOF|MM|-?2CADR|-?[1-6]DNADR|ADRES|BBCON|[SE]?BANK\=?|BLOCK|BNKSUM|E?CADR|COUNT\*?|2?DEC\*?|-?DNCHAN|-?DNPTR|EQUALS|ERASE|MEMORY|2?OCT|REMADR|SETLOC|SUBRO|ORG|BSS|BES|SYN|EQU|DEFINE|END)\s/,null],["lit",/^\'(?:-*(?:\w|\\[\x21-\x7e])(?:[\w-]*|\\[\x21-\x7e])[=!?]?)?/],["pln",/^-*(?:[!-z_]|\\[\x21-\x7e])(?:[\w-]*|\\[\x21-\x7e])[=!?]?/i],["pun",/^[^\w\t\n\r \xA0()\"\\\';]+/]]),["apollo","agc","aea"]); 19 | -------------------------------------------------------------------------------- /docs/vendor/prettify/lang-apollo.js: -------------------------------------------------------------------------------- 1 | /* 2 | 3 | Copyright (C) 2009 Onno Hommes. 4 | 5 | Licensed under the Apache License, Version 2.0 (the "License"); 6 | you may not use this file except in compliance with the License. 7 | You may obtain a copy of the License at 8 | 9 | http://www.apache.org/licenses/LICENSE-2.0 10 | 11 | Unless required by applicable law or agreed to in writing, software 12 | distributed under the License is distributed on an "AS IS" BASIS, 13 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | See the License for the specific language governing permissions and 15 | limitations under the License. 16 | */ 17 | PR.registerLangHandler(PR.createSimpleLexer([["com",/^#[^\r\n]*/,null,"#"],["pln",/^[\t\n\r \xA0]+/,null,"\t\n\r \u00a0"],["str",/^\"(?:[^\"\\]|\\[\s\S])*(?:\"|$)/,null,'"']],[["kwd",/^(?:ADS|AD|AUG|BZF|BZMF|CAE|CAF|CA|CCS|COM|CS|DAS|DCA|DCOM|DCS|DDOUBL|DIM|DOUBLE|DTCB|DTCF|DV|DXCH|EDRUPT|EXTEND|INCR|INDEX|NDX|INHINT|LXCH|MASK|MSK|MP|MSU|NOOP|OVSK|QXCH|RAND|READ|RELINT|RESUME|RETURN|ROR|RXOR|SQUARE|SU|TCR|TCAA|OVSK|TCF|TC|TS|WAND|WOR|WRITE|XCH|XLQ|XXALQ|ZL|ZQ|ADD|ADZ|SUB|SUZ|MPY|MPR|MPZ|DVP|COM|ABS|CLA|CLZ|LDQ|STO|STQ|ALS|LLS|LRS|TRA|TSQ|TMI|TOV|AXT|TIX|DLY|INP|OUT)\s/, 18 | null],["typ",/^(?:-?GENADR|=MINUS|2BCADR|VN|BOF|MM|-?2CADR|-?[1-6]DNADR|ADRES|BBCON|[SE]?BANK\=?|BLOCK|BNKSUM|E?CADR|COUNT\*?|2?DEC\*?|-?DNCHAN|-?DNPTR|EQUALS|ERASE|MEMORY|2?OCT|REMADR|SETLOC|SUBRO|ORG|BSS|BES|SYN|EQU|DEFINE|END)\s/,null],["lit",/^\'(?:-*(?:\w|\\[\x21-\x7e])(?:[\w-]*|\\[\x21-\x7e])[=!?]?)?/],["pln",/^-*(?:[!-z_]|\\[\x21-\x7e])(?:[\w-]*|\\[\x21-\x7e])[=!?]?/i],["pun",/^[^\w\t\n\r \xA0()\"\\\';]+/]]),["apollo","agc","aea"]); 19 | -------------------------------------------------------------------------------- /docs/vendor/prettify/lang-basic.js: -------------------------------------------------------------------------------- 1 | /* 2 | 3 | Copyright (C) 2013 Peter Kofler 4 | 5 | Licensed under the Apache License, Version 2.0 (the "License"); 6 | you may not use this file except in compliance with the License. 7 | You may obtain a copy of the License at 8 | 9 | http://www.apache.org/licenses/LICENSE-2.0 10 | 11 | Unless required by applicable law or agreed to in writing, software 12 | distributed under the License is distributed on an "AS IS" BASIS, 13 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | See the License for the specific language governing permissions and 15 | limitations under the License. 16 | */ 17 | PR.registerLangHandler(PR.createSimpleLexer([["str",/^(?:"(?:[^\\"\r\n]|\\.)*(?:"|$))/,null,'"'],["pln",/^\s+/,null," \r\n\t\u00a0"]],[["com",/^REM[^\r\n]*/,null],["kwd",/^\b(?:AND|CLOSE|CLR|CMD|CONT|DATA|DEF ?FN|DIM|END|FOR|GET|GOSUB|GOTO|IF|INPUT|LET|LIST|LOAD|NEW|NEXT|NOT|ON|OPEN|OR|POKE|PRINT|READ|RESTORE|RETURN|RUN|SAVE|STEP|STOP|SYS|THEN|TO|VERIFY|WAIT)\b/,null],["pln",/^[A-Z][A-Z0-9]?(?:\$|%)?/i,null],["lit",/^(?:\d+(?:\.\d*)?|\.\d+)(?:e[+\-]?\d+)?/i, 18 | null,"0123456789"],["pun",/^.[^\s\w\.$%"]*/,null]]),["basic","cbm"]); 19 | -------------------------------------------------------------------------------- /docs/vendor/prettify/lang-cbm.js: -------------------------------------------------------------------------------- 1 | /* 2 | 3 | Copyright (C) 2013 Peter Kofler 4 | 5 | Licensed under the Apache License, Version 2.0 (the "License"); 6 | you may not use this file except in compliance with the License. 7 | You may obtain a copy of the License at 8 | 9 | http://www.apache.org/licenses/LICENSE-2.0 10 | 11 | Unless required by applicable law or agreed to in writing, software 12 | distributed under the License is distributed on an "AS IS" BASIS, 13 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | See the License for the specific language governing permissions and 15 | limitations under the License. 16 | */ 17 | PR.registerLangHandler(PR.createSimpleLexer([["str",/^(?:"(?:[^\\"\r\n]|\\.)*(?:"|$))/,null,'"'],["pln",/^\s+/,null," \r\n\t\u00a0"]],[["com",/^REM[^\r\n]*/,null],["kwd",/^\b(?:AND|CLOSE|CLR|CMD|CONT|DATA|DEF ?FN|DIM|END|FOR|GET|GOSUB|GOTO|IF|INPUT|LET|LIST|LOAD|NEW|NEXT|NOT|ON|OPEN|OR|POKE|PRINT|READ|RESTORE|RETURN|RUN|SAVE|STEP|STOP|SYS|THEN|TO|VERIFY|WAIT)\b/,null],["pln",/^[A-Z][A-Z0-9]?(?:\$|%)?/i,null],["lit",/^(?:\d+(?:\.\d*)?|\.\d+)(?:e[+\-]?\d+)?/i, 18 | null,"0123456789"],["pun",/^.[^\s\w\.$%"]*/,null]]),["basic","cbm"]); 19 | -------------------------------------------------------------------------------- /docs/vendor/prettify/lang-cl.js: -------------------------------------------------------------------------------- 1 | /* 2 | 3 | Copyright (C) 2008 Google Inc. 4 | 5 | Licensed under the Apache License, Version 2.0 (the "License"); 6 | you may not use this file except in compliance with the License. 7 | You may obtain a copy of the License at 8 | 9 | http://www.apache.org/licenses/LICENSE-2.0 10 | 11 | Unless required by applicable law or agreed to in writing, software 12 | distributed under the License is distributed on an "AS IS" BASIS, 13 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | See the License for the specific language governing permissions and 15 | limitations under the License. 16 | */ 17 | PR.registerLangHandler(PR.createSimpleLexer([["opn",/^\(+/,null,"("],["clo",/^\)+/,null,")"],["com",/^;[^\r\n]*/,null,";"],["pln",/^[\t\n\r \xA0]+/,null,"\t\n\r \u00a0"],["str",/^\"(?:[^\"\\]|\\[\s\S])*(?:\"|$)/,null,'"']],[["kwd",/^(?:block|c[ad]+r|catch|con[ds]|def(?:ine|un)|do|eq|eql|equal|equalp|eval-when|flet|format|go|if|labels|lambda|let|load-time-value|locally|macrolet|multiple-value-call|nil|progn|progv|quote|require|return-from|setq|symbol-macrolet|t|tagbody|the|throw|unwind)\b/, 18 | null],["lit",/^[+\-]?(?:[0#]x[0-9a-f]+|\d+\/\d+|(?:\.\d+|\d+(?:\.\d*)?)(?:[ed][+\-]?\d+)?)/i],["lit",/^\'(?:-*(?:\w|\\[\x21-\x7e])(?:[\w-]*|\\[\x21-\x7e])[=!?]?)?/],["pln",/^-*(?:[a-z_]|\\[\x21-\x7e])(?:[\w-]*|\\[\x21-\x7e])[=!?]?/i],["pun",/^[^\w\t\n\r \xA0()\"\\\';]+/]]),"cl el lisp lsp scm ss rkt".split(" ")); 19 | -------------------------------------------------------------------------------- /docs/vendor/prettify/lang-clj.js: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright (C) 2011 Google Inc. 3 | 4 | Licensed under the Apache License, Version 2.0 (the "License"); 5 | you may not use this file except in compliance with the License. 6 | You may obtain a copy of the License at 7 | 8 | http://www.apache.org/licenses/LICENSE-2.0 9 | 10 | Unless required by applicable law or agreed to in writing, software 11 | distributed under the License is distributed on an "AS IS" BASIS, 12 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | See the License for the specific language governing permissions and 14 | limitations under the License. 15 | */ 16 | PR.registerLangHandler(PR.createSimpleLexer([["opn",/^[\(\{\[]+/,null,"([{"],["clo",/^[\)\}\]]+/,null,")]}"],["com",/^;[^\r\n]*/,null,";"],["pln",/^[\t\n\r \xA0]+/,null,"\t\n\r \u00a0"],["str",/^\"(?:[^\"\\]|\\[\s\S])*(?:\"|$)/,null,'"']],[["kwd",/^(?:def|if|do|let|quote|var|fn|loop|recur|throw|try|monitor-enter|monitor-exit|defmacro|defn|defn-|macroexpand|macroexpand-1|for|doseq|dosync|dotimes|and|or|when|not|assert|doto|proxy|defstruct|first|rest|cons|defprotocol|deftype|defrecord|reify|defmulti|defmethod|meta|with-meta|ns|in-ns|create-ns|import|intern|refer|alias|namespace|resolve|ref|deref|refset|new|set!|memfn|to-array|into-array|aset|gen-class|reduce|map|filter|find|nil?|empty?|hash-map|hash-set|vec|vector|seq|flatten|reverse|assoc|dissoc|list|list?|disj|get|union|difference|intersection|extend|extend-type|extend-protocol|prn)\b/, 17 | null],["typ",/^:[0-9a-zA-Z\-]+/]]),["clj"]); 18 | -------------------------------------------------------------------------------- /docs/vendor/prettify/lang-css.js: -------------------------------------------------------------------------------- 1 | /* 2 | 3 | Copyright (C) 2009 Google Inc. 4 | 5 | Licensed under the Apache License, Version 2.0 (the "License"); 6 | you may not use this file except in compliance with the License. 7 | You may obtain a copy of the License at 8 | 9 | http://www.apache.org/licenses/LICENSE-2.0 10 | 11 | Unless required by applicable law or agreed to in writing, software 12 | distributed under the License is distributed on an "AS IS" BASIS, 13 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | See the License for the specific language governing permissions and 15 | limitations under the License. 16 | */ 17 | PR.registerLangHandler(PR.createSimpleLexer([["pln",/^[ \t\r\n\f]+/,null," \t\r\n\f"]],[["str",/^\"(?:[^\n\r\f\\\"]|\\(?:\r\n?|\n|\f)|\\[\s\S])*\"/,null],["str",/^\'(?:[^\n\r\f\\\']|\\(?:\r\n?|\n|\f)|\\[\s\S])*\'/,null],["lang-css-str",/^url\(([^\)\"\']+)\)/i],["kwd",/^(?:url|rgb|\!important|@import|@page|@media|@charset|inherit)(?=[^\-\w]|$)/i,null],["lang-css-kw",/^(-?(?:[_a-z]|(?:\\[0-9a-f]+ ?))(?:[_a-z0-9\-]|\\(?:\\[0-9a-f]+ ?))*)\s*:/i],["com",/^\/\*[^*]*\*+(?:[^\/*][^*]*\*+)*\//], 18 | ["com",/^(?:\x3c!--|--\x3e)/],["lit",/^(?:\d+|\d*\.\d+)(?:%|[a-z]+)?/i],["lit",/^#(?:[0-9a-f]{3}){1,2}\b/i],["pln",/^-?(?:[_a-z]|(?:\\[\da-f]+ ?))(?:[_a-z\d\-]|\\(?:\\[\da-f]+ ?))*/i],["pun",/^[^\s\w\'\"]+/]]),["css"]);PR.registerLangHandler(PR.createSimpleLexer([],[["kwd",/^-?(?:[_a-z]|(?:\\[\da-f]+ ?))(?:[_a-z\d\-]|\\(?:\\[\da-f]+ ?))*/i]]),["css-kw"]);PR.registerLangHandler(PR.createSimpleLexer([],[["str",/^[^\)\"\']+/]]),["css-str"]); 19 | -------------------------------------------------------------------------------- /docs/vendor/prettify/lang-dart.js: -------------------------------------------------------------------------------- 1 | /* 2 | 3 | Copyright (C) 2013 Google Inc. 4 | 5 | Licensed under the Apache License, Version 2.0 (the "License"); 6 | you may not use this file except in compliance with the License. 7 | You may obtain a copy of the License at 8 | 9 | http://www.apache.org/licenses/LICENSE-2.0 10 | 11 | Unless required by applicable law or agreed to in writing, software 12 | distributed under the License is distributed on an "AS IS" BASIS, 13 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | See the License for the specific language governing permissions and 15 | limitations under the License. 16 | */ 17 | PR.registerLangHandler(PR.createSimpleLexer([["pln",/^[\t\n\r \xA0]+/,null,"\t\n\r \u00a0"]],[["com",/^#!(?:.*)/],["kwd",/^\b(?:import|library|part of|part|as|show|hide)\b/i],["com",/^\/\/(?:.*)/],["com",/^\/\*[^*]*\*+(?:[^\/*][^*]*\*+)*\//],["kwd",/^\b(?:class|interface)\b/i],["kwd",/^\b(?:assert|async|await|break|case|catch|continue|default|do|else|finally|for|if|in|is|new|return|super|switch|sync|this|throw|try|while)\b/i],["kwd",/^\b(?:abstract|const|extends|factory|final|get|implements|native|operator|set|static|typedef|var)\b/i], 18 | ["typ",/^\b(?:bool|double|Dynamic|int|num|Object|String|void)\b/i],["kwd",/^\b(?:false|null|true)\b/i],["str",/^r?[\']{3}[\s|\S]*?[^\\][\']{3}/],["str",/^r?[\"]{3}[\s|\S]*?[^\\][\"]{3}/],["str",/^r?\'(\'|(?:[^\n\r\f])*?[^\\]\')/],["str",/^r?\"(\"|(?:[^\n\r\f])*?[^\\]\")/],["typ",/^[A-Z]\w*/],["pln",/^[a-z_$][a-z0-9_]*/i],["pun",/^[~!%^&*+=|?:<>/-]/],["lit",/^\b0x[0-9a-f]+/i],["lit",/^\b\d+(?:\.\d*)?(?:e[+-]?\d+)?/i],["lit", 19 | /^\b\.\d+(?:e[+-]?\d+)?/i],["pun",/^[(){}\[\],.;]/]]),["dart"]); 20 | -------------------------------------------------------------------------------- /docs/vendor/prettify/lang-el.js: -------------------------------------------------------------------------------- 1 | /* 2 | 3 | Copyright (C) 2008 Google Inc. 4 | 5 | Licensed under the Apache License, Version 2.0 (the "License"); 6 | you may not use this file except in compliance with the License. 7 | You may obtain a copy of the License at 8 | 9 | http://www.apache.org/licenses/LICENSE-2.0 10 | 11 | Unless required by applicable law or agreed to in writing, software 12 | distributed under the License is distributed on an "AS IS" BASIS, 13 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | See the License for the specific language governing permissions and 15 | limitations under the License. 16 | */ 17 | PR.registerLangHandler(PR.createSimpleLexer([["opn",/^\(+/,null,"("],["clo",/^\)+/,null,")"],["com",/^;[^\r\n]*/,null,";"],["pln",/^[\t\n\r \xA0]+/,null,"\t\n\r \u00a0"],["str",/^\"(?:[^\"\\]|\\[\s\S])*(?:\"|$)/,null,'"']],[["kwd",/^(?:block|c[ad]+r|catch|con[ds]|def(?:ine|un)|do|eq|eql|equal|equalp|eval-when|flet|format|go|if|labels|lambda|let|load-time-value|locally|macrolet|multiple-value-call|nil|progn|progv|quote|require|return-from|setq|symbol-macrolet|t|tagbody|the|throw|unwind)\b/, 18 | null],["lit",/^[+\-]?(?:[0#]x[0-9a-f]+|\d+\/\d+|(?:\.\d+|\d+(?:\.\d*)?)(?:[ed][+\-]?\d+)?)/i],["lit",/^\'(?:-*(?:\w|\\[\x21-\x7e])(?:[\w-]*|\\[\x21-\x7e])[=!?]?)?/],["pln",/^-*(?:[a-z_]|\\[\x21-\x7e])(?:[\w-]*|\\[\x21-\x7e])[=!?]?/i],["pun",/^[^\w\t\n\r \xA0()\"\\\';]+/]]),"cl el lisp lsp scm ss rkt".split(" ")); 19 | -------------------------------------------------------------------------------- /docs/vendor/prettify/lang-erl.js: -------------------------------------------------------------------------------- 1 | /* 2 | 3 | Copyright (C) 2013 Andrew Allen 4 | 5 | Licensed under the Apache License, Version 2.0 (the "License"); 6 | you may not use this file except in compliance with the License. 7 | You may obtain a copy of the License at 8 | 9 | http://www.apache.org/licenses/LICENSE-2.0 10 | 11 | Unless required by applicable law or agreed to in writing, software 12 | distributed under the License is distributed on an "AS IS" BASIS, 13 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | See the License for the specific language governing permissions and 15 | limitations under the License. 16 | */ 17 | PR.registerLangHandler(PR.createSimpleLexer([["pln",/^[\t\n\x0B\x0C\r ]+/,null,"\t\n\x0B\f\r "],["str",/^\"(?:[^\"\\\n\x0C\r]|\\[\s\S])*(?:\"|$)/,null,'"'],["lit",/^[a-z][a-zA-Z0-9_]*/],["lit",/^\'(?:[^\'\\\n\x0C\r]|\\[^&])+\'?/,null,"'"],["lit",/^\?[^ \t\n({]+/,null,"?"],["lit",/^(?:0o[0-7]+|0x[\da-f]+|\d+(?:\.\d+)?(?:e[+\-]?\d+)?)/i,null,"0123456789"]],[["com",/^%[^\n]*/],["kwd",/^(?:module|attributes|do|let|in|letrec|apply|call|primop|case|of|end|when|fun|try|catch|receive|after|char|integer|float,atom,string,var)\b/], 18 | ["kwd",/^-[a-z_]+/],["typ",/^[A-Z_][a-zA-Z0-9_]*/],["pun",/^[.,;]/]]),["erlang","erl"]); 19 | -------------------------------------------------------------------------------- /docs/vendor/prettify/lang-erlang.js: -------------------------------------------------------------------------------- 1 | /* 2 | 3 | Copyright (C) 2013 Andrew Allen 4 | 5 | Licensed under the Apache License, Version 2.0 (the "License"); 6 | you may not use this file except in compliance with the License. 7 | You may obtain a copy of the License at 8 | 9 | http://www.apache.org/licenses/LICENSE-2.0 10 | 11 | Unless required by applicable law or agreed to in writing, software 12 | distributed under the License is distributed on an "AS IS" BASIS, 13 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | See the License for the specific language governing permissions and 15 | limitations under the License. 16 | */ 17 | PR.registerLangHandler(PR.createSimpleLexer([["pln",/^[\t\n\x0B\x0C\r ]+/,null,"\t\n\x0B\f\r "],["str",/^\"(?:[^\"\\\n\x0C\r]|\\[\s\S])*(?:\"|$)/,null,'"'],["lit",/^[a-z][a-zA-Z0-9_]*/],["lit",/^\'(?:[^\'\\\n\x0C\r]|\\[^&])+\'?/,null,"'"],["lit",/^\?[^ \t\n({]+/,null,"?"],["lit",/^(?:0o[0-7]+|0x[\da-f]+|\d+(?:\.\d+)?(?:e[+\-]?\d+)?)/i,null,"0123456789"]],[["com",/^%[^\n]*/],["kwd",/^(?:module|attributes|do|let|in|letrec|apply|call|primop|case|of|end|when|fun|try|catch|receive|after|char|integer|float,atom,string,var)\b/], 18 | ["kwd",/^-[a-z_]+/],["typ",/^[A-Z_][a-zA-Z0-9_]*/],["pun",/^[.,;]/]]),["erlang","erl"]); 19 | -------------------------------------------------------------------------------- /docs/vendor/prettify/lang-fs.js: -------------------------------------------------------------------------------- 1 | /* 2 | 3 | Copyright (C) 2008 Google Inc. 4 | 5 | Licensed under the Apache License, Version 2.0 (the "License"); 6 | you may not use this file except in compliance with the License. 7 | You may obtain a copy of the License at 8 | 9 | http://www.apache.org/licenses/LICENSE-2.0 10 | 11 | Unless required by applicable law or agreed to in writing, software 12 | distributed under the License is distributed on an "AS IS" BASIS, 13 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | See the License for the specific language governing permissions and 15 | limitations under the License. 16 | */ 17 | PR.registerLangHandler(PR.createSimpleLexer([["pln",/^[\t\n\r \xA0]+/,null,"\t\n\r \u00a0"],["com",/^#(?:if[\t\n\r \xA0]+(?:[a-z_$][\w\']*|``[^\r\n\t`]*(?:``|$))|else|endif|light)/i,null,"#"],["str",/^(?:\"(?:[^\"\\]|\\[\s\S])*(?:\"|$)|\'(?:[^\'\\]|\\[\s\S])(?:\'|$))/,null,"\"'"]],[["com",/^(?:\/\/[^\r\n]*|\(\*[\s\S]*?\*\))/],["kwd",/^(?:abstract|and|as|assert|begin|class|default|delegate|do|done|downcast|downto|elif|else|end|exception|extern|false|finally|for|fun|function|if|in|inherit|inline|interface|internal|lazy|let|match|member|module|mutable|namespace|new|null|of|open|or|override|private|public|rec|return|static|struct|then|to|true|try|type|upcast|use|val|void|when|while|with|yield|asr|land|lor|lsl|lsr|lxor|mod|sig|atomic|break|checked|component|const|constraint|constructor|continue|eager|event|external|fixed|functor|global|include|method|mixin|object|parallel|process|protected|pure|sealed|trait|virtual|volatile)\b/], 18 | ["lit",/^[+\-]?(?:0x[\da-f]+|(?:(?:\.\d+|\d+(?:\.\d*)?)(?:e[+\-]?\d+)?))/i],["pln",/^(?:[a-z_][\w']*[!?#]?|``[^\r\n\t`]*(?:``|$))/i],["pun",/^[^\t\n\r \xA0\"\'\w]+/]]),["fs","ml"]); 19 | -------------------------------------------------------------------------------- /docs/vendor/prettify/lang-go.js: -------------------------------------------------------------------------------- 1 | /* 2 | 3 | Copyright (C) 2010 Google Inc. 4 | 5 | Licensed under the Apache License, Version 2.0 (the "License"); 6 | you may not use this file except in compliance with the License. 7 | You may obtain a copy of the License at 8 | 9 | http://www.apache.org/licenses/LICENSE-2.0 10 | 11 | Unless required by applicable law or agreed to in writing, software 12 | distributed under the License is distributed on an "AS IS" BASIS, 13 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | See the License for the specific language governing permissions and 15 | limitations under the License. 16 | */ 17 | PR.registerLangHandler(PR.createSimpleLexer([["pln",/^[\t\n\r \xA0]+/,null,"\t\n\r \u00a0"],["pln",/^(?:\"(?:[^\"\\]|\\[\s\S])*(?:\"|$)|\'(?:[^\'\\]|\\[\s\S])+(?:\'|$)|`[^`]*(?:`|$))/,null,"\"'"]],[["com",/^(?:\/\/[^\r\n]*|\/\*[\s\S]*?\*\/)/],["pln",/^(?:[^\/\"\'`]|\/(?![\/\*]))+/i]]),["go"]); 18 | -------------------------------------------------------------------------------- /docs/vendor/prettify/lang-hs.js: -------------------------------------------------------------------------------- 1 | /* 2 | 3 | Copyright (C) 2009 Google Inc. 4 | 5 | Licensed under the Apache License, Version 2.0 (the "License"); 6 | you may not use this file except in compliance with the License. 7 | You may obtain a copy of the License at 8 | 9 | http://www.apache.org/licenses/LICENSE-2.0 10 | 11 | Unless required by applicable law or agreed to in writing, software 12 | distributed under the License is distributed on an "AS IS" BASIS, 13 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | See the License for the specific language governing permissions and 15 | limitations under the License. 16 | */ 17 | PR.registerLangHandler(PR.createSimpleLexer([["pln",/^[\t\n\x0B\x0C\r ]+/,null,"\t\n\x0B\f\r "],["str",/^\"(?:[^\"\\\n\x0C\r]|\\[\s\S])*(?:\"|$)/,null,'"'],["str",/^\'(?:[^\'\\\n\x0C\r]|\\[^&])\'?/,null,"'"],["lit",/^(?:0o[0-7]+|0x[\da-f]+|\d+(?:\.\d+)?(?:e[+\-]?\d+)?)/i,null,"0123456789"]],[["com",/^(?:(?:--+(?:[^\r\n\x0C]*)?)|(?:\{-(?:[^-]|-+[^-\}])*-\}))/],["kwd",/^(?:case|class|data|default|deriving|do|else|if|import|in|infix|infixl|infixr|instance|let|module|newtype|of|then|type|where|_)(?=[^a-zA-Z0-9\']|$)/, 18 | null],["pln",/^(?:[A-Z][\w\']*\.)*[a-zA-Z][\w\']*/],["pun",/^[^\t\n\x0B\x0C\r a-zA-Z0-9\'\"]+/]]),["hs"]); 19 | -------------------------------------------------------------------------------- /docs/vendor/prettify/lang-lasso.js: -------------------------------------------------------------------------------- 1 | /* 2 | 3 | Copyright (C) 2013 Eric Knibbe 4 | 5 | Licensed under the Apache License, Version 2.0 (the "License"); 6 | you may not use this file except in compliance with the License. 7 | You may obtain a copy of the License at 8 | 9 | http://www.apache.org/licenses/LICENSE-2.0 10 | 11 | Unless required by applicable law or agreed to in writing, software 12 | distributed under the License is distributed on an "AS IS" BASIS, 13 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | See the License for the specific language governing permissions and 15 | limitations under the License. 16 | */ 17 | PR.registerLangHandler(PR.createSimpleLexer([["pln",/^[\t\n\r \xA0]+/,null,"\t\n\r \u00a0"],["str",/^\'(?:[^\'\\]|\\[\s\S])*(?:\'|$)/,null,"'"],["str",/^\"(?:[^\"\\]|\\[\s\S])*(?:\"|$)/,null,'"'],["str",/^\`[^\`]*(?:\`|$)/,null,"`"],["lit",/^0x[\da-f]+|\d+/i,null,"0123456789"],["atn",/^#\d+|[#$][a-z_][\w.]*|#![ \S]+lasso9\b/i,null,"#$"]],[["tag",/^[[\]]|<\?(?:lasso(?:script)?|=)|\?>|noprocess\b|no_square_brackets\b/i],["com",/^\/\/[^\r\n]*|\/\*[\s\S]*?\*\//], 18 | ["atn",/^-(?!infinity)[a-z_][\w.]*|\.\s*'[a-z_][\w.]*'/i],["lit",/^\d*\.\d+(?:e[-+]?\d+)?|infinity\b|NaN\b/i],["atv",/^::\s*[a-z_][\w.]*/i],["lit",/^(?:true|false|none|minimal|full|all|void|and|or|not|bw|nbw|ew|new|cn|ncn|lt|lte|gt|gte|eq|neq|rx|nrx|ft)\b/i],["kwd",/^(?:error_code|error_msg|error_pop|error_push|error_reset|cache|database_names|database_schemanames|database_tablenames|define_tag|define_type|email_batch|encode_set|html_comment|handle|handle_error|header|if|inline|iterate|ljax_target|link|link_currentaction|link_currentgroup|link_currentrecord|link_detail|link_firstgroup|link_firstrecord|link_lastgroup|link_lastrecord|link_nextgroup|link_nextrecord|link_prevgroup|link_prevrecord|log|loop|namespace_using|output_none|portal|private|protect|records|referer|referrer|repeating|resultset|rows|search_args|search_arguments|select|sort_args|sort_arguments|thread_atomic|value_list|while|abort|case|else|if_empty|if_false|if_null|if_true|loop_abort|loop_continue|loop_count|params|params_up|return|return_value|run_children|soap_definetag|soap_lastrequest|soap_lastresponse|tag_name|ascending|average|by|define|descending|do|equals|frozen|group|handle_failure|import|in|into|join|let|match|max|min|on|order|parent|protected|provide|public|require|returnhome|skip|split_thread|sum|take|thread|to|trait|type|where|with|yield|yieldhome)\b/i], 19 | ["typ",/^(?:array|date|decimal|duration|integer|map|pair|string|tag|xml|null|boolean|bytes|keyword|list|locale|queue|set|stack|staticarray|local|var|variable|global|data|self|inherited|currentcapture|givenblock)\b|^\.\.?/i],["pln",/^[a-z_][\w.]*(?:=\s*(?=\())?/i],["pun",/^:=|[-+*\/%=<>&|!?\\]/]]),["lasso","ls","lassoscript"]); 20 | -------------------------------------------------------------------------------- /docs/vendor/prettify/lang-lassoscript.js: -------------------------------------------------------------------------------- 1 | /* 2 | 3 | Copyright (C) 2013 Eric Knibbe 4 | 5 | Licensed under the Apache License, Version 2.0 (the "License"); 6 | you may not use this file except in compliance with the License. 7 | You may obtain a copy of the License at 8 | 9 | http://www.apache.org/licenses/LICENSE-2.0 10 | 11 | Unless required by applicable law or agreed to in writing, software 12 | distributed under the License is distributed on an "AS IS" BASIS, 13 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | See the License for the specific language governing permissions and 15 | limitations under the License. 16 | */ 17 | PR.registerLangHandler(PR.createSimpleLexer([["pln",/^[\t\n\r \xA0]+/,null,"\t\n\r \u00a0"],["str",/^\'(?:[^\'\\]|\\[\s\S])*(?:\'|$)/,null,"'"],["str",/^\"(?:[^\"\\]|\\[\s\S])*(?:\"|$)/,null,'"'],["str",/^\`[^\`]*(?:\`|$)/,null,"`"],["lit",/^0x[\da-f]+|\d+/i,null,"0123456789"],["atn",/^#\d+|[#$][a-z_][\w.]*|#![ \S]+lasso9\b/i,null,"#$"]],[["tag",/^[[\]]|<\?(?:lasso(?:script)?|=)|\?>|noprocess\b|no_square_brackets\b/i],["com",/^\/\/[^\r\n]*|\/\*[\s\S]*?\*\//], 18 | ["atn",/^-(?!infinity)[a-z_][\w.]*|\.\s*'[a-z_][\w.]*'/i],["lit",/^\d*\.\d+(?:e[-+]?\d+)?|infinity\b|NaN\b/i],["atv",/^::\s*[a-z_][\w.]*/i],["lit",/^(?:true|false|none|minimal|full|all|void|and|or|not|bw|nbw|ew|new|cn|ncn|lt|lte|gt|gte|eq|neq|rx|nrx|ft)\b/i],["kwd",/^(?:error_code|error_msg|error_pop|error_push|error_reset|cache|database_names|database_schemanames|database_tablenames|define_tag|define_type|email_batch|encode_set|html_comment|handle|handle_error|header|if|inline|iterate|ljax_target|link|link_currentaction|link_currentgroup|link_currentrecord|link_detail|link_firstgroup|link_firstrecord|link_lastgroup|link_lastrecord|link_nextgroup|link_nextrecord|link_prevgroup|link_prevrecord|log|loop|namespace_using|output_none|portal|private|protect|records|referer|referrer|repeating|resultset|rows|search_args|search_arguments|select|sort_args|sort_arguments|thread_atomic|value_list|while|abort|case|else|if_empty|if_false|if_null|if_true|loop_abort|loop_continue|loop_count|params|params_up|return|return_value|run_children|soap_definetag|soap_lastrequest|soap_lastresponse|tag_name|ascending|average|by|define|descending|do|equals|frozen|group|handle_failure|import|in|into|join|let|match|max|min|on|order|parent|protected|provide|public|require|returnhome|skip|split_thread|sum|take|thread|to|trait|type|where|with|yield|yieldhome)\b/i], 19 | ["typ",/^(?:array|date|decimal|duration|integer|map|pair|string|tag|xml|null|boolean|bytes|keyword|list|locale|queue|set|stack|staticarray|local|var|variable|global|data|self|inherited|currentcapture|givenblock)\b|^\.\.?/i],["pln",/^[a-z_][\w.]*(?:=\s*(?=\())?/i],["pun",/^:=|[-+*\/%=<>&|!?\\]/]]),["lasso","ls","lassoscript"]); 20 | -------------------------------------------------------------------------------- /docs/vendor/prettify/lang-latex.js: -------------------------------------------------------------------------------- 1 | /* 2 | 3 | Copyright (C) 2011 Martin S. 4 | 5 | Licensed under the Apache License, Version 2.0 (the "License"); 6 | you may not use this file except in compliance with the License. 7 | You may obtain a copy of the License at 8 | 9 | http://www.apache.org/licenses/LICENSE-2.0 10 | 11 | Unless required by applicable law or agreed to in writing, software 12 | distributed under the License is distributed on an "AS IS" BASIS, 13 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | See the License for the specific language governing permissions and 15 | limitations under the License. 16 | */ 17 | PR.registerLangHandler(PR.createSimpleLexer([["pln",/^[\t\n\r \xA0]+/,null,"\t\n\r \u00a0"],["com",/^%[^\r\n]*/,null,"%"]],[["kwd",/^\\[a-zA-Z@]+/],["kwd",/^\\./],["typ",/^[$&]/],["lit",/[+-]?(?:\.\d+|\d+(?:\.\d*)?)(cm|em|ex|in|pc|pt|bp|mm)/i],["pun",/^[{}()\[\]=]+/]]),["latex","tex"]); 18 | -------------------------------------------------------------------------------- /docs/vendor/prettify/lang-lgt.js: -------------------------------------------------------------------------------- 1 | /* 2 | 3 | Copyright (C) 2014 Paulo Moura 4 | 5 | Licensed under the Apache License, Version 2.0 (the "License"); 6 | you may not use this file except in compliance with the License. 7 | You may obtain a copy of the License at 8 | 9 | http://www.apache.org/licenses/LICENSE-2.0 10 | 11 | Unless required by applicable law or agreed to in writing, software 12 | distributed under the License is distributed on an "AS IS" BASIS, 13 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | See the License for the specific language governing permissions and 15 | limitations under the License. 16 | */ 17 | PR.registerLangHandler(PR.createSimpleLexer([["str",/^\"(?:[^\"\\\n\x0C\r]|\\[\s\S])*(?:\"|$)/,null,'"'],["lit",/^[a-z][a-zA-Z0-9_]*/],["lit",/^\'(?:[^\'\\\n\x0C\r]|\\[^&])+\'?/,null,"'"],["lit",/^(?:0'.|0b[0-1]+|0o[0-7]+|0x[\da-f]+|\d+(?:\.\d+)?(?:e[+\-]?\d+)?)/i,null,"0123456789"]],[["com",/^%[^\r\n]*/,null,"%"],["com",/^\/\*[\s\S]*?\*\//],["kwd",/^\s*:-\s(c(a(lls|tegory)|oinductive)|p(ublic|r(ot(ocol|ected)|ivate))|e(l(if|se)|n(coding|sure_loaded)|xport)|i(f|n(clude|itialization|fo))|alias|d(ynamic|iscontiguous)|m(eta_(non_terminal|predicate)|od(e|ule)|ultifile)|reexport|s(et_(logtalk|prolog)_flag|ynchronized)|o(bject|p)|use(s|_module))/], 18 | ["kwd",/^\s*:-\s(e(lse|nd(if|_(category|object|protocol)))|built_in|dynamic|synchronized|threaded)/],["typ",/^[A-Z_][a-zA-Z0-9_]*/],["pun",/^[.,;{}:^<>=\\/+*?#!-]/]]),["logtalk","lgt"]); 19 | -------------------------------------------------------------------------------- /docs/vendor/prettify/lang-lisp.js: -------------------------------------------------------------------------------- 1 | /* 2 | 3 | Copyright (C) 2008 Google Inc. 4 | 5 | Licensed under the Apache License, Version 2.0 (the "License"); 6 | you may not use this file except in compliance with the License. 7 | You may obtain a copy of the License at 8 | 9 | http://www.apache.org/licenses/LICENSE-2.0 10 | 11 | Unless required by applicable law or agreed to in writing, software 12 | distributed under the License is distributed on an "AS IS" BASIS, 13 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | See the License for the specific language governing permissions and 15 | limitations under the License. 16 | */ 17 | PR.registerLangHandler(PR.createSimpleLexer([["opn",/^\(+/,null,"("],["clo",/^\)+/,null,")"],["com",/^;[^\r\n]*/,null,";"],["pln",/^[\t\n\r \xA0]+/,null,"\t\n\r \u00a0"],["str",/^\"(?:[^\"\\]|\\[\s\S])*(?:\"|$)/,null,'"']],[["kwd",/^(?:block|c[ad]+r|catch|con[ds]|def(?:ine|un)|do|eq|eql|equal|equalp|eval-when|flet|format|go|if|labels|lambda|let|load-time-value|locally|macrolet|multiple-value-call|nil|progn|progv|quote|require|return-from|setq|symbol-macrolet|t|tagbody|the|throw|unwind)\b/, 18 | null],["lit",/^[+\-]?(?:[0#]x[0-9a-f]+|\d+\/\d+|(?:\.\d+|\d+(?:\.\d*)?)(?:[ed][+\-]?\d+)?)/i],["lit",/^\'(?:-*(?:\w|\\[\x21-\x7e])(?:[\w-]*|\\[\x21-\x7e])[=!?]?)?/],["pln",/^-*(?:[a-z_]|\\[\x21-\x7e])(?:[\w-]*|\\[\x21-\x7e])[=!?]?/i],["pun",/^[^\w\t\n\r \xA0()\"\\\';]+/]]),"cl el lisp lsp scm ss rkt".split(" ")); 19 | -------------------------------------------------------------------------------- /docs/vendor/prettify/lang-ll.js: -------------------------------------------------------------------------------- 1 | /* 2 | 3 | Copyright (C) 2013 Nikhil Dabas 4 | 5 | Licensed under the Apache License, Version 2.0 (the "License"); 6 | you may not use this file except in compliance with the License. 7 | You may obtain a copy of the License at 8 | 9 | http://www.apache.org/licenses/LICENSE-2.0 10 | 11 | Unless required by applicable law or agreed to in writing, software 12 | distributed under the License is distributed on an "AS IS" BASIS, 13 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | See the License for the specific language governing permissions and 15 | limitations under the License. 16 | */ 17 | PR.registerLangHandler(PR.createSimpleLexer([["pln",/^[\t\n\r \xA0]+/,null,"\t\n\r \u00a0"],["str",/^!?\"(?:[^\"\\]|\\[\s\S])*(?:\"|$)/,null,'"'],["com",/^;[^\r\n]*/,null,";"]],[["pln",/^[%@!](?:[-a-zA-Z$._][-a-zA-Z$._0-9]*|\d+)/],["kwd",/^[A-Za-z_][0-9A-Za-z_]*/,null],["lit",/^\d+\.\d+/],["lit",/^(?:\d+|0[xX][a-fA-F0-9]+)/],["pun",/^[()\[\]{},=*<>:]|\.\.\.$/]]),["llvm","ll"]); 18 | -------------------------------------------------------------------------------- /docs/vendor/prettify/lang-llvm.js: -------------------------------------------------------------------------------- 1 | /* 2 | 3 | Copyright (C) 2013 Nikhil Dabas 4 | 5 | Licensed under the Apache License, Version 2.0 (the "License"); 6 | you may not use this file except in compliance with the License. 7 | You may obtain a copy of the License at 8 | 9 | http://www.apache.org/licenses/LICENSE-2.0 10 | 11 | Unless required by applicable law or agreed to in writing, software 12 | distributed under the License is distributed on an "AS IS" BASIS, 13 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | See the License for the specific language governing permissions and 15 | limitations under the License. 16 | */ 17 | PR.registerLangHandler(PR.createSimpleLexer([["pln",/^[\t\n\r \xA0]+/,null,"\t\n\r \u00a0"],["str",/^!?\"(?:[^\"\\]|\\[\s\S])*(?:\"|$)/,null,'"'],["com",/^;[^\r\n]*/,null,";"]],[["pln",/^[%@!](?:[-a-zA-Z$._][-a-zA-Z$._0-9]*|\d+)/],["kwd",/^[A-Za-z_][0-9A-Za-z_]*/,null],["lit",/^\d+\.\d+/],["lit",/^(?:\d+|0[xX][a-fA-F0-9]+)/],["pun",/^[()\[\]{},=*<>:]|\.\.\.$/]]),["llvm","ll"]); 18 | -------------------------------------------------------------------------------- /docs/vendor/prettify/lang-logtalk.js: -------------------------------------------------------------------------------- 1 | /* 2 | 3 | Copyright (C) 2014 Paulo Moura 4 | 5 | Licensed under the Apache License, Version 2.0 (the "License"); 6 | you may not use this file except in compliance with the License. 7 | You may obtain a copy of the License at 8 | 9 | http://www.apache.org/licenses/LICENSE-2.0 10 | 11 | Unless required by applicable law or agreed to in writing, software 12 | distributed under the License is distributed on an "AS IS" BASIS, 13 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | See the License for the specific language governing permissions and 15 | limitations under the License. 16 | */ 17 | PR.registerLangHandler(PR.createSimpleLexer([["str",/^\"(?:[^\"\\\n\x0C\r]|\\[\s\S])*(?:\"|$)/,null,'"'],["lit",/^[a-z][a-zA-Z0-9_]*/],["lit",/^\'(?:[^\'\\\n\x0C\r]|\\[^&])+\'?/,null,"'"],["lit",/^(?:0'.|0b[0-1]+|0o[0-7]+|0x[\da-f]+|\d+(?:\.\d+)?(?:e[+\-]?\d+)?)/i,null,"0123456789"]],[["com",/^%[^\r\n]*/,null,"%"],["com",/^\/\*[\s\S]*?\*\//],["kwd",/^\s*:-\s(c(a(lls|tegory)|oinductive)|p(ublic|r(ot(ocol|ected)|ivate))|e(l(if|se)|n(coding|sure_loaded)|xport)|i(f|n(clude|itialization|fo))|alias|d(ynamic|iscontiguous)|m(eta_(non_terminal|predicate)|od(e|ule)|ultifile)|reexport|s(et_(logtalk|prolog)_flag|ynchronized)|o(bject|p)|use(s|_module))/], 18 | ["kwd",/^\s*:-\s(e(lse|nd(if|_(category|object|protocol)))|built_in|dynamic|synchronized|threaded)/],["typ",/^[A-Z_][a-zA-Z0-9_]*/],["pun",/^[.,;{}:^<>=\\/+*?#!-]/]]),["logtalk","lgt"]); 19 | -------------------------------------------------------------------------------- /docs/vendor/prettify/lang-ls.js: -------------------------------------------------------------------------------- 1 | /* 2 | 3 | Copyright (C) 2013 Eric Knibbe 4 | 5 | Licensed under the Apache License, Version 2.0 (the "License"); 6 | you may not use this file except in compliance with the License. 7 | You may obtain a copy of the License at 8 | 9 | http://www.apache.org/licenses/LICENSE-2.0 10 | 11 | Unless required by applicable law or agreed to in writing, software 12 | distributed under the License is distributed on an "AS IS" BASIS, 13 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | See the License for the specific language governing permissions and 15 | limitations under the License. 16 | */ 17 | PR.registerLangHandler(PR.createSimpleLexer([["pln",/^[\t\n\r \xA0]+/,null,"\t\n\r \u00a0"],["str",/^\'(?:[^\'\\]|\\[\s\S])*(?:\'|$)/,null,"'"],["str",/^\"(?:[^\"\\]|\\[\s\S])*(?:\"|$)/,null,'"'],["str",/^\`[^\`]*(?:\`|$)/,null,"`"],["lit",/^0x[\da-f]+|\d+/i,null,"0123456789"],["atn",/^#\d+|[#$][a-z_][\w.]*|#![ \S]+lasso9\b/i,null,"#$"]],[["tag",/^[[\]]|<\?(?:lasso(?:script)?|=)|\?>|noprocess\b|no_square_brackets\b/i],["com",/^\/\/[^\r\n]*|\/\*[\s\S]*?\*\//], 18 | ["atn",/^-(?!infinity)[a-z_][\w.]*|\.\s*'[a-z_][\w.]*'/i],["lit",/^\d*\.\d+(?:e[-+]?\d+)?|infinity\b|NaN\b/i],["atv",/^::\s*[a-z_][\w.]*/i],["lit",/^(?:true|false|none|minimal|full|all|void|and|or|not|bw|nbw|ew|new|cn|ncn|lt|lte|gt|gte|eq|neq|rx|nrx|ft)\b/i],["kwd",/^(?:error_code|error_msg|error_pop|error_push|error_reset|cache|database_names|database_schemanames|database_tablenames|define_tag|define_type|email_batch|encode_set|html_comment|handle|handle_error|header|if|inline|iterate|ljax_target|link|link_currentaction|link_currentgroup|link_currentrecord|link_detail|link_firstgroup|link_firstrecord|link_lastgroup|link_lastrecord|link_nextgroup|link_nextrecord|link_prevgroup|link_prevrecord|log|loop|namespace_using|output_none|portal|private|protect|records|referer|referrer|repeating|resultset|rows|search_args|search_arguments|select|sort_args|sort_arguments|thread_atomic|value_list|while|abort|case|else|if_empty|if_false|if_null|if_true|loop_abort|loop_continue|loop_count|params|params_up|return|return_value|run_children|soap_definetag|soap_lastrequest|soap_lastresponse|tag_name|ascending|average|by|define|descending|do|equals|frozen|group|handle_failure|import|in|into|join|let|match|max|min|on|order|parent|protected|provide|public|require|returnhome|skip|split_thread|sum|take|thread|to|trait|type|where|with|yield|yieldhome)\b/i], 19 | ["typ",/^(?:array|date|decimal|duration|integer|map|pair|string|tag|xml|null|boolean|bytes|keyword|list|locale|queue|set|stack|staticarray|local|var|variable|global|data|self|inherited|currentcapture|givenblock)\b|^\.\.?/i],["pln",/^[a-z_][\w.]*(?:=\s*(?=\())?/i],["pun",/^:=|[-+*\/%=<>&|!?\\]/]]),["lasso","ls","lassoscript"]); 20 | -------------------------------------------------------------------------------- /docs/vendor/prettify/lang-lsp.js: -------------------------------------------------------------------------------- 1 | /* 2 | 3 | Copyright (C) 2008 Google Inc. 4 | 5 | Licensed under the Apache License, Version 2.0 (the "License"); 6 | you may not use this file except in compliance with the License. 7 | You may obtain a copy of the License at 8 | 9 | http://www.apache.org/licenses/LICENSE-2.0 10 | 11 | Unless required by applicable law or agreed to in writing, software 12 | distributed under the License is distributed on an "AS IS" BASIS, 13 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | See the License for the specific language governing permissions and 15 | limitations under the License. 16 | */ 17 | PR.registerLangHandler(PR.createSimpleLexer([["opn",/^\(+/,null,"("],["clo",/^\)+/,null,")"],["com",/^;[^\r\n]*/,null,";"],["pln",/^[\t\n\r \xA0]+/,null,"\t\n\r \u00a0"],["str",/^\"(?:[^\"\\]|\\[\s\S])*(?:\"|$)/,null,'"']],[["kwd",/^(?:block|c[ad]+r|catch|con[ds]|def(?:ine|un)|do|eq|eql|equal|equalp|eval-when|flet|format|go|if|labels|lambda|let|load-time-value|locally|macrolet|multiple-value-call|nil|progn|progv|quote|require|return-from|setq|symbol-macrolet|t|tagbody|the|throw|unwind)\b/, 18 | null],["lit",/^[+\-]?(?:[0#]x[0-9a-f]+|\d+\/\d+|(?:\.\d+|\d+(?:\.\d*)?)(?:[ed][+\-]?\d+)?)/i],["lit",/^\'(?:-*(?:\w|\\[\x21-\x7e])(?:[\w-]*|\\[\x21-\x7e])[=!?]?)?/],["pln",/^-*(?:[a-z_]|\\[\x21-\x7e])(?:[\w-]*|\\[\x21-\x7e])[=!?]?/i],["pun",/^[^\w\t\n\r \xA0()\"\\\';]+/]]),"cl el lisp lsp scm ss rkt".split(" ")); 19 | -------------------------------------------------------------------------------- /docs/vendor/prettify/lang-lua.js: -------------------------------------------------------------------------------- 1 | /* 2 | 3 | Copyright (C) 2008 Google Inc. 4 | 5 | Licensed under the Apache License, Version 2.0 (the "License"); 6 | you may not use this file except in compliance with the License. 7 | You may obtain a copy of the License at 8 | 9 | http://www.apache.org/licenses/LICENSE-2.0 10 | 11 | Unless required by applicable law or agreed to in writing, software 12 | distributed under the License is distributed on an "AS IS" BASIS, 13 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | See the License for the specific language governing permissions and 15 | limitations under the License. 16 | */ 17 | PR.registerLangHandler(PR.createSimpleLexer([["pln",/^[\t\n\r \xA0]+/,null,"\t\n\r \u00a0"],["str",/^(?:\"(?:[^\"\\]|\\[\s\S])*(?:\"|$)|\'(?:[^\'\\]|\\[\s\S])*(?:\'|$))/,null,"\"'"]],[["com",/^--(?:\[(=*)\[[\s\S]*?(?:\]\1\]|$)|[^\r\n]*)/],["str",/^\[(=*)\[[\s\S]*?(?:\]\1\]|$)/],["kwd",/^(?:and|break|do|else|elseif|end|false|for|function|if|in|local|nil|not|or|repeat|return|then|true|until|while)\b/,null],["lit",/^[+-]?(?:0x[\da-f]+|(?:(?:\.\d+|\d+(?:\.\d*)?)(?:e[+\-]?\d+)?))/i], 18 | ["pln",/^[a-z_]\w*/i],["pun",/^[^\w\t\n\r \xA0][^\w\t\n\r \xA0\"\'\-\+=]*/]]),["lua"]); 19 | -------------------------------------------------------------------------------- /docs/vendor/prettify/lang-ml.js: -------------------------------------------------------------------------------- 1 | /* 2 | 3 | Copyright (C) 2008 Google Inc. 4 | 5 | Licensed under the Apache License, Version 2.0 (the "License"); 6 | you may not use this file except in compliance with the License. 7 | You may obtain a copy of the License at 8 | 9 | http://www.apache.org/licenses/LICENSE-2.0 10 | 11 | Unless required by applicable law or agreed to in writing, software 12 | distributed under the License is distributed on an "AS IS" BASIS, 13 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | See the License for the specific language governing permissions and 15 | limitations under the License. 16 | */ 17 | PR.registerLangHandler(PR.createSimpleLexer([["pln",/^[\t\n\r \xA0]+/,null,"\t\n\r \u00a0"],["com",/^#(?:if[\t\n\r \xA0]+(?:[a-z_$][\w\']*|``[^\r\n\t`]*(?:``|$))|else|endif|light)/i,null,"#"],["str",/^(?:\"(?:[^\"\\]|\\[\s\S])*(?:\"|$)|\'(?:[^\'\\]|\\[\s\S])(?:\'|$))/,null,"\"'"]],[["com",/^(?:\/\/[^\r\n]*|\(\*[\s\S]*?\*\))/],["kwd",/^(?:abstract|and|as|assert|begin|class|default|delegate|do|done|downcast|downto|elif|else|end|exception|extern|false|finally|for|fun|function|if|in|inherit|inline|interface|internal|lazy|let|match|member|module|mutable|namespace|new|null|of|open|or|override|private|public|rec|return|static|struct|then|to|true|try|type|upcast|use|val|void|when|while|with|yield|asr|land|lor|lsl|lsr|lxor|mod|sig|atomic|break|checked|component|const|constraint|constructor|continue|eager|event|external|fixed|functor|global|include|method|mixin|object|parallel|process|protected|pure|sealed|trait|virtual|volatile)\b/], 18 | ["lit",/^[+\-]?(?:0x[\da-f]+|(?:(?:\.\d+|\d+(?:\.\d*)?)(?:e[+\-]?\d+)?))/i],["pln",/^(?:[a-z_][\w']*[!?#]?|``[^\r\n\t`]*(?:``|$))/i],["pun",/^[^\t\n\r \xA0\"\'\w]+/]]),["fs","ml"]); 19 | -------------------------------------------------------------------------------- /docs/vendor/prettify/lang-mumps.js: -------------------------------------------------------------------------------- 1 | /* 2 | 3 | Copyright (C) 2011 Kitware Inc. 4 | 5 | Licensed under the Apache License, Version 2.0 (the "License"); 6 | you may not use this file except in compliance with the License. 7 | You may obtain a copy of the License at 8 | 9 | http://www.apache.org/licenses/LICENSE-2.0 10 | 11 | Unless required by applicable law or agreed to in writing, software 12 | distributed under the License is distributed on an "AS IS" BASIS, 13 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | See the License for the specific language governing permissions and 15 | limitations under the License. 16 | */ 17 | PR.registerLangHandler(PR.createSimpleLexer([["pln",/^[\t\n\r \xA0]+/,null,"\t\n\r \u00a0"],["str",/^(?:"(?:[^"]|\\.)*")/,null,'"']],[["com",/^;[^\r\n]*/,null,";"],["dec",/^(?:\$(?:D|DEVICE|EC|ECODE|ES|ESTACK|ET|ETRAP|H|HOROLOG|I|IO|J|JOB|K|KEY|P|PRINCIPAL|Q|QUIT|ST|STACK|S|STORAGE|SY|SYSTEM|T|TEST|TL|TLEVEL|TR|TRESTART|X|Y|Z[A-Z]*|A|ASCII|C|CHAR|D|DATA|E|EXTRACT|F|FIND|FN|FNUMBER|G|GET|J|JUSTIFY|L|LENGTH|NA|NAME|O|ORDER|P|PIECE|QL|QLENGTH|QS|QSUBSCRIPT|Q|QUERY|R|RANDOM|RE|REVERSE|S|SELECT|ST|STACK|T|TEXT|TR|TRANSLATE|NaN))\b/i, 18 | null],["kwd",/^(?:[^\$]B|BREAK|C|CLOSE|D|DO|E|ELSE|F|FOR|G|GOTO|H|HALT|H|HANG|I|IF|J|JOB|K|KILL|L|LOCK|M|MERGE|N|NEW|O|OPEN|Q|QUIT|R|READ|S|SET|TC|TCOMMIT|TRE|TRESTART|TRO|TROLLBACK|TS|TSTART|U|USE|V|VIEW|W|WRITE|X|XECUTE)\b/i,null],["lit",/^[+-]?(?:(?:\.\d+|\d+(?:\.\d*)?)(?:E[+\-]?\d+)?)/i],["pln",/^[a-z][a-zA-Z0-9]*/i],["pun",/^[^\w\t\n\r\xA0\"\$;%\^]|_/]]),["mumps"]); 19 | -------------------------------------------------------------------------------- /docs/vendor/prettify/lang-n.js: -------------------------------------------------------------------------------- 1 | /* 2 | 3 | Copyright (C) 2011 Zimin A.V. 4 | 5 | Licensed under the Apache License, Version 2.0 (the "License"); 6 | you may not use this file except in compliance with the License. 7 | You may obtain a copy of the License at 8 | 9 | http://www.apache.org/licenses/LICENSE-2.0 10 | 11 | Unless required by applicable law or agreed to in writing, software 12 | distributed under the License is distributed on an "AS IS" BASIS, 13 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | See the License for the specific language governing permissions and 15 | limitations under the License. 16 | */ 17 | PR.registerLangHandler(PR.createSimpleLexer([["str",/^(?:\'(?:[^\\\'\r\n]|\\.)*\'|\"(?:[^\\\"\r\n]|\\.)*(?:\"|$))/,null,'"'],["com",/^#(?:(?:define|elif|else|endif|error|ifdef|include|ifndef|line|pragma|undef|warning)\b|[^\r\n]*)/,null,"#"],["pln",/^\s+/,null," \r\n\t\u00a0"]],[["str",/^@\"(?:[^\"]|\"\")*(?:\"|$)/,null],["str",/^<#(?:[^#>])*(?:#>|$)/,null],["str",/^<(?:(?:(?:\.\.\/)*|\/?)(?:[\w-]+(?:\/[\w-]+)+)?[\w-]+\.h|[a-z]\w*)>/,null],["com",/^\/\/[^\r\n]*/, 18 | null],["com",/^\/\*[\s\S]*?(?:\*\/|$)/,null],["kwd",/^(?:abstract|and|as|base|catch|class|def|delegate|enum|event|extern|false|finally|fun|implements|interface|internal|is|macro|match|matches|module|mutable|namespace|new|null|out|override|params|partial|private|protected|public|ref|sealed|static|struct|syntax|this|throw|true|try|type|typeof|using|variant|virtual|volatile|when|where|with|assert|assert2|async|break|checked|continue|do|else|ensures|for|foreach|if|late|lock|new|nolate|otherwise|regexp|repeat|requires|return|surroundwith|unchecked|unless|using|while|yield)\b/, 19 | null],["typ",/^(?:array|bool|byte|char|decimal|double|float|int|list|long|object|sbyte|short|string|ulong|uint|ufloat|ulong|ushort|void)\b/,null],["lit",/^@[a-z_$][a-z_$@0-9]*/i,null],["typ",/^@[A-Z]+[a-z][A-Za-z_$@0-9]*/,null],["pln",/^'?[A-Za-z_$][a-z_$@0-9]*/i,null],["lit",/^(?:0x[a-f0-9]+|(?:\d(?:_\d+)*\d*(?:\.\d*)?|\.\d\+)(?:e[+\-]?\d+)?)[a-z]*/i,null,"0123456789"],["pun",/^.[^\s\w\.$@\'\"\`\/\#]*/,null]]),["n","nemerle"]); 20 | -------------------------------------------------------------------------------- /docs/vendor/prettify/lang-nemerle.js: -------------------------------------------------------------------------------- 1 | /* 2 | 3 | Copyright (C) 2011 Zimin A.V. 4 | 5 | Licensed under the Apache License, Version 2.0 (the "License"); 6 | you may not use this file except in compliance with the License. 7 | You may obtain a copy of the License at 8 | 9 | http://www.apache.org/licenses/LICENSE-2.0 10 | 11 | Unless required by applicable law or agreed to in writing, software 12 | distributed under the License is distributed on an "AS IS" BASIS, 13 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | See the License for the specific language governing permissions and 15 | limitations under the License. 16 | */ 17 | PR.registerLangHandler(PR.createSimpleLexer([["str",/^(?:\'(?:[^\\\'\r\n]|\\.)*\'|\"(?:[^\\\"\r\n]|\\.)*(?:\"|$))/,null,'"'],["com",/^#(?:(?:define|elif|else|endif|error|ifdef|include|ifndef|line|pragma|undef|warning)\b|[^\r\n]*)/,null,"#"],["pln",/^\s+/,null," \r\n\t\u00a0"]],[["str",/^@\"(?:[^\"]|\"\")*(?:\"|$)/,null],["str",/^<#(?:[^#>])*(?:#>|$)/,null],["str",/^<(?:(?:(?:\.\.\/)*|\/?)(?:[\w-]+(?:\/[\w-]+)+)?[\w-]+\.h|[a-z]\w*)>/,null],["com",/^\/\/[^\r\n]*/, 18 | null],["com",/^\/\*[\s\S]*?(?:\*\/|$)/,null],["kwd",/^(?:abstract|and|as|base|catch|class|def|delegate|enum|event|extern|false|finally|fun|implements|interface|internal|is|macro|match|matches|module|mutable|namespace|new|null|out|override|params|partial|private|protected|public|ref|sealed|static|struct|syntax|this|throw|true|try|type|typeof|using|variant|virtual|volatile|when|where|with|assert|assert2|async|break|checked|continue|do|else|ensures|for|foreach|if|late|lock|new|nolate|otherwise|regexp|repeat|requires|return|surroundwith|unchecked|unless|using|while|yield)\b/, 19 | null],["typ",/^(?:array|bool|byte|char|decimal|double|float|int|list|long|object|sbyte|short|string|ulong|uint|ufloat|ulong|ushort|void)\b/,null],["lit",/^@[a-z_$][a-z_$@0-9]*/i,null],["typ",/^@[A-Z]+[a-z][A-Za-z_$@0-9]*/,null],["pln",/^'?[A-Za-z_$][a-z_$@0-9]*/i,null],["lit",/^(?:0x[a-f0-9]+|(?:\d(?:_\d+)*\d*(?:\.\d*)?|\.\d\+)(?:e[+\-]?\d+)?)[a-z]*/i,null,"0123456789"],["pun",/^.[^\s\w\.$@\'\"\`\/\#]*/,null]]),["n","nemerle"]); 20 | -------------------------------------------------------------------------------- /docs/vendor/prettify/lang-pascal.js: -------------------------------------------------------------------------------- 1 | /* 2 | 3 | Copyright (C) 2013 Peter Kofler 4 | 5 | Licensed under the Apache License, Version 2.0 (the "License"); 6 | you may not use this file except in compliance with the License. 7 | You may obtain a copy of the License at 8 | 9 | http://www.apache.org/licenses/LICENSE-2.0 10 | 11 | Unless required by applicable law or agreed to in writing, software 12 | distributed under the License is distributed on an "AS IS" BASIS, 13 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | See the License for the specific language governing permissions and 15 | limitations under the License. 16 | */ 17 | PR.registerLangHandler(PR.createSimpleLexer([["str",/^(?:\'(?:[^\\\'\r\n]|\\.)*(?:\'|$))/,null,"'"],["pln",/^\s+/,null," \r\n\t\u00a0"]],[["com",/^\(\*[\s\S]*?(?:\*\)|$)|^\{[\s\S]*?(?:\}|$)/,null],["kwd",/^(?:ABSOLUTE|AND|ARRAY|ASM|ASSEMBLER|BEGIN|CASE|CONST|CONSTRUCTOR|DESTRUCTOR|DIV|DO|DOWNTO|ELSE|END|EXTERNAL|FOR|FORWARD|FUNCTION|GOTO|IF|IMPLEMENTATION|IN|INLINE|INTERFACE|INTERRUPT|LABEL|MOD|NOT|OBJECT|OF|OR|PACKED|PROCEDURE|PROGRAM|RECORD|REPEAT|SET|SHL|SHR|THEN|TO|TYPE|UNIT|UNTIL|USES|VAR|VIRTUAL|WHILE|WITH|XOR)\b/i, 18 | null],["lit",/^(?:true|false|self|nil)/i,null],["pln",/^[a-z][a-z0-9]*/i,null],["lit",/^(?:\$[a-f0-9]+|(?:\d+(?:\.\d*)?|\.\d+)(?:e[+\-]?\d+)?)/i,null,"0123456789"],["pun",/^.[^\s\w\.$@\'\/]*/,null]]),["pascal"]); 19 | -------------------------------------------------------------------------------- /docs/vendor/prettify/lang-proto.js: -------------------------------------------------------------------------------- 1 | /* 2 | 3 | Copyright (C) 2006 Google Inc. 4 | 5 | Licensed under the Apache License, Version 2.0 (the "License"); 6 | you may not use this file except in compliance with the License. 7 | You may obtain a copy of the License at 8 | 9 | http://www.apache.org/licenses/LICENSE-2.0 10 | 11 | Unless required by applicable law or agreed to in writing, software 12 | distributed under the License is distributed on an "AS IS" BASIS, 13 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | See the License for the specific language governing permissions and 15 | limitations under the License. 16 | */ 17 | PR.registerLangHandler(PR.sourceDecorator({keywords:"bytes,default,double,enum,extend,extensions,false,group,import,max,message,option,optional,package,repeated,required,returns,rpc,service,syntax,to,true",types:/^(bool|(double|s?fixed|[su]?int)(32|64)|float|string)\b/,cStyleComments:!0}),["proto"]); 18 | -------------------------------------------------------------------------------- /docs/vendor/prettify/lang-r.js: -------------------------------------------------------------------------------- 1 | /* 2 | 3 | Copyright (C) 2012 Jeffrey B. Arnold 4 | 5 | Licensed under the Apache License, Version 2.0 (the "License"); 6 | you may not use this file except in compliance with the License. 7 | You may obtain a copy of the License at 8 | 9 | http://www.apache.org/licenses/LICENSE-2.0 10 | 11 | Unless required by applicable law or agreed to in writing, software 12 | distributed under the License is distributed on an "AS IS" BASIS, 13 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | See the License for the specific language governing permissions and 15 | limitations under the License. 16 | */ 17 | PR.registerLangHandler(PR.createSimpleLexer([["pln",/^[\t\n\r \xA0]+/,null,"\t\n\r \u00a0"],["str",/^\"(?:[^\"\\]|\\[\s\S])*(?:\"|$)/,null,'"'],["str",/^\'(?:[^\'\\]|\\[\s\S])*(?:\'|$)/,null,"'"]],[["com",/^#.*/],["kwd",/^(?:if|else|for|while|repeat|in|next|break|return|switch|function)(?![A-Za-z0-9_.])/],["lit",/^0[xX][a-fA-F0-9]+([pP][0-9]+)?[Li]?/],["lit",/^[+-]?([0-9]+(\.[0-9]+)?|\.[0-9]+)([eE][+-]?[0-9]+)?[Li]?/],["lit",/^(?:NULL|NA(?:_(?:integer|real|complex|character)_)?|Inf|TRUE|FALSE|NaN|\.\.(?:\.|[0-9]+))(?![A-Za-z0-9_.])/], 18 | ["pun",/^(?:<>?|-|==|<=|>=|<|>|&&?|!=|\|\|?|\*|\+|\^|\/|!|%.*?%|=|~|\$|@|:{1,3}|[\[\](){};,?])/],["pln",/^(?:[A-Za-z]+[A-Za-z0-9_.]*|\.[a-zA-Z_][0-9a-zA-Z\._]*)(?![A-Za-z0-9_.])/],["str",/^`.+`/]]),["r","s","R","S","Splus"]); 19 | -------------------------------------------------------------------------------- /docs/vendor/prettify/lang-rd.js: -------------------------------------------------------------------------------- 1 | /* 2 | 3 | Copyright (C) 2012 Jeffrey Arnold 4 | 5 | Licensed under the Apache License, Version 2.0 (the "License"); 6 | you may not use this file except in compliance with the License. 7 | You may obtain a copy of the License at 8 | 9 | http://www.apache.org/licenses/LICENSE-2.0 10 | 11 | Unless required by applicable law or agreed to in writing, software 12 | distributed under the License is distributed on an "AS IS" BASIS, 13 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | See the License for the specific language governing permissions and 15 | limitations under the License. 16 | */ 17 | PR.registerLangHandler(PR.createSimpleLexer([["pln",/^[\t\n\r \xA0]+/,null,"\t\n\r \u00a0"],["com",/^%[^\r\n]*/,null,"%"]],[["lit",/^\\(?:cr|l?dots|R|tab)\b/],["kwd",/^\\[a-zA-Z@]+/],["kwd",/^#(?:ifn?def|endif)/],["pln",/^\\[{}]/],["pun",/^[{}()\[\]]+/]]),["Rd","rd"]); 18 | -------------------------------------------------------------------------------- /docs/vendor/prettify/lang-rkt.js: -------------------------------------------------------------------------------- 1 | /* 2 | 3 | Copyright (C) 2008 Google Inc. 4 | 5 | Licensed under the Apache License, Version 2.0 (the "License"); 6 | you may not use this file except in compliance with the License. 7 | You may obtain a copy of the License at 8 | 9 | http://www.apache.org/licenses/LICENSE-2.0 10 | 11 | Unless required by applicable law or agreed to in writing, software 12 | distributed under the License is distributed on an "AS IS" BASIS, 13 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | See the License for the specific language governing permissions and 15 | limitations under the License. 16 | */ 17 | PR.registerLangHandler(PR.createSimpleLexer([["opn",/^\(+/,null,"("],["clo",/^\)+/,null,")"],["com",/^;[^\r\n]*/,null,";"],["pln",/^[\t\n\r \xA0]+/,null,"\t\n\r \u00a0"],["str",/^\"(?:[^\"\\]|\\[\s\S])*(?:\"|$)/,null,'"']],[["kwd",/^(?:block|c[ad]+r|catch|con[ds]|def(?:ine|un)|do|eq|eql|equal|equalp|eval-when|flet|format|go|if|labels|lambda|let|load-time-value|locally|macrolet|multiple-value-call|nil|progn|progv|quote|require|return-from|setq|symbol-macrolet|t|tagbody|the|throw|unwind)\b/, 18 | null],["lit",/^[+\-]?(?:[0#]x[0-9a-f]+|\d+\/\d+|(?:\.\d+|\d+(?:\.\d*)?)(?:[ed][+\-]?\d+)?)/i],["lit",/^\'(?:-*(?:\w|\\[\x21-\x7e])(?:[\w-]*|\\[\x21-\x7e])[=!?]?)?/],["pln",/^-*(?:[a-z_]|\\[\x21-\x7e])(?:[\w-]*|\\[\x21-\x7e])[=!?]?/i],["pun",/^[^\w\t\n\r \xA0()\"\\\';]+/]]),"cl el lisp lsp scm ss rkt".split(" ")); 19 | -------------------------------------------------------------------------------- /docs/vendor/prettify/lang-rust.js: -------------------------------------------------------------------------------- 1 | /* 2 | 3 | Copyright (C) 2015 Chris Morgan 4 | 5 | Licensed under the Apache License, Version 2.0 (the "License"); 6 | you may not use this file except in compliance with the License. 7 | You may obtain a copy of the License at 8 | 9 | http://www.apache.org/licenses/LICENSE-2.0 10 | 11 | Unless required by applicable law or agreed to in writing, software 12 | distributed under the License is distributed on an "AS IS" BASIS, 13 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | See the License for the specific language governing permissions and 15 | limitations under the License. 16 | */ 17 | PR.registerLangHandler(PR.createSimpleLexer([],[["pln",/^[\t\n\r \xA0]+/],["com",/^\/\/.*/],["com",/^\/\*[\s\S]*?(?:\*\/|$)/],["str",/^b"(?:[^\\]|\\(?:.|x[\da-fA-F]{2}))*?"/],["str",/^"(?:[^\\]|\\(?:.|x[\da-fA-F]{2}|u\{\[\da-fA-F]{1,6}\}))*?"/],["str",/^b?r(#*)\"[\s\S]*?\"\1/],["str",/^b'([^\\]|\\(.|x[\da-fA-F]{2}))'/],["str",/^'([^\\]|\\(.|x[\da-fA-F]{2}|u\{[\da-fA-F]{1,6}\}))'/],["tag",/^'\w+?\b/],["kwd",/^(?:match|if|else|as|break|box|continue|extern|fn|for|in|if|impl|let|loop|pub|return|super|unsafe|where|while|use|mod|trait|struct|enum|type|move|mut|ref|static|const|crate)\b/], 18 | ["kwd",/^(?:alignof|become|do|offsetof|priv|pure|sizeof|typeof|unsized|yield|abstract|virtual|final|override|macro)\b/],["typ",/^(?:[iu](8|16|32|64|size)|char|bool|f32|f64|str|Self)\b/],["typ",/^(?:Copy|Send|Sized|Sync|Drop|Fn|FnMut|FnOnce|Box|ToOwned|Clone|PartialEq|PartialOrd|Eq|Ord|AsRef|AsMut|Into|From|Default|Iterator|Extend|IntoIterator|DoubleEndedIterator|ExactSizeIterator|Option|Some|None|Result|Ok|Err|SliceConcatExt|String|ToString|Vec)\b/],["lit",/^(self|true|false|null)\b/], 19 | ["lit",/^\d[0-9_]*(?:[iu](?:size|8|16|32|64))?/],["lit",/^0x[a-fA-F0-9_]+(?:[iu](?:size|8|16|32|64))?/],["lit",/^0o[0-7_]+(?:[iu](?:size|8|16|32|64))?/],["lit",/^0b[01_]+(?:[iu](?:size|8|16|32|64))?/],["lit",/^\d[0-9_]*\.(?![^\s\d.])/],["lit",/^\d[0-9_]*(?:\.\d[0-9_]*)(?:[eE][+-]?[0-9_]+)?(?:f32|f64)?/],["lit",/^\d[0-9_]*(?:\.\d[0-9_]*)?(?:[eE][+-]?[0-9_]+)(?:f32|f64)?/],["lit",/^\d[0-9_]*(?:\.\d[0-9_]*)?(?:[eE][+-]?[0-9_]+)?(?:f32|f64)/], 20 | ["atn",/^[a-z_]\w*!/i],["pln",/^[a-z_]\w*/i],["atv",/^#!?\[[\s\S]*?\]/],["pun",/^[+\-/*=^&|!<>%[\](){}?:.,;]/],["pln",/./]]),["rust"]); 21 | -------------------------------------------------------------------------------- /docs/vendor/prettify/lang-s.js: -------------------------------------------------------------------------------- 1 | /* 2 | 3 | Copyright (C) 2012 Jeffrey B. Arnold 4 | 5 | Licensed under the Apache License, Version 2.0 (the "License"); 6 | you may not use this file except in compliance with the License. 7 | You may obtain a copy of the License at 8 | 9 | http://www.apache.org/licenses/LICENSE-2.0 10 | 11 | Unless required by applicable law or agreed to in writing, software 12 | distributed under the License is distributed on an "AS IS" BASIS, 13 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | See the License for the specific language governing permissions and 15 | limitations under the License. 16 | */ 17 | PR.registerLangHandler(PR.createSimpleLexer([["pln",/^[\t\n\r \xA0]+/,null,"\t\n\r \u00a0"],["str",/^\"(?:[^\"\\]|\\[\s\S])*(?:\"|$)/,null,'"'],["str",/^\'(?:[^\'\\]|\\[\s\S])*(?:\'|$)/,null,"'"]],[["com",/^#.*/],["kwd",/^(?:if|else|for|while|repeat|in|next|break|return|switch|function)(?![A-Za-z0-9_.])/],["lit",/^0[xX][a-fA-F0-9]+([pP][0-9]+)?[Li]?/],["lit",/^[+-]?([0-9]+(\.[0-9]+)?|\.[0-9]+)([eE][+-]?[0-9]+)?[Li]?/],["lit",/^(?:NULL|NA(?:_(?:integer|real|complex|character)_)?|Inf|TRUE|FALSE|NaN|\.\.(?:\.|[0-9]+))(?![A-Za-z0-9_.])/], 18 | ["pun",/^(?:<>?|-|==|<=|>=|<|>|&&?|!=|\|\|?|\*|\+|\^|\/|!|%.*?%|=|~|\$|@|:{1,3}|[\[\](){};,?])/],["pln",/^(?:[A-Za-z]+[A-Za-z0-9_.]*|\.[a-zA-Z_][0-9a-zA-Z\._]*)(?![A-Za-z0-9_.])/],["str",/^`.+`/]]),["r","s","R","S","Splus"]); 19 | -------------------------------------------------------------------------------- /docs/vendor/prettify/lang-scala.js: -------------------------------------------------------------------------------- 1 | /* 2 | 3 | Copyright (C) 2010 Google Inc. 4 | 5 | Licensed under the Apache License, Version 2.0 (the "License"); 6 | you may not use this file except in compliance with the License. 7 | You may obtain a copy of the License at 8 | 9 | http://www.apache.org/licenses/LICENSE-2.0 10 | 11 | Unless required by applicable law or agreed to in writing, software 12 | distributed under the License is distributed on an "AS IS" BASIS, 13 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | See the License for the specific language governing permissions and 15 | limitations under the License. 16 | */ 17 | PR.registerLangHandler(PR.createSimpleLexer([["pln",/^[\t\n\r \xA0]+/,null,"\t\n\r \u00a0"],["str",/^(?:"(?:(?:""(?:""?(?!")|[^\\"]|\\.)*"{0,3})|(?:[^"\r\n\\]|\\.)*"?))/,null,'"'],["lit",/^`(?:[^\r\n\\`]|\\.)*`?/,null,"`"],["pun",/^[!#%&()*+,\-:;<=>?@\[\\\]^{|}~]+/,null,"!#%&()*+,-:;<=>?@[\\]^{|}~"]],[["str",/^'(?:[^\r\n\\']|\\(?:'|[^\r\n']+))'/],["lit",/^'[a-zA-Z_$][\w$]*(?!['$\w])/],["kwd",/^(?:abstract|case|catch|class|def|do|else|extends|final|finally|for|forSome|if|implicit|import|lazy|match|new|object|override|package|private|protected|requires|return|sealed|super|throw|trait|try|type|val|var|while|with|yield)\b/], 18 | ["lit",/^(?:true|false|null|this)\b/],["lit",/^(?:(?:0(?:[0-7]+|X[0-9A-F]+))L?|(?:(?:0|[1-9][0-9]*)(?:(?:\.[0-9]+)?(?:E[+\-]?[0-9]+)?F?|L?))|\\.[0-9]+(?:E[+\-]?[0-9]+)?F?)/i],["typ",/^[$_]*[A-Z][_$A-Z0-9]*[a-z][\w$]*/],["pln",/^[$a-zA-Z_][\w$]*/],["com",/^\/(?:\/.*|\*(?:\/|\**[^*/])*(?:\*+\/?)?)/],["pun",/^(?:\.+|\/)/]]),["scala"]); 19 | -------------------------------------------------------------------------------- /docs/vendor/prettify/lang-scm.js: -------------------------------------------------------------------------------- 1 | /* 2 | 3 | Copyright (C) 2008 Google Inc. 4 | 5 | Licensed under the Apache License, Version 2.0 (the "License"); 6 | you may not use this file except in compliance with the License. 7 | You may obtain a copy of the License at 8 | 9 | http://www.apache.org/licenses/LICENSE-2.0 10 | 11 | Unless required by applicable law or agreed to in writing, software 12 | distributed under the License is distributed on an "AS IS" BASIS, 13 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | See the License for the specific language governing permissions and 15 | limitations under the License. 16 | */ 17 | PR.registerLangHandler(PR.createSimpleLexer([["opn",/^\(+/,null,"("],["clo",/^\)+/,null,")"],["com",/^;[^\r\n]*/,null,";"],["pln",/^[\t\n\r \xA0]+/,null,"\t\n\r \u00a0"],["str",/^\"(?:[^\"\\]|\\[\s\S])*(?:\"|$)/,null,'"']],[["kwd",/^(?:block|c[ad]+r|catch|con[ds]|def(?:ine|un)|do|eq|eql|equal|equalp|eval-when|flet|format|go|if|labels|lambda|let|load-time-value|locally|macrolet|multiple-value-call|nil|progn|progv|quote|require|return-from|setq|symbol-macrolet|t|tagbody|the|throw|unwind)\b/, 18 | null],["lit",/^[+\-]?(?:[0#]x[0-9a-f]+|\d+\/\d+|(?:\.\d+|\d+(?:\.\d*)?)(?:[ed][+\-]?\d+)?)/i],["lit",/^\'(?:-*(?:\w|\\[\x21-\x7e])(?:[\w-]*|\\[\x21-\x7e])[=!?]?)?/],["pln",/^-*(?:[a-z_]|\\[\x21-\x7e])(?:[\w-]*|\\[\x21-\x7e])[=!?]?/i],["pun",/^[^\w\t\n\r \xA0()\"\\\';]+/]]),"cl el lisp lsp scm ss rkt".split(" ")); 19 | -------------------------------------------------------------------------------- /docs/vendor/prettify/lang-sql.js: -------------------------------------------------------------------------------- 1 | /* 2 | 3 | Copyright (C) 2008 Google Inc. 4 | 5 | Licensed under the Apache License, Version 2.0 (the "License"); 6 | you may not use this file except in compliance with the License. 7 | You may obtain a copy of the License at 8 | 9 | http://www.apache.org/licenses/LICENSE-2.0 10 | 11 | Unless required by applicable law or agreed to in writing, software 12 | distributed under the License is distributed on an "AS IS" BASIS, 13 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | See the License for the specific language governing permissions and 15 | limitations under the License. 16 | */ 17 | PR.registerLangHandler(PR.createSimpleLexer([["pln",/^[\t\n\r \xA0]+/,null,"\t\n\r \u00a0"],["str",/^(?:"(?:[^\"\\]|\\.)*"|'(?:[^\'\\]|\\.)*')/,null,"\"'"]],[["com",/^(?:--[^\r\n]*|\/\*[\s\S]*?(?:\*\/|$))/],["kwd",/^(?:ADD|ALL|ALTER|AND|ANY|APPLY|AS|ASC|AUTHORIZATION|BACKUP|BEGIN|BETWEEN|BREAK|BROWSE|BULK|BY|CASCADE|CASE|CHECK|CHECKPOINT|CLOSE|CLUSTERED|COALESCE|COLLATE|COLUMN|COMMIT|COMPUTE|CONNECT|CONSTRAINT|CONTAINS|CONTAINSTABLE|CONTINUE|CONVERT|CREATE|CROSS|CURRENT|CURRENT_DATE|CURRENT_TIME|CURRENT_TIMESTAMP|CURRENT_USER|CURSOR|DATABASE|DBCC|DEALLOCATE|DECLARE|DEFAULT|DELETE|DENY|DESC|DISK|DISTINCT|DISTRIBUTED|DOUBLE|DROP|DUMMY|DUMP|ELSE|END|ERRLVL|ESCAPE|EXCEPT|EXEC|EXECUTE|EXISTS|EXIT|FETCH|FILE|FILLFACTOR|FOLLOWING|FOR|FOREIGN|FREETEXT|FREETEXTTABLE|FROM|FULL|FUNCTION|GOTO|GRANT|GROUP|HAVING|HOLDLOCK|IDENTITY|IDENTITYCOL|IDENTITY_INSERT|IF|IN|INDEX|INNER|INSERT|INTERSECT|INTO|IS|JOIN|KEY|KILL|LEFT|LIKE|LINENO|LOAD|MATCH|MATCHED|MERGE|NATURAL|NATIONAL|NOCHECK|NONCLUSTERED|NOCYCLE|NOT|NULL|NULLIF|OF|OFF|OFFSETS|ON|OPEN|OPENDATASOURCE|OPENQUERY|OPENROWSET|OPENXML|OPTION|OR|ORDER|OUTER|OVER|PARTITION|PERCENT|PIVOT|PLAN|PRECEDING|PRECISION|PRIMARY|PRINT|PROC|PROCEDURE|PUBLIC|RAISERROR|READ|READTEXT|RECONFIGURE|REFERENCES|REPLICATION|RESTORE|RESTRICT|RETURN|REVOKE|RIGHT|ROLLBACK|ROWCOUNT|ROWGUIDCOL|ROWS?|RULE|SAVE|SCHEMA|SELECT|SESSION_USER|SET|SETUSER|SHUTDOWN|SOME|START|STATISTICS|SYSTEM_USER|TABLE|TEXTSIZE|THEN|TO|TOP|TRAN|TRANSACTION|TRIGGER|TRUNCATE|TSEQUAL|UNBOUNDED|UNION|UNIQUE|UNPIVOT|UPDATE|UPDATETEXT|USE|USER|USING|VALUES|VARYING|VIEW|WAITFOR|WHEN|WHERE|WHILE|WITH|WITHIN|WRITETEXT|XML)(?=[^\w-]|$)/i, 18 | null],["lit",/^[+-]?(?:0x[\da-f]+|(?:(?:\.\d+|\d+(?:\.\d*)?)(?:e[+\-]?\d+)?))/i],["pln",/^[a-z_][\w-]*/i],["pun",/^[^\w\t\n\r \xA0\"\'][^\w\t\n\r \xA0+\-\"\']*/]]),["sql"]); 19 | -------------------------------------------------------------------------------- /docs/vendor/prettify/lang-ss.js: -------------------------------------------------------------------------------- 1 | /* 2 | 3 | Copyright (C) 2008 Google Inc. 4 | 5 | Licensed under the Apache License, Version 2.0 (the "License"); 6 | you may not use this file except in compliance with the License. 7 | You may obtain a copy of the License at 8 | 9 | http://www.apache.org/licenses/LICENSE-2.0 10 | 11 | Unless required by applicable law or agreed to in writing, software 12 | distributed under the License is distributed on an "AS IS" BASIS, 13 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | See the License for the specific language governing permissions and 15 | limitations under the License. 16 | */ 17 | PR.registerLangHandler(PR.createSimpleLexer([["opn",/^\(+/,null,"("],["clo",/^\)+/,null,")"],["com",/^;[^\r\n]*/,null,";"],["pln",/^[\t\n\r \xA0]+/,null,"\t\n\r \u00a0"],["str",/^\"(?:[^\"\\]|\\[\s\S])*(?:\"|$)/,null,'"']],[["kwd",/^(?:block|c[ad]+r|catch|con[ds]|def(?:ine|un)|do|eq|eql|equal|equalp|eval-when|flet|format|go|if|labels|lambda|let|load-time-value|locally|macrolet|multiple-value-call|nil|progn|progv|quote|require|return-from|setq|symbol-macrolet|t|tagbody|the|throw|unwind)\b/, 18 | null],["lit",/^[+\-]?(?:[0#]x[0-9a-f]+|\d+\/\d+|(?:\.\d+|\d+(?:\.\d*)?)(?:[ed][+\-]?\d+)?)/i],["lit",/^\'(?:-*(?:\w|\\[\x21-\x7e])(?:[\w-]*|\\[\x21-\x7e])[=!?]?)?/],["pln",/^-*(?:[a-z_]|\\[\x21-\x7e])(?:[\w-]*|\\[\x21-\x7e])[=!?]?/i],["pun",/^[^\w\t\n\r \xA0()\"\\\';]+/]]),"cl el lisp lsp scm ss rkt".split(" ")); 19 | -------------------------------------------------------------------------------- /docs/vendor/prettify/lang-swift.js: -------------------------------------------------------------------------------- 1 | /* 2 | 3 | Copyright (C) 2015 Google Inc. 4 | Licensed under the Apache License, Version 2.0 (the "License"); 5 | you may not use this file except in compliance with the License. 6 | You may obtain a copy of the License at 7 | 8 | http://www.apache.org/licenses/LICENSE-2.0 9 | Unless required by applicable law or agreed to in writing, software 10 | distributed under the License is distributed on an "AS IS" BASIS, 11 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | See the License for the specific language governing permissions and 13 | limitations under the License. 14 | */ 15 | PR.registerLangHandler(PR.createSimpleLexer([["pln",/^[ \n\r\t\v\f\0]+/,null," \n\r\t\v\f\x00"],["str",/^"(?:[^"\\]|(?:\\.)|(?:\\\((?:[^"\\)]|\\.)*\)))*"/,null,'"']],[["lit",/^(?:(?:0x[\da-fA-F][\da-fA-F_]*\.[\da-fA-F][\da-fA-F_]*[pP]?)|(?:\d[\d_]*\.\d[\d_]*[eE]?))[+-]?\d[\d_]*/,null],["lit",/^-?(?:(?:0(?:(?:b[01][01_]*)|(?:o[0-7][0-7_]*)|(?:x[\da-fA-F][\da-fA-F_]*)))|(?:\d[\d_]*))/,null],["lit",/^(?:true|false|nil)\b/,null],["kwd",/^\b(?:__COLUMN__|__FILE__|__FUNCTION__|__LINE__|#available|#else|#elseif|#endif|#if|#line|arch|arm|arm64|associativity|as|break|case|catch|class|continue|convenience|default|defer|deinit|didSet|do|dynamic|dynamicType|else|enum|fallthrough|final|for|func|get|import|indirect|infix|init|inout|internal|i386|if|in|iOS|iOSApplicationExtension|is|lazy|left|let|mutating|none|nonmutating|operator|optional|OSX|OSXApplicationExtension|override|postfix|precedence|prefix|private|protocol|Protocol|public|required|rethrows|return|right|safe|self|set|static|struct|subscript|super|switch|throw|try|Type|typealias|unowned|unsafe|var|weak|watchOS|while|willSet|x86_64)\b/, 16 | null],["com",/^\/\/.*?[\n\r]/,null],["com",/^\/\*[\s\S]*?(?:\*\/|$)/,null],["pun",/^<<=|<=|<<|>>=|>=|>>|===|==|\.\.\.|&&=|\.\.<|!==|!=|&=|~=|~|\(|\)|\[|\]|{|}|@|#|;|\.|,|:|\|\|=|\?\?|\|\||&&|&\*|&\+|&-|&=|\+=|-=|\/=|\*=|\^=|%=|\|=|->|`|==|\+\+|--|\/|\+|!|\*|%|<|>|&|\||\^|\?|=|-|_/,null],["typ",/^\b(?:[@_]?[A-Z]+[a-z][A-Za-z_$@0-9]*|\w+_t\b)/,null]]),["swift"]); 17 | -------------------------------------------------------------------------------- /docs/vendor/prettify/lang-tcl.js: -------------------------------------------------------------------------------- 1 | /* 2 | 3 | Copyright (C) 2012 Pyrios 4 | 5 | Licensed under the Apache License, Version 2.0 (the "License"); 6 | you may not use this file except in compliance with the License. 7 | You may obtain a copy of the License at 8 | 9 | http://www.apache.org/licenses/LICENSE-2.0 10 | 11 | Unless required by applicable law or agreed to in writing, software 12 | distributed under the License is distributed on an "AS IS" BASIS, 13 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | See the License for the specific language governing permissions and 15 | limitations under the License. 16 | */ 17 | PR.registerLangHandler(PR.createSimpleLexer([["opn",/^\{+/,null,"{"],["clo",/^\}+/,null,"}"],["com",/^#[^\r\n]*/,null,"#"],["pln",/^[\t\n\r \xA0]+/,null,"\t\n\r \u00a0"],["str",/^\"(?:[^\"\\]|\\[\s\S])*(?:\"|$)/,null,'"']],[["kwd",/^(?:after|append|apply|array|break|case|catch|continue|error|eval|exec|exit|expr|for|foreach|if|incr|info|proc|return|set|switch|trace|uplevel|upvar|while)\b/,null],["lit",/^[+\-]?(?:[0#]x[0-9a-f]+|\d+\/\d+|(?:\.\d+|\d+(?:\.\d*)?)(?:[ed][+\-]?\d+)?)/i], 18 | ["lit",/^\'(?:-*(?:\w|\\[\x21-\x7e])(?:[\w-]*|\\[\x21-\x7e])[=!?]?)?/],["pln",/^-*(?:[a-z_]|\\[\x21-\x7e])(?:[\w-]*|\\[\x21-\x7e])[=!?]?/i],["pun",/^[^\w\t\n\r \xA0()\"\\\';]+/]]),["tcl"]); 19 | -------------------------------------------------------------------------------- /docs/vendor/prettify/lang-tex.js: -------------------------------------------------------------------------------- 1 | /* 2 | 3 | Copyright (C) 2011 Martin S. 4 | 5 | Licensed under the Apache License, Version 2.0 (the "License"); 6 | you may not use this file except in compliance with the License. 7 | You may obtain a copy of the License at 8 | 9 | http://www.apache.org/licenses/LICENSE-2.0 10 | 11 | Unless required by applicable law or agreed to in writing, software 12 | distributed under the License is distributed on an "AS IS" BASIS, 13 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | See the License for the specific language governing permissions and 15 | limitations under the License. 16 | */ 17 | PR.registerLangHandler(PR.createSimpleLexer([["pln",/^[\t\n\r \xA0]+/,null,"\t\n\r \u00a0"],["com",/^%[^\r\n]*/,null,"%"]],[["kwd",/^\\[a-zA-Z@]+/],["kwd",/^\\./],["typ",/^[$&]/],["lit",/[+-]?(?:\.\d+|\d+(?:\.\d*)?)(cm|em|ex|in|pc|pt|bp|mm)/i],["pun",/^[{}()\[\]=]+/]]),["latex","tex"]); 18 | -------------------------------------------------------------------------------- /docs/vendor/prettify/lang-vb.js: -------------------------------------------------------------------------------- 1 | /* 2 | 3 | Copyright (C) 2009 Google Inc. 4 | 5 | Licensed under the Apache License, Version 2.0 (the "License"); 6 | you may not use this file except in compliance with the License. 7 | You may obtain a copy of the License at 8 | 9 | http://www.apache.org/licenses/LICENSE-2.0 10 | 11 | Unless required by applicable law or agreed to in writing, software 12 | distributed under the License is distributed on an "AS IS" BASIS, 13 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | See the License for the specific language governing permissions and 15 | limitations under the License. 16 | */ 17 | PR.registerLangHandler(PR.createSimpleLexer([["pln",/^[\t\n\r \xA0\u2028\u2029]+/,null,"\t\n\r \u00a0\u2028\u2029"],["str",/^(?:[\"\u201C\u201D](?:[^\"\u201C\u201D]|[\"\u201C\u201D]{2})(?:[\"\u201C\u201D]c|$)|[\"\u201C\u201D](?:[^\"\u201C\u201D]|[\"\u201C\u201D]{2})*(?:[\"\u201C\u201D]|$))/i,null,'"\u201c\u201d'],["com",/^[\'\u2018\u2019](?:_(?:\r\n?|[^\r]?)|[^\r\n_\u2028\u2029])*/,null,"'\u2018\u2019"]],[["kwd",/^(?:AddHandler|AddressOf|Alias|And|AndAlso|Ansi|As|Assembly|Auto|Boolean|ByRef|Byte|ByVal|Call|Case|Catch|CBool|CByte|CChar|CDate|CDbl|CDec|Char|CInt|Class|CLng|CObj|Const|CShort|CSng|CStr|CType|Date|Decimal|Declare|Default|Delegate|Dim|DirectCast|Do|Double|Each|Else|ElseIf|End|EndIf|Enum|Erase|Error|Event|Exit|Finally|For|Friend|Function|Get|GetType|GoSub|GoTo|Handles|If|Implements|Imports|In|Inherits|Integer|Interface|Is|Let|Lib|Like|Long|Loop|Me|Mod|Module|MustInherit|MustOverride|MyBase|MyClass|Namespace|New|Next|Not|NotInheritable|NotOverridable|Object|On|Option|Optional|Or|OrElse|Overloads|Overridable|Overrides|ParamArray|Preserve|Private|Property|Protected|Public|RaiseEvent|ReadOnly|ReDim|RemoveHandler|Resume|Return|Select|Set|Shadows|Shared|Short|Single|Static|Step|Stop|String|Structure|Sub|SyncLock|Then|Throw|To|Try|TypeOf|Unicode|Until|Variant|Wend|When|While|With|WithEvents|WriteOnly|Xor|EndIf|GoSub|Let|Variant|Wend)\b/i, 18 | null],["com",/^REM\b[^\r\n\u2028\u2029]*/i],["lit",/^(?:True\b|False\b|Nothing\b|\d+(?:E[+\-]?\d+[FRD]?|[FRDSIL])?|(?:&H[0-9A-F]+|&O[0-7]+)[SIL]?|\d*\.\d+(?:E[+\-]?\d+)?[FRD]?|#\s+(?:\d+[\-\/]\d+[\-\/]\d+(?:\s+\d+:\d+(?::\d+)?(\s*(?:AM|PM))?)?|\d+:\d+(?::\d+)?(\s*(?:AM|PM))?)\s+#)/i],["pln",/^(?:(?:[a-z]|_\w)\w*(?:\[[%&@!#]+\])?|\[(?:[a-z]|_\w)\w*\])/i],["pun",/^[^\w\t\n\r \"\'\[\]\xA0\u2018\u2019\u201C\u201D\u2028\u2029]+/],["pun",/^(?:\[|\])/]]),["vb", 19 | "vbs"]); 20 | -------------------------------------------------------------------------------- /docs/vendor/prettify/lang-vbs.js: -------------------------------------------------------------------------------- 1 | /* 2 | 3 | Copyright (C) 2009 Google Inc. 4 | 5 | Licensed under the Apache License, Version 2.0 (the "License"); 6 | you may not use this file except in compliance with the License. 7 | You may obtain a copy of the License at 8 | 9 | http://www.apache.org/licenses/LICENSE-2.0 10 | 11 | Unless required by applicable law or agreed to in writing, software 12 | distributed under the License is distributed on an "AS IS" BASIS, 13 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | See the License for the specific language governing permissions and 15 | limitations under the License. 16 | */ 17 | PR.registerLangHandler(PR.createSimpleLexer([["pln",/^[\t\n\r \xA0\u2028\u2029]+/,null,"\t\n\r \u00a0\u2028\u2029"],["str",/^(?:[\"\u201C\u201D](?:[^\"\u201C\u201D]|[\"\u201C\u201D]{2})(?:[\"\u201C\u201D]c|$)|[\"\u201C\u201D](?:[^\"\u201C\u201D]|[\"\u201C\u201D]{2})*(?:[\"\u201C\u201D]|$))/i,null,'"\u201c\u201d'],["com",/^[\'\u2018\u2019](?:_(?:\r\n?|[^\r]?)|[^\r\n_\u2028\u2029])*/,null,"'\u2018\u2019"]],[["kwd",/^(?:AddHandler|AddressOf|Alias|And|AndAlso|Ansi|As|Assembly|Auto|Boolean|ByRef|Byte|ByVal|Call|Case|Catch|CBool|CByte|CChar|CDate|CDbl|CDec|Char|CInt|Class|CLng|CObj|Const|CShort|CSng|CStr|CType|Date|Decimal|Declare|Default|Delegate|Dim|DirectCast|Do|Double|Each|Else|ElseIf|End|EndIf|Enum|Erase|Error|Event|Exit|Finally|For|Friend|Function|Get|GetType|GoSub|GoTo|Handles|If|Implements|Imports|In|Inherits|Integer|Interface|Is|Let|Lib|Like|Long|Loop|Me|Mod|Module|MustInherit|MustOverride|MyBase|MyClass|Namespace|New|Next|Not|NotInheritable|NotOverridable|Object|On|Option|Optional|Or|OrElse|Overloads|Overridable|Overrides|ParamArray|Preserve|Private|Property|Protected|Public|RaiseEvent|ReadOnly|ReDim|RemoveHandler|Resume|Return|Select|Set|Shadows|Shared|Short|Single|Static|Step|Stop|String|Structure|Sub|SyncLock|Then|Throw|To|Try|TypeOf|Unicode|Until|Variant|Wend|When|While|With|WithEvents|WriteOnly|Xor|EndIf|GoSub|Let|Variant|Wend)\b/i, 18 | null],["com",/^REM\b[^\r\n\u2028\u2029]*/i],["lit",/^(?:True\b|False\b|Nothing\b|\d+(?:E[+\-]?\d+[FRD]?|[FRDSIL])?|(?:&H[0-9A-F]+|&O[0-7]+)[SIL]?|\d*\.\d+(?:E[+\-]?\d+)?[FRD]?|#\s+(?:\d+[\-\/]\d+[\-\/]\d+(?:\s+\d+:\d+(?::\d+)?(\s*(?:AM|PM))?)?|\d+:\d+(?::\d+)?(\s*(?:AM|PM))?)\s+#)/i],["pln",/^(?:(?:[a-z]|_\w)\w*(?:\[[%&@!#]+\])?|\[(?:[a-z]|_\w)\w*\])/i],["pun",/^[^\w\t\n\r \"\'\[\]\xA0\u2018\u2019\u201C\u201D\u2028\u2029]+/],["pun",/^(?:\[|\])/]]),["vb", 19 | "vbs"]); 20 | -------------------------------------------------------------------------------- /docs/vendor/prettify/lang-vhd.js: -------------------------------------------------------------------------------- 1 | /* 2 | 3 | Copyright (C) 2010 benoit@ryder.fr 4 | 5 | Licensed under the Apache License, Version 2.0 (the "License"); 6 | you may not use this file except in compliance with the License. 7 | You may obtain a copy of the License at 8 | 9 | http://www.apache.org/licenses/LICENSE-2.0 10 | 11 | Unless required by applicable law or agreed to in writing, software 12 | distributed under the License is distributed on an "AS IS" BASIS, 13 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | See the License for the specific language governing permissions and 15 | limitations under the License. 16 | */ 17 | PR.registerLangHandler(PR.createSimpleLexer([["pln",/^[\t\n\r \xA0]+/,null,"\t\n\r \u00a0"]],[["str",/^(?:[BOX]?"(?:[^\"]|"")*"|'.')/i],["com",/^--[^\r\n]*/],["kwd",/^(?:abs|access|after|alias|all|and|architecture|array|assert|attribute|begin|block|body|buffer|bus|case|component|configuration|constant|disconnect|downto|else|elsif|end|entity|exit|file|for|function|generate|generic|group|guarded|if|impure|in|inertial|inout|is|label|library|linkage|literal|loop|map|mod|nand|new|next|nor|not|null|of|on|open|or|others|out|package|port|postponed|procedure|process|pure|range|record|register|reject|rem|report|return|rol|ror|select|severity|shared|signal|sla|sll|sra|srl|subtype|then|to|transport|type|unaffected|units|until|use|variable|wait|when|while|with|xnor|xor)(?=[^\w-]|$)/i, 18 | null],["typ",/^(?:bit|bit_vector|character|boolean|integer|real|time|string|severity_level|positive|natural|signed|unsigned|line|text|std_u?logic(?:_vector)?)(?=[^\w-]|$)/i,null],["typ",/^\'(?:ACTIVE|ASCENDING|BASE|DELAYED|DRIVING|DRIVING_VALUE|EVENT|HIGH|IMAGE|INSTANCE_NAME|LAST_ACTIVE|LAST_EVENT|LAST_VALUE|LEFT|LEFTOF|LENGTH|LOW|PATH_NAME|POS|PRED|QUIET|RANGE|REVERSE_RANGE|RIGHT|RIGHTOF|SIMPLE_NAME|STABLE|SUCC|TRANSACTION|VAL|VALUE)(?=[^\w-]|$)/i,null],["lit",/^\d+(?:_\d+)*(?:#[\w\\.]+#(?:[+\-]?\d+(?:_\d+)*)?|(?:\.\d+(?:_\d+)*)?(?:E[+\-]?\d+(?:_\d+)*)?)/i], 19 | ["pln",/^(?:[a-z]\w*|\\[^\\]*\\)/i],["pun",/^[^\w\t\n\r \xA0\"\'][^\w\t\n\r \xA0\-\"\']*/]]),["vhdl","vhd"]); 20 | -------------------------------------------------------------------------------- /docs/vendor/prettify/lang-vhdl.js: -------------------------------------------------------------------------------- 1 | /* 2 | 3 | Copyright (C) 2010 benoit@ryder.fr 4 | 5 | Licensed under the Apache License, Version 2.0 (the "License"); 6 | you may not use this file except in compliance with the License. 7 | You may obtain a copy of the License at 8 | 9 | http://www.apache.org/licenses/LICENSE-2.0 10 | 11 | Unless required by applicable law or agreed to in writing, software 12 | distributed under the License is distributed on an "AS IS" BASIS, 13 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | See the License for the specific language governing permissions and 15 | limitations under the License. 16 | */ 17 | PR.registerLangHandler(PR.createSimpleLexer([["pln",/^[\t\n\r \xA0]+/,null,"\t\n\r \u00a0"]],[["str",/^(?:[BOX]?"(?:[^\"]|"")*"|'.')/i],["com",/^--[^\r\n]*/],["kwd",/^(?:abs|access|after|alias|all|and|architecture|array|assert|attribute|begin|block|body|buffer|bus|case|component|configuration|constant|disconnect|downto|else|elsif|end|entity|exit|file|for|function|generate|generic|group|guarded|if|impure|in|inertial|inout|is|label|library|linkage|literal|loop|map|mod|nand|new|next|nor|not|null|of|on|open|or|others|out|package|port|postponed|procedure|process|pure|range|record|register|reject|rem|report|return|rol|ror|select|severity|shared|signal|sla|sll|sra|srl|subtype|then|to|transport|type|unaffected|units|until|use|variable|wait|when|while|with|xnor|xor)(?=[^\w-]|$)/i, 18 | null],["typ",/^(?:bit|bit_vector|character|boolean|integer|real|time|string|severity_level|positive|natural|signed|unsigned|line|text|std_u?logic(?:_vector)?)(?=[^\w-]|$)/i,null],["typ",/^\'(?:ACTIVE|ASCENDING|BASE|DELAYED|DRIVING|DRIVING_VALUE|EVENT|HIGH|IMAGE|INSTANCE_NAME|LAST_ACTIVE|LAST_EVENT|LAST_VALUE|LEFT|LEFTOF|LENGTH|LOW|PATH_NAME|POS|PRED|QUIET|RANGE|REVERSE_RANGE|RIGHT|RIGHTOF|SIMPLE_NAME|STABLE|SUCC|TRANSACTION|VAL|VALUE)(?=[^\w-]|$)/i,null],["lit",/^\d+(?:_\d+)*(?:#[\w\\.]+#(?:[+\-]?\d+(?:_\d+)*)?|(?:\.\d+(?:_\d+)*)?(?:E[+\-]?\d+(?:_\d+)*)?)/i], 19 | ["pln",/^(?:[a-z]\w*|\\[^\\]*\\)/i],["pun",/^[^\w\t\n\r \xA0\"\'][^\w\t\n\r \xA0\-\"\']*/]]),["vhdl","vhd"]); 20 | -------------------------------------------------------------------------------- /docs/vendor/prettify/lang-wiki.js: -------------------------------------------------------------------------------- 1 | /* 2 | 3 | Copyright (C) 2009 Google Inc. 4 | 5 | Licensed under the Apache License, Version 2.0 (the "License"); 6 | you may not use this file except in compliance with the License. 7 | You may obtain a copy of the License at 8 | 9 | http://www.apache.org/licenses/LICENSE-2.0 10 | 11 | Unless required by applicable law or agreed to in writing, software 12 | distributed under the License is distributed on an "AS IS" BASIS, 13 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | See the License for the specific language governing permissions and 15 | limitations under the License. 16 | */ 17 | PR.registerLangHandler(PR.createSimpleLexer([["pln",/^[\t \xA0a-gi-z0-9]+/,null,"\t \u00a0abcdefgijklmnopqrstuvwxyz0123456789"],["pun",/^[=*~\^\[\]]+/,null,"=*~^[]"]],[["lang-wiki.meta",/(?:^^|\r\n?|\n)(#[a-z]+)\b/],["lit",/^(?:[A-Z][a-z][a-z0-9]+[A-Z][a-z][a-zA-Z0-9]+)\b/],["lang-",/^\{\{\{([\s\S]+?)\}\}\}/],["lang-",/^`([^\r\n`]+)`/],["str",/^https?:\/\/[^\/?#\s]*(?:\/[^?#\s]*)?(?:\?[^#\s]*)?(?:#\S*)?/i],["pln",/^(?:\r\n|[\s\S])[^#=*~^A-Zh\{`\[\r\n]*/]]),["wiki"]); 18 | PR.registerLangHandler(PR.createSimpleLexer([["kwd",/^#[a-z]+/i,null,"#"]],[]),["wiki.meta"]); 19 | -------------------------------------------------------------------------------- /docs/vendor/prettify/lang-yaml.js: -------------------------------------------------------------------------------- 1 | /* 2 | 3 | Copyright (C) 2015 ribrdb @ code.google.com 4 | 5 | Licensed under the Apache License, Version 2.0 (the "License"); 6 | you may not use this file except in compliance with the License. 7 | You may obtain a copy of the License at 8 | 9 | http://www.apache.org/licenses/LICENSE-2.0 10 | 11 | Unless required by applicable law or agreed to in writing, software 12 | distributed under the License is distributed on an "AS IS" BASIS, 13 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | See the License for the specific language governing permissions and 15 | limitations under the License. 16 | */ 17 | PR.registerLangHandler(PR.createSimpleLexer([["pun",/^[:|>?]+/,null,":|>?"],["dec",/^%(?:YAML|TAG)[^#\r\n]+/,null,"%"],["typ",/^[&]\S+/,null,"&"],["typ",/^!\S*/,null,"!"],["str",/^"(?:[^\\"]|\\.)*(?:"|$)/,null,'"'],["str",/^'(?:[^']|'')*(?:'|$)/,null,"'"],["com",/^#[^\r\n]*/,null,"#"],["pln",/^\s+/,null," \t\r\n"]],[["dec",/^(?:---|\.\.\.)(?:[\r\n]|$)/],["pun",/^-/],["kwd",/^[\w-]+:[ \r\n]/],["pln", 18 | /^\w+/]]),["yaml","yml"]); 19 | -------------------------------------------------------------------------------- /docs/vendor/prettify/lang-yml.js: -------------------------------------------------------------------------------- 1 | /* 2 | 3 | Copyright (C) 2015 ribrdb @ code.google.com 4 | 5 | Licensed under the Apache License, Version 2.0 (the "License"); 6 | you may not use this file except in compliance with the License. 7 | You may obtain a copy of the License at 8 | 9 | http://www.apache.org/licenses/LICENSE-2.0 10 | 11 | Unless required by applicable law or agreed to in writing, software 12 | distributed under the License is distributed on an "AS IS" BASIS, 13 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | See the License for the specific language governing permissions and 15 | limitations under the License. 16 | */ 17 | PR.registerLangHandler(PR.createSimpleLexer([["pun",/^[:|>?]+/,null,":|>?"],["dec",/^%(?:YAML|TAG)[^#\r\n]+/,null,"%"],["typ",/^[&]\S+/,null,"&"],["typ",/^!\S*/,null,"!"],["str",/^"(?:[^\\"]|\\.)*(?:"|$)/,null,'"'],["str",/^'(?:[^']|'')*(?:'|$)/,null,"'"],["com",/^#[^\r\n]*/,null,"#"],["pln",/^\s+/,null," \t\r\n"]],[["dec",/^(?:---|\.\.\.)(?:[\r\n]|$)/],["pun",/^-/],["kwd",/^[\w-]+:[ \r\n]/],["pln", 18 | /^\w+/]]),["yaml","yml"]); 19 | -------------------------------------------------------------------------------- /docs/vendor/prettify/prettify.css: -------------------------------------------------------------------------------- 1 | .pln{color:#000}@media screen{.str{color:#080}.kwd{color:#008}.com{color:#800}.typ{color:#606}.lit{color:#066}.pun,.opn,.clo{color:#660}.tag{color:#008}.atn{color:#606}.atv{color:#080}.dec,.var{color:#606}.fun{color:red}}@media print,projection{.str{color:#060}.kwd{color:#006;font-weight:bold}.com{color:#600;font-style:italic}.typ{color:#404;font-weight:bold}.lit{color:#044}.pun,.opn,.clo{color:#440}.tag{color:#006;font-weight:bold}.atn{color:#404}.atv{color:#060}}pre.prettyprint{padding:2px;border:1px solid #888}ol.linenums{margin-top:0;margin-bottom:0}li.L0,li.L1,li.L2,li.L3,li.L5,li.L6,li.L7,li.L8{list-style-type:none}li.L1,li.L3,li.L5,li.L7,li.L9{background:#eee} -------------------------------------------------------------------------------- /docs/vendor/webfontloader.js: -------------------------------------------------------------------------------- 1 | /* Web Font Loader v1.6.24 - (c) Adobe Systems, Google. License: Apache 2.0 */ 2 | (function(){function aa(a,b,d){return a.call.apply(a.bind,arguments)}function ba(a,b,d){if(!a)throw Error();if(2=b.f?e():a.fonts.load(fa(b.a),b.h).then(function(a){1<=a.length?c():setTimeout(k,25)},function(){e()})}k()}),e=new Promise(function(a,c){setTimeout(c,b.f)});Promise.race([e,c]).then(function(){b.g(b.a)},function(){b.j(b.a)})};function R(a,b,d,c,e,f,g){this.v=a;this.B=b;this.c=d;this.a=c;this.s=g||"BESbswy";this.f={};this.w=e||3E3;this.u=f||null;this.o=this.j=this.h=this.g=null;this.g=new N(this.c,this.s);this.h=new N(this.c,this.s);this.j=new N(this.c,this.s);this.o=new N(this.c,this.s);a=new H(this.a.c+",serif",K(this.a));a=P(a);this.g.a.style.cssText=a;a=new H(this.a.c+",sans-serif",K(this.a));a=P(a);this.h.a.style.cssText=a;a=new H("serif",K(this.a));a=P(a);this.j.a.style.cssText=a;a=new H("sans-serif",K(this.a));a= 8 | P(a);this.o.a.style.cssText=a;O(this.g);O(this.h);O(this.j);O(this.o)}var S={D:"serif",C:"sans-serif"},T=null;function U(){if(null===T){var a=/AppleWebKit\/([0-9]+)(?:\.([0-9]+))/.exec(window.navigator.userAgent);T=!!a&&(536>parseInt(a[1],10)||536===parseInt(a[1],10)&&11>=parseInt(a[2],10))}return T}R.prototype.start=function(){this.f.serif=this.j.a.offsetWidth;this.f["sans-serif"]=this.o.a.offsetWidth;this.A=q();la(this)}; 9 | function ma(a,b,d){for(var c in S)if(S.hasOwnProperty(c)&&b===a.f[S[c]]&&d===a.f[S[c]])return!0;return!1}function la(a){var b=a.g.a.offsetWidth,d=a.h.a.offsetWidth,c;(c=b===a.f.serif&&d===a.f["sans-serif"])||(c=U()&&ma(a,b,d));c?q()-a.A>=a.w?U()&&ma(a,b,d)&&(null===a.u||a.u.hasOwnProperty(a.a.c))?V(a,a.v):V(a,a.B):na(a):V(a,a.v)}function na(a){setTimeout(p(function(){la(this)},a),50)}function V(a,b){setTimeout(p(function(){v(this.g.a);v(this.h.a);v(this.j.a);v(this.o.a);b(this.a)},a),0)};function W(a,b,d){this.c=a;this.a=b;this.f=0;this.o=this.j=!1;this.s=d}var X=null;W.prototype.g=function(a){var b=this.a;b.g&&w(b.f,[b.a.c("wf",a.c,K(a).toString(),"active")],[b.a.c("wf",a.c,K(a).toString(),"loading"),b.a.c("wf",a.c,K(a).toString(),"inactive")]);L(b,"fontactive",a);this.o=!0;oa(this)}; 10 | W.prototype.h=function(a){var b=this.a;if(b.g){var d=y(b.f,b.a.c("wf",a.c,K(a).toString(),"active")),c=[],e=[b.a.c("wf",a.c,K(a).toString(),"loading")];d||c.push(b.a.c("wf",a.c,K(a).toString(),"inactive"));w(b.f,c,e)}L(b,"fontinactive",a);oa(this)};function oa(a){0==--a.f&&a.j&&(a.o?(a=a.a,a.g&&w(a.f,[a.a.c("wf","active")],[a.a.c("wf","loading"),a.a.c("wf","inactive")]),L(a,"active")):M(a.a))};function pa(a){this.j=a;this.a=new ja;this.h=0;this.f=this.g=!0}pa.prototype.load=function(a){this.c=new ca(this.j,a.context||this.j);this.g=!1!==a.events;this.f=!1!==a.classes;qa(this,new ha(this.c,a),a)}; 11 | function ra(a,b,d,c,e){var f=0==--a.h;(a.f||a.g)&&setTimeout(function(){var a=e||null,k=c||null||{};if(0===d.length&&f)M(b.a);else{b.f+=d.length;f&&(b.j=f);var h,m=[];for(h=0;h { 2 | return knex.schema.createTable('users', (table) => { 3 | table.uuid('id').notNullable().primary() 4 | table.string('email').unique().notNullable() 5 | table.string('name').notNullable().notNullable() 6 | table.string('avatar') 7 | table.string('password') 8 | table.string('facebook_token') 9 | table.string('facebook_id') 10 | table.string('role').defaultTo('user').notNullable() 11 | table.timestamps() 12 | }) 13 | } 14 | 15 | exports.down = (knex) => knex.schema.dropTableIfExists('users') 16 | -------------------------------------------------------------------------------- /package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "node-starter", 3 | "version": "1.0.0", 4 | "description": "Node.js API server starter using Koa2 and Bookshelf", 5 | "main": "index.js", 6 | "author": "Lorenzo Piccoli Módolo ", 7 | "license": "MIT", 8 | "scripts": { 9 | "start": "./node_modules/.bin/knex migrate:latest && NODE_ENV=production node index.js", 10 | "dev": "NODE_ENV=development ./node_modules/.bin/nodemon index.js", 11 | "test": "NODE_ENV=test ./node_modules/istanbul/lib/cli.js cover -x \"**/config/**\" ./node_modules/.bin/_mocha ./test/index.js --report lcovonly -- --compilers js:babel-register --require babel-polyfill && ./node_modules/.bin/codecov", 12 | "lint": "eslint src test", 13 | "docs": "./node_modules/.bin/apidoc -i src/ -o docs", 14 | "db:migrate": "./node_modules/.bin/knex migrate:latest" 15 | }, 16 | "repository": { 17 | "type": "git", 18 | "url": "https://github.com/lorenzopicoli/node-api-starter" 19 | }, 20 | "dependencies": { 21 | "aws-sdk": "^2.3.17", 22 | "babel-core": "^6.22.1", 23 | "babel-plugin-module-resolver": "^2.5.0", 24 | "babel-polyfill": "^6.9.1", 25 | "babel-preset-es2015-node5": "^1.2.0", 26 | "babel-preset-stage-0": "^6.22.0", 27 | "bcrypt": "^1.0.2", 28 | "bluebird": "^3.4.0", 29 | "bookshelf": "^0.10.3", 30 | "dotenv": "^4.0.0", 31 | "fbgraph": "^1.3.0", 32 | "glob": "^7.0.3", 33 | "jsonwebtoken": "^7.0.0", 34 | "knex": "^0.12.8", 35 | "knex-postgis": "^0.2.0", 36 | "koa": "^2.0.0-alpha.7", 37 | "koa-bodyparser": "^4.1.0", 38 | "koa-convert": "^1.2.0", 39 | "koa-cors": "0.0.16", 40 | "koa-generic-session": "^1.10.2", 41 | "koa-logger": "^2.0.0", 42 | "koa-mount": "^2.0.0", 43 | "koa-passport": "^3.0.0", 44 | "koa-router": "^7.0.1", 45 | "npm": "^4.0.2", 46 | "passport-facebook-token": "^3.3.0", 47 | "passport-local": "^1.0.0", 48 | "pg": "^6.1.4", 49 | "request": "^2.79.0", 50 | "request-promise": "^4.1.1", 51 | "uuid": "^3.0.1" 52 | }, 53 | "devDependencies": { 54 | "apidoc": "^0.17.5", 55 | "babel-cli": "^6.22.2", 56 | "babel-eslint": "^7.1.1", 57 | "babel-preset-env": "^1.1.8", 58 | "babel-register": "^6.22.0", 59 | "chai": "^3.5.0", 60 | "codecov": "^1.0.1", 61 | "del": "^2.2.0", 62 | "eslint": "^3.15.0", 63 | "eslint-config-standard": "^7.1.0", 64 | "eslint-plugin-babel": "^4.0.1", 65 | "eslint-plugin-promise": "^3.4.1", 66 | "eslint-plugin-standard": "^2.0.0", 67 | "faker": "^4.1.0", 68 | "isparta": "^4.0.0", 69 | "istanbul": "^1.0.0-alpha", 70 | "knex-seed-file": "^0.3.1", 71 | "mocha": "^3.2.0", 72 | "mocha-circleci-reporter": "0.0.2", 73 | "nodemon": "^1.9.2", 74 | "supertest": "^3.0.0" 75 | } 76 | } 77 | -------------------------------------------------------------------------------- /seeds/common/index.js: -------------------------------------------------------------------------------- 1 | const uuidV4 = require('uuid/v4') 2 | 3 | exports.seed = (knex, Promise) => { 4 | const bcrypt = Promise.promisifyAll(require('bcrypt')) 5 | 6 | return bcrypt.genSaltAsync(10) 7 | .then(salt => bcrypt.hashAsync(process.env.ADMIN_PASS, salt)) 8 | .then(hash => knex('users').insert( 9 | { 10 | id: uuidV4(), 11 | name: 'Lorenzo Piccoli', 12 | email: 'lorenzopicoli@me.com', 13 | password: hash, 14 | role: 'admin' 15 | } 16 | ) 17 | ) 18 | } 19 | -------------------------------------------------------------------------------- /seeds/development/admin.js: -------------------------------------------------------------------------------- 1 | module.exports = require('../common/index') 2 | -------------------------------------------------------------------------------- /seeds/development/users.js: -------------------------------------------------------------------------------- 1 | const uuidV4 = require('uuid/v4') 2 | 3 | exports.seed = (knex, Promise) => { 4 | const bcrypt = Promise.promisifyAll(require('bcrypt')) 5 | 6 | return bcrypt.genSaltAsync(10) 7 | .then(salt => bcrypt.hashAsync('123', salt)) 8 | .then(hash => knex('users').insert( 9 | [ 10 | { 11 | id: uuidV4(), 12 | name: 'Lucas', 13 | email: 'lucas@me.com', 14 | password: hash, 15 | role: 'user' 16 | }, { 17 | id: uuidV4(), 18 | name: 'Marcelo', 19 | email: 'marcelo@me.com', 20 | password: hash, 21 | role: 'user' 22 | }, { 23 | id: uuidV4(), 24 | name: 'Andreia', 25 | email: 'andreia@me.com', 26 | role: 'user', 27 | password: hash 28 | } 29 | ] 30 | ) 31 | ) 32 | } 33 | -------------------------------------------------------------------------------- /seeds/production/admin.js: -------------------------------------------------------------------------------- 1 | module.exports = require('../common/index') 2 | -------------------------------------------------------------------------------- /src/middleware/error.js: -------------------------------------------------------------------------------- 1 | export default function errorMiddleware() { 2 | return async (ctx, next) => { 3 | try { 4 | await next() 5 | } catch (err) { 6 | ctx.status = err.status || 500 7 | ctx.body = { error: err.message } 8 | ctx.app.emit('error', err, ctx) 9 | } 10 | } 11 | } 12 | -------------------------------------------------------------------------------- /src/middleware/validators.js: -------------------------------------------------------------------------------- 1 | import { verify } from 'jsonwebtoken' 2 | import config from 'config' 3 | 4 | // Sets body = { me } where me is the jwt payload 5 | export async function isAuthenticated(ctx, next) { 6 | const authorization = ctx.headers.authorization 7 | 8 | if (!authorization) { 9 | ctx.throw(401) 10 | } 11 | 12 | try { 13 | const me = verify(authorization, config.jwt.token) 14 | ctx.body = { me } 15 | } catch (err) { 16 | ctx.throw(401) 17 | } 18 | 19 | if (!next) return 20 | return next() 21 | } 22 | 23 | // Gets the user ID from the jwt token 24 | export async function setUserIdFromToken(ctx, next) { 25 | const { me } = ctx.body 26 | ctx.params.id = me.id 27 | 28 | if (next) await next() 29 | } 30 | 31 | // Throws an error if the the user is not an admin 32 | export function restrictToAdmin(ctx, next) { 33 | const { 34 | role 35 | } = ctx.body.me 36 | 37 | if (role === 'admin') { 38 | if (!next) return 39 | return next() 40 | } 41 | 42 | ctx.throw(403) 43 | } 44 | // Create here other authorization middlewares, ex: 45 | // export function isNoteOwner(ctx, next) { 46 | -------------------------------------------------------------------------------- /src/models/helpers/index.js: -------------------------------------------------------------------------------- 1 | import S3 from 'lib/aws' 2 | import config from 'config' 3 | const { aws: { Bucket } } = config 4 | 5 | export function sign(Key) { 6 | return new Promise((resolve, reject) => { 7 | S3.getSignedUrl('putObject', { 8 | Key, 9 | Bucket, 10 | ACL: 'public-read', 11 | Expires: 60 * 60 * 60 12 | }, (err, url) => { 13 | if (err) reject(err) 14 | resolve(url) 15 | }) 16 | }) 17 | } 18 | -------------------------------------------------------------------------------- /src/models/users.js: -------------------------------------------------------------------------------- 1 | import Bookshelf from 'db/bookshelf' 2 | import uuidV4 from 'uuid/v4' 3 | import Promise from 'bluebird' 4 | import jwt from 'jsonwebtoken' 5 | import { sign } from './helpers/' 6 | import S3 from 'lib/aws' 7 | import config from 'config' 8 | import rp from 'request-promise' 9 | 10 | const bcrypt = Promise.promisifyAll(require('bcrypt')) 11 | const { aws: { Bucket } } = config 12 | 13 | export const User = Bookshelf.Model.extend({ 14 | tableName: 'users', 15 | hasTimestamps: true, 16 | hidden: ['password', 'facebook_token'], 17 | idAttribute: 'id', 18 | 19 | initialize() { 20 | this.on('saving', this.hashPassword, this) 21 | this.on('creating', this.generateUUID, this) 22 | this.on('creating', this.setAvi, this) 23 | this.on('destroying', this.cleanAvi, this) 24 | }, 25 | 26 | generateToken() { 27 | return jwt.sign({ 28 | id: this.get('id'), 29 | role: this.get('role') 30 | }, config.jwt.token, { expiresIn: '2 days' }) 31 | }, 32 | 33 | validatePassword(password) { 34 | const user = this 35 | 36 | return bcrypt.compareAsync(password, user.get('password')) 37 | .then(match => { 38 | if (!match) { 39 | return null 40 | } 41 | 42 | return user 43 | }) 44 | }, 45 | 46 | async hashPassword() { 47 | const user = this 48 | 49 | if (user.isNew() || user.hasChanged('password')) { 50 | const salt = await bcrypt.genSaltAsync(10) 51 | const hash = await bcrypt.hashAsync(user.get('password'), salt) 52 | 53 | user.set('password', hash) 54 | } 55 | }, 56 | 57 | async saveFBAvatar(fbUrl) { 58 | // Download from facebook 59 | const data = await rp({url: fbUrl, encoding: null}) 60 | // Upload to S3 61 | await rp.put({ 62 | url: await this.generateSignedURL(), 63 | body: data 64 | }) 65 | }, 66 | 67 | generateUUID() { 68 | this.set('id', uuidV4()) 69 | }, 70 | 71 | generateSignedURL() { 72 | const id = this.get('id') 73 | return sign(`${id}/avatar.jpg`) 74 | }, 75 | 76 | setAvi() { 77 | const id = this.get('id') 78 | return this.set('avatar', `https://${Bucket}.s3.amazonaws.com/${id}/avatar.jpg`) 79 | }, 80 | 81 | cleanAvi() { 82 | const user = this 83 | const re = /[^\/]*$/ // eslint-disable-line 84 | const avatarString = user.get('avatar') 85 | const [Key] = re.exec(avatarString) 86 | const options = { Bucket, Key } 87 | return S3.deleteObjectAsync(options) 88 | } 89 | }) 90 | -------------------------------------------------------------------------------- /src/modules/auth/controller.js: -------------------------------------------------------------------------------- 1 | import passport from 'koa-passport' 2 | import { User } from 'models/users' 3 | import { fbAuthenticate, fbSignup } from './helpers' 4 | 5 | /** 6 | * @api {post} /auth/ Authorize user 7 | * @apiName AuthUser 8 | * @apiGroup Auth 9 | * 10 | * @apiParam {String} email - User's email 11 | * @apiParam {String} password - User's password 12 | * 13 | * @apiSuccess {String} token User authorization token. 14 | * @apiSuccess {Object} user The user object. 15 | */ 16 | export async function authUser(ctx, next) { 17 | return passport.authenticate('local', (user) => { 18 | if (!user) ctx.throw(401) 19 | 20 | const token = user.generateToken() 21 | 22 | const response = user.toJSON() 23 | 24 | ctx.body = { 25 | token, 26 | user: response 27 | } 28 | })(ctx, next) 29 | } 30 | 31 | /** 32 | * @api {post} /auth/facebook Authenticate user through Facebook 33 | * @apiName AuthUserFacebook 34 | * @apiGroup Auth 35 | * @apiDescription This route will authenticate a user based on his token. If the user doesn't exist we'll create it. If the user exists, but isn't linked we'll link and then authenticate 36 | * 37 | * @apiParam {String} access_token - User facebook token 38 | * 39 | * @apiSuccess {String} token User authorization token. 40 | * @apiSuccess {Object} user The user object. 41 | */ 42 | export async function authFacebook(ctx, next) { 43 | const authFunction = passport.authenticate('facebook-token', async (err, info) => { 44 | if (!info || !info.profile) { 45 | if (err && err.message === 'You should provide access_token') ctx.throw(400, err.message) 46 | 47 | ctx.throw(401) 48 | } 49 | 50 | const profile = info.profile._json 51 | 52 | // Fetch user by email or facebook_id 53 | const user = await User.query({ 54 | where: { 55 | 'facebook_id': profile.id 56 | }, 57 | orWhere: { 58 | 'email': profile.email 59 | } 60 | }).fetch({}) 61 | 62 | try { 63 | // User already exists = Link or authenticate 64 | if (user) { 65 | ctx.body = await fbAuthenticate(user, info.facebook_token, profile.id) 66 | return 67 | } 68 | // If user does not exists sign up 69 | ctx.body = await fbSignup(profile, info.facebook_token) 70 | } catch (err) { 71 | ctx.throw(400, err.message) 72 | } 73 | }) 74 | 75 | // Execute the function 76 | try { 77 | await authFunction(ctx, next) 78 | } catch (e) { 79 | // Invalid token 80 | ctx.throw(400, e.message) 81 | } 82 | } 83 | -------------------------------------------------------------------------------- /src/modules/auth/helpers.js: -------------------------------------------------------------------------------- 1 | import { User } from 'models/users' 2 | 3 | export async function fbAuthenticate(user, facebookToken, facebookId) { 4 | user.set({ 5 | 'facebook_token': facebookToken, 6 | 'facebook_id': facebookId 7 | }) 8 | 9 | const newUser = await user.save() 10 | 11 | const token = newUser.generateToken() 12 | 13 | const response = newUser.toJSON() 14 | 15 | return { 16 | token, 17 | user: response 18 | } 19 | } 20 | 21 | export async function fbSignup(profile, facebookToken) { 22 | // Signup the user if it doesn't exists 23 | const newUser = User.forge({ 24 | name: `${profile.first_name} ${profile.last_name}`, 25 | email: profile.email, 26 | facebook_token: facebookToken, 27 | facebook_id: profile.id 28 | }) 29 | 30 | await newUser.save() 31 | await newUser.refresh() 32 | 33 | const token = newUser.generateToken() 34 | const url = await newUser.generateSignedURL() 35 | const pic = profile.picture.data 36 | 37 | // If the picture is not a silhouette we upload 38 | if (!pic.is_silhouette) await newUser.saveFBAvatar(pic.url) 39 | 40 | return { 41 | token, 42 | user: newUser, 43 | url 44 | } 45 | } 46 | -------------------------------------------------------------------------------- /src/modules/auth/router.js: -------------------------------------------------------------------------------- 1 | import * as auth from './controller' 2 | 3 | export const baseUrl = '/auth' 4 | 5 | export default [ 6 | { 7 | method: 'POST', 8 | route: '/', 9 | handlers: [ 10 | auth.authUser 11 | ] 12 | }, 13 | { 14 | method: 'POST', 15 | route: '/facebook/', 16 | handlers: [ 17 | auth.authFacebook 18 | ] 19 | } 20 | ] 21 | -------------------------------------------------------------------------------- /src/modules/index.js: -------------------------------------------------------------------------------- 1 | import glob from 'glob' 2 | import Router from 'koa-router' 3 | 4 | exports = module.exports = function initModules(app) { 5 | glob(`${__dirname}/*`, { ignore: '**/index.js' }, (err, matches) => { 6 | if (err) { throw err } 7 | 8 | matches.forEach((mod) => { 9 | const router = require(`${mod}/router`) 10 | 11 | const routes = router.default 12 | const baseUrl = router.baseUrl 13 | const instance = new Router({ prefix: baseUrl }) 14 | 15 | routes.forEach((config) => { 16 | const { 17 | method = '', 18 | route = '', 19 | handlers = [] 20 | } = config 21 | 22 | const lastHandler = handlers.pop() 23 | 24 | instance[method.toLowerCase()](route, ...handlers, async function(ctx) { 25 | return await lastHandler(ctx) 26 | }) 27 | 28 | app 29 | .use(instance.routes()) 30 | .use(instance.allowedMethods()) 31 | }) 32 | }) 33 | }) 34 | } 35 | -------------------------------------------------------------------------------- /src/modules/users/controller.js: -------------------------------------------------------------------------------- 1 | import { User } from 'models/users' 2 | import Promise from 'bluebird' 3 | import { isAuthenticated, restrictToAdmin } from 'middleware/validators' 4 | const graph = Promise.promisifyAll(require('fbgraph')) 5 | 6 | /** 7 | * @api {post} /users/ Create user 8 | * @apiName CreateUser 9 | * @apiGroup Users 10 | * 11 | * @apiParam {String} username - User's username 12 | * @apiParam {String} password - User's password 13 | * @apiParam {String} email - User's email 14 | * @apiParam {String} name - User's name 15 | * @apiParam {String} role (optional) - User's role ('user' or 'admin') 16 | * 17 | * @apiSuccess {String} token - User authorization token. 18 | * @apiSuccess {String} avatarSignedUrl - AWS signed URL to upload the user profile pic. 19 | * @apiSuccess {Object} user - The user object. 20 | * 21 | * @apiSuccessExample {json} Success-Response: 22 | * HTTP/1.1 200 OK 23 | * { 24 | * "token": "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpZCI6ImMzNDFjZTlhLWVlZGUtNGQ5My1hMmE4LWVjNGFkNjg0NThiMCIsInJvbGUiOiJ1c2VyIiwiaWF0IjoxNDg2NzM1MTgxfQ.hlJpzbpoN3gXPV--JSRqbTBGXvj-jfgd6Bi3cu4nIfs", 25 | * "user": { 26 | * "username": "lorenzopicoli2", 27 | * "email": "lorenzopicoli2@me.com", 28 | * "name": "Lorenzo Piccoli", 29 | * "updated_at": "2017-02-10T13:59:40.656Z", 30 | * "created_at": "2017-02-10T13:59:40.656Z", 31 | * "id": "c341ce9a-eede-4d93-a2a8-ec4ad68458b0", 32 | * "avatar": "https://feather-app-staging.s3.amazonaws.com/c341ce9a-eede-4d93-a2a8-ec4ad68458b0/avatar.jpg", 33 | * "facebook_token": null, 34 | * "facebook_id": null, 35 | * "role": "user" 36 | * }, 37 | * "avatarSignedUrl": "https://feather-app-staging.s3.amazonaws.com/c341ce9a-eede-4d93-a2a8-ec4ad68458b0/avatar.jpg?AWSAccessKeyId=AKIAJDTICCAVYLZOBXSA&Expires=1486951181&Signature=td9A2wDuoCc5JSJoTC%2FZlATS7%2Fs%3D&x-amz-acl=public-read" 38 | * } 39 | */ 40 | export async function create(ctx) { 41 | // We want to restrict the ability to create admins to admin only 42 | // This line will throw an error if the user is not an admin 43 | if (ctx.request.body.role) { 44 | await isAuthenticated(ctx) 45 | restrictToAdmin(ctx) 46 | } 47 | 48 | const user = User.forge(ctx.request.body) 49 | 50 | try { 51 | await user.save() 52 | await user.refresh() 53 | } catch (err) { 54 | ctx.throw(422, err.detail) 55 | } 56 | 57 | const token = user.generateToken() 58 | const avatarSignedUrl = await user.generateSignedURL() 59 | 60 | ctx.body = { token, user, avatarSignedUrl } 61 | } 62 | 63 | /** 64 | * @api {get} /users/ Get all users 65 | * @apiName GetAllUsers 66 | * @apiGroup Users 67 | * 68 | * @apiPermission admin 69 | * 70 | * @apiHeader {String} Authorization Admin auth token. 71 | * 72 | * @apiSuccess {Array} users - Array of users objects 73 | * 74 | * @apiSuccessExample {json} Success-Response: 75 | * HTTP/1.1 200 OK 76 | * { 77 | * "users": [ 78 | * { 79 | * "id": "24f5e80e-bb02-4927-8f42-7176c12b4261", 80 | * "email": "lorenzopicoli@me.com", 81 | * "name": "Lorenzo Piccoli", 82 | * "username": "lorenzopicoli", 83 | * "avatar": null, 84 | * "facebook_id": null, 85 | * "role": "admin", 86 | * "created_at": null, 87 | * "updated_at": null 88 | * }, 89 | * { 90 | * "id": "1c8c1533-31f6-400d-902d-8e2ba06f642d", 91 | * "email": "lucas@me.com", 92 | * "name": "Lucas", 93 | * "username": "lucas", 94 | * "avatar": null, 95 | * "facebook_id": null, 96 | * "role": "user", 97 | * "created_at": null, 98 | * "updated_at": null 99 | * }, 100 | * { 101 | * "id": "bf31e15c-4007-4e1c-ad4f-c73ce59b328e", 102 | * "email": "marcelo@me.com", 103 | * "name": "Marcelo", 104 | * "username": "marcelo", 105 | * "avatar": null, 106 | * "facebook_id": null, 107 | * "role": "user", 108 | * "created_at": null, 109 | * "updated_at": null 110 | * }, 111 | * { 112 | * "id": "7d7f8477-3068-4c5d-95bb-c7dee3bb9b08", 113 | * "email": "andreia@me.com", 114 | * "name": "Andreia", 115 | * "username": "andreia", 116 | * "avatar": null, 117 | * "facebook_id": null, 118 | * "role": "user", 119 | * "created_at": null, 120 | * "updated_at": null 121 | * } 122 | * ] 123 | * } 124 | */ 125 | export async function getAll(ctx) { 126 | try { 127 | const users = await User.fetchAll() 128 | ctx.body = { users } 129 | } catch (err) { 130 | if (err.message === 'EmptyResponse') { 131 | ctx.body = { users: [] } 132 | } 133 | ctx.throw(500) 134 | } 135 | } 136 | 137 | /** 138 | * @api {get} /users/:id Get a user 139 | * @apiName GetUser 140 | * @apiGroup Users 141 | * 142 | * @apiPermission user 143 | * 144 | * @apiHeader {String} Authorization - Auth token. 145 | * 146 | * @apiSuccess {Object} user - The user 147 | * 148 | * @apiSuccessExample {json} Success-Response: 149 | * HTTP/1.1 200 OK 150 | * { 151 | * "user": { 152 | * .... 153 | * } 154 | * } 155 | */ 156 | export async function get(ctx, next) { 157 | try { 158 | const user = await User.where('id', ctx.params.id).fetch({ 159 | require: true 160 | // withRelated: ['blablabla'] 161 | }) 162 | 163 | if (ctx.body) { 164 | ctx.body.user = user 165 | } else { 166 | ctx.body = { user } 167 | } 168 | } catch (err) { 169 | // Not found 170 | if (err.message === 'EmptyResponse') ctx.throw(404) 171 | 172 | // Invalid uuid 173 | if (err.code === '22P02') ctx.throw(400) 174 | 175 | ctx.throw(500) 176 | } 177 | 178 | if (next) await next() 179 | } 180 | 181 | /** 182 | * @api {put} /users/me/ Update the current user 183 | * @apiName UpdateUser 184 | * @apiGroup Users 185 | * 186 | * @apiPermission user 187 | * 188 | * @apiHeader {String} Authorization - Auth token. 189 | * 190 | * @apiParam {Any} user property - Any user property you want to update (see user create) 191 | * 192 | * @apiSuccess {Object} user - The user 193 | * 194 | * @apiSuccessExample {json} Success-Response: 195 | * HTTP/1.1 200 OK 196 | * { 197 | * "user": { 198 | * ... 199 | * } 200 | * } 201 | */ 202 | export async function update(ctx) { 203 | // We want to restrict the ability to update roles to admin only 204 | // This line will throw an error if the user is not an admin 205 | if (ctx.request.body.role) restrictToAdmin(ctx) 206 | 207 | const { user } = ctx.body 208 | 209 | const response = await user.save(ctx.request.body, { 210 | patch: true 211 | }) 212 | 213 | ctx.body = { 214 | user: response 215 | } 216 | } 217 | 218 | /** 219 | * @api {delete} /users/me Delete the current user 220 | * @apiName DeleteUser 221 | * @apiGroup Users 222 | * 223 | * @apiPermission user 224 | * 225 | * @apiHeader {String} Authorization - Auth token. 226 | * 227 | * @apiSuccessExample {json} Success-Response: 228 | * HTTP/1.1 200 OK 229 | * { 230 | * "success": true 231 | * } 232 | */ 233 | export async function remove(ctx) { 234 | const { user } = ctx.body 235 | 236 | await user.destroy() 237 | 238 | ctx.status = 200 239 | ctx.body = { success: true } 240 | } 241 | 242 | /** 243 | * @api {get} /users/me/facebook/friends Get Facebook friends 244 | * @apiName UserFacebookFriends 245 | * @apiGroup Users 246 | * 247 | * @apiDescription Search for the FB users, fetch the user by their facebook_id, also retun users not registered 248 | * 249 | * @apiPermission user 250 | * 251 | * @apiHeader {String} Authorization - Auth token. 252 | * 253 | * @apiParam {String} limit - Number of users to be fetched 254 | * @apiParam {String} url - Optional for paging (next or previous url) 255 | * 256 | * @apiSuccess {Array} registeredFriends - Array of FB friends that are registered 257 | * @apiSuccess {Array} nonRegisteredFriends - Array of FB friends that are not registered 258 | * @apiSuccess {Object} paging - May contain a "next" or "previous" urls that could be sent in the next request 259 | * 260 | * @apiSuccessExample {json} Success-Response: 261 | * HTTP/1.1 200 OK 262 | * { 263 | * "registredFriends": [ 264 | * { 265 | * "id": "ebf22822-0465-47bb-94d7-94d149e5e2bc", 266 | * "email": "smqskncsyl_1480367478@tfbnw.net", 267 | * "name": "Maria Aladbhcdcgibf Shepardsen", 268 | * "username": null, 269 | * "avatar": "https://feather-app-staging.s3.amazonaws.com/ebf22822-0465-47bb-94d7-94d149e5e2bc/avatar.jpg", 270 | * "facebook_id": "124113654741415", 271 | * "role": "user", 272 | * "created_at": "2017-02-10T23:26:20.182Z", 273 | * "updated_at": "2017-02-10T23:26:20.182Z" 274 | * } 275 | * ], 276 | * "nonRegistredFriends": [ 277 | * { 278 | * "name": "Open Graph Test User", 279 | * "id": "335312250184633" 280 | * } 281 | * ], 282 | * "paging": { 283 | * "next": "https://graph.facebook.com/v2.5/101447620347201/friends?access_token=EAADBBMQBeFkBANPnrCj3BeZAV2X0Lwk0y0fCHDvQzCKd1M8SdvjBjo0ZB77bnY96zZCZCTGc0O01WRMjSGEMZB62oUHInSe9sZCN4hXSUQZCEe19OimyEcC2hZC1SRhk0NhWbq4TTcTDtENXMYCCkElbTHkFSEfpNtJZAoGyqnZBEG7OuYvDz7FcK3IpgqCd0ISBFVrEaKQwiff0fGM6nsISviy9XTtMmGcXoZD&limit=2&after=QVFIUjhFdGhGdUNVYTF4N1dDRlV1TS14czRfbjJSVGZATQTFzM3dXeVNaRUNwN1FZASmxycmhNUDhxekRMbF9CcmNmOWxUUF9UOGozSWVTNmFlZAE1RUV81bmFR" 284 | * "previous": "https://graph.facebook.com/v2.5/101447620347201/friends?access_token=EAADBBMQBeFkBANPnrCj3BeZAV2X0Lwk0y0fCHDvQzCKd1M8SdvjBjo0ZB77bnY96zZCZCTGc0O01WRMjSGEMZB62oUHInSe9sZCN4hXSUQZCEe19OimyEcC2hZC1SRhk0NhWbq4TTcTDtENXMYCCkElbTHkFSEfpNtJZAoGyqnZBEG7OuYvDz7FcK3IpgqCd0ISBFVrEaKQwiff0fGM6nsISviy9XTtMmGcXoZD&limit=2&after=QVFIUjhFdGhGdUNVYTF4N1dDRlV1TS14czRfbjJSVGZATQTFzM3dXeVNaRUNwN1FZASmxycmhNUDhxekRMbF9CcmNmOWxUUF9UOGozSWVTNmFlZAE1RUV81bmFR" 285 | * } 286 | * } 287 | */ 288 | export async function getFacebookFriends(ctx) { 289 | const { user } = ctx.body 290 | 291 | graph.setAccessToken(user.get('facebook_token')) 292 | 293 | // For pagination 294 | const url = ctx.request.query.url || 'me/friends' 295 | const limit = ctx.request.query.limit || 30 296 | 297 | try { 298 | const res = await graph.getAsync(url, { limit }) 299 | 300 | // Getting the facebook ID only 301 | const friendsIds = res.data.map(friend => friend.id) 302 | const registredFriends = await User.where('facebook_id', 'IN', friendsIds).fetchAll() 303 | const nonRegistredFriends = res.data.filter(friend => !registredFriends.some(user => user.get('facebook_id') === friend.id)) 304 | 305 | ctx.body = { registredFriends, nonRegistredFriends, paging: { next: res.paging.next, previous: res.paging.previous } } 306 | } catch (err) { 307 | ctx.throw(500) 308 | } 309 | } 310 | -------------------------------------------------------------------------------- /src/modules/users/router.js: -------------------------------------------------------------------------------- 1 | import { isAuthenticated, restrictToAdmin, setUserIdFromToken } from 'middleware/validators' 2 | import * as user from './controller' 3 | 4 | export const baseUrl = '/users' 5 | 6 | export default [ 7 | { 8 | method: 'POST', 9 | route: '/', 10 | handlers: [ 11 | user.create 12 | ] 13 | }, 14 | { 15 | method: 'GET', 16 | route: '/', 17 | handlers: [ 18 | isAuthenticated, 19 | restrictToAdmin, 20 | user.getAll 21 | ] 22 | }, 23 | { 24 | method: 'GET', 25 | route: '/:id', 26 | handlers: [ 27 | isAuthenticated, 28 | user.get 29 | ] 30 | }, 31 | { 32 | method: 'PUT', 33 | route: '/me', 34 | handlers: [ 35 | isAuthenticated, 36 | setUserIdFromToken, 37 | user.get, 38 | user.update 39 | ] 40 | }, 41 | { 42 | method: 'DELETE', 43 | route: '/me', 44 | handlers: [ 45 | isAuthenticated, 46 | setUserIdFromToken, 47 | user.get, 48 | user.remove 49 | ] 50 | }, 51 | { 52 | method: 'DELETE', 53 | route: '/:id', 54 | handlers: [ 55 | isAuthenticated, 56 | restrictToAdmin, 57 | user.get, 58 | user.remove 59 | ] 60 | }, 61 | { 62 | method: 'GET', 63 | route: '/me/facebook/friends', 64 | handlers: [ 65 | isAuthenticated, 66 | setUserIdFromToken, 67 | user.get, 68 | user.getFacebookFriends 69 | ] 70 | } 71 | ] 72 | -------------------------------------------------------------------------------- /test-results.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | -------------------------------------------------------------------------------- /test/auth/post.js: -------------------------------------------------------------------------------- 1 | import { expect } from 'chai' 2 | import { user, admin } from '../utils' 3 | import { User } from 'models/users' 4 | 5 | module.exports = (request, context) => { 6 | describe('POST /auth', () => { 7 | beforeEach(async () => { 8 | context.user = await User.forge(user()).save() 9 | context.admin = await User.forge(admin()).save() 10 | }) 11 | 12 | afterEach(async () => { 13 | await context.user.destroy() 14 | await context.admin.destroy() 15 | }) 16 | 17 | it('should throw 401 if credentials are incorrect', (done) => { 18 | request 19 | .post('/auth') 20 | .set('Accept', 'application/json') 21 | .send({ email: '9999999999', password: 'wrongpassword' }) 22 | .expect(401, done) 23 | }) 24 | 25 | it('should auth user (local)', (done) => { 26 | const { admin } = context 27 | const email = admin.get('email') 28 | request 29 | .post('/auth') 30 | .set('Accept', 'application/json') 31 | .send({ email, password: '123' }) 32 | .expect(200, (err, res) => { 33 | if (err) { return done(err) } 34 | 35 | res.body.user.should.have.property('email') 36 | res.body.user.email.should.equal(email) 37 | 38 | expect(res.body.user.password).to.not.exist // eslint-disable-line 39 | 40 | done() 41 | }) 42 | }) 43 | }) 44 | } 45 | -------------------------------------------------------------------------------- /test/index.js: -------------------------------------------------------------------------------- 1 | require('dotenv').config({ silent: true }) 2 | 3 | import app from '../bin/server' 4 | import supertest from 'supertest' 5 | import { should } from 'chai' 6 | 7 | should() 8 | 9 | const request = supertest.agent(app.listen()) 10 | const context = {} 11 | 12 | describe('Server Tests', function() { 13 | // Creating a top level describe to set "global" hooks or configuration 14 | this.timeout(10000) 15 | 16 | require('./users/post')(request, context) 17 | require('./auth/post')(request, context) 18 | require('./users/get')(request, context) 19 | require('./users/put')(request, context) 20 | require('./users/delete')(request, context) 21 | require('./users/facebook')(request, context) 22 | }) 23 | -------------------------------------------------------------------------------- /test/users/delete.js: -------------------------------------------------------------------------------- 1 | import { User } from 'models/users' 2 | import { user, admin } from '../utils' 3 | 4 | module.exports = (request, context) => { 5 | describe('DELETE /users/me', () => { 6 | beforeEach(async () => { 7 | context.user = await User.forge(user()).save() 8 | context.admin = await User.forge(admin()).save() 9 | context.userData = user() 10 | }) 11 | 12 | afterEach(async () => { 13 | // The ideal would be to call await context.user.destroy(), but it causes an error (Bookshelf bug?) 14 | await User.where({ id: context.user.get('id') }).destroy() 15 | await User.where({ id: context.admin.get('id') }).destroy() 16 | delete context.userData 17 | }) 18 | 19 | it('should not delete user if token is invalid', (done) => { 20 | request 21 | .delete(`/users/me`) 22 | .set('Authorization', 'token') 23 | .set('Accept', 'application/json') 24 | .expect(401, done) 25 | }) 26 | 27 | it('should not allow an user to use the admin route', (done) => { 28 | // We need to wrap it inside an async because of Mocha "overspecification" issues 29 | // https://github.com/mochajs/mocha/issues/2407 30 | (async () => { 31 | const { user, userData } = context 32 | const secondUser = await User.forge(userData).save() 33 | 34 | request 35 | .delete(`/users/${secondUser.get('id')}`) 36 | .set('Authorization', user.generateToken()) 37 | .set('Accept', 'application/json') 38 | .expect(403, async (err, res) => { 39 | if (err) { return done(err) } 40 | 41 | await User.where({ id: secondUser.get('id') }).destroy() 42 | done() 43 | }) 44 | })() 45 | }) 46 | 47 | it('should delete user (not admin)', (done) => { 48 | const { user } = context 49 | 50 | request 51 | .delete(`/users/me`) 52 | .set('Authorization', user.generateToken()) 53 | .set('Accept', 'application/json') 54 | .expect(200, done) 55 | }) 56 | 57 | it('should delete user (admin)', (done) => { 58 | const { user, admin } = context 59 | 60 | request 61 | .delete(`/users/${user.id}`) 62 | .set('Authorization', admin.generateToken()) 63 | .set('Accept', 'application/json') 64 | .expect(200, done) 65 | }) 66 | }) 67 | } 68 | -------------------------------------------------------------------------------- /test/users/facebook.js: -------------------------------------------------------------------------------- 1 | import { User } from 'models/users' 2 | import { fbUser, user, getFbAccessData } from '../utils' 3 | import { expect } from 'chai' 4 | 5 | module.exports = (request, context) => { 6 | describe('Facebook', () => { 7 | before(async () => { 8 | // Saves facebook access data { token, id } 9 | const fbAccessData = await getFbAccessData() 10 | context.fbAccessData = fbAccessData 11 | }) 12 | 13 | beforeEach(async () => { 14 | const { token, id } = context.fbAccessData 15 | const fbData = fbUser(token, id) 16 | context.user = await User.forge(fbData).save() 17 | context.facebookToken = fbData.facebook_token 18 | }) 19 | 20 | afterEach(async () => { 21 | await User.where({ id: context.user.get('id') }).destroy() 22 | delete context.facebookToken 23 | }) 24 | 25 | it('should sign up with facebook', (done) => { 26 | // We need to wrap it inside an async because of Mocha "overspecification" issues 27 | // https://github.com/mochajs/mocha/issues/2407 28 | (async () => { 29 | await User.where({ id: context.user.get('id') }).destroy() 30 | 31 | const { token } = context.fbAccessData 32 | 33 | request 34 | .post('/auth/facebook') 35 | .set('Accept', 'application/json') 36 | .send({ access_token: token }) 37 | .expect(200, async (err, res) => { 38 | if (err) { return done(err) } 39 | res.body.should.have.property('user') 40 | res.body.user.should.have.property('name') 41 | res.body.user.should.have.property('email') 42 | 43 | expect(res.body.user.password).to.not.exist // eslint-disable-line 44 | expect(res.body.user.salt).to.not.exist // eslint-disable-line 45 | 46 | expect(res.body.user.facebook_id).to.exist // eslint-disable-line 47 | await User.where({ id: res.body.user.id }).destroy() 48 | 49 | done() 50 | }) 51 | })() 52 | }) 53 | 54 | it('should auth user (facebook)', (done) => { 55 | const { facebookToken } = context 56 | request 57 | .post('/auth/facebook') 58 | .set('Accept', 'application/json') 59 | .send({ access_token: facebookToken }) 60 | .expect(200, async (err, res) => { 61 | if (err) { return done(err) } 62 | 63 | res.body.should.have.property('token') 64 | res.body.should.have.property('user') 65 | res.body.user.should.have.property('name') 66 | res.body.user.should.have.property('email') 67 | 68 | expect(res.body.user.password).to.not.exist // eslint-disable-line 69 | expect(res.body.user.salt).to.not.exist // eslint-disable-line 70 | 71 | expect(res.body.user.facebook_id).to.exist // eslint-disable-line 72 | done() 73 | }) 74 | }) 75 | 76 | it('should NOT auth user with the wrong token (facebook)', (done) => { 77 | request 78 | .post('/auth/facebook') 79 | .set('Accept', 'application/json') 80 | .send({ access_token: 'adasdasd' }) 81 | .expect(400, done) 82 | }) 83 | 84 | it('should not sign up a user with a invalid token', (done) => { 85 | request 86 | .post('/auth/facebook') 87 | .set('Accept', 'application/json') 88 | .send({ access_token: 'fake' }) 89 | .expect(400, done) 90 | }) 91 | 92 | it('should not sign up a user without a token', (done) => { 93 | request 94 | .post('/auth/facebook') 95 | .set('Accept', 'application/json') 96 | .send({}) 97 | .expect(400, done) 98 | }) 99 | 100 | it('should not link a user with an invalid token', (done) => { 101 | // We need to wrap it inside an async because of Mocha "overspecification" issues 102 | // https://github.com/mochajs/mocha/issues/2407 103 | (async () => { 104 | const newUser = await User.forge(user()).save() 105 | request 106 | .post('/auth/facebook/') 107 | .set('Accept', 'application/json') 108 | .send({ access_token: 'adasdasd' }) 109 | .expect(400, async (err, res) => { 110 | if (err) { return done(err) } 111 | 112 | await User.where({ id: newUser.get('id') }).destroy() 113 | done() 114 | }) 115 | })() 116 | }) 117 | 118 | it('should link a facebook account to a user', (done) => { 119 | // We need to wrap it inside an async because of Mocha "overspecification" issues 120 | // https://github.com/mochajs/mocha/issues/2407 121 | (async () => { 122 | // Delete the user created in the before hook 123 | await User.where({ id: context.user.get('id') }).destroy() 124 | // Get a valid FB token 125 | const { token, email } = context.fbAccessData 126 | // Create a new user (not linked) 127 | const localUser = user() 128 | localUser.email = email 129 | const newUser = await User.forge(localUser).save() 130 | 131 | request 132 | .post(`/auth/facebook/`) 133 | .send({ access_token: token }) 134 | .set('Accept', 'application/json') 135 | .expect(200, async (err, res) => { 136 | if (err) { return done(err) } 137 | 138 | res.body.user.should.have.property('name') 139 | res.body.user.should.have.property('email') 140 | res.body.user.should.have.property('facebook_id') 141 | 142 | await User.where({ id: newUser.get('id') }).destroy() 143 | 144 | done() 145 | }) 146 | })() 147 | }) 148 | 149 | it('should get a list of user FB friends', (done) => { 150 | const { user } = context 151 | 152 | request 153 | .get(`/users/me/facebook/friends`) 154 | .set('Authorization', user.generateToken()) 155 | .set('Accept', 'application/json') 156 | .send() 157 | .expect(200, async (err, res) => { 158 | if (err) { return done(err) } 159 | 160 | res.body.should.have.property('registredFriends') 161 | res.body.should.have.property('nonRegistredFriends') 162 | res.body.should.have.property('paging') 163 | 164 | done() 165 | }) 166 | }) 167 | }) 168 | } 169 | -------------------------------------------------------------------------------- /test/users/get.js: -------------------------------------------------------------------------------- 1 | import { expect } from 'chai' 2 | import { User } from 'models/users' 3 | import { user, admin } from '../utils' 4 | 5 | module.exports = (request, context) => { 6 | describe('GET /users', () => { 7 | beforeEach(async () => { 8 | context.user = await User.forge(user()).save() 9 | context.admin = await User.forge(admin()).save() 10 | }) 11 | 12 | afterEach(async () => { 13 | // The ideal would be to call await context.user.destroy(), but it causes an error (Bookshelf bug?) 14 | await User.where({ id: context.user.get('id') }).destroy() 15 | await User.where({ id: context.admin.get('id') }).destroy() 16 | }) 17 | 18 | it('should not fetch all users if not admin', (done) => { 19 | const { user } = context 20 | 21 | request 22 | .get('/users') 23 | .set('Authorization', user.generateToken()) 24 | .set('Accept', 'application/json') 25 | .expect(403, done) 26 | }) 27 | 28 | it('should fetch users if is admin', (done) => { 29 | const { admin } = context 30 | request 31 | .get('/users') 32 | .set('Authorization', admin.generateToken()) 33 | .set('Accept', 'application/json') 34 | .expect(200, done) 35 | }) 36 | }) 37 | 38 | describe('GET /users/:id', () => { 39 | beforeEach(async () => { 40 | context.user = await User.forge(user()).save() 41 | context.admin = await User.forge(admin()).save() 42 | }) 43 | 44 | afterEach(async () => { 45 | // The ideal would be to call await context.user.destroy(), but it causes an error (Bookshelf bug?) 46 | await User.where({ id: context.user.get('id') }).destroy() 47 | await User.where({ id: context.admin.get('id') }).destroy() 48 | }) 49 | 50 | it('should not fetch user if token is invalid', (done) => { 51 | const { user } = context 52 | 53 | request 54 | .get(`/users/${user.get('id')}`) 55 | .set('Authorization', 'token') 56 | .set('Accept', 'application/json') 57 | .expect(401, done) 58 | }) 59 | 60 | it('should throw 401 if there isn\'t a header called Authorization', (done) => { 61 | request 62 | .get(`/users/me`) 63 | .set('Accept', 'application/json') 64 | .expect(401, done) 65 | }) 66 | 67 | it('should throw 404 if user doesn\'t exist', (done) => { 68 | const { user } = context 69 | request 70 | .get('/users/1a143b57-d463-4873-84e1-32157f4965e9') 71 | .set('Authorization', user.generateToken()) 72 | .set('Accept', 'application/json') 73 | .expect(404, done) 74 | }) 75 | 76 | it('should throw 400 if the id is not an uuid', (done) => { 77 | const { user } = context 78 | request 79 | .get('/users/me') 80 | .set('Authorization', user.generateToken()) 81 | .set('Accept', 'application/json') 82 | .expect(400, done) 83 | }) 84 | 85 | it('should fetch user', (done) => { 86 | const { user } = context 87 | 88 | request 89 | .get(`/users/${user.get('id')}`) 90 | .set('Authorization', user.generateToken()) 91 | .set('Accept', 'application/json') 92 | .expect(200, (err, res) => { 93 | if (err) { return done(err) } 94 | 95 | res.body.should.have.property('user') 96 | 97 | expect(res.body.user.password).to.not.exist // eslint-disable-line 98 | expect(res.body.user.salt).to.not.exist // eslint-disable-line 99 | 100 | done() 101 | }) 102 | }) 103 | }) 104 | } 105 | -------------------------------------------------------------------------------- /test/users/post.js: -------------------------------------------------------------------------------- 1 | import { expect } from 'chai' 2 | import faker from 'faker' 3 | import { User } from 'models/users' 4 | import { user, admin } from '../utils' 5 | 6 | module.exports = (request, context) => describe('POST /users', () => { 7 | beforeEach(async () => { 8 | context.user = await User.forge(user()).save() 9 | context.admin = await User.forge(admin()).save() 10 | }) 11 | 12 | afterEach(async () => { 13 | // The ideal would be to call await context.user.destroy(), but it causes an error (Bookshelf bug?) 14 | await User.where({ id: context.user.get('id') }).destroy() 15 | await User.where({ id: context.admin.get('id') }).destroy() 16 | }) 17 | 18 | it('should reject signup when data is incomplete', (done) => { 19 | request 20 | .post('/users') 21 | .set('Accept', 'application/json') 22 | .send({ email: 'supercoolname@mas.eoc' }) 23 | .expect(422, done) 24 | }) 25 | 26 | it('should sign up', (done) => { 27 | const email = faker.internet.email() 28 | const name = faker.name.findName() 29 | request 30 | .post('/users') 31 | .set('Accept', 'application/json') 32 | .send({ 33 | email: email, 34 | name: name, 35 | password: 'supersecretpassword' 36 | }) 37 | .expect(200, async (err, res) => { 38 | if (err) { return done(err) } 39 | res.body.user.should.have.property('name') 40 | res.body.user.name.should.equal(name) 41 | 42 | res.body.user.should.have.property('email') 43 | res.body.user.email.should.equal(email) 44 | 45 | expect(res.body.user.password).to.not.exist // eslint-disable-line 46 | expect(res.body.user.salt).to.not.exist // eslint-disable-line 47 | 48 | await User.where({ id: res.body.user.id }).destroy() 49 | done() 50 | }) 51 | }) 52 | 53 | it('should not sign up duplicated user', (done) => { 54 | const { user } = context 55 | request 56 | .post('/users') 57 | .set('Accept', 'application/json') 58 | .send({ 59 | email: user.email, 60 | name: user.name, 61 | password: 'supersecretpassword' 62 | }) 63 | .expect(422, done) 64 | }) 65 | 66 | it('should not sign up a user as admin (no token)', (done) => { 67 | const email = faker.internet.email() 68 | const name = faker.name.findName() 69 | request 70 | .post('/users') 71 | .set('Accept', 'application/json') 72 | .send({ 73 | email: email, 74 | name: name, 75 | password: 'supersecretpassword', 76 | role: 'admin' 77 | }) 78 | .expect(401, done) 79 | }) 80 | 81 | it('should not sign up a user as admin (user token)', (done) => { 82 | const email = faker.internet.email() 83 | const name = faker.name.findName() 84 | const { user } = context 85 | const token = user.generateToken() 86 | request 87 | .post('/users') 88 | .set('Accept', 'application/json') 89 | .set('Authorization', token) 90 | .send({ 91 | email: email, 92 | name: name, 93 | password: 'supersecretpassword', 94 | role: 'admin' 95 | }) 96 | .expect(403, done) 97 | }) 98 | }) 99 | -------------------------------------------------------------------------------- /test/users/put.js: -------------------------------------------------------------------------------- 1 | import { expect } from 'chai' 2 | import { user, admin } from '../utils' 3 | import { User } from 'models/users' 4 | 5 | module.exports = async (request, context) => { 6 | describe('PUT /users/me', () => { 7 | beforeEach(async () => { 8 | context.user = await User.forge(user()).save() 9 | context.admin = await User.forge(admin()).save() 10 | }) 11 | 12 | afterEach(async () => { 13 | // The ideal would be to call await context.user.destroy(), but it causes an error (Bookshelf bug?) 14 | await User.where({ id: context.user.get('id') }).destroy() 15 | await User.where({ id: context.admin.get('id') }).destroy() 16 | }) 17 | 18 | it('should not update user if token is invalid', (done) => { 19 | request 20 | .put(`/users/me`) 21 | .set('Authorization', 'token') 22 | .set('Accept', 'application/json') 23 | .expect(401, done) 24 | }) 25 | 26 | it('should update user', (done) => { 27 | const { user } = context 28 | const token = user.generateToken() 29 | request 30 | .put(`/users/me`) 31 | .set('Authorization', token) 32 | .set('Accept', 'application/json') 33 | .send({ name: 'updatedcoolname' }) 34 | .expect(200, (err, res) => { 35 | if (err) { return done(err) } 36 | 37 | res.body.user.should.have.property('name') 38 | res.body.user.name.should.equal('updatedcoolname') 39 | 40 | expect(res.body.user.password).to.not.exist // eslint-disable-line 41 | expect(res.body.user.salt).to.not.exist // eslint-disable-line 42 | 43 | done() 44 | }) 45 | }) 46 | 47 | it('should not update the user\'s role', (done) => { 48 | const { user } = context 49 | const token = user.generateToken() 50 | request 51 | .put(`/users/me`) 52 | .set('Authorization', token) 53 | .set('Accept', 'application/json') 54 | .send({ role: 'admin' }) 55 | .expect(403, done) 56 | }) 57 | }) 58 | } 59 | -------------------------------------------------------------------------------- /test/utils.js: -------------------------------------------------------------------------------- 1 | import faker from 'faker' 2 | import Promise from 'bluebird' 3 | const graph = Promise.promisifyAll(require('fbgraph')) 4 | 5 | export function user() { 6 | return { 7 | email: faker.internet.email(), 8 | password: '123', 9 | name: 'user', 10 | role: faker.name.findName() 11 | } 12 | } 13 | 14 | export function admin() { 15 | return { 16 | email: faker.internet.email(), 17 | password: '123', 18 | name: faker.name.findName(), 19 | role: 'admin' 20 | } 21 | } 22 | 23 | export function fbUser(token, id) { 24 | return { 25 | email: faker.internet.email(), 26 | password: '123', 27 | name: faker.name.findName(), 28 | role: 'user', 29 | facebook_token: token, 30 | facebook_id: id 31 | } 32 | } 33 | 34 | export async function getFbAccessData() { 35 | // Get the app access token 36 | const { access_token } = await graph.getAsync(`/oauth/access_token?client_id=${process.env.FACEBOOK_ID}&client_secret=${process.env.FACEBOOK_SECRET}&grant_type=client_credentials`) 37 | graph.setAccessToken(access_token) 38 | // Get test users 39 | const { data } = await graph.getAsync(`/${process.env.FACEBOOK_ID}/accounts/test-users`) 40 | // User access token and ID 41 | const { id } = data[0] 42 | const token = data[0].access_token 43 | 44 | graph.setAccessToken(token) 45 | // Get the user's email (need to know the email for the liking test) 46 | const me = await graph.getAsync(`/me?fields=email`) 47 | 48 | return { token, id, email: me.email } 49 | } 50 | --------------------------------------------------------------------------------