How to use fortune - 8 common examples

To help you get started, we’ve selected a few fortune examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github fortunejs / fortune-postgres / relational.js View on Github external
var fortune = require('fortune')
  , orm = require('orm')
  , RSVP = fortune.RSVP
  , _ = fortune._;

var adapter = {};

adapter._init = function(options) {
  var _this = this;

  // Setup ORM instance.
  this.orm = orm.connect({
    host: options.host,
    database: options.db,
    protocol: options.adapter,
    user: options.username,
    password: options.password,
    port: options.port,
    query: options.flags
github fortunejs / fortune-postgres / relational.js View on Github external
var fortune = require('fortune')
  , orm = require('orm')
  , RSVP = fortune.RSVP
  , _ = fortune._;

var adapter = {};

adapter._init = function(options) {
  var _this = this;

  // Setup ORM instance.
  this.orm = orm.connect({
    host: options.host,
    database: options.db,
    protocol: options.adapter,
    user: options.username,
    password: options.password,
    port: options.port,
    query: options.flags
  });
github joefiorini / baby-barter / server / site.js View on Github external
}, function(e) {
    fortune.RSVP.rethrow(e);
    console.error("error authenticating user: ", e);
    res.send(500);
  });
}
github joefiorini / baby-barter / server / site.js View on Github external
sittings: ['sitting']
}).transform(auth.before, auth.after).

resource("sitting", {
  startedAt: Date,
  endedAt: Date,
  requestedBy: 'family',
  performedBy: {ref: 'family', inverse: 'sittings'}
}).

resource("token", {
  owner: 'family',
  value: String
});

fortune.RSVP.configure("onerror", function(error) {
  if(error) {
    console.error("error resolving promise: ", error.stack);
  }
});

var pbkdf2 = {
    iterations: Math.pow(2, 16),
      keylen: Math.pow(2, 8)
};

function authentication(req, res, next) {
  if(!req.path.match(/sessions/i)) return next();
  if(!req.header('content-type').match(/^application\/json/)) {
    return res.send(412);
  }
github genie-team / graphql-genie / src / FortuneGraph.ts View on Github external
if (badSchema) {
							console.error('Bad schema. Types that share unions/interfaces have fields of the same name but different types. This is not allowed\n',
								'fortune type', fortuneName, '\n',
								'field name', fieldName, '\n',
								'currType', fortuneConfigForName[fieldName], '\n',
								'newType', fields[fieldName]);
						}

					}
				});
				fortuneConfig[fortuneName] = fortuneConfigForName;
			}

		});
		const store = fortune(fortuneConfig, this.fortuneOptions);
		window['store'] = store;
		return store;
	}
github genie-team / graphql-genie / src / FortuneGraph.ts View on Github external
if (badSchema) {
							console.error('Bad schema. Types that share unions/interfaces have fields of the same name but different types. This is not allowed\n',
								'fortune type', fortuneName, '\n',
								'field name', fieldName, '\n',
								'currType', fortuneConfigForName[fieldName], '\n',
								'newType', fields[fieldName]);
						}

					}
				});
				fortuneConfig[fortuneName] = fortuneConfigForName;
			}

		});
		const store = fortune(fortuneConfig, this.fortuneOptions);
		window['store'] = store;
		return store;
	}
github genie-team / graphql-genie / lib / FortuneGraph.js View on Github external
const newType = fields[fieldName];
                        if (!currType) {
                            fortuneConfigForName[fieldName] = newType;
                        }
                        else {
                            let badSchema = typeof newType !== typeof currType;
                            badSchema = badSchema ? badSchema : !isEqual(fortuneConfigForName[fieldName], fields[fieldName]);
                            if (badSchema) {
                                console.error('Bad schema. Types that share unions/interfaces have fields of the same name but different types. This is not allowed\n', 'fortune type', fortuneName, '\n', 'field name', fieldName, '\n', 'currType', fortuneConfigForName[fieldName], '\n', 'newType', fields[fieldName]);
                            }
                        }
                    });
                    fortuneConfig[fortuneName] = fortuneConfigForName;
                }
            });
            const store = fortune(fortuneConfig, this.fortuneOptions);
            window['store'] = store;
            return store;
        };
        this.generateOptions = (options, graphQLTypeName, ids) => {
github joefiorini / baby-barter / server / auth-transform.js View on Github external
function checkUser(user, compareToken) {
  return new fortune.RSVP.Promise(function(resolve, reject) {
    if(!compareToken) return reject();

    global.app.adapter.findMany('token', user.links.tokens).then(function(tokens) {

      var tokenFound = false;

      tokens.forEach(function(token) {
        if(token.value == compareToken) {
          tokenFound = true;
          resolve(user);
        }
      });

      if(!tokenFound) reject("token not found");

    }, function() {

fortune

Non-native graph database abstraction layer for Node.js and web browsers.

MIT
Latest version published 2 months ago

Package Health Score

76 / 100
Full package analysis

Popular fortune functions