UNPKG

292 kBSource Map (JSON)View Raw
1{"version":3,"sources":["/Users/daw/oss/denali/denali/app/actions/error.ts","/Users/daw/oss/denali/denali/app/actions/index.ts","/Users/daw/oss/denali/denali/app/addon.ts","/Users/daw/oss/denali/denali/app/logger.ts","/Users/daw/oss/denali/denali/app/orm-adapters/application.ts","/Users/daw/oss/denali/denali/app/orm-adapters/memory.ts","/Users/daw/oss/denali/denali/app/parsers/application.ts","/Users/daw/oss/denali/denali/app/parsers/json-api.ts","/Users/daw/oss/denali/denali/app/parsers/json.ts","/Users/daw/oss/denali/denali/app/router.ts","/Users/daw/oss/denali/denali/app/serializers/application.ts","/Users/daw/oss/denali/denali/app/serializers/json-api.ts","/Users/daw/oss/denali/denali/app/serializers/json.ts","/Users/daw/oss/denali/denali/app/services/config.ts","/Users/daw/oss/denali/denali/app/views/error.ts","/Users/daw/oss/denali/denali/config/environment.ts","/Users/daw/oss/denali/denali/config/initializers/define-orm-models.ts","/Users/daw/oss/denali/denali/config/middleware.ts","/Users/daw/oss/denali/denali/lib/data/descriptors.ts","/Users/daw/oss/denali/denali/lib/data/memory.ts","/Users/daw/oss/denali/denali/lib/data/model.ts","/Users/daw/oss/denali/denali/lib/data/orm-adapter.ts","/Users/daw/oss/denali/denali/lib/index.ts","/Users/daw/oss/denali/denali/lib/metal/container.ts","/Users/daw/oss/denali/denali/lib/metal/instrumentation.ts","/Users/daw/oss/denali/denali/lib/metal/mixin.ts","/Users/daw/oss/denali/denali/lib/metal/object.ts","/Users/daw/oss/denali/denali/lib/metal/resolver.ts","/Users/daw/oss/denali/denali/lib/parse/json-api.ts","/Users/daw/oss/denali/denali/lib/parse/json.ts","/Users/daw/oss/denali/denali/lib/parse/parser.ts","/Users/daw/oss/denali/denali/lib/render/json-api.ts","/Users/daw/oss/denali/denali/lib/render/json.ts","/Users/daw/oss/denali/denali/lib/render/serializer.ts","/Users/daw/oss/denali/denali/lib/render/view.ts","/Users/daw/oss/denali/denali/lib/runtime/action.ts","/Users/daw/oss/denali/denali/lib/runtime/addon.ts","/Users/daw/oss/denali/denali/lib/runtime/application.ts","/Users/daw/oss/denali/denali/lib/runtime/config.ts","/Users/daw/oss/denali/denali/lib/runtime/errors.ts","/Users/daw/oss/denali/denali/lib/runtime/logger.ts","/Users/daw/oss/denali/denali/lib/runtime/request.ts","/Users/daw/oss/denali/denali/lib/runtime/route.ts","/Users/daw/oss/denali/denali/lib/runtime/router.ts","/Users/daw/oss/denali/denali/lib/runtime/service.ts","/Users/daw/oss/denali/denali/lib/test/acceptance-test.ts","/Users/daw/oss/denali/denali/lib/test/mock-request.ts","/Users/daw/oss/denali/denali/lib/test/mock-response.ts","/Users/daw/oss/denali/denali/lib/test/unit-test.ts","lib/utils/json-api.js","/Users/daw/oss/denali/denali/lib/utils/result.ts","/Users/daw/oss/denali/denali/lib/utils/rewrap.ts","/Users/daw/oss/denali/denali/lib/utils/set-if-not-empty.ts","/Users/daw/oss/denali/denali/lib/utils/strings.ts","/Users/daw/oss/denali/denali/lib/utils/topsort.ts","lib/utils/types.js"],"sourcesContent":["import * as assert from 'assert';\nimport Action from '../../lib/runtime/action';\nimport Logger from '../../lib/runtime/logger';\nimport JSONParser from '../../lib/parse/json';\nimport { lookup } from '../../lib/metal/container';\n\n/**\n * The default error action. When Denali encounters an error while processing a request, it will\n * attempt to hand off that error to the `error` action, which can determine how to respond. This is\n * a good spot to do things like report the error to an error-tracking service, sanitize the error\n * response based on environment (i.e. a full stack trace in dev, but limited info in prod), etc.\n *\n * @export\n * @class ErrorAction\n * @extends {Action}\n */\nexport default class ErrorAction extends Action {\n\n get originalAction(): string {\n return this.request._originalAction;\n }\n\n logger = lookup<Logger>('app:logger');\n parser = lookup<JSONParser>('parser:json');\n\n /**\n * Respond with JSON by default\n */\n async respond({ params }: any) {\n let error = params.error;\n assert(error, 'Error action must be invoked with an error as a param');\n // Print the error to the logs\n if ((!error.status || error.status >= 500) && this.config.environment !== 'test') {\n this.logger.error(`Request ${ this.request.id } errored:\\n${ error.stack || error.message }`);\n }\n // Ensure a default status code of 500\n error.status = error.statusCode = error.statusCode || 500;\n // If debugging info is allowed, attach some debugging info to standard\n // locations.\n if (this.config.getWithDefault('logging', 'showDebuggingInfo', this.config.environment !== 'production')) {\n error.meta = error.meta || {};\n Object.assign(error.meta, {\n stack: error.stack.split('\\n'),\n action: this.originalAction\n });\n // Otherwise, sanitize the output\n } else {\n if (error.statusCode === 500) {\n error.message = 'Internal Error';\n }\n delete error.stack;\n }\n if (this.request.accepts('html') && this.config.environment !== 'production') {\n this.render(error.status, error, { view: 'error.html' });\n } else {\n this.render(error.status, error);\n }\n }\n\n}\n","import Action from '../../lib/runtime/action';\n\nexport default class IndexAction extends Action {\n\n respond() {\n return this.render(200, { hello: 'world' }, { serializer: 'json' });\n }\n\n}\n","import { Addon } from '../lib';\n\nexport default class MyAddonAddon extends Addon {}\n","export { default } from '../lib/runtime/logger';","export { default } from '../../lib/data/memory';\n","export { default } from '../../lib/data/memory';\n","export { default } from './json-api';\n","export { default } from '../../lib/parse/json-api';\n","export { default } from '../../lib/parse/json';\n","export { default } from '../lib/runtime/router';","export { default } from './json-api';\n","export { default } from '../../lib/render/json-api';\n","export { default } from '../../lib/render/json';\n","export { default } from '../../lib/runtime/config';","import {\n template as compileTemplate\n} from 'lodash';\nimport { ServerResponse } from 'http';\nimport Action, { RenderOptions } from '../../lib/runtime/action';\nimport View from '../../lib/render/view';\n\nlet template = compileTemplate(`\n <html>\n <head>\n <style>\n body {\n font-family: Arial, Helvetica, sans-serif;\n background: #f7f7f7;\n margin: 0;\n }\n pre {\n font-family: Inconsolata, Monaco, Menlo, monospace;\n }\n .headline {\n background: #fff;\n padding: 30px;\n color: #DC4B4B;\n font-family: Inconsolata, Monaco, Menlo, monospace;\n border-bottom: 1px solid #ddd;\n margin-bottom: 0;\n }\n .lead {\n display: block;\n margin-bottom: 7px;\n color: #aaa;\n font-size: 14px;\n font-family: Arial, Helvetica, sans-serif;\n font-weight: 300;\n }\n .details {\n padding: 30px;\n }\n </style>\n </head>\n <body>\n <h1 class='headline'>\n <small class='lead'>There was an error with this request:</small>\n <%= data.error.message %>\n </h1>\n <div class='details'>\n <% if (data.error.action) { %>\n <h2 class='source'>from <%= data.error.action %></h2>\n <% } %>\n <h5>Stacktrace:</h5>\n <pre><code><%= data.error.stack %></code></pre>\n </div>\n </body>\n </html>\n`, {\n variable: 'data'\n});\n\nexport default class ErrorView extends View {\n\n async render(action: Action, response: ServerResponse, error: any, options: RenderOptions) {\n response.setHeader('Content-type', 'text/html');\n error.stack = error.stack.replace('\\\\n', '\\n');\n response.write(template({ error }));\n response.end();\n }\n\n}\n","module.exports = function baseConfig(environment: string, appConfig: any): void {\n if (!appConfig.logging) {\n appConfig.logging = {};\n }\n if (!appConfig.logging.hasOwnProperty('showDebuggingInfo')) {\n appConfig.logging.showDebuggingInfo = environment !== 'production';\n }\n};\n","import {\n forEach\n} from 'lodash';\nimport Application from '../../lib/runtime/application';\nimport Model from '../../lib/data/model';\nimport ORMAdapter from '../../lib/data/orm-adapter';\nimport container, { lookup } from '../../lib/metal/container';\n\nexport default {\n name: 'define-orm-models',\n\n /**\n * Find all models, group them by their orm adapter, then give each adapter the chance to define\n * any internal model representation necessary.\n */\n async initialize(application: Application): Promise<void> {\n let models: { [modelName: string]: typeof Model } = container.lookupAll('model');\n let modelsGroupedByAdapter = new Map<ORMAdapter, typeof Model[]>();\n forEach(models, (ModelClass, modelName) => {\n if (ModelClass.hasOwnProperty('abstract') && ModelClass.abstract) {\n return;\n }\n let Adapter = lookup<ORMAdapter>(`orm-adapter:${ modelName }`, { loose: true }) || container.lookup<ORMAdapter>('orm-adapter:application');\n if (!modelsGroupedByAdapter.has(Adapter)) {\n modelsGroupedByAdapter.set(Adapter, []);\n }\n modelsGroupedByAdapter.get(Adapter).push(ModelClass);\n });\n for (let [Adapter, models] of modelsGroupedByAdapter) {\n if (Adapter.defineModels) {\n await Adapter.defineModels(models);\n }\n }\n }\n};\n","import {\n defaults\n} from 'lodash';\nimport * as timing from 'response-time';\nimport * as compression from 'compression';\nimport * as cookies from 'cookie-parser';\nimport * as cors from 'cors';\nimport * as helmet from 'helmet';\nimport * as morgan from 'morgan';\nimport { IncomingMessage, ServerResponse } from 'http';\nimport Router from '../lib/runtime/router';\nimport Application from '../lib/runtime/application';\n\n/**\n * Denali ships with several base middleware included, each of which can be enabled/disabled\n * individually through config options.\n */\nexport default function baseMiddleware(router: Router, application: Application): void {\n\n let config = application.config;\n\n /**\n * Returns true if the given property either does not exist on the config object, or it does exist\n * and it's `enabled` property is not `false`. All the middleware here are opt out, so to disable\n * you must define set that middleware's root config property to `{ enabled: false }`\n */\n function isEnabled(prop: string): boolean {\n return config.get(prop) == null || config.get(prop, 'enabled') !== false;\n }\n\n if (isEnabled('timing')) {\n router.use(timing());\n }\n\n if (isEnabled('logging')) {\n let defaultLoggingFormat = application.environment === 'production' ? 'combined' : 'dev';\n let defaultLoggingOptions = {\n // tslint:disable-next-line:completed-docs\n skip(): boolean {\n return application.environment === 'test';\n }\n };\n let format = config.getWithDefault('logging', 'format', defaultLoggingFormat);\n let options = defaults(config.getWithDefault('logging', {}), defaultLoggingOptions);\n router.use(morgan(format, options));\n\n // Patch morgan to read from our non-express response\n morgan.token('res', (req: IncomingMessage, res: ServerResponse, field: string) => {\n let header = res.getHeader(field);\n if (typeof header === 'number') {\n header = String(header);\n } else if (Array.isArray(header)) {\n header = header.join(', ');\n }\n return header;\n });\n }\n\n if (isEnabled('compression')) {\n router.use(compression());\n }\n\n if (isEnabled('cookies')) {\n router.use(cookies(config.get('cookies')));\n }\n\n if (isEnabled('cors')) {\n router.use(cors(config.get('cors')));\n }\n\n if (isEnabled('xssFilter')) {\n router.use(helmet.xssFilter());\n }\n\n if (isEnabled('frameguard')) {\n router.use(helmet.frameguard());\n }\n\n if (isEnabled('hidePoweredBy')) {\n router.use(helmet.hidePoweredBy());\n }\n\n if (isEnabled('ieNoOpen')) {\n router.use(helmet.ieNoOpen());\n }\n\n if (isEnabled('noSniff')) {\n router.use(helmet.noSniff());\n }\n\n}\n","import { Dict } from '../utils/types';\n\n/**\n * Base Descriptor class\n *\n * @package data\n */\nexport class Descriptor {\n\n /**\n * Creates an instance of Descriptor.\n */\n constructor(public options: Dict<any> = {}) {}\n\n}\n\nexport type BaseAttributeTypes = 'number' | 'string' | 'boolean' | 'date';\n\n/**\n * The Attribute class is used to tell Denali what the available attributes are\n * on your Model. You shouldn't use the Attribute class directly; instead,\n * import the `attr()` method from Denali, and use it to define an attribute:\n *\n * import { attr } from 'denali';\n * class Post extends ApplicationModel {\n * static title = attr('text');\n * }\n *\n * Note that attributes must be defined as `static` properties on your Model\n * class.\n *\n * The `attr()` method takes two arguments:\n *\n * * `type` - a string indicating the type of this attribute. Denali doesn't\n * care what this string is. Your ORM adapter should specify what types it\n * expects.\n * * `options` - any additional options for this attribute. At the moment,\n * these are used solely by your ORM adapter, there are no additional options\n * that Denali expects itself.\n *\n * @package data\n * @since 0.1.0\n */\nexport class AttributeDescriptor extends Descriptor {\n\n /**\n * Convenience flag for checking if this is an attribute\n *\n * @since 0.1.0\n */\n isAttribute = true;\n\n constructor(public datatype: BaseAttributeTypes | string, options: any) {\n super(options);\n }\n\n}\n\n/**\n * Syntax sugar factory method for creating Attributes\n *\n * @package data\n * @since 0.1.0\n */\nexport function attr(datatype: BaseAttributeTypes, options?: any): AttributeDescriptor {\n return new AttributeDescriptor(datatype, options);\n}\n\n\n/**\n * The HasManyRelationship class is used to describe a 1 to many or many to\n * many relationship on your Model. You shouldn't use the HasManyRelationship\n * class directly; instead, import the `hasMany()` method from Denali, and use\n * it to define a relationship:\n *\n * import { hasMany } from 'denali';\n * class Post extends ApplicationModel {\n * static comments = hasMany('comment');\n * }\n *\n * Note that relationships must be defined as `static` properties on your Model\n * class.\n *\n * The `hasMany()` method takes two arguments:\n *\n * * `type` - a string indicating the type of model for this relationship.\n * * `options` - any additional options for this attribute. At the moment,\n * these are used solely by your ORM adapter, there are no additional options\n * that Denali expects itself.\n *\n * @package data\n * @since 0.1.0\n */\nexport class HasManyRelationshipDescriptor extends Descriptor {\n\n /**\n * Convenience flag for checking if this is a relationship\n *\n * @since 0.1.0\n */\n isRelationship = true;\n\n /**\n * Relationship mode, i.e. 1 -> 1 or 1 -> N\n *\n * @since 0.1.0\n */\n mode = 'hasMany';\n\n constructor(public relatedModelName: string, options: any) {\n super(options);\n }\n\n}\n\n/**\n * Syntax sugar factory function for creating HasManyRelationships\n *\n * @package data\n * @since 0.1.0\n */\nexport function hasMany(relatedModelName: string, options?: any): HasManyRelationshipDescriptor {\n return new HasManyRelationshipDescriptor(relatedModelName, options);\n}\n\n/**\n * The HasOneRelationship class is used to describe a 1 to many or 1 to 1\n * relationship on your Model. You shouldn't use the HasOneRelationship class\n * directly; instead, import the `hasOne()` method from Denali, and use it to\n * define a relationship:\n *\n * import { hasOne } from 'denali';\n * class Post extends ApplicationModel {\n * static author = hasOne('user');\n * }\n *\n * Note that relationships must be defined as `static` properties on your Model\n * class.\n *\n * The `hasOne()` method takes two arguments:\n *\n * * `type` - a string indicating the type of model for this relationship.\n * * `options` - any additional options for this attribute. At the moment,\n * these are used solely by your ORM adapter, there are no additional options\n * that Denali expects itself.\n *\n * @package data\n * @since 0.1.0\n */\nexport class HasOneRelationshipDescriptor extends Descriptor {\n\n /**\n * Convenience flag for checking if this is a relationship\n *\n * @since 0.1.0\n */\n isRelationship = true;\n\n /**\n * Relationship mode, i.e. 1 -> 1 or 1 -> N\n *\n * @since 0.1.0\n */\n mode = 'hasOne';\n\n constructor(public relatedModelName: string, options: any) {\n super(options);\n }\n\n}\n\n/**\n * Syntax sugar factory function for creating HasOneRelationships\n *\n * @package data\n * @since 0.1.0\n */\nexport function hasOne(relatedModelName: string, options?: any): HasOneRelationshipDescriptor {\n return new HasOneRelationshipDescriptor(relatedModelName, options);\n}\n\nexport type RelationshipDescriptor = HasManyRelationshipDescriptor | HasOneRelationshipDescriptor;\n\nexport type SchemaDescriptor = AttributeDescriptor | RelationshipDescriptor;","import {\n find,\n filter,\n map,\n remove,\n values\n} from 'lodash';\nimport ORMAdapter from './orm-adapter';\nimport Model from './model';\nimport { RelationshipDescriptor } from './descriptors';\nimport * as assert from 'assert';\nimport { singularize } from 'inflection';\n\nlet guid = 0;\n\n/**\n * An in-memory ORM adapter for getting started quickly, testing, and\n * debugging. Should **not** be used for production data.\n *\n * @package data\n * @since 0.1.0\n */\nexport default class MemoryAdapter extends ORMAdapter {\n\n\n /**\n * An in-memory cache of records. Top level objects are collections of\n * records by type, indexed by record id.\n */\n _cache: { [type: string]: { [id: number]: any } } = {};\n\n /**\n * Get the collection of records for a given type, indexed by record id. If\n * the collection doesn't exist yet, create it and return the empty\n * collection.\n */\n _cacheFor(type: string): { [id: number]: any } {\n if (!this._cache[type]) {\n this._cache[type] = {};\n }\n return this._cache[type];\n }\n\n // tslint:disable:completed-docs\n\n async find(type: string, id: number): Promise<any> {\n return this._cacheFor(type)[id] || null;\n }\n\n async queryOne(type: string, query: any): Promise<any> {\n return find(this._cacheFor(type), query) || null;\n }\n\n async all(type: string): Promise<any[]> {\n return values(this._cacheFor(type));\n }\n\n async query(type: string, query: any): Promise<any[]> {\n return filter(this._cacheFor(type), query);\n }\n\n buildRecord(type: string, data: any = {}): any {\n this._cacheFor(type);\n return data;\n }\n\n idFor(model: Model) {\n return model.record.id;\n }\n\n setId(model: Model, value: number) {\n let collection = this._cacheFor(model.modelName);\n delete collection[model.record.id];\n model.record.id = value;\n collection[value] = model.record;\n }\n\n getAttribute(model: Model, property: string): any {\n return model.record[property] === undefined ? null : model.record[property];\n }\n\n setAttribute(model: Model, property: string, value: any): true {\n model.record[property] = value;\n return true;\n }\n\n deleteAttribute(model: Model, property: string): true {\n model.record[property] = null;\n return true;\n }\n\n async getRelated(model: Model, relationship: string, descriptor: RelationshipDescriptor, query: any): Promise<any|any[]> {\n let relatedCollection = this._cacheFor(descriptor.relatedModelName);\n if (descriptor.mode === 'hasMany') {\n let related = filter(relatedCollection, (relatedRecord: any) => {\n let relatedIds = model.record[`${ singularize(relationship) }_ids`];\n return relatedIds && relatedIds.includes(relatedRecord.id);\n });\n if (query) {\n related = filter(related, query);\n }\n return related;\n }\n return this.queryOne(descriptor.relatedModelName, { id: model.record[`${ relationship }_id`] });\n }\n\n async setRelated(model: Model, relationship: string, descriptor: RelationshipDescriptor, relatedModels: Model|Model[]): Promise<void> {\n if (Array.isArray(relatedModels)) {\n assert(descriptor.mode === 'hasMany', `You tried to set ${ relationship } to an array of related records, but it is a hasOne relationship`);\n model.record[`${ singularize(relationship) }_ids`] = map(relatedModels, 'record.id');\n } else {\n model.record[`${ relationship }_id`] = relatedModels.record.id;\n }\n }\n\n async addRelated(model: Model, relationship: string, descriptor: RelationshipDescriptor, relatedModel: Model): Promise<void> {\n let relatedIds = model.record[`${ singularize(relationship) }_ids`];\n if (!relatedIds) {\n relatedIds = model.record[`${ singularize(relationship) }_ids`] = [];\n }\n relatedIds.push(relatedModel.id);\n }\n\n async removeRelated(model: Model, relationship: string, descriptor: RelationshipDescriptor, relatedModel: Model): Promise<void> {\n remove(model.record[`${ singularize(relationship) }_ids`], (id) => id === relatedModel.id);\n }\n\n async saveRecord(model: Model): Promise<void> {\n let collection = this._cacheFor(model.modelName);\n if (model.record.id == null) {\n guid += 1;\n model.record.id = guid;\n }\n collection[model.record.id] = model.record;\n return model.record;\n }\n\n async deleteRecord(model: Model): Promise<void> {\n let collection = this._cacheFor(model.modelName);\n delete collection[model.record.id];\n }\n\n}\n","import * as assert from 'assert';\nimport * as util from 'util';\nimport * as createDebug from 'debug';\nimport { pluralize, singularize } from 'inflection';\nimport { forEach, startCase, kebabCase, upperFirst, pickBy } from 'lodash';\nimport DenaliObject from '../metal/object';\nimport { lookup } from '../metal/container';\nimport ORMAdapter from './orm-adapter';\nimport { AttributeDescriptor, RelationshipDescriptor, SchemaDescriptor } from './descriptors';\nimport { Dict } from '../utils/types';\n\nconst debug = createDebug('denali:model');\n\nconst augmentedWithAccessors = Symbol();\n\n/**\n * The Model class is the core of Denali's unique approach to data and ORMs. It\n * acts as a wrapper and translation layer that provides a unified interface to\n * access and manipulate data, but translates those interactions into ORM\n * specific operations via ORM adapters.\n *\n * The primary purpose of having Models in Denali is to allow Denali addons to\n * access a common interface for manipulating data. Importantly, the goal is\n * **not** to let you swap different ORMs / databases with little effort. Don't\n * be surprised if you find your app littered with ORM specific code - that is\n * expected and even encouraged. For more on this concept, check out the Denali\n * blog.\n *\n * TODO: link to blog post on ^\n *\n * @package data\n * @since 0.1.0\n */\nexport default class Model extends DenaliObject {\n\n /**\n * Marks the Model as an abstract base model, so ORM adapters can know not to\n * create tables or other supporting infrastructure.\n *\n * @since 0.1.0\n */\n static abstract = false;\n\n /**\n * The schema definition for this model. Keys are the field names, and values\n * should be either `attr(...)', `hasOne(...)`, or `hasMany(...)`\n */\n static schema: Dict<SchemaDescriptor> = {};\n\n /**\n * Returns the schema filtered down to just the attribute fields\n */\n static get attributes(): Dict<AttributeDescriptor> {\n // <any> is needed here because pickBy doesn't properly act as a type guard\n // see: https://github.com/Microsoft/TypeScript/issues/7657\n return <any>pickBy(this.schema, (descriptor: AttributeDescriptor) => descriptor.isAttribute);\n }\n\n /**\n * Returns the schema filtered down to just the relationship fields\n */\n static get relationships(): Dict<RelationshipDescriptor> {\n // <any> is needed here because pickBy doesn't properly act as a type guard\n // see: https://github.com/Microsoft/TypeScript/issues/7657\n return <any>pickBy(this.schema, (descriptor: RelationshipDescriptor) => descriptor.isRelationship);\n }\n\n private static _augmentWithSchemaAccessors() {\n if (this.prototype[augmentedWithAccessors]) {\n return;\n }\n this.prototype[augmentedWithAccessors] = true;\n forEach(this.schema, (descriptor, name) => {\n if ((<any>descriptor).isAttribute) {\n Object.defineProperty(this.prototype, name, {\n configurable: true,\n get() {\n return (<typeof Model>this.constructor).adapter.getAttribute(this, name);\n },\n set(newValue) {\n return (<typeof Model>this.constructor).adapter.setAttribute(this, name, newValue);\n }\n });\n\n } else {\n\n // author => \"Author\"\n let methodRoot = upperFirst(name);\n // getAuthor(options?)\n Object.defineProperty(this.prototype, `get${methodRoot}`, {\n configurable: true,\n value(options?: any) { return (<Model>this).getRelated(name, options); }\n });\n // setAuthor(comments, options?)\n Object.defineProperty(this.prototype, `set${methodRoot}`, {\n configurable: true,\n value(relatedModels: Model | Model[], options?: any) {\n return (<Model>this).setRelated(name, relatedModels, options);\n }\n });\n\n if ((<any>descriptor).mode === 'hasMany') {\n let singularRoot = singularize(methodRoot);\n // addComment(comment, options?)\n Object.defineProperty(this.prototype, `add${singularRoot}`, {\n configurable: true,\n value(relatedModel: Model, options?: any) {\n return (<Model>this).addRelated(name, relatedModel, options);\n }\n });\n // removeComment(comment, options?)\n Object.defineProperty(this.prototype, `remove${singularRoot}`, {\n configurable: true,\n value(relatedModel: Model, options?: any) {\n return (<Model>this).removeRelated(name, relatedModel, options);\n }\n });\n }\n\n }\n });\n }\n\n /**\n * Builds a new Model instance from an already existing ORM record reference\n *\n * @param record The ORM adapter record object\n */\n static build(record: any) {\n let model = new this();\n model.record = record;\n return model;\n }\n\n /**\n * Retrieve a single record by it's id\n *\n * @param id The id of the record you want to lookup\n * @param options Options passed through to the ORM adapter\n * @since 0.1.0\n */\n static async find(id: any, options?: any): Promise<Model|null> {\n assert(id != null, `You must pass an id to Model.find(id)`);\n debug(`${ this.modelName } find: ${ id }`);\n let record = await this.adapter.find(this.modelName, id, options);\n if (!record) {\n return null;\n }\n return this.build(record);\n }\n\n /**\n * Retrieve the first record matching the given query\n *\n * @param query The query to pass through to the ORM adapter\n * @param options An options object passed through to the ORM adapter\n * @since 0.1.0\n */\n static async queryOne(query: any, options?: any): Promise<Model|null> {\n assert(query != null, `You must pass a query to Model.queryOne(conditions)`);\n debug(`${ this.modelName } queryOne: ${ util.inspect(query) }`);\n let record = await this.adapter.queryOne(this.modelName, query, options);\n if (!record) {\n return null;\n }\n return this.build(record);\n }\n\n /**\n * Fetch all records matching the given query\n *\n * @param query The query to pass through to the ORM adapter\n * @param options An options object passed through to the ORM adapter\n * @since 0.1.0\n */\n static async query(query: any, options?: any): Promise<Model[]> {\n assert(query != null, `You must pass a query to Model.query(conditions)`);\n debug(`${ this.modelName } query: ${ util.inspect(query) }`);\n let records = await this.adapter.query(this.modelName, query, options);\n return records.map((record) => this.build(record));\n }\n\n /**\n * Fetch all records of this type\n *\n * @param options An options object passed through to the ORM adapter\n * @since 0.1.0\n */\n static async all(options?: any): Promise<Model[]> {\n debug(`${ this.modelName } all`);\n let result = await this.adapter.all(this.modelName, options);\n return result.map((record) => this.build(record));\n }\n\n /**\n * Create a new Model instance with the supplied data, and immediately\n * persist it\n *\n * @param data Data to populate the new Model instance with\n * @param options An options object passed through to the ORM adapter\n * @since 0.1.0\n */\n static async create(data: any = {}, options?: any): Promise<Model> {\n let model = new this(data, options);\n return model.save();\n }\n\n /**\n * The ORM adapter specific to this model type. Defaults to the application's\n * ORM adapter if none for this specific model type is found.\n *\n * @since 0.1.0\n */\n static get adapter(): ORMAdapter {\n return lookup<ORMAdapter>(`orm-adapter:${ this.modelName }`);\n }\n\n /**\n * The name of this Model type. Used in a variety of use cases, including\n * serialization.\n *\n * @since 0.1.0\n */\n static get modelName(): string {\n let name = this.name;\n if (name.endsWith('Model')) {\n name = name.substring(0, name.length - 'Model'.length);\n }\n name = kebabCase(name);\n return name;\n }\n\n [key: string]: any;\n\n /**\n * The underlying ORM adapter record. An opaque value to Denali, handled\n * entirely by the ORM adapter.\n *\n * @since 0.1.0\n */\n record: any = null;\n\n /**\n * The name of this Model type. Used in a variety of use cases, including\n * serialization.\n *\n * @since 0.1.0\n */\n get modelName(): string {\n return (<typeof Model>this.constructor).modelName;\n }\n\n /**\n * The id of the record\n *\n * @since 0.1.0\n */\n get id(): any {\n return (<typeof Model>this.constructor).adapter.idFor(this);\n }\n set id(value: any) {\n (<typeof Model>this.constructor).adapter.setId(this, value);\n }\n\n /**\n * Tell the underlying ORM to build this record\n */\n constructor(data?: any, options?: any) {\n super();\n (<typeof Model>this.constructor)._augmentWithSchemaAccessors();\n this.record = (<typeof Model>this.constructor).adapter.buildRecord(this.modelName, data, options);\n }\n\n /**\n * Persist this model.\n *\n * @since 0.1.0\n */\n async save(options?: any): Promise<Model> {\n debug(`saving ${ this.toString()}`);\n await (<typeof Model>this.constructor).adapter.saveRecord(this, options);\n return this;\n }\n\n /**\n * Delete this model.\n *\n * @since 0.1.0\n */\n async delete(options?: any): Promise<void> {\n debug(`deleting ${ this.toString() }`);\n await (<typeof Model>this.constructor).adapter.deleteRecord(this, options);\n }\n\n /**\n * Returns the related record(s) for the given relationship.\n *\n * @since 0.1.0\n */\n async getRelated(relationshipName: string, options?: any): Promise<Model|Model[]> {\n let descriptor: RelationshipDescriptor = <RelationshipDescriptor>(<typeof Model>this.constructor).schema[relationshipName];\n assert(descriptor && descriptor.isRelationship, `You tried to fetch related ${ relationshipName }, but no such relationship exists on ${ this.modelName }`);\n let RelatedModel = lookup<typeof Model>(`model:${ descriptor.relatedModelName }`);\n let results = await (<typeof Model>this.constructor).adapter.getRelated(this, relationshipName, descriptor, options);\n if (descriptor.mode === 'hasOne') {\n assert(!Array.isArray(results), `The ${ this.modelName } ORM adapter returned an array for the hasOne '${ relationshipName }' relationship - it should return either an ORM record or null.`);\n return results ? RelatedModel.create(results) : null;\n }\n assert(Array.isArray(results), `The ${ this.modelName } ORM adapter did not return an array for the hasMany '${ relationshipName }' relationship - it should return an array (empty if no related records exist).`);\n return results.map((record: any) => RelatedModel.build(record));\n }\n\n /**\n * Replaces the related records for the given relationship with the supplied\n * related records.\n *\n * @since 0.1.0\n */\n async setRelated(relationshipName: string, relatedModels: Model|Model[], options?: any): Promise<void> {\n let descriptor: RelationshipDescriptor = <RelationshipDescriptor>(<typeof Model>this.constructor).schema[relationshipName];\n await (<typeof Model>this.constructor).adapter.setRelated(this, relationshipName, descriptor, relatedModels, options);\n }\n\n /**\n * Add a related record to a hasMany relationship.\n *\n * @since 0.1.0\n */\n async addRelated(relationshipName: string, relatedModel: Model, options?: any): Promise<void> {\n let descriptor: RelationshipDescriptor = <RelationshipDescriptor>(<typeof Model>this.constructor).schema[pluralize(relationshipName)];\n await (<typeof Model>this.constructor).adapter.addRelated(this, relationshipName, descriptor, relatedModel, options);\n }\n\n /**\n * Remove the given record from the hasMany relationship\n *\n * @since 0.1.0\n */\n async removeRelated(relationshipName: string, relatedModel: Model, options?: any): Promise<void> {\n let descriptor: RelationshipDescriptor = <RelationshipDescriptor>(<typeof Model>this.constructor).schema[pluralize(relationshipName)];\n await (<typeof Model>this.constructor).adapter.removeRelated(this, relationshipName, descriptor, relatedModel, options);\n }\n\n /**\n * Return an human-friendly string representing this Model instance, with a\n * summary of it's attributes\n *\n * @since 0.1.0\n */\n inspect(): string {\n let attributesSummary: string[] = [];\n forEach((<typeof Model>this.constructor).schema, (descriptor, name) => {\n attributesSummary.push(`${ name }=${ util.inspect(this[name]) }`);\n });\n return `<${ startCase(this.modelName) }:${ this.id == null ? '-new-' : this.id } ${ attributesSummary.join(', ') }>`;\n }\n\n /**\n * Return an human-friendly string representing this Model instance\n *\n * @since 0.1.0\n */\n toString(): string {\n return `<${ startCase(this.modelName) }:${ this.id == null ? '-new-' : this.id }>`;\n }\n}\n","import DenaliObject from '../metal/object';\nimport Model from './model';\nimport { RelationshipDescriptor } from './descriptors';\n\n/**\n * The ORMAdapter class is responsible for enabling Denali to communicate with\n * the ORM of your choice. It does this by boiling down the possible actions\n * that a user might before against a Model that would involve persistence into\n * a set of basic operations. Your adapter then implements these operations,\n * and Denali can build on top of that.\n *\n * Most of the values passed between your application code and the underlying\n * ORM are opaque to Denali. This means that Denali has no idea what that\n * `query` object looks like or does - it just blindly hands it off to your\n * ORM adapter, which can plug it into the ORM interface appropriately.\n *\n * Most instance-level methods are given a reference to the Denali Model\n * instance that is being acted upon. Most ORM adapters will use that model\n * instance to access `model.record`, which is the slot used to store the\n * instance of the ORM's record. However, the full Model instance is supplied\n * to provide the adapter with maximum flexibility.\n *\n * The ORM adapter interface was designed to be a high enough abstraction that\n * most data stores should support most of the operations. However, it is not\n * required that an adapter support all of the operations - for example, not\n * all data stores support changing a record's ID. In those cases, the adapter\n * method may simply throw.\n *\n * @package data\n * @since 0.1.0\n */\nexport default abstract class ORMAdapter extends DenaliObject {\n\n /**\n * The current test transaction, if applicable. See `startTestTransaction()`\n * for details\n *\n * @since 0.1.0\n */\n testTransaction: any;\n\n /**\n * Find a single record by it's id.\n *\n * @since 0.1.0\n */\n abstract async find(type: string, id: any, options: any): Promise<any>;\n\n /**\n * Find a single record that matches the given query.\n *\n * @since 0.1.0\n */\n abstract async queryOne(type: string, query: any, options: any): Promise<any>;\n\n /**\n * Find all records of this type.\n *\n * @since 0.1.0\n */\n abstract async all(type: string, options: any): Promise<any[]>;\n\n /**\n * Find all records that match the given query.\n *\n * @since 0.1.0\n */\n abstract async query(type: string, query: any, options: any): Promise<any[]>;\n\n /**\n * Return the id for the given model.\n *\n * @since 0.1.0\n */\n abstract idFor(model: Model): any;\n\n /**\n * Set the id for the given model. If the ORM does not support updating ids,\n * this method may throw.\n *\n * @since 0.1.0\n */\n abstract setId(model: Model, value: any): void;\n\n /**\n * Build an internal record instance of the given type with the given data.\n * Note that this method should return the internal, ORM representation of\n * the record, not a Denali Model.\n *\n * @since 0.1.0\n */\n abstract buildRecord(type: string, data: any, options: any): any;\n\n /**\n * Return the value for the given attribute on the given record.\n *\n * @since 0.1.0\n */\n abstract getAttribute(model: Model, attribute: string): any;\n\n /**\n * Set the value for the given attribute on the given record.\n *\n * @returns returns true if set operation was successful\n * @since 0.1.0\n */\n abstract setAttribute(model: Model, attribute: string, value: any): boolean;\n\n /**\n * Delete the value for the given attribute on the given record. The\n * semantics of this may behave slightly differently depending on backend -\n * SQL databases may NULL out the value, while document stores like Mongo may\n * actually delete the key from the document (rather than just nulling it\n * out). It is up to the adapter to decide what \"deletion\" means in this\n * context, and ideally should document such behavior.\n *\n * @returns returns true if delete operation was successful\n * @since 0.1.0\n */\n abstract deleteAttribute(model: Model, attribute: string): boolean;\n\n /**\n * Return the related record(s) for the given relationship.\n *\n * @param model The model whose related records are being fetched\n * @param relationship The name of the relationship on the model that should be fetched\n * @param descriptor The RelationshipDescriptor of the relationship being fetch\n * @param query An optional query to filter the related records by\n * @since 0.1.0\n */\n abstract async getRelated(model: Model, relationship: string, descriptor: RelationshipDescriptor, options: any): Promise<any|any[]>;\n\n /**\n * Set the related record(s) for the given relationship. Note: for has-many\n * relationships, the entire set of existing related records should be\n * replaced by the supplied records. The old related records should be\n * \"unlinked\" in their relationship. Whether that results in the deletion of\n * those old records is up to the ORM adapter, although it is recommended\n * that they not be deleted unless the user has explicitly expressed that\n * intent in some way (i.e. via configuration flags on the model class, or\n * the supplied options object)\n *\n * @param model The model whose related records are being altered\n * @param relationship The name of the relationship on the model that should\n * be altered\n * @param descriptor The RelationshipDescriptor of the relationship being\n * altered\n * @param related The related record(s) that should be linked to the given\n * relationship\n * @since 0.1.0\n */\n abstract async setRelated(model: Model, relationship: string, descriptor: RelationshipDescriptor, related: any, options: any): Promise<void>;\n\n /**\n * Add related record(s) to a hasMany relationship. Existing related records\n * should remain unaltered.\n *\n * @param model The model whose related records are being altered\n * @param relationship The name of the relationship on the model that should\n * be altered\n * @param descriptor The RelationshipDescriptor of the relationship being\n * altered\n * @param related The related record(s) that should be linked to the given\n * relationship\n * @since 0.1.0\n */\n abstract async addRelated(model: Model, relationship: string, descriptor: RelationshipDescriptor, related: Model|Model[], options: any): Promise<void>;\n\n /**\n * Remove related record(s) from a hasMany relationship. Note: The removed\n * related records should be \"unlinked\" in their relationship. Whether that\n * results in the deletion of those old records is up to the ORM adapter,\n * although it is recommended that they not be deleted unless the user has\n * explicitly expressed that intent.\n *\n * @param model The model whose related records are being altered\n * @param relationship The name of the relationship on the model that should\n * be altered\n * @param descriptor The RelationshipDescriptor of the relationship being\n * altered\n * @param related The related record(s) that should be removed from the\n * relationship; if not provided, then all related records should be removed\n * @since 0.1.0\n */\n abstract async removeRelated(model: Model, relationship: string, descriptor: RelationshipDescriptor, related: Model|Model[]|null, options: any): Promise<void>;\n\n /**\n * Persist the supplied model.\n *\n * @since 0.1.0\n */\n abstract async saveRecord(model: Model, options: any): Promise<void>;\n\n /**\n * Delete the supplied model from the persistent data store.\n *\n * @since 0.1.0\n */\n abstract async deleteRecord(model: Model, options: any): Promise<void>;\n\n /**\n * Takes an array of Denali Models and defines an ORM specific model class,\n * and/or any other ORM specific setup that might be required for that Model.\n *\n * @since 0.1.0\n */\n async defineModels?<T extends typeof Model>(models: T[]): Promise<void>;\n\n /**\n * Start a transaction that will wrap a test, and be rolled back afterwards.\n * If the data store doesn't support transactions, just omit this method. Only\n * one test transaction will be opened per process, and the ORM adapter is\n * responsible for keeping track of that transaction so it can later be rolled\n * back.\n *\n * @since 0.1.0\n */\n async startTestTransaction?(): Promise<void>;\n\n /**\n * Roll back the test transaction.\n *\n * @since 0.1.0\n */\n async rollbackTestTransaction?(): Promise<void>;\n\n}\n","/**\n *\n * This is the main module exported by Denali when it is loaded via\n * `require/import`.\n *\n * This exports convenient shortcuts to other modules within Denali.\n * Rather than having to `import Addon from 'denali/lib/runtime/addon'`,\n * you can just `import { Addon } from 'denali'`.\n *\n */\n\n// Data\nimport {\n attr,\n hasMany,\n hasOne,\n RelationshipDescriptor,\n HasOneRelationshipDescriptor,\n HasManyRelationshipDescriptor,\n AttributeDescriptor\n} from './data/descriptors';\nimport Model from './data/model';\nimport ORMAdapter from './data/orm-adapter';\nimport MemoryAdapter from './data/memory';\n\n// Render\nimport Serializer from './render/serializer';\nimport JSONSerializer from './render/json';\nimport JSONAPISerializer from './render/json-api';\nimport View from './render/view';\n\n// Parse\nimport Parser from './parse/parser';\nimport JSONParser from './parse/json';\nimport JSONAPIParser from './parse/json-api';\n\n// Metal\nimport Instrumentation from './metal/instrumentation';\nimport mixin, {\n createMixin,\n MixinFactory,\n MixinApplicator\n} from './metal/mixin';\nimport container, { lookup, Container } from './metal/container';\nimport Resolver from './metal/resolver';\nimport DenaliObject from './metal/object';\n\n// Runtime\nimport Action, {\n RenderOptions,\n ResponderParams\n} from './runtime/action';\nimport Addon from './runtime/addon';\nimport Application from './runtime/application';\nimport Errors from './runtime/errors';\nimport Logger from './runtime/logger';\nimport Request from './runtime/request';\nimport Router from './runtime/router';\nimport Service from './runtime/service';\nimport ConfigService from './runtime/config';\n\n// Test\nimport setupAcceptanceTest, { AcceptanceTest, AcceptanceTestContext } from './test/acceptance-test';\nimport setupUnitTest, { UnitTest } from './test/unit-test';\nimport MockRequest from './test/mock-request';\nimport MockResponse from './test/mock-response';\n\n\nexport {\n // Data\n attr,\n hasMany,\n hasOne,\n RelationshipDescriptor,\n HasOneRelationshipDescriptor,\n HasManyRelationshipDescriptor,\n AttributeDescriptor,\n Model,\n ORMAdapter,\n MemoryAdapter,\n\n // Render\n View,\n Serializer,\n JSONSerializer,\n JSONAPISerializer,\n\n // Parse\n Parser,\n JSONParser,\n JSONAPIParser,\n\n // Metal\n Instrumentation,\n mixin,\n createMixin,\n MixinFactory,\n MixinApplicator,\n Container,\n container,\n lookup,\n Resolver,\n DenaliObject,\n\n // Runtime\n Action,\n Addon,\n Application,\n Errors,\n Logger,\n Request,\n Router,\n Service,\n RenderOptions,\n ResponderParams,\n ConfigService,\n\n // Test\n setupAcceptanceTest,\n AcceptanceTest,\n AcceptanceTestContext,\n setupUnitTest,\n UnitTest,\n MockRequest,\n MockResponse\n\n};\n","import * as assert from 'assert';\nimport { defaults, forEach, forOwn, uniq, zipObject } from 'lodash';\nimport Resolver from './resolver';\nimport { Dict, Constructor } from '../utils/types';\nimport strings from '../utils/strings';\nimport * as crawl from 'tree-crawl';\nimport Loader from '@denali-js/loader';\n\nconst DEFAULT_OPTIONS = {\n singleton: true,\n fallbacks: <string[]>[]\n};\n\nexport interface ContainerOptions {\n /**\n * The container should treat the member as a singleton. If true, the\n * container will create that singleton on the first lookup.\n */\n singleton?: boolean;\n /**\n * What should the container fallback to if it's unable to find a specific\n * entry under the given type? This is used to allow for the common\n * \"application\" fallback entry, i.e. if you don't define a model-specific\n * ORM adapter, then because the `orm-adapter` type has `fallbacks: [\n * 'application' ]`, the container will return the ApplicationORMAdapter\n * instead.\n */\n fallbacks?: string[];\n}\n\n/**\n * The Container is the dependency injection solution for Denali. It is\n * responsible for managing the lifecycle of objects (i.e. singletons),\n * as well as orchestrating dependency lookup. This provides two key benefits:\n *\n * * Apps can consume classes that originate from anywhere in the addon\n * dependency tree, without needing to care/specify where.\n * * We can more easily test parts of the framework by mocking out container\n * entries instead of dealing with hardcoding dependencies\n *\n * @package metal\n * @since 0.1.0\n */\nexport class Container {\n\n /**\n * Manual registrations that should override resolver retrieved values\n */\n protected registry: Dict<any> = {};\n\n /**\n * An array of resolvers used to retrieve container members. Resolvers are\n * tried in order, first to find the member wins. Normally, each addon will\n * supply it's own resolver, allowing for addon order and precedence when\n * looking up container entries.\n */\n protected resolvers: Resolver[] = [];\n\n /**\n * Internal cache of lookup values\n */\n protected lookups: Dict<any> = {};\n\n /**\n * The top level loader for the entire bundle\n */\n loader: Loader;\n\n /**\n * Default options for container entries. Keyed on specifier or type. See\n * ContainerOptions.\n */\n protected options: Dict<ContainerOptions> = {\n app: { singleton: true },\n 'app:application': { singleton: false },\n action: { singleton: false },\n config: { singleton: false },\n initializer: { singleton: false },\n 'orm-adapter': { singleton: true, fallbacks: [ 'orm-adapter:application' ] },\n model: { singleton: false },\n parser: { singleton: true, fallbacks: [ 'parser:application' ] },\n serializer: { singleton: true, fallbacks: [ 'serializer:application' ] },\n service: { singleton: true },\n view: { singleton: true }\n };\n\n /**\n * Take a top level bundle loader and load it into this container\n */\n loadBundle(loader: Loader) {\n this.loader = loader;\n crawl(loader, this.loadBundleScope.bind(this), {\n order: 'bfs',\n getChildren(loader: Loader) {\n return Array.from(loader.children.values());\n }\n });\n }\n\n /**\n * Load a bundle scope into the container. A bundle scope typically\n * corresponds to an addon. Each bundle scope can provide it's own resolver to\n * tell the consuming app how to look things up within the bundle scope. If\n * no resolver is supplied, Denali will use the default Denali resolver.\n */\n loadBundleScope(loader: Loader) {\n let LoaderResolver: typeof Resolver;\n try {\n LoaderResolver = loader.load<typeof Resolver>('resolver');\n } catch (e) {\n LoaderResolver = Resolver;\n }\n let resolver = new LoaderResolver(loader);\n this.resolvers.push(resolver);\n loader.resolver = resolver;\n }\n\n /**\n * Add a manual registration that will take precedence over any resolved\n * lookups.\n *\n * @since 0.1.0\n */\n register(specifier: string, entry: any, options?: ContainerOptions) {\n this.registry[specifier] = entry;\n if (options) {\n forOwn(options, (value, key: keyof ContainerOptions) => {\n this.setOption(specifier, key, value);\n });\n }\n }\n\n /**\n * Lookup the given specifier in the container. If options.loose is true,\n * failed lookups will return undefined rather than throw.\n *\n * @since 0.1.0\n * @param options.loose if the entry is not found, don't throw, just return `false`\n * @param options.raw Ignore the cache, and lookup the underlying container\n * value rather than any singletons; mostly useful for tests, you should rarely use\n * this option, and at your own risk\n */\n lookup<T = any>(specifier: string, options?: { raw?: true }): T;\n lookup<T = any>(specifier: string, options?: { raw?: true, loose: true }): T | false;\n lookup<T>(specifier: string, options: { raw?: true, loose?: boolean } = {}): T | false {\n // Raw lookups skip caching and singleton behavior\n if (options.raw) {\n let entry = this.lookupRaw<T>(specifier);\n if (entry === false && !options.loose) {\n throw new ContainerEntryNotFound(specifier, this.registry, this.resolvers);\n }\n return entry;\n }\n // I can haz cache hit plz?\n if (this.lookups[specifier]) {\n return this.lookups[specifier];\n }\n\n // Not in cache - first lookup. Get the underlying value first\n let entry = this.lookupRaw<T>(specifier);\n // If that works - handle singletons, cache, and call it good\n if (entry !== false) {\n entry = this.instantiateSingletons<T>(specifier, entry);\n this.lookups[specifier] = entry;\n return entry;\n }\n\n // Not in cache and no underlying entry found. Can we fallback?\n let fallbacks = this.getOption(specifier, 'fallbacks').slice(0);\n let fallback;\n while ((fallback = fallbacks.shift()) && (fallback !== specifier)) {\n entry = this.lookup<T>(fallback, options);\n if (entry) {\n break;\n }\n }\n if (entry !== false) {\n // No singleton instantiation here - the recursion into lookup should\n // handle that\n this.lookups[specifier] = entry;\n return entry;\n }\n\n if (options.loose) {\n return false;\n }\n\n throw new ContainerEntryNotFound(specifier, this.registry, this.resolvers);\n }\n\n protected instantiateSingletons<T>(specifier: string, entry: T): T {\n // Instantiate if it's a singleton\n let singleton = this.getOption(specifier, 'singleton');\n if (singleton) {\n let Class = <Constructor<T>>(<any>entry);\n assert(typeof Class === 'function', strings.ContainerEntryNotAConstructor(specifier, Class));\n return new Class();\n }\n return entry;\n }\n\n /**\n * Recursive lookup method that takes a specifier and fallback specifiers.\n * Checks manual registrations first, then iterates through each resolver. If\n * the entry is still not found, it recurses through the fallback options\n * before ultimatley throwing (or returning false if loose: true)\n */\n protected lookupRaw<T>(specifier: string): T | false {\n // Manual registrations take precedence\n let entry = <T>this.registry[specifier];\n\n // Try each resolver in order\n if (!entry) {\n forEach(this.resolvers, (resolver) => {\n entry = resolver.retrieve<T>(specifier);\n if (entry) {\n return false;\n }\n });\n }\n\n return entry == null ? false : entry;\n }\n\n /**\n * Lookup all the entries for a given type in the container. This will ask\n * all resolvers to eagerly load all classes for this type. Returns an object\n * whose keys are container specifiers and values are the looked up values\n * for those specifiers.\n *\n * @since 0.1.0\n */\n lookupAll<T = any>(type: string): Dict<T> {\n let entries = this.availableForType(type);\n let values = entries.map((entry) => this.lookup(`${ type }:${ entry }`));\n return <Dict<T>>zipObject(entries, values);\n }\n\n /**\n * Returns an array of entry names for all entries under this type.\n *\n * @since 0.1.0\n */\n availableForType(type: string): string[] {\n let registrations = Object.keys(this.registry).filter((specifier) => {\n return specifier.startsWith(type);\n });\n let resolved = this.resolvers.reverse().reduce((entries, resolver) => {\n return entries.concat(resolver.availableForType(type));\n }, []);\n return uniq(registrations.concat(resolved)).map((specifier) => specifier.split(':')[1]);\n }\n\n /**\n * Return the value for the given option on the given specifier. Specifier\n * may be a full specifier or just a type.\n *\n * @since 0.1.0\n */\n getOption<U extends keyof ContainerOptions>(specifier: string, optionName: U): ContainerOptions[U] {\n let [ type ] = specifier.split(':');\n let options = defaults(this.options[specifier], this.options[type], DEFAULT_OPTIONS);\n return options[optionName];\n }\n\n /**\n * Set the option for the given specifier or type.\n *\n * @since 0.1.0\n */\n setOption(specifier: string, optionName: keyof ContainerOptions, value: any): void {\n if (!this.options[specifier]) {\n this.options[specifier] = Object.assign({}, DEFAULT_OPTIONS);\n }\n this.options[specifier][optionName] = value;\n }\n\n /**\n * Clear any cached lookups for this specifier. You probably don't want to\n * use this. The only significant use case is for testing to allow test\n * containers to override an already looked up value.\n */\n clearCache(specifier: string) {\n delete this.lookups[specifier];\n }\n\n /**\n * Empties the entire container, including removing all resolvers and the\n * loader, as well as emptying all caches. The primary use case is for\n * unit testing, when you want a clean slate environment to selectively\n * add things back to.\n */\n clear() {\n this.lookups = {};\n this.registry = {};\n this.resolvers = [];\n this.loader = null;\n }\n\n /**\n * Given container-managed singletons a chance to cleanup on application\n * shutdown\n *\n * @since 0.1.0\n */\n teardown() {\n forEach(this.lookups, (instance) => {\n if (typeof instance.teardown === 'function') {\n instance.teardown();\n }\n });\n }\n\n}\n\nclass ContainerEntryNotFound extends Error {\n constructor(specifier: string, registry: { [specifier: string]: any }, resolvers: Resolver[]) {\n let message = strings.ContainerEntryNotFound(specifier, Object.keys(registry), resolvers.map((r) => r.name));\n super(message);\n }\n}\n\n// The exports here are unusual - rather than exporting the Container class, we\n// actually instantiate the container and export that. This is because all\n// Denali code is loaded via a bundle, and there is only one container instance\n// per bundle. Instantiating it here allows us to treat the container as\n// effectively a global variable, which allows for *much* more convenient use\n// (otherwise, the container would need to control instantiation of every object\n// to ensure each object could get a reference to the container instance).\nconst container = new Container();\nexport default container;\nexport const lookup: typeof Container.prototype.lookup = container.lookup.bind(container);\n","import * as EventEmitter from 'events';\nimport { merge } from 'lodash';\n\n/**\n * The Instrumentation class is a low level class for instrumenting your app's\n * code. It allows you to listen to framework level profiling events, as well\n * as creating and firing your own such events.\n *\n * For example, if you wanted to instrument how long a particular action was\n * taking:\n *\n * import { Instrumentation, Action } from 'denali';\n * export default class MyAction extends Action {\n * respond() {\n * let Post = this.modelFor('post');\n * return Instrumentation.instrument('post lookup', { currentUser: this.user.id }, () => {\n * Post.find({ user: this.user });\n * });\n * }\n * }\n *\n * @package metal\n */\nexport default class InstrumentationEvent {\n\n /**\n * The internal event emitter used for notifications\n */\n protected static _emitter = new EventEmitter();\n\n /**\n * Subscribe to be notified when a particular instrumentation block completes.\n */\n static subscribe(eventName: string, callback: (event: InstrumentationEvent) => void) {\n this._emitter.on(eventName, callback);\n }\n\n /**\n * Unsubscribe from being notified when a particular instrumentation block completes.\n */\n static unsubscribe(eventName: string, callback?: (event: InstrumentationEvent) => void) {\n this._emitter.removeListener(eventName, callback);\n }\n\n /**\n * Run the supplied function, timing how long it takes to complete. If the function returns a\n * promise, the timer waits until that promise resolves. Returns a promise that resolves with the\n * return value of the supplied function. Fires an event with the given event name and event data\n * (the function result is provided as well).\n */\n static instrument(eventName: string, data: any): InstrumentationEvent {\n return new InstrumentationEvent(eventName, data);\n }\n\n /**\n * Emit an InstrumentationEvent to subscribers\n */\n static emit(eventName: string, event: InstrumentationEvent): void {\n this._emitter.emit(eventName, event);\n }\n\n /**\n * The name of this instrumentation even\n */\n eventName: string;\n\n /**\n * The duration of the instrumentation event (calculated after calling `.finish()`)\n */\n duration: number;\n\n /**\n * Additional data supplied for this event, either at the start or finish of the event.\n */\n data: any;\n\n /**\n * High resolution start time of this event\n */\n protected startTime: [ number, number ];\n\n constructor(eventName: string, data: any) {\n this.eventName = eventName;\n this.data = data;\n this.startTime = process.hrtime();\n }\n\n /**\n * Finish this event. Records the duration, and fires an event to any subscribers. Any data\n * provided here is merged with any previously provided data.\n */\n finish(data?: any): void {\n this.duration = process.hrtime(this.startTime)[1];\n this.data = merge({}, this.data, data);\n InstrumentationEvent.emit(this.eventName, this);\n }\n\n}\n","import * as assert from 'assert';\n\nexport interface MixinApplicator<T, U extends T> {\n (...args: any[]): MixinApplicator<T, U>;\n _args: any[];\n _factory: MixinFactory<T, U>;\n}\n\nexport interface MixinFactory<T, U extends T> {\n (baseClass: T, ...args: any[]): U;\n}\n\n/**\n * ES6 classes don't provide any native syntax or support for compositional\n * mixins. This helper method provides that support:\n *\n * import { mixin } from 'denali';\n * import MyMixin from '../mixins/my-mixin';\n * import ApplicationAction from './application';\n *\n * export default class MyAction extends mixin(ApplicationAction, MyMixin) {\n * // ...\n * }\n *\n * Objects that extend from Denali's Object class automatically get a static\n * `mixin` method to make the syntax a bit more familiar:\n *\n * export default class MyAction extends ApplicationAction.mixin(MyMixin) {\n *\n * ## How it works\n *\n * Since ES6 classes are based on prototype chains, and protoype chains are\n * purely linear (you can't have two prototypes of a single object), we\n * implement mixins by creating anonymous intermediate subclasses for each\n * applied mixin.\n *\n * Mixins are defined as factory functions that take a base class and extend it\n * with their own mixin properties/methods. When these mixin factory functions\n * are applied, they are called in order, with the result of the last mixin\n * feeding into the base class of the next mixin factory.\n *\n * ## Use sparingly!\n *\n * Mixins can be useful in certain circumstances, but use them sparingly. They\n * add indirection that can be surprising or confusing to later developers who\n * encounter the code. Wherever possible, try to find alternatives that make\n * the various dependencies of your code clear.\n *\n * @package metal\n * @since 0.1.0\n */\nexport default function mixin(baseClass: Function, ...mixins: any[]): any {\n return <any>mixins.reduce((currentBase: Function, mixinFactory: MixinApplicator<any, any>) => {\n let appliedClass = mixinFactory._factory(currentBase, ...mixinFactory._args);\n assert(typeof appliedClass === 'function', `Invalid mixin (${ appliedClass }) - did you forget to return your mixin class from the createMixin method?`);\n return appliedClass;\n }, baseClass);\n}\n\n/**\n * Creates a mixin factory function wrapper. These wrapper functions have the\n * special property that they can be invoked an arbitrary number of times, and\n * each time will cache the arguments to be handed off to the actual factory\n * function.\n *\n * This is useful to allow per-use options for your mixin. For example:\n *\n * class ProtectedAction extends Action.mixin(authenticate({ ... })) {\n *\n * In that example, the optons object provided to the `authenticate` mixin\n * function will be cached, and once the mixin factory function is invoked, it\n * will be provided as an additional argument:\n *\n * createMixin((BaseClass, options) => {\n *\n * @package metal\n * @since 0.1.0\n */\nexport function createMixin<T, U extends T>(mixinFactory: MixinFactory<T, U>): MixinApplicator<T, U> {\n let cacheMixinArguments = <MixinApplicator<T, U>>function(...args: any[]): MixinApplicator<T, U> {\n cacheMixinArguments._args.push(...args);\n return cacheMixinArguments;\n };\n cacheMixinArguments._args = [];\n cacheMixinArguments._factory = mixinFactory;\n return cacheMixinArguments;\n}\n","import mixin, { MixinApplicator } from './mixin';\n\n/**\n * The base object class for Denali classes. Adds mixin support and a stubbed\n * `teardown` method.\n *\n * @package metal\n * @since 0.1.0\n */\nexport default class DenaliObject {\n\n /**\n * Apply mixins using this class as the base class. Pure syntactic sugar for\n * the `mixin` helper.\n */\n static mixin(...mixins: MixinApplicator<any, any>[]): any {\n return <any>mixin(this, ...mixins);\n }\n\n /**\n * A hook invoked when an application is torn down. Only invoked on\n * singletons stored in the container.\n */\n teardown(): void {\n // Default is no-op\n }\n\n}\n","import { camelCase, upperFirst, uniq, constant } from 'lodash';\nimport * as path from 'path';\nimport { pluralize } from 'inflection';\nimport * as assert from 'assert';\nimport * as createDebug from 'debug';\nimport Loader from '@denali-js/loader';\n\ninterface RetrieveMethod<T> {\n (type: string, entry: string): T;\n}\n\nexport interface AvailableForTypeMethod {\n (type: string): string[];\n}\n\nexport type Registry = Map<string, any>;\n\nexport default class Resolver {\n\n /**\n * The loader scope to retrieve from\n */\n loader: Loader;\n\n /**\n * The debug logger instance for this resolver - we create a separate\n * instance per resolver to make it easier to trace resolutions.\n */\n debug: any;\n\n /**\n * The name of this resolver - typically the addon name\n *\n * @since 0.1.0\n */\n name: string;\n\n /**\n * The internal cache of available references\n */\n protected registry: Registry = new Map();\n\n constructor(loader?: Loader) {\n assert(loader, 'You must supply a loader that the resolver should use to load from');\n this.name = loader.pkgName;\n this.debug = createDebug(`denali:resolver:${ this.name }`);\n this.loader = loader;\n }\n\n /**\n * Manually add a member to this resolver. Manually registered members take\n * precedence over any retrieved from the filesystem. This same pattern\n * exists at the container level, but having it here allows an addon to\n * specify a manual override _for it's own scope_, but not necessarily force\n * it onto the consuming application\n *\n * @since 0.1.0\n */\n register(specifier: string, value: any) {\n assert(specifier.includes(':'), 'Container specifiers must be in \"type:entry\" format');\n this.registry.set(specifier, value);\n }\n\n /**\n * Fetch the member matching the given parsedName. First checks for any\n * manually registered members, then falls back to type specific retrieve\n * methods that typically find the matching file on the filesystem.\n *\n * @since 0.1.0\n */\n retrieve<T>(specifier: string): T {\n assert(specifier.includes(':'), 'Container specifiers must be in \"type:entry\" format');\n this.debug(`retrieving ${ specifier }`);\n let [ type, entry ] = specifier.split(':');\n if (this.registry.has(specifier)) {\n this.debug(`cache hit, returning cached value`);\n return this.registry.get(specifier);\n }\n let retrieveMethod = <RetrieveMethod<T>>(<any>this)[`retrieve${ upperFirst(camelCase(type)) }`];\n if (!retrieveMethod) {\n retrieveMethod = <RetrieveMethod<T>>this.retrieveOther;\n }\n this.debug(`retrieving via retrieve${ upperFirst(camelCase(type)) }`);\n let result = retrieveMethod.call(this, type, entry);\n result = result && result.default || result;\n this.debug('retrieved %o', result);\n return result;\n }\n\n protected _retrieve(type: string, entry: string, relativepath: string) {\n this.debug(`attempting to retrieve ${ type }:${ entry } at ${ relativepath } from ${ this.name }`);\n return this.loader.loadRelative('/', relativepath, constant(false));\n }\n\n /**\n * Unknown types are assumed to exist underneath the `app/` folder\n */\n protected retrieveOther(type: string, entry: string) {\n return this._retrieve(type, entry, path.join('/app', pluralize(type), entry));\n }\n\n /**\n * App files are found in `app/*`\n */\n protected retrieveApp(type: string, entry: string) {\n return this._retrieve(type, entry, path.join('/app', entry));\n }\n\n /**\n * Config files are found in `config/`\n */\n protected retrieveConfig(type: string, entry: string) {\n return this._retrieve(type, entry, path.join('/config', entry));\n }\n\n /**\n * Initializer files are found in `config/initializers/`\n */\n protected retrieveInitializer(type: string, entry: string) {\n return this._retrieve(type, entry, path.join('/config', 'initializers', entry));\n }\n\n /**\n * Returns an array of entry names that are available from this resolver for\n * the given type.\n *\n * @since 0.1.0\n */\n availableForType(type: string) {\n let registeredForType: string[] = [];\n this.registry.forEach((entry, specifier) => {\n if (specifier.split(':')[0] === type) {\n registeredForType.push(specifier);\n }\n });\n let availableMethod = <AvailableForTypeMethod>(<any>this)[`availableFor${ upperFirst(camelCase(type)) }`];\n if (!availableMethod) {\n availableMethod = this.availableForOther;\n }\n let entries = <string[]>availableMethod.call(this, type);\n let resolvedEntries = entries.map((entry) => `${ type }:${ entry }`);\n return uniq(registeredForType.sort().concat(resolvedEntries.sort()));\n }\n\n protected _availableForType(prefix: string): string[] {\n let matchingFactories = Array.from(this.loader.factories.keys()).filter((moduleName) => {\n return moduleName.startsWith(prefix);\n });\n return matchingFactories.map((factoryPath) => factoryPath.substring(prefix.length + 1));\n }\n\n /**\n * Unknown types are assumed to exist in the `app/` folder\n */\n protected availableForOther(type: string) {\n return this._availableForType(path.join('/app', pluralize(type)));\n }\n\n /**\n * App files are found in `app/*`\n */\n protected availableForApp(type: string, entry: string) {\n return this._availableForType('/app');\n }\n\n /**\n * Config files are found in the `config/` folder. Initializers are _not_ included in this group\n */\n protected availableForConfig(type: string) {\n return this._availableForType('/config');\n }\n\n /**\n * Initializers files are found in the `config/initializers/` folder\n */\n protected availableForInitializer(type: string) {\n return this._availableForType(path.join('/config', 'initializers'));\n }\n\n}\n","import {\n isArray,\n mapKeys,\n camelCase\n} from 'lodash';\nimport * as assert from 'assert';\nimport JSONParser from './json';\nimport Errors from '../runtime/errors';\nimport { ResponderParams } from '../runtime/action';\nimport Request from '../runtime/request';\nimport setIfNotEmpty from '../utils/set-if-not-empty';\nimport { singularize } from 'inflection';\nimport {\n ResourceObject as JSONAPIResourceObject,\n AttributesObject as JSONAPIAttributesObject,\n RelationshipsObject as JSONAPIRelationshipsObject\n} from 'jsonapi-typescript';\nimport { Dict } from '../utils/types';\n\n/**\n * Parses incoming request bodies according to the JSON-API specification. For\n * incoming payloads with `included` arrays, the primary `data` is returned\n * under the `body` key, and `included` is moved to it's own property.\n *\n * @package parse\n * @since 0.1.0\n */\nexport default class JSONAPIParser extends JSONParser {\n\n /**\n * The media type for JSON-API requests. If the incoming request doesn't have\n * this Content Type, the parser will immediately render a 400 Bad Request response\n */\n type = 'application/vnd.api+json';\n\n async parse(request: Request) {\n let body = await this.bufferAndParseBody(request);\n\n let result: ResponderParams = {\n query: request.query,\n headers: request.headers,\n params: request.params\n };\n\n if (!request.hasBody) {\n return result;\n }\n\n try {\n assert(request.getHeader('content-type') === 'application/vnd.api+json', 'Invalid content type - must have `application/vnd.api+json` as the request content type');\n assert(body.data, 'Invalid JSON-API document (missing top level `data` object - see http://jsonapi.org/format/#document-top-level)');\n\n let parseResource = this.parseResource.bind(this);\n\n if (body.data) {\n if (!isArray(body.data)) {\n result.body = parseResource(body.data);\n } else {\n result.body = body.data.map(parseResource);\n }\n }\n\n if (body.included) {\n result.included = body.included.map(parseResource);\n }\n\n return result;\n } catch (e) {\n if (e.name === 'AssertionError') {\n throw new Errors.BadRequest(e.message);\n }\n throw e;\n }\n }\n\n\n /**\n * Parse a single resource object from a JSONAPI document. The resource\n * object could come from the top level `data` payload, or from the\n * sideloaded `included` records.\n *\n * @since 0.1.0\n */\n protected parseResource(resource: JSONAPIResourceObject): any {\n let parsedResource: Dict<any> = {};\n setIfNotEmpty(parsedResource, 'id', this.parseId(resource.id));\n Object.assign(parsedResource, this.parseAttributes(resource.attributes));\n Object.assign(parsedResource, this.parseRelationships(resource.relationships));\n return parsedResource;\n }\n\n /**\n * Parse a resource object id\n *\n * @since 0.1.0\n */\n protected parseId(id: string): any {\n return id;\n }\n\n /**\n * Parse a resource object's type string\n *\n * @since 0.1.0\n */\n protected parseType(type: string): string {\n return singularize(type);\n }\n\n /**\n * Parse a resource object's attributes. By default, this converts from the\n * JSONAPI recommended dasheried keys to camelCase.\n *\n * @since 0.1.0\n */\n protected parseAttributes(attrs: JSONAPIAttributesObject): any {\n return mapKeys(attrs, (value, key) => {\n return camelCase(key);\n });\n }\n\n /**\n * Parse a resource object's relationships. By default, this converts from\n * the JSONAPI recommended dasheried keys to camelCase.\n *\n * @since 0.1.0\n */\n protected parseRelationships(relationships: JSONAPIRelationshipsObject): any {\n return mapKeys(relationships, (value, key) => {\n return camelCase(key);\n });\n }\n\n}\n","import Parser from './parser';\nimport Request from '../runtime/request';\nimport { json } from 'body-parser';\nimport { Response, RequestHandler } from 'express';\nimport { fromNode } from 'bluebird';\nimport { ResponderParams } from '../runtime/action';\n\ndeclare module 'body-parser' {\n interface OptionsJson {\n verify(req: Request, res: any, buf: Buffer, encoding: string): void;\n }\n}\n\n/**\n * Parses incoming request bodies as JSON payloads.\n *\n * @package parse\n * @since 0.1.0\n */\nexport default class JSONParser extends Parser {\n\n /**\n * When set to true, then deflated (compressed) bodies will be inflated; when\n * false, deflated bodies are rejected. Defaults to true.\n *\n * @since 0.1.0\n */\n inflate = true;\n\n /**\n * Controls the maximum request body size. If this is a number, then the\n * value specifies the number of bytes; if it is a string, the value is\n * passed to the bytes library for parsing. Defaults to '100kb'.\n *\n * @since 0.1.0\n */\n limit = '100kb';\n\n /**\n * The reviver option is passed directly to JSON.parse as the second\n * argument.\n *\n * @since 0.1.0\n */\n reviver: (key: string, value: any) => any;\n\n /**\n * When set to true, will only accept arrays and objects; when false will\n * accept anything JSON.parse accepts. Defaults to true.\n *\n * @since 0.1.0\n */\n strict = true;\n\n /**\n * The type option is used to determine what media type the middleware will\n * parse. This option can be a function or a string. If a string, type option\n * is passed directly to the type-is library and this can be an extension\n * name (like json), a mime type (like application/json), or a mime type with\n * a wildcard. If a function, the type option is called as fn(req) and the\n * request is parsed if it returns a truthy value. Defaults to\n * application/json.\n *\n * @since 0.1.0\n */\n type = 'application/json';\n\n /**\n * The verify option, if supplied, is called as verify(req, res, buf,\n * encoding), where buf is a Buffer of the raw request body and encoding is\n * the encoding of the request. The parsing can be aborted by throwing an\n * error.\n *\n * @since 0.1.0\n */\n verify: (req: Request, res: Response, buf: Buffer, encoding: string) => void;\n\n protected jsonParserMiddleware: RequestHandler;\n\n protected async bufferAndParseBody(request: Request) {\n await fromNode((cb) => {\n if (!this.jsonParserMiddleware) {\n this.jsonParserMiddleware = json({\n inflate: this.inflate,\n limit: this.limit,\n reviver: this.reviver,\n strict: this.strict,\n type: this.type,\n verify: this.verify\n });\n }\n this.jsonParserMiddleware(<any>request.incomingMessage, <any>{}, cb)\n });\n return (<any>request.incomingMessage).body;\n }\n\n async parse(request: Request) {\n let body = await this.bufferAndParseBody(request);\n\n return <ResponderParams>{\n body,\n query: request.query,\n headers: request.headers,\n params: request.params\n };\n }\n\n\n}\n","import DenaliObject from '../metal/object';\nimport Request from '../runtime/request';\nimport { ResponderParams } from '../runtime/action';\n\n/**\n * Denali's Parsers are responsible for taking the incoming request body of an\n * HTTP request and transforming it into a consistent object structure that can\n * be used by Actions.\n *\n * For example, if your app uses JSON-API, you can use the JSON-API parser to\n * transform the incoming JSON-API request body structure into something easier\n * to work with in your Action layer.\n *\n * Other examples of common tasks include parsing and type casting query\n * params, and transforming keys (i.e. kebab-case to camelCase).\n *\n * @package parse\n * @since 0.1.0\n */\nexport default abstract class Parser extends DenaliObject {\n\n /**\n * Take an incoming request and return an object that will be passed in as\n * the argument to your Action.\n *\n * The object should include some common properties:\n *\n * body - usually the primary data payload of the incoming request\n * query - parsed and typecast query string parameters\n * headers - the headers of the incoming HTTP request\n * params - parsed and typecast parameters from the dynamic segments of the\n * incoming request URL\n *\n * Beyond that, each parser can add it's own additional properties based on\n * how it parses. For example, the JSON-API parser adds any sideloaded\n * records from the request body under the `included` property.\n *\n * @since 0.1.0\n */\n abstract async parse(request: Request): Promise<ResponderParams>;\n\n}\n","import { assign, isArray, isUndefined, kebabCase, uniqBy } from 'lodash';\nimport * as assert from 'assert';\nimport * as path from 'path';\nimport { pluralize } from 'inflection';\nimport Serializer from './serializer';\nimport Model from '../data/model';\nimport Router from '../runtime/router';\nimport Action, { RenderOptions } from '../runtime/action';\nimport { RelationshipDescriptor } from '../data/descriptors';\nimport { lookup } from '../metal/container';\nimport { RelationshipConfig } from './serializer';\nimport { map } from 'bluebird';\nimport setIfNotEmpty from '../utils/set-if-not-empty';\nimport * as JSONAPI from '../utils/json-api';\n\nexport interface Options extends RenderOptions {\n /**\n * An array of Models you want to ensure are included in the \"included\" sideload. Note that the\n * spec requires \"full-linkage\" - i.e. any Models you include here must be referenced by a\n * resource identifier elsewhere in the payload - to maintain full compliance.\n */\n included?: Model[];\n /**\n * Any top level metadata to send with the response.\n */\n meta?: JSONAPI.Meta;\n /**\n * Any top level links to send with the response.\n */\n links?: JSONAPI.Links;\n [key: string]: any;\n}\n\n/**\n * Used internally to simplify passing arguments required by all functions.\n */\nexport interface Context {\n action: Action;\n body: any;\n options: Options;\n document: JSONAPI.Document;\n}\n\n/**\n * Renders the payload according to the JSONAPI 1.0 spec, including related\n * resources, included records, and support for meta and links.\n *\n * @package data\n * @since 0.1.0\n */\nexport default abstract class JSONAPISerializer extends Serializer {\n\n /**\n * The default content type to use for any responses rendered by this serializer.\n *\n * @since 0.1.0\n */\n contentType = 'application/vnd.api+json';\n\n /**\n * Take a response body (a model, an array of models, or an Error) and render\n * it as a JSONAPI compliant document\n *\n * @since 0.1.0\n */\n async serialize(body: any, action: Action, options: RenderOptions): Promise<JSONAPI.Document> {\n let context: Context = {\n action,\n body,\n options,\n document: {}\n };\n await this.renderPrimary(context);\n await this.renderIncluded(context);\n this.renderMeta(context);\n this.renderLinks(context);\n this.renderVersion(context);\n this.dedupeIncluded(context);\n return context.document;\n }\n\n /**\n * Render the primary payload for a JSONAPI document (either a model or array\n * of models).\n *\n * @since 0.1.0\n */\n protected async renderPrimary(context: Context): Promise<void> {\n let payload = context.body;\n if (isArray(payload)) {\n await this.renderPrimaryArray(context, payload);\n } else {\n await this.renderPrimaryObject(context, payload);\n }\n }\n\n /**\n * Render the primary data for the document, either a single Model or a\n * single Error.\n *\n * @since 0.1.0\n */\n protected async renderPrimaryObject(context: Context, payload: any): Promise<void> {\n if (payload instanceof Error) {\n context.document.errors = [ await this.renderError(context, payload) ];\n } else {\n context.document.data = await this.renderRecord(context, payload);\n }\n }\n\n /**\n * Render the primary data for the document, either an array of Models or\n * Errors\n *\n * @since 0.1.0\n */\n protected async renderPrimaryArray(context: Context, payload: any): Promise<void> {\n if (payload[0] instanceof Error) {\n context.document.errors = await map(payload, async (error: Error) => {\n assert(error instanceof Error, 'You passed a mixed array of errors and models to the JSON-API serializer. The JSON-API spec does not allow for both `data` and `errors` top level objects in a response');\n return await this.renderError(context, error);\n });\n } else {\n context.document.data = await map(payload, async (record: Model) => {\n assert(!(record instanceof Error), 'You passed a mixed array of errors and models to the JSON-API serializer. The JSON-API spec does not allow for both `data` and `errors` top level objects in a response');\n return await this.renderRecord(context, record);\n });\n }\n }\n\n /**\n * Render any included records supplied by the options into the top level of\n * the document\n *\n * @since 0.1.0\n */\n protected async renderIncluded(context: Context): Promise<void> {\n if (context.options.included) {\n assert(isArray(context.options.included), 'included records must be passed in as an array');\n context.document.included = await map(context.options.included, async (includedRecord) => {\n return await this.renderRecord(context, includedRecord);\n });\n }\n }\n\n /**\n * Render top level meta object for a document. Default uses meta supplied in\n * options call to res.render().\n *\n * @since 0.1.0\n */\n protected renderMeta(context: Context): void {\n if (context.options.meta) {\n context.document.meta = context.options.meta;\n }\n }\n\n /**\n * Render top level links object for a document. Defaults to the links\n * supplied in options.\n *\n * @since 0.1.0\n */\n protected renderLinks(context: Context): void {\n if (context.options.links) {\n context.document.links = context.options.links;\n }\n }\n\n /**\n * Render the version of JSONAPI supported.\n *\n * @since 0.1.0\n */\n protected renderVersion(context: Context): void {\n context.document.jsonapi = {\n version: '1.0'\n };\n }\n\n /**\n * Render the supplied record as a resource object.\n *\n * @since 0.1.0\n */\n protected async renderRecord(context: Context, record: Model): Promise<JSONAPI.ResourceObject> {\n assert(record, `Cannot serialize ${ record }. You supplied ${ record } instead of a Model instance.`);\n let serializedRecord: JSONAPI.ResourceObject = {\n type: pluralize(record.modelName),\n id: record.id\n };\n assert(serializedRecord.id != null, `Attempted to serialize a record (${ record }) without an id, but the JSON-API spec requires all resources to have an id.`);\n setIfNotEmpty(serializedRecord, 'attributes', this.attributesForRecord(context, record));\n setIfNotEmpty(serializedRecord, 'relationships', await this.relationshipsForRecord(context, record));\n setIfNotEmpty(serializedRecord, 'links', this.linksForRecord(context, record));\n setIfNotEmpty(serializedRecord, 'meta', this.metaForRecord(context, record));\n return serializedRecord;\n }\n\n /**\n * Returns the JSONAPI attributes object representing this record's\n * relationships\n *\n * @since 0.1.0\n */\n protected attributesForRecord(context: Context, record: Model): JSONAPI.Attributes {\n let serializedAttributes: JSONAPI.Attributes = {};\n let attributes = this.attributesToSerialize(context.action, context.options);\n attributes.forEach((attributeName) => {\n let key = this.serializeAttributeName(context, attributeName);\n let rawValue = record[attributeName];\n if (!isUndefined(rawValue)) {\n let value = this.serializeAttributeValue(context, rawValue, key, record);\n serializedAttributes[key] = value;\n }\n });\n return serializedAttributes;\n }\n\n /**\n * The JSONAPI spec recommends (but does not require) that property names be\n * dasherized. The default implementation of this serializer therefore does\n * that, but you can override this method to use a different approach.\n *\n * @since 0.1.0\n */\n protected serializeAttributeName(context: Context, name: string): string {\n return kebabCase(name);\n }\n\n /**\n * Take an attribute value and return the serialized value. Useful for\n * changing how certain types of values are serialized, i.e. Date objects.\n *\n * The default implementation returns the attribute's value unchanged.\n *\n * @since 0.1.0\n */\n protected serializeAttributeValue(context: Context, value: any, key: string, record: Model): any {\n return value;\n }\n\n /**\n * Returns the JSONAPI relationships object representing this record's\n * relationships\n *\n * @since 0.1.0\n */\n protected async relationshipsForRecord(context: Context, record: Model): Promise<JSONAPI.Relationships> {\n let serializedRelationships: JSONAPI.Relationships = {};\n let relationships = this.relationshipsToSerialize(context.action, context.options);\n\n // The result of this.relationships is a whitelist of which relationships should be serialized,\n // and the configuration for their serialization\n let relationshipNames = Object.keys(relationships);\n for (let name of relationshipNames) {\n let config = relationships[name];\n let key = config.key || this.serializeRelationshipName(context, name);\n let descriptor = <RelationshipDescriptor>(<typeof Model>record.constructor).schema[name];\n assert(descriptor, `You specified a '${ name }' relationship in your ${ record.modelName } serializer, but no such relationship is defined on the ${ record.modelName } model`);\n serializedRelationships[key] = await this.serializeRelationship(context, name, config, descriptor, record);\n }\n\n return serializedRelationships;\n }\n\n /**\n * Convert the relationship name to it's \"over-the-wire\" format. Defaults to\n * dasherizing it.\n *\n * @since 0.1.0\n */\n protected serializeRelationshipName(context: Context, name: string): string {\n return kebabCase(name);\n }\n\n /**\n * Takes the serializer config and the model's descriptor for a relationship,\n * and returns the serialized relationship object. Also sideloads any full\n * records if the relationship is so configured.\n *\n * @since 0.1.0\n */\n protected async serializeRelationship(context: Context, name: string, config: RelationshipConfig, descriptor: RelationshipDescriptor, record: Model): Promise<JSONAPI.Relationship> {\n let relationship: JSONAPI.Relationship = {};\n setIfNotEmpty(relationship, 'links', this.linksForRelationship(context, name, config, descriptor, record));\n setIfNotEmpty(relationship, 'meta', this.metaForRelationship(context, name, config, descriptor, record));\n setIfNotEmpty(relationship, 'data', await this.dataForRelationship(context, name, config, descriptor, record));\n return relationship;\n }\n\n /**\n * Returns the serialized form of the related Models for the given record and\n * relationship.\n *\n * @since 0.1.0\n */\n protected async dataForRelationship(context: Context, name: string, config: RelationshipConfig, descriptor: RelationshipDescriptor, record: Model): Promise<JSONAPI.RelationshipData> {\n let relatedData = await record.getRelated(name);\n if (descriptor.mode === 'hasMany') {\n return await map(<Model[]>relatedData, async (relatedRecord) => {\n return await this.dataForRelatedRecord(context, name, relatedRecord, config, descriptor, record);\n });\n }\n return await this.dataForRelatedRecord(context, name, <Model>relatedData, config, descriptor, record);\n }\n\n /**\n * Given a related record, return the resource object for that record, and\n * sideload the record as well.\n *\n * @since 0.1.0\n */\n protected async dataForRelatedRecord(context: Context, name: string, relatedRecord: Model, config: RelationshipConfig, descriptor: RelationshipDescriptor, record: Model): Promise<JSONAPI.ResourceIdentifier> {\n await this.includeRecord(context, name, relatedRecord, config, descriptor);\n return {\n type: pluralize(relatedRecord.modelName),\n id: relatedRecord.id\n };\n }\n\n /**\n * Takes a relationship descriptor and the record it's for, and returns any\n * links for that relationship for that record. I.e. '/books/1/author'\n *\n * @since 0.1.0\n */\n protected linksForRelationship(context: Context, name: string, config: RelationshipConfig, descriptor: RelationshipDescriptor, record: Model): JSONAPI.Links {\n let recordLinks = this.linksForRecord(context, record);\n let recordURL: string;\n if (recordLinks) {\n if (typeof recordLinks.self === 'string') {\n recordURL = recordLinks.self;\n } else {\n recordURL = recordLinks.self.href;\n }\n return {\n self: path.join(recordURL, `relationships/${ name }`),\n related: path.join(recordURL, name)\n };\n }\n return null;\n }\n\n /**\n * Returns any meta for a given relationship and record. No meta included by\n * default.\n *\n * @since 0.1.0\n */\n protected metaForRelationship(context: Context, name: string, config: RelationshipConfig, descriptor: RelationshipDescriptor, record: Model): JSONAPI.Meta | void {\n // defaults to no meta content\n }\n\n /**\n * Returns links for a particular record, i.e. self: \"/books/1\". Default\n * implementation assumes the URL for a particular record maps to that type's\n * `show` action, i.e. `books/show`.\n *\n * @since 0.1.0\n */\n protected linksForRecord(context: Context, record: Model): JSONAPI.Links {\n let router = lookup<Router>('app:router');\n let url = router.urlFor(`${ pluralize(record.modelName) }/show`, record);\n return typeof url === 'string' ? { self: url } : null;\n }\n\n /**\n * Returns meta for a particular record.\n *\n * @since 0.1.0\n */\n protected metaForRecord(context: Context, record: Model): void | JSONAPI.Meta {\n // defaults to no meta\n }\n\n /**\n * Sideloads a record into the top level \"included\" array\n *\n * @since 0.1.0\n */\n protected async includeRecord(context: Context, name: string, relatedRecord: Model, config: RelationshipConfig, descriptor: RelationshipDescriptor): Promise<void> {\n assert(relatedRecord, 'You tried to sideload an included record, but the record itself was not provided.');\n if (!isArray(context.document.included)) {\n context.document.included = [];\n }\n let relatedOptions = (context.options.relationships && context.options.relationships[name]) || context.options;\n let relatedSerializer = lookup<JSONAPISerializer>(`serializer:${ config.serializer || relatedRecord.modelName }`);\n let relatedContext: Context = assign({}, context, { options: relatedOptions });\n context.document.included.push(await relatedSerializer.renderRecord(relatedContext, relatedRecord));\n }\n\n /**\n * Render the supplied error\n *\n * @since 0.1.0\n */\n protected renderError(context: Context, error: any): JSONAPI.ErrorObject {\n let renderedError: JSONAPI.ErrorObject = {\n status: String(error.status) || '500',\n code: error.code || error.name || 'InternalServerError',\n detail: error.message\n };\n setIfNotEmpty(renderedError, 'id', this.idForError(context, error));\n setIfNotEmpty(renderedError, 'title', this.titleForError(context, error));\n setIfNotEmpty(renderedError, 'source', this.sourceForError(context, error));\n setIfNotEmpty(renderedError, 'meta', this.metaForError(context, error));\n setIfNotEmpty(renderedError, 'links', this.linksForError(context, error));\n return renderedError;\n }\n\n /**\n * Given an error, return a unique id for this particular occurence of the\n * problem.\n *\n * @since 0.1.0\n */\n protected idForError(context: Context, error: any): string {\n return error.id;\n }\n\n /**\n * A short, human-readable summary of the problem that SHOULD NOT change from\n * occurrence to occurrence of the problem, except for purposes of\n * localization.\n *\n * @since 0.1.0\n */\n protected titleForError(context: Context, error: any): string {\n return error.title;\n }\n\n /**\n * Given an error, return a JSON Pointer, a URL query param name, or other\n * info indicating the source of the error.\n *\n * @since 0.1.0\n */\n protected sourceForError(context: Context, error: any): string {\n return error.source;\n }\n\n /**\n * Return the meta for a given error object. You could use this for example,\n * to return debug information in development environments.\n *\n * @since 0.1.0\n */\n protected metaForError(context: Context, error: any): JSONAPI.Meta | void {\n return error.meta;\n }\n\n /**\n * Return a links object for an error. You could use this to link to a bug\n * tracker report of the error, for example.\n *\n * @since 0.1.0\n */\n protected linksForError(context: Context, error: any): JSONAPI.Links | void {\n // defaults to no links\n }\n\n /**\n * Remove duplicate entries from the sideloaded data.\n *\n * @since 0.1.0\n */\n protected dedupeIncluded(context: Context): void {\n if (isArray(context.document.included)) {\n context.document.included = uniqBy(context.document.included, (resource) => {\n return `${ resource.type }/${ resource.id }`;\n });\n }\n }\n\n}\n","import {\n isArray,\n assign,\n isUndefined\n} from 'lodash';\nimport * as assert from 'assert';\nimport { all } from 'bluebird';\nimport Serializer, { RelationshipConfig } from './serializer';\nimport Model from '../data/model';\nimport Action, { RenderOptions } from '../runtime/action';\nimport { RelationshipDescriptor } from '../data/descriptors';\nimport { lookup } from '../metal/container';\n\n/**\n * Renders the payload as a flat JSON object or array at the top level. Related\n * models are embedded.\n *\n * @package data\n * @since 0.1.0\n */\nexport default abstract class JSONSerializer extends Serializer {\n\n /**\n * The default content type to apply to responses formatted by this\n * serializer\n *\n * @since 0.1.0\n */\n contentType = 'application/json';\n\n /**\n * Renders the payload, either a primary data model(s) or an error payload.\n *\n * @since 0.1.0\n */\n async serialize(body: any, action: Action, options: RenderOptions = {}): Promise<any> {\n if (body instanceof Error) {\n return this.renderError(body, action, options);\n }\n return this.renderPrimary(body, action, options);\n }\n\n /**\n * Renders a primary data payload (a model or array of models).\n *\n * @since 0.1.0\n */\n protected async renderPrimary(payload: any, action: Action, options: RenderOptions): Promise<any> {\n if (isArray(payload)) {\n return await all(payload.map(async (item) => {\n return await this.renderItem(item, action, options);\n }));\n }\n return await this.renderItem(payload, action, options);\n }\n\n /**\n * If the primary data isn't a model, just render whatever it is directly\n *\n * @since 0.1.0\n */\n async renderItem(item: any, action: Action, options: RenderOptions) {\n if (item instanceof Model) {\n return await this.renderModel(item, action, options);\n }\n return item;\n }\n\n /**\n * Renders an individual model\n *\n * @since 0.1.0\n */\n async renderModel(model: Model, action: Action, options: RenderOptions): Promise<any> {\n let id = model.id;\n let attributes = this.serializeAttributes(model, action, options);\n let relationships = await this.serializeRelationships(model, action, options);\n return assign({ id }, attributes, relationships);\n }\n\n /**\n * Serialize the attributes for a given model\n *\n * @since 0.1.0\n */\n protected serializeAttributes(model: Model, action: Action, options: RenderOptions): any {\n let serializedAttributes: any = {};\n let attributes = this.attributesToSerialize(action, options);\n attributes.forEach((attributeName) => {\n let key = this.serializeAttributeName(attributeName);\n let rawValue = model[attributeName];\n if (!isUndefined(rawValue)) {\n let value = this.serializeAttributeValue(rawValue, key, model);\n serializedAttributes[key] = value;\n }\n });\n return serializedAttributes;\n }\n\n /**\n * Transform attribute names into their over-the-wire representation. Default\n * behavior uses the attribute name as-is.\n *\n * @since 0.1.0\n */\n protected serializeAttributeName(attributeName: string): string {\n return attributeName;\n }\n\n /**\n * Take an attribute value and return the serialized value. Useful for\n * changing how certain types of values are serialized, i.e. Date objects.\n *\n * The default implementation returns the attribute's value unchanged.\n *\n * @since 0.1.0\n */\n protected serializeAttributeValue(value: any, key: string, model: any): any {\n return value;\n }\n\n /**\n * Serialize the relationships for a given model\n *\n * @since 0.1.0\n */\n protected async serializeRelationships(model: Model, action: Action, options: RenderOptions): Promise<{ [key: string]: any }> {\n let serializedRelationships: { [key: string ]: any } = {};\n let relationships = this.relationshipsToSerialize(action, options);\n\n // The result of this.relationships is a whitelist of which relationships\n // should be serialized, and the configuration for their serialization\n for (let relationshipName in this.relationships) {\n let config = relationships[relationshipName];\n let key = config.key || this.serializeRelationshipName(relationshipName);\n let descriptor = <RelationshipDescriptor>(<typeof Model>model.constructor).schema[relationshipName];\n assert(descriptor, `You specified a '${ relationshipName }' relationship in your ${ this.constructor.name } serializer, but no such relationship is defined on the ${ model.modelName } model`);\n serializedRelationships[key] = await this.serializeRelationship(relationshipName, config, descriptor, model, action, options);\n }\n\n return serializedRelationships;\n }\n\n /**\n * Serializes a relationship\n *\n * @since 0.1.0\n */\n protected async serializeRelationship(relationship: string, config: RelationshipConfig, descriptor: RelationshipDescriptor, model: Model, action: Action, options: RenderOptions) {\n let relatedSerializer = lookup<JSONSerializer>(`serializer:${ descriptor.relatedModelName }`, { loose: true }) || lookup<JSONSerializer>(`serializer:application`, { loose: true });\n if (typeof relatedSerializer === 'boolean') {\n throw new Error(`No serializer found for ${ descriptor.relatedModelName }, and no fallback application serializer found either`);\n }\n if (descriptor.mode === 'hasMany') {\n let relatedModels = <Model[]>await model.getRelated(relationship);\n return await all(relatedModels.map(async (relatedModel: Model) => {\n if (config.strategy === 'embed') {\n return await (<JSONSerializer>relatedSerializer).renderModel(relatedModel, action, options);\n } else if (config.strategy === 'id') {\n return relatedModel.id;\n }\n }));\n } else {\n let relatedModel = <Model>await model.getRelated(relationship);\n if (config.strategy === 'embed') {\n return await relatedSerializer.renderModel(relatedModel, action, options);\n } else if (config.strategy === 'id') {\n return relatedModel.id;\n }\n }\n }\n\n /**\n * Transform relationship names into their over-the-wire representation.\n * Default behavior uses the relationship name as-is.\n *\n * @since 0.1.0\n */\n protected serializeRelationshipName(name: string): string {\n return name;\n }\n\n /**\n * Render an error payload\n *\n * @since 0.1.0\n */\n protected renderError(error: any, action: Action, options: any): any {\n return {\n status: error.status || 500,\n code: error.code || 'InternalServerError',\n message: error.message\n };\n }\n\n}\n","import View from './view';\nimport { ServerResponse } from 'http';\nimport Action, { RenderOptions } from '../runtime/action';\nimport Errors from '../runtime/errors';\nimport result from '../utils/result';\nimport { lookup } from '../metal/container';\n\nexport interface RelationshipConfig {\n strategy?: 'embed' | 'id' | string;\n key?: string;\n serializer?: string;\n}\n\nexport interface RelationshipConfigs {\n [relationshipName: string]: RelationshipConfig;\n}\n\n/**\n * Serializers allow you to customize what data is returned in the response and\n * apply simple transformations to it. They allow you to decouple what data is\n * sent from how that data is structured / rendered.\n *\n * @package data\n * @since 0.1.0\n */\nexport default abstract class Serializer extends View {\n\n /**\n * The content type header to send back with the response\n *\n * @since 0.1.0\n */\n protected contentType = 'application/json';\n\n /**\n * The list of attribute names that should be serialized. Attributes not\n * included in this list will be omitted from the final rendered payload.\n *\n * @since 0.1.0\n */\n protected abstract attributes: ((...args: any[]) => string[]) | string[];\n\n /**\n * An object with configuration on how to serialize relationships.\n * Relationships that have no configuration present are omitted from the\n * final rendered payload.\n *\n * Out of the box, one option is supported:\n *\n * **strategy**\n *\n * It has one of two possible values:\n *\n * * `embed`: embed all related records in the response payload\n * * `id`: include only the id of the related record(s)\n *\n * What the embedded records or ids look like is up to each serializer to\n * determine.\n *\n * @since 0.1.0\n */\n protected abstract relationships: ((...args: any[]) => RelationshipConfigs) | RelationshipConfigs;\n\n /**\n * Convenience method to encapsulate standard attribute whitelist behavior -\n * render options take precedence, then allow this.attributes to be a\n * function or straight definition\n *\n * @since 0.1.0\n */\n protected attributesToSerialize(action: Action, options: RenderOptions) {\n return options.attributes || result(this.attributes, action);\n }\n\n /**\n * Convenience method to encapsulate standard relationship whitelist behavior\n * - render options take precedence, then allow this.relationships to be a\n * function or straight definition\n *\n * @since 0.1.0\n */\n protected relationshipsToSerialize(action: Action, options: RenderOptions) {\n return options.relationships || result(this.relationships, action);\n }\n\n async render(action: Action, response: ServerResponse, body: any, options: RenderOptions): Promise<void> {\n response.setHeader('Content-type', this.contentType);\n if (body instanceof Errors) {\n response.statusCode = body.status;\n }\n body = await this.serialize(body, action, options);\n let isProduction = lookup('config:environment').environment === 'production';\n response.write(JSON.stringify(body , null, isProduction ? 0 : 2) || '');\n response.end();\n }\n\n protected abstract async serialize(body: any, action: Action, options: RenderOptions): Promise<any>;\n\n}\n","import DenaliObject from '../metal/object';\nimport { ServerResponse } from 'http';\nimport Action, { RenderOptions } from '../runtime/action';\n\nexport default abstract class View extends DenaliObject {\n\n abstract async render(action: Action, response: ServerResponse, body: any, options: RenderOptions): Promise<void>;\n\n}\n","import { isArray, flatMap, clone, get, castArray } from 'lodash';\nimport * as protochain from 'protochain';\nimport Instrumentation from '../metal/instrumentation';\nimport Model from '../data/model';\nimport Parser from '../parse/parser';\nimport * as createDebug from 'debug';\nimport * as assert from 'assert';\nimport DenaliObject from '../metal/object';\nimport Request from './request';\nimport Errors from './errors';\nimport View from '../render/view';\nimport { ServerResponse } from 'http';\nimport Serializer from '../render/serializer';\nimport { lookup } from '../metal/container';\nimport Logger from './logger';\nimport ConfigService from './config';\nimport { RelationshipConfigs } from '../render/serializer';\n\nconst debug = createDebug('denali:action');\n\nexport interface Responder {\n (params: ResponderParams): any;\n}\n\n/**\n * The parser determines the exact shape and structure of the arguments object\n * passed into your Action's respond method. However, the common convention is\n * to at least expose the properties listed below.\n *\n * *Note for Typescript users:*\n *\n * It's possible to have a parser that returns a query object with non-string\n * properties (i.e. your parser automatically converts the `page=4` query param\n * into a number). In that case, you should probably define your own interface\n * that extends from this, and use that interface to type your respond method\n * argument.\n */\nexport interface ResponderParams {\n body?: any;\n query?: any;\n headers?: any;\n params?: any;\n [key: string]: any;\n}\n\nexport interface RenderOptions {\n /**\n * The view class that should be used to render this response. Overrides the\n * `serializer` setting. This is useful if you want complete, low-level\n * control over the rendering process - you'll have direct access to the\n * response object, and can use it to render however you want. Render with a\n * streaming JSON renderer, use an HTML templating engine, a binary protocol,\n * etc.\n */\n view?: string;\n /**\n * Explicitly set the name of the serializer that should be used to render\n * this response. If not provided, and the response body is a Model or array\n * of Models, it will try to find a matching serializer and use that. If it\n * can't find the matching serializer, or if the response body is another\n * kind of object, it will fall back to the application serializer.\n */\n serializer?: string;\n /**\n * Override which attributes should be serialized.\n */\n attributes?: string[];\n /**\n * Override which relationships should be serialized.\n */\n relationships?: RelationshipConfigs;\n [key: string]: any;\n}\n\nconst beforeFiltersCache = new Map<typeof Action, Filter[]>();\nconst afterFiltersCache = new Map<typeof Action, Filter[]>();\n\nexport interface Filter {\n (params: ResponderParams): boolean | void;\n}\nexport type FilterSpecifier = string | Filter;\n\n/**\n * Actions form the core of interacting with a Denali application. They are the\n * controller layer in the MVC architecture, taking in incoming requests,\n * performing business logic, and handing off to the renderer to send the\n * response.\n *\n * When a request comes in, Denali will invoke the `respond` method on the\n * matching Action class. The return value (or resolved return value) of this\n * method is used to render the response.\n *\n * Actions also support filters. Simply define a method on your action, and add\n * the method name to the `before` or `after` array. Filters behave similar to\n * responders in that they receive the request params and can return a promise\n * which will be waited on before continuing. Filters are inheritable, so child\n * classes will run filters added by parent classes.\n *\n * @package runtime\n * @since 0.1.0\n */\nexport default abstract class Action extends DenaliObject {\n\n /**\n * Invoked before the `respond()` method. The framework will invoke filters\n * from parent classes and mixins in the same order the mixins were applied.\n *\n * Filters can be synchronous, or return a promise (which will pause the\n * before/respond/after chain until it resolves).\n *\n * If a before filter returns any value (or returns a promise which resolves\n * to any value) other than null or undefined, Denali will attempt to render\n * that response and halt further processing of the request (including\n * remaining before filters).\n *\n * Filters must be defined as static properties to allow Denali to extract\n * the values. Instance fields are not visible until instantiation, so\n * there's no way to build an \"accumulated\" value from each step in the\n * inheritance chain.\n *\n * @since 0.1.0\n */\n static before: FilterSpecifier[] = [];\n\n /**\n * Invoked after the `respond()` method. The framework will invoke filters\n * from parent classes and mixins in the same order the mixins were applied.\n *\n * Filters can be synchronous, or return a promise (which will pause the\n * before/respond/after chain until it resolves).\n *\n * Filters must be defined as static properties to allow Denali to extract\n * the values. Instance fields are not visible until instantiation, so\n * there's no way to build an \"accumulated\" value from each step in the\n * inheritance chain.\n *\n * @since 0.1.0\n */\n static after: FilterSpecifier[] = [];\n\n /**\n * Application config\n *\n * @since 0.1.0\n */\n config = lookup<ConfigService>('service:config');\n\n /**\n * Force which parser should be used for parsing the incoming request.\n *\n * By default it uses the application parser, but you can override with the\n * name of the parser you'd rather use instead.\n *\n * @since 0.1.0\n */\n parser = lookup<Parser>('parser:application');\n\n /**\n * Automatically inject the logger into all actions\n *\n * @since 0.1.0\n */\n logger = lookup<Logger>('app:logger');\n\n /**\n * The incoming Request that this Action is responding to.\n *\n * @since 0.1.0\n */\n request: Request;\n\n /**\n * The outgoing HTTP server response\n *\n * @since 0.1.0\n */\n response: ServerResponse;\n\n /**\n * Track whether or not we have rendered yet\n */\n protected hasRendered = false;\n\n /**\n * The path to this action, i.e. 'users/create'\n */\n actionPath: string;\n\n /**\n * Render the response body\n *\n * @since 0.1.0\n */\n async render(body: any, options?: RenderOptions): Promise<void>;\n async render(status: number, body?: any, options?: RenderOptions): Promise<void>;\n async render(status: number, body?: any, options?: RenderOptions): Promise<void> {\n if (typeof status !== 'number') {\n options = body;\n body = status;\n status = 200;\n }\n if (!options) {\n options = {};\n }\n\n this.hasRendered = true;\n\n debug(`[${ this.request.id }]: rendering`);\n this.response.setHeader('X-Request-Id', this.request.id);\n\n debug(`[${ this.request.id }]: setting response status code to ${ status }`);\n this.response.statusCode = status;\n\n if (!body) {\n debug(`[${ this.request.id }]: no response body to render, response finished`);\n this.response.end();\n return;\n }\n\n // Render with a custom view if requested\n if (options.view) {\n let view = lookup<View>(`view:${ options.view }`);\n assert(view, `No such view: ${ options.view }`);\n debug(`[${ this.request.id }]: rendering response body with the ${ options.view } view`);\n return await view.render(this, this.response, body, options);\n }\n\n // Pick the serializer to use\n let serializerLookup = 'application';\n if (options.serializer) {\n serializerLookup = options.serializer;\n } else {\n let sample = isArray(body) ? body[0] : body;\n if (sample instanceof Model) {\n serializerLookup = sample.modelName;\n }\n }\n\n // Render with the serializer\n let serializer = lookup<Serializer>(`serializer:${ serializerLookup }`);\n debug(`[${ this.request.id }]: rendering response body with the ${ serializerLookup } serializer`);\n return await serializer.render(this, this.response, body, options);\n }\n\n /**\n * Invokes the action. Determines the best responder method for content\n * negotiation, then executes the filter/responder chain in sequence,\n * handling errors and rendering the response.\n *\n * You shouldn't invoke this directly - Denali will automatically wire up\n * your routes to this method.\n *\n * @since 0.1.0\n */\n async run(request: Request, response: ServerResponse) {\n this.request = request;\n this.response = response;\n\n // Parse the incoming request based on the action's chosen parser\n debug(`[${ request.id }]: parsing request`);\n assert(typeof this.parser.parse === 'function', 'The parser you supply must define a `parse(request)` method. See the parser docs for details');\n let parsedRequest = await this.parser.parse(request);\n\n // Build the before and after filter chains\n let { beforeChain, afterChain } = this._buildFilterChains();\n\n let instrumentation = Instrumentation.instrument('action.run', {\n action: this.actionPath,\n parsed: parsedRequest\n });\n\n // Before filters\n debug(`[${ this.request.id }]: running before filters`);\n await this._invokeFilters(beforeChain, parsedRequest);\n\n // Responder\n if (!this.hasRendered) {\n debug(`[${ this.request.id }]: running responder`);\n let result = await this.respond(parsedRequest);\n // Autorender if render has not been manually called and a value was returned\n if (!this.hasRendered) {\n debug(`[${ this.request.id }]: autorendering`);\n await this.render(result);\n }\n }\n\n // After filters\n debug(`[${ this.request.id }]: running after filters`);\n await this._invokeFilters(afterChain, parsedRequest);\n\n // If no one has rendered, bail\n if (!this.hasRendered) {\n throw new Errors.InternalServerError(`${ this.actionPath } did not render anything`);\n }\n\n instrumentation.finish();\n }\n\n /**\n * The default responder method. You should override this method with\n * whatever logic is needed to respond to the incoming request.\n *\n * @since 0.1.0\n */\n abstract respond(params: ResponderParams): any;\n\n /**\n * Invokes the filters in the supplied chain in sequence.\n */\n protected async _invokeFilters(chain: Filter[], parsedRequest: ResponderParams): Promise<any> {\n chain = clone(chain);\n while (chain.length > 0) {\n let filter = chain.shift();\n let instrumentation = Instrumentation.instrument('action.filter', {\n action: this.actionPath,\n request: parsedRequest,\n filter: filter.name\n });\n debug(`[${ this.request.id }]: running '${ filter.name }' filter`);\n let filterResult = await filter.call(this, parsedRequest);\n instrumentation.finish();\n if (!this.hasRendered && filterResult) {\n return this.render(200, filterResult);\n }\n }\n }\n\n /**\n * Walk the prototype chain of this Action instance to find all the `before`\n * and `after` arrays to build the complete filter chains.\n *\n * Caches the result on the child Action class to avoid the potentially\n * expensive prototype walk on each request.\n *\n * Throws if it encounters the name of a filter method that doesn't exist.\n */\n protected _buildFilterChains(): { beforeChain: Filter[], afterChain: Filter[] } {\n let ActionClass = <typeof Action>this.constructor;\n if (!beforeFiltersCache.has(ActionClass)) {\n let prototypeChain: typeof Action[] = protochain(ActionClass).reverse().concat(ActionClass);\n this._buildFilterChain('before', beforeFiltersCache, prototypeChain);\n this._buildFilterChain('after', afterFiltersCache, prototypeChain);\n }\n return {\n beforeChain: beforeFiltersCache.get(ActionClass),\n afterChain: afterFiltersCache.get(ActionClass)\n };\n }\n\n protected _buildFilterChain(stageName: 'before' | 'after', cache: Map<typeof Action, Filter[]>, prototypes: typeof Action[]) {\n let ActionClass = <typeof Action>this.constructor;\n let compiledFilterList = flatMap(prototypes, (prototype) => {\n let filters = get(prototype, stageName, <FilterSpecifier[]>[]);\n filters = castArray(filters);\n return filters.map((filter) => {\n if (typeof filter === 'string') {\n assert(typeof get(this, filter) === 'function', `${ filter } method not found on the ${ this.actionPath } action.`);\n return <Filter>(<any>this)[filter];\n }\n return filter;\n });\n });\n cache.set(ActionClass, compiledFilterList);\n }\n\n}\n","import container from '../metal/container';\nimport Resolver from '../metal/resolver';\nimport Application from './application';\nimport Loader from '@denali-js/loader';\n\n/**\n * Addons are the fundamental unit of organization for Denali apps. The\n * Application class is just a specialized Addon, and each Addon can contain\n * any amount of functionality - each one is essentially a mini Denali app.\n *\n * @package runtime\n * @since 0.1.0\n */\nexport default class Addon {\n\n /**\n * The current environment for the app, i.e. 'development'\n *\n * @since 0.1.0\n */\n environment: string;\n\n /**\n * The loader scope for this addon\n */\n loader: Loader;\n\n /**\n * The resolver for this addon's loader scope\n */\n get resolver(): Resolver {\n return this.loader.resolver;\n }\n\n constructor(loader: Loader, options: { environment: string }) {\n this.loader = loader;\n this.environment = options.environment;\n container.register(`addon:${ this.name }`, this);\n }\n\n /**\n * The name of the addon. Override this to use a different name than the\n * package name for your addon.\n *\n * @since 0.1.0\n */\n get name(): string {\n return `${ this.loader.pkgName }@${ this.loader.version }`;\n }\n\n /**\n * A hook to perform any shutdown actions necessary to gracefully exit the\n * application, i.e. close database/socket connections.\n *\n * @since 0.1.0\n */\n async shutdown(application: Application): Promise<void> {\n // defaults to noop\n }\n\n}\n","import { values, constant, noop, defaults } from 'lodash';\nimport * as http from 'http';\nimport * as https from 'https';\nimport { all } from 'bluebird';\nimport Addon from './addon';\nimport topsort from '../utils/topsort';\nimport Router from './router';\nimport Logger from './logger';\nimport ConfigService, { AppConfig } from './config';\nimport container, { Container } from '../metal/container';\nimport Resolver from '../metal/resolver';\nimport { Vertex } from '../utils/topsort';\nimport Loader from '@denali-js/loader';\n\nexport interface AppConfigBuilder {\n (environment: string, container: Container): AppConfig;\n}\n\nexport interface AddonConfigBuilder {\n (environment: string, container: Container, config: AppConfig): void;\n}\n\nexport interface MiddlewareBuilder {\n (router: Router, application: Application): void;\n}\n\nexport interface RoutesMap {\n (router: Router, application: Application): void;\n}\n\n/**\n * Initializers are run before the application starts up. You are given the\n * application instance, and if you need to perform async operations, you can\n * return a Promise. You can configure initializer order by specifying the\n * names of initializers that should come before or after your initializer.\n *\n * @since 0.1.0\n */\nexport interface Initializer {\n name: string;\n before?: string | string[];\n after?: string | string[];\n initialize(application: Application): Promise<any>;\n}\n\n/**\n * Application instances are specialized Addons, designed to kick off the\n * loading, mounting, and launching stages of booting up.\n *\n * @package runtime\n */\nexport default class Application extends Addon {\n\n /**\n * The Router instance for this Application.\n */\n router: Router;\n\n /**\n * The application config\n *\n * @since 0.1.0\n */\n config: ConfigService;\n\n /**\n * Track servers that need to drain before application shutdown\n */\n protected drainers: (() => Promise<void>)[];\n\n /**\n * The logger instance for the entire application\n *\n * @since 0.1.0\n */\n logger: Logger;\n\n /**\n * List of child addons for this app (one-level deep only, i.e. no\n * addons-of-addons are included)\n *\n * @since 0.1.0\n */\n addons: Addon[] = [];\n\n constructor(loader: Loader, options: { environment: string }) {\n super(loader, defaults(options, { environment: 'development' }));\n\n this.loader.children.forEach((addonLoader, addonName) => {\n let AddonClass = (<Resolver>addonLoader.resolver).retrieve<typeof Addon>('app:addon') || Addon;\n this.addons.push(new AddonClass(addonLoader, options));\n });\n\n this.drainers = [];\n\n // Setup some helpful container shortcuts\n container.register('app:main', this);\n\n this.router = container.lookup('app:router');\n this.logger = container.lookup('app:logger');\n\n // Generate config first, since the loading process may need it\n this.generateConfig();\n\n this.config = container.lookup('service:config');\n\n this.compileRouter();\n }\n\n /**\n * Take the loaded environment config functions, and execute them.\n * Application config is executed first, and the returned config object is\n * handed off to the addon config files, which add their configuration by\n * mutating that same object.\n *\n * The resulting final config is stored at `application.config`, and is\n * registered in the container under `config:environment`.\n *\n * This is invoked before the rest of the addons are loaded for 2 reasons:\n *\n * - The config values for the application could theoretically impact the\n * addon loading process\n * - Addons are given a chance to modify the application config, so it must\n * be loaded before they are.\n */\n protected generateConfig(): any {\n let appConfig = this.resolver.retrieve<AppConfigBuilder>('config:environment') || <AppConfigBuilder>constant({\n environment: 'development',\n server: {\n port: 3000\n }\n });\n let config = appConfig(this.environment, container);\n config.environment = this.environment;\n container.register('config:environment', config);\n this.addons.forEach((addon) => {\n let addonConfig = addon.resolver.retrieve<AddonConfigBuilder>('config:environment');\n if (addonConfig) {\n addonConfig(this.environment, container, config);\n }\n });\n return config;\n }\n\n /**\n * Assemble middleware and routes\n */\n protected compileRouter(): void {\n // Load addon middleware first\n this.addons.forEach((addon) => {\n let addonMiddleware = addon.resolver.retrieve<MiddlewareBuilder>('config:middleware') || noop;\n addonMiddleware(this.router, this);\n });\n // Then load app middleware\n let appMiddleware = this.resolver.retrieve<MiddlewareBuilder>('config:middleware') || noop;\n appMiddleware(this.router, this);\n // Load app routes first so they have precedence\n let appRoutes = this.resolver.retrieve<RoutesMap>('config:routes') || noop;\n appRoutes(this.router, this);\n // Load addon routes in reverse order so routing precedence matches addon load order\n this.addons.reverse().forEach((addon) => {\n let addonRoutes = addon.resolver.retrieve<RoutesMap>('config:routes') || noop;\n addonRoutes(this.router, this);\n });\n }\n\n /**\n * Start the Denali server. Runs all initializers, creates an HTTP server,\n * and binds to the port to handle incoming HTTP requests.\n *\n * @since 0.1.0\n */\n async start(): Promise<void> {\n let port = this.config.getWithDefault('server', 'port', 3000);\n await this.runInitializers();\n if (!this.config.get('server', 'detached')) {\n await this.createServer(port);\n this.logger.info(`${ this.name } server up on port ${ port }`);\n }\n }\n\n /**\n * Creates an HTTP or HTTPS server, depending on whether or not SSL\n * configuration is present in config/environment.js\n */\n protected async createServer(port: number): Promise<void> {\n await new Promise((resolve) => {\n let handler = this.router.handle.bind(this.router);\n let server: any;\n if (this.config.get('server', 'ssl')) {\n server = https.createServer(this.config.get('server', 'ssl'), handler).listen(port, resolve);\n } else {\n server = http.createServer(handler).listen(port, resolve);\n }\n this.drainers.push(async function drainHttp() {\n await new Promise((resolveDrainer) => {\n server.close(resolveDrainer);\n setTimeout(resolveDrainer, 60 * 1000);\n });\n });\n });\n }\n\n /**\n * Lookup all initializers and run them in sequence. Initializers can\n * override the default load order by including `before` or `after`\n * properties on the exported class (the name or array of names of the other\n * initializers it should run before/after).\n *\n * @since 0.1.0\n */\n async runInitializers(): Promise<void> {\n let initializers = values(container.lookupAll<Initializer>('initializer'));\n initializers = topsort(<Vertex[]>initializers);\n for (let initializer of initializers) {\n await initializer.initialize(this);\n }\n }\n\n /**\n * Shutdown the application gracefully (i.e. close external database\n * connections, drain in-flight requests, etc)\n *\n * @since 0.1.0\n */\n async shutdown(): Promise<void> {\n await all(this.drainers.map((drainer) => drainer()));\n await all(this.addons.map(async (addon) => {\n await addon.shutdown(this);\n }));\n container.teardown();\n }\n\n}\n","import Service from './service';\nimport { get } from 'lodash';\nimport { lookup } from '../metal/container';\n\nexport default class ConfigService extends Service {\n\n protected _config = lookup<AppConfig>('config:environment');\n\n get environment(): string {\n return this._config.environment;\n }\n\n // This nonsense basically gets us type info for the static config object up to 6 levels deep in nesting\n get<S extends AppConfig, T1 extends keyof S>(p1: T1): S[T1];\n get<S extends AppConfig, T1 extends keyof S, T2 extends keyof S[T1]>(p1: T1, p2: T2): S[T1][T2];\n get<S extends AppConfig, T1 extends keyof S, T2 extends keyof S[T1], T3 extends keyof S[T1][T2]>(p1: T1, p2: T2, p3: T3): S[T1][T2][T3];\n get<S extends AppConfig, T1 extends keyof S, T2 extends keyof S[T1], T3 extends keyof S[T1][T2], T4 extends keyof S[T1][T2][T3]>(p1: T1, p2: T2, p3: T3, p4: T4): S[T1][T2][T3][T4];\n get<S extends AppConfig, T1 extends keyof S, T2 extends keyof S[T1], T3 extends keyof S[T1][T2], T4 extends keyof S[T1][T2][T3], T5 extends keyof S[T1][T2][T3][T4]>(p1: T1, p2: T2, p3: T3, p4: T4, p5: T5): S[T1][T2][T3][T4][T5];\n get<S extends AppConfig, T1 extends keyof S, T2 extends keyof S[T1], T3 extends keyof S[T1][T2], T4 extends keyof S[T1][T2][T3], T5 extends keyof S[T1][T2][T3][T4], T6 extends keyof S[T1][T2][T3][T4][T5]>(p1: T1, p2: T2, p3: T3, p4: T4, p5: T5, p6: T6): S[T1][T2][T3][T4][T5][T6];\n get<S extends AppConfig, T1 extends keyof S, T2 extends keyof S[T1], T3 extends keyof S[T1][T2], T4 extends keyof S[T1][T2][T3], T5 extends keyof S[T1][T2][T3][T4], T6 extends keyof S[T1][T2][T3][T4][T5], T7 extends keyof S[T1][T2][T3][T4][T5][T6]>(p1: T1, p2: T2, p3: T3, p4: T4, p5: T5, p6: T6, p7: T7): S[T1][T2][T3][T4][T5][T6][T7];\n get(...path: string[]): any {\n // Split on dots in path segments, allowing for `get('foo.bar')` as well as `get('foo', 'bar')`\n path = path.reduce((segments, nextSegment) => segments.concat(nextSegment.split('.')), []);\n return get(this._config, path);\n }\n\n // This nonsense basically gets us type info for the static config object up to 6 levels deep in nesting\n getWithDefault<S extends AppConfig, T1 extends keyof S>(p1: T1, defaultValue: any): S[T1];\n getWithDefault<S extends AppConfig, T1 extends keyof S, T2 extends keyof S[T1]>(p1: T1, p2: T2, defaultValue: any): S[T1][T2];\n getWithDefault<S extends AppConfig, T1 extends keyof S, T2 extends keyof S[T1], T3 extends keyof S[T1][T2]>(p1: T1, p2: T2, p3: T3, defaultValue: any): S[T1][T2][T3];\n getWithDefault<S extends AppConfig, T1 extends keyof S, T2 extends keyof S[T1], T3 extends keyof S[T1][T2], T4 extends keyof S[T1][T2][T3]>(p1: T1, p2: T2, p3: T3, p4: T4, defaultValue: any): S[T1][T2][T3][T4];\n getWithDefault<S extends AppConfig, T1 extends keyof S, T2 extends keyof S[T1], T3 extends keyof S[T1][T2], T4 extends keyof S[T1][T2][T3], T5 extends keyof S[T1][T2][T3][T4]>(p1: T1, p2: T2, p3: T3, p4: T4, p5: T5, defaultValue: any): S[T1][T2][T3][T4][T5];\n getWithDefault<S extends AppConfig, T1 extends keyof S, T2 extends keyof S[T1], T3 extends keyof S[T1][T2], T4 extends keyof S[T1][T2][T3], T5 extends keyof S[T1][T2][T3][T4], T6 extends keyof S[T1][T2][T3][T4][T5]>(p1: T1, p2: T2, p3: T3, p4: T4, p5: T5, p6: T6, defaultValue: any): S[T1][T2][T3][T4][T5][T6];\n getWithDefault<S extends AppConfig, T1 extends keyof S, T2 extends keyof S[T1], T3 extends keyof S[T1][T2], T4 extends keyof S[T1][T2][T3], T5 extends keyof S[T1][T2][T3][T4], T6 extends keyof S[T1][T2][T3][T4][T5], T7 extends keyof S[T1][T2][T3][T4][T5][T6]>(p1: T1, p2: T2, p3: T3, p4: T4, p5: T5, p6: T6, p7: T7, defaultValue: any): S[T1][T2][T3][T4][T5][T6][T7];\n getWithDefault(...args: any[]): any {\n let defaultValue = args.pop();\n let path = <string[]>args;\n // Split on dots in path segments, allowing for `get('foo.bar')` as well as `get('foo', 'bar')`\n path = path.reduce((segments, nextSegment) => segments.concat(nextSegment.split('.')), []);\n return get(this._config, path, defaultValue);\n }\n\n}\n\nexport interface AppConfig {\n /**\n * The name of the current environment, i.e. 'developement', 'test', 'production'\n */\n environment: string;\n\n logging?: {\n\n /**\n * Should logs show debug information? If true, errors will log out as much detail as possible.\n */\n showDebuggingInfo?: boolean;\n\n /**\n * A morgan log format string to use\n */\n format?: string;\n\n /**\n * A function to determine whether or not logging should be skipped for a given request - see\n * morgan docs for details\n */\n skip?(): boolean;\n\n };\n\n /**\n * Cookie parser configuration - see cookie-parser for details\n */\n cookies?: any;\n\n /**\n * CORS configuration - see cors middleware package for details\n */\n cors?: any;\n\n migrations?: {\n\n /**\n * Knex configuration information for running migrations\n */\n db?: any;\n\n };\n\n server: {\n\n /**\n * THe port number that the application should start up on\n */\n port?: number;\n\n /**\n * Should the application start in detached mode? I.e. without attaching to a port?\n */\n detached?: boolean;\n\n /**\n * SSL/TLS certificate files. Note these should be the file contents, not the file paths\n */\n ssl?: {\n key: Buffer | string;\n cert: Buffer | string;\n }\n\n trustProxy?: string | string[] | ((addr?: string, i?: number) => boolean);\n\n subdomainOffset?: number;\n\n };\n\n /**\n * Connection and configuration for your ORM adapter - see your ORM adapter docs for\n * details\n */\n database?: any;\n\n [key: string]: any;\n}\n","import * as Errors from 'http-errors';\n\n/**\n * Denali uses the **http-errors** package for handling HTTP errors. Check\n * [it's documentation](https://github.com/jshttp/http-errors) for how to use\n * it.\n *\n * @package runtime\n * @since 0.1.0\n */\nexport default Errors;\n","import {\n identity,\n padStart\n} from 'lodash';\nimport chalk from 'chalk';\nimport DenaliObject from '../metal/object';\n\nexport type LogLevel = 'info' | 'warn' | 'error';\n\n/**\n * A simple Logger class that adds timestamps and supports multiple levels of\n * logging, colorized output, and control over verbosity.\n *\n * @package runtime\n * @since 0.1.0\n */\nexport default class Logger extends DenaliObject {\n\n /**\n * Default log level if none specified.\n *\n * @since 0.1.0\n */\n loglevel: LogLevel = 'info';\n\n /**\n * Specify if logs should be colorized.\n *\n * @since 0.1.0\n */\n colorize = true;\n\n /**\n * Available log levels that can be used.\n */\n levels: LogLevel[] = [\n 'info',\n 'warn',\n 'error'\n ];\n\n /**\n * Color map for the available levels.\n */\n colors: { [level: string]: (...text: string[]) => string } = {\n info: chalk.white,\n warn: chalk.yellow,\n error: chalk.red\n };\n\n /**\n * Log at the 'info' level.\n *\n * @since 0.1.0\n */\n info(msg: any): void {\n this.log('info', msg);\n }\n\n /**\n * Log at the 'warn' level.\n *\n * @since 0.1.0\n */\n warn(msg: any): void {\n this.log('warn', msg);\n }\n\n /**\n * Log at the 'error' level.\n *\n * @since 0.1.0\n */\n error(msg: any): void {\n this.log('error', msg);\n }\n\n /**\n * Log a message to the logger at a specific log level.\n */\n log(level: LogLevel, msg: string): void {\n if (this.levels.indexOf(level) === -1) {\n level = this.loglevel;\n }\n let timestamp = (new Date()).toISOString();\n let padLength = this.levels.reduce((n: number, label) => Math.max(n, label.length), null);\n let levelLabel = padStart(level.toUpperCase(), padLength);\n if (this.colorize) {\n let colorizer = this.colors[level] || identity;\n msg = colorizer(msg);\n levelLabel = colorizer(levelLabel);\n }\n /* tslint:disable:no-console no-debugger */\n console.log(`[${ timestamp }] ${ levelLabel } - ${ msg }`);\n if (level === 'error') {\n debugger;\n }\n /* tslint:enable:no-console no-debugger*/\n }\n\n}\n","import { Dict } from '../utils/types';\nimport Route from './route';\nimport { AppConfig } from './config';\nimport { constant } from 'lodash';\nimport * as accepts from 'accepts';\nimport { isIP } from 'net';\nimport { TLSSocket } from 'tls';\nimport * as typeis from 'type-is';\nimport * as http from 'http';\nimport * as parseRange from 'range-parser';\nimport * as parse from 'parseurl';\nimport * as proxyaddr from 'proxy-addr';\nimport * as uuid from 'uuid';\nimport * as url from 'url';\n\n/**\n * The Request class represents an incoming HTTP request (specifically, Node's\n * IncomingMessage).\n *\n * @package runtime\n * @since 0.1.0\n */\nexport default class Request {\n\n /**\n * A UUID generated unqiue to this request. Useful for tracing a request\n * through the application.\n *\n * @since 0.1.0\n */\n id: string = uuid.v4();\n\n /**\n * The route parser route that was matched\n *\n * @since 0.1.0\n */\n route: Route;\n\n /**\n * The name of the original action that was invoked - useful for error\n * actions to create helpful debug messages.\n *\n * @since 0.1.0\n */\n _originalAction: string;\n\n /**\n * The underlying HTTP server's IncomingMessage instance\n *\n * @since 0.1.0\n */\n incomingMessage: http.IncomingMessage;\n\n /**\n * A subset of the app config, the `config.server` namespace\n *\n * @since 0.1.0\n */\n config: AppConfig['server'];\n\n /**\n * The uppercase method name for the request, i.e. GET, POST, HEAD\n *\n * @since 0.1.0\n */\n get method(): string {\n return this.incomingMessage.method.toUpperCase();\n }\n\n /**\n * The requested path name\n *\n * @since 0.1.0\n */\n get path(): string {\n return parse(this.incomingMessage).pathname;\n }\n\n /**\n * The params extracted from the router's dynamic segments\n *\n * @since 0.1.0\n */\n params: any;\n\n /**\n * The query string, parsed into an object\n *\n * @since 0.1.0\n */\n get query(): Dict<string | string[]> {\n return url.parse(this.incomingMessage.url, true).query;\n }\n\n /**\n * The headers for the incoming request\n *\n * @since 0.1.0\n */\n get headers(): Dict<string | string[]> {\n return this.incomingMessage.headers;\n }\n\n /**\n * Return subdomains as an array.\n *\n * Subdomains are the dot-separated parts of the host before the main domain\n * of the app. By default, the domain of the app is assumed to be the last\n * two parts of the host. This can be changed by setting\n * config.server.subdomainOffset\n *\n * For example, if the domain is \"tobi.ferrets.example.com\": If the subdomain\n * offset is not set, req.subdomains is `[\"ferrets\", \"tobi\"]`. If the\n * subdomain offset is 3, req.subdomains is `[\"tobi\"]`.\n *\n * @since 0.1.0\n */\n get subdomains(): string[] {\n let hostname = this.hostname;\n if (!hostname) {\n return [];\n }\n let offset = this.config.subdomainOffset;\n let subdomains = !isIP(hostname) ? hostname.split('.').reverse() : [ hostname ];\n return subdomains.slice(offset == null ? 2 : offset);\n }\n\n /**\n * Return the protocol string \"http\" or \"https\" when requested with TLS. When\n * the \"server.trustProxy\" setting trusts the socket address, the\n * \"X-Forwarded-Proto\" header field will be trusted and used if present.\n *\n * If you're running behind a reverse proxy that supplies https for you this\n * may be enabled.\n *\n * @since 0.1.0\n */\n get protocol(): 'http' | 'https' {\n let rawProtocol: 'http' | 'https' = (<TLSSocket>this.incomingMessage.connection).encrypted ? 'https' : 'http';\n let ip = this.incomingMessage.connection.remoteAddress;\n let trustProxyConfig = this.config.trustProxy || constant(false);\n\n if (trustProxyConfig) {\n let trustProxy: (addr?: string, i?: number) => boolean;\n if (typeof trustProxyConfig !== 'function') {\n trustProxy = proxyaddr.compile(trustProxyConfig);\n } else {\n trustProxy = trustProxyConfig;\n }\n if (trustProxy(ip, 0)) {\n let proxyClaimedProtocol = this.getHeader('X-Forwarded-Proto') || rawProtocol;\n return <'http' | 'https'>proxyClaimedProtocol.split(/\\s*,\\s*/)[0];\n }\n }\n return rawProtocol;\n }\n\n /**\n * Check if the request was an _XMLHttpRequest_.\n *\n * @since 0.1.0\n */\n get xhr(): boolean {\n let val = this.getHeader('X-Requested-With') || '';\n return val.toLowerCase() === 'xmlhttprequest';\n }\n\n /**\n * Parse the \"Host\" header field to a hostname.\n *\n * When the \"trust proxy\" setting trusts the socket address, the\n * \"X-Forwarded-Host\" header field will be trusted.\n *\n * @since 0.1.0\n */\n get hostname(): string {\n let host = this.getHeader('X-Forwarded-Host');\n let ip = this.incomingMessage.socket.remoteAddress;\n let trustProxyConfig = this.config.trustProxy || constant(false);\n\n let trustProxy: (addr?: string, i?: number) => boolean;\n if (typeof trustProxyConfig !== 'function') {\n trustProxy = proxyaddr.compile(trustProxyConfig);\n } else {\n trustProxy = trustProxyConfig;\n }\n if (!host || !trustProxy(ip, 0)) {\n host = this.getHeader('Host');\n }\n if (!host) {\n return;\n }\n // IPv6 literal support\n let offset = host[0] === '[' ? host.indexOf(']') + 1 : 0;\n let index = host.indexOf(':', offset);\n return index !== -1 ? host.substring(0, index) : host;\n }\n\n /**\n * Return the remote address from the trusted proxy.\n *\n * The is the remote address on the socket unless \"trust proxy\" is set.\n *\n * @since 0.1.0\n */\n\n get ip(): string {\n let trustProxyConfig = this.config.trustProxy || constant(false);\n return proxyaddr(this.incomingMessage, trustProxyConfig);\n }\n\n /**\n * When \"trust proxy\" is set, trusted proxy addresses + client.\n *\n * For example if the value were \"client, proxy1, proxy2\" you would receive\n * the array `[\"client\", \"proxy1\", \"proxy2\"]` where \"proxy2\" is the furthest\n * down-stream and \"proxy1\" and \"proxy2\" were trusted.\n *\n * @since 0.1.0\n */\n get ips(): string[] {\n let trustProxyConfig = this.config.trustProxy || constant(false);\n let ips = proxyaddr.all(this.incomingMessage, trustProxyConfig);\n ips.reverse().pop();\n return ips;\n }\n\n /**\n * Does this request have a request body?\n */\n get hasBody(): boolean {\n return typeis.hasBody(this.incomingMessage);\n }\n\n constructor(incomingMessage: http.IncomingMessage, serverConfig?: AppConfig['server']) {\n this.incomingMessage = incomingMessage;\n this.config = serverConfig || {};\n }\n\n /**\n * Return request header.\n *\n * The `Referrer` header field is special-cased, both `Referrer` and\n * `Referer` are interchangeable.\n *\n * Examples:\n *\n * req.get('Content-Type'); // => \"text/plain\"\n *\n * req.get('content-type'); // => \"text/plain\"\n *\n * req.get('Something'); // => undefined\n *\n * Aliased as `req.header()`.\n * @since 0.1.0\n */\n getHeader(name: string): string;\n getHeader(name: 'set-cookie' | 'Set-cookie' | 'Set-Cookie'): string[];\n getHeader(name: 'set-cookie' | 'Set-cookie' | 'Set-Cookie' | string): string | string[] {\n return this.incomingMessage.headers[name.toLowerCase()];\n }\n\n /**\n * Check if the given `type(s)` is acceptable, returning the best match when\n * true, otherwise `undefined`, in which case you should respond with 406\n * \"Not Acceptable\".\n *\n * The `type` value may be a single MIME type string such as\n * \"application/json\", an extension name such as \"json\", a comma-delimited\n * list such as \"json, html, text/plain\", an argument list such as `\"json\",\n * \"html\", \"text/plain\"`, or an array `[\"json\", \"html\", \"text/plain\"]`. When\n * a list or array is given, the _best_ match, if any is returned.\n *\n * Examples:\n *\n * // Accept: text/html\n * req.accepts('html');\n * // => \"html\"\n *\n * // Accept: text/*, application/json\n * req.accepts('html');\n * // => \"html\"\n * req.accepts('text/html');\n * // => \"text/html\"\n * req.accepts('json, text');\n * // => \"json\"\n * req.accepts('application/json');\n * // => \"application/json\"\n *\n * // Accept: text/*, application/json\n * req.accepts('image/png');\n * req.accepts('png');\n * // => undefined\n *\n * // Accept: text/*;q=.5, application/json\n * req.accepts(['html', 'json']);\n * req.accepts('html', 'json');\n * req.accepts('html, json');\n * // => \"json\"\n *\n * @since 0.1.0\n */\n accepts(): string[];\n accepts(...type: string[]): string[] | string | false;\n accepts(...type: string[]): string[] | string | false {\n let accept = accepts(this.incomingMessage);\n return accept.types(...type);\n }\n\n /**\n * Check if the given `encoding`s are accepted.\n *\n * @since 0.1.0\n */\n acceptsEncodings(): string[];\n acceptsEncodings(...encoding: string[]): string | false;\n acceptsEncodings(...encoding: string[]): string[] | string | false {\n let accept = accepts(this.incomingMessage);\n // <any> is needed here because of incorrect types\n // see https://github.com/DefinitelyTyped/DefinitelyTyped/pull/23395\n return (<any>accept.encodings)(...encoding);\n }\n\n /**\n * Check if the given `charset`s are acceptable, otherwise you should respond\n * with 406 \"Not Acceptable\".\n *\n * @since 0.1.0\n */\n acceptsCharsets(): string[];\n acceptsCharsets(...charset: string[]): string | false;\n acceptsCharsets(...charset: string[]): string[] | string | false {\n let accept = accepts(this.incomingMessage);\n // <any> is needed here because of incorrect types\n // see https://github.com/DefinitelyTyped/DefinitelyTyped/pull/23395\n return (<any>accept.charsets)(...charset);\n }\n\n /**\n * Check if the given `lang`s are acceptable, otherwise you should respond\n * with 406 \"Not Acceptable\".\n *\n * @since 0.1.0\n */\n acceptsLanguages(): string[];\n acceptsLanguages(...lang: string[]): string | false;\n acceptsLanguages(...lang: string[]): string[] | string | false {\n let accept = accepts(this.incomingMessage);\n // <any> is needed here because of incorrect types\n // see https://github.com/DefinitelyTyped/DefinitelyTyped/pull/23395\n return (<any>accept.languages)(...lang);\n }\n\n /**\n * Parse Range header field, capping to the given `size`.\n *\n * Unspecified ranges such as \"0-\" require knowledge of your resource length.\n * In the case of a byte range this is of course the total number of bytes. If\n * the Range header field is not given `undefined` is returned, `-1` when\n * unsatisfiable, and `-2` when syntactically invalid.\n *\n * When ranges are returned, the array has a \"type\" property which is the type\n * of range that is required (most commonly, \"bytes\"). Each array element is\n * an object with a \"start\" and \"end\" property for the portion of the range.\n *\n * The \"combine\" option can be set to `true` and overlapping & adjacent ranges\n * will be combined into a single range.\n *\n * NOTE: remember that ranges are inclusive, so for example \"Range: users=0-3\"\n * should respond with 4 users when available, not 3.\n *\n * @since 0.1.0\n */\n range(size: number, options?: parseRange.Options): parseRange.Result | parseRange.Ranges {\n let range = this.getHeader('Range');\n if (!range) {\n return;\n }\n return parseRange(size, range, options);\n }\n\n /**\n * Check if the incoming request contains the \"Content-Type\" header field,\n * and it contains the give mime `type`.\n *\n * Examples:\n *\n * // With Content-Type: text/html; charset=utf-8\n * req.is('html');\n * req.is('text/html');\n * req.is('text/*');\n * // => true\n *\n * // When Content-Type is application/json\n * req.is('json');\n * req.is('application/json');\n * req.is('application/*');\n * // => true\n *\n * req.is('html');\n * // => false\n *\n * @since 0.1.0\n */\n is(...types: string[]): string | false {\n if (Array.isArray(types[0])) {\n types = <any>types[0];\n }\n return typeis(this.incomingMessage, types);\n }\n\n}\n","import * as RouteParser from 'route-parser';\nimport Action from './action';\nimport { Constructor } from '../utils/types';\n\n/**\n * Extends the base RouteParser Route class with some additional properties\n * that Denali tacks on.\n *\n * @package runtime\n */\nexport default class Route extends RouteParser {\n\n /**\n * The spec for this route (just exposing this property in the type\n * definition, since the RouteParser type definitions incorrectly don't\n * include this property).\n */\n spec: string;\n\n /**\n * You can define static data that should be included in the `params` passed\n * to an action when you define a route in the config/routes.js file. This is\n * useful if you have a single action class whose behavior should vary based\n * on the endpoint hitting it (i.e. an authentication action whose logic is\n * identical, but needs to lookup different models based on the url)\n */\n additionalParams: any;\n\n /**\n * The Action class that should be invoked when a request hits this route\n */\n action: Constructor<Action>;\n\n /**\n * The container name of the action\n */\n actionPath: string;\n\n}\n","import * as ware from 'ware';\nimport { IncomingMessage, ServerResponse } from 'http';\nimport { pluralize } from 'inflection';\nimport { fromNode } from 'bluebird';\nimport * as createDebug from 'debug';\nimport Errors from './errors';\nimport Route from './route';\nimport Request from './request';\nimport DenaliObject from '../metal/object';\nimport { lookup } from '../metal/container';\nimport ConfigService from './config';\nimport { Constructor } from '../utils/types';\nimport Action from './action';\nimport {\n find,\n forEach,\n castArray\n } from 'lodash';\n\nconst debug = createDebug('denali:router');\n\nexport interface RoutesCache {\n GET: Route[];\n POST: Route[];\n PUT: Route[];\n PATCH: Route[];\n DELETE: Route[];\n HEAD: Route[];\n OPTIONS: Route[];\n [method: string]: Route[];\n}\n\nexport interface MiddlewareFn {\n (req: IncomingMessage, res: ServerResponse, next: Function): void;\n}\n\nexport interface ResourceOptions {\n /**\n * Should routes for related resources be generated? If true, routes will be\n * generated following the JSON-API recommendations for relationship URLs.\n *\n * @see {@link http://jsonapi.org/recommendations/#urls-relationships|JSON-API URL\n * Recommendatiosn}\n */\n related?: boolean;\n /**\n * A list of action types to _not_ generate.\n */\n except?: string[];\n /**\n * A list of action types that should be the _only_ ones generated.\n */\n only?: string[];\n}\n\nexport interface RouterDSL {\n get(pattern: string, action: string, params?: {}): void;\n post(pattern: string, action: string, params?: {}): void;\n put(pattern: string, action: string, params?: {}): void;\n patch(pattern: string, action: string, params?: {}): void;\n delete(pattern: string, action: string, params?: {}): void;\n head(pattern: string, action: string, params?: {}): void;\n options(pattern: string, action: string, params?: {}): void;\n resource(resourceName: string, options?: ResourceOptions): void;\n}\n\n/**\n * The Router handles incoming requests, sending them to the appropriate\n * action. It's also responsible for defining routes in the first place - it's\n * passed into the `config/routes.js` file's exported function as the first\n * argument.\n *\n * @package runtime\n * @since 0.1.0\n */\nexport default class Router extends DenaliObject implements RouterDSL {\n\n /**\n * The cache of available routes.\n */\n routes: RoutesCache = {\n GET: [],\n POST: [],\n PUT: [],\n PATCH: [],\n DELETE: [],\n HEAD: [],\n OPTIONS: []\n };\n\n /**\n * The internal generic middleware handler, responsible for building and\n * executing the middleware chain.\n */\n protected middleware: any = (<() => any>ware)();\n\n get config() {\n return lookup<ConfigService>('service:config');\n }\n\n /**\n * Helper method to invoke the function exported by `config/routes.js` in the\n * context of the current router instance.\n *\n * @since 0.1.0\n */\n map(fn: (router: Router) => void): void {\n debug('mapping routes');\n fn(this);\n }\n\n /**\n * Takes an incoming request and it's response from an HTTP server, prepares\n * them, runs the generic middleware first, hands them off to the appropriate\n * action given the incoming URL, and finally renders the response.\n */\n async handle(req: IncomingMessage, res: ServerResponse): Promise<void> {\n let serverConfig = this.config.get('server');\n let request = new Request(req, serverConfig);\n try {\n\n debug(`[${ request.id }]: ${ request.method.toUpperCase() } ${ request.path }`);\n\n // Middleware\n await fromNode((cb) => this.middleware.run(request, res, cb));\n\n // Find the matching route\n debug(`[${ request.id }]: routing request`);\n let routes = this.routes[request.method];\n if (routes) {\n /* tslint:disable-next-line prefer-for-of */\n for (let i = 0; i < routes.length; i += 1) {\n request.params = routes[i].match(request.path);\n if (request.params) {\n request.route = routes[i];\n break;\n }\n }\n }\n // Handle 404s\n if (!request.route) {\n let availableRoutes = routes && routes.map((r) => r.spec);\n debug(`[${ request.id }]: ${ request.method } ${ request.path } did match any route. Available ${ request.method } routes:\\n${ availableRoutes.join(',\\n') || 'none' }`);\n let error = new Errors.NotFound('Route not recognized');\n error.meta = { availableRoutesForMethod: routes || [] };\n throw error;\n }\n\n // Create our action to handle the response\n let action: Action = new request.route.action();\n\n // Run the action\n debug(`[${ request.id }]: running action`);\n await action.run(request, res);\n\n } catch (error) {\n await this.handleError(request, res, error);\n }\n }\n\n /**\n * Takes a request, response, and an error and hands off to the generic\n * application level error action.\n */\n protected async handleError(request: Request, res: ServerResponse, error: Error) {\n request.params = request.params || {};\n request.params.error = error;\n let ErrorAction = lookup<Constructor<Action>>('action:error');\n let errorAction = new ErrorAction();\n return errorAction.run(request, res);\n }\n\n /**\n * Add the supplied middleware function to the generic middleware stack that\n * runs prior to action handling.\n *\n * @since 0.1.0\n */\n use(middleware: MiddlewareFn): void {\n this.middleware.use(middleware);\n }\n\n /**\n * Add a route to the application. Maps a method and URL pattern to an\n * action, with optional additional parameters.\n *\n * URL patterns can use:\n *\n * * Dynamic segments, i.e. `'foo/:bar'` * Wildcard segments, i.e.\n * `'foo/*bar'`, captures the rest of the URL up to the querystring\n * * Optional groups, i.e. `'foo(/:bar)'`\n *\n * @since 0.1.0\n */\n route(method: string, rawPattern: string, actionPath: string, params?: any) {\n method = method.toUpperCase();\n // Ensure leading slashes\n let normalizedPattern = rawPattern.replace(/^([^/])/, '/$1');\n // Remove hardcoded trailing slashes\n normalizedPattern = normalizedPattern.replace(/\\/$/, '');\n // Ensure optional trailing slashes\n normalizedPattern = `${ normalizedPattern }(/)`;\n // Add route\n let ActionClass = lookup<Constructor<Action>>(`action:${ actionPath }`);\n let route = new Route(normalizedPattern);\n route.actionPath = actionPath;\n route.action = ActionClass;\n route.additionalParams = params;\n if (!route.action) {\n throw new Error(`No action found at ${ actionPath }`);\n }\n this.routes[method].push(route);\n }\n\n /**\n * Returns the URL for a given action. You can supply a params object which\n * will be used to fill in the dynamic segements of the action's route (if\n * any).\n */\n urlFor(actionPath: string, data: any): string | boolean {\n let actionEntry = lookup<Constructor<Action>>(`action:${ actionPath }`, { loose: true });\n if (actionEntry === false) {\n return false;\n }\n\n let action = actionEntry; // because TS won't narrow the type in the forEach below\n let route: Route;\n forEach(this.routes, (routes) => {\n route = find(routes, { action });\n return !route; // kill the iterator if we found the match\n });\n\n return route && route.reverse(data);\n }\n\n /**\n * Shorthand for `this.route('get', ...arguments)`\n *\n * @since 0.1.0\n */\n get(rawPattern: string, actionPath: string, params?: any): void {\n this.route('get', rawPattern, actionPath, params);\n }\n\n /**\n * Shorthand for `this.route('post', ...arguments)`\n *\n * @since 0.1.0\n */\n post(rawPattern: string, actionPath: string, params?: any): void {\n this.route('post', rawPattern, actionPath, params);\n }\n\n /**\n * Shorthand for `this.route('put', ...arguments)`\n *\n * @since 0.1.0\n */\n put(rawPattern: string, actionPath: string, params?: any): void {\n this.route('put', rawPattern, actionPath, params);\n }\n\n /**\n * Shorthand for `this.route('patch', ...arguments)`\n *\n * @since 0.1.0\n */\n patch(rawPattern: string, actionPath: string, params?: any): void {\n this.route('patch', rawPattern, actionPath, params);\n }\n\n /**\n * Shorthand for `this.route('delete', ...arguments)`\n *\n * @since 0.1.0\n */\n delete(rawPattern: string, actionPath: string, params?: any): void {\n this.route('delete', rawPattern, actionPath, params);\n }\n\n /**\n * Shorthand for `this.route('head', ...arguments)`\n *\n * @since 0.1.0\n */\n head(rawPattern: string, actionPath: string, params?: any): void {\n this.route('head', rawPattern, actionPath, params);\n }\n\n /**\n * Shorthand for `this.route('options', ...arguments)`\n *\n * @since 0.1.0\n */\n options(rawPattern: string, actionPath: string, params?: any): void {\n this.route('options', rawPattern, actionPath, params);\n }\n\n /**\n * Create all the CRUD routes for a given resource and it's relationships.\n * Based on the JSON-API recommendations for URL design.\n *\n * The `options` argument lets you pass in `only` or `except` arrays to\n * define exceptions. Action names included in `only` will be the only ones\n * generated, while names included in `except` will be omitted.\n *\n * Set `options.related = false` to disable relationship routes.\n *\n * If no options are supplied, the following routes are generated (assuming a\n * 'books' resource as an example):\n *\n * * `GET /books`\n * * `POST /books`\n * * `GET /books/:id`\n * * `PATCH /books/:id`\n * * `DELETE /books/:id`\n * * `GET /books/:id/:relation`\n * * `GET /books/:id/relationships/:relation`\n * * `PATCH /books/:id/relationships/:relation`\n * * `POST /books/:id/relationships/:relation`\n * * `DELETE /books/:id/relationships/:relation`\n *\n * See http://jsonapi.org/recommendations/#urls for details.\n *\n * @since 0.1.0\n */\n resource(resourceName: string, options: ResourceOptions = {}): void {\n let plural = pluralize(resourceName);\n let collection = `/${ plural }`;\n let resource = `${ collection }/:id`;\n let relationship = `${ resource }/relationships/:relation`;\n let related = `${ resource }/:relation`;\n\n if (!options.related) {\n options.except = [ 'related', 'fetch-related', 'replace-related', 'add-related', 'remove-related' ].concat(options.except);\n }\n\n let hasWhitelist = Boolean(options.only);\n options.only = castArray(options.only);\n options.except = castArray(options.except);\n\n /**\n * Check if the given action should be generated based on the\n * whitelist/blacklist options\n */\n function include(action: string) {\n let whitelisted = options.only.includes(action);\n let blacklisted = options.except.includes(action);\n return !blacklisted && (\n (hasWhitelist && whitelisted) ||\n !hasWhitelist\n );\n }\n\n [\n [ 'list', 'get', collection ],\n [ 'create', 'post', collection ],\n [ 'show', 'get', resource ],\n [ 'update', 'patch', resource ],\n [ 'destroy', 'delete', resource ],\n [ 'related', 'get', related ],\n [ 'fetch-related', 'get', relationship ],\n [ 'replace-related', 'patch', relationship ],\n [ 'add-related', 'post', relationship ],\n [ 'remove-related', 'delete', relationship ]\n ].forEach((routeTemplate: [ string, string, string ]) => {\n let [ action, method, url ] = routeTemplate;\n if (include(action)) {\n let routeMethod = <(url: string, action: string) => void>this[method];\n routeMethod.call(this, url, `${ plural }/${ action }`);\n }\n });\n }\n\n [methodName: string]: any;\n\n /**\n * Enables easy route namespacing. You can supply a method which takes a\n * single argument that works just like the `router` argument in your\n * `config/routes.js`, or you can use the return value just like the router.\n *\n * router.namespace('users', (namespace) => {\n * namespace.get('sign-in');\n * });\n * // or ...\n * let namespace = router.namespace('users');\n * namespace.get('sign-in');\n */\n namespace(namespace: string, fn: (wrapper: RouterDSL) => void): void {\n let router = this;\n if (namespace.endsWith('/')) {\n namespace = namespace.slice(0, namespace.length - 1);\n }\n // tslint:disable:completed-docs\n let wrapper: RouterDSL = {\n get(pattern: string, actionPath, params) {\n router.route('get', `${ namespace }/${ pattern.replace(/^\\//, '') }`, actionPath, params);\n },\n post(pattern: string, actionPath, params) {\n router.route('post', `${ namespace }/${ pattern.replace(/^\\//, '') }`, actionPath, params);\n },\n put(pattern: string, actionPath, params) {\n router.route('put', `${ namespace }/${ pattern.replace(/^\\//, '') }`, actionPath, params);\n },\n patch(pattern: string, actionPath, params) {\n router.route('patch', `${ namespace }/${ pattern.replace(/^\\//, '') }`, actionPath, params);\n },\n delete(pattern: string, actionPath, params) {\n router.route('delete', `${ namespace }/${ pattern.replace(/^\\//, '') }`, actionPath, params);\n },\n head(pattern: string, actionPath, params) {\n router.route('head', `${ namespace }/${ pattern.replace(/^\\//, '') }`, actionPath, params);\n },\n options(pattern: string, actionPath, params) {\n router.route('options', `${ namespace }/${ pattern.replace(/^\\//, '') }`, actionPath, params);\n },\n resource(resourceName: string, options: ResourceOptions) {\n router.resource.call(this, resourceName, options);\n }\n };\n // tslint:enable:completed-docs\n if (fn) {\n fn(wrapper);\n }\n }\n\n}\n","import DenaliObject from '../metal/object';\n\n/**\n * Services are typically used to represent either external systems (i.e. a\n * caching service) or a cross-cutting, reusable piece of application logic\n * (i.e. an authorization / roles service).\n *\n * Services are mostly conventional - they are just singletons with no\n * special behavior. The common base class ensures they are\n * singletons, makes user intent clear, and paves the way for introducing\n * additional common functionality in future versions of Denali.\n *\n * @package runtime\n */\nexport default abstract class Service extends DenaliObject {\n}\n","import * as path from 'path';\nimport { sync as glob } from 'glob';\nimport { all } from 'bluebird';\nimport { assign, forEach, mapKeys } from 'lodash';\nimport { RegisterContextual } from 'ava';\nimport { IncomingHttpHeaders } from 'http';\nimport MockRequest from './mock-request';\nimport MockResponse from './mock-response';\nimport Application from '../runtime/application';\nimport ORMAdapter from '../data/orm-adapter';\nimport { ContainerOptions, Container } from '../metal/container';\n\nexport interface AcceptanceTestContext {\n app: AcceptanceTest;\n}\n\n/**\n * The AppAcceptance class represents an app acceptance test. It spins up an\n * in-memory instance of the application under test, and exposes methods to\n * submit simulated requests to the application, and get the response. This\n * helps keep acceptance tests lightweight and easily parallelizable, since\n * they don't need to bind to an actual port.\n *\n * @package test\n * @since 0.1.0\n */\nexport class AcceptanceTest {\n\n /**\n * A helper method for setting up an app acceptance test. Adds\n * beforeEach/afterEach hooks to the current ava test suite which will setup\n * and teardown the acceptance test. They also setup a test transaction and\n * roll it back once the test is finished (for the ORM adapters that support\n * it), so your test data won't pollute the database.\n *\n * @package test\n * @since 0.1.0\n */\n static setupTest() {\n let ava = <RegisterContextual<AcceptanceTestContext>>require('ava');\n ava.beforeEach(async (t) => {\n let acceptanceTest = new AcceptanceTest();\n await acceptanceTest.setup(t.context);\n });\n ava.afterEach.always(async (t) => {\n await t.context.app.teardown();\n });\n return ava;\n }\n\n /**\n * The application instance under test\n */\n application: Application;\n\n /**\n * The container instance for this test\n */\n container: Container;\n\n /**\n * Default headers that are applied to each request. Useful for handling\n * API-wide content-types, sessions, etc.\n *\n * @since 0.1.0\n */\n headers: IncomingHttpHeaders = {\n accept: 'application/json',\n 'content-type': 'application/json'\n };\n\n /**\n * An internal registry of container injections.\n */\n protected _injections: { [fullName: string]: any } = {};\n\n constructor() {\n let compiledPath = path.join(process.cwd(), process.env.DENALI_TEST_BUILD_DIR);\n let bundleFile = glob(path.join(compiledPath, '*.bundle.js'))[0];\n let bundle = require(bundleFile);\n this.container = bundle();\n let Application = this.container.lookup('app:application');\n this.application = new Application(this.container.loader, { environment: process.env.NODE_ENV || 'test' });\n }\n\n async setup(context: AcceptanceTestContext) {\n context.app = this;\n await this.start();\n let adapters = this.container.lookupAll<ORMAdapter>('orm-adapter');\n let transactionInitializers: Promise<void>[] = [];\n forEach(adapters, (Adapter) => {\n if (typeof Adapter.startTestTransaction === 'function') {\n transactionInitializers.push(Adapter.startTestTransaction());\n }\n });\n await all(transactionInitializers);\n }\n\n async teardown() {\n let transactionRollbacks: Promise<void>[] = [];\n let adapters = this.container.lookupAll<ORMAdapter>('orm-adapter');\n forEach(adapters, (Adapter) => {\n if (typeof Adapter.rollbackTestTransaction === 'function') {\n transactionRollbacks.push(Adapter.rollbackTestTransaction());\n }\n });\n await all(transactionRollbacks);\n await this.shutdown();\n }\n\n /**\n * Start the application (note: this won't actually start the HTTP server, but performs all the\n * other startup work for you).\n *\n * @since 0.1.0\n */\n async start(): Promise<void> {\n await this.application.runInitializers();\n }\n\n /**\n * Submit a simulated HTTP request to the application.\n *\n * @since 0.1.0\n */\n async request(options: { method: string, url: string, body?: any, headers?: { [key: string]: string } }): Promise<{ status: number, body: any }> {\n let body: any = null;\n options.headers = mapKeys(options.headers, (value, key) => key.toLowerCase()) || {};\n if (options.body) {\n body = typeof options.body === 'string' ? options.body : JSON.stringify(options.body);\n options.headers['transfer-encoding'] = 'chunked';\n }\n let req = new MockRequest({\n method: options.method.toUpperCase(),\n url: options.url,\n headers: assign({}, this.headers, options.headers)\n });\n return new Promise<{ status: number, body: any }>((resolve, reject) => {\n let res = new MockResponse(({ status, body, json }) => {\n if (status < 500) {\n resolve({ status: res.statusCode, body: json || body });\n } else {\n reject({ response: res, status, body, json });\n }\n });\n\n // tslint:disable-next-line:no-floating-promises\n this.application.router.handle(<any>req, <any>res);\n\n let SIMULATED_WRITE_DELAY = 10;\n setTimeout(() => {\n if (body) {\n req.write(body);\n }\n req.end();\n }, SIMULATED_WRITE_DELAY);\n });\n }\n\n /**\n * Send a simulated GET request\n *\n * @since 0.1.0\n */\n async get(url: string, options = {}): Promise<{ status: number, body: any }> {\n return this.request(Object.assign(options, { url, method: 'GET' }));\n }\n /**\n * Send a simulated HEAD request\n *\n * @since 0.1.0\n */\n async head(url: string, options = {}): Promise<{ status: number, body: any }> {\n return this.request(Object.assign(options, { url, method: 'HEAD' }));\n }\n /**\n * Send a simulated DELETE request\n *\n * @since 0.1.0\n */\n async delete(url: string, options = {}): Promise<{ status: number, body: any }> {\n return this.request(Object.assign(options, { url, method: 'DELETE' }));\n }\n /**\n * Send a simulated POST request\n *\n * @since 0.1.0\n */\n async post(url: string, body: any, options = {}): Promise<{ status: number, body: any }> {\n return this.request(Object.assign(options, { url, body, method: 'POST' }));\n }\n /**\n * Send a simulated PUT request\n *\n * @since 0.1.0\n */\n async put(url: string, body: any, options = {}): Promise<{ status: number, body: any }> {\n return this.request(Object.assign(options, { url, body, method: 'PUT' }));\n }\n /**\n * Send a simulated PATCH request\n *\n * @since 0.1.0\n */\n async patch(url: string, body: any, options = {}): Promise<{ status: number, body: any }> {\n return this.request(Object.assign(options, { url, body, method: 'PATCH' }));\n }\n\n /**\n * Get the current value of a default header\n *\n * @since 0.1.0\n */\n getHeader<T extends keyof IncomingHttpHeaders>(name: T) {\n name = <T>name.toLowerCase();\n return this.headers[name];\n }\n\n /**\n * Set a default header value\n *\n * @since 0.1.0\n */\n setHeader<T extends keyof IncomingHttpHeaders, U extends IncomingHttpHeaders[T]>(name: T, value: U): void {\n this.headers[name.toLowerCase()] = value;\n }\n\n /**\n * Remove a default header value\n *\n * @since 0.1.0\n */\n removeHeader(name: string): void {\n delete this.headers[name.toLowerCase()];\n }\n\n /**\n * Lookup an entry in the test application container\n *\n * @since 0.1.0\n */\n lookup(name: string): any {\n return this.container.lookup(name);\n }\n\n /**\n * Overwrite an entry in the test application container. Use `restore()` to\n * restore the original container entry later.\n *\n * @since 0.1.0\n */\n inject(name: string, value: any, options?: ContainerOptions): void {\n this._injections[name] = this.container.lookup(name);\n this.container.register(name, value, options);\n this.container.clearCache(name);\n }\n\n /**\n * Restore the original container entry for an entry that was previously\n * overwritten by `inject()`\n *\n * @since 0.1.0\n */\n restore(name: string): void {\n this.container.register(name, this._injections[name]);\n delete this._injections[name];\n }\n\n /**\n * Shut down the test application, cleaning up any resources in use\n *\n * @since 0.1.0\n */\n async shutdown(): Promise<void> {\n await this.application.shutdown();\n }\n\n}\n\nexport default <typeof AcceptanceTest.setupTest>AcceptanceTest.setupTest.bind(AcceptanceTest);\n","import { IncomingMessage as IncomingHttpMessage, IncomingHttpHeaders } from 'http';\nimport { PassThrough, Readable } from 'stream';\nimport * as url from 'url';\nimport { Socket } from 'net';\nimport { Dict } from '../utils/types';\nimport { flatMapDeep, mapKeys, toPairs, flatten } from 'lodash';\n\n\nexport interface MockMessageOptions {\n method?: string;\n url?: string;\n headers?: IncomingHttpHeaders;\n trailers?: Dict<string>;\n httpVersion?: string;\n json?: any;\n body?: Readable | Buffer | string;\n}\n\n/**\n * A mock request used to simluate an HTTP request to the application during\n * tests. You shouldn't need to instantiate these directly - instead, use an\n * AppAcceptance test.\n *\n * @package test\n */\nexport default class MockRequest extends PassThrough implements IncomingHttpMessage {\n\n httpVersion = '1.1';\n get httpVersionMajor() {\n return Number(this.httpVersion.split('.')[0]);\n }\n get httpVersionMinor() {\n return Number(this.httpVersion.split('.')[1]);\n }\n\n connection: Socket;\n get socket(): Socket {\n return this.connection;\n }\n\n headers: IncomingHttpHeaders = {};\n get rawHeaders(): string[] {\n return flatMapDeep<IncomingHttpHeaders, string>(this.headers, (value, name) => {\n if (Array.isArray(value)) {\n return value.map((v) => [ name, v ]);\n }\n return [ name, value ];\n });\n }\n\n method = 'GET';\n url = '/';\n\n trailers: Dict<string> = {};\n get rawTrailers(): string[] {\n return flatten(toPairs(this.trailers));\n }\n\n readable = true;\n\n constructor(options: MockMessageOptions = {}) {\n super();\n\n this.method = options.method || this.method;\n\n let parsedUrl = url.parse(options.url || this.url);\n this.url = parsedUrl.path;\n\n if (options.headers) {\n this.headers = mapKeys(options.headers, (value, key) => key.toLowerCase());\n }\n if (options.trailers) {\n this.trailers = mapKeys(options.trailers, (value, key) => key.toLowerCase());\n }\n\n this.httpVersion = options.httpVersion || this.httpVersion;\n this.connection = new Socket();\n Object.defineProperty(this.connection, 'remoteAddress', {\n value: '192.168.1.1'\n });\n Object.defineProperty(this.connection, 'encrypted', {\n get: () => {\n return parsedUrl.protocol === 'https:';\n }\n });\n\n let json = options.json;\n if (json) {\n options.body = JSON.stringify(options.json);\n this.headers['content-type'] = this.headers['content-type'] || 'application/json';\n }\n\n let body = options.body;\n if (body) {\n if (isReadableStream(body)) {\n body.pipe(this);\n } else {\n if (!this.headers['content-length']) {\n this.headers['content-length'] = String(body.length);\n }\n this.write(body);\n this.end();\n }\n }\n }\n\n setTimeout(msecs: number, callback: () => void): this {\n return this;\n }\n destroy() {\n // noop\n }\n\n}\n\nfunction isReadableStream(stream: any): stream is Readable {\n return typeof stream.pipe === 'function';\n}\n","import { Writable } from 'stream';\nimport { Socket } from 'net';\nimport { ServerResponse as HttpServerResponse, OutgoingHttpHeaders, STATUS_CODES } from 'http';\n\n/**\n * A mock response used to simluate the server response to mock requests during\n * tests. You shouldn't need to instantiate these directly - instead, use an\n * AppAcceptance test.\n *\n * @package test\n */\n// tslint:disable:completed-docs member-access\nexport default class MockResponse extends Writable implements HttpServerResponse {\n\n // Response data\n statusCode: number;\n get statusMessage(): string {\n return this._customStatusMessage || STATUS_CODES[this.statusCode];\n }\n _headers: OutgoingHttpHeaders = {};\n\n // Settings\n upgrading = false;\n chunkedEncoding = false;\n shouldKeepAlive = false;\n useChunkedEncodingByDefault = false;\n sendDate = true;\n\n // Response state\n finished = false;\n headersSent = false;\n\n connection = new Socket();\n\n protected _customStatusMessage: string;\n\n _body = '';\n _json: any;\n\n constructor(callback?: (result: { status: number, body: string, json: any }) => void) {\n super();\n this.on('finish', () => {\n try {\n this._json = JSON.parse(this._body);\n } catch (e) { /* don't care if we can't parse, just ignore it */ }\n if (callback) {\n callback({ status: this.statusCode, body: this._body, json: this._json });\n }\n });\n }\n\n write(chunk: Buffer | string, encoding?: string | Function, cb?: Function): boolean {\n if (Buffer.isBuffer(chunk)) {\n chunk = chunk.toString();\n }\n this._body += chunk;\n if (cb) {\n setImmediate(cb);\n }\n return true;\n }\n\n // Outgoing Message interface\n _implicitHeader(): void { /* noop */ }\n setHeader(name: string, value: number | string | string[]): void {\n this._headers[name] = value;\n }\n getHeader(name: string): string | number | string[] {\n return this._headers[name];\n }\n getHeaders(): OutgoingHttpHeaders {\n return this._headers;\n }\n getHeaderNames(): string[] {\n return Object.keys(this._headers);\n }\n hasHeader(name: string): boolean {\n return Boolean(this._headers[name]);\n }\n removeHeader(name: string): void {\n delete this._headers[name];\n }\n addTrailers(headers: OutgoingHttpHeaders | [string, string][]): void {\n throw new Error('Trailing headers are not supported on requests without chunked encoding, and MockResponse does not support chunked encoding yet.');\n }\n flushHeaders(): void { /* noop */ }\n\n writeHead(statusCode: number, statusMessage?: string | OutgoingHttpHeaders, headers?: OutgoingHttpHeaders): void {\n this.statusCode = statusCode;\n if (typeof statusMessage === 'string') {\n this._customStatusMessage = statusMessage;\n Object.assign(this._headers, headers);\n } else {\n Object.assign(this._headers, statusMessage);\n }\n }\n\n writeContinue() { /* noop - can be provided in options */ }\n\n assignSocket(socket: Socket): void { /* noop */ }\n detachSocket(socket: Socket): void { /* noop */ }\n setTimeout(msecs: number, callback?: () => void): this {\n this.connection.setTimeout(msecs, callback);\n return this;\n }\n\n}\n","import { all } from 'bluebird';\nimport { forEach, mapValues } from 'lodash';\nimport { RegisterContextual } from 'ava';\nimport ORMAdapter from '../data/orm-adapter';\nimport { ContainerOptions, Container } from '../metal/container';\n\nexport interface ContainerOverrideConfig {\n [containerSpecifier: string]: true | any;\n}\n\nexport interface UnitTestContext<Subject> {\n unit: UnitTest;\n container: Container;\n lookup: typeof Container.prototype.lookup;\n subject(): Subject;\n inject(injections: { [specifier: string]: any }): void;\n inject(name: string, value: any, options?: ContainerOptions): void;\n restore(...specifiers: string[]): void;\n}\n\nexport interface UnitTestOptions {\n /**\n * If true, the container will be cleared before each test, with only your\n * supplied overrides present. If false, the container will be fully\n * populated with your app, and then your overrides applied on top of that.\n *\n * Defaults to true, and that is the recommended approach. Clearing the\n * container forces you to declare _all_ the dependencies of the module under\n * test in your unit test. If set to false, it's easy to produce leaky unit\n * tests that end up accidentally relying on container dependencies that you\n * forgot to properly mock or declare.\n */\n clearContainer?: false;\n}\n\n\n/**\n * The AppUnitTest class represents an app unit test. Loads up the bundle and\n * lookups up the module under test. The bundle allows for multiple concurrent\n * tests while ensuring state is not shared across them.\n *\n * @package test\n * @since 0.1.0\n */\nexport class UnitTest<Subject = any> {\n\n /**\n * A helper method for setting up an app unit test. Adds beforeEach/afterEach\n * hooks to the ava test suite which will setup and teardown the unit test.\n * They also setup a test transaction and roll it back once the test is\n * finished (for the ORM adapters that support it), so your test data won't\n * pollute the database.\n *\n * It returns the Ava test interface, but it enforces serial execution. For\n * more details, check out\n * https://gist.github.com/davewasmer/cd8ac4fad5502e9ce5c8055b283f08cb\n *\n * @since 0.1.0\n */\n static setupTest<Subject, AdditionalContext = {}>(subject: string | (() => Subject) = () => null, overrides: ContainerOverrideConfig = {}, options: UnitTestOptions = {}): RegisterContextual<UnitTestContext<Subject> & AdditionalContext> {\n let ava = <RegisterContextual<UnitTestContext<Subject> & AdditionalContext>>require('ava');\n let unitTest = new this<Subject>(subject, overrides, options);\n ava.beforeEach(async (t) => await unitTest.setup(t.context));\n ava.afterEach.always(async (t) => await unitTest.teardown());\n return <any>ava.serial;\n }\n\n /**\n * The container instance for this test suite\n */\n container: Container;\n\n /**\n * A map of container values that should be setup prior to each test run. This\n * is derived from the ContainerOverrideConfig that is passed into the\n * UnitTest constructor - it's the \"allowed world\" for this unit test.\n *\n * Note: don't confuse this with `originalContainerValues`, which holds the\n * value of a container entry that was overwritten by a user's `inject()`\n * call. The `originalContainerValues` is there to allow users to restore an\n * injected entry mid-test if needed. This `startingContainerValues` property\n * is for setting up the container _before_ each test.\n */\n protected startingContainerValues: { [specifier: string]: any };\n\n protected originalContainerValues: { [specific: string]: any } = {};\n\n constructor(protected _subject: string | (() => any), protected overrideConfig: ContainerOverrideConfig, options: UnitTestOptions = {}) {\n // Fetch the container for this unit test file (added during the build process)\n this.container = (<any>global).unitTestBundleContainer;\n // If the subject is pulled from the container, make sure we preserve it's value\n if (typeof _subject === 'string') {\n overrideConfig[_subject] = true;\n }\n this.applyContainerOverrideConfig(overrideConfig, options.clearContainer);\n }\n\n async setup(context: UnitTestContext<any>) {\n // Setup the container with the \"allowed world\" for this test suite\n forEach(this.startingContainerValues, (value, specifier) => {\n this.container.register(specifier, value);\n });\n\n // Some shortcuts on the context object\n context.unit = this;\n context.container = this.container;\n context.subject = this.subject.bind(this);\n context.inject = this.inject.bind(this);\n context.restore = this.restore.bind(this);\n context.lookup = this.container.lookup.bind(this.container);\n\n // Start any database transactions we can\n await this.startTestTransactions();\n }\n\n /**\n * Takes the supplied override config, and updates the bundle container to\n * match it.\n *\n * @param overrideConfig Container overrides that should be used for this\n * test (see ContainerOverrideConfig)\n */\n protected applyContainerOverrideConfig(overrideConfig: ContainerOverrideConfig, clearContainer: false | undefined) {\n // Before we potentially wipe the container, grab any \"passthrough\" entries\n // allowed by the config\n this.startingContainerValues = mapValues(overrideConfig, (config, key) => {\n return config === true ? this.container.lookup(key, { raw: true, loose: true }) : config;\n });\n if (clearContainer !== false) {\n this.container.clear();\n }\n }\n\n /**\n * Returns the subject of the test. Follows container lookup rules, i.e. if\n * the entry under test is a singleton, will return the singleton instance,\n * not the class.\n *\n * @since 0.1.0\n */\n subject(): Subject {\n if (typeof this._subject === 'string') {\n return this.container.lookup(this._subject);\n }\n return this._subject();\n }\n\n /**\n * Overwrite an entry in the test application container. Use `restore()` to\n * restore the original container entry later. Can supply a single name and\n * value with options, or an object whose keys are specifiers and values are\n * the values to inject.\n *\n * @since 0.1.0\n */\n inject(injections: { [specifier: string]: any }): void;\n inject(name: string, value: any, options?: ContainerOptions): void;\n inject(nameOrInjections: string | { [specifier: string]: any }, value?: any, options?: ContainerOptions): void {\n let injections: { [specifier: string]: { value: any, options?: ContainerOptions } };\n if (typeof nameOrInjections === 'string') {\n let name = nameOrInjections;\n injections = { [name]: { value, options } };\n } else {\n injections = mapValues(nameOrInjections, (value) => ({ value }));\n }\n forEach(injections, ({ value, options }, specifier) => {\n this.originalContainerValues[specifier] = this.container.lookup(specifier, { raw: true, loose: true });\n this.container.register(specifier, value, options);\n this.container.clearCache(specifier);\n });\n }\n\n /**\n * Restore the original container entry for an entry that was previously\n * overwritten by `inject()`. If no arguments are supplied, all injections\n * are restored.\n *\n * @since 0.1.0\n */\n restore(...specifiers: string[]): void {\n if (specifiers.length === 0) {\n specifiers = Object.keys(this.originalContainerValues);\n }\n specifiers.forEach((specifier) => {\n this.container.clearCache(specifier);\n let originalValue = this.originalContainerValues[specifier];\n if (originalValue != null) {\n this.container.register(specifier, originalValue);\n }\n delete this.originalContainerValues[specifier];\n });\n }\n\n /**\n * Lookup all the ORM adapters, and give each one a chance to start a\n * transaction that will wrap a test, and be rolled back after\n */\n async startTestTransactions() {\n let adapters = this.container.lookupAll<ORMAdapter>('orm-adapter');\n let transactionInitializers: Promise<void>[] = [];\n forEach(adapters, (Adapter) => {\n if (typeof Adapter.startTestTransaction === 'function') {\n transactionInitializers.push(Adapter.startTestTransaction());\n }\n });\n await all(transactionInitializers);\n }\n\n /**\n * Roll back any test transactions started at the beginning of the test\n */\n async rollbackTestTransactions() {\n let transactionRollbacks: Promise<void>[] = [];\n let adapters = this.container.lookupAll<ORMAdapter>('orm-adapter');\n forEach(adapters, (Adapter) => {\n if (typeof Adapter.rollbackTestTransaction === 'function') {\n transactionRollbacks.push(Adapter.rollbackTestTransaction());\n }\n });\n await all(transactionRollbacks);\n }\n\n async teardown() {\n this.container.clear();\n await this.rollbackTestTransactions();\n }\n\n}\n\nexport default <typeof UnitTest.setupTest>UnitTest.setupTest.bind(UnitTest);\n","\"use strict\";\nObject.defineProperty(exports, \"__esModule\", { value: true });\n","export default function result<T>(valueOrFn: ((...args: any[]) => T) | T, ...args: any[]): T {\n if (typeof valueOrFn === 'function') {\n return valueOrFn(...args);\n } else {\n return valueOrFn;\n }\n}","import { unwrap } from 'denali-cli';\nimport * as wrap from 'wordwrap';\nimport * as tty from 'tty';\n\n/**\n * Take the tagged string and change the word wrapping to 100 columns (or the width of the terminal\n * window, if smaller). Useful for writing paragraphs of text that should wrap in the source code,\n * but may need to wrap to a different width when printed out to the terminal.\n *\n * @package util\n */\nexport default function rewrap(strings: TemplateStringsArray, ...expressions: any[]): string {\n let text = unwrap(strings, ...expressions);\n text = wrap(text, Math.min(100, (<tty.WriteStream>process.stdout).columns));\n return text;\n}\n","import { isArray, isEmpty, set } from 'lodash';\n\nexport default function setIfNotEmpty<T extends object>(obj: T, key: keyof T, value: any): void {\n if (isArray(value) || !isEmpty(value)) {\n set<T>(obj, key, value);\n }\n}\n","import * as dedent from 'dedent-js';\nimport { inspect } from 'util';\n\nexport default {\n\n ////////////\n // Errors //\n ////////////\n\n ContainerEntryNotFound(specifier: string, registryEntries: string[], resolverNames: string[]) {\n let registrationsOverview;\n if (registryEntries.length > 0) {\n registrationsOverview = dedent`\n Available manual registrations (via container.register(...)):\n - ${ registryEntries.join('\\n - ') }\n `;\n } else {\n registrationsOverview = dedent`\n There were no manually registered entries in the container.\n `;\n }\n\n let resolversOverview;\n if (resolverNames.length > 0) {\n resolversOverview = dedent`\n Available resolvers:\n - ${ resolverNames.join('\\n - ') }\n `;\n } else {\n resolversOverview = dedent`\n There were no resolvers available in the container.\n `;\n }\n return dedent`\n You tried to lookup a container entry under ${ specifier }, but the\n container has no such entry.\n\n ${ registrationsOverview }\n\n ${ resolversOverview }\n\n Run with DEBUG=verbose-denali:resolver:<resolver name> to trace a specific\n resolver's resolution\n `;\n },\n\n ContainerEntryNotAConstructor(specifier: string, value: any) {\n let str = dedent`\n You flagged ${ specifier } as a singleton, so the container expected to\n a constructor function under that entry.\n `;\n if (value === undefined) {\n str += dedent`\n Instead it found 'undefined'. Did you forget to add 'export default'\n to a file?\n `;\n } else {\n str += dedent`\n Instead it found:\n\n ${ inspect(value) }\n `;\n }\n return str;\n }\n\n};\n","import DAG from 'dag-map';\n\nexport interface Vertex {\n name: string;\n before: string | string[];\n after: string | string[];\n [key: string]: any;\n}\n\n/**\n * Take an array of vertices (objects with a name, value, and optional before / after), create a\n * directed acyclic graph of them, and return the vertex values in a sorted array.\n *\n * @package util\n */\nexport default function topsort(items: Vertex[], options: { valueKey?: string } = {}): any[] {\n let graph = new DAG();\n items.forEach((item) => {\n let value = options.valueKey ? item[options.valueKey] : item;\n graph.add(item.name, value, item.before, item.after);\n });\n let sorted: any[] = [];\n graph.topsort((key, value) => {\n sorted.push(value);\n });\n return sorted;\n}\n","\"use strict\";\nObject.defineProperty(exports, \"__esModule\", { value: true });\n"],"names":[],"mappings":";;;;;;;;;;;;;AAAA,iCAAiC;AACjC,qDAA8C;AAG9C,yDAAmD;AAEnD;;;;;;;;;GASG;AACH,iBAAiC,SAAQ,gBAAM;IAA/C;;QAME,WAAM,GAAG,kBAAM,CAAS,YAAY,CAAC,CAAC;QACtC,WAAM,GAAG,kBAAM,CAAa,aAAa,CAAC,CAAC;IAoC7C,CAAC;IAzCC,IAAI,cAAc;QAChB,MAAM,CAAC,IAAI,CAAC,OAAO,CAAC,eAAe,CAAC;IACtC,CAAC;IAKD;;OAEG;IACH,KAAK,CAAC,OAAO,CAAC,EAAE,MAAM,EAAO;QAC3B,IAAI,KAAK,GAAG,MAAM,CAAC,KAAK,CAAC;QACzB,MAAM,CAAC,KAAK,EAAE,uDAAuD,CAAC,CAAC;QACvE,8BAA8B;QAC9B,EAAE,CAAC,CAAC,CAAC,CAAC,KAAK,CAAC,MAAM,IAAI,KAAK,CAAC,MAAM,IAAI,GAAG,CAAC,IAAI,IAAI,CAAC,MAAM,CAAC,WAAW,KAAK,MAAM,CAAC,CAAC,CAAC;YACjF,IAAI,CAAC,MAAM,CAAC,KAAK,CAAC,WAAY,IAAI,CAAC,OAAO,CAAC,EAAG,cAAe,KAAK,CAAC,K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