git ssb

0+

Piet / ssb-loomio



Commit b4e7ba90af1e22153fb4b857f562935d5b33d350

extract raw methods api

mix irving committed on 3/5/2018, 5:08:33 AM
Parent: 07a5f24f2034628892c7c9ed0782b63b30fc7911

Files changed

index.jschanged
methods.jsadded
stance.jsdeleted
index.jsView
@@ -1,23 +1,12 @@
1-const verboseMethods = {
2- poll: {
3- async: {
4- // publishPoll: require('./async/publishPoll')
5- },
6- sync: {
7- isPoll: require('./sync/isPoll')
8- // Poll: // this is not exported - doesn't follow the inject pattern atm
9- }
10- },
11- position: {
1+const raw = require('./methods')
122
13- }
3+const niceMappings = {
4+ isPoll: raw.poll.sync.isPoll
145 }
6+// by following this pattern you can write your own API
157
16-const easyMethods = {
17- isPoll: require('./sync/isPoll')
18-}
8+module.exports = function (server, opts) {
9+ const methods = Object.assign({}, raw, niceMappings)
1910
20-module.exports = function (server, opts) {
21- const methods = Object.assign({}, verboseMethods, easyMethods)
2211 return require('./lib/inject')(server, methods)
2312 }
methods.jsView
@@ -1,0 +1,18 @@
1+// verbose export of public methods
2+
3+module.exports = {
4+ poll: {
5+ async: {
6+ // publishPoll: require('./async/publishPoll')
7+ },
8+ sync: {
9+ isPoll: require('./poll/sync/isPoll')
10+ // Poll: // this is not exported - doesn't follow the inject pattern atm
11+ }
12+ },
13+ position: {
14+ sync: {
15+ isPosition: require('./position/sync/isPosition')
16+ }
17+ }
18+}
stance.jsView
@@ -1,17 +1,0 @@
1-var Validate = require('is-my-json-valid')
2-const { msgIdRegex, feedIdRegex, blobIdRegex } = require('ssb-ref')
3-
4-function create () {
5-
6-}
7-
8-const schema = {
9-}
10-
11-const validate = Validate(schema, { verbose: true })
12-
13-module.exports = {
14- create,
15- schema,
16- validate
17-}

Built with git-ssb-web