mirror of
https://github.com/strapi/strapi.git
synced 2025-12-27 15:13:21 +00:00
Merge branch 'master' into add/inputs-to-ctb
This commit is contained in:
commit
82b8361229
@ -1,6 +1,6 @@
|
||||
{
|
||||
"private": true,
|
||||
"version": "3.0.0-alpha.9.2",
|
||||
"version": "3.0.0-alpha.9.3",
|
||||
"devDependencies": {
|
||||
"assert": "~1.3.0",
|
||||
"babel-eslint": "^6.1.2",
|
||||
|
||||
@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "strapi-admin",
|
||||
"version": "3.0.0-alpha.9.2",
|
||||
"version": "3.0.0-alpha.9.3",
|
||||
"description": "Strapi Admin",
|
||||
"repository": {
|
||||
"type": "git",
|
||||
@ -27,8 +27,8 @@
|
||||
},
|
||||
"devDependencies": {
|
||||
"sanitize.css": "^4.1.0",
|
||||
"strapi-helper-plugin": "3.0.0-alpha.9.2",
|
||||
"strapi-utils": "3.0.0-alpha.9.2"
|
||||
"strapi-helper-plugin": "3.0.0-alpha.9.3",
|
||||
"strapi-utils": "3.0.0-alpha.9.3"
|
||||
},
|
||||
"author": {
|
||||
"name": "Strapi",
|
||||
|
||||
@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "strapi-bookshelf",
|
||||
"version": "3.0.0-alpha.9.2",
|
||||
"version": "3.0.0-alpha.9.3",
|
||||
"description": "Bookshelf hook for the Strapi framework",
|
||||
"homepage": "http://strapi.io",
|
||||
"keywords": [
|
||||
@ -19,8 +19,8 @@
|
||||
"bookshelf": "^0.10.3",
|
||||
"lodash": "^4.17.4",
|
||||
"pluralize": "^6.0.0",
|
||||
"strapi-knex": "3.0.0-alpha.9.2",
|
||||
"strapi-utils": "3.0.0-alpha.9.2"
|
||||
"strapi-knex": "3.0.0-alpha.9.3",
|
||||
"strapi-utils": "3.0.0-alpha.9.3"
|
||||
},
|
||||
"strapi": {
|
||||
"isHook": true,
|
||||
|
||||
@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "strapi-ejs",
|
||||
"version": "3.0.0-alpha.9.2",
|
||||
"version": "3.0.0-alpha.9.3",
|
||||
"description": "EJS hook for the Strapi framework",
|
||||
"homepage": "http://strapi.io",
|
||||
"keywords": [
|
||||
|
||||
@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "strapi-generate-admin",
|
||||
"version": "3.0.0-alpha.9.2",
|
||||
"version": "3.0.0-alpha.9.3",
|
||||
"description": "Generate the default admin panel for a Strapi application.",
|
||||
"homepage": "http://strapi.io",
|
||||
"keywords": [
|
||||
@ -15,7 +15,7 @@
|
||||
"dependencies": {
|
||||
"fs-extra": "^4.0.1",
|
||||
"lodash": "^4.17.4",
|
||||
"strapi-admin": "3.0.0-alpha.9.2"
|
||||
"strapi-admin": "3.0.0-alpha.9.3"
|
||||
},
|
||||
"author": {
|
||||
"email": "hi@strapi.io",
|
||||
|
||||
@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "strapi-generate-api",
|
||||
"version": "3.0.0-alpha.9.2",
|
||||
"version": "3.0.0-alpha.9.3",
|
||||
"description": "Generate an API for a Strapi application.",
|
||||
"homepage": "http://strapi.io",
|
||||
"keywords": [
|
||||
|
||||
@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "strapi-generate-controller",
|
||||
"version": "3.0.0-alpha.9.2",
|
||||
"version": "3.0.0-alpha.9.3",
|
||||
"description": "Generate a controller for a Strapi API.",
|
||||
"homepage": "http://strapi.io",
|
||||
"keywords": [
|
||||
|
||||
@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "strapi-generate-model",
|
||||
"version": "3.0.0-alpha.9.2",
|
||||
"version": "3.0.0-alpha.9.3",
|
||||
"description": "Generate a model for a Strapi API.",
|
||||
"homepage": "http://strapi.io",
|
||||
"keywords": [
|
||||
|
||||
@ -5,6 +5,7 @@
|
||||
"connector": "strapi-mongoose",
|
||||
"settings": {
|
||||
"client": "mongo",
|
||||
"uri": "${process.env.DATABASE_URI || ''}",
|
||||
"host": "${process.env.DATABASE_HOST || '127.0.0.1'}",
|
||||
"port": "${process.env.DATABASE_PORT || 27017}",
|
||||
"database": "${process.env.DATABASE_NAME || 'production'}",
|
||||
|
||||
@ -1,6 +1,6 @@
|
||||
{
|
||||
"host": "127.0.0.1",
|
||||
"port": 1337,
|
||||
"port": "${process.env.PORT || 1337}",
|
||||
"autoReload": {
|
||||
"enabled": false
|
||||
},
|
||||
|
||||
@ -5,7 +5,8 @@
|
||||
"responseTime",
|
||||
"logger",
|
||||
"cors",
|
||||
"responses"
|
||||
"responses",
|
||||
"gzip"
|
||||
],
|
||||
"order": [
|
||||
"Define the middlewares' load order by putting their name in this array is the right order"
|
||||
|
||||
@ -145,7 +145,7 @@
|
||||
<h1>Welcome.</h1>
|
||||
<p>You successfully created your Strapi application.</p>
|
||||
<p>You are looking at: <code>./public/index.html</code>.</p>
|
||||
<p>Your built-in admin panel is available at <a href="http://localhost:1337/admin/" target="blank">http://localhost:1337/admin/</a>.
|
||||
<p>Your built-in admin panel is available at <a href="/admin" target="blank">/admin</a>.
|
||||
<h2>Create your first API</h2>
|
||||
<p>Easily generate a complete API with controllers, models and routes using:</p>
|
||||
<pre><code class="lang-bash">$ strapi generate:api <apiName></code></pre>
|
||||
|
||||
@ -119,6 +119,7 @@ module.exports = (scope, cb) => {
|
||||
|
||||
if (hasDatabaseConfig) {
|
||||
const databaseChoice = _.find(databaseChoices, ['value.database', scope.database.settings.client]);
|
||||
scope.database.connector = databaseChoice.value.connector;
|
||||
answers.client = {
|
||||
...databaseChoice.value
|
||||
};
|
||||
@ -141,7 +142,7 @@ module.exports = (scope, cb) => {
|
||||
when: !hasDatabaseConfig,
|
||||
type: 'input',
|
||||
prefix: '',
|
||||
name: 'name',
|
||||
name: 'database',
|
||||
message: 'Database name:',
|
||||
default: _.get(scope.database, 'database', 'strapi')
|
||||
},
|
||||
@ -185,10 +186,11 @@ module.exports = (scope, cb) => {
|
||||
},
|
||||
{
|
||||
when: !hasDatabaseConfig,
|
||||
type: 'input',
|
||||
type: 'password',
|
||||
prefix: '',
|
||||
name: 'password',
|
||||
message: 'Password:',
|
||||
mask: '*',
|
||||
default: _.get(scope.database, 'password', undefined)
|
||||
}
|
||||
])
|
||||
@ -200,7 +202,7 @@ module.exports = (scope, cb) => {
|
||||
|
||||
scope.database.settings.host = answers.host;
|
||||
scope.database.settings.port = answers.port;
|
||||
scope.database.settings.database = answers.name;
|
||||
scope.database.settings.database = answers.database;
|
||||
scope.database.settings.username = answers.username;
|
||||
scope.database.settings.password = answers.password;
|
||||
|
||||
|
||||
@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "strapi-generate-new",
|
||||
"version": "3.0.0-alpha.9.2",
|
||||
"version": "3.0.0-alpha.9.3",
|
||||
"description": "Generate a new Strapi application.",
|
||||
"homepage": "http://strapi.io",
|
||||
"keywords": [
|
||||
@ -18,7 +18,7 @@
|
||||
"get-installed-path": "^3.0.1",
|
||||
"inquirer": "^4.0.2",
|
||||
"lodash": "^4.17.4",
|
||||
"strapi-utils": "3.0.0-alpha.9.2",
|
||||
"strapi-utils": "3.0.0-alpha.9.3",
|
||||
"uuid": "^3.1.0"
|
||||
},
|
||||
"scripts": {
|
||||
|
||||
@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "strapi-generate-plugin",
|
||||
"version": "3.0.0-alpha.9.2",
|
||||
"version": "3.0.0-alpha.9.3",
|
||||
"description": "Generate an plugin for a Strapi application.",
|
||||
"homepage": "http://strapi.io",
|
||||
"keywords": [
|
||||
|
||||
@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "strapi-generate-policy",
|
||||
"version": "3.0.0-alpha.9.2",
|
||||
"version": "3.0.0-alpha.9.3",
|
||||
"description": "Generate a policy for a Strapi API.",
|
||||
"homepage": "http://strapi.io",
|
||||
"keywords": [
|
||||
|
||||
@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "strapi-generate-service",
|
||||
"version": "3.0.0-alpha.9.2",
|
||||
"version": "3.0.0-alpha.9.3",
|
||||
"description": "Generate a service for a Strapi API.",
|
||||
"homepage": "http://strapi.io",
|
||||
"keywords": [
|
||||
|
||||
@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "strapi-generate",
|
||||
"version": "3.0.0-alpha.9.2",
|
||||
"version": "3.0.0-alpha.9.3",
|
||||
"description": "Master of ceremonies for the Strapi generators.",
|
||||
"homepage": "http://strapi.io",
|
||||
"keywords": [
|
||||
@ -17,7 +17,7 @@
|
||||
"fs-extra": "^4.0.0",
|
||||
"lodash": "^4.17.4",
|
||||
"reportback": "^2.0.1",
|
||||
"strapi-utils": "3.0.0-alpha.9.2"
|
||||
"strapi-utils": "3.0.0-alpha.9.3"
|
||||
},
|
||||
"author": {
|
||||
"name": "Strapi team",
|
||||
|
||||
@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "strapi-helper-plugin",
|
||||
"version": "3.0.0-alpha.9.2",
|
||||
"version": "3.0.0-alpha.9.3",
|
||||
"description": "Helper for Strapi plugins development",
|
||||
"engines": {
|
||||
"node": ">= 8.0.0",
|
||||
|
||||
@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "strapi-knex",
|
||||
"version": "3.0.0-alpha.9.2",
|
||||
"version": "3.0.0-alpha.9.3",
|
||||
"description": "Knex hook for the Strapi framework",
|
||||
"homepage": "http://strapi.io",
|
||||
"keywords": [
|
||||
|
||||
@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "strapi-middleware-views",
|
||||
"version": "3.0.0-alpha.9.2",
|
||||
"version": "3.0.0-alpha.9.3",
|
||||
"description": "Views hook to enable server-side rendering for the Strapi framework",
|
||||
"homepage": "http://strapi.io",
|
||||
"keywords": [
|
||||
|
||||
@ -40,7 +40,7 @@ module.exports = function (strapi) {
|
||||
initialize: cb => {
|
||||
_.forEach(_.pickBy(strapi.config.connections, {connector: 'strapi-mongoose'}), (connection, connectionName) => {
|
||||
const instance = new Mongoose();
|
||||
const { host, port, username, password, database } = _.defaults(connection.settings, strapi.config.hook.settings.mongoose);
|
||||
const { uri, host, port, username, password, database } = _.defaults(connection.settings, strapi.config.hook.settings.mongoose);
|
||||
|
||||
// Connect to mongo database
|
||||
const connectOptions = {}
|
||||
@ -50,7 +50,8 @@ module.exports = function (strapi) {
|
||||
connectOptions.pass = password
|
||||
}
|
||||
}
|
||||
instance.connect(`mongodb://${host}:${port}/${database}`, connectOptions);
|
||||
|
||||
instance.connect(uri || `mongodb://${host}:${port}/${database}`, connectOptions);
|
||||
|
||||
// Handle error
|
||||
instance.connection.on('error', error => {
|
||||
|
||||
@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "strapi-mongoose",
|
||||
"version": "3.0.0-alpha.9.2",
|
||||
"version": "3.0.0-alpha.9.3",
|
||||
"description": "Mongoose hook for the Strapi framework",
|
||||
"homepage": "http://strapi.io",
|
||||
"keywords": [
|
||||
@ -19,7 +19,7 @@
|
||||
"mongoose": "^5.0.0-rc1",
|
||||
"mongoose-float": "^1.0.2",
|
||||
"pluralize": "^6.0.0",
|
||||
"strapi-utils": "3.0.0-alpha.9.2"
|
||||
"strapi-utils": "3.0.0-alpha.9.3"
|
||||
},
|
||||
"strapi": {
|
||||
"isHook": true
|
||||
|
||||
@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "strapi-plugin-content-manager",
|
||||
"version": "3.0.0-alpha.9.2",
|
||||
"version": "3.0.0-alpha.9.3",
|
||||
"description": "A powerful UI to easily manage your data.",
|
||||
"strapi": {
|
||||
"name": "Content Manager",
|
||||
@ -24,7 +24,7 @@
|
||||
},
|
||||
"devDependencies": {
|
||||
"react-select": "^1.0.0-rc.5",
|
||||
"strapi-helper-plugin": "3.0.0-alpha.9.2"
|
||||
"strapi-helper-plugin": "3.0.0-alpha.9.3"
|
||||
},
|
||||
"author": {
|
||||
"name": "Strapi team",
|
||||
|
||||
@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "strapi-plugin-content-type-builder",
|
||||
"version": "3.0.0-alpha.9.2",
|
||||
"version": "3.0.0-alpha.9.3",
|
||||
"description": "Strapi plugin to create content type (API).",
|
||||
"strapi": {
|
||||
"name": "Content Type Builder",
|
||||
@ -24,11 +24,11 @@
|
||||
},
|
||||
"dependencies": {
|
||||
"pluralize": "^7.0.0",
|
||||
"strapi-generate": "3.0.0-alpha.9.2",
|
||||
"strapi-generate-api": "3.0.0-alpha.9.2"
|
||||
"strapi-generate": "3.0.0-alpha.9.3",
|
||||
"strapi-generate-api": "3.0.0-alpha.9.3"
|
||||
},
|
||||
"devDependencies": {
|
||||
"strapi-helper-plugin": "3.0.0-alpha.9.2"
|
||||
"strapi-helper-plugin": "3.0.0-alpha.9.3"
|
||||
},
|
||||
"author": {
|
||||
"name": "Strapi team",
|
||||
|
||||
@ -79,7 +79,7 @@ module.exports = {
|
||||
return new Promise((resolve, reject) => {
|
||||
const scope = {
|
||||
generatorType: 'api',
|
||||
id: name,
|
||||
id: name.toLowerCase(),
|
||||
rootPath: strapi.config.appPath,
|
||||
args: {
|
||||
api: name,
|
||||
|
||||
@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "strapi-plugin-email",
|
||||
"version": "3.0.0-alpha.9.2",
|
||||
"version": "3.0.0-alpha.9.3",
|
||||
"description": "This is the description of the plugin.",
|
||||
"strapi": {
|
||||
"name": "Email",
|
||||
@ -26,7 +26,7 @@
|
||||
"sendmail": "^1.2.0"
|
||||
},
|
||||
"devDependencies": {
|
||||
"strapi-helper-plugin": "3.0.0-alpha.9.2"
|
||||
"strapi-helper-plugin": "3.0.0-alpha.9.3"
|
||||
},
|
||||
"author": {
|
||||
"name": "Strapi team",
|
||||
|
||||
@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "strapi-plugin-settings-manager",
|
||||
"version": "3.0.0-alpha.9.2",
|
||||
"version": "3.0.0-alpha.9.3",
|
||||
"description": "Strapi plugin to manage settings.",
|
||||
"strapi": {
|
||||
"name": "Settings Manager",
|
||||
@ -25,7 +25,7 @@
|
||||
"devDependencies": {
|
||||
"flag-icon-css": "^2.8.0",
|
||||
"react-select": "^1.0.0-rc.5",
|
||||
"strapi-helper-plugin": "3.0.0-alpha.9.2"
|
||||
"strapi-helper-plugin": "3.0.0-alpha.9.3"
|
||||
},
|
||||
"author": {
|
||||
"name": "Strapi team",
|
||||
|
||||
@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "strapi-plugin-users-permissions",
|
||||
"version": "3.0.0-alpha.9.2",
|
||||
"version": "3.0.0-alpha.9.3",
|
||||
"description": "Protect your API with a full-authentication process based on JWT",
|
||||
"strapi": {
|
||||
"name": "Auth & Permissions",
|
||||
@ -32,7 +32,7 @@
|
||||
"uuid": "^3.1.0"
|
||||
},
|
||||
"devDependencies": {
|
||||
"strapi-helper-plugin": "3.0.0-alpha.9.2"
|
||||
"strapi-helper-plugin": "3.0.0-alpha.9.3"
|
||||
},
|
||||
"author": {
|
||||
"name": "Strapi team",
|
||||
|
||||
@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "strapi-redis",
|
||||
"version": "3.0.0-alpha.9.2",
|
||||
"version": "3.0.0-alpha.9.3",
|
||||
"description": "Redis hook for the Strapi framework",
|
||||
"homepage": "http://strapi.io",
|
||||
"keywords": [
|
||||
@ -18,7 +18,7 @@
|
||||
"ioredis": "^3.1.2",
|
||||
"lodash": "^4.17.4",
|
||||
"stack-trace": "0.0.10",
|
||||
"strapi-utils": "3.0.0-alpha.9.2"
|
||||
"strapi-utils": "3.0.0-alpha.9.3"
|
||||
},
|
||||
"strapi": {
|
||||
"isHook": true
|
||||
|
||||
@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "strapi-utils",
|
||||
"version": "3.0.0-alpha.9.2",
|
||||
"version": "3.0.0-alpha.9.3",
|
||||
"description": "Shared utilities for the Strapi packages",
|
||||
"homepage": "http://strapi.io",
|
||||
"keywords": [
|
||||
|
||||
@ -27,7 +27,6 @@ module.exports = strapi => {
|
||||
// Log error.
|
||||
strapi.log.error(error);
|
||||
|
||||
|
||||
// Wrap error into a Boom's response.
|
||||
ctx.status = error.status || 500;
|
||||
ctx.body = _.get(ctx.body, 'isBoom')
|
||||
|
||||
@ -1,72 +0,0 @@
|
||||
'use strict';
|
||||
|
||||
/**
|
||||
* Module dependencies
|
||||
*/
|
||||
|
||||
// Public node modules.
|
||||
const _ = require('lodash');
|
||||
const Boom = require('boom');
|
||||
const delegate = require('delegates');
|
||||
|
||||
// Local utilities.
|
||||
const responses = require('./responses/index');
|
||||
|
||||
// Custom function to avoid ctx.body repeat
|
||||
const createResponses = ctx => {
|
||||
return _.merge(
|
||||
responses,
|
||||
_.mapValues(_.omit(Boom, ['create']), fn => (...rest) => {
|
||||
ctx.body = fn(...rest);
|
||||
})
|
||||
);
|
||||
};
|
||||
|
||||
/**
|
||||
* Policy used to add responses in the `this.response` object.
|
||||
*/
|
||||
|
||||
module.exports = async function(ctx, next) {
|
||||
const delegator = delegate(ctx, 'response');
|
||||
|
||||
_.forEach(createResponses(ctx), (value, key) => {
|
||||
// Assign new error methods to context.response
|
||||
ctx.response[key] = value;
|
||||
// Delegate error methods to context
|
||||
delegator.method(key);
|
||||
});
|
||||
|
||||
try {
|
||||
// App logic.
|
||||
await next();
|
||||
} catch (error) {
|
||||
// Log error.
|
||||
strapi.log.error(error);
|
||||
|
||||
// Wrap error into a Boom's response.
|
||||
ctx.status = error.status || 500;
|
||||
ctx.body = _.get(ctx.body, 'isBoom')
|
||||
? ctx.body || error && error.message
|
||||
: Boom.wrap(error, ctx.status, ctx.body || error.message);
|
||||
}
|
||||
|
||||
// Empty body is considered as `notFound` response.
|
||||
if (_.isUndefined(ctx.body) && _.isUndefined(ctx.status)) {
|
||||
ctx.notFound();
|
||||
}
|
||||
|
||||
if (_.isObject(ctx.body)) {
|
||||
if (ctx.body.isBoom && ctx.body.data) {
|
||||
ctx.body.output.payload.data = ctx.body.data;
|
||||
}
|
||||
|
||||
// Format `ctx.body` and `ctx.status`.
|
||||
ctx.status = ctx.body.isBoom ? ctx.body.output.statusCode : ctx.status;
|
||||
ctx.body = ctx.body.isBoom ? ctx.body.output.payload : ctx.body;
|
||||
}
|
||||
|
||||
// Call custom responses.
|
||||
if (_.isFunction(_.get(strapi.config, `functions.responses.${ctx.status}`))) {
|
||||
await strapi.config.functions.responses[ctx.status].call(this, ctx);
|
||||
}
|
||||
};
|
||||
@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "strapi",
|
||||
"version": "3.0.0-alpha.9.2",
|
||||
"version": "3.0.0-alpha.9.3",
|
||||
"description": "An open source solution to create and manage your own API. It provides a powerful dashboard and features to make your life easier.",
|
||||
"homepage": "http://strapi.io",
|
||||
"keywords": [
|
||||
@ -55,14 +55,14 @@
|
||||
"rimraf": "^2.6.2",
|
||||
"semver": "^5.4.1",
|
||||
"stack-trace": "0.0.10",
|
||||
"strapi-generate": "3.0.0-alpha.9.2",
|
||||
"strapi-generate-admin": "3.0.0-alpha.9.2",
|
||||
"strapi-generate-api": "3.0.0-alpha.9.2",
|
||||
"strapi-generate-new": "3.0.0-alpha.9.2",
|
||||
"strapi-generate-plugin": "3.0.0-alpha.9.2",
|
||||
"strapi-generate-policy": "3.0.0-alpha.9.2",
|
||||
"strapi-generate-service": "3.0.0-alpha.9.2",
|
||||
"strapi-utils": "3.0.0-alpha.9.2"
|
||||
"strapi-generate": "3.0.0-alpha.9.3",
|
||||
"strapi-generate-admin": "3.0.0-alpha.9.3",
|
||||
"strapi-generate-api": "3.0.0-alpha.9.3",
|
||||
"strapi-generate-new": "3.0.0-alpha.9.3",
|
||||
"strapi-generate-plugin": "3.0.0-alpha.9.3",
|
||||
"strapi-generate-policy": "3.0.0-alpha.9.3",
|
||||
"strapi-generate-service": "3.0.0-alpha.9.3",
|
||||
"strapi-utils": "3.0.0-alpha.9.3"
|
||||
},
|
||||
"author": {
|
||||
"email": "hi@strapi.io",
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user