alaska-settings
Advanced tools
Comparing version 0.10.1 to 0.11.0
@@ -1,14 +0,3 @@ | ||
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { | ||
value: true | ||
}); | ||
/** | ||
* @copyright Maichong Software Ltd. 2016 http://maichong.it | ||
* @date 2016-03-01 | ||
* @author Liang <liang@maichong.it> | ||
*/ | ||
exports.default = { | ||
export default { | ||
prefix: false | ||
}; | ||
}; |
105
index.js
@@ -1,35 +0,13 @@ | ||
'use strict'; | ||
// @flow | ||
Object.defineProperty(exports, "__esModule", { | ||
value: true | ||
}); | ||
exports.routes = undefined; | ||
import { Service } from 'alaska'; | ||
var _co = require('co'); | ||
var _alaska = require('alaska'); | ||
var _alaska2 = _interopRequireDefault(_alaska); | ||
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } | ||
const debug = require('debug')('alaska-settings'); | ||
//为 alaska-admin-view 注入设置编辑器 | ||
/** | ||
* @copyright Maichong Software Ltd. 2016 http://maichong.it | ||
* @date 2016-03-01 | ||
* @author Liang <liang@maichong.it> | ||
* @class SettingsService | ||
*/ | ||
class SettingsService extends Service { | ||
const routes = exports.routes = [{ | ||
component: __dirname + '/views/SettingsEditor', | ||
path: 'settings' | ||
}]; | ||
/** | ||
* @class SettingsService | ||
*/ | ||
class SettingsService extends _alaska2.default.Service { | ||
constructor(options) { | ||
constructor(options?: Alaska$Service$options) { | ||
options = options || {}; | ||
@@ -43,22 +21,19 @@ options.dir = options.dir || __dirname; | ||
* 注册新设置选项 | ||
* @param {Object} data | ||
* @param data | ||
* @returns {Settings} | ||
*/ | ||
register(data) { | ||
var _this = this; | ||
async register(data: Object) { | ||
const Settings = this.model('Settings'); | ||
return (0, _co.wrap)(function* () { | ||
const Settings = _this.model('Settings'); | ||
const id = data.id || data._id; | ||
let settings = yield Settings.findCache(id); | ||
if (settings) { | ||
return settings; | ||
} | ||
settings = new Settings(data); | ||
settings._id = id; | ||
debug('register', id); | ||
yield settings.save(); | ||
const id = data.id || data._id; | ||
// $Flow | ||
let settings: Settings = await Settings.findById(id); | ||
if (settings) { | ||
return settings; | ||
})(); | ||
} | ||
settings = new Settings(data); | ||
settings._id = id; | ||
debug('register', id); | ||
await settings.save(); | ||
return settings; | ||
} | ||
@@ -71,12 +46,9 @@ | ||
*/ | ||
get(id) { | ||
var _this2 = this; | ||
return (0, _co.wrap)(function* () { | ||
const Settings = _this2.model('Settings'); | ||
let record = yield Settings.findCache(id); | ||
let value = record ? record.value : undefined; | ||
debug('get', id, '=>', value); | ||
return value; | ||
})(); | ||
async get(id: string|number) { | ||
const Settings = this.model('Settings'); | ||
// $Flow | ||
let record = await Settings.findById(id); | ||
let value = record ? record.value : undefined; | ||
debug('get', id, '=>', value); | ||
return value; | ||
} | ||
@@ -90,19 +62,16 @@ | ||
*/ | ||
set(id, value) { | ||
var _this3 = this; | ||
return (0, _co.wrap)(function* () { | ||
debug('set', id, '=>', value); | ||
const Settings = _this3.model('Settings'); | ||
let record = yield Settings.findCache(id); | ||
if (!record) { | ||
return null; | ||
} | ||
record.value = value; | ||
yield record.save(); | ||
return record; | ||
})(); | ||
async set(id: string|number, value: any) { | ||
debug('set', id, '=>', value); | ||
const Settings = this.model('Settings'); | ||
// $Flow | ||
let record = await Settings.findById(id); | ||
if (!record) { | ||
return null; | ||
} | ||
record.value = value; | ||
await record.save(); | ||
return record; | ||
} | ||
} | ||
exports.default = new SettingsService(); | ||
export default new SettingsService(); |
@@ -1,13 +0,2 @@ | ||
'use strict'; | ||
Object.defineProperty(exports, "__esModule", { | ||
value: true | ||
}); | ||
/** | ||
* @copyright Maichong Software Ltd. 2016 http://maichong.it | ||
* @date 2016-04-03 | ||
* @author Liang <liang@maichong.it> | ||
*/ | ||
exports.default = { | ||
export default{ | ||
Settings: 'Settings', | ||
@@ -19,2 +8,2 @@ Group: 'Group', | ||
'Basic Settings': 'Basic Settings' | ||
}; | ||
}; |
@@ -1,13 +0,2 @@ | ||
'use strict'; | ||
Object.defineProperty(exports, "__esModule", { | ||
value: true | ||
}); | ||
/** | ||
* @copyright Maichong Software Ltd. 2016 http://maichong.it | ||
* @date 2016-04-03 | ||
* @author Liang <liang@maichong.it> | ||
*/ | ||
exports.default = { | ||
export default{ | ||
Settings: '设置', | ||
@@ -19,2 +8,2 @@ Group: '组', | ||
'Basic Settings': '基础设置' | ||
}; | ||
}; |
@@ -1,97 +0,96 @@ | ||
'use strict'; | ||
// @flow | ||
Object.defineProperty(exports, "__esModule", { | ||
value: true | ||
}); | ||
import { Model } from 'alaska'; | ||
var _alaska = require('alaska'); | ||
export default class Settings extends Model { | ||
static label = 'Settings'; | ||
static icon = 'cogs'; | ||
static defaultSort = 'group service'; | ||
static defaultColumns = '_id title group service'; | ||
static cache = 600; //缓存10分钟 | ||
var _alaska2 = _interopRequireDefault(_alaska); | ||
static defaultFilters = (ctx) => { | ||
if (!ctx.state.superMode) { | ||
return { super: { $ne: true } }; | ||
} | ||
return {}; | ||
}; | ||
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } | ||
class Settings extends _alaska2.default.Model {} | ||
exports.default = Settings; /** | ||
* @copyright Maichong Software Ltd. 2016 http://maichong.it | ||
* @date 2016-04-03 | ||
* @author Liang <liang@maichong.it> | ||
*/ | ||
Settings.label = 'Settings'; | ||
Settings.icon = 'cogs'; | ||
Settings.defaultSort = 'group service'; | ||
Settings.defaultColumns = '_id title group service'; | ||
Settings.cache = 600; | ||
Settings.defaultFilters = ctx => { | ||
if (!ctx.state.superMode) { | ||
return { super: { $ne: true } }; | ||
} | ||
}; | ||
Settings.fields = { | ||
_id: String, | ||
title: { | ||
label: 'Title', | ||
type: String | ||
}, | ||
service: { | ||
label: 'Service', | ||
type: String | ||
}, | ||
group: { | ||
label: 'Group', | ||
type: String | ||
}, | ||
value: { | ||
label: 'Value', | ||
type: Object, | ||
default: null | ||
}, | ||
help: { | ||
label: 'Help', | ||
type: String | ||
}, | ||
type: { | ||
label: 'Type', | ||
type: 'select', | ||
default: 'MixedFieldView', | ||
options: [{ | ||
label: 'Text', | ||
value: 'TextFieldView' | ||
}, { | ||
label: 'Number', | ||
value: 'NumberFieldView' | ||
}, { | ||
label: 'Checkbox', | ||
value: 'CheckboxFieldView' | ||
}, { | ||
label: 'Select', | ||
value: 'SelectFieldView' | ||
}, { | ||
label: 'Date', | ||
value: 'DateFieldView' | ||
}, { | ||
label: 'Datetime', | ||
value: 'DatetimeFieldView' | ||
}, { | ||
label: 'Mixed', | ||
value: 'MixedFieldView' | ||
}, { | ||
label: 'Html', | ||
value: 'HtmlFieldView' | ||
}, { | ||
label: 'Image', | ||
value: 'ImageFieldView' | ||
}] | ||
}, | ||
super: { | ||
label: 'Super', | ||
type: Boolean | ||
}, | ||
options: { | ||
label: 'Options', | ||
type: Object, | ||
default: {} | ||
} | ||
}; | ||
static fields = { | ||
_id: { | ||
type: String | ||
}, | ||
title: { | ||
label: 'Title', | ||
type: String | ||
}, | ||
service: { | ||
label: 'Service', | ||
type: String | ||
}, | ||
group: { | ||
label: 'Group', | ||
type: String | ||
}, | ||
value: { | ||
label: 'Value', | ||
type: Object, | ||
default: null | ||
}, | ||
help: { | ||
label: 'Help', | ||
type: String | ||
}, | ||
type: { | ||
label: 'Type', | ||
type: 'select', | ||
default: 'MixedFieldView', | ||
options: [{ | ||
label: 'Text', | ||
value: 'TextFieldView' | ||
}, { | ||
label: 'Number', | ||
value: 'NumberFieldView' | ||
}, { | ||
label: 'Checkbox', | ||
value: 'CheckboxFieldView' | ||
}, { | ||
label: 'Select', | ||
value: 'SelectFieldView' | ||
}, { | ||
label: 'Date', | ||
value: 'DateFieldView' | ||
}, { | ||
label: 'Datetime', | ||
value: 'DatetimeFieldView' | ||
}, { | ||
label: 'Mixed', | ||
value: 'MixedFieldView' | ||
}, { | ||
label: 'Html', | ||
value: 'HtmlFieldView' | ||
}, { | ||
label: 'Image', | ||
value: 'ImageFieldView' | ||
}] | ||
}, | ||
super: { | ||
label: 'Super', | ||
type: Boolean | ||
}, | ||
options: { | ||
label: 'Options', | ||
type: Object, | ||
default: {} | ||
} | ||
}; | ||
_id: string|number|Object|any; | ||
title: string; | ||
service: string; | ||
group: string; | ||
value: Object; | ||
help: string; | ||
type: string; | ||
super: boolean; | ||
options: Object; | ||
} |
{ | ||
"name": "alaska-settings", | ||
"version": "0.10.1", | ||
"version": "0.11.0", | ||
"description": "Alaska settings service", | ||
@@ -10,31 +10,11 @@ "keywords": [ | ||
"main": "index.js", | ||
"scripts": { | ||
"build": "babel ./src --out-dir ./", | ||
"watch": "babel ./src --out-dir ./ -w", | ||
"prebuild": "rimraf lib api controllers config locales middlewares models sleds views", | ||
"prepublish": "npm run build" | ||
}, | ||
"repository": { | ||
"type": "git", | ||
"url": "git+https://github.com/maichong/alaska-settings.git" | ||
}, | ||
"author": { | ||
"email": "liang@maichong.it", | ||
"name": "liang", | ||
"url": "https://github.com/liangxingchen" | ||
}, | ||
"repository": "https://github.com/maichong/alaska/tree/master/packages/alaska-settings", | ||
"author": "Liang <liang@maichong.it> (https://github.com/liangxingchen)", | ||
"license": "MIT", | ||
"bugs": { | ||
"url": "https://github.com/maichong/alaska-settings/issues" | ||
}, | ||
"homepage": "https://github.com/maichong/alaska-settings#readme", | ||
"peerDependencies": { | ||
"alaska": "^0.10.6" | ||
}, | ||
"dependencies": { | ||
"alaska-field-mixed": "^0.10.1", | ||
"alaska-field-select": "^0.10.2", | ||
"alaska-field-text": "^0.10.3", | ||
"debug": "^2.2.0" | ||
"alaska-field-mixed": "^0.11.0", | ||
"alaska-field-select": "^0.11.0", | ||
"alaska-field-text": "^0.11.0", | ||
"debug": "^2.6.3" | ||
} | ||
} |
# alaska-settings | ||
Alaska settings service |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
Found 1 instance in 1 package
No bug tracker
MaintenancePackage does not have a linked bug tracker in package.json.
Found 1 instance in 1 package
No repository
Supply chain riskPackage does not have a linked source code repository. Without this field, a package will have no reference to the location of the source code use to generate the package.
Found 1 instance in 1 package
No website
QualityPackage does not have a website.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
4
9077
340
2
2
1
1
+ Addedalaska-field-checkbox@0.11.22(transitive)
+ Addedalaska-field-mixed@0.11.12(transitive)
+ Addedalaska-field-select@0.11.22(transitive)
+ Addedalaska-field-text@0.11.15(transitive)
+ Addedclassnames@2.5.1(transitive)
+ Addedreact@16.14.0(transitive)
+ Addedreact-dom@16.14.0(transitive)
+ Addedreact-input-autosize@2.2.2(transitive)
+ Addedreact-select@1.3.0(transitive)
+ Addedscheduler@0.19.1(transitive)
- Removed@babel/runtime@7.26.0(transitive)
- Removedaccepts@1.3.8(transitive)
- Removedalaska@0.10.10(transitive)
- Removedalaska-cache-lru@0.10.0(transitive)
- Removedalaska-field-checkbox@0.10.2(transitive)
- Removedalaska-field-mixed@0.10.1(transitive)
- Removedalaska-field-select@0.10.4(transitive)
- Removedalaska-field-text@0.10.3(transitive)
- Removedalaska-render-swig@0.10.0(transitive)
- Removedamdefine@1.0.1(transitive)
- Removedany-promise@1.3.0(transitive)
- Removedasap@2.0.6(transitive)
- Removedasync@0.2.102.6.0(transitive)
- Removedbluebird@3.5.0(transitive)
- Removedbson@1.0.9(transitive)
- Removedbuffer-shims@1.0.0(transitive)
- Removedcache-content-type@1.0.1(transitive)
- Removedcamelcase@1.2.1(transitive)
- Removedchain-function@1.0.1(transitive)
- Removedco@4.6.0(transitive)
- Removedcollie@0.2.1(transitive)
- Removedcontent-disposition@0.5.4(transitive)
- Removedcontent-type@1.0.5(transitive)
- Removedcookies@0.9.1(transitive)
- Removedcore-js@1.2.7(transitive)
- Removedcore-util-is@1.0.3(transitive)
- Removedcreate-react-class@15.7.0(transitive)
- Removeddebug@3.2.74.3.7(transitive)
- Removeddecamelize@1.2.0(transitive)
- Removeddeep-equal@1.0.1(transitive)
- Removeddelegates@1.0.0(transitive)
- Removeddepd@1.1.22.0.0(transitive)
- Removeddestroy@1.2.0(transitive)
- Removeddom-helpers@3.4.0(transitive)
- Removedee-first@1.1.1(transitive)
- Removedencodeurl@1.0.2(transitive)
- Removedencoding@0.1.13(transitive)
- Removedes6-promise@3.2.1(transitive)
- Removedescape-html@1.0.3(transitive)
- Removedfbjs@0.8.18(transitive)
- Removedfresh@0.5.2(transitive)
- Removedhas-symbols@1.0.3(transitive)
- Removedhas-tostringtag@1.0.2(transitive)
- Removedhooks-fixed@2.0.2(transitive)
- Removedhttp-assert@1.5.0(transitive)
- Removedhttp-errors@1.8.1(transitive)
- Removediconv-lite@0.6.3(transitive)
- Removedinherits@2.0.4(transitive)
- Removedintl-messageformat@1.3.0(transitive)
- Removedintl-messageformat-parser@1.2.0(transitive)
- Removedis-generator-function@1.0.10(transitive)
- Removedis-stream@1.1.0(transitive)
- Removedisarray@0.0.11.0.0(transitive)
- Removedisomorphic-fetch@2.2.1(transitive)
- Removedkareem@1.5.0(transitive)
- Removedkeygrip@1.1.0(transitive)
- Removedkoa@2.15.3(transitive)
- Removedkoa-compose@3.2.14.2.0(transitive)
- Removedkoa-convert@2.0.0(transitive)
- Removedkoa-qs@2.0.0(transitive)
- Removedkoa-router@7.4.0(transitive)
- Removedlodash@4.17.21(transitive)
- Removedlodash.get@4.4.2(transitive)
- Removedlru-cache@4.1.5(transitive)
- Removedmedia-typer@0.3.0(transitive)
- Removedmerge-descriptors@0.0.2(transitive)
- Removedmethods@1.1.2(transitive)
- Removedmime@1.6.0(transitive)
- Removedmime-db@1.52.0(transitive)
- Removedmime-types@2.1.35(transitive)
- Removedminimist@0.0.10(transitive)
- Removedmongodb@2.2.34(transitive)
- Removedmongodb-core@2.1.18(transitive)
- Removedmongoose@4.13.21(transitive)
- Removedmpath@0.5.1(transitive)
- Removedmpromise@0.5.5(transitive)
- Removedmquery@2.3.3(transitive)
- Removedms@2.1.3(transitive)
- Removedmuri@1.3.0(transitive)
- Removedmz@2.7.0(transitive)
- Removednegotiator@0.6.3(transitive)
- Removednode-fetch@1.7.3(transitive)
- Removedon-finished@2.4.1(transitive)
- Removedonly@0.0.2(transitive)
- Removedoptimist@0.6.1(transitive)
- Removedparseurl@1.3.3(transitive)
- Removedpath-to-regexp@1.9.0(transitive)
- Removedprelude-extension@0.0.13(transitive)
- Removedprelude-ls@1.2.1(transitive)
- Removedprocess-nextick-args@1.0.7(transitive)
- Removedpromise@7.3.1(transitive)
- Removedpseudomap@1.0.2(transitive)
- Removedqs@2.3.3(transitive)
- Removedreact@15.7.0(transitive)
- Removedreact-addons-css-transition-group@15.6.2(transitive)
- Removedreact-addons-shallow-compare@15.6.3(transitive)
- Removedreact-dom@15.7.0(transitive)
- Removedreact-selectize@2.1.0(transitive)
- Removedreact-transition-group@1.2.1(transitive)
- Removedreadable-stream@2.2.7(transitive)
- Removedregenerator-runtime@0.14.1(transitive)
- Removedregexp-clone@0.0.1(transitive)
- Removedrequire_optional@1.0.1(transitive)
- Removedresolve-from@2.0.0(transitive)
- Removedsafe-buffer@5.1.25.2.1(transitive)
- Removedsafer-buffer@2.1.2(transitive)
- Removedsemver@5.7.2(transitive)
- Removedsetimmediate@1.0.5(transitive)
- Removedsetprototypeof@1.2.0(transitive)
- Removedsliced@0.0.51.0.1(transitive)
- Removedsource-map@0.1.34(transitive)
- Removedstatuses@1.5.0(transitive)
- Removedstring-random@0.1.3(transitive)
- Removedstring_decoder@1.0.3(transitive)
- Removedswig@1.4.2(transitive)
- Removedtether@1.4.7(transitive)
- Removedthenify@3.3.1(transitive)
- Removedthenify-all@1.6.0(transitive)
- Removedtoidentifier@1.0.1(transitive)
- Removedtsscmp@1.0.6(transitive)
- Removedtype-is@1.6.18(transitive)
- Removedua-parser-js@0.7.39(transitive)
- Removeduglify-js@2.4.24(transitive)
- Removeduglify-to-browserify@1.0.2(transitive)
- Removedurijs@1.19.11(transitive)
- Removedutil-deprecate@1.0.2(transitive)
- Removedvary@1.1.2(transitive)
- Removedwarning@3.0.0(transitive)
- Removedwhatwg-fetch@3.6.20(transitive)
- Removedwindow-size@0.1.0(transitive)
- Removedwordwrap@0.0.20.0.3(transitive)
- Removedyallist@2.1.2(transitive)
- Removedyargs@3.5.4(transitive)
- Removedylru@1.4.0(transitive)
Updatedalaska-field-mixed@^0.11.0
Updatedalaska-field-select@^0.11.0
Updatedalaska-field-text@^0.11.0
Updateddebug@^2.6.3