├── .gitignore ├── .npmignore ├── README.md ├── lerna.json ├── package-lock.json ├── package.json ├── packages ├── blueprint-cli │ ├── .gitignore │ ├── LICENSE │ ├── README.md │ ├── bin │ │ └── blueprint │ ├── cli │ │ └── commands │ │ │ ├── generate │ │ │ └── index.js │ │ │ └── new │ │ │ ├── index.js │ │ │ └── templates │ │ │ ├── .gitignore │ │ │ ├── app │ │ │ ├── assets │ │ │ │ └── .gitkeep │ │ │ ├── configs │ │ │ │ ├── app.js │ │ │ │ ├── env │ │ │ │ │ ├── development │ │ │ │ │ │ └── .gitkeep │ │ │ │ │ ├── production │ │ │ │ │ │ └── .gitkeep │ │ │ │ │ └── test │ │ │ │ │ │ └── .gitkeep │ │ │ │ └── server.js │ │ │ ├── controllers │ │ │ │ └── helloworld.js │ │ │ ├── index.js │ │ │ ├── listeners │ │ │ │ └── blueprint.app.started │ │ │ │ │ └── console.js │ │ │ ├── models │ │ │ │ └── .gitkeep │ │ │ ├── policies │ │ │ │ └── .gitkeep │ │ │ ├── routers │ │ │ │ └── helloworld.js │ │ │ ├── sanitizers │ │ │ │ └── .gitkeep │ │ │ ├── validators │ │ │ │ └── .gitkeep │ │ │ └── views │ │ │ │ └── helloworld.pug │ │ │ ├── package.json │ │ │ └── tests │ │ │ └── unit-tests │ │ │ └── bootstrap.js │ ├── lib │ │ ├── command-factory.js │ │ ├── command.js │ │ ├── entity-generator.js │ │ ├── generator.js │ │ ├── index.js │ │ ├── installer.js │ │ ├── module-finder.js │ │ ├── program-context.js │ │ ├── simple-command-factory.js │ │ └── template-path.js │ ├── package-lock.json │ ├── package.json │ └── tests │ │ └── dummy │ │ ├── cli │ │ ├── commands │ │ │ └── mock │ │ │ │ └── index.js │ │ └── generators │ │ │ └── test:generator │ │ │ ├── files │ │ │ └── app │ │ │ │ └── models │ │ │ │ └── {{entityName}}.js │ │ │ └── index.js │ │ └── package.json ├── blueprint-compression │ ├── .gitignore │ ├── LICENSE │ ├── README.md │ ├── app │ │ ├── configs │ │ │ ├── app.js │ │ │ ├── env │ │ │ │ ├── development │ │ │ │ │ └── .gitkeep │ │ │ │ ├── production │ │ │ │ │ └── .gitkeep │ │ │ │ └── test │ │ │ │ │ └── .gitkeep │ │ │ └── server.js │ │ ├── index.js │ │ └── services │ │ │ └── compression.js │ ├── package.json │ ├── tests │ │ ├── dummy │ │ │ ├── app │ │ │ │ ├── assets │ │ │ │ │ └── big.txt │ │ │ │ ├── configs │ │ │ │ │ ├── app.js │ │ │ │ │ ├── compression.js │ │ │ │ │ ├── server.js │ │ │ │ │ └── test │ │ │ │ │ │ ├── .gitkeep │ │ │ │ │ │ └── app.js │ │ │ │ ├── controllers │ │ │ │ │ └── asset.js │ │ │ │ ├── index.js │ │ │ │ └── routers │ │ │ │ │ └── asset.js │ │ │ └── package.json │ │ └── unit-tests │ │ │ ├── app │ │ │ └── compression-test.js │ │ │ └── bootstrap.js │ └── yarn.lock ├── blueprint-cron │ ├── .gitignore │ ├── LICENSE.md │ ├── README.md │ ├── app │ │ ├── index.js │ │ └── services │ │ │ └── cron.js │ ├── lib │ │ ├── index.js │ │ └── job.js │ ├── package-lock.json │ ├── package.json │ ├── tests │ │ ├── dummy │ │ │ ├── app │ │ │ │ ├── configs │ │ │ │ │ ├── app.js │ │ │ │ │ ├── env │ │ │ │ │ │ └── development │ │ │ │ │ │ │ ├── .gitkeep │ │ │ │ │ │ │ └── app.js │ │ │ │ │ └── server.js │ │ │ │ ├── controllers │ │ │ │ │ └── helloworld.js │ │ │ │ ├── cronjobs │ │ │ │ │ └── basic.js │ │ │ │ ├── index.js │ │ │ │ └── routers │ │ │ │ │ └── helloworld.js │ │ │ ├── package-lock.json │ │ │ └── package.json │ │ └── unit-tests │ │ │ ├── bootstrap.js │ │ │ └── lib │ │ │ └── job-tests.js │ └── yarn.lock ├── blueprint-deploy │ ├── cli │ │ └── commands │ │ │ └── deploy │ │ │ ├── README.md │ │ │ └── index.js │ ├── package-lock.json │ └── package.json ├── blueprint-dfinity │ ├── README.md │ ├── app │ │ ├── assets │ │ │ └── .gitkeep │ │ ├── configs │ │ │ ├── app.js │ │ │ ├── env │ │ │ │ ├── development │ │ │ │ │ └── .gitkeep │ │ │ │ ├── production │ │ │ │ │ └── .gitkeep │ │ │ │ └── test │ │ │ │ │ └── .gitkeep │ │ │ └── server.js │ │ ├── controllers │ │ │ └── helloworld.js │ │ ├── index.js │ │ ├── listeners │ │ │ └── blueprint.app.started │ │ │ │ └── console.js │ │ ├── models │ │ │ └── .gitkeep │ │ ├── policies │ │ │ └── .gitkeep │ │ ├── routers │ │ │ └── helloworld.js │ │ ├── sanitizers │ │ │ └── .gitkeep │ │ ├── services │ │ │ └── dfinity.js │ │ ├── validators │ │ │ └── .gitkeep │ │ └── views │ │ │ └── helloworld.pug │ ├── examples │ │ └── actors │ │ │ ├── basic_bitcoin.js │ │ │ ├── calc.js │ │ │ ├── counter.js │ │ │ ├── factorial.js │ │ │ ├── helloworld.js │ │ │ ├── phone-book.js │ │ │ ├── quicksort.js │ │ │ └── whoami.js │ ├── lib │ │ ├── actor-builder.js │ │ ├── actor.js │ │ ├── decorators │ │ │ ├── function.js │ │ │ ├── query.js │ │ │ └── update.js │ │ ├── descriptors │ │ │ ├── function.js │ │ │ ├── query.js │ │ │ └── update.js │ │ ├── identity │ │ │ ├── index.js │ │ │ ├── key.js │ │ │ └── seed.js │ │ ├── index.js │ │ └── properties │ │ │ └── actor.js │ ├── package-lock.json │ ├── package.json │ └── tests │ │ ├── dummy │ │ ├── app │ │ │ ├── actors │ │ │ │ └── hello.js │ │ │ ├── assets │ │ │ │ ├── dummy.pem │ │ │ │ └── seed.txt │ │ │ ├── configs │ │ │ │ └── env │ │ │ │ │ └── test │ │ │ │ │ ├── app.js │ │ │ │ │ └── dfinity.js │ │ │ ├── controllers │ │ │ │ └── hello.js │ │ │ ├── index.js │ │ │ └── routers │ │ │ │ └── hello.js │ │ └── package.json │ │ └── unit-tests │ │ ├── app │ │ ├── routers │ │ │ └── hello-test.js │ │ └── services │ │ │ └── dfinity-test.js │ │ ├── bootstrap.js │ │ └── lib │ │ ├── actor-test.js │ │ └── identity │ │ ├── key-test.js │ │ └── seed-test.js ├── blueprint-emberjs │ ├── LICENSE.md │ ├── app │ │ ├── assets │ │ │ └── .gitkeep │ │ ├── configs │ │ │ ├── app.js │ │ │ ├── env │ │ │ │ ├── development │ │ │ │ │ └── .gitkeep │ │ │ │ ├── production │ │ │ │ │ └── .gitkeep │ │ │ │ └── test │ │ │ │ │ └── .gitkeep │ │ │ └── server.js │ │ ├── index.js │ │ ├── listeners │ │ │ └── .gitkeep │ │ ├── models │ │ │ └── .gitkeep │ │ ├── policies │ │ │ └── .gitkeep │ │ └── resources │ │ │ └── handlebars │ │ │ ├── helpers │ │ │ └── encode-content.js │ │ │ └── partials │ │ │ ├── blueprint.head.hbs │ │ │ ├── facebook.hbs │ │ │ ├── linked-in.hbs │ │ │ ├── og.hbs │ │ │ └── twitter.hbs │ ├── lib │ │ ├── ember-app-action.js │ │ ├── ember-app.js │ │ ├── ember-router.js │ │ └── index.js │ ├── package-lock.json │ ├── package.json │ └── tests │ │ └── unit-tests │ │ └── bootstrap.js ├── blueprint-firebase-messaging │ ├── .gitignore │ ├── .npmignore │ ├── .travis.yml │ ├── LICENSE │ ├── app │ │ ├── controllers │ │ │ └── firebase-device.js │ │ ├── listeners │ │ │ ├── .gitkeep │ │ │ ├── gatekeeper.account.deleted │ │ │ │ └── remove-tokens-for-account.js │ │ │ └── gatekeeper.session.logout │ │ │ │ └── remove-token-for-session.js │ │ ├── models │ │ │ ├── firebase-device.js │ │ │ └── firebase-notification.js │ │ ├── policies │ │ │ ├── .gitkeep │ │ │ └── firebase │ │ │ │ └── device │ │ │ │ ├── create.js │ │ │ │ ├── delete.js │ │ │ │ ├── owner.js │ │ │ │ └── update.js │ │ ├── routers │ │ │ └── v1 │ │ │ │ └── firebase-devices.js │ │ └── services │ │ │ └── fcm.js │ ├── package-lock.json │ ├── package.json │ └── tests │ │ ├── dummy │ │ ├── app │ │ │ ├── configs │ │ │ │ ├── app.js │ │ │ │ ├── env │ │ │ │ │ ├── development │ │ │ │ │ │ └── firebase.js │ │ │ │ │ └── test │ │ │ │ │ │ ├── .gitkeep │ │ │ │ │ │ └── app.js │ │ │ │ ├── firebase.js │ │ │ │ ├── gatekeeper.js │ │ │ │ ├── mongodb.js │ │ │ │ └── server.js │ │ │ ├── controllers │ │ │ │ └── push.js │ │ │ ├── index.js │ │ │ ├── routers │ │ │ │ └── v1.js │ │ │ └── seeds │ │ │ │ └── mongodb │ │ │ │ └── env │ │ │ │ ├── development │ │ │ │ └── $default.js │ │ │ │ └── test │ │ │ │ └── $default.js │ │ └── package.json │ │ └── unit-tests │ │ ├── app │ │ ├── routers │ │ │ └── v1 │ │ │ │ └── device.js │ │ └── services │ │ │ └── fcm-test.js │ │ └── bootstrap.js ├── blueprint-gatekeeper-cli │ ├── .gitignore │ ├── .npmignore │ ├── .travis.yml │ ├── LICENSE │ ├── README.md │ ├── bin │ │ ├── gatekeeper │ │ ├── gatekeeper-account │ │ ├── gatekeeper-account-add │ │ ├── gatekeeper-account-passwd │ │ ├── gatekeeper-account-remove │ │ ├── gatekeeper-client │ │ ├── gatekeeper-client-add │ │ └── gatekeeper-client-remove │ ├── lib │ │ └── GatekeeperClient.js │ ├── package-lock.json │ └── package.json ├── blueprint-gatekeeper-client │ ├── .gitignore │ ├── LICENSE │ ├── app │ │ ├── configs │ │ │ ├── app.js │ │ │ ├── env │ │ │ │ ├── development │ │ │ │ │ └── .gitkeep │ │ │ │ ├── production │ │ │ │ │ └── .gitkeep │ │ │ │ └── test │ │ │ │ │ └── .gitkeep │ │ │ └── server.js │ │ ├── index.js │ │ └── services │ │ │ └── gatekeeper.js │ ├── package-lock.json │ ├── package.json │ ├── tests │ │ ├── dummy │ │ │ ├── app │ │ │ │ ├── configs │ │ │ │ │ ├── app.js │ │ │ │ │ ├── env │ │ │ │ │ │ └── test │ │ │ │ │ │ │ ├── .gitkeep │ │ │ │ │ │ │ ├── app.js │ │ │ │ │ │ │ └── gatekeeper.js │ │ │ │ │ ├── mongodb.js │ │ │ │ │ └── server.js │ │ │ │ └── index.js │ │ │ ├── package.json │ │ │ └── yarn.lock │ │ └── unit-tests │ │ │ ├── app │ │ │ └── services │ │ │ │ └── gatekeeper-test.js │ │ │ └── bootstrap.js │ └── yarn.lock ├── blueprint-gatekeeper │ ├── .gitignore │ ├── .npmignore │ ├── .travis.yml │ ├── LICENSE │ ├── README.md │ ├── app │ │ ├── -internal │ │ │ ├── granter.js │ │ │ ├── granters │ │ │ │ ├── client_credentials.js │ │ │ │ ├── index.js │ │ │ │ ├── password.js │ │ │ │ ├── refresh_token.js │ │ │ │ └── temp.js │ │ │ └── token-generator.js │ │ ├── configs │ │ │ └── env │ │ │ │ └── development │ │ │ │ ├── app.js │ │ │ │ ├── gatekeeper.js │ │ │ │ ├── mongodb.js │ │ │ │ └── server.js │ │ ├── controllers │ │ │ └── gatekeeper │ │ │ │ ├── account.js │ │ │ │ ├── client.js │ │ │ │ ├── oauth2 │ │ │ │ └── token.js │ │ │ │ ├── password.js │ │ │ │ └── verification.js │ │ ├── index.js │ │ ├── models │ │ │ ├── -common-options.js │ │ │ ├── -visitor.js │ │ │ ├── access-token.js │ │ │ ├── account.js │ │ │ ├── android.js │ │ │ ├── client-token.js │ │ │ ├── client.js │ │ │ ├── event.js │ │ │ ├── hybrid.js │ │ │ ├── native.js │ │ │ ├── recaptcha.js │ │ │ ├── resource-event.js │ │ │ └── user-token.js │ │ ├── policies │ │ │ └── gatekeeper │ │ │ │ ├── account │ │ │ │ ├── create.js │ │ │ │ ├── delete.js │ │ │ │ ├── getAll.js │ │ │ │ ├── getOne.js │ │ │ │ ├── impersonate.js │ │ │ │ ├── me.js │ │ │ │ ├── password │ │ │ │ │ └── change.js │ │ │ │ ├── search.js │ │ │ │ ├── update.js │ │ │ │ ├── verified.js │ │ │ │ └── verify.js │ │ │ │ ├── auth │ │ │ │ ├── basic.js │ │ │ │ ├── bearer.js │ │ │ │ └── recaptcha.js │ │ │ │ ├── client │ │ │ │ ├── create.js │ │ │ │ ├── delete.js │ │ │ │ ├── get_all.js │ │ │ │ ├── search.js │ │ │ │ └── update.js │ │ │ │ ├── clients │ │ │ │ ├── android.js │ │ │ │ ├── index.js │ │ │ │ ├── native.js │ │ │ │ └── recaptcha.js │ │ │ │ ├── password │ │ │ │ └── reset.js │ │ │ │ ├── request │ │ │ │ ├── client.js │ │ │ │ └── user.js │ │ │ │ ├── resource │ │ │ │ └── owner.js │ │ │ │ └── scope.js │ │ ├── resources │ │ │ └── mailer │ │ │ │ └── templates │ │ │ │ ├── gatekeeper.account.verification │ │ │ │ ├── html.hbs │ │ │ │ └── subject.hbs │ │ │ │ ├── gatekeeper.password.changed │ │ │ │ ├── html.hbs │ │ │ │ └── subject.hbs │ │ │ │ └── gatekeeper.password.reset │ │ │ │ ├── html.hbs │ │ │ │ └── subject.hbs │ │ ├── routers │ │ │ ├── endpoints.js │ │ │ └── v1 │ │ │ │ ├── account.js │ │ │ │ ├── client.js │ │ │ │ ├── oauth2 │ │ │ │ └── token.js │ │ │ │ ├── password.js │ │ │ │ └── verification.js │ │ ├── seeds │ │ │ └── mongodb │ │ │ │ └── env │ │ │ │ └── development │ │ │ │ └── $default.js │ │ ├── services │ │ │ ├── account.js │ │ │ ├── env │ │ │ │ └── test │ │ │ │ │ └── gatekeeper-test.js │ │ │ ├── gatekeeper.js │ │ │ ├── issuer.js │ │ │ ├── recaptcha.js │ │ │ ├── session.js │ │ │ └── verification.js │ │ └── validators │ │ │ └── isMongoIdOrMe.js │ ├── bin │ │ └── gatekeeper-setup │ ├── examples │ │ └── dab.js │ ├── lib │ │ ├── auth-controller.js │ │ ├── cors.js │ │ ├── index.js │ │ ├── password-policy.js │ │ ├── resource-controller.js │ │ ├── token-generator.js │ │ └── user-resource-controller.js │ ├── package-lock.json │ ├── package.json │ └── tests │ │ ├── README.md │ │ ├── dummy │ │ ├── app │ │ │ ├── configs │ │ │ │ ├── app.js │ │ │ │ └── env │ │ │ │ │ └── test │ │ │ │ │ ├── .gitkeep │ │ │ │ │ ├── app.js │ │ │ │ │ ├── gatekeeper.js │ │ │ │ │ ├── mailer.js │ │ │ │ │ ├── mongodb.js │ │ │ │ │ └── server.js │ │ │ ├── controllers │ │ │ │ ├── book.js │ │ │ │ └── verified.js │ │ │ ├── index.js │ │ │ ├── models │ │ │ │ └── book.js │ │ │ ├── policies │ │ │ │ ├── book │ │ │ │ │ └── delete.js │ │ │ │ └── gatekeeper │ │ │ │ │ └── account │ │ │ │ │ └── password │ │ │ │ │ └── check.js │ │ │ ├── routers │ │ │ │ ├── basic.js │ │ │ │ ├── book.js │ │ │ │ ├── v1.js │ │ │ │ └── verified.js │ │ │ └── seeds │ │ │ │ └── mongodb │ │ │ │ └── $default.js │ │ └── package.json │ │ └── unit-tests │ │ ├── app │ │ ├── models │ │ │ ├── access-token-test.js │ │ │ ├── account-test.js │ │ │ └── user-token-test.js │ │ ├── policies │ │ │ └── gatekeeper │ │ │ │ ├── account │ │ │ │ └── verified-test.js │ │ │ │ ├── auth │ │ │ │ └── bearer-test.js │ │ │ │ ├── resource │ │ │ │ └── owner.js │ │ │ │ └── scope-test.js │ │ ├── routers │ │ │ └── v1 │ │ │ │ ├── account-test.js │ │ │ │ ├── client-test.js │ │ │ │ ├── oauth2 │ │ │ │ └── token-test.js │ │ │ │ ├── password-test.js │ │ │ │ └── verification-test.js │ │ └── services │ │ │ ├── gatekeeper-test.js │ │ │ ├── issuer-test.js │ │ │ ├── recaptcha-test.js │ │ │ └── session-test.js │ │ ├── bootstrap.js │ │ └── lib │ │ ├── token-generator-test.js │ │ └── user-resource-controller-test.js ├── blueprint-greenlock │ ├── .gitignore │ ├── .idea │ │ ├── blueprint-greenlock.iml │ │ ├── copyright │ │ │ └── One_Hill_Technologies__LLC__Apache_2_0_.xml │ │ ├── dictionaries │ │ │ └── hilljh.xml │ │ ├── encodings.xml │ │ ├── misc.xml │ │ ├── modules.xml │ │ └── workspace.xml │ ├── LICENSE │ ├── README.md │ ├── app │ │ ├── index.js │ │ └── services │ │ │ └── greenlock.js │ ├── lib │ │ ├── approve-domains.js │ │ ├── basic-approve-domains.js │ │ └── index.js │ ├── package-lock.json │ ├── package.json │ ├── tests │ │ ├── dummy │ │ │ ├── app │ │ │ │ ├── configs │ │ │ │ │ ├── app.js │ │ │ │ │ ├── env │ │ │ │ │ │ └── development │ │ │ │ │ │ │ ├── .gitkeep │ │ │ │ │ │ │ ├── app.js │ │ │ │ │ │ │ └── greenlock.js │ │ │ │ │ └── server.js │ │ │ │ ├── controllers │ │ │ │ │ └── helloworld.js │ │ │ │ ├── index.js │ │ │ │ └── routers │ │ │ │ │ └── helloworld.js │ │ │ └── package.json │ │ └── unit-tests │ │ │ ├── app │ │ │ └── services │ │ │ │ └── greenlock-test.js │ │ │ └── bootstrap.js │ └── yarn.lock ├── blueprint-handlebars │ ├── LICENSE │ ├── app │ │ ├── index.js │ │ └── services │ │ │ └── handlebars.js │ ├── lib │ │ └── template-compiler.js │ ├── package-lock.json │ ├── package.json │ └── tests │ │ └── unit-tests │ │ └── bootstrap.js ├── blueprint-mailer │ ├── .gitignore │ ├── LICENSE.md │ ├── app │ │ ├── controllers │ │ │ └── email.js │ │ ├── index.js │ │ ├── models │ │ │ └── email.js │ │ ├── routers │ │ │ └── v1 │ │ │ │ └── email.js │ │ └── services │ │ │ ├── mailer.js │ │ │ └── mailgun.js │ ├── lib │ │ └── template-compiler.js │ ├── package-lock.json │ ├── package.json │ └── tests │ │ ├── dummy │ │ ├── app │ │ │ ├── configs │ │ │ │ └── env │ │ │ │ │ └── test │ │ │ │ │ ├── mailer.js │ │ │ │ │ ├── mailgun.js │ │ │ │ │ └── mongodb.js │ │ │ └── resources │ │ │ │ └── mailer │ │ │ │ └── templates │ │ │ │ └── helloworld │ │ │ │ ├── html.css │ │ │ │ ├── html.hbs │ │ │ │ ├── html.scss │ │ │ │ ├── subject.hbs │ │ │ │ └── text.hbs │ │ └── package.json │ │ └── unit-tests │ │ ├── bootstrap.js │ │ └── services │ │ └── mailer.js ├── blueprint-mongodb │ ├── .gitignore │ ├── .npmignore │ ├── .travis.yml │ ├── LICENSE │ ├── README.md │ ├── app │ │ ├── listeners │ │ │ └── blueprint.test.start │ │ │ │ └── seed-database-for-test.js │ │ ├── models │ │ │ └── __mongodb.js │ │ ├── sanitizers │ │ │ ├── toDate.js │ │ │ ├── toMongoId.js │ │ │ └── toMongoIdFromToken.js │ │ ├── services │ │ │ ├── env │ │ │ │ └── test │ │ │ │ │ └── mongodb-context.js │ │ │ ├── mongodb.js │ │ │ └── oidgen.js │ │ └── validators │ │ │ ├── isDate.js │ │ │ └── isMongoId.js │ ├── cli │ │ └── generators │ │ │ ├── mongodb:model │ │ │ ├── files │ │ │ │ └── app │ │ │ │ │ └── models │ │ │ │ │ └── {{entityName}}.js │ │ │ └── index.js │ │ │ ├── mongodb:resource │ │ │ ├── files │ │ │ │ └── app │ │ │ │ │ ├── controllers │ │ │ │ │ └── {{entityName}}.js │ │ │ │ │ ├── models │ │ │ │ │ └── {{entityName}}.js │ │ │ │ │ └── routers │ │ │ │ │ └── {{entityName}}.js │ │ │ └── index.js │ │ │ └── mongodb:seed │ │ │ ├── files │ │ │ └── app │ │ │ │ └── seeds │ │ │ │ └── mongodb │ │ │ │ └── {{entityName}}.js │ │ │ └── index.js │ ├── lib │ │ ├── connection.js │ │ ├── gridfs-controller.js │ │ ├── index.js │ │ ├── migration.js │ │ ├── models.js │ │ ├── plugins │ │ │ ├── const.js │ │ │ ├── hidden.js │ │ │ ├── index.js │ │ │ ├── lean.js │ │ │ └── stat.js │ │ ├── populate │ │ │ ├── add-model-visitor.js │ │ │ ├── index.js │ │ │ ├── model-registry.js │ │ │ ├── populate-array.js │ │ │ ├── populate-element.js │ │ │ ├── populate-embedded-array.js │ │ │ ├── populate-embedded.js │ │ │ ├── populate-visitor.js │ │ │ ├── populate.js │ │ │ ├── population.js │ │ │ └── unseen-id-visitor.js │ │ ├── resource-controller.js │ │ ├── schema │ │ │ └── types │ │ │ │ └── ref.js │ │ ├── seed │ │ │ ├── planter.js │ │ │ ├── seed.js │ │ │ └── store.js │ │ ├── subdocument-resource-controller.js │ │ ├── utils │ │ │ ├── index.js │ │ │ ├── lean.js │ │ │ └── seed.js │ │ └── validation │ │ │ ├── build.js │ │ │ ├── date.js │ │ │ ├── index.js │ │ │ ├── number.js │ │ │ ├── objectid.js │ │ │ └── string.js │ ├── package-lock.json │ ├── package.json │ ├── tests │ │ ├── data │ │ │ ├── avatar1.png │ │ │ └── avatar2.png │ │ ├── dummy │ │ │ ├── app │ │ │ │ ├── configs │ │ │ │ │ ├── mongodb.js │ │ │ │ │ └── server.js │ │ │ │ ├── controllers │ │ │ │ │ ├── author.js │ │ │ │ │ ├── book.js │ │ │ │ │ ├── callbacks.js │ │ │ │ │ ├── image.js │ │ │ │ │ └── user.js │ │ │ │ ├── index.js │ │ │ │ ├── migrations │ │ │ │ │ └── mongodb │ │ │ │ │ │ └── up │ │ │ │ │ │ └── 2.js │ │ │ │ ├── models │ │ │ │ │ ├── author.js │ │ │ │ │ ├── book.js │ │ │ │ │ └── user.js │ │ │ │ ├── routers │ │ │ │ │ ├── author.js │ │ │ │ │ ├── book.js │ │ │ │ │ ├── callbacks.js │ │ │ │ │ ├── image.js │ │ │ │ │ └── user.js │ │ │ │ └── seeds │ │ │ │ │ └── mongodb │ │ │ │ │ └── $default.js │ │ │ └── package.json │ │ └── unit-tests │ │ │ ├── app │ │ │ ├── sanitizers │ │ │ │ ├── toDate-test.js │ │ │ │ └── toMongoId-test.js │ │ │ ├── services │ │ │ │ └── mongodb-test.js │ │ │ └── validators │ │ │ │ └── isDate-test.js │ │ │ ├── bootstrap.js │ │ │ └── lib │ │ │ ├── gridfs-controller-test.js │ │ │ ├── lean-test.js │ │ │ ├── models-test.js │ │ │ ├── plugins │ │ │ ├── const-test.js │ │ │ ├── hidden-test.js │ │ │ └── stat-test.js │ │ │ ├── populate │ │ │ ├── index-test.js │ │ │ ├── model-registry-test.js │ │ │ ├── populate-element-test.js │ │ │ └── population-test.js │ │ │ ├── resource-controller-test.js │ │ │ └── validators │ │ │ ├── date-test.js │ │ │ ├── number-test.js │ │ │ └── objectid-test.js │ └── yarn.lock ├── blueprint-python │ ├── LICENSE │ ├── README.md │ ├── app │ │ ├── configs │ │ │ ├── app.js │ │ │ ├── env │ │ │ │ ├── development │ │ │ │ │ └── .gitkeep │ │ │ │ ├── production │ │ │ │ │ └── .gitkeep │ │ │ │ └── test │ │ │ │ │ └── .gitkeep │ │ │ └── server.js │ │ ├── index.js │ │ ├── policies │ │ │ └── .gitkeep │ │ └── services │ │ │ └── python.js │ ├── package-lock.json │ ├── package.json │ └── tests │ │ ├── dummy │ │ ├── app │ │ │ └── assets │ │ │ │ └── scripts │ │ │ │ ├── delayed-helloworld.py │ │ │ │ └── helloworld.py │ │ └── package.json │ │ └── unit-tests │ │ ├── app │ │ └── services │ │ │ └── python-test.js │ │ └── bootstrap.js ├── blueprint-schedule │ ├── app │ │ ├── index.js │ │ └── services │ │ │ └── schedule.js │ ├── lib │ │ ├── index.js │ │ ├── last-time-run-file.js │ │ └── schedule.js │ ├── package-lock.json │ ├── package.json │ ├── tests │ │ ├── dummy │ │ │ ├── app │ │ │ │ ├── index.js │ │ │ │ └── schedules │ │ │ │ │ ├── basic-schedule.js │ │ │ │ │ └── run-if-first-time.js │ │ │ └── package.json │ │ └── unit-tests │ │ │ ├── app │ │ │ └── services │ │ │ │ └── schedule-test.js │ │ │ └── bootstrap.js │ └── yarn.lock ├── blueprint-sequelize │ ├── .gitignore │ ├── LICENSE │ ├── README.md │ ├── app │ │ ├── listeners │ │ │ └── blueprint.test.start │ │ │ │ └── seed.js │ │ └── services │ │ │ └── sequelize.js │ ├── lib │ │ ├── flatten.js │ │ ├── index.js │ │ ├── models.js │ │ ├── resource-controller.js │ │ ├── seed.js │ │ └── utils │ │ │ ├── index.js │ │ │ ├── lean.js │ │ │ └── seed.js │ ├── package-lock.json │ ├── package.json │ ├── tests │ │ ├── dummy │ │ │ ├── app │ │ │ │ ├── configs │ │ │ │ │ ├── sequelize.js │ │ │ │ │ └── server.js │ │ │ │ ├── controllers │ │ │ │ │ └── project.js │ │ │ │ ├── index.js │ │ │ │ ├── models │ │ │ │ │ ├── organization.js │ │ │ │ │ └── project.js │ │ │ │ ├── routers │ │ │ │ │ └── project.js │ │ │ │ └── seeds │ │ │ │ │ └── sequelize │ │ │ │ │ └── $default.js │ │ │ └── package.json │ │ └── unit-tests │ │ │ ├── bootstrap.js │ │ │ └── lib │ │ │ └── resource-controller-test.js │ └── yarn.lock ├── blueprint-socket.io │ ├── .gitignore │ ├── .npmignore │ ├── LICENSE │ ├── README.md │ ├── app │ │ └── services │ │ │ └── io.js │ ├── lib │ │ ├── connection-listener.js │ │ ├── index.js │ │ └── properties │ │ │ ├── namespace-descriptor.js │ │ │ └── socket-descriptor.js │ ├── package-lock.json │ ├── package.json │ ├── tests │ │ ├── .gitkeep │ │ ├── dummy │ │ │ ├── app │ │ │ │ ├── .DS_Store │ │ │ │ ├── configs │ │ │ │ │ └── server.js │ │ │ │ ├── controllers │ │ │ │ │ └── chat.js │ │ │ │ ├── index.js │ │ │ │ ├── listeners │ │ │ │ │ └── socket.io.connection │ │ │ │ │ │ ├── com │ │ │ │ │ │ └── onehilltech │ │ │ │ │ │ │ └── README.md │ │ │ │ │ │ └── connection.js │ │ │ │ ├── routers │ │ │ │ │ └── chat.js │ │ │ │ └── views │ │ │ │ │ └── index.handlebars │ │ │ └── package.json │ │ └── unit-tests │ │ │ └── bootstrap.js │ └── yarn.lock ├── blueprint-stripe │ ├── .gitignore │ ├── LICENSE │ ├── app │ │ ├── controllers │ │ │ ├── stripe-account.js │ │ │ ├── stripe-balance.js │ │ │ ├── stripe-external-account.js │ │ │ ├── stripe-person.js │ │ │ └── stripe.js │ │ ├── index.js │ │ ├── routers │ │ │ ├── stripe-connect.js │ │ │ └── stripe.js │ │ └── services │ │ │ └── stripe.js │ ├── lib │ │ ├── index.js │ │ ├── models │ │ │ ├── index.js │ │ │ └── stripe-account-ref.js │ │ ├── stripe-account-action.js │ │ ├── stripe-action.js │ │ └── stripe-resource-controller.js │ ├── package-lock.json │ ├── package.json │ └── tests │ │ └── unit-tests │ │ └── bootstrap.js ├── blueprint-swagger │ ├── .gitignore │ ├── .npmignore │ ├── LICENSE │ ├── README.md │ ├── app │ │ ├── controllers │ │ │ └── swagger.js │ │ ├── listeners │ │ │ └── blueprint.app.init │ │ │ │ └── initSwaggerUI.js │ │ ├── routers │ │ │ └── v1 │ │ │ │ └── swagger.js │ │ └── views │ │ │ └── swagger.handlebars │ ├── lib │ │ └── specification.js │ ├── package-lock.json │ ├── package.json │ ├── public_html │ │ ├── css │ │ │ ├── print.css │ │ │ ├── reset.css │ │ │ ├── screen.css │ │ │ ├── style.css │ │ │ └── typography.css │ │ ├── fonts │ │ │ ├── DroidSans-Bold.ttf │ │ │ └── DroidSans.ttf │ │ ├── images │ │ │ ├── collapse.gif │ │ │ ├── expand.gif │ │ │ ├── explorer_icons.png │ │ │ ├── favicon-16x16.png │ │ │ ├── favicon-32x32.png │ │ │ ├── favicon.ico │ │ │ ├── logo_small.png │ │ │ ├── pet_store_api.png │ │ │ ├── throbber.gif │ │ │ └── wordnik_api.png │ │ ├── index.html │ │ ├── lang │ │ │ ├── ca.js │ │ │ ├── en.js │ │ │ ├── es.js │ │ │ ├── fr.js │ │ │ ├── geo.js │ │ │ ├── it.js │ │ │ ├── ja.js │ │ │ ├── ko-kr.js │ │ │ ├── pl.js │ │ │ ├── pt.js │ │ │ ├── ru.js │ │ │ ├── tr.js │ │ │ ├── translator.js │ │ │ └── zh-cn.js │ │ ├── lib │ │ │ ├── backbone-min.js │ │ │ ├── es5-shim.js │ │ │ ├── handlebars-4.0.5.js │ │ │ ├── highlight.9.1.0.pack.js │ │ │ ├── highlight.9.1.0.pack_extended.js │ │ │ ├── jquery-1.8.0.min.js │ │ │ ├── jquery.ba-bbq.min.js │ │ │ ├── jquery.slideto.min.js │ │ │ ├── jquery.wiggle.min.js │ │ │ ├── js-yaml.min.js │ │ │ ├── jsoneditor.min.js │ │ │ ├── lodash.min.js │ │ │ ├── marked.js │ │ │ ├── object-assign-pollyfill.js │ │ │ ├── sanitize-html.min.js │ │ │ └── swagger-oauth.js │ │ ├── o2c.html │ │ ├── swagger-ui.js │ │ └── swagger-ui.min.js │ └── tests │ │ ├── .gitkeep │ │ ├── fixtures │ │ └── mock-app │ │ │ ├── .gitignore │ │ │ ├── .npmignore │ │ │ ├── app │ │ │ ├── configs │ │ │ │ ├── app.config.js │ │ │ │ ├── development │ │ │ │ │ └── .gitkeep │ │ │ │ ├── mongodb.config.js │ │ │ │ ├── production │ │ │ │ │ └── .gitkeep │ │ │ │ ├── server.config.js │ │ │ │ └── test │ │ │ │ │ └── .gitkeep │ │ │ ├── controllers │ │ │ │ └── HelloWorldController.js │ │ │ ├── hooks │ │ │ │ └── module.init.js │ │ │ ├── index.js │ │ │ ├── listeners │ │ │ │ └── .gitkeep │ │ │ ├── models │ │ │ │ └── User.js │ │ │ ├── policies │ │ │ │ └── .gitkeep │ │ │ ├── resources │ │ │ │ └── .gitkeep │ │ │ ├── routers │ │ │ │ └── MainRouter.js │ │ │ └── views │ │ │ │ └── helloworld.pug │ │ │ ├── package.json │ │ │ └── tests │ │ │ ├── .gitkeep │ │ │ ├── fixtures │ │ │ └── appPath.js │ │ │ ├── integration-tests │ │ │ └── .gitkeep │ │ │ └── unit-tests │ │ │ └── .gitkeep │ │ ├── integration-tests │ │ └── .gitkeep │ │ └── unit-tests │ │ ├── .gitkeep │ │ └── lib │ │ └── specificationTest.js ├── blueprint-testing │ ├── .gitignore │ ├── LICENSE │ ├── lib │ │ ├── bootstrap.js │ │ ├── index.js │ │ └── request.js │ ├── package-lock.json │ └── package.json ├── blueprint-urls │ ├── LICENSE │ ├── app │ │ ├── controllers │ │ │ ├── redirect.js │ │ │ └── short-url.js │ │ ├── models │ │ │ └── short-url.js │ │ ├── routers │ │ │ ├── redirect.js │ │ │ └── short-url.js │ │ └── services │ │ │ ├── url-shortener.js │ │ │ └── urls.js │ ├── lib │ │ └── redirect-action.js │ ├── package-lock.json │ ├── package.json │ └── tests │ │ ├── dummy │ │ ├── app │ │ │ ├── configs │ │ │ │ ├── .gitkeep │ │ │ │ ├── mongodb.js │ │ │ │ ├── server.js │ │ │ │ └── urls.js │ │ │ ├── controllers │ │ │ │ └── .gitkeep │ │ │ ├── index.js │ │ │ ├── models │ │ │ │ └── .gitkeep │ │ │ ├── routers │ │ │ │ ├── .gitkeep │ │ │ │ └── links.js │ │ │ └── seeds │ │ │ │ ├── .gitkeep │ │ │ │ └── mongodb │ │ │ │ └── $default.js │ │ └── package.json │ │ └── unit-tests │ │ ├── app │ │ ├── controllers │ │ │ └── redirect-test.js │ │ ├── models │ │ │ └── short-url-test.js │ │ └── services │ │ │ ├── url-shortener-test.js │ │ │ └── urls-test.js │ │ └── bootstrap.js ├── blueprint-winston │ ├── app │ │ ├── assets │ │ │ └── .gitkeep │ │ ├── index.js │ │ ├── models │ │ │ └── .gitkeep │ │ ├── policies │ │ │ └── .gitkeep │ │ └── services │ │ │ └── logger.js │ ├── index.js │ ├── package-lock.json │ ├── package.json │ └── tests │ │ └── unit-tests │ │ └── bootstrap.js └── blueprint │ ├── .github │ └── ISSUE_TEMPLATE │ │ └── bug_report.md │ ├── .gitignore │ ├── .npmignore │ ├── .travis.yml │ ├── LICENSE │ ├── README.md │ ├── cli │ └── generators │ │ ├── controller │ │ ├── files │ │ │ └── app │ │ │ │ └── controllers │ │ │ │ └── {{entityName}}.js │ │ └── index.js │ │ ├── listener │ │ ├── files │ │ │ └── app │ │ │ │ └── listeners │ │ │ │ └── {{eventName}} │ │ │ │ └── {{entityName}}.js │ │ └── index.js │ │ ├── router │ │ └── index.js │ │ └── service │ │ ├── files │ │ └── app │ │ │ └── services │ │ │ └── {{entityName}}.js │ │ └── index.js │ ├── examples │ ├── 01_helloworld │ │ ├── .gitignore │ │ ├── .npmignore │ │ ├── app │ │ │ ├── assets │ │ │ │ └── ssl │ │ │ │ │ ├── helloworld.crt │ │ │ │ │ └── helloworld.key │ │ │ ├── configs │ │ │ │ ├── app.js │ │ │ │ └── server.js │ │ │ ├── controllers │ │ │ │ └── helloworld.js │ │ │ ├── index.js │ │ │ ├── listeners │ │ │ │ ├── blueprint.app.initialized │ │ │ │ │ └── console.js │ │ │ │ └── blueprint.app.started │ │ │ │ │ └── console.js │ │ │ ├── routers │ │ │ │ └── main.js │ │ │ └── views │ │ │ │ └── helloworld.pug │ │ ├── package-lock.json │ │ ├── package.json │ │ └── yarn.lock │ ├── 02_policies │ │ ├── .gitignore │ │ ├── .npmignore │ │ ├── app │ │ │ ├── configs │ │ │ │ ├── app.js │ │ │ │ └── server.js │ │ │ ├── controllers │ │ │ │ └── helloworld.js │ │ │ ├── index.js │ │ │ ├── policies │ │ │ │ └── identity.js │ │ │ ├── routers │ │ │ │ └── main.js │ │ │ └── views │ │ │ │ └── helloworld.pug │ │ └── package.json │ ├── 03_upload │ │ ├── .gitignore │ │ ├── .npmignore │ │ ├── app │ │ │ ├── configs │ │ │ │ ├── app.js │ │ │ │ └── server.js │ │ │ ├── controllers │ │ │ │ └── helloworld.js │ │ │ ├── index.js │ │ │ ├── routers │ │ │ │ └── main.js │ │ │ └── views │ │ │ │ └── helloworld.pug │ │ └── package.json │ ├── 04_resources │ │ ├── app │ │ │ ├── configs │ │ │ │ ├── app.js │ │ │ │ └── server.js │ │ │ ├── controllers │ │ │ │ └── message.js │ │ │ ├── index.js │ │ │ ├── routers │ │ │ │ └── messages.js │ │ │ └── views │ │ │ │ └── messageboard.pug │ │ └── package.json │ └── 05_cluster │ │ ├── .gitignore │ │ ├── .npmignore │ │ ├── app │ │ ├── configs │ │ │ ├── app.js │ │ │ └── server.js │ │ ├── controllers │ │ │ └── helloworld.js │ │ ├── index.js │ │ ├── routers │ │ │ └── main.js │ │ └── views │ │ │ └── helloworld.pug │ │ ├── package.json │ │ └── tests │ │ ├── .gitkeep │ │ ├── fixtures │ │ └── .gitkeep │ │ ├── integration-tests │ │ └── .gitkeep │ │ └── unit-tests │ │ └── setup.js │ ├── lib │ ├── -framework.js │ ├── -lookup.js │ ├── action.js │ ├── application-messaging.js │ ├── application-module.js │ ├── application.js │ ├── array-upload-action.js │ ├── bad-request-error.js │ ├── barrier │ │ ├── barrier-participant.js │ │ ├── barrier.js │ │ └── index.js │ ├── cluster │ │ ├── index.js │ │ ├── master-application.js │ │ └── worker-application.js │ ├── controller.js │ ├── environment.js │ ├── error.js │ ├── fields-upload-action.js │ ├── forbidden-error.js │ ├── framework.js │ ├── http-error.js │ ├── http │ │ ├── headers.js │ │ └── index.js │ ├── index.js │ ├── internal-server-error.js │ ├── legacy-function-action.js │ ├── legacy-policy.js │ ├── listener-loader.js │ ├── loader.js │ ├── messaging │ │ ├── async-listener.js │ │ ├── event-listeners.js │ │ ├── events.js │ │ ├── index.js │ │ ├── legacy-listener.js │ │ ├── listener-handle.js │ │ ├── listener.js │ │ ├── messenger.js │ │ └── noop-listener.js │ ├── middleware │ │ ├── action-validator.js │ │ ├── check-policy.js │ │ ├── execute-action.js │ │ ├── handle-validation-result.js │ │ ├── index.js │ │ ├── legacy-sanitizer.js │ │ ├── legacy-validator.js │ │ └── render.js │ ├── module-loader.js │ ├── not-found-error.js │ ├── policies │ │ ├── -check.js │ │ ├── all.js │ │ ├── any.js │ │ ├── check.js │ │ ├── index.js │ │ ├── negate.js │ │ └── policy-maker.js │ ├── policy.js │ ├── properties │ │ ├── index.js │ │ ├── model.js │ │ ├── resource-descriptor.js │ │ └── service.js │ ├── resource-controller.js │ ├── router-builder.js │ ├── router.js │ ├── server │ │ ├── handle-error.js │ │ ├── index.js │ │ ├── protocol.js │ │ └── protocols │ │ │ ├── http.js │ │ │ ├── https.js │ │ │ └── index.js │ ├── service.js │ ├── single-file-upload-action.js │ ├── single-view-action.js │ ├── text-only-upload-action.js │ ├── unauthorized-error.js │ ├── upload-action.js │ └── view-action.js │ ├── package-lock.json │ ├── package.json │ └── tests │ ├── dummy │ ├── app │ │ ├── assets │ │ │ └── ssl │ │ │ │ ├── dummy.crt │ │ │ │ └── dummy.key │ │ ├── configs │ │ │ ├── app.js │ │ │ └── server.js │ │ ├── controllers │ │ │ ├── main.js │ │ │ ├── namespace-user.js │ │ │ └── user.js │ │ ├── listeners │ │ │ └── blueprint.app.init │ │ │ │ ├── echo.js │ │ │ │ └── legacy.js │ │ ├── models │ │ │ ├── -options.js │ │ │ └── person.js │ │ ├── policies │ │ │ ├── identity.js │ │ │ ├── test │ │ │ │ └── user │ │ │ │ │ └── create.js │ │ │ └── user │ │ │ │ └── create.js │ │ ├── resources │ │ │ └── views │ │ │ │ └── helloworld.hbs │ │ ├── routers │ │ │ ├── inner │ │ │ │ └── main.js │ │ │ ├── main.js │ │ │ └── users.js │ │ ├── services │ │ │ ├── cart.js │ │ │ └── shopping-cart.js │ │ └── views │ │ │ └── dummy.handlebars │ ├── node_modules │ │ ├── mod_a │ │ │ ├── app │ │ │ │ ├── controllers │ │ │ │ │ └── empty.js │ │ │ │ └── resources │ │ │ │ │ └── views │ │ │ │ │ └── mod_a │ │ │ │ │ └── helloworld.hbs │ │ │ └── package.json │ │ └── mod_b │ │ │ ├── app │ │ │ └── controllers │ │ │ │ └── empty.js │ │ │ └── package.json │ └── package.json │ ├── files │ └── avatar.png │ ├── helpers │ └── loader-test │ │ ├── a │ │ └── b │ │ │ ├── c.js │ │ │ └── d.js │ │ └── env │ │ └── test │ │ ├── a │ │ └── b │ │ │ └── c.js │ │ └── a1.js │ └── unit-tests │ ├── bootstrap.js │ └── lib │ ├── application-module-test.js │ ├── application-test.js │ ├── array-upload-action-test.js │ ├── environment-test.js │ ├── error-test.js │ ├── http-error-test.js │ ├── legacy-function-action-test.js │ ├── listener-loader-test.js │ ├── loader-test.js │ ├── messaging │ ├── async-event-listeners-test.js │ ├── event-listeners-test.js │ ├── legacy-listener-test.js │ ├── listener-handle-test.js │ ├── listener-test.js │ └── messenger-test.js │ ├── middleware │ └── execute-action-test.js │ ├── module-loader-test.js │ ├── policies │ ├── -negate-test.js │ ├── all-test.js │ ├── any-test.js │ └── check-test.js │ ├── properties │ ├── model-test.js │ └── service-test.js │ ├── resource-controller-test.js │ ├── router-builder-test.js │ ├── router-test.js │ ├── server │ ├── index-test.js │ ├── protocol-test.js │ └── protocols │ │ ├── http-test.js │ │ └── https-test.js │ ├── service-test.js │ ├── single-file-upload-action-test.js │ ├── upload-action-test.js │ └── view-action-test.js └── yarn.lock /.npmignore: -------------------------------------------------------------------------------- 1 | # Logs 2 | logs 3 | *.log 4 | 5 | # Runtime data 6 | pids 7 | *.pid 8 | *.seed 9 | 10 | # Directory for instrumented libs generated by jscoverage/JSCover 11 | lib-cov 12 | 13 | # Coverage directory used by tools like istanbul 14 | coverage 15 | 16 | # Grunt intermediate storage (http://gruntjs.com/creating-plugins#storing-task-files) 17 | .grunt 18 | 19 | # node-waf configuration 20 | .lock-wscript 21 | 22 | # Compiled binary addons (http://nodejs.org/api/addons.html) 23 | build/Release 24 | 25 | # Dependency directory 26 | # https://docs.npmjs.com/misc/faq#should-i-check-my-node-modules-folder-into-git 27 | node_modules 28 | tests 29 | examples 30 | tutorials 31 | docs 32 | 33 | -------------------------------------------------------------------------------- /lerna.json: -------------------------------------------------------------------------------- 1 | { 2 | "packages": [ 3 | "packages/blueprint*" 4 | ], 5 | "version": "4.76.5" 6 | } -------------------------------------------------------------------------------- /package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "blueprint", 3 | "private": false, 4 | "devDependencies": { 5 | "lerna": "^3.19.0" 6 | } 7 | } 8 | -------------------------------------------------------------------------------- /packages/blueprint-cli/README.md: -------------------------------------------------------------------------------- 1 | # blueprint-cli 2 | 3 | command-line interface for managing [Blueprint.js](https://github.com/onehilltech/blueprint) 4 | applications 5 | 6 | ## Installation 7 | 8 | Install the command-line interface globally on your machine: 9 | 10 | npm install -g @onehilltech/blueprint-cli 11 | 12 | ## Getting Started 13 | 14 | Create a new application: 15 | 16 | blueprint new [other options] 17 | 18 | Start the application: 19 | 20 | node ./app 21 | 22 | Open your browser, and go to [http://localhost:5000/helloworld](http://localhost:5000/helloworld). 23 | -------------------------------------------------------------------------------- /packages/blueprint-cli/cli/commands/new/templates/.gitignore: -------------------------------------------------------------------------------- 1 | ### Node template 2 | # Logs 3 | logs 4 | *.log 5 | npm-debug.log* 6 | 7 | # Runtime data 8 | pids 9 | *.pid 10 | *.seed 11 | 12 | # Directory for instrumented libs generated by jscoverage/JSCover 13 | lib-cov 14 | 15 | # Coverage directory used by tools like istanbul 16 | coverage 17 | 18 | # nyc test coverage 19 | .nyc_output 20 | 21 | # Grunt intermediate storage (http://gruntjs.com/creating-plugins#storing-task-files) 22 | .grunt 23 | 24 | # node-waf configuration 25 | .lock-wscript 26 | 27 | # Compiled binary addons (http://nodejs.org/api/addons.html) 28 | build/Release 29 | 30 | # Dependency directories 31 | node_modules 32 | jspm_packages 33 | 34 | # Optional npm cache directory 35 | .npm 36 | 37 | # Optional REPL history 38 | .node_repl_history 39 | 40 | ### Blueprint.js template 41 | .blueprint/ -------------------------------------------------------------------------------- /packages/blueprint-cli/cli/commands/new/templates/app/assets/.gitkeep: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/onehilltech/blueprint/8b8fbc06594c9ef996d728aa918e73e166d3e67e/packages/blueprint-cli/cli/commands/new/templates/app/assets/.gitkeep -------------------------------------------------------------------------------- /packages/blueprint-cli/cli/commands/new/templates/app/configs/app.js: -------------------------------------------------------------------------------- 1 | module.exports = { 2 | name : '{{project.name}}' 3 | }; 4 | -------------------------------------------------------------------------------- /packages/blueprint-cli/cli/commands/new/templates/app/configs/env/development/.gitkeep: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/onehilltech/blueprint/8b8fbc06594c9ef996d728aa918e73e166d3e67e/packages/blueprint-cli/cli/commands/new/templates/app/configs/env/development/.gitkeep -------------------------------------------------------------------------------- /packages/blueprint-cli/cli/commands/new/templates/app/configs/env/production/.gitkeep: -------------------------------------------------------------------------------- 1 | module.exports = exports = { 2 | middleware : { 3 | session: { 4 | cookie: { 5 | secure: true 6 | }, 7 | secret: '123abc', 8 | resave: true, 9 | saveUninitialized: true 10 | } 11 | } 12 | }; -------------------------------------------------------------------------------- /packages/blueprint-cli/cli/commands/new/templates/app/configs/env/test/.gitkeep: -------------------------------------------------------------------------------- 1 | 2 | -------------------------------------------------------------------------------- /packages/blueprint-cli/cli/commands/new/templates/app/configs/server.js: -------------------------------------------------------------------------------- 1 | module.exports = { 2 | connections : { 3 | insecure: { protocol: 'http', port: 8080 } 4 | }, 5 | 6 | middleware : { 7 | validator : { }, 8 | bodyParser : { 9 | urlencoded : { extended: false }, 10 | json : { } 11 | }, 12 | 13 | morgan: { 14 | format: 'dev', 15 | immediate: true 16 | } 17 | } 18 | }; 19 | -------------------------------------------------------------------------------- /packages/blueprint-cli/cli/commands/new/templates/app/controllers/helloworld.js: -------------------------------------------------------------------------------- 1 | const { Controller, Action } = require ('@onehilltech/blueprint'); 2 | 3 | /** 4 | * @class HelloWorldController 5 | */ 6 | module.exports = Controller.extend ({ 7 | echoName () { 8 | return Action.extend ({ 9 | execute (req, res) { 10 | res.render ('helloworld.pug', {name: req.body.name}); 11 | } 12 | }); 13 | } 14 | }); 15 | -------------------------------------------------------------------------------- /packages/blueprint-cli/cli/commands/new/templates/app/index.js: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env node 2 | 3 | const blueprint = require ('@onehilltech/blueprint'); 4 | 5 | return blueprint.createApplicationAndStart (__dirname) 6 | .catch (err => console.error (err)); 7 | -------------------------------------------------------------------------------- /packages/blueprint-cli/cli/commands/new/templates/app/listeners/blueprint.app.started/console.js: -------------------------------------------------------------------------------- 1 | const { Listener } = require ('@onehilltech/blueprint'); 2 | 3 | /** 4 | * @class ConsoleListener 5 | */ 6 | module.exports = Listener.extend ({ 7 | handleEvent (app) { 8 | console.log ('The application has started...'); 9 | } 10 | }); 11 | -------------------------------------------------------------------------------- /packages/blueprint-cli/cli/commands/new/templates/app/models/.gitkeep: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/onehilltech/blueprint/8b8fbc06594c9ef996d728aa918e73e166d3e67e/packages/blueprint-cli/cli/commands/new/templates/app/models/.gitkeep -------------------------------------------------------------------------------- /packages/blueprint-cli/cli/commands/new/templates/app/policies/.gitkeep: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/onehilltech/blueprint/8b8fbc06594c9ef996d728aa918e73e166d3e67e/packages/blueprint-cli/cli/commands/new/templates/app/policies/.gitkeep -------------------------------------------------------------------------------- /packages/blueprint-cli/cli/commands/new/templates/app/routers/helloworld.js: -------------------------------------------------------------------------------- 1 | module.exports = { 2 | '/' : { 3 | get : { view : 'helloworld.pug' }, 4 | post : { action : 'helloworld@echoName'}, 5 | } 6 | }; 7 | -------------------------------------------------------------------------------- /packages/blueprint-cli/cli/commands/new/templates/app/sanitizers/.gitkeep: -------------------------------------------------------------------------------- 1 | sanitizers 2 | =========== 3 | 4 | This directory contains sanitizers auto-loaded into the application, and 5 | available to request objects. Each file must export a single s function 6 | with the signature ```function (str) => [*]```. For example: 7 | 8 | ```javascript 9 | // toUpperCase.js 10 | 'use strict'; 11 | 12 | module.exports = function (str) { 13 | return str.toUpperCase () 14 | } 15 | ``` 16 | 17 | More Details 18 | ------------ 19 | 20 | [Blueprint.js](https://github.com/onehilltech/blueprint) uses 21 | [express-validator](https://github.com/ctavan/express-validator#customsanitizers) 22 | to expose the customer sanitizers on request objects. 23 | -------------------------------------------------------------------------------- /packages/blueprint-cli/cli/commands/new/templates/app/validators/.gitkeep: -------------------------------------------------------------------------------- 1 | validators 2 | =========== 3 | 4 | This directory contains validators auto-loaded into the application, and 5 | available to request objects. Each file must export a single validator function 6 | with the signature ```function (str) => boolean``` value. For example: 7 | 8 | ```javascript 9 | // isMongoIdOrMe.js 10 | 'use strict'; 11 | 12 | var validator = require ('validator') 13 | ; 14 | 15 | module.exports = function (str) { 16 | return validator.isMongoId (str) || str === 'me'; 17 | } 18 | ``` 19 | 20 | More Details 21 | ------------ 22 | 23 | [Blueprint.js](https://github.com/onehilltech/blueprint) uses 24 | [express-validator](https://github.com/ctavan/express-validator#customvalidators) 25 | to expose the customer validators on request objects. 26 | -------------------------------------------------------------------------------- /packages/blueprint-cli/cli/commands/new/templates/tests/unit-tests/bootstrap.js: -------------------------------------------------------------------------------- 1 | const path = require ('path'); 2 | const blueprint = require ('@onehilltech/blueprint-testing'); 3 | 4 | const appPath = path.resolve (__dirname, '../../app'); 5 | blueprint.bootstrap (appPath); -------------------------------------------------------------------------------- /packages/blueprint-cli/lib/command-factory.js: -------------------------------------------------------------------------------- 1 | const { BaseObject } = require ('base-object'); 2 | 3 | /** 4 | * @class CommandFactory 5 | * 6 | * The base class for concrete command factories. The command factory is responsible 7 | * for creating concrete commands. 8 | */ 9 | const CommandFactory = BaseObject.extend ({ 10 | makeCommand () { 11 | throw new Error ('You must overload the makeCommand() method.'); 12 | }, 13 | 14 | /// Optional options for the command. 15 | options: null 16 | }); 17 | 18 | module.exports = CommandFactory; 19 | 20 | CommandFactory.SimpleCommandFactory = function (Command) { 21 | const Factory = CommandFactory.extend ({ 22 | makeCommand () { 23 | return new Command (); 24 | } 25 | }); 26 | 27 | return function () { 28 | return new Factory (); 29 | } 30 | } 31 | -------------------------------------------------------------------------------- /packages/blueprint-cli/lib/command.js: -------------------------------------------------------------------------------- 1 | const commander = require ('commander'); 2 | 3 | /** 4 | * @class Command 5 | * 6 | * The base class for all command objects in the cli framework. 7 | */ 8 | class Command extends commander.Command { 9 | /** 10 | * Constructor 11 | * 12 | * @param name Name of the command 13 | * @param description Description of the command 14 | */ 15 | constructor (name, description) { 16 | super (name); 17 | 18 | // Configure the underlying 19 | this.description (description); 20 | this.action (this.execute.bind (this)); 21 | } 22 | 23 | configure () { 24 | 25 | } 26 | 27 | /** 28 | * Method called with the command is to execute. 29 | */ 30 | execute () { 31 | 32 | } 33 | } 34 | 35 | module.exports = Command; 36 | -------------------------------------------------------------------------------- /packages/blueprint-cli/lib/simple-command-factory.js: -------------------------------------------------------------------------------- 1 | const CommandFactory = require ('./command-factory'); 2 | 3 | /** 4 | * Utility function for creating a command factory. 5 | * 6 | * @param Command 7 | * @returns {(function(): *)|*} 8 | */ 9 | module.exports = function (Command) { 10 | const Factory = CommandFactory.extend ({ 11 | makeCommand () { 12 | return new Command (); 13 | } 14 | }); 15 | 16 | return function () { 17 | return new Factory (); 18 | } 19 | } 20 | -------------------------------------------------------------------------------- /packages/blueprint-cli/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "@onehilltech/blueprint-cli", 3 | "description": "command-line interface for Blueprint.js", 4 | "version": "4.64.1", 5 | "private": false, 6 | "author": "One Hill Technologies, LLC", 7 | "repository": "onehilltech/blueprint", 8 | "dependencies": { 9 | "base-object": "^1.4.0", 10 | "bluebird": "^3.5.1", 11 | "chalk": "^2.4.1", 12 | "commander": "^6.1.0", 13 | "fs-extra": "^6.0.0", 14 | "handlebars": "^4.7.6", 15 | "npm": "^3.10.7", 16 | "ora": "^2.1.0", 17 | "winston": "^2.4.2" 18 | }, 19 | "license": "Apache-2.0", 20 | "engines": { 21 | "node": ">=11.6.0", 22 | "npm": ">=6.5.0" 23 | }, 24 | "bin": { 25 | "blueprint": "./bin/blueprint" 26 | }, 27 | "gitHead": "3fa9d1898f478215e947cceb53313d6bd2cf93a5" 28 | } 29 | -------------------------------------------------------------------------------- /packages/blueprint-cli/tests/dummy/cli/commands/mock/index.js: -------------------------------------------------------------------------------- 1 | const { SimpleCommandFactory, Command } = require ('../../../../../lib'); 2 | 3 | class MockCommand extends Command { 4 | constructor () { 5 | super ('mock', 'This is a mock command'); 6 | } 7 | 8 | execute () { 9 | console.log ('Executing the mock command...'); 10 | } 11 | } 12 | 13 | module.exports = SimpleCommandFactory (MockCommand); 14 | -------------------------------------------------------------------------------- /packages/blueprint-cli/tests/dummy/cli/generators/test:generator/files/app/models/{{entityName}}.js: -------------------------------------------------------------------------------- 1 | module.exports = { 2 | name: '{{entityName}}' 3 | }; 4 | -------------------------------------------------------------------------------- /packages/blueprint-cli/tests/dummy/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "dummy" 3 | } -------------------------------------------------------------------------------- /packages/blueprint-compression/app/configs/app.js: -------------------------------------------------------------------------------- 1 | module.exports = { 2 | name : '' 3 | }; 4 | -------------------------------------------------------------------------------- /packages/blueprint-compression/app/configs/env/development/.gitkeep: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/onehilltech/blueprint/8b8fbc06594c9ef996d728aa918e73e166d3e67e/packages/blueprint-compression/app/configs/env/development/.gitkeep -------------------------------------------------------------------------------- /packages/blueprint-compression/app/configs/env/production/.gitkeep: -------------------------------------------------------------------------------- 1 | module.exports = exports = { 2 | middleware : { 3 | session: { 4 | cookie: { 5 | secure: true 6 | }, 7 | secret: '123abc', 8 | resave: true, 9 | saveUninitialized: true 10 | } 11 | } 12 | }; -------------------------------------------------------------------------------- /packages/blueprint-compression/app/configs/env/test/.gitkeep: -------------------------------------------------------------------------------- 1 | 2 | -------------------------------------------------------------------------------- /packages/blueprint-compression/app/configs/server.js: -------------------------------------------------------------------------------- 1 | module.exports = { 2 | protocols : { 3 | http : { 4 | port: 5000 5 | } 6 | }, 7 | 8 | middleware : { 9 | validator : { }, 10 | bodyParser : { 11 | urlencoded : { extended: false }, 12 | json : { } 13 | }, 14 | 15 | morgan: { 16 | format: 'dev', 17 | immediate: true 18 | } 19 | } 20 | }; 21 | -------------------------------------------------------------------------------- /packages/blueprint-compression/app/index.js: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env node 2 | 3 | const blueprint = require ('@onehilltech/blueprint'); 4 | 5 | return blueprint.createApplicationAndStart (__dirname) 6 | .catch (err => console.error (err)); 7 | -------------------------------------------------------------------------------- /packages/blueprint-compression/tests/dummy/app/configs/app.js: -------------------------------------------------------------------------------- 1 | module.exports = { 2 | name : 'dummy' 3 | }; 4 | -------------------------------------------------------------------------------- /packages/blueprint-compression/tests/dummy/app/configs/compression.js: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2018 One Hill Technologies, LLC 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | module.exports = { 18 | paths: { 19 | '/asset/compression': true 20 | } 21 | }; 22 | -------------------------------------------------------------------------------- /packages/blueprint-compression/tests/dummy/app/configs/server.js: -------------------------------------------------------------------------------- 1 | const path = require ('path'); 2 | 3 | module.exports = { 4 | middleware : { 5 | validator : { }, 6 | bodyParser : { json : { } }, 7 | 8 | morgan: { 9 | format: 'dev', 10 | immediate: true 11 | } 12 | } 13 | }; -------------------------------------------------------------------------------- /packages/blueprint-compression/tests/dummy/app/configs/test/.gitkeep: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/onehilltech/blueprint/8b8fbc06594c9ef996d728aa918e73e166d3e67e/packages/blueprint-compression/tests/dummy/app/configs/test/.gitkeep -------------------------------------------------------------------------------- /packages/blueprint-compression/tests/dummy/app/configs/test/app.js: -------------------------------------------------------------------------------- 1 | module.exports = exports = { 2 | hostname : 'http://localhost' 3 | }; 4 | -------------------------------------------------------------------------------- /packages/blueprint-compression/tests/dummy/app/index.js: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env node 2 | 3 | const blueprint = require ('@onehilltech/blueprint'); 4 | 5 | blueprint.createApplicationAndStart (__dirname) 6 | .then (() => console.log ('The application is started.')) 7 | .catch (err => console.error (err.message)); -------------------------------------------------------------------------------- /packages/blueprint-compression/tests/dummy/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "dummy", 3 | "author": "One Hill Technologies, LLC", 4 | "version": "1.0.0", 5 | "main": "./app", 6 | "dependencies": { 7 | "@onehilltech/blueprint-compression": "file:../../" 8 | } 9 | } 10 | -------------------------------------------------------------------------------- /packages/blueprint-compression/tests/unit-tests/bootstrap.js: -------------------------------------------------------------------------------- 1 | const path = require ('path'); 2 | const blueprint = require ('@onehilltech/blueprint-testing'); 3 | 4 | const appPath = path.resolve (__dirname, '../dummy/app'); 5 | blueprint.bootstrap (appPath); 6 | -------------------------------------------------------------------------------- /packages/blueprint-cron/app/index.js: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env node 2 | 3 | const blueprint = require ('@onehilltech/blueprint'); 4 | 5 | return blueprint.createApplicationAndStart (__dirname) 6 | .catch (err => console.error (err)); 7 | -------------------------------------------------------------------------------- /packages/blueprint-cron/lib/index.js: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2018 One Hill Technologies, LLC 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | exports.Job = require ('./job'); 18 | -------------------------------------------------------------------------------- /packages/blueprint-cron/tests/dummy/app/configs/app.js: -------------------------------------------------------------------------------- 1 | module.exports = { 2 | name : 'dummy' 3 | }; 4 | -------------------------------------------------------------------------------- /packages/blueprint-cron/tests/dummy/app/configs/env/development/.gitkeep: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/onehilltech/blueprint/8b8fbc06594c9ef996d728aa918e73e166d3e67e/packages/blueprint-cron/tests/dummy/app/configs/env/development/.gitkeep -------------------------------------------------------------------------------- /packages/blueprint-cron/tests/dummy/app/configs/env/development/app.js: -------------------------------------------------------------------------------- 1 | module.exports = exports = { 2 | hostname : 'http://localhost' 3 | }; 4 | -------------------------------------------------------------------------------- /packages/blueprint-cron/tests/dummy/app/index.js: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env node 2 | 3 | const blueprint = require ('@onehilltech/blueprint'); 4 | 5 | return blueprint.createApplicationAndStart (__dirname) 6 | .catch (err => console.error (err)); 7 | -------------------------------------------------------------------------------- /packages/blueprint-cron/tests/dummy/app/routers/helloworld.js: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2018 One Hill Technologies, LLC 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | module.exports = { 18 | '/': { 19 | get: 'helloworld' 20 | } 21 | }; 22 | -------------------------------------------------------------------------------- /packages/blueprint-cron/tests/dummy/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "dummy", 3 | "dependencies": { 4 | "@onehilltech/blueprint-cron": "file:../../" 5 | } 6 | } 7 | -------------------------------------------------------------------------------- /packages/blueprint-cron/tests/unit-tests/bootstrap.js: -------------------------------------------------------------------------------- 1 | const path = require ('path'); 2 | const blueprint = require ('@onehilltech/blueprint-testing'); 3 | 4 | const appPath = path.resolve (__dirname, '../dummy/app'); 5 | blueprint.bootstrap (appPath); 6 | -------------------------------------------------------------------------------- /packages/blueprint-deploy/cli/commands/deploy/README.md: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/onehilltech/blueprint/8b8fbc06594c9ef996d728aa918e73e166d3e67e/packages/blueprint-deploy/cli/commands/deploy/README.md -------------------------------------------------------------------------------- /packages/blueprint-deploy/cli/commands/deploy/index.js: -------------------------------------------------------------------------------- 1 | const { SimpleCommandFactory, Command } = require ('@onehilltech/blueprint-cli'); 2 | 3 | class DeployCommand extends Command { 4 | constructor () { 5 | super ('name', 'deploy a Blueprint application'); 6 | } 7 | } 8 | 9 | module.exports = SimpleCommandFactory (DeployCommand); -------------------------------------------------------------------------------- /packages/blueprint-dfinity/app/assets/.gitkeep: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/onehilltech/blueprint/8b8fbc06594c9ef996d728aa918e73e166d3e67e/packages/blueprint-dfinity/app/assets/.gitkeep -------------------------------------------------------------------------------- /packages/blueprint-dfinity/app/configs/app.js: -------------------------------------------------------------------------------- 1 | module.exports = { 2 | name : '' 3 | }; 4 | -------------------------------------------------------------------------------- /packages/blueprint-dfinity/app/configs/env/development/.gitkeep: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/onehilltech/blueprint/8b8fbc06594c9ef996d728aa918e73e166d3e67e/packages/blueprint-dfinity/app/configs/env/development/.gitkeep -------------------------------------------------------------------------------- /packages/blueprint-dfinity/app/configs/env/production/.gitkeep: -------------------------------------------------------------------------------- 1 | module.exports = exports = { 2 | middleware : { 3 | session: { 4 | cookie: { 5 | secure: true 6 | }, 7 | secret: '123abc', 8 | resave: true, 9 | saveUninitialized: true 10 | } 11 | } 12 | }; -------------------------------------------------------------------------------- /packages/blueprint-dfinity/app/configs/env/test/.gitkeep: -------------------------------------------------------------------------------- 1 | 2 | -------------------------------------------------------------------------------- /packages/blueprint-dfinity/app/configs/server.js: -------------------------------------------------------------------------------- 1 | module.exports = { 2 | connections : { 3 | insecure: { protocol: 'http' } 4 | }, 5 | 6 | middleware : { 7 | validator : { }, 8 | bodyParser : { 9 | urlencoded : { extended: false }, 10 | json : { } 11 | }, 12 | 13 | morgan: { 14 | format: 'dev', 15 | immediate: true 16 | } 17 | } 18 | }; 19 | -------------------------------------------------------------------------------- /packages/blueprint-dfinity/app/controllers/helloworld.js: -------------------------------------------------------------------------------- 1 | const { Controller, Action } = require ('@onehilltech/blueprint'); 2 | 3 | /** 4 | * @class HelloWorldController 5 | */ 6 | module.exports = Controller.extend ({ 7 | echoName () { 8 | return Action.extend ({ 9 | execute (req, res) { 10 | res.render ('helloworld.pug', {name: req.body.name}); 11 | } 12 | }); 13 | } 14 | }); 15 | -------------------------------------------------------------------------------- /packages/blueprint-dfinity/app/index.js: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env node 2 | 3 | const blueprint = require ('@onehilltech/blueprint'); 4 | 5 | return blueprint.createApplicationAndStart (__dirname) 6 | .catch (err => console.error (err)); 7 | -------------------------------------------------------------------------------- /packages/blueprint-dfinity/app/listeners/blueprint.app.started/console.js: -------------------------------------------------------------------------------- 1 | const { Listener } = require ('@onehilltech/blueprint'); 2 | 3 | /** 4 | * @class ConsoleListener 5 | */ 6 | module.exports = Listener.extend ({ 7 | handleEvent (app) { 8 | console.log ('The application has started...'); 9 | } 10 | }); 11 | -------------------------------------------------------------------------------- /packages/blueprint-dfinity/app/models/.gitkeep: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/onehilltech/blueprint/8b8fbc06594c9ef996d728aa918e73e166d3e67e/packages/blueprint-dfinity/app/models/.gitkeep -------------------------------------------------------------------------------- /packages/blueprint-dfinity/app/policies/.gitkeep: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/onehilltech/blueprint/8b8fbc06594c9ef996d728aa918e73e166d3e67e/packages/blueprint-dfinity/app/policies/.gitkeep -------------------------------------------------------------------------------- /packages/blueprint-dfinity/app/routers/helloworld.js: -------------------------------------------------------------------------------- 1 | module.exports = { 2 | '/' : { 3 | get : { view : 'helloworld.pug' }, 4 | post : { action : 'helloworld@echoName'}, 5 | } 6 | }; 7 | -------------------------------------------------------------------------------- /packages/blueprint-dfinity/app/sanitizers/.gitkeep: -------------------------------------------------------------------------------- 1 | sanitizers 2 | =========== 3 | 4 | This directory contains sanitizers auto-loaded into the application, and 5 | available to request objects. Each file must export a single s function 6 | with the signature ```function (str) => [*]```. For example: 7 | 8 | ```javascript 9 | // toUpperCase.js 10 | 'use strict'; 11 | 12 | module.exports = function (str) { 13 | return str.toUpperCase () 14 | } 15 | ``` 16 | 17 | More Details 18 | ------------ 19 | 20 | [Blueprint.js](https://github.com/onehilltech/blueprint) uses 21 | [express-validator](https://github.com/ctavan/express-validator#customsanitizers) 22 | to expose the customer sanitizers on request objects. 23 | -------------------------------------------------------------------------------- /packages/blueprint-dfinity/app/validators/.gitkeep: -------------------------------------------------------------------------------- 1 | validators 2 | =========== 3 | 4 | This directory contains validators auto-loaded into the application, and 5 | available to request objects. Each file must export a single validator function 6 | with the signature ```function (str) => boolean``` value. For example: 7 | 8 | ```javascript 9 | // isMongoIdOrMe.js 10 | 'use strict'; 11 | 12 | var validator = require ('validator') 13 | ; 14 | 15 | module.exports = function (str) { 16 | return validator.isMongoId (str) || str === 'me'; 17 | } 18 | ``` 19 | 20 | More Details 21 | ------------ 22 | 23 | [Blueprint.js](https://github.com/onehilltech/blueprint) uses 24 | [express-validator](https://github.com/ctavan/express-validator#customvalidators) 25 | to expose the customer validators on request objects. 26 | -------------------------------------------------------------------------------- /packages/blueprint-dfinity/examples/actors/basic_bitcoin.js: -------------------------------------------------------------------------------- 1 | const { query, Actor } = require ('../lib'); 2 | 3 | /** 4 | * @class BasicBitcoinActor 5 | * 6 | * https://github.com/dfinity/examples/blob/master/motoko/basic_bitcoin/src/basic_bitcoin/basic_bitcoin.did 7 | */ 8 | module.exports = Actor.extend ({ 9 | /// Define the greet update method. 10 | get_p2pkh_address: query ([], 'text'), 11 | 12 | get_balance: query ('text', 'nat64'), 13 | 14 | get_utxos: query ('text', { 15 | record: { 16 | utxos: 'vec utxo', 17 | tip_block_hash: 'blob', 18 | tip_height: 'nat32', 19 | next_page: 'opt blob' 20 | } 21 | }), 22 | 23 | get_current_fee_percentiles: query ([], 'vec nat64'), 24 | 25 | send: query ({ 26 | record: { 27 | destination_address: 'text', 28 | amount_in_satoshi: 'nat64' 29 | } 30 | }, 'text'), 31 | }); 32 | 33 | -------------------------------------------------------------------------------- /packages/blueprint-dfinity/examples/actors/calc.js: -------------------------------------------------------------------------------- 1 | const { query, update, Actor } = require ('../lib'); 2 | 3 | /** 4 | * @class CalcActor 5 | * 6 | * https://github.com/dfinity/examples/blob/master/motoko/calc/src/Main.mo 7 | */ 8 | module.exports = Actor.extend ({ 9 | add: update ('int', 'int'), 10 | sub: update ('int', 'int'), 11 | mul: update ('int', 'int'), 12 | div: update ('int', 'int'), 13 | clearall: update (), 14 | }); 15 | 16 | -------------------------------------------------------------------------------- /packages/blueprint-dfinity/examples/actors/counter.js: -------------------------------------------------------------------------------- 1 | const { query, update, Actor } = require ('../lib'); 2 | 3 | /** 4 | * @class BasicBitcoinActor 5 | * 6 | * https://github.com/dfinity/examples/blob/master/motoko/counter/src/Main.mo 7 | */ 8 | module.exports = Actor.extend ({ 9 | get: query ([], 'nat'), 10 | set: update ('nat', []), 11 | inc: update ([], []), 12 | }); 13 | 14 | -------------------------------------------------------------------------------- /packages/blueprint-dfinity/examples/actors/factorial.js: -------------------------------------------------------------------------------- 1 | const { query, Actor } = require ('../lib'); 2 | 3 | /** 4 | * @class FactorialActor 5 | * 6 | * https://github.com/dfinity/examples/tree/master/motoko/factorial 7 | */ 8 | module.exports = Actor.extend ({ 9 | /// Define the greet update method. 10 | fac: query ('nat', 'nat'), 11 | }); 12 | 13 | -------------------------------------------------------------------------------- /packages/blueprint-dfinity/examples/actors/helloworld.js: -------------------------------------------------------------------------------- 1 | const { update, query, Actor } = require ('../lib'); 2 | 3 | /** 4 | * @class HelloWorldActor 5 | * 6 | * This example was borrowed from: 7 | * 8 | * https://forum.dfinity.org/t/using-dfinity-agent-in-node-js/6169 9 | */ 10 | module.exports = Actor.extend ({ 11 | /// Define the greet update method. 12 | greet: update ('text', 'text'), 13 | 14 | /// Define the green query method. 15 | greetq: query ('text', 'text'), 16 | 17 | /// Define the whoami method. 18 | whoami: query (null, 'principal'), 19 | }); 20 | 21 | -------------------------------------------------------------------------------- /packages/blueprint-dfinity/examples/actors/phone-book.js: -------------------------------------------------------------------------------- 1 | const { query, update, Actor } = require ('../lib'); 2 | 3 | /** 4 | * @class PhonebookActor 5 | * 6 | * https://github.com/dfinity/examples/tree/master/motoko/phone-book 7 | */ 8 | module.exports = Actor.extend ({ 9 | insert: update (['text', { 10 | record: { 11 | desc: 'text', phone: 'text' 12 | } 13 | }], []), 14 | 15 | lookup: query ('text', { 16 | record: { 17 | desc: 'text', phone: 'text' 18 | } 19 | }), 20 | }); 21 | 22 | -------------------------------------------------------------------------------- /packages/blueprint-dfinity/examples/actors/quicksort.js: -------------------------------------------------------------------------------- 1 | const { query, Actor } = require ('../lib'); 2 | 3 | /** 4 | * @class QuicksortActor 5 | * 6 | * https://github.com/dfinity/examples/tree/master/motoko/quicksort 7 | */ 8 | module.exports = Actor.extend ({ 9 | /// Define the greet update method. 10 | sort: query ('vec int', 'vec int'), 11 | }); 12 | 13 | -------------------------------------------------------------------------------- /packages/blueprint-dfinity/examples/actors/whoami.js: -------------------------------------------------------------------------------- 1 | const { query, update, Actor } = require ('../lib'); 2 | 3 | /** 4 | * @class QuicksortActor 5 | * 6 | * https://github.com/dfinity/examples/tree/master/motoko/quicksort 7 | */ 8 | module.exports = Actor.extend ({ 9 | installer: query (undefined, 'principal'), 10 | argument: query (undefined, 'principal'), 11 | whoami: update (undefined, 'principal'), 12 | id: update (undefined, 'principal'), 13 | idQuick: update (undefined, 'principal') 14 | }); 15 | 16 | -------------------------------------------------------------------------------- /packages/blueprint-dfinity/lib/actor-builder.js: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2022 One Hill Technologies, LLC 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | /** 18 | * @class ActorBuilder 19 | * 20 | * The base class for actor objects. 21 | */ 22 | class ActorBuilder { 23 | 24 | } 25 | 26 | module.exports = ActorBuilder; -------------------------------------------------------------------------------- /packages/blueprint-dfinity/lib/decorators/query.js: -------------------------------------------------------------------------------- 1 | const FunctionDescriptor = require ('./function'); 2 | 3 | /** 4 | * @class QueryDescriptor 5 | * 6 | * The descriptor for defining an updated function on an actor. 7 | */ 8 | class QueryDescriptor extends FunctionDescriptor { 9 | constructor (input, output) { 10 | super ([], input, output); 11 | } 12 | } 13 | 14 | function query (input, output) { 15 | return new QueryDescriptor (output, input); 16 | } 17 | 18 | module.exports = query; 19 | -------------------------------------------------------------------------------- /packages/blueprint-dfinity/lib/decorators/update.js: -------------------------------------------------------------------------------- 1 | const FunctionDescriptor = require ('./function'); 2 | 3 | /** 4 | * @class UpdateDescriptor 5 | * 6 | * The descriptor for defining an updated function on an actor. 7 | */ 8 | class UpdateDescriptor extends FunctionDescriptor { 9 | constructor (input, output) { 10 | super (['update'], input, output); 11 | } 12 | } 13 | 14 | function update (input, output) { 15 | return new UpdateDescriptor (output, input); 16 | } 17 | 18 | module.exports = update; 19 | -------------------------------------------------------------------------------- /packages/blueprint-dfinity/lib/descriptors/query.js: -------------------------------------------------------------------------------- 1 | const FunctionDescriptor = require ('./function'); 2 | 3 | /** 4 | * @class QueryDescriptor 5 | * 6 | * The descriptor for defining an updated function on an actor. 7 | */ 8 | class QueryDescriptor extends FunctionDescriptor { 9 | constructor (input, output) { 10 | super ([], input, output); 11 | } 12 | } 13 | 14 | function query (input, output) { 15 | return new QueryDescriptor (output, input); 16 | } 17 | 18 | module.exports = query; 19 | -------------------------------------------------------------------------------- /packages/blueprint-dfinity/lib/descriptors/update.js: -------------------------------------------------------------------------------- 1 | const FunctionDescriptor = require ('./function'); 2 | 3 | /** 4 | * @class UpdateDescriptor 5 | * 6 | * The descriptor for defining an updated function on an actor. 7 | */ 8 | class UpdateDescriptor extends FunctionDescriptor { 9 | constructor (input, output) { 10 | super (['update'], input, output); 11 | } 12 | } 13 | 14 | function update (input, output) { 15 | return new UpdateDescriptor (output, input); 16 | } 17 | 18 | module.exports = update; 19 | -------------------------------------------------------------------------------- /packages/blueprint-dfinity/lib/identity/index.js: -------------------------------------------------------------------------------- 1 | module.exports = exports = {}; 2 | 3 | const { fromKey, fromKeyFile } = require ('./key'); 4 | const { fromSeed, fromSeedFile } = require ('./seed'); 5 | 6 | exports.fromKey = fromKey; 7 | exports.fromKeyFile = fromKeyFile; 8 | exports.fromSeed = fromSeed; 9 | exports.fromSeedFile = fromSeedFile; 10 | -------------------------------------------------------------------------------- /packages/blueprint-dfinity/tests/dummy/app/actors/hello.js: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2022 One Hill Technologies, LLC 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | const { Actor, query } = require ('../../../../lib'); 18 | 19 | module.exports = Actor.extend ({ 20 | greet: query ('text', 'text') 21 | }); 22 | -------------------------------------------------------------------------------- /packages/blueprint-dfinity/tests/dummy/app/assets/dummy.pem: -------------------------------------------------------------------------------- 1 | -----BEGIN EC PRIVATE KEY----- 2 | MHQCAQEEIAkKo9QVK7oYlc4L0PJDlwLYbvgmyhxYdNifMndrw4ACoAcGBSuBBAAK 3 | oUQDQgAEdN1WIpUH29NUdnblv9TJEU0ugIATD0KHiQg+1+2axgKRBFK5hr/UDwmC 4 | Wvlm6xjRsGTI4iWkWl7hzQf4UBrOlQ== 5 | -----END EC PRIVATE KEY----- 6 | -------------------------------------------------------------------------------- /packages/blueprint-dfinity/tests/dummy/app/assets/seed.txt: -------------------------------------------------------------------------------- 1 | early cinnamon crucial teach mobile just toast real rebel around card priority spike aerobic result account marble hero action intact inside elbow wrestle oval -------------------------------------------------------------------------------- /packages/blueprint-dfinity/tests/dummy/app/configs/env/test/app.js: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2018 One Hill Technologies, LLC 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | module.exports = { 18 | hostname : 'http://localhost' 19 | }; 20 | -------------------------------------------------------------------------------- /packages/blueprint-dfinity/tests/dummy/app/configs/env/test/dfinity.js: -------------------------------------------------------------------------------- 1 | module.exports = { 2 | agents: { 3 | $default: { 4 | host: 'http://localhost:8000' 5 | }, 6 | 7 | key: { 8 | host: 'http://localhost:8000', 9 | privateKey: './assets/dummy.pem', 10 | }, 11 | 12 | phrase: { 13 | host: 'http://localhost:8000', 14 | phrase: './assets/seed.txt' 15 | } 16 | }, 17 | 18 | canisters: { 19 | $default: 'rrkah-fqaaa-aaaaa-aaaaq-cai', 20 | } 21 | }; 22 | -------------------------------------------------------------------------------- /packages/blueprint-dfinity/tests/dummy/app/routers/hello.js: -------------------------------------------------------------------------------- 1 | module.exports = { 2 | '/hello': { 3 | post: 'hello' 4 | } 5 | } -------------------------------------------------------------------------------- /packages/blueprint-dfinity/tests/dummy/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "dummy", 3 | "author": "One Hill Technologies, LLC", 4 | "version": "1.0.0", 5 | "main": "./app", 6 | "dependencies": { 7 | "@onehilltech/blueprint-dfinity": "file:../../" 8 | } 9 | } 10 | -------------------------------------------------------------------------------- /packages/blueprint-dfinity/tests/unit-tests/bootstrap.js: -------------------------------------------------------------------------------- 1 | const path = require ('path'); 2 | const blueprint = require ('@onehilltech/blueprint-testing'); 3 | 4 | const appPath = path.resolve (__dirname, '../dummy/app'); 5 | blueprint.bootstrap (appPath); -------------------------------------------------------------------------------- /packages/blueprint-emberjs/app/assets/.gitkeep: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/onehilltech/blueprint/8b8fbc06594c9ef996d728aa918e73e166d3e67e/packages/blueprint-emberjs/app/assets/.gitkeep -------------------------------------------------------------------------------- /packages/blueprint-emberjs/app/configs/app.js: -------------------------------------------------------------------------------- 1 | module.exports = { 2 | name : '' 3 | }; 4 | -------------------------------------------------------------------------------- /packages/blueprint-emberjs/app/configs/env/development/.gitkeep: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/onehilltech/blueprint/8b8fbc06594c9ef996d728aa918e73e166d3e67e/packages/blueprint-emberjs/app/configs/env/development/.gitkeep -------------------------------------------------------------------------------- /packages/blueprint-emberjs/app/configs/env/production/.gitkeep: -------------------------------------------------------------------------------- 1 | module.exports = exports = { 2 | middleware : { 3 | session: { 4 | cookie: { 5 | secure: true 6 | }, 7 | secret: '123abc', 8 | resave: true, 9 | saveUninitialized: true 10 | } 11 | } 12 | }; -------------------------------------------------------------------------------- /packages/blueprint-emberjs/app/configs/env/test/.gitkeep: -------------------------------------------------------------------------------- 1 | 2 | -------------------------------------------------------------------------------- /packages/blueprint-emberjs/app/configs/server.js: -------------------------------------------------------------------------------- 1 | module.exports = { 2 | connections : { 3 | insecure: { protocol: 'http', port: 8080 } 4 | }, 5 | 6 | middleware : { 7 | validator : { }, 8 | bodyParser : { 9 | urlencoded : { extended: false }, 10 | json : { } 11 | }, 12 | 13 | morgan: { 14 | format: 'dev', 15 | immediate: true 16 | } 17 | } 18 | }; 19 | -------------------------------------------------------------------------------- /packages/blueprint-emberjs/app/index.js: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env node 2 | 3 | const blueprint = require ('@onehilltech/blueprint'); 4 | 5 | return blueprint.createApplicationAndStart (__dirname) 6 | .catch (err => console.error (err)); 7 | -------------------------------------------------------------------------------- /packages/blueprint-emberjs/app/listeners/.gitkeep: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/onehilltech/blueprint/8b8fbc06594c9ef996d728aa918e73e166d3e67e/packages/blueprint-emberjs/app/listeners/.gitkeep -------------------------------------------------------------------------------- /packages/blueprint-emberjs/app/models/.gitkeep: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/onehilltech/blueprint/8b8fbc06594c9ef996d728aa918e73e166d3e67e/packages/blueprint-emberjs/app/models/.gitkeep -------------------------------------------------------------------------------- /packages/blueprint-emberjs/app/policies/.gitkeep: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/onehilltech/blueprint/8b8fbc06594c9ef996d728aa918e73e166d3e67e/packages/blueprint-emberjs/app/policies/.gitkeep -------------------------------------------------------------------------------- /packages/blueprint-emberjs/app/resources/handlebars/helpers/encode-content.js: -------------------------------------------------------------------------------- 1 | const { isObjectLike } = require ('lodash'); 2 | 3 | module.exports = function (obj) { 4 | return encodeURI (JSON.stringify (obj)); 5 | }; 6 | -------------------------------------------------------------------------------- /packages/blueprint-emberjs/app/resources/handlebars/partials/blueprint.head.hbs: -------------------------------------------------------------------------------- 1 | {{>og}} 2 | {{#unless meta.facebook.exclude}} 3 | {{>facebook}} 4 | {{/unless}} 5 | {{#unless meta.twitter.exclude}} 6 | {{>twitter}} 7 | {{/unless}} 8 | {{#unless meta.linkedin.exclude}} 9 | {{>linked-in}} 10 | {{/unless}} 11 | -------------------------------------------------------------------------------- /packages/blueprint-emberjs/app/resources/handlebars/partials/facebook.hbs: -------------------------------------------------------------------------------- 1 | {{#if meta.facebook.app_id}} 2 | 3 | {{/if}} 4 | -------------------------------------------------------------------------------- /packages/blueprint-emberjs/app/resources/handlebars/partials/linked-in.hbs: -------------------------------------------------------------------------------- 1 | {{#if meta.linkedin.author}} 2 | 3 | {{/if}} 4 | 5 | -------------------------------------------------------------------------------- /packages/blueprint-emberjs/app/resources/handlebars/partials/og.hbs: -------------------------------------------------------------------------------- 1 | 2 | {{#if meta.url}} 3 | 4 | {{/if}} 5 | {{#if meta.title}} 6 | 7 | {{/if}} 8 | {{#if meta.description}} 9 | 10 | {{/if}} 11 | {{#if meta.image}} 12 | 13 | {{/if}} 14 | {{#if meta.image_alt}} 15 | 16 | {{/if}} 17 | {{#if meta.site_name}} 18 | 19 | {{/if}} 20 | {{#if meta.updated_time}} 21 | 22 | {{/if}} 23 | -------------------------------------------------------------------------------- /packages/blueprint-emberjs/app/resources/handlebars/partials/twitter.hbs: -------------------------------------------------------------------------------- 1 | 2 | {{#if meta.twitter.site}} 3 | 4 | {{/if}} 5 | {{#if meta.twitter.creator}} 6 | 7 | {{/if}} 8 | {{#if meta.title}} 9 | 10 | {{/if}} 11 | {{#if meta.description}} 12 | 13 | {{/if}} 14 | {{#if meta.image}} 15 | 16 | {{/if}} 17 | -------------------------------------------------------------------------------- /packages/blueprint-emberjs/lib/ember-router.js: -------------------------------------------------------------------------------- 1 | const EmberApp = require ('./ember-app'); 2 | 3 | module.exports = function EmberRouter (spec = {}) { 4 | return { ...spec, use: EmberApp () }; 5 | }; -------------------------------------------------------------------------------- /packages/blueprint-emberjs/package-lock.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "@onehilltech/blueprint-emberjs", 3 | "version": "4.76.5", 4 | "lockfileVersion": 1, 5 | "requires": true, 6 | "dependencies": { 7 | "mime": { 8 | "version": "3.0.0", 9 | "resolved": "https://registry.npmjs.org/mime/-/mime-3.0.0.tgz", 10 | "integrity": "sha512-jSCU7/VB1loIWBZe14aEYHU/+1UMEHoaO7qxCOVJOw9GgH72VAWppxNcjU+x9a2k3GSIBXNKxXQFqRvvZ7vr3A==" 11 | } 12 | } 13 | } -------------------------------------------------------------------------------- /packages/blueprint-emberjs/tests/unit-tests/bootstrap.js: -------------------------------------------------------------------------------- 1 | const path = require ('path'); 2 | const blueprint = require ('@onehilltech/blueprint-testing'); 3 | 4 | const appPath = path.resolve (__dirname, '../../app'); 5 | blueprint.bootstrap (appPath); -------------------------------------------------------------------------------- /packages/blueprint-firebase-messaging/.travis.yml: -------------------------------------------------------------------------------- 1 | sudo : false 2 | 3 | language: node_js 4 | 5 | node_js: 6 | - "6" 7 | - "7" 8 | - "8" 9 | - "9" 10 | - "10" 11 | 12 | env: 13 | - CXX=g++-4.8 14 | 15 | addons: 16 | apt: 17 | sources: 18 | - ubuntu-toolchain-r-test 19 | packages: 20 | - g++-4.8 21 | 22 | services: 23 | - mongodb 24 | 25 | after_success: 26 | - npm run coveralls 27 | -------------------------------------------------------------------------------- /packages/blueprint-firebase-messaging/LICENSE: -------------------------------------------------------------------------------- 1 | Copyright (c) 2016 One Hill Technologies, LLC 2 | 3 | Licensed under the Apache License, Version 2.0 (the "License"); 4 | you may not use this file except in compliance with the License. 5 | You may obtain a copy of the License at 6 | 7 | http://www.apache.org/licenses/LICENSE-2.0 8 | 9 | Unless required by applicable law or agreed to in writing, software 10 | distributed under the License is distributed on an "AS IS" BASIS, 11 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | See the License for the specific language governing permissions and 13 | limitations under the License. 14 | -------------------------------------------------------------------------------- /packages/blueprint-firebase-messaging/app/listeners/.gitkeep: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/onehilltech/blueprint/8b8fbc06594c9ef996d728aa918e73e166d3e67e/packages/blueprint-firebase-messaging/app/listeners/.gitkeep -------------------------------------------------------------------------------- /packages/blueprint-firebase-messaging/app/policies/.gitkeep: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/onehilltech/blueprint/8b8fbc06594c9ef996d728aa918e73e166d3e67e/packages/blueprint-firebase-messaging/app/policies/.gitkeep -------------------------------------------------------------------------------- /packages/blueprint-firebase-messaging/app/policies/firebase/device/delete.js: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2021 One Hill Technologies, LLC 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | const { policies: {check } } = require ('@onehilltech/blueprint'); 18 | 19 | module.exports = check ('firebase.device.owner'); 20 | -------------------------------------------------------------------------------- /packages/blueprint-firebase-messaging/app/policies/firebase/device/update.js: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2021 One Hill Technologies, LLC 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | const { policies: { check } } = require ('@onehilltech/blueprint'); 18 | 19 | module.exports = check ('firebase.device.owner'); 20 | -------------------------------------------------------------------------------- /packages/blueprint-firebase-messaging/tests/dummy/app/configs/app.js: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2018 One Hill Technologies, LLC 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | module.exports = { 18 | name : 'firebase-messaging', 19 | hostname : 'http://localhost:5000' 20 | }; 21 | -------------------------------------------------------------------------------- /packages/blueprint-firebase-messaging/tests/dummy/app/configs/env/development/firebase.js: -------------------------------------------------------------------------------- 1 | module.exports = { 2 | dryRun: false 3 | }; 4 | -------------------------------------------------------------------------------- /packages/blueprint-firebase-messaging/tests/dummy/app/configs/env/test/.gitkeep: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/onehilltech/blueprint/8b8fbc06594c9ef996d728aa918e73e166d3e67e/packages/blueprint-firebase-messaging/tests/dummy/app/configs/env/test/.gitkeep -------------------------------------------------------------------------------- /packages/blueprint-firebase-messaging/tests/dummy/app/configs/env/test/app.js: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2018 One Hill Technologies, LLC 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | module.exports = { 18 | hostname : 'http://localhost' 19 | }; 20 | -------------------------------------------------------------------------------- /packages/blueprint-firebase-messaging/tests/dummy/app/configs/firebase.js: -------------------------------------------------------------------------------- 1 | module.exports = { 2 | apiKey: process.env.FIREBASE_APIKEY 3 | } -------------------------------------------------------------------------------- /packages/blueprint-firebase-messaging/tests/dummy/app/controllers/push.js: -------------------------------------------------------------------------------- 1 | const { Action, Controller, service } = require ('@onehilltech/blueprint'); 2 | 3 | module.exports = Controller.extend ({ 4 | 5 | __invoke () { 6 | return Action.extend ({ 7 | fcm: service (), 8 | 9 | execute (req, res) { 10 | const data = { type: 'greeting', message: 'Hello, World!' }; 11 | 12 | this.fcm.send (req.user._id, { data }).catch (reason => console.log (reason)); 13 | 14 | res.status (200).json (true); 15 | } 16 | }); 17 | } 18 | }) -------------------------------------------------------------------------------- /packages/blueprint-firebase-messaging/tests/dummy/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "dummy", 3 | "author": "One Hill Technologies, LLC", 4 | "version": "1.0.0", 5 | "main": "./app", 6 | "dependencies": { 7 | "@onehilltech/blueprint-firebase-messaging": "file:../../" 8 | } 9 | } 10 | -------------------------------------------------------------------------------- /packages/blueprint-gatekeeper-cli/.travis.yml: -------------------------------------------------------------------------------- 1 | sudo : false 2 | 3 | language: node_js 4 | 5 | node_js: 6 | - "5" 7 | - "6" 8 | 9 | env: 10 | - CXX=g++-4.8 11 | 12 | addons: 13 | apt: 14 | sources: 15 | - ubuntu-toolchain-r-test 16 | packages: 17 | - g++-4.8 18 | 19 | services: 20 | - mongodb 21 | 22 | after_success: 23 | - npm run coveralls 24 | -------------------------------------------------------------------------------- /packages/blueprint-gatekeeper-cli/LICENSE: -------------------------------------------------------------------------------- 1 | Copyright (c) 2016 One Hill Technologies, LLC 2 | 3 | Licensed under the Apache License, Version 2.0 (the "License"); 4 | you may not use this file except in compliance with the License. 5 | You may obtain a copy of the License at 6 | 7 | http://www.apache.org/licenses/LICENSE-2.0 8 | 9 | Unless required by applicable law or agreed to in writing, software 10 | distributed under the License is distributed on an "AS IS" BASIS, 11 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | See the License for the specific language governing permissions and 13 | limitations under the License. -------------------------------------------------------------------------------- /packages/blueprint-gatekeeper-cli/bin/gatekeeper: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env node 2 | 3 | const program = require ('commander'); 4 | const { version } = require ('../package.json'); 5 | 6 | program 7 | .version (version) 8 | .command ('client', 'manage client access to resources') 9 | .command ('account', 'manage user access to resources') 10 | .parse (process.argv); 11 | -------------------------------------------------------------------------------- /packages/blueprint-gatekeeper-cli/bin/gatekeeper-account: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env node 2 | 3 | const program = require ('commander'); 4 | 5 | program 6 | .command ('add', 'add a new user account') 7 | .command ('remove', 'remove an existing user account') 8 | .command ('passwd', 'change the password for an account') 9 | .parse (process.argv); 10 | -------------------------------------------------------------------------------- /packages/blueprint-gatekeeper-cli/bin/gatekeeper-client: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env node 2 | 3 | const program = require ('commander'); 4 | 5 | program 6 | .command ('add', 'add a new client to service') 7 | .command ('remove', 'remove an existing client from service') 8 | .parse (process.argv); 9 | -------------------------------------------------------------------------------- /packages/blueprint-gatekeeper-client/.gitignore: -------------------------------------------------------------------------------- 1 | ### Node template 2 | # Logs 3 | logs 4 | *.log 5 | npm-debug.log* 6 | 7 | # Runtime data 8 | pids 9 | *.pid 10 | *.seed 11 | 12 | # Directory for instrumented libs generated by jscoverage/JSCover 13 | lib-cov 14 | 15 | # Coverage directory used by tools like istanbul 16 | coverage 17 | 18 | # nyc test coverage 19 | .nyc_output 20 | 21 | # Grunt intermediate storage (http://gruntjs.com/creating-plugins#storing-task-files) 22 | .grunt 23 | 24 | # node-waf configuration 25 | .lock-wscript 26 | 27 | # Compiled binary addons (http://nodejs.org/api/addons.html) 28 | build/Release 29 | 30 | # Dependency directories 31 | node_modules 32 | jspm_packages 33 | 34 | # Optional npm cache directory 35 | .npm 36 | 37 | # Optional REPL history 38 | .node_repl_history 39 | 40 | ### Blueprint.js template 41 | .blueprint/ -------------------------------------------------------------------------------- /packages/blueprint-gatekeeper-client/app/configs/app.js: -------------------------------------------------------------------------------- 1 | module.exports = { 2 | name : '' 3 | }; 4 | -------------------------------------------------------------------------------- /packages/blueprint-gatekeeper-client/app/configs/env/development/.gitkeep: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/onehilltech/blueprint/8b8fbc06594c9ef996d728aa918e73e166d3e67e/packages/blueprint-gatekeeper-client/app/configs/env/development/.gitkeep -------------------------------------------------------------------------------- /packages/blueprint-gatekeeper-client/app/configs/env/production/.gitkeep: -------------------------------------------------------------------------------- 1 | module.exports = exports = { 2 | middleware : { 3 | session: { 4 | cookie: { 5 | secure: true 6 | }, 7 | secret: '123abc', 8 | resave: true, 9 | saveUninitialized: true 10 | } 11 | } 12 | }; -------------------------------------------------------------------------------- /packages/blueprint-gatekeeper-client/app/configs/env/test/.gitkeep: -------------------------------------------------------------------------------- 1 | 2 | -------------------------------------------------------------------------------- /packages/blueprint-gatekeeper-client/app/configs/server.js: -------------------------------------------------------------------------------- 1 | module.exports = { 2 | protocols : { 3 | http : { 4 | port: 5000 5 | } 6 | }, 7 | 8 | middleware : { 9 | validator : { }, 10 | bodyParser : { 11 | urlencoded : { extended: false }, 12 | json : { } 13 | }, 14 | 15 | morgan: { 16 | format: 'dev', 17 | immediate: true 18 | } 19 | } 20 | }; 21 | -------------------------------------------------------------------------------- /packages/blueprint-gatekeeper-client/app/index.js: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env node 2 | 3 | const blueprint = require ('@onehilltech/blueprint'); 4 | 5 | return blueprint.createApplicationAndStart (__dirname) 6 | .catch (err => console.error (err)); 7 | -------------------------------------------------------------------------------- /packages/blueprint-gatekeeper-client/tests/dummy/app/configs/app.js: -------------------------------------------------------------------------------- 1 | module.exports = { 2 | name : 'dummy' 3 | }; 4 | -------------------------------------------------------------------------------- /packages/blueprint-gatekeeper-client/tests/dummy/app/configs/env/test/.gitkeep: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/onehilltech/blueprint/8b8fbc06594c9ef996d728aa918e73e166d3e67e/packages/blueprint-gatekeeper-client/tests/dummy/app/configs/env/test/.gitkeep -------------------------------------------------------------------------------- /packages/blueprint-gatekeeper-client/tests/dummy/app/configs/env/test/app.js: -------------------------------------------------------------------------------- 1 | module.exports = exports = { 2 | hostname : 'http://localhost' 3 | }; 4 | -------------------------------------------------------------------------------- /packages/blueprint-gatekeeper-client/tests/dummy/app/configs/env/test/gatekeeper.js: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2018 One Hill Technologies, LLC 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | module.exports = { 18 | baseUrl: 'http://gatekeeper' 19 | }; 20 | -------------------------------------------------------------------------------- /packages/blueprint-gatekeeper-client/tests/dummy/app/configs/server.js: -------------------------------------------------------------------------------- 1 | module.exports = { 2 | middleware : { 3 | validator : { }, 4 | bodyParser : { json : { } }, 5 | 6 | morgan: { 7 | format: 'dev', 8 | immediate: true 9 | } 10 | } 11 | }; -------------------------------------------------------------------------------- /packages/blueprint-gatekeeper-client/tests/dummy/app/index.js: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env node 2 | 3 | const blueprint = require ('@onehilltech/blueprint'); 4 | 5 | blueprint.createApplicationAndStart (__dirname) 6 | .then (() => console.log ('The application is started.')) 7 | .catch (err => console.error (err.message)); -------------------------------------------------------------------------------- /packages/blueprint-gatekeeper-client/tests/dummy/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "dummy", 3 | "author": "One Hill Technologies, LLC", 4 | "version": "1.0.0", 5 | "main": "./app", 6 | "dependencies": { 7 | "@onehilltech/blueprint-gatekeeper-client": "file:../../" 8 | } 9 | } 10 | -------------------------------------------------------------------------------- /packages/blueprint-gatekeeper/.travis.yml: -------------------------------------------------------------------------------- 1 | sudo : false 2 | 3 | language: node_js 4 | 5 | node_js: 6 | - "6" 7 | - "7" 8 | - "8" 9 | - "9" 10 | - "10" 11 | 12 | env: 13 | - CXX=g++-4.8 14 | 15 | addons: 16 | apt: 17 | sources: 18 | - ubuntu-toolchain-r-test 19 | packages: 20 | - g++-4.8 21 | 22 | services: 23 | - mongodb 24 | 25 | after_success: 26 | - npm run coveralls 27 | -------------------------------------------------------------------------------- /packages/blueprint-gatekeeper/LICENSE: -------------------------------------------------------------------------------- 1 | Copyright (c) 2016 One Hill Technologies, LLC 2 | 3 | Licensed under the Apache License, Version 2.0 (the "License"); 4 | you may not use this file except in compliance with the License. 5 | You may obtain a copy of the License at 6 | 7 | http://www.apache.org/licenses/LICENSE-2.0 8 | 9 | Unless required by applicable law or agreed to in writing, software 10 | distributed under the License is distributed on an "AS IS" BASIS, 11 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | See the License for the specific language governing permissions and 13 | limitations under the License. -------------------------------------------------------------------------------- /packages/blueprint-gatekeeper/app/configs/env/development/app.js: -------------------------------------------------------------------------------- 1 | module.exports = { 2 | name: 'gatekeeper' 3 | }; 4 | 5 | -------------------------------------------------------------------------------- /packages/blueprint-gatekeeper/app/index.js: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2018 One Hill Technologies, LLC 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | const blueprint = require ('@onehilltech/blueprint'); 18 | 19 | blueprint.createApplicationAndStart (__dirname) 20 | .then (() => console.log ('The application is started.')); -------------------------------------------------------------------------------- /packages/blueprint-gatekeeper/app/policies/gatekeeper/account/delete.js: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2018 One Hill Technologies, LLC 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | const { 18 | policies: { check } 19 | } = require ('@onehilltech/blueprint'); 20 | 21 | module.exports = check ('gatekeeper.account.me'); 22 | -------------------------------------------------------------------------------- /packages/blueprint-gatekeeper/app/policies/gatekeeper/clients/index.js: -------------------------------------------------------------------------------- 1 | 'use strict'; 2 | 3 | var exports = module.exports = {}; 4 | 5 | exports.android = require ('./android'); 6 | exports.native = require ('./native'); 7 | exports.recaptcha = require ('./recaptcha'); 8 | 9 | -------------------------------------------------------------------------------- /packages/blueprint-gatekeeper/app/policies/gatekeeper/clients/native.js: -------------------------------------------------------------------------------- 1 | 'use strict'; 2 | 3 | /** 4 | * Check the policy of a native client. The native client is expected to have a 5 | * client secret. 6 | * 7 | * @param req 8 | * @param callback 9 | * @returns {*} 10 | */ 11 | module.exports = function (req, callback) { 12 | const clientSecret = req.body.client_secret; 13 | const correct = clientSecret === req.client.client_secret; 14 | 15 | return callback (null, correct, {reason: 'incorrect_secret', message: 'Incorrect client secret'}); 16 | }; 17 | -------------------------------------------------------------------------------- /packages/blueprint-gatekeeper/app/resources/mailer/templates/gatekeeper.account.verification/subject.hbs: -------------------------------------------------------------------------------- 1 | Verify your account -------------------------------------------------------------------------------- /packages/blueprint-gatekeeper/app/resources/mailer/templates/gatekeeper.password.changed/subject.hbs: -------------------------------------------------------------------------------- 1 | Your password has been changed -------------------------------------------------------------------------------- /packages/blueprint-gatekeeper/app/resources/mailer/templates/gatekeeper.password.reset/subject.hbs: -------------------------------------------------------------------------------- 1 | Reset your password -------------------------------------------------------------------------------- /packages/blueprint-gatekeeper/app/routers/v1/verification.js: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2018 One Hill Technologies, LLC 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | module.exports = { 18 | '/verify': { 19 | get: 'gatekeeper.verification' 20 | } 21 | }; 22 | -------------------------------------------------------------------------------- /packages/blueprint-gatekeeper/app/services/account.js: -------------------------------------------------------------------------------- 1 | const { 2 | Service 3 | } = require ('@onehilltech/blueprint'); 4 | 5 | module.exports = Service.extend ({ 6 | init () { 7 | this._super.call (this, ...arguments); 8 | }, 9 | 10 | prepareId (doc) { 11 | return doc; 12 | } 13 | }); -------------------------------------------------------------------------------- /packages/blueprint-gatekeeper/tests/README.md: -------------------------------------------------------------------------------- 1 | # Test Cases 2 | 3 | This directoy contains test cases for the appserver. The test cases 4 | are written atop the [Mocha](http://visionmedia.github.io/mocha/) 5 | framework for [node.js](http://nodejs.org/). 6 | 7 | ## Running the Tests 8 | 9 | Use the following command to run all the test cases: 10 | 11 | mocha --recursive 12 | -------------------------------------------------------------------------------- /packages/blueprint-gatekeeper/tests/dummy/app/configs/app.js: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2018 One Hill Technologies, LLC 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | module.exports = { 18 | name : 'gatekeeper', 19 | hostname : 'http://localhost:5000' 20 | }; 21 | -------------------------------------------------------------------------------- /packages/blueprint-gatekeeper/tests/dummy/app/configs/env/test/.gitkeep: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/onehilltech/blueprint/8b8fbc06594c9ef996d728aa918e73e166d3e67e/packages/blueprint-gatekeeper/tests/dummy/app/configs/env/test/.gitkeep -------------------------------------------------------------------------------- /packages/blueprint-gatekeeper/tests/dummy/app/configs/env/test/app.js: -------------------------------------------------------------------------------- 1 | module.exports = exports = { 2 | hostname : 'http://localhost' 3 | }; 4 | -------------------------------------------------------------------------------- /packages/blueprint-gatekeeper/tests/dummy/app/configs/env/test/mailer.js: -------------------------------------------------------------------------------- 1 | module.exports = { 2 | preview: true 3 | }; 4 | -------------------------------------------------------------------------------- /packages/blueprint-gatekeeper/tests/dummy/app/configs/env/test/server.js: -------------------------------------------------------------------------------- 1 | module.exports = { 2 | connections: { 3 | insecure: { protocol: 'http' } 4 | }, 5 | 6 | middleware : { 7 | morgan: { 8 | format: 'dev', 9 | immediate: true 10 | } 11 | } 12 | }; -------------------------------------------------------------------------------- /packages/blueprint-gatekeeper/tests/dummy/app/controllers/verified.js: -------------------------------------------------------------------------------- 1 | const { Action, Controller } = require ('@onehilltech/blueprint'); 2 | 3 | module.exports = Controller.extend ({ 4 | __invoke () { 5 | return Action.extend ({ 6 | execute (req, res) { 7 | return res.status (200).json ({ message: req.body.message }); 8 | } 9 | }); 10 | } 11 | }); -------------------------------------------------------------------------------- /packages/blueprint-gatekeeper/tests/dummy/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "dummy", 3 | "author": "One Hill Technologies, LLC", 4 | "version": "1.0.0", 5 | "main": "./app", 6 | "dependencies": { 7 | "@onehilltech/blueprint-gatekeeper": "file:../../" 8 | } 9 | } 10 | -------------------------------------------------------------------------------- /packages/blueprint-greenlock/.gitignore: -------------------------------------------------------------------------------- 1 | ### Node template 2 | # Logs 3 | logs 4 | *.log 5 | npm-debug.log* 6 | 7 | # Runtime data 8 | pids 9 | *.pid 10 | *.seed 11 | 12 | # Directory for instrumented libs generated by jscoverage/JSCover 13 | lib-cov 14 | 15 | # Coverage directory used by tools like istanbul 16 | coverage 17 | 18 | # nyc test coverage 19 | .nyc_output 20 | 21 | # Grunt intermediate storage (http://gruntjs.com/creating-plugins#storing-task-files) 22 | .grunt 23 | 24 | # node-waf configuration 25 | .lock-wscript 26 | 27 | # Compiled binary addons (http://nodejs.org/api/addons.html) 28 | build/Release 29 | 30 | # Dependency directories 31 | node_modules 32 | jspm_packages 33 | 34 | # Optional npm cache directory 35 | .npm 36 | 37 | # Optional REPL history 38 | .node_repl_history 39 | 40 | ### Blueprint.js template 41 | .blueprint/ -------------------------------------------------------------------------------- /packages/blueprint-greenlock/.idea/blueprint-greenlock.iml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | -------------------------------------------------------------------------------- /packages/blueprint-greenlock/.idea/dictionaries/hilljh.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | greenlock 5 | webroot 6 | 7 | 8 | -------------------------------------------------------------------------------- /packages/blueprint-greenlock/.idea/encodings.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | -------------------------------------------------------------------------------- /packages/blueprint-greenlock/.idea/modules.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /packages/blueprint-greenlock/app/index.js: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env node 2 | 3 | const blueprint = require ('@onehilltech/blueprint'); 4 | 5 | return blueprint.createApplicationAndStart (__dirname) 6 | .catch (err => console.error (err)); 7 | -------------------------------------------------------------------------------- /packages/blueprint-greenlock/lib/approve-domains.js: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2018 One Hill Technologies, LLC 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | const { BO } = require ('@onehilltech/blueprint'); 18 | 19 | module.exports = BO.extend ({ 20 | approveDomains (/*options, cert*/) { 21 | 22 | } 23 | }); 24 | -------------------------------------------------------------------------------- /packages/blueprint-greenlock/lib/index.js: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2018 One Hill Technologies, LLC 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | exports.ApproveDomains = require ('./approve-domains'); 18 | exports.BasicApproveDomains = require ('./basic-approve-domains'); 19 | -------------------------------------------------------------------------------- /packages/blueprint-greenlock/tests/dummy/app/configs/app.js: -------------------------------------------------------------------------------- 1 | module.exports = { 2 | name : 'dummy' 3 | }; 4 | -------------------------------------------------------------------------------- /packages/blueprint-greenlock/tests/dummy/app/configs/env/development/.gitkeep: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/onehilltech/blueprint/8b8fbc06594c9ef996d728aa918e73e166d3e67e/packages/blueprint-greenlock/tests/dummy/app/configs/env/development/.gitkeep -------------------------------------------------------------------------------- /packages/blueprint-greenlock/tests/dummy/app/configs/env/development/app.js: -------------------------------------------------------------------------------- 1 | module.exports = exports = { 2 | hostname : 'http://localhost' 3 | }; 4 | -------------------------------------------------------------------------------- /packages/blueprint-greenlock/tests/dummy/app/configs/server.js: -------------------------------------------------------------------------------- 1 | module.exports = { 2 | connections : { 3 | greenlock : { protocol: 'greenlock' } 4 | }, 5 | 6 | middleware : { 7 | validator : { }, 8 | bodyParser : { json : { } }, 9 | 10 | morgan: { 11 | format: 'dev', 12 | immediate: true 13 | } 14 | } 15 | }; -------------------------------------------------------------------------------- /packages/blueprint-greenlock/tests/dummy/app/index.js: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env node 2 | 3 | const blueprint = require ('@onehilltech/blueprint'); 4 | 5 | blueprint.createApplicationAndStart (__dirname) 6 | .then (() => console.log ('The application is started.')) 7 | .catch (err => console.error (err.message)); -------------------------------------------------------------------------------- /packages/blueprint-greenlock/tests/dummy/app/routers/helloworld.js: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2018 One Hill Technologies, LLC 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | module.exports = { 18 | '/': { 19 | get: 'helloworld' 20 | } 21 | }; 22 | -------------------------------------------------------------------------------- /packages/blueprint-greenlock/tests/dummy/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "dummy", 3 | "author": "One Hill Technologies, LLC", 4 | "version": "1.0.0", 5 | "main": "./app", 6 | "dependencies": { 7 | "@onehilltech/blueprint-greenlock": "file:../../" 8 | } 9 | } 10 | -------------------------------------------------------------------------------- /packages/blueprint-greenlock/tests/unit-tests/app/services/greenlock-test.js: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2018 One Hill Technologies, LLC 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | describe ('app | services | le', function () { 18 | it ('should configure the service', function () { 19 | 20 | }); 21 | }); 22 | -------------------------------------------------------------------------------- /packages/blueprint-greenlock/tests/unit-tests/bootstrap.js: -------------------------------------------------------------------------------- 1 | const path = require ('path'); 2 | const blueprint = require ('@onehilltech/blueprint-testing'); 3 | 4 | const appPath = path.resolve (__dirname, '../dummy/app'); 5 | blueprint.bootstrap (appPath); 6 | -------------------------------------------------------------------------------- /packages/blueprint-handlebars/app/index.js: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env node 2 | 3 | const blueprint = require ('@onehilltech/blueprint'); 4 | 5 | return blueprint.createApplicationAndStart (__dirname) 6 | .catch (err => console.error (err)); 7 | -------------------------------------------------------------------------------- /packages/blueprint-handlebars/lib/template-compiler.js: -------------------------------------------------------------------------------- 1 | const fse = require ('fs-extra'); 2 | const Promise = require ('bluebird'); 3 | const fs = Promise.promisifyAll (require ('fs')); 4 | 5 | /** 6 | * @class TemplateCompiler 7 | * 8 | * Utility class responsible for compiling an email template for usage. 9 | */ 10 | module.exports = class TemplateCompiler { 11 | constructor (templatePath, handlebars) { 12 | this.templatePath = templatePath; 13 | this.handlebars = handlebars; 14 | } 15 | 16 | /** 17 | * Compile the template. 18 | * 19 | * @param path Path to template file. 20 | */ 21 | async compile (path) { 22 | const exists = await fse.pathExists (path); 23 | 24 | if (!exists) 25 | return null; 26 | 27 | const content = await fs.readFileAsync (path, 'utf-8'); 28 | return this.handlebars.compile (content); 29 | } 30 | } 31 | -------------------------------------------------------------------------------- /packages/blueprint-handlebars/tests/unit-tests/bootstrap.js: -------------------------------------------------------------------------------- 1 | const path = require ('path'); 2 | const blueprint = require ('@onehilltech/blueprint-testing'); 3 | 4 | const appPath = path.resolve (__dirname, '../../app'); 5 | blueprint.bootstrap (appPath); -------------------------------------------------------------------------------- /packages/blueprint-mailer/.gitignore: -------------------------------------------------------------------------------- 1 | ### Node template 2 | # Logs 3 | logs 4 | *.log 5 | npm-debug.log* 6 | 7 | # Runtime data 8 | pids 9 | *.pid 10 | *.seed 11 | 12 | # Directory for instrumented libs generated by jscoverage/JSCover 13 | lib-cov 14 | 15 | # Coverage directory used by tools like istanbul 16 | coverage 17 | 18 | # nyc test coverage 19 | .nyc_output 20 | 21 | # Grunt intermediate storage (http://gruntjs.com/creating-plugins#storing-task-files) 22 | .grunt 23 | 24 | # node-waf configuration 25 | .lock-wscript 26 | 27 | # Compiled binary addons (http://nodejs.org/api/addons.html) 28 | build/Release 29 | 30 | # Dependency directories 31 | node_modules 32 | jspm_packages 33 | 34 | # Optional npm cache directory 35 | .npm 36 | 37 | # Optional REPL history 38 | .node_repl_history 39 | 40 | ### Blueprint.js template 41 | .blueprint/ -------------------------------------------------------------------------------- /packages/blueprint-mailer/app/controllers/email.js: -------------------------------------------------------------------------------- 1 | const { ResourceController } = require ('@onehilltech/blueprint-mongodb'); 2 | const { model } = require ('@onehilltech/blueprint'); 3 | 4 | module.exports = ResourceController.extend ({ 5 | Model: model ('email') 6 | }); 7 | -------------------------------------------------------------------------------- /packages/blueprint-mailer/app/index.js: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env node 2 | 3 | const blueprint = require ('@onehilltech/blueprint'); 4 | 5 | return blueprint.createApplicationAndStart (__dirname) 6 | .catch (err => console.error (err)); 7 | -------------------------------------------------------------------------------- /packages/blueprint-mailer/app/routers/v1/email.js: -------------------------------------------------------------------------------- 1 | const { Router } = require ('@onehilltech/blueprint'); 2 | const bodyParser = require ('body-parser'); 3 | 4 | module.exports = Router.extend ({ 5 | specification: { 6 | '/emails': { 7 | use: [bodyParser.json (), bodyParser.urlencoded ({extended: false})], 8 | 9 | resource: { 10 | controller: 'email' 11 | } 12 | } 13 | } 14 | }); 15 | -------------------------------------------------------------------------------- /packages/blueprint-mailer/tests/dummy/app/configs/env/test/mailer.js: -------------------------------------------------------------------------------- 1 | const nodemailer = require ('nodemailer'); 2 | const mg = require ('nodemailer-mailgun-transport'); 3 | const mailgun = require ('./mailgun'); 4 | 5 | module.exports = { 6 | // Preview all emails. 7 | preview: true, 8 | 9 | message: { 10 | // Default sender for all emails. 11 | from: 'no-reply@donatians.com' 12 | }, 13 | 14 | // Using the mailgun transport. You can configure the mailer service to use 15 | // any transport that you like. 16 | transport: nodemailer.createTransport (mg (mailgun)) 17 | }; 18 | -------------------------------------------------------------------------------- /packages/blueprint-mailer/tests/dummy/app/configs/env/test/mailgun.js: -------------------------------------------------------------------------------- 1 | const { env } = require ('process'); 2 | 3 | module.exports = { 4 | auth: { 5 | api_key: env.MAILGUN_API_KEY, 6 | domain: env.MAILGUN_DOMAIN 7 | }, 8 | 9 | webhooks: { 10 | open: { url: 'http://localhost:8080' } 11 | } 12 | }; 13 | -------------------------------------------------------------------------------- /packages/blueprint-mailer/tests/dummy/app/resources/mailer/templates/helloworld/html.css: -------------------------------------------------------------------------------- 1 | .email__content { 2 | background-color: lightgray; 3 | } -------------------------------------------------------------------------------- /packages/blueprint-mailer/tests/dummy/app/resources/mailer/templates/helloworld/html.hbs: -------------------------------------------------------------------------------- 1 | 2 | 3 | This is the title 4 | 5 | 6 | 7 |
8 | This is the body of the HTML email. 9 |
10 | 11 | -------------------------------------------------------------------------------- /packages/blueprint-mailer/tests/dummy/app/resources/mailer/templates/helloworld/html.scss: -------------------------------------------------------------------------------- 1 | .email { 2 | &__content { 3 | background-color: lightgray; 4 | } 5 | } -------------------------------------------------------------------------------- /packages/blueprint-mailer/tests/dummy/app/resources/mailer/templates/helloworld/subject.hbs: -------------------------------------------------------------------------------- 1 | This is the subject -------------------------------------------------------------------------------- /packages/blueprint-mailer/tests/dummy/app/resources/mailer/templates/helloworld/text.hbs: -------------------------------------------------------------------------------- 1 | This is the test version of the email. -------------------------------------------------------------------------------- /packages/blueprint-mailer/tests/dummy/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "dummy", 3 | "author": "One Hill Technologies, LLC", 4 | "version": "1.0.0", 5 | "main": "./app", 6 | "dependencies": { 7 | "@onehilltech/blueprint-mailer": "file:../../" 8 | } 9 | } 10 | -------------------------------------------------------------------------------- /packages/blueprint-mailer/tests/unit-tests/bootstrap.js: -------------------------------------------------------------------------------- 1 | const path = require ('path'); 2 | const blueprint = require ('@onehilltech/blueprint-testing'); 3 | 4 | const appPath = path.resolve (__dirname, '../dummy/app'); 5 | blueprint.bootstrap (appPath); 6 | -------------------------------------------------------------------------------- /packages/blueprint-mailer/tests/unit-tests/services/mailer.js: -------------------------------------------------------------------------------- 1 | const blueprint = require ('@onehilltech/blueprint'); 2 | const { expect } = require ('chai'); 3 | 4 | describe ('service | mailer', function () { 5 | it ('should send a mock email', async function () { 6 | const mailer = blueprint.lookup ('service:mailer'); 7 | 8 | const email = await mailer.send ('helloworld', { 9 | message: { 10 | to: 'james@onehilltech.com' 11 | } 12 | }); 13 | 14 | expect (email).to.exist; 15 | }); 16 | }); -------------------------------------------------------------------------------- /packages/blueprint-mongodb/.npmignore: -------------------------------------------------------------------------------- 1 | # Logs 2 | logs 3 | *.log 4 | 5 | # Runtime data 6 | pids 7 | *.pid 8 | *.seed 9 | 10 | # Directory for instrumented libs generated by jscoverage/JSCover 11 | lib-cov 12 | 13 | # Coverage directory used by tools like istanbul 14 | coverage 15 | 16 | # Grunt intermediate storage (http://gruntjs.com/creating-plugins#storing-task-files) 17 | .grunt 18 | 19 | # node-waf configuration 20 | .lock-wscript 21 | 22 | # Compiled binary addons (http://nodejs.org/api/addons.html) 23 | build/Release 24 | 25 | # Dependency directory 26 | # https://docs.npmjs.com/misc/faq#should-i-check-my-node-modules-folder-into-git 27 | node_modules/ 28 | app/configs 29 | 30 | tests/ -------------------------------------------------------------------------------- /packages/blueprint-mongodb/.travis.yml: -------------------------------------------------------------------------------- 1 | sudo : false 2 | 3 | language: node_js 4 | 5 | node_js: 6 | - "8" 7 | - "10" 8 | 9 | services: 10 | - mongodb 11 | 12 | env: 13 | - CXX=g++-4.8 14 | 15 | addons: 16 | apt: 17 | sources: 18 | - ubuntu-toolchain-r-test 19 | packages: 20 | - g++-4.8 21 | 22 | after_success: 23 | - npm run coveralls 24 | -------------------------------------------------------------------------------- /packages/blueprint-mongodb/LICENSE: -------------------------------------------------------------------------------- 1 | Copyright (c) 2016 One Hill Technologies, LLC 2 | 3 | Licensed under the Apache License, Version 2.0 (the "License"); 4 | you may not use this file except in compliance with the License. 5 | You may obtain a copy of the License at 6 | 7 | http://www.apache.org/licenses/LICENSE-2.0 8 | 9 | Unless required by applicable law or agreed to in writing, software 10 | distributed under the License is distributed on an "AS IS" BASIS, 11 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | See the License for the specific language governing permissions and 13 | limitations under the License. 14 | -------------------------------------------------------------------------------- /packages/blueprint-mongodb/app/models/__mongodb.js: -------------------------------------------------------------------------------- 1 | const mongodb = require ('../../lib'); 2 | const mongoose = require ('mongoose'); 3 | 4 | const options = { 5 | // Name of the resource collection 6 | collection: 'blueprint_mongodb', 7 | }; 8 | 9 | const schema = new mongodb.Schema ({ 10 | /// Version number of the application database schema. 11 | version: { type: Number, required: true, default: 1 } 12 | }, options); 13 | 14 | module.exports = mongoose.model ('__mongodb', schema); 15 | -------------------------------------------------------------------------------- /packages/blueprint-mongodb/app/services/oidgen.js: -------------------------------------------------------------------------------- 1 | const { Service } = require ('@onehilltech/blueprint'); 2 | const { Types: { ObjectId } } = require ('mongoose'); 3 | const { times } = require ('lodash'); 4 | 5 | /** 6 | * @class oidgen 7 | */ 8 | module.exports = Service.extend ({ 9 | /** 10 | * Generate one or more ObjectId instances. 11 | * 12 | * @param n Number of ids to generate [default=1] 13 | * @returns {*} 14 | */ 15 | generate (n = 1) { 16 | return n === 1 ? new ObjectId () : times (n, () => new ObjectId ()); 17 | }, 18 | }); 19 | -------------------------------------------------------------------------------- /packages/blueprint-mongodb/cli/generators/mongodb:model/files/app/models/{{entityName}}.js: -------------------------------------------------------------------------------- 1 | const mongodb = require ('@onehilltech/blueprint-mongodb'); 2 | const { Schema } = mongodb; 3 | const { Types: { refersTo }} = Schema; 4 | 5 | const options = { 6 | {{#if collection}} 7 | // Name of the resource collection 8 | collection: '{{collection}}', 9 | {{/if}} 10 | }; 11 | 12 | const schema = new Schema ({ 13 | // add your schema definition here 14 | }, options); 15 | 16 | module.exports = mongodb.resource ('{{entityBaseName}}', schema); 17 | -------------------------------------------------------------------------------- /packages/blueprint-mongodb/cli/generators/mongodb:resource/files/app/controllers/{{entityName}}.js: -------------------------------------------------------------------------------- 1 | const { ResourceController } = require ('@onehilltech/blueprint-mongodb'); 2 | const { model } = require ('@onehilltech/blueprint'); 3 | 4 | module.exports = ResourceController.extend ({ 5 | Model: model ('{{referenceName}}') 6 | }); 7 | -------------------------------------------------------------------------------- /packages/blueprint-mongodb/cli/generators/mongodb:resource/files/app/models/{{entityName}}.js: -------------------------------------------------------------------------------- 1 | const mongodb = require ('@onehilltech/blueprint-mongodb'); 2 | const { Schema } = mongodb; 3 | const { Types: { refersTo }} = Schema; 4 | 5 | // use mongodb.Types to access mongoose.Types 6 | 7 | const options = { 8 | {{#if collection}} 9 | // Name of the model collection. 10 | collection: '{{collection}}', 11 | {{/if}} 12 | 13 | {{#if softDelete}} 14 | // Support soft delete of the resource. 15 | softDelete: true, 16 | {{/if}} 17 | }; 18 | 19 | const schema = new Schema ({ 20 | // add your schema definition here 21 | }, options); 22 | 23 | module.exports = mongodb.resource ('{{entityBaseName}}', schema); 24 | -------------------------------------------------------------------------------- /packages/blueprint-mongodb/cli/generators/mongodb:resource/files/app/routers/{{entityName}}.js: -------------------------------------------------------------------------------- 1 | const { Router } = require ('@onehilltech/blueprint'); 2 | 3 | module.exports = Router.extend ({ 4 | specification: { 5 | '{{resourcePath}}': { 6 | resource: { 7 | controller: '{{referenceName}}' 8 | } 9 | } 10 | } 11 | }); 12 | -------------------------------------------------------------------------------- /packages/blueprint-mongodb/cli/generators/mongodb:seed/files/app/seeds/mongodb/{{entityName}}.js: -------------------------------------------------------------------------------- 1 | const { Seed } = require ('@onehilltech/blueprint-mongodb'); 2 | const dab = require ('@onehilltech/dab'); 3 | 4 | /** 5 | * @class 6 | * 7 | * The implementation of the seed definition. The seed definition must implement the 8 | * model() function. It must return a dab definition. 9 | */ 10 | module.exports = new Seed ({ 11 | model () { 12 | return { 13 | 14 | } 15 | } 16 | }); 17 | -------------------------------------------------------------------------------- /packages/blueprint-mongodb/lib/plugins/index.js: -------------------------------------------------------------------------------- 1 | module.exports = exports = {}; 2 | 3 | exports.StatPlugin = require ('./stat'); 4 | exports.HiddenPlugin = require ('./hidden'); 5 | exports.ConstPlugin = require ('./const'); 6 | exports.LeanPlugin = require ('./lean'); 7 | -------------------------------------------------------------------------------- /packages/blueprint-mongodb/lib/utils/index.js: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2018 One Hill Technologies, LLC 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | exports.lean = require ('./lean'); 18 | exports.seed = require ('./seed'); 19 | -------------------------------------------------------------------------------- /packages/blueprint-mongodb/lib/utils/lean.js: -------------------------------------------------------------------------------- 1 | const { 2 | parse, 3 | stringify 4 | } = JSON; 5 | 6 | /** 7 | * This method will convert Mongoose documents to raw JavaScript objects. 8 | * 9 | * @param value 10 | */ 11 | module.exports = function lean (value) { 12 | return parse (stringify (value)); 13 | }; 14 | -------------------------------------------------------------------------------- /packages/blueprint-mongodb/lib/validation/index.js: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2018 One Hill Technologies, LLC 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | module.exports = exports = require ('./build'); 18 | 19 | -------------------------------------------------------------------------------- /packages/blueprint-mongodb/tests/data/avatar1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/onehilltech/blueprint/8b8fbc06594c9ef996d728aa918e73e166d3e67e/packages/blueprint-mongodb/tests/data/avatar1.png -------------------------------------------------------------------------------- /packages/blueprint-mongodb/tests/data/avatar2.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/onehilltech/blueprint/8b8fbc06594c9ef996d728aa918e73e166d3e67e/packages/blueprint-mongodb/tests/data/avatar2.png -------------------------------------------------------------------------------- /packages/blueprint-mongodb/tests/dummy/app/configs/server.js: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2018 One Hill Technologies, LLC 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | module.exports = { 18 | connections: { 19 | insecure: { 20 | protocol: 'http' 21 | } 22 | } 23 | }; -------------------------------------------------------------------------------- /packages/blueprint-mongodb/tests/dummy/app/index.js: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env node 2 | 3 | const blueprint = require ('@onehilltech/blueprint'); 4 | 5 | blueprint.createApplicationAndStart (__dirname).then (() => { 6 | console.log ('The application is started.'); 7 | }).catch (err => { 8 | console.error (err); 9 | }); 10 | -------------------------------------------------------------------------------- /packages/blueprint-mongodb/tests/dummy/app/migrations/mongodb/up/2.js: -------------------------------------------------------------------------------- 1 | const Migration = require ('../../../../../../lib/migration'); 2 | 3 | module.exports = Migration.extend ({ 4 | prepare () { 5 | 6 | }, 7 | 8 | migrate () { 9 | 10 | }, 11 | 12 | finalize () { 13 | 14 | } 15 | }); 16 | -------------------------------------------------------------------------------- /packages/blueprint-mongodb/tests/dummy/app/routers/book.js: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2018 One Hill Technologies, LLC 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | module.exports = { 18 | '/books': { 19 | resource: { 20 | controller: 'book' 21 | } 22 | } 23 | }; 24 | -------------------------------------------------------------------------------- /packages/blueprint-mongodb/tests/dummy/app/routers/callbacks.js: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2018 One Hill Technologies, LLC 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | module.exports = { 18 | '/callbacks': { 19 | resource: { 20 | controller: 'callbacks' 21 | } 22 | } 23 | }; 24 | -------------------------------------------------------------------------------- /packages/blueprint-mongodb/tests/dummy/app/routers/image.js: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2018 One Hill Technologies, LLC 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | module.exports = { 18 | '/images': { resource: { controller: 'image' } } 19 | }; 20 | -------------------------------------------------------------------------------- /packages/blueprint-mongodb/tests/dummy/app/routers/user.js: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2018 One Hill Technologies, LLC 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | module.exports = { 18 | '/users': { 19 | resource: { 20 | controller: 'user' 21 | } 22 | } 23 | }; 24 | -------------------------------------------------------------------------------- /packages/blueprint-mongodb/tests/dummy/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "dummy", 3 | "author": "One Hill Technologies, LLC", 4 | "version": "1.0.0", 5 | "main": "./app", 6 | "dependencies": { 7 | "@onehilltech/blueprint-mongodb": "file:../../" 8 | } 9 | } 10 | -------------------------------------------------------------------------------- /packages/blueprint-mongodb/tests/unit-tests/app/sanitizers/toMongoId-test.js: -------------------------------------------------------------------------------- 1 | const toMongoId = require ('../../../../app/sanitizers/toMongoId'); 2 | const { expect } = require ('chai'); 3 | 4 | const { 5 | Types: { 6 | ObjectId 7 | } 8 | } = require ('mongoose'); 9 | 10 | describe ('app | sanitizers | toMongoId', function () { 11 | it ('should convert a string to a MongoId', function () { 12 | let expected = new ObjectId (); 13 | let id = toMongoId (expected.toString ()); 14 | 15 | expect (expected).to.eql (id); 16 | }); 17 | }); 18 | -------------------------------------------------------------------------------- /packages/blueprint-mongodb/tests/unit-tests/lib/lean-test.js: -------------------------------------------------------------------------------- 1 | const {expect} = require ('chai'); 2 | const blueprint = require ('@onehilltech/blueprint'); 3 | const lean = require ('../../../lib/utils/lean'); 4 | 5 | describe ('lib | lean', function () { 6 | it ('should convert model to raw object', function () { 7 | const User = blueprint.lookup ('model:user'); 8 | const user = new User ({first_name: 'James', last_name: 'Hill', email: 'james@no-reply.com'}); 9 | 10 | const leanUser = lean (user); 11 | 12 | expect (leanUser).to.eql ({ 13 | _id: user.id, 14 | first_name: user.first_name, 15 | last_name: user.last_name, 16 | email: user.email, 17 | blacklist: [], 18 | bookstores: [] 19 | }); 20 | }); 21 | }); 22 | -------------------------------------------------------------------------------- /packages/blueprint-python/LICENSE: -------------------------------------------------------------------------------- 1 | Copyright (c) 2016 One Hill Technologies, LLC 2 | 3 | Licensed under the Apache License, Version 2.0 (the "License"); 4 | you may not use this file except in compliance with the License. 5 | You may obtain a copy of the License at 6 | 7 | http://www.apache.org/licenses/LICENSE-2.0 8 | 9 | Unless required by applicable law or agreed to in writing, software 10 | distributed under the License is distributed on an "AS IS" BASIS, 11 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | See the License for the specific language governing permissions and 13 | limitations under the License. 14 | -------------------------------------------------------------------------------- /packages/blueprint-python/app/configs/app.js: -------------------------------------------------------------------------------- 1 | module.exports = { 2 | name : '' 3 | }; 4 | -------------------------------------------------------------------------------- /packages/blueprint-python/app/configs/env/development/.gitkeep: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/onehilltech/blueprint/8b8fbc06594c9ef996d728aa918e73e166d3e67e/packages/blueprint-python/app/configs/env/development/.gitkeep -------------------------------------------------------------------------------- /packages/blueprint-python/app/configs/env/production/.gitkeep: -------------------------------------------------------------------------------- 1 | module.exports = exports = { 2 | middleware : { 3 | session: { 4 | cookie: { 5 | secure: true 6 | }, 7 | secret: '123abc', 8 | resave: true, 9 | saveUninitialized: true 10 | } 11 | } 12 | }; -------------------------------------------------------------------------------- /packages/blueprint-python/app/configs/env/test/.gitkeep: -------------------------------------------------------------------------------- 1 | 2 | -------------------------------------------------------------------------------- /packages/blueprint-python/app/configs/server.js: -------------------------------------------------------------------------------- 1 | module.exports = { 2 | connections : { 3 | insecure: { protocol: 'http', port: 8080 } 4 | }, 5 | 6 | middleware : { 7 | validator : { }, 8 | bodyParser : { 9 | urlencoded : { extended: false }, 10 | json : { } 11 | }, 12 | 13 | morgan: { 14 | format: 'dev', 15 | immediate: true 16 | } 17 | } 18 | }; 19 | -------------------------------------------------------------------------------- /packages/blueprint-python/app/index.js: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env node 2 | 3 | const blueprint = require ('@onehilltech/blueprint'); 4 | 5 | return blueprint.createApplicationAndStart (__dirname) 6 | .catch (err => console.error (err)); 7 | -------------------------------------------------------------------------------- /packages/blueprint-python/app/policies/.gitkeep: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/onehilltech/blueprint/8b8fbc06594c9ef996d728aa918e73e166d3e67e/packages/blueprint-python/app/policies/.gitkeep -------------------------------------------------------------------------------- /packages/blueprint-python/tests/dummy/app/assets/scripts/delayed-helloworld.py: -------------------------------------------------------------------------------- 1 | import time 2 | 3 | # Let's wait 5 seconds, then print the message. 4 | time.sleep(10) 5 | print ('Hello, World!', end = '') 6 | -------------------------------------------------------------------------------- /packages/blueprint-python/tests/dummy/app/assets/scripts/helloworld.py: -------------------------------------------------------------------------------- 1 | print ('Hello, World!', end = '') 2 | -------------------------------------------------------------------------------- /packages/blueprint-python/tests/dummy/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "dummy", 3 | "author": "One Hill Technologies, LLC", 4 | "version": "1.0.0", 5 | "main": "./app", 6 | "dependencies": { 7 | "@onehilltech/blueprint-python": "file:../../" 8 | } 9 | } 10 | -------------------------------------------------------------------------------- /packages/blueprint-python/tests/unit-tests/bootstrap.js: -------------------------------------------------------------------------------- 1 | const path = require ('path'); 2 | const blueprint = require ('@onehilltech/blueprint-testing'); 3 | 4 | const appPath = path.resolve (__dirname, '../dummy/app'); 5 | blueprint.bootstrap (appPath); -------------------------------------------------------------------------------- /packages/blueprint-schedule/app/index.js: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env node 2 | 3 | const blueprint = require ('@onehilltech/blueprint'); 4 | 5 | return blueprint.createApplicationAndStart (__dirname) 6 | .catch (err => console.error (err)); 7 | -------------------------------------------------------------------------------- /packages/blueprint-schedule/lib/index.js: -------------------------------------------------------------------------------- 1 | exports.Schedule = require ('./schedule'); 2 | -------------------------------------------------------------------------------- /packages/blueprint-schedule/tests/dummy/app/index.js: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env node 2 | 3 | const blueprint = require ('@onehilltech/blueprint'); 4 | 5 | blueprint.createApplicationAndStart (__dirname).then (() => { 6 | console.log ('The application is started.'); 7 | }).catch (err => { 8 | console.error (err); 9 | }); 10 | -------------------------------------------------------------------------------- /packages/blueprint-schedule/tests/dummy/app/schedules/basic-schedule.js: -------------------------------------------------------------------------------- 1 | const { Schedule } = require ('../../../../lib'); 2 | 3 | module.exports = Schedule.extend ({ 4 | spec: '* * * * * *', 5 | 6 | run () { 7 | this.didRun = true; 8 | }, 9 | 10 | onScheduled () { 11 | this.didSchedule = true; 12 | }, 13 | 14 | onCanceled () { 15 | this.didCancel = true; 16 | } 17 | }); 18 | -------------------------------------------------------------------------------- /packages/blueprint-schedule/tests/dummy/app/schedules/run-if-first-time.js: -------------------------------------------------------------------------------- 1 | const { Schedule } = require ('../../../../lib'); 2 | 3 | module.exports = Schedule.extend ({ 4 | spec: '* * * * * *', 5 | 6 | runIfFirstTime: true, 7 | 8 | run () { 9 | this.didRun = true; 10 | }, 11 | 12 | onScheduled () { 13 | this.didSchedule = true; 14 | }, 15 | 16 | onCanceled () { 17 | this.didCancel = true; 18 | } 19 | }); 20 | -------------------------------------------------------------------------------- /packages/blueprint-schedule/tests/dummy/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "dummy", 3 | "author": "One Hill Technologies, LLC", 4 | "version": "1.0.0", 5 | "main": "./app", 6 | "dependencies": { 7 | "@onehilltech/blueprint-schedule": "file:../../" 8 | } 9 | } 10 | -------------------------------------------------------------------------------- /packages/blueprint-schedule/tests/unit-tests/bootstrap.js: -------------------------------------------------------------------------------- 1 | const path = require ('path'); 2 | const blueprint = require ('@onehilltech/blueprint-testing'); 3 | 4 | const appPath = path.resolve (__dirname, '../dummy/app'); 5 | blueprint.bootstrap (appPath); 6 | -------------------------------------------------------------------------------- /packages/blueprint-sequelize/lib/utils/index.js: -------------------------------------------------------------------------------- 1 | exports.seed = require ('./seed'); 2 | exports.lean = require ('./lean'); 3 | -------------------------------------------------------------------------------- /packages/blueprint-sequelize/lib/utils/lean.js: -------------------------------------------------------------------------------- 1 | const { parse, stringify } = JSON; 2 | 3 | /** 4 | * This method will convert Mongoose documents to raw JavaScript objects. 5 | * 6 | * @param value 7 | */ 8 | module.exports = function lean (value) { 9 | return parse (stringify (value)); 10 | }; 11 | -------------------------------------------------------------------------------- /packages/blueprint-sequelize/tests/dummy/app/configs/server.js: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2018 One Hill Technologies, LLC 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | module.exports = { 18 | connections: { 19 | insecure: { 20 | protocol: 'http', port: 8080 21 | } 22 | } 23 | }; -------------------------------------------------------------------------------- /packages/blueprint-sequelize/tests/dummy/app/index.js: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env node 2 | 3 | const blueprint = require ('@onehilltech/blueprint'); 4 | 5 | blueprint.createApplicationAndStart (__dirname).then (() => { 6 | console.log ('The application is started.'); 7 | }).catch (err => { 8 | console.error (err); 9 | }); 10 | -------------------------------------------------------------------------------- /packages/blueprint-sequelize/tests/dummy/app/routers/project.js: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2019 One Hill Technologies, LLC 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | module.exports = { 18 | '/projects': { 19 | resource: { 20 | controller: 'project' 21 | } 22 | } 23 | }; 24 | -------------------------------------------------------------------------------- /packages/blueprint-sequelize/tests/dummy/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "dummy", 3 | "author": "One Hill Technologies, LLC", 4 | "version": "1.0.0", 5 | "main": "./app", 6 | "dependencies": { 7 | "@onehilltech/blueprint-sequelize": "file:../../" 8 | } 9 | } 10 | -------------------------------------------------------------------------------- /packages/blueprint-sequelize/tests/unit-tests/bootstrap.js: -------------------------------------------------------------------------------- 1 | const path = require ('path'); 2 | const blueprint = require ('@onehilltech/blueprint-testing'); 3 | 4 | const appPath = path.resolve (__dirname, '../dummy/app'); 5 | blueprint.bootstrap (appPath); 6 | -------------------------------------------------------------------------------- /packages/blueprint-socket.io/.gitignore: -------------------------------------------------------------------------------- 1 | ### Node template 2 | # Logs 3 | logs 4 | *.log 5 | npm-debug.log* 6 | 7 | # Runtime data 8 | pids 9 | *.pid 10 | *.seed 11 | 12 | # Directory for instrumented libs generated by jscoverage/JSCover 13 | lib-cov 14 | 15 | # Coverage directory used by tools like istanbul 16 | coverage 17 | 18 | # nyc test coverage 19 | .nyc_output 20 | 21 | # Grunt intermediate storage (http://gruntjs.com/creating-plugins#storing-task-files) 22 | .grunt 23 | 24 | # node-waf configuration 25 | .lock-wscript 26 | 27 | # Compiled binary addons (http://nodejs.org/api/addons.html) 28 | build/Release 29 | 30 | # Dependency directories 31 | node_modules 32 | jspm_packages 33 | 34 | # Optional npm cache directory 35 | .npm 36 | 37 | # Optional REPL history 38 | .node_repl_history 39 | 40 | ### Blueprint.js template 41 | app/temp 42 | 43 | .blueprint 44 | -------------------------------------------------------------------------------- /packages/blueprint-socket.io/.npmignore: -------------------------------------------------------------------------------- 1 | ### Blueprint.js template 2 | app/configs 3 | tests/ 4 | examples/ 5 | -------------------------------------------------------------------------------- /packages/blueprint-socket.io/LICENSE: -------------------------------------------------------------------------------- 1 | Copyright (c) 2016 One Hill Technologies, LLC 2 | 3 | Licensed under the Apache License, Version 2.0 (the "License"); 4 | you may not use this file except in compliance with the License. 5 | You may obtain a copy of the License at 6 | 7 | http://www.apache.org/licenses/LICENSE-2.0 8 | 9 | Unless required by applicable law or agreed to in writing, software 10 | distributed under the License is distributed on an "AS IS" BASIS, 11 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | See the License for the specific language governing permissions and 13 | limitations under the License. 14 | -------------------------------------------------------------------------------- /packages/blueprint-socket.io/tests/.gitkeep: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/onehilltech/blueprint/8b8fbc06594c9ef996d728aa918e73e166d3e67e/packages/blueprint-socket.io/tests/.gitkeep -------------------------------------------------------------------------------- /packages/blueprint-socket.io/tests/dummy/app/.DS_Store: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/onehilltech/blueprint/8b8fbc06594c9ef996d728aa918e73e166d3e67e/packages/blueprint-socket.io/tests/dummy/app/.DS_Store -------------------------------------------------------------------------------- /packages/blueprint-socket.io/tests/dummy/app/configs/server.js: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2018 One Hill Technologies, LLC 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | module.exports = { 18 | connections: { 19 | insecure: { 20 | protocol: 'http', port: 8080 21 | } 22 | } 23 | }; 24 | -------------------------------------------------------------------------------- /packages/blueprint-socket.io/tests/dummy/app/index.js: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env node 2 | 3 | const blueprint = require ('@onehilltech/blueprint'); 4 | 5 | blueprint.createApplicationAndStart (__dirname).then (() => { 6 | console.log ('The application is started.'); 7 | }).catch (err => { 8 | console.error (err); 9 | }); 10 | -------------------------------------------------------------------------------- /packages/blueprint-socket.io/tests/dummy/app/listeners/socket.io.connection/com/onehilltech/README.md: -------------------------------------------------------------------------------- 1 | All listeners in this directory are registered under the namespace 2 | com.onehilltech. 3 | -------------------------------------------------------------------------------- /packages/blueprint-socket.io/tests/dummy/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "dummy", 3 | "author": "One Hill Technologies, LLC", 4 | "version": "1.0.0", 5 | "main": "./app", 6 | "dependencies": { 7 | "@onehilltech/blueprint-socket.io": "file:../../" 8 | } 9 | } 10 | -------------------------------------------------------------------------------- /packages/blueprint-stripe/.gitignore: -------------------------------------------------------------------------------- 1 | ### Node template 2 | # Logs 3 | logs 4 | *.log 5 | npm-debug.log* 6 | 7 | # Runtime data 8 | pids 9 | *.pid 10 | *.seed 11 | 12 | # Directory for instrumented libs generated by jscoverage/JSCover 13 | lib-cov 14 | 15 | # Coverage directory used by tools like istanbul 16 | coverage 17 | 18 | # nyc test coverage 19 | .nyc_output 20 | 21 | # Grunt intermediate storage (http://gruntjs.com/creating-plugins#storing-task-files) 22 | .grunt 23 | 24 | # node-waf configuration 25 | .lock-wscript 26 | 27 | # Compiled binary addons (http://nodejs.org/api/addons.html) 28 | build/Release 29 | 30 | # Dependency directories 31 | node_modules 32 | jspm_packages 33 | 34 | # Optional npm cache directory 35 | .npm 36 | 37 | # Optional REPL history 38 | .node_repl_history 39 | 40 | ### Blueprint.js template 41 | .blueprint/ -------------------------------------------------------------------------------- /packages/blueprint-stripe/app/controllers/stripe-balance.js: -------------------------------------------------------------------------------- 1 | const { Controller } = require ('@onehilltech/blueprint'); 2 | const { StripeAction } = require ('../../lib'); 3 | 4 | /** 5 | * The resource controller for managing Stripe accounts. 6 | */ 7 | module.exports = Controller.extend ({ 8 | /** 9 | * Get a single account. 10 | */ 11 | get () { 12 | return StripeAction.extend ({ 13 | execute (req, res) { 14 | const { stripeAccountId: stripeAccount } = req.params; 15 | 16 | return this.stripe.balance.retrieve ({ stripeAccount }) 17 | .then (result => res.status (200).json ({'stripe-balance': result})); 18 | } 19 | }); 20 | } 21 | }); 22 | -------------------------------------------------------------------------------- /packages/blueprint-stripe/app/index.js: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env node 2 | 3 | const blueprint = require ('@onehilltech/blueprint'); 4 | 5 | return blueprint.createApplicationAndStart (__dirname) 6 | .catch (err => console.error (err)); 7 | -------------------------------------------------------------------------------- /packages/blueprint-stripe/app/routers/stripe.js: -------------------------------------------------------------------------------- 1 | const bodyParser = require ('body-parser'); 2 | 3 | module.exports = { 4 | '/webhooks': { 5 | use: bodyParser.raw ({type: 'application/json'}), 6 | post: { action: 'stripe@emitStripeEvent', options: { webhook: '$default' } } 7 | } 8 | } -------------------------------------------------------------------------------- /packages/blueprint-stripe/lib/index.js: -------------------------------------------------------------------------------- 1 | module.exports = exports = {}; 2 | 3 | exports.StripeAction = require ('./stripe-action'); 4 | exports.StripeAccountAction = require ('./stripe-account-action'); 5 | exports.StripeResourceController = require ('./stripe-resource-controller'); 6 | 7 | exports.models = require ('./models'); -------------------------------------------------------------------------------- /packages/blueprint-stripe/lib/models/index.js: -------------------------------------------------------------------------------- 1 | module.exports = exports = {}; 2 | 3 | exports.StripeAccountRef = require ('./stripe-account-ref'); 4 | -------------------------------------------------------------------------------- /packages/blueprint-stripe/lib/models/stripe-account-ref.js: -------------------------------------------------------------------------------- 1 | const db = require ('@onehilltech/blueprint-mongodb'); 2 | const { Schema } = db; 3 | 4 | const StripeAccountRefSchema = new Schema({ 5 | /// The id associated with the Stripe account. 6 | id: { type: String }, 7 | 8 | /// Charges are enabled on the Stripe account. 9 | charges_enabled: { type: Boolean }, 10 | 11 | /// Payouts are enabled on the Stripe account. 12 | payouts_enabled: { type: Boolean }, 13 | 14 | /// The requirements for the account. The content of this object is used 15 | /// to inform the platform what information is needed about a Stripe account. 16 | requirements: {}, 17 | 18 | /// The settings for the Stripe account. 19 | settings: {}, 20 | }, { _id: false }); 21 | 22 | module.exports = StripeAccountRefSchema; 23 | -------------------------------------------------------------------------------- /packages/blueprint-stripe/lib/stripe-account-action.js: -------------------------------------------------------------------------------- 1 | const { Action, NotFoundError } = require ('@onehilltech/blueprint'); 2 | 3 | module.exports = Action.extend ({ 4 | execute (req, res) { 5 | return Promise.resolve (this.getAccountId (req)) 6 | .then (accountId => { 7 | if (!accountId) 8 | throw new NotFoundError ('account_not_found', 'The account does not exist.'); 9 | 10 | return this.doExecute (accountId, req, res); 11 | }); 12 | }, 13 | 14 | getAccountId (req) { 15 | 16 | }, 17 | 18 | doExecute (accountId, req, res) { 19 | 20 | } 21 | }); 22 | -------------------------------------------------------------------------------- /packages/blueprint-stripe/lib/stripe-action.js: -------------------------------------------------------------------------------- 1 | const { Action, service } = require ('@onehilltech/blueprint'); 2 | 3 | module.exports = Action.extend ({ 4 | stripe: service () 5 | }); 6 | -------------------------------------------------------------------------------- /packages/blueprint-stripe/lib/stripe-resource-controller.js: -------------------------------------------------------------------------------- 1 | const { ResourceController, computed } = require ('@onehilltech/blueprint'); 2 | const { camelCase } = require ('lodash'); 3 | 4 | module.exports = ResourceController.extend ({ 5 | namespace: 'stripe', 6 | 7 | nameWithNamespace: computed ({ 8 | get () { return `${this.namespace}-${this.name}`; } 9 | }), 10 | 11 | id: computed ({ 12 | get () { return `${camelCase (this.nameWithNamespace)}Id`; } 13 | }), 14 | 15 | resourceName: computed.alias ('nameWithNamespace') 16 | }); -------------------------------------------------------------------------------- /packages/blueprint-stripe/tests/unit-tests/bootstrap.js: -------------------------------------------------------------------------------- 1 | const path = require ('path'); 2 | const blueprint = require ('@onehilltech/blueprint-testing'); 3 | 4 | const appPath = path.resolve (__dirname, '../../app'); 5 | blueprint.bootstrap (appPath); 6 | -------------------------------------------------------------------------------- /packages/blueprint-swagger/.gitignore: -------------------------------------------------------------------------------- 1 | ### Node template 2 | # Logs 3 | logs 4 | *.log 5 | npm-debug.log* 6 | 7 | # Runtime data 8 | pids 9 | *.pid 10 | *.seed 11 | 12 | # Directory for instrumented libs generated by jscoverage/JSCover 13 | lib-cov 14 | 15 | # Coverage directory used by tools like istanbul 16 | coverage 17 | 18 | # nyc test coverage 19 | .nyc_output 20 | 21 | # Grunt intermediate storage (http://gruntjs.com/creating-plugins#storing-task-files) 22 | .grunt 23 | 24 | # node-waf configuration 25 | .lock-wscript 26 | 27 | # Compiled binary addons (http://nodejs.org/api/addons.html) 28 | build/Release 29 | 30 | # Dependency directories 31 | node_modules 32 | jspm_packages 33 | 34 | # Optional npm cache directory 35 | .npm 36 | 37 | # Optional REPL history 38 | .node_repl_history 39 | 40 | ### Blueprint.js template 41 | app/temp 42 | -------------------------------------------------------------------------------- /packages/blueprint-swagger/.npmignore: -------------------------------------------------------------------------------- 1 | ### Blueprint.js template 2 | app/configs 3 | tests/ 4 | examples/ 5 | -------------------------------------------------------------------------------- /packages/blueprint-swagger/LICENSE: -------------------------------------------------------------------------------- 1 | Copyright (c) 2016 One Hill Technologies, LLC 2 | 3 | Licensed under the Apache License, Version 2.0 (the "License"); 4 | you may not use this file except in compliance with the License. 5 | You may obtain a copy of the License at 6 | 7 | http://www.apache.org/licenses/LICENSE-2.0 8 | 9 | Unless required by applicable law or agreed to in writing, software 10 | distributed under the License is distributed on an "AS IS" BASIS, 11 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | See the License for the specific language governing permissions and 13 | limitations under the License. 14 | -------------------------------------------------------------------------------- /packages/blueprint-swagger/app/controllers/swagger.js: -------------------------------------------------------------------------------- 1 | const { Controller, Action } = require ('@onehilltech/blueprint'); 2 | 3 | module.exports = Controller.extend ({ 4 | json () { 5 | return Action.extend ({ 6 | /// Cached version of the SwaggerUI specification. 7 | _spec: null, 8 | 9 | /// The specification builder, which is a promise. 10 | _builder: null, 11 | 12 | execute (req, res) { 13 | if (!!this._spec) 14 | return res.status (200).json (this._spec); 15 | 16 | return this.build ().then (spec => res.status (200).json (spec)); 17 | }, 18 | 19 | build () { 20 | if (this._builder) 21 | return this._builder; 22 | 23 | return this._builder = new Promise ((req, res) => { 24 | 25 | }); 26 | } 27 | }); 28 | } 29 | }); 30 | -------------------------------------------------------------------------------- /packages/blueprint-swagger/app/routers/v1/swagger.js: -------------------------------------------------------------------------------- 1 | const { Router } = require ('@onehilltech/blueprint'); 2 | 3 | module.exports = Router.extend ({ 4 | specification () { 5 | return { 6 | '/swagger.json': { 7 | get: 'swagger@json' 8 | } 9 | } 10 | } 11 | }) -------------------------------------------------------------------------------- /packages/blueprint-swagger/public_html/css/typography.css: -------------------------------------------------------------------------------- 1 | /* Google Font's Droid Sans */ 2 | @font-face { 3 | font-family: 'Droid Sans'; 4 | font-style: normal; 5 | font-weight: 400; 6 | src: local('Droid Sans'), local('DroidSans'), url('../fonts/DroidSans.ttf') format('truetype'); 7 | } 8 | /* Google Font's Droid Sans Bold */ 9 | @font-face { 10 | font-family: 'Droid Sans'; 11 | font-style: normal; 12 | font-weight: 700; 13 | src: local('Droid Sans Bold'), local('DroidSans-Bold'), url('../fonts/DroidSans-Bold.ttf') format('truetype'); 14 | } 15 | -------------------------------------------------------------------------------- /packages/blueprint-swagger/public_html/fonts/DroidSans-Bold.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/onehilltech/blueprint/8b8fbc06594c9ef996d728aa918e73e166d3e67e/packages/blueprint-swagger/public_html/fonts/DroidSans-Bold.ttf -------------------------------------------------------------------------------- /packages/blueprint-swagger/public_html/fonts/DroidSans.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/onehilltech/blueprint/8b8fbc06594c9ef996d728aa918e73e166d3e67e/packages/blueprint-swagger/public_html/fonts/DroidSans.ttf -------------------------------------------------------------------------------- /packages/blueprint-swagger/public_html/images/collapse.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/onehilltech/blueprint/8b8fbc06594c9ef996d728aa918e73e166d3e67e/packages/blueprint-swagger/public_html/images/collapse.gif -------------------------------------------------------------------------------- /packages/blueprint-swagger/public_html/images/expand.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/onehilltech/blueprint/8b8fbc06594c9ef996d728aa918e73e166d3e67e/packages/blueprint-swagger/public_html/images/expand.gif -------------------------------------------------------------------------------- /packages/blueprint-swagger/public_html/images/explorer_icons.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/onehilltech/blueprint/8b8fbc06594c9ef996d728aa918e73e166d3e67e/packages/blueprint-swagger/public_html/images/explorer_icons.png -------------------------------------------------------------------------------- /packages/blueprint-swagger/public_html/images/favicon-16x16.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/onehilltech/blueprint/8b8fbc06594c9ef996d728aa918e73e166d3e67e/packages/blueprint-swagger/public_html/images/favicon-16x16.png -------------------------------------------------------------------------------- /packages/blueprint-swagger/public_html/images/favicon-32x32.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/onehilltech/blueprint/8b8fbc06594c9ef996d728aa918e73e166d3e67e/packages/blueprint-swagger/public_html/images/favicon-32x32.png -------------------------------------------------------------------------------- /packages/blueprint-swagger/public_html/images/favicon.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/onehilltech/blueprint/8b8fbc06594c9ef996d728aa918e73e166d3e67e/packages/blueprint-swagger/public_html/images/favicon.ico -------------------------------------------------------------------------------- /packages/blueprint-swagger/public_html/images/logo_small.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/onehilltech/blueprint/8b8fbc06594c9ef996d728aa918e73e166d3e67e/packages/blueprint-swagger/public_html/images/logo_small.png -------------------------------------------------------------------------------- /packages/blueprint-swagger/public_html/images/pet_store_api.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/onehilltech/blueprint/8b8fbc06594c9ef996d728aa918e73e166d3e67e/packages/blueprint-swagger/public_html/images/pet_store_api.png -------------------------------------------------------------------------------- /packages/blueprint-swagger/public_html/images/throbber.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/onehilltech/blueprint/8b8fbc06594c9ef996d728aa918e73e166d3e67e/packages/blueprint-swagger/public_html/images/throbber.gif -------------------------------------------------------------------------------- /packages/blueprint-swagger/public_html/images/wordnik_api.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/onehilltech/blueprint/8b8fbc06594c9ef996d728aa918e73e166d3e67e/packages/blueprint-swagger/public_html/images/wordnik_api.png -------------------------------------------------------------------------------- /packages/blueprint-swagger/public_html/lib/jquery.slideto.min.js: -------------------------------------------------------------------------------- 1 | (function(b){b.fn.slideto=function(a){a=b.extend({slide_duration:"slow",highlight_duration:3E3,highlight:true,highlight_color:"#FFFF99"},a);return this.each(function(){obj=b(this);b("body").animate({scrollTop:obj.offset().top},a.slide_duration,function(){a.highlight&&b.ui.version&&obj.effect("highlight",{color:a.highlight_color},a.highlight_duration)})})}})(jQuery); 2 | -------------------------------------------------------------------------------- /packages/blueprint-swagger/public_html/lib/jquery.wiggle.min.js: -------------------------------------------------------------------------------- 1 | /* 2 | jQuery Wiggle 3 | Author: WonderGroup, Jordan Thomas 4 | URL: http://labs.wondergroup.com/demos/mini-ui/index.html 5 | License: MIT (http://en.wikipedia.org/wiki/MIT_License) 6 | */ 7 | jQuery.fn.wiggle=function(o){var d={speed:50,wiggles:3,travel:5,callback:null};var o=jQuery.extend(d,o);return this.each(function(){var cache=this;var wrap=jQuery(this).wrap('
').css("position","relative");var calls=0;for(i=1;i<=o.wiggles;i++){jQuery(this).animate({left:"-="+o.travel},o.speed).animate({left:"+="+o.travel*2},o.speed*2).animate({left:"-="+o.travel},o.speed,function(){calls++;if(jQuery(cache).parent().hasClass('wiggle-wrap')){jQuery(cache).parent().replaceWith(cache);} 8 | if(calls==o.wiggles&&jQuery.isFunction(o.callback)){o.callback();}});}});}; -------------------------------------------------------------------------------- /packages/blueprint-swagger/public_html/lib/object-assign-pollyfill.js: -------------------------------------------------------------------------------- 1 | if (typeof Object.assign != 'function') { 2 | (function () { 3 | Object.assign = function (target) { 4 | 'use strict'; 5 | if (target === undefined || target === null) { 6 | throw new TypeError('Cannot convert undefined or null to object'); 7 | } 8 | 9 | var output = Object(target); 10 | for (var index = 1; index < arguments.length; index++) { 11 | var source = arguments[index]; 12 | if (source !== undefined && source !== null) { 13 | for (var nextKey in source) { 14 | if (Object.prototype.hasOwnProperty.call(source, nextKey)) { 15 | output[nextKey] = source[nextKey]; 16 | } 17 | } 18 | } 19 | } 20 | return output; 21 | }; 22 | })(); 23 | } 24 | -------------------------------------------------------------------------------- /packages/blueprint-swagger/public_html/o2c.html: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /packages/blueprint-swagger/tests/.gitkeep: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/onehilltech/blueprint/8b8fbc06594c9ef996d728aa918e73e166d3e67e/packages/blueprint-swagger/tests/.gitkeep -------------------------------------------------------------------------------- /packages/blueprint-swagger/tests/fixtures/mock-app/.gitignore: -------------------------------------------------------------------------------- 1 | ### Node template 2 | # Logs 3 | logs 4 | *.log 5 | npm-debug.log* 6 | 7 | # Runtime data 8 | pids 9 | *.pid 10 | *.seed 11 | 12 | # Directory for instrumented libs generated by jscoverage/JSCover 13 | lib-cov 14 | 15 | # Coverage directory used by tools like istanbul 16 | coverage 17 | 18 | # nyc test coverage 19 | .nyc_output 20 | 21 | # Grunt intermediate storage (http://gruntjs.com/creating-plugins#storing-task-files) 22 | .grunt 23 | 24 | # node-waf configuration 25 | .lock-wscript 26 | 27 | # Compiled binary addons (http://nodejs.org/api/addons.html) 28 | build/Release 29 | 30 | # Dependency directories 31 | node_modules 32 | jspm_packages 33 | 34 | # Optional npm cache directory 35 | .npm 36 | 37 | # Optional REPL history 38 | .node_repl_history 39 | 40 | ### Blueprint.js template 41 | app/temp 42 | -------------------------------------------------------------------------------- /packages/blueprint-swagger/tests/fixtures/mock-app/.npmignore: -------------------------------------------------------------------------------- 1 | ### Blueprint.js template 2 | app/configs 3 | tests/ 4 | examples/ 5 | -------------------------------------------------------------------------------- /packages/blueprint-swagger/tests/fixtures/mock-app/app/configs/app.config.js: -------------------------------------------------------------------------------- 1 | module.exports = exports = { 2 | name : 'mock-app' 3 | }; 4 | -------------------------------------------------------------------------------- /packages/blueprint-swagger/tests/fixtures/mock-app/app/configs/development/.gitkeep: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/onehilltech/blueprint/8b8fbc06594c9ef996d728aa918e73e166d3e67e/packages/blueprint-swagger/tests/fixtures/mock-app/app/configs/development/.gitkeep -------------------------------------------------------------------------------- /packages/blueprint-swagger/tests/fixtures/mock-app/app/configs/mongodb.config.js: -------------------------------------------------------------------------------- 1 | var blueprint = require ('@onehilltech/blueprint') 2 | ; 3 | 4 | module.exports = { 5 | connections: { 6 | $default: { 7 | connstr: 'mongodb://localhost/mock-app_' + blueprint.env, 8 | 9 | options : { 10 | db: { 11 | native_parser: true, 12 | read_preference: "primary", 13 | forceServerObjectId: false, 14 | w: 1 15 | }, 16 | server: { 17 | auto_reconnect: true, 18 | keepAlive: 1, 19 | poolSize: 5, 20 | socketOptions: {} 21 | } 22 | } 23 | } 24 | } 25 | }; 26 | -------------------------------------------------------------------------------- /packages/blueprint-swagger/tests/fixtures/mock-app/app/configs/production/.gitkeep: -------------------------------------------------------------------------------- 1 | module.exports = exports = { 2 | middleware : { 3 | session: { 4 | cookie: { 5 | secure: true 6 | }, 7 | secret: '123abc', 8 | resave: true, 9 | saveUninitialized: true 10 | } 11 | } 12 | }; -------------------------------------------------------------------------------- /packages/blueprint-swagger/tests/fixtures/mock-app/app/configs/server.config.js: -------------------------------------------------------------------------------- 1 | module.exports = exports = { 2 | protocols : { 3 | http : { 4 | port: 5000 5 | } 6 | }, 7 | 8 | middleware : { 9 | validator : { }, 10 | bodyParser : { 11 | urlencoded : { extended: false }, 12 | json : { } 13 | }, 14 | 15 | morgan: { 16 | format: 'dev', 17 | immediate: true 18 | } 19 | } 20 | }; 21 | -------------------------------------------------------------------------------- /packages/blueprint-swagger/tests/fixtures/mock-app/app/configs/test/.gitkeep: -------------------------------------------------------------------------------- 1 | 2 | -------------------------------------------------------------------------------- /packages/blueprint-swagger/tests/fixtures/mock-app/app/controllers/HelloWorldController.js: -------------------------------------------------------------------------------- 1 | var blueprint = require ('@onehilltech/blueprint') 2 | , util = require ('util') 3 | ; 4 | 5 | function HelloWorldController () { 6 | blueprint.BaseController.call (this); 7 | } 8 | 9 | blueprint.controller (HelloWorldController); 10 | 11 | HelloWorldController.prototype.echoName = function () { 12 | var self = this; 13 | 14 | return function (req, res) { 15 | return res.render ('helloworld.pug', {name: req.body.name}); 16 | }; 17 | }; 18 | 19 | module.exports = exports = HelloWorldController; 20 | -------------------------------------------------------------------------------- /packages/blueprint-swagger/tests/fixtures/mock-app/app/hooks/module.init.js: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/onehilltech/blueprint/8b8fbc06594c9ef996d728aa918e73e166d3e67e/packages/blueprint-swagger/tests/fixtures/mock-app/app/hooks/module.init.js -------------------------------------------------------------------------------- /packages/blueprint-swagger/tests/fixtures/mock-app/app/index.js: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env node 2 | 3 | var winston = require ('winston') 4 | , blueprint = require ('@onehilltech/blueprint') 5 | ; 6 | 7 | blueprint.Application (__dirname, function (err, app) { 8 | if (err) throw err; 9 | 10 | app.start (function (err) { 11 | if (err) throw err; 12 | 13 | winston.log ('info', 'application started...'); 14 | }); 15 | }); 16 | -------------------------------------------------------------------------------- /packages/blueprint-swagger/tests/fixtures/mock-app/app/listeners/.gitkeep: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/onehilltech/blueprint/8b8fbc06594c9ef996d728aa918e73e166d3e67e/packages/blueprint-swagger/tests/fixtures/mock-app/app/listeners/.gitkeep -------------------------------------------------------------------------------- /packages/blueprint-swagger/tests/fixtures/mock-app/app/models/User.js: -------------------------------------------------------------------------------- 1 | var mongodb = require ('@onehilltech/blueprint-mongodb') 2 | ; 3 | 4 | var schema = new mongodb.Schema({ 5 | firstname: {type: String, required: true, trim: true}, 6 | lastname: {type: String, required: true, trim: true}, 7 | }); 8 | 9 | const COLLECTION_NAME = 'user'; 10 | module.exports = exports = mongodb.model (COLLECTION_NAME, schema); 11 | -------------------------------------------------------------------------------- /packages/blueprint-swagger/tests/fixtures/mock-app/app/policies/.gitkeep: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/onehilltech/blueprint/8b8fbc06594c9ef996d728aa918e73e166d3e67e/packages/blueprint-swagger/tests/fixtures/mock-app/app/policies/.gitkeep -------------------------------------------------------------------------------- /packages/blueprint-swagger/tests/fixtures/mock-app/app/resources/.gitkeep: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/onehilltech/blueprint/8b8fbc06594c9ef996d728aa918e73e166d3e67e/packages/blueprint-swagger/tests/fixtures/mock-app/app/resources/.gitkeep -------------------------------------------------------------------------------- /packages/blueprint-swagger/tests/fixtures/mock-app/app/routers/MainRouter.js: -------------------------------------------------------------------------------- 1 | module.exports = exports = { 2 | '/helloworld' : { 3 | get : { view : 'helloworld.pug' }, 4 | post : { action : 'HelloWorldController@echoName'}, 5 | } 6 | }; 7 | -------------------------------------------------------------------------------- /packages/blueprint-swagger/tests/fixtures/mock-app/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "mock-app", 3 | "description": "", 4 | "version": "0.0.1", 5 | "private": true, 6 | "scripts": { 7 | "test": "env NODE_ENV=test mocha --recursive tests/tests", 8 | "start-server": "env NODE_ENV=production forever -o ./app/temp/logs/output.log -e ./app/temp/logs/error.log start ./app/index.js", 9 | "stop-server": "env NODE_ENV=production forever stop app/index.js" 10 | }, 11 | "dependencies": { 12 | "@onehilltech/blueprint": "^1.0.1", 13 | "@onehilltech/blueprint-mongodb": "^0.8.0", 14 | "chai": "^3.5.0", 15 | "mocha": "^3.1.2", 16 | "superagent": "^2.3.0", 17 | "supertest": "^2.0.1" 18 | }, 19 | "devDependencies": {}, 20 | "license": "Apache-2.0", 21 | "engines": { 22 | "node": ">=4.0.0", 23 | "npm": ">=3.0.0" 24 | } 25 | } 26 | -------------------------------------------------------------------------------- /packages/blueprint-swagger/tests/fixtures/mock-app/tests/.gitkeep: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/onehilltech/blueprint/8b8fbc06594c9ef996d728aa918e73e166d3e67e/packages/blueprint-swagger/tests/fixtures/mock-app/tests/.gitkeep -------------------------------------------------------------------------------- /packages/blueprint-swagger/tests/fixtures/mock-app/tests/fixtures/appPath.js: -------------------------------------------------------------------------------- 1 | var path = require ('path'); 2 | module.exports = path.resolve (__dirname, '../../app'); 3 | -------------------------------------------------------------------------------- /packages/blueprint-swagger/tests/fixtures/mock-app/tests/integration-tests/.gitkeep: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/onehilltech/blueprint/8b8fbc06594c9ef996d728aa918e73e166d3e67e/packages/blueprint-swagger/tests/fixtures/mock-app/tests/integration-tests/.gitkeep -------------------------------------------------------------------------------- /packages/blueprint-swagger/tests/fixtures/mock-app/tests/unit-tests/.gitkeep: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/onehilltech/blueprint/8b8fbc06594c9ef996d728aa918e73e166d3e67e/packages/blueprint-swagger/tests/fixtures/mock-app/tests/unit-tests/.gitkeep -------------------------------------------------------------------------------- /packages/blueprint-swagger/tests/integration-tests/.gitkeep: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/onehilltech/blueprint/8b8fbc06594c9ef996d728aa918e73e166d3e67e/packages/blueprint-swagger/tests/integration-tests/.gitkeep -------------------------------------------------------------------------------- /packages/blueprint-swagger/tests/unit-tests/.gitkeep: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/onehilltech/blueprint/8b8fbc06594c9ef996d728aa918e73e166d3e67e/packages/blueprint-swagger/tests/unit-tests/.gitkeep -------------------------------------------------------------------------------- /packages/blueprint-swagger/tests/unit-tests/lib/specificationTest.js: -------------------------------------------------------------------------------- 1 | var blueprint = require ('@onehilltech/blueprint') 2 | , path = require ('path') 3 | , swagger = require ('../../../lib/specification') 4 | , expect = require ('chai').expect 5 | ; 6 | 7 | describe ('specification', function () { 8 | before (function (done) { 9 | var appPath = path.resolve (__dirname, '../../fixtures/mock-app/app'); 10 | blueprint.Application (appPath, done); 11 | }); 12 | 13 | it ('should create a Swagger specification', function (done) { 14 | swagger (blueprint.app, function (err, spec) { 15 | if (err) return done (err); 16 | 17 | expect (spec).to.have.property ('swagger', '2.0'); 18 | //expect (spec).to.have.property ('schemes', ['http']); 19 | 20 | return done (null); 21 | }); 22 | }); 23 | }); -------------------------------------------------------------------------------- /packages/blueprint-testing/lib/index.js: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2018 One Hill Technologies, LLC 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | exports.request = require ('./request'); 18 | exports.bootstrap = require ('./bootstrap'); 19 | -------------------------------------------------------------------------------- /packages/blueprint-testing/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "@onehilltech/blueprint-testing", 3 | "version": "4.76.5", 4 | "description": "Testing module for BlueprintJS applications", 5 | "main": "lib/index.js", 6 | "repository": "onehilltech/blueprint", 7 | "scripts": { 8 | "test": "echo \"Error: no test specified\" && exit 1" 9 | }, 10 | "keywords": [ 11 | "blueprint" 12 | ], 13 | "author": "One Hill Technologies, LLC", 14 | "license": "Apache-2.0", 15 | "dependencies": { 16 | "chai": "^4.3.6", 17 | "chai-datetime": "^1.8.0", 18 | "mocha": "^9.2.1", 19 | "path": "^0.12.7", 20 | "supertest": "^3.4.2" 21 | }, 22 | "engines": { 23 | "node": ">=11.6.0", 24 | "npm": ">=6.5.0" 25 | }, 26 | "gitHead": "3fa9d1898f478215e947cceb53313d6bd2cf93a5" 27 | } 28 | -------------------------------------------------------------------------------- /packages/blueprint-urls/app/controllers/redirect.js: -------------------------------------------------------------------------------- 1 | const RedirectAction = require ('../../lib/redirect-action'); 2 | const { Controller } = require ('@onehilltech/blueprint'); 3 | 4 | /** 5 | * @class RedirectController 6 | * 7 | * The controller for redirecting short url requests. 8 | * 9 | * The single responsibility of this controller is the take the request, and redirect 10 | * it to the original url that matches the short url in the request. 11 | */ 12 | module.exports = Controller.extend ({ 13 | __invoke () { 14 | return RedirectAction; 15 | } 16 | }); 17 | -------------------------------------------------------------------------------- /packages/blueprint-urls/app/controllers/short-url.js: -------------------------------------------------------------------------------- 1 | const { ResourceController } = require ('@onehilltech/blueprint-mongodb'); 2 | const { model } = require ('@onehilltech/blueprint'); 3 | 4 | module.exports = ResourceController.extend ({ 5 | /// Reference to the target resource. 6 | Model: model ('short-url'), 7 | 8 | /// Namespace for prevent clashes. 9 | namespace: 'blueprint' 10 | }); 11 | -------------------------------------------------------------------------------- /packages/blueprint-urls/app/routers/redirect.js: -------------------------------------------------------------------------------- 1 | const { Router, policies: { check } } = require ('@onehilltech/blueprint'); 2 | const bodyParser = require ('body-parser'); 3 | 4 | module.exports = Router.extend ({ 5 | specification: { 6 | '/*': { 7 | use: [bodyParser.json (), bodyParser.urlencoded ({extended: false})], 8 | get: 'redirect' 9 | } 10 | } 11 | }); 12 | -------------------------------------------------------------------------------- /packages/blueprint-urls/app/routers/short-url.js: -------------------------------------------------------------------------------- 1 | const { Router, policies: { check } } = require ('@onehilltech/blueprint'); 2 | const bodyParser = require ('body-parser'); 3 | 4 | module.exports = Router.extend ({ 5 | specification: { 6 | '/short-urls': { 7 | use: [bodyParser.json (), bodyParser.urlencoded ({extended: false})], 8 | 9 | policy: check ('gatekeeper.scope', 'blueprint.short-urls'), 10 | resource: { 11 | controller: 'short-url', 12 | } 13 | } 14 | } 15 | }); 16 | -------------------------------------------------------------------------------- /packages/blueprint-urls/app/services/urls.js: -------------------------------------------------------------------------------- 1 | const { Service } = require ('@onehilltech/blueprint'); 2 | const { forOwn } = require ('lodash'); 3 | 4 | /** 5 | * @class urls 6 | */ 7 | module.exports = Service.extend ({ 8 | /** 9 | * Configure the service. 10 | */ 11 | configure () { 12 | const { configs: { urls = {} }} = this.app; 13 | const { alias = {} } = urls; 14 | 15 | forOwn (alias, (value, key) => { 16 | Object.defineProperty (this, key, { value }); 17 | }); 18 | } 19 | }); 20 | -------------------------------------------------------------------------------- /packages/blueprint-urls/lib/redirect-action.js: -------------------------------------------------------------------------------- 1 | const { Action, service } = require ('@onehilltech/blueprint'); 2 | 3 | /** 4 | * @class RedirectAction 5 | * 6 | * A simple action for redirecting a short url to its original url. This action 7 | * can be use in Blueprint controllers. 8 | */ 9 | module.exports = Action.extend ({ 10 | /// Reference to the url shortener service. 11 | UrlShortener: service ('url-shortener'), 12 | 13 | /** 14 | * Get the options for the request. 15 | * 16 | * @param req 17 | * @return {{}} 18 | */ 19 | async getOptions (req) { 20 | return { }; 21 | }, 22 | 23 | /** 24 | * Execute the action. 25 | * 26 | * @param req 27 | * @param res 28 | */ 29 | async execute (req, res) { 30 | const options = await this.getOptions (req); 31 | return this.UrlShortener.redirect (req, res, options); 32 | } 33 | }); -------------------------------------------------------------------------------- /packages/blueprint-urls/tests/dummy/app/configs/.gitkeep: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/onehilltech/blueprint/8b8fbc06594c9ef996d728aa918e73e166d3e67e/packages/blueprint-urls/tests/dummy/app/configs/.gitkeep -------------------------------------------------------------------------------- /packages/blueprint-urls/tests/dummy/app/configs/server.js: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2018 One Hill Technologies, LLC 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | module.exports = { 18 | connections: { 19 | insecure: { protocol: 'http' } 20 | } 21 | }; -------------------------------------------------------------------------------- /packages/blueprint-urls/tests/dummy/app/configs/urls.js: -------------------------------------------------------------------------------- 1 | module.exports = { 2 | alias: { 3 | a1: 'https://localhost:8080', 4 | a2: 'https://localhost:9000', 5 | } 6 | }; 7 | -------------------------------------------------------------------------------- /packages/blueprint-urls/tests/dummy/app/controllers/.gitkeep: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/onehilltech/blueprint/8b8fbc06594c9ef996d728aa918e73e166d3e67e/packages/blueprint-urls/tests/dummy/app/controllers/.gitkeep -------------------------------------------------------------------------------- /packages/blueprint-urls/tests/dummy/app/index.js: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env node 2 | 3 | const blueprint = require ('@onehilltech/blueprint'); 4 | 5 | blueprint.createApplicationAndStart (__dirname).then (() => { 6 | console.log ('The application is started.'); 7 | }).catch (err => { 8 | console.error (err); 9 | }); 10 | -------------------------------------------------------------------------------- /packages/blueprint-urls/tests/dummy/app/models/.gitkeep: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/onehilltech/blueprint/8b8fbc06594c9ef996d728aa918e73e166d3e67e/packages/blueprint-urls/tests/dummy/app/models/.gitkeep -------------------------------------------------------------------------------- /packages/blueprint-urls/tests/dummy/app/routers/.gitkeep: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/onehilltech/blueprint/8b8fbc06594c9ef996d728aa918e73e166d3e67e/packages/blueprint-urls/tests/dummy/app/routers/.gitkeep -------------------------------------------------------------------------------- /packages/blueprint-urls/tests/dummy/app/routers/links.js: -------------------------------------------------------------------------------- 1 | module.exports = { 2 | '/links/*': { 3 | get: 'redirect' 4 | } 5 | } -------------------------------------------------------------------------------- /packages/blueprint-urls/tests/dummy/app/seeds/.gitkeep: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/onehilltech/blueprint/8b8fbc06594c9ef996d728aa918e73e166d3e67e/packages/blueprint-urls/tests/dummy/app/seeds/.gitkeep -------------------------------------------------------------------------------- /packages/blueprint-urls/tests/dummy/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "dummy", 3 | "author": "One Hill Technologies, LLC", 4 | "version": "1.0.0", 5 | "main": "./app", 6 | "dependencies": { 7 | "@onehilltech/blueprint-urls": "file:../../" 8 | } 9 | } 10 | -------------------------------------------------------------------------------- /packages/blueprint-urls/tests/unit-tests/app/controllers/redirect-test.js: -------------------------------------------------------------------------------- 1 | const { request } = require ('@onehilltech/blueprint-testing'); 2 | const { seed } = require ('@onehilltech/blueprint-mongodb'); 3 | const { expect } = require ('chai'); 4 | 5 | describe ('app | controllers | redirect', function () { 6 | it ('should redirect a short url', async function () { 7 | const { 'short-urls': [ shortUrl ] } = seed (); 8 | 9 | const res = await request () 10 | .get (`/links/${shortUrl.short_code}`) 11 | .expect (301, {}); 12 | 13 | expect (res.get ('location')).to.equal (shortUrl.url); 14 | }) 15 | }); -------------------------------------------------------------------------------- /packages/blueprint-urls/tests/unit-tests/app/services/urls-test.js: -------------------------------------------------------------------------------- 1 | const blueprint = require ('@onehilltech/blueprint'); 2 | const { expect } = require ('chai'); 3 | 4 | describe ('services | urls', function () { 5 | it ('should load aliases', async function () { 6 | const urls = blueprint.lookup ('service:urls'); 7 | 8 | expect (urls).to.include ( { 9 | a1: 'https://localhost:8080', 10 | a2: 'https://localhost:9000', 11 | }) 12 | }); 13 | }); 14 | -------------------------------------------------------------------------------- /packages/blueprint-urls/tests/unit-tests/bootstrap.js: -------------------------------------------------------------------------------- 1 | const path = require ('path'); 2 | const blueprint = require ('@onehilltech/blueprint-testing'); 3 | 4 | const appPath = path.resolve (__dirname, '../dummy/app'); 5 | blueprint.bootstrap (appPath); -------------------------------------------------------------------------------- /packages/blueprint-winston/app/assets/.gitkeep: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/onehilltech/blueprint/8b8fbc06594c9ef996d728aa918e73e166d3e67e/packages/blueprint-winston/app/assets/.gitkeep -------------------------------------------------------------------------------- /packages/blueprint-winston/app/index.js: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env node 2 | 3 | const blueprint = require ('@onehilltech/blueprint'); 4 | 5 | return blueprint.createApplicationAndStart (__dirname) 6 | .catch (err => console.error (err)); 7 | -------------------------------------------------------------------------------- /packages/blueprint-winston/app/models/.gitkeep: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/onehilltech/blueprint/8b8fbc06594c9ef996d728aa918e73e166d3e67e/packages/blueprint-winston/app/models/.gitkeep -------------------------------------------------------------------------------- /packages/blueprint-winston/app/policies/.gitkeep: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/onehilltech/blueprint/8b8fbc06594c9ef996d728aa918e73e166d3e67e/packages/blueprint-winston/app/policies/.gitkeep -------------------------------------------------------------------------------- /packages/blueprint-winston/index.js: -------------------------------------------------------------------------------- 1 | const winston = reqiure ('winston'); 2 | 3 | module.exports = winston; 4 | -------------------------------------------------------------------------------- /packages/blueprint-winston/tests/unit-tests/bootstrap.js: -------------------------------------------------------------------------------- 1 | const path = require ('path'); 2 | const blueprint = require ('@onehilltech/blueprint-testing'); 3 | 4 | const appPath = path.resolve (__dirname, '../../app'); 5 | blueprint.bootstrap (appPath); 6 | -------------------------------------------------------------------------------- /packages/blueprint/.github/ISSUE_TEMPLATE/bug_report.md: -------------------------------------------------------------------------------- 1 | --- 2 | name: Bug report 3 | about: Create a report to help us improve 4 | title: '' 5 | labels: '' 6 | assignees: '' 7 | 8 | --- 9 | 10 | **Describe the bug** 11 | A clear and concise description of what the bug is. 12 | 13 | **To Reproduce** 14 | Steps to reproduce the behavior: 15 | 1. Go to '...' 16 | 2. Click on '....' 17 | 3. Scroll down to '....' 18 | 4. See error 19 | 20 | **Expected behavior** 21 | A clear and concise description of what you expected to happen. 22 | 23 | **Screenshots** 24 | If applicable, add screenshots to help explain your problem. 25 | 26 | **Platform (please complete the following information):** 27 | - OS: [e.g. iOS] 28 | - Version [e.g. 22] 29 | - Node: [e.g. 8] 30 | 31 | **Additional context** 32 | Add any other context about the problem here. 33 | -------------------------------------------------------------------------------- /packages/blueprint/.npmignore: -------------------------------------------------------------------------------- 1 | # Logs 2 | logs 3 | *.log 4 | 5 | # Runtime data 6 | pids 7 | *.pid 8 | *.seed 9 | 10 | # Directory for instrumented libs generated by jscoverage/JSCover 11 | lib-cov 12 | 13 | # Coverage directory used by tools like istanbul 14 | coverage 15 | 16 | # Grunt intermediate storage (http://gruntjs.com/creating-plugins#storing-task-files) 17 | .grunt 18 | 19 | # node-waf configuration 20 | .lock-wscript 21 | 22 | # Compiled binary addons (http://nodejs.org/api/addons.html) 23 | build/Release 24 | 25 | # Dependency directory 26 | # https://docs.npmjs.com/misc/faq#should-i-check-my-node-modules-folder-into-git 27 | node_modules 28 | tests 29 | examples 30 | tutorials 31 | docs 32 | 33 | -------------------------------------------------------------------------------- /packages/blueprint/.travis.yml: -------------------------------------------------------------------------------- 1 | sudo : false 2 | 3 | language: node_js 4 | 5 | node_js: 6 | - "8" 7 | - "10" 8 | 9 | env: 10 | - CXX=g++-4.8 11 | 12 | addons: 13 | apt: 14 | sources: 15 | - ubuntu-toolchain-r-test 16 | packages: 17 | - g++-4.8 18 | 19 | after_success: 20 | - npm run coveralls 21 | -------------------------------------------------------------------------------- /packages/blueprint/README.md: -------------------------------------------------------------------------------- 1 | Blueprint 2 | ================ 3 | 4 | a solid framework for building APIs and backend services 5 | 6 | ![npm version](https://img.shields.io/npm/v/@onehilltech/blueprint.svg) 7 | ![node version](https://img.shields.io/node/v/@onehilltech/blueprint.svg) 8 | [![Build Status](https://travis-ci.org/onehilltech/blueprint.svg?branch=master)](https://travis-ci.org/onehilltech/blueprint) 9 | [![Coverage Status](https://coveralls.io/repos/github/onehilltech/blueprint/badge.svg?branch=master)](https://coveralls.io/github/onehilltech/blueprint?branch=master) 10 | [![Dependencies](https://david-dm.org/onehilltech/blueprint.svg)](https://david-dm.org/onehilltech/blueprint) 11 | [![devDependencies Status](https://david-dm.org/onehilltech/blueprint/dev-status.svg)](https://david-dm.org/onehilltech/blueprint?type=dev) 12 | -------------------------------------------------------------------------------- /packages/blueprint/cli/generators/controller/files/app/controllers/{{entityName}}.js: -------------------------------------------------------------------------------- 1 | const { 2 | Controller, 3 | Action 4 | } = require ('@onehilltech/blueprint'); 5 | 6 | /** 7 | * @class {{entityBaseName}} 8 | */ 9 | module.exports = Controller.extend ({ 10 | {{#if defaultAction}} 11 | /** 12 | * This is the default controller action. It is bound from the router specification 13 | * if you do not provide a controller action with defining to the action property. 14 | * 15 | * @return {Action} Action subclass 16 | */ 17 | __invoke () { 18 | return Action.extend ({ 19 | execute (req, res) { 20 | 21 | } 22 | }); 23 | } 24 | {{/if}} 25 | }); 26 | -------------------------------------------------------------------------------- /packages/blueprint/cli/generators/listener/files/app/listeners/{{eventName}}/{{entityName}}.js: -------------------------------------------------------------------------------- 1 | const { Listener } = require ('@onehilltech/blueprint'); 2 | 3 | module.exports = Listener.extend ({ 4 | handleEvent (/* arg0, arg1, arg2*/) { 5 | // TODO Add implementation here 6 | } 7 | }); 8 | -------------------------------------------------------------------------------- /packages/blueprint/cli/generators/service/files/app/services/{{entityName}}.js: -------------------------------------------------------------------------------- 1 | const { Service } = require ('@onehilltech/blueprint'); 2 | 3 | /** 4 | * @class {{entityBaseName}} 5 | */ 6 | module.exports = Service.extend ({ 7 | 8 | }); 9 | -------------------------------------------------------------------------------- /packages/blueprint/examples/01_helloworld/.gitignore: -------------------------------------------------------------------------------- 1 | # Logs 2 | logs 3 | *.log 4 | 5 | # Runtime data 6 | pids 7 | *.pid 8 | *.seed 9 | 10 | # Directory for instrumented libs generated by jscoverage/JSCover 11 | lib-cov 12 | 13 | # Coverage directory used by tools like istanbul 14 | coverage 15 | 16 | # Grunt intermediate storage (http://gruntjs.com/creating-plugins#storing-task-files) 17 | .grunt 18 | 19 | # node-waf configuration 20 | .lock-wscript 21 | 22 | # Compiled binary addons (http://nodejs.org/api/addons.html) 23 | build/Release 24 | 25 | # Dependency directory 26 | # https://docs.npmjs.com/misc/faq#should-i-check-my-node-modules-folder-into-git 27 | node_modules 28 | 29 | app/data 30 | -------------------------------------------------------------------------------- /packages/blueprint/examples/01_helloworld/.npmignore: -------------------------------------------------------------------------------- 1 | # Logs 2 | logs 3 | *.log 4 | 5 | # Runtime data 6 | pids 7 | *.pid 8 | *.seed 9 | 10 | # Directory for instrumented libs generated by jscoverage/JSCover 11 | lib-cov 12 | 13 | # Coverage directory used by tools like istanbul 14 | coverage 15 | 16 | # Grunt intermediate storage (http://gruntjs.com/creating-plugins#storing-task-files) 17 | .grunt 18 | 19 | # node-waf configuration 20 | .lock-wscript 21 | 22 | # Compiled binary addons (http://nodejs.org/api/addons.html) 23 | build/Release 24 | 25 | # Dependency directory 26 | # https://docs.npmjs.com/misc/faq#should-i-check-my-node-modules-folder-into-git 27 | node_modules 28 | -------------------------------------------------------------------------------- /packages/blueprint/examples/01_helloworld/app/configs/app.js: -------------------------------------------------------------------------------- 1 | module.exports = exports = { 2 | name : 'helloworld' 3 | }; 4 | -------------------------------------------------------------------------------- /packages/blueprint/examples/01_helloworld/app/controllers/helloworld.js: -------------------------------------------------------------------------------- 1 | const { 2 | SingleViewAction, 3 | Controller, 4 | Action 5 | } = require ('@onehilltech/blueprint'); 6 | 7 | module.exports = Controller.extend ({ 8 | echoName () { 9 | return Action.extend ({ 10 | execute (req, res) { 11 | 12 | } 13 | }) 14 | 15 | return SingleViewAction.extend ({ 16 | template: 'helloworld.pug', 17 | 18 | model (req) { 19 | const {whoami} = req.body; 20 | return {name: whoami}; 21 | } 22 | }); 23 | } 24 | }); 25 | -------------------------------------------------------------------------------- /packages/blueprint/examples/01_helloworld/app/index.js: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env node 2 | 3 | const blueprint = require ('@onehilltech/blueprint'); 4 | 5 | blueprint.createApplicationAndStart (__dirname).then (() => { 6 | console.log ('The application is started.'); 7 | }).catch (err => { 8 | console.error (err); 9 | }); 10 | -------------------------------------------------------------------------------- /packages/blueprint/examples/01_helloworld/app/listeners/blueprint.app.initialized/console.js: -------------------------------------------------------------------------------- 1 | const { Listener } = require ('@onehilltech/blueprint'); 2 | 3 | module.exports = Listener.extend ({ 4 | handleEvent () { 5 | console.log ('The application is initialized.') 6 | } 7 | }); 8 | -------------------------------------------------------------------------------- /packages/blueprint/examples/01_helloworld/app/listeners/blueprint.app.started/console.js: -------------------------------------------------------------------------------- 1 | const { Listener } = require ('@onehilltech/blueprint'); 2 | 3 | module.exports = Listener.extend ({ 4 | handleEvent () { 5 | console.log ('The application is started.'); 6 | } 7 | }); 8 | -------------------------------------------------------------------------------- /packages/blueprint/examples/01_helloworld/app/routers/main.js: -------------------------------------------------------------------------------- 1 | module.exports = { 2 | '/helloworld' : { 3 | get : { view : 'helloworld.pug' }, 4 | post : { action : 'helloworld@echoName'} 5 | } 6 | }; 7 | 8 | 9 | -------------------------------------------------------------------------------- /packages/blueprint/examples/01_helloworld/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "helloworld", 3 | "author": "One Hill Technologies, LLC", 4 | "version": "1.0.0", 5 | "description": "Hello, World!", 6 | "main": "./app", 7 | "dependencies": { 8 | "@onehilltech/blueprint": "file:../..", 9 | "pug": "^2.0.1" 10 | } 11 | } 12 | -------------------------------------------------------------------------------- /packages/blueprint/examples/02_policies/.gitignore: -------------------------------------------------------------------------------- 1 | # Logs 2 | logs 3 | *.log 4 | 5 | # Runtime data 6 | pids 7 | *.pid 8 | *.seed 9 | 10 | # Directory for instrumented libs generated by jscoverage/JSCover 11 | lib-cov 12 | 13 | # Coverage directory used by tools like istanbul 14 | coverage 15 | 16 | # Grunt intermediate storage (http://gruntjs.com/creating-plugins#storing-task-files) 17 | .grunt 18 | 19 | # node-waf configuration 20 | .lock-wscript 21 | 22 | # Compiled binary addons (http://nodejs.org/api/addons.html) 23 | build/Release 24 | 25 | # Dependency directory 26 | # https://docs.npmjs.com/misc/faq#should-i-check-my-node-modules-folder-into-git 27 | node_modules 28 | 29 | # Blueprint.js files 30 | app/data 31 | 32 | -------------------------------------------------------------------------------- /packages/blueprint/examples/02_policies/.npmignore: -------------------------------------------------------------------------------- 1 | # Logs 2 | logs 3 | *.log 4 | 5 | # Runtime data 6 | pids 7 | *.pid 8 | *.seed 9 | 10 | # Directory for instrumented libs generated by jscoverage/JSCover 11 | lib-cov 12 | 13 | # Coverage directory used by tools like istanbul 14 | coverage 15 | 16 | # Grunt intermediate storage (http://gruntjs.com/creating-plugins#storing-task-files) 17 | .grunt 18 | 19 | # node-waf configuration 20 | .lock-wscript 21 | 22 | # Compiled binary addons (http://nodejs.org/api/addons.html) 23 | build/Release 24 | 25 | # Dependency directory 26 | # https://docs.npmjs.com/misc/faq#should-i-check-my-node-modules-folder-into-git 27 | node_modules 28 | -------------------------------------------------------------------------------- /packages/blueprint/examples/02_policies/app/configs/app.js: -------------------------------------------------------------------------------- 1 | module.exports = exports = { 2 | name : 'blueprint-examples-seeds' 3 | }; 4 | -------------------------------------------------------------------------------- /packages/blueprint/examples/02_policies/app/configs/server.js: -------------------------------------------------------------------------------- 1 | module.exports = exports = { 2 | protocols : { 3 | http : { 4 | port: 5000 5 | } 6 | }, 7 | middleware : { 8 | morgan: { 9 | format: 'dev', 10 | immediate: true 11 | }, 12 | 13 | validator : { }, 14 | 15 | bodyParser : { 16 | json : { }, 17 | urlencoded : { extended : false} 18 | }, 19 | 20 | passport : { }, 21 | 22 | session: { 23 | cookie: { 24 | secure: false 25 | }, 26 | secret: "123abc", 27 | resave: true, 28 | saveUninitialized: true 29 | } 30 | } 31 | }; 32 | -------------------------------------------------------------------------------- /packages/blueprint/examples/02_policies/app/controllers/helloworld.js: -------------------------------------------------------------------------------- 1 | const { 2 | Controller, 3 | SingleViewAction 4 | } = require ('@onehilltech/blueprint'); 5 | 6 | module.exports = Controller.extend ({ 7 | echoName () { 8 | return SingleViewAction.extend ({ 9 | template: 'helloworld.pug', 10 | 11 | model (req) { 12 | const {name} = req.body; 13 | return {name}; 14 | } 15 | }); 16 | } 17 | }); 18 | -------------------------------------------------------------------------------- /packages/blueprint/examples/02_policies/app/index.js: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env node 2 | 3 | const blueprint = require ('@onehilltech/blueprint'); 4 | 5 | blueprint.createApplicationAndStart (__dirname).then (() => { 6 | console.log ('The application is started.'); 7 | }).catch (err => { 8 | console.error (err); 9 | }); 10 | -------------------------------------------------------------------------------- /packages/blueprint/examples/02_policies/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "policies", 3 | "author": "James H. Hill", 4 | "version": "0.0.0", 5 | "description": "a Blueprint.js web application", 6 | 7 | "main": "./app", 8 | 9 | "dependencies": { 10 | "@onehilltech/blueprint": "file:../..", 11 | "pug": "^2.0.1" 12 | } 13 | } 14 | -------------------------------------------------------------------------------- /packages/blueprint/examples/03_upload/.gitignore: -------------------------------------------------------------------------------- 1 | # Logs 2 | logs 3 | *.log 4 | 5 | # Runtime data 6 | pids 7 | *.pid 8 | *.seed 9 | 10 | # Directory for instrumented libs generated by jscoverage/JSCover 11 | lib-cov 12 | 13 | # Coverage directory used by tools like istanbul 14 | coverage 15 | 16 | # Grunt intermediate storage (http://gruntjs.com/creating-plugins#storing-task-files) 17 | .grunt 18 | 19 | # node-waf configuration 20 | .lock-wscript 21 | 22 | # Compiled binary addons (http://nodejs.org/api/addons.html) 23 | build/Release 24 | 25 | # Dependency directory 26 | # https://docs.npmjs.com/misc/faq#should-i-check-my-node-modules-folder-into-git 27 | node_modules 28 | 29 | # Blueprint.js files 30 | app/data 31 | 32 | -------------------------------------------------------------------------------- /packages/blueprint/examples/03_upload/.npmignore: -------------------------------------------------------------------------------- 1 | # Logs 2 | logs 3 | *.log 4 | 5 | # Runtime data 6 | pids 7 | *.pid 8 | *.seed 9 | 10 | # Directory for instrumented libs generated by jscoverage/JSCover 11 | lib-cov 12 | 13 | # Coverage directory used by tools like istanbul 14 | coverage 15 | 16 | # Grunt intermediate storage (http://gruntjs.com/creating-plugins#storing-task-files) 17 | .grunt 18 | 19 | # node-waf configuration 20 | .lock-wscript 21 | 22 | # Compiled binary addons (http://nodejs.org/api/addons.html) 23 | build/Release 24 | 25 | # Dependency directory 26 | # https://docs.npmjs.com/misc/faq#should-i-check-my-node-modules-folder-into-git 27 | node_modules 28 | -------------------------------------------------------------------------------- /packages/blueprint/examples/03_upload/app/configs/app.js: -------------------------------------------------------------------------------- 1 | module.exports = { 2 | name : 'blueprint-init' 3 | }; 4 | -------------------------------------------------------------------------------- /packages/blueprint/examples/03_upload/app/configs/server.js: -------------------------------------------------------------------------------- 1 | module.exports = { 2 | protocols : { 3 | http : { 4 | port: 5000 5 | }, 6 | }, 7 | middleware : { 8 | morgan: { 9 | format: 'dev', 10 | immediate: true 11 | }, 12 | 13 | bodyParser : { 14 | json : { }, 15 | urlencoded : { extended : false} 16 | } 17 | } 18 | }; 19 | -------------------------------------------------------------------------------- /packages/blueprint/examples/03_upload/app/controllers/helloworld.js: -------------------------------------------------------------------------------- 1 | const { 2 | SingleFileUploadAction, 3 | Controller, 4 | } = require ('@onehilltech/blueprint'); 5 | 6 | module.exports = Controller.extend ({ 7 | uploadImage () { 8 | return SingleFileUploadAction.extend ({ 9 | name: 'image', 10 | 11 | onUploadComplete (req, res) { 12 | res.status (200).render ('helloworld.pug', {file: req.file}); 13 | } 14 | }); 15 | } 16 | }); 17 | -------------------------------------------------------------------------------- /packages/blueprint/examples/03_upload/app/index.js: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env node 2 | 3 | const blueprint = require ('@onehilltech/blueprint'); 4 | 5 | blueprint.createApplicationAndStart (__dirname).then (() => { 6 | console.log ('The application is started.'); 7 | }).catch (err => { 8 | console.error (err); 9 | }); 10 | -------------------------------------------------------------------------------- /packages/blueprint/examples/03_upload/app/routers/main.js: -------------------------------------------------------------------------------- 1 | module.exports = { 2 | '/helloworld' : { 3 | get : {view: 'helloworld.pug'}, 4 | post: {action: 'helloworld@uploadImage'} 5 | } 6 | }; 7 | -------------------------------------------------------------------------------- /packages/blueprint/examples/03_upload/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "blueprint-init", 3 | "author": "Blueprint.js", 4 | "version": "0.0.0", 5 | "description": "a Blueprint.js web application", 6 | "main": "./app", 7 | "dependencies": { 8 | "@onehilltech/blueprint": "file:../..", 9 | "pug": "^2.0.2" 10 | } 11 | } 12 | -------------------------------------------------------------------------------- /packages/blueprint/examples/04_resources/app/configs/app.js: -------------------------------------------------------------------------------- 1 | module.exports = { 2 | name : 'blueprint_examples_resources' 3 | }; 4 | -------------------------------------------------------------------------------- /packages/blueprint/examples/04_resources/app/configs/server.js: -------------------------------------------------------------------------------- 1 | module.exports = { 2 | protocols : { 3 | http : { 4 | port: 5000 5 | } 6 | }, 7 | 8 | middleware : { 9 | bodyParser : { 10 | urlencoded : { extended: false }, 11 | json : { } 12 | }, 13 | 14 | morgan: { 15 | format: 'dev', 16 | immediate: true 17 | } 18 | } 19 | }; 20 | -------------------------------------------------------------------------------- /packages/blueprint/examples/04_resources/app/index.js: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env node 2 | 3 | const blueprint = require ('@onehilltech/blueprint'); 4 | 5 | blueprint.createApplicationAndStart (__dirname).then (() => { 6 | console.log ('The application is started.'); 7 | }).catch (err => { 8 | console.error (err); 9 | }); 10 | -------------------------------------------------------------------------------- /packages/blueprint/examples/04_resources/app/routers/messages.js: -------------------------------------------------------------------------------- 1 | module.exports = { 2 | '/messageboard' : { 3 | get : { view : 'messageboard.pug' } 4 | }, 5 | 6 | '/messages': { 7 | resource: { 8 | controller: 'message', 9 | deny: ['update'] 10 | } 11 | } 12 | }; 13 | -------------------------------------------------------------------------------- /packages/blueprint/examples/04_resources/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "blueprint_examples_resources", 3 | "version": "1.0.0", 4 | "description": "", 5 | "main": "./app", 6 | "author": "One Hill Technologies, LLC", 7 | "license": "Apache-2.0", 8 | "dependencies": { 9 | "@onehilltech/blueprint": "file:../..", 10 | "pug": "^2.0.2" 11 | } 12 | } 13 | -------------------------------------------------------------------------------- /packages/blueprint/examples/05_cluster/.gitignore: -------------------------------------------------------------------------------- 1 | ### Node template 2 | # Logs 3 | logs 4 | *.log 5 | npm-debug.log* 6 | 7 | # Runtime data 8 | pids 9 | *.pid 10 | *.seed 11 | 12 | # Directory for instrumented libs generated by jscoverage/JSCover 13 | lib-cov 14 | 15 | # Coverage directory used by tools like istanbul 16 | coverage 17 | 18 | # nyc test coverage 19 | .nyc_output 20 | 21 | # Grunt intermediate storage (http://gruntjs.com/creating-plugins#storing-task-files) 22 | .grunt 23 | 24 | # node-waf configuration 25 | .lock-wscript 26 | 27 | # Compiled binary addons (http://nodejs.org/api/addons.html) 28 | build/Release 29 | 30 | # Dependency directories 31 | node_modules 32 | jspm_packages 33 | 34 | # Optional npm cache directory 35 | .npm 36 | 37 | # Optional REPL history 38 | .node_repl_history 39 | 40 | ### Blueprint.js template 41 | .blueprint/ 42 | -------------------------------------------------------------------------------- /packages/blueprint/examples/05_cluster/.npmignore: -------------------------------------------------------------------------------- 1 | ### Blueprint.js template 2 | app/configs 3 | tests/ 4 | examples/ 5 | -------------------------------------------------------------------------------- /packages/blueprint/examples/05_cluster/app/configs/app.js: -------------------------------------------------------------------------------- 1 | module.exports = exports = { 2 | name : '07_cluster', 3 | cluster: true 4 | }; 5 | -------------------------------------------------------------------------------- /packages/blueprint/examples/05_cluster/app/configs/server.js: -------------------------------------------------------------------------------- 1 | module.exports = exports = { 2 | protocols : { 3 | http : { 4 | port: 5000 5 | } 6 | }, 7 | 8 | middleware : { 9 | validator : { }, 10 | bodyParser : { 11 | urlencoded : { extended: false }, 12 | json : { } 13 | }, 14 | 15 | morgan: { 16 | format: 'dev', 17 | immediate: true 18 | } 19 | } 20 | }; 21 | -------------------------------------------------------------------------------- /packages/blueprint/examples/05_cluster/app/controllers/helloworld.js: -------------------------------------------------------------------------------- 1 | const { 2 | Controller, 3 | SingleViewAction 4 | } = require ('@onehilltech/blueprint'); 5 | 6 | 7 | module.exports = Controller.extend ({ 8 | echoName () { 9 | return SingleViewAction.extend ({ 10 | template: 'helloworld.pug', 11 | 12 | model (req) { 13 | return {name: req.body.name}; 14 | } 15 | }) 16 | } 17 | }); 18 | -------------------------------------------------------------------------------- /packages/blueprint/examples/05_cluster/app/index.js: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env node 2 | 3 | const blueprint = require ('@onehilltech/blueprint'); 4 | 5 | blueprint.createApplicationAndStart (__dirname).then (() => { 6 | console.log ('The application is started.'); 7 | }).catch (err => { 8 | console.error (err); 9 | }); 10 | -------------------------------------------------------------------------------- /packages/blueprint/examples/05_cluster/app/routers/main.js: -------------------------------------------------------------------------------- 1 | module.exports = exports = { 2 | '/helloworld' : { 3 | get : { view : 'helloworld.pug' }, 4 | post : { action : 'helloworld@echoName'}, 5 | } 6 | }; 7 | -------------------------------------------------------------------------------- /packages/blueprint/examples/05_cluster/tests/.gitkeep: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/onehilltech/blueprint/8b8fbc06594c9ef996d728aa918e73e166d3e67e/packages/blueprint/examples/05_cluster/tests/.gitkeep -------------------------------------------------------------------------------- /packages/blueprint/examples/05_cluster/tests/fixtures/.gitkeep: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/onehilltech/blueprint/8b8fbc06594c9ef996d728aa918e73e166d3e67e/packages/blueprint/examples/05_cluster/tests/fixtures/.gitkeep -------------------------------------------------------------------------------- /packages/blueprint/examples/05_cluster/tests/integration-tests/.gitkeep: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/onehilltech/blueprint/8b8fbc06594c9ef996d728aa918e73e166d3e67e/packages/blueprint/examples/05_cluster/tests/integration-tests/.gitkeep -------------------------------------------------------------------------------- /packages/blueprint/examples/05_cluster/tests/unit-tests/setup.js: -------------------------------------------------------------------------------- 1 | 'use strict'; 2 | 3 | const path = require ('path') 4 | , blueprint = require ('@onehilltech/blueprint') 5 | ; 6 | 7 | before ('create application and start', function (done) { 8 | const appPath = path.resolve (__dirname, '../../app'); 9 | blueprint.createApplicationAndStart (appPath, done); 10 | }); 11 | 12 | beforeEach ('restart application', function (done) { 13 | blueprint.app.restart (done); 14 | }); 15 | -------------------------------------------------------------------------------- /packages/blueprint/lib/array-upload-action.js: -------------------------------------------------------------------------------- 1 | const assert = require ('assert'); 2 | const UploadAction = require ('./upload-action'); 3 | 4 | /** 5 | * @class ArrayUploadAction 6 | * 7 | * Action for uploading an array files. The files will be available on req.files 8 | * in onUploadComplete(req,res). 9 | */ 10 | module.exports = UploadAction.extend ({ 11 | /// The name of the field that will contain the uploaded files. 12 | name: null, 13 | 14 | init () { 15 | this._super.call (this, ...arguments); 16 | 17 | assert (!!this.name, "You must define the 'name' property."); 18 | 19 | this._middleware = this._upload.array (this.name); 20 | } 21 | }); 22 | -------------------------------------------------------------------------------- /packages/blueprint/lib/environment.js: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2018 One Hill Technologies, LLC 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | const {BO} = require ('base-object'); 18 | 19 | module.exports = BO.create ({ 20 | env: process.env.NODE_ENV || 'development' 21 | }); 22 | -------------------------------------------------------------------------------- /packages/blueprint/lib/fields-upload-action.js: -------------------------------------------------------------------------------- 1 | const assert = require ('assert'); 2 | const UploadAction = require ('./upload-action'); 3 | 4 | /** 5 | * @class FieldsUploadAction 6 | * 7 | * Action for accepting a mix of files. 8 | */ 9 | module.exports = UploadAction.extend ({ 10 | /// The name of the field that will contain the uploaded file. 11 | fields: null, 12 | 13 | init () { 14 | this._super.call (this, ...arguments); 15 | 16 | assert (!!this.fields, "You must define the 'fields' property."); 17 | 18 | this._middleware = this._upload.fields (this.fields); 19 | } 20 | }); 21 | -------------------------------------------------------------------------------- /packages/blueprint/lib/http-error.js: -------------------------------------------------------------------------------- 1 | const BlueprintError = require ('./error'); 2 | 3 | /** 4 | * @class HttpError 5 | * 6 | * Base class for all http errors. 7 | * 8 | * @param statusCode Http status code 9 | * @param code Error code 10 | * @param message Error message 11 | * @param details Optional details about the error 12 | * @constructor 13 | */ 14 | class HttpError extends BlueprintError { 15 | constructor (statusCode, code, message, details) { 16 | super (code, message, details); 17 | 18 | this.statusCode = statusCode; 19 | } 20 | 21 | accept (v) { 22 | v.visitHttpError (this); 23 | } 24 | } 25 | 26 | module.exports = HttpError; 27 | -------------------------------------------------------------------------------- /packages/blueprint/lib/http/headers.js: -------------------------------------------------------------------------------- 1 | 'use strict'; 2 | 3 | var exports = module.exports = {}; 4 | 5 | exports.LAST_MODIFIED = 'Last-Modified'; 6 | exports.IF_MODIFIED_SINCE = 'If-Modified-Since'; 7 | exports.IF_UNMODIFIED_SINCE = 'If-Unmodified-Since'; 8 | exports.ETAG = 'ETag'; 9 | 10 | exports.lowercase = { 11 | LAST_MODIFIED: exports.LAST_MODIFIED.toLowerCase (), 12 | IF_MODIFIED_SINCE: exports.IF_MODIFIED_SINCE.toLowerCase (), 13 | IF_UNMODIFIED_SINCE: exports.IF_UNMODIFIED_SINCE.toLowerCase (), 14 | ETAG: exports.ETAG.toLowerCase () 15 | }; 16 | -------------------------------------------------------------------------------- /packages/blueprint/lib/http/index.js: -------------------------------------------------------------------------------- 1 | 'use strict'; 2 | 3 | exports.headers = require ('./headers'); 4 | -------------------------------------------------------------------------------- /packages/blueprint/lib/messaging/index.js: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2018 One Hill Technologies, LLC 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | exports.Events = require ('./events'); 18 | 19 | exports.Listener = require ('./listener'); 20 | exports.AsyncListener = require ('./async-listener'); 21 | -------------------------------------------------------------------------------- /packages/blueprint/lib/middleware/execute-action.js: -------------------------------------------------------------------------------- 1 | /** 2 | * Factory method for creating a middleware function for the execute 3 | * function that returns a Promise. 4 | * 5 | * @param action Action to execute 6 | * @returns {Function} 7 | */ 8 | module.exports = function (action) { 9 | return function __blueprint_execute_action (req, res, next) { 10 | try { 11 | Promise.resolve (action.execute (req, res)) 12 | .then (() => next ()) 13 | .catch (next); 14 | } 15 | catch (ex) { 16 | next (ex); 17 | } 18 | } 19 | }; 20 | -------------------------------------------------------------------------------- /packages/blueprint/lib/middleware/handle-validation-result.js: -------------------------------------------------------------------------------- 1 | const HttpError = require ('../http-error'); 2 | 3 | const { 4 | validationResult 5 | } = require ('express-validator/check'); 6 | 7 | /** 8 | * Handle the validation results. 9 | * 10 | * @param req 11 | * @param res 12 | * @param next 13 | * @returns {*} 14 | */ 15 | module.exports = function (req, res, next) { 16 | const errors = validationResult (req); 17 | 18 | if (errors.isEmpty ()) 19 | return next (); 20 | 21 | return next (new HttpError (400, 'validation_failed', 'The request validation failed.', {validation: errors.mapped ()})); 22 | }; 23 | -------------------------------------------------------------------------------- /packages/blueprint/lib/middleware/legacy-sanitizer.js: -------------------------------------------------------------------------------- 1 | /** 2 | * Factory method for creating the legacy sanitize middleware function. 3 | * 4 | * @param sanitize Sanitize function 5 | * @returns {Function} 6 | */ 7 | module.exports = function sanitizer (sanitize) { 8 | return function __blueprint_sanitize (req, res, next) { 9 | sanitize (req, next); 10 | } 11 | } 12 | -------------------------------------------------------------------------------- /packages/blueprint/lib/middleware/legacy-validator.js: -------------------------------------------------------------------------------- 1 | /** 2 | * Factory method for creating the validate middleware function. 3 | * 4 | * @param validate Validate function 5 | * @returns {Function} 6 | */ 7 | module.exports = function validator (validate) { 8 | return function __blueprint_validate (req, res, next) { 9 | validate (req, next); 10 | } 11 | }; 12 | -------------------------------------------------------------------------------- /packages/blueprint/lib/policies/index.js: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2018 One Hill Technologies, LLC 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | exports.check = require ('./check'); 18 | exports.all = require ('./all'); 19 | exports.any = require ('./any'); 20 | exports.policyMaker = require ('./policy-maker'); 21 | -------------------------------------------------------------------------------- /packages/blueprint/lib/properties/index.js: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2018 One Hill Technologies, LLC 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | exports.ResourceDescriptor = require ('./resource-descriptor'); 18 | exports.model = require ('./model'); 19 | exports.service = require ('./service'); 20 | -------------------------------------------------------------------------------- /packages/blueprint/lib/server/protocols/index.js: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2018 One Hill Technologies, LLC 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | module.exports = { 18 | http: require ('./http'), 19 | https: require ('./https') 20 | }; 21 | -------------------------------------------------------------------------------- /packages/blueprint/lib/single-file-upload-action.js: -------------------------------------------------------------------------------- 1 | const assert = require ('assert'); 2 | const UploadAction = require ('./upload-action'); 3 | 4 | /** 5 | * @class SingleFileUploadAction 6 | * 7 | * Action for uploading a single file. The file is expected to be part of a 8 | * multipart/form-data request. 9 | */ 10 | module.exports = UploadAction.extend ({ 11 | /// The name of the field that will contain the uploaded file. 12 | name: null, 13 | 14 | init () { 15 | this._super.call (this, ...arguments); 16 | 17 | assert (!!this.name, "You must define the 'name' property."); 18 | 19 | this._middleware = this._upload.single (this.name); 20 | } 21 | }); 22 | -------------------------------------------------------------------------------- /packages/blueprint/lib/single-view-action.js: -------------------------------------------------------------------------------- 1 | const ViewAction = require ('./view-action'); 2 | const assert = require ('assert'); 3 | 4 | /** 5 | * @class SingleViewAction 6 | * 7 | * Specialization of the ViewAction class that only supports a single view. Subclasses, 8 | * and instances of this class, must provide the template property. 9 | */ 10 | module.exports = ViewAction.extend ({ 11 | init () { 12 | this._super.call (this, ...arguments); 13 | 14 | assert (!!this.template, "You must define the 'template' property."); 15 | }, 16 | 17 | /// Name of the view template to render for this action. 18 | template: null, 19 | 20 | view () { 21 | return this.template; 22 | } 23 | }); 24 | -------------------------------------------------------------------------------- /packages/blueprint/lib/text-only-upload-action.js: -------------------------------------------------------------------------------- 1 | const UploadAction = require ('./upload-action'); 2 | 3 | /** 4 | * @class TextOnlyUploadAction 5 | * 6 | * Action for uploading text only. 7 | */ 8 | module.exports = UploadAction.extend ({ 9 | init () { 10 | this._super.call (this, ...arguments); 11 | this._middleware = this._upload.none (); 12 | } 13 | }); 14 | -------------------------------------------------------------------------------- /packages/blueprint/tests/dummy/app/configs/app.js: -------------------------------------------------------------------------------- 1 | module.exports = { 2 | name: 'dummy' 3 | }; 4 | -------------------------------------------------------------------------------- /packages/blueprint/tests/dummy/app/controllers/namespace-user.js: -------------------------------------------------------------------------------- 1 | const UserController = require ('./user'); 2 | 3 | module.exports = UserController.extend ({ 4 | namespace: 'test' 5 | }); 6 | -------------------------------------------------------------------------------- /packages/blueprint/tests/dummy/app/listeners/blueprint.app.init/echo.js: -------------------------------------------------------------------------------- 1 | const Listener = require ('../../../../../lib/messaging/listener'); 2 | 3 | module.exports = Listener.extend ({ 4 | handleEvent (msg) { 5 | console.log (msg); 6 | } 7 | }); 8 | -------------------------------------------------------------------------------- /packages/blueprint/tests/dummy/app/listeners/blueprint.app.init/legacy.js: -------------------------------------------------------------------------------- 1 | module.exports = function (msg) { 2 | console.log (msg); 3 | }; 4 | -------------------------------------------------------------------------------- /packages/blueprint/tests/dummy/app/models/-options.js: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/onehilltech/blueprint/8b8fbc06594c9ef996d728aa918e73e166d3e67e/packages/blueprint/tests/dummy/app/models/-options.js -------------------------------------------------------------------------------- /packages/blueprint/tests/dummy/app/models/person.js: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2018 One Hill Technologies, LLC 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | const { BO } = require ('base-object'); 18 | 19 | module.exports = BO.extend ({ 20 | firstName: null, 21 | 22 | lastName: null 23 | }); 24 | -------------------------------------------------------------------------------- /packages/blueprint/tests/dummy/app/resources/views/helloworld.hbs: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/onehilltech/blueprint/8b8fbc06594c9ef996d728aa918e73e166d3e67e/packages/blueprint/tests/dummy/app/resources/views/helloworld.hbs -------------------------------------------------------------------------------- /packages/blueprint/tests/dummy/app/routers/inner/main.js: -------------------------------------------------------------------------------- 1 | module.exports = { 2 | '/main': { 3 | get: {action: 'main@performGet'}, 4 | post: 'main' 5 | } 6 | }; 7 | -------------------------------------------------------------------------------- /packages/blueprint/tests/dummy/app/routers/main.js: -------------------------------------------------------------------------------- 1 | module.exports = { 2 | '/main': { 3 | get: {action: 'main@performGet'}, 4 | post: 'main' 5 | } 6 | }; 7 | -------------------------------------------------------------------------------- /packages/blueprint/tests/dummy/app/routers/users.js: -------------------------------------------------------------------------------- 1 | module.exports = { 2 | '/users': { 3 | resource: { 4 | controller: 'namespace-user' 5 | } 6 | } 7 | }; 8 | -------------------------------------------------------------------------------- /packages/blueprint/tests/dummy/app/views/dummy.handlebars: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/onehilltech/blueprint/8b8fbc06594c9ef996d728aa918e73e166d3e67e/packages/blueprint/tests/dummy/app/views/dummy.handlebars -------------------------------------------------------------------------------- /packages/blueprint/tests/dummy/node_modules/mod_a/app/controllers/empty.js: -------------------------------------------------------------------------------- 1 | const Controller = require ('../../../../../../lib/controller'); 2 | 3 | module.exports = Controller.extend ({ 4 | name: 'mod_a' 5 | }); 6 | -------------------------------------------------------------------------------- /packages/blueprint/tests/dummy/node_modules/mod_a/app/resources/views/mod_a/helloworld.hbs: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/onehilltech/blueprint/8b8fbc06594c9ef996d728aa918e73e166d3e67e/packages/blueprint/tests/dummy/node_modules/mod_a/app/resources/views/mod_a/helloworld.hbs -------------------------------------------------------------------------------- /packages/blueprint/tests/dummy/node_modules/mod_a/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "mod_a", 3 | "version": "0.0.1", 4 | 5 | "dependencies": { 6 | "mod_b": "file:./node_modules/mod_b" 7 | }, 8 | 9 | "keywords": [ 10 | "blueprint", 11 | "blueprint-module" 12 | ] 13 | } -------------------------------------------------------------------------------- /packages/blueprint/tests/dummy/node_modules/mod_b/app/controllers/empty.js: -------------------------------------------------------------------------------- 1 | const Controller = require ('../../../../../../lib/controller'); 2 | 3 | module.exports = Controller.extend ({ 4 | name: 'mod_b' 5 | }); 6 | -------------------------------------------------------------------------------- /packages/blueprint/tests/dummy/node_modules/mod_b/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "mod_b", 3 | "version": "0.0.1", 4 | 5 | "keywords": [ 6 | "blueprint", 7 | "blueprint-module" 8 | ] 9 | } -------------------------------------------------------------------------------- /packages/blueprint/tests/dummy/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "dummy", 3 | "version": "1.0.0", 4 | 5 | "dependencies": { 6 | "mod_a": "file:./node_modules/mod_a" 7 | }, 8 | 9 | "keywords": [ 10 | "blueprint", 11 | "blueprint-module" 12 | ] 13 | } -------------------------------------------------------------------------------- /packages/blueprint/tests/files/avatar.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/onehilltech/blueprint/8b8fbc06594c9ef996d728aa918e73e166d3e67e/packages/blueprint/tests/files/avatar.png -------------------------------------------------------------------------------- /packages/blueprint/tests/helpers/loader-test/a/b/c.js: -------------------------------------------------------------------------------- 1 | module.exports = 'c'; 2 | -------------------------------------------------------------------------------- /packages/blueprint/tests/helpers/loader-test/a/b/d.js: -------------------------------------------------------------------------------- 1 | module.exports = 'd'; 2 | -------------------------------------------------------------------------------- /packages/blueprint/tests/helpers/loader-test/env/test/a/b/c.js: -------------------------------------------------------------------------------- 1 | module.exports = 'c-override'; 2 | -------------------------------------------------------------------------------- /packages/blueprint/tests/helpers/loader-test/env/test/a1.js: -------------------------------------------------------------------------------- 1 | module.exports = 'a1'; 2 | -------------------------------------------------------------------------------- /packages/blueprint/tests/unit-tests/lib/environment-test.js: -------------------------------------------------------------------------------- 1 | const {env} = require ('../../../lib/environment'); 2 | const expect = require ('chai').expect; 3 | 4 | describe ('lib | Environment', function () { 5 | it ('should create an environment object', function () { 6 | expect (env).to.equal ('test'); 7 | }); 8 | }); -------------------------------------------------------------------------------- /packages/blueprint/tests/unit-tests/lib/loader-test.js: -------------------------------------------------------------------------------- 1 | const {expect} = require ('chai'); 2 | const path = require ('path'); 3 | const Loader = require ('../../../lib/loader'); 4 | 5 | describe ('lib | loader', function () { 6 | it ('should load all the assets', function () { 7 | let dirname = path.resolve ('./tests/helpers/loader-test'); 8 | let loader = new Loader (); 9 | 10 | return loader.load ({dirname}).then (assets => { 11 | expect (assets).to.deep.equal ({ 12 | a: { b: {c: 'c-override', d: 'd' } }, 13 | a1: 'a1' 14 | }); 15 | }); 16 | }); 17 | }); 18 | -------------------------------------------------------------------------------- /packages/blueprint/tests/unit-tests/lib/server/protocol-test.js: -------------------------------------------------------------------------------- 1 | const {expect} = require ('chai'); 2 | const Protocol = require ('../../../../lib/server/protocol'); 3 | 4 | describe ('lib | server | Protocol', function () { 5 | describe ('constructor', function () { 6 | it ('should create the object', function () { 7 | let p = new Protocol (); 8 | 9 | expect (p.server).to.be.null; 10 | expect (p.options).to.be.null; 11 | }); 12 | }) 13 | }); 14 | -------------------------------------------------------------------------------- /packages/blueprint/tests/unit-tests/lib/server/protocols/http-test.js: -------------------------------------------------------------------------------- 1 | const {expect} = require ('chai'); 2 | 3 | const blueprint = require ('../../../../../lib'); 4 | const Http = require ('../../../../../lib/server/protocols/http'); 5 | const http = require ('http'); 6 | 7 | describe ('lib | server | protocols | Http', function () { 8 | describe ('createProtocol', function () { 9 | it ('should create a http protocol with default options', function () { 10 | const { server: { connections: { insecure } } } = blueprint.app; 11 | 12 | expect (insecure).to.be.instanceof (Http); 13 | expect (insecure).to.have.property ('options').to.deep.include ({port: 10000}); 14 | expect (insecure).to.have.property ('server').instanceof (http.Server); 15 | }); 16 | }); 17 | }); 18 | -------------------------------------------------------------------------------- /packages/blueprint/tests/unit-tests/lib/server/protocols/https-test.js: -------------------------------------------------------------------------------- 1 | const {expect} = require ('chai'); 2 | 3 | const blueprint = require ('../../../../../lib'); 4 | const Https = require ('../../../../../lib/server/protocols/https'); 5 | const https = require ('https'); 6 | 7 | describe ('lib | server | protocols | Https', function () { 8 | describe ('createProtocol', function () { 9 | it ('should create a https protocol with default options', function () { 10 | const { server: { connections: { secure } } } = blueprint.app; 11 | 12 | expect (secure).to.be.instanceof (Https); 13 | expect (secure).to.have.property ('options').to.deep.include ({port: 8443}); 14 | expect (secure).to.have.property ('server').instanceof (https.Server); 15 | }); 16 | }); 17 | }); 18 | -------------------------------------------------------------------------------- /packages/blueprint/tests/unit-tests/lib/service-test.js: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2018 One Hill Technologies, LLC 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | describe ('lib | Service', function () { 18 | 19 | }); 20 | -------------------------------------------------------------------------------- /packages/blueprint/tests/unit-tests/lib/upload-action-test.js: -------------------------------------------------------------------------------- 1 | const UploadAction = require ('../../../lib/upload-action'); 2 | const {expect} = require ('chai'); 3 | 4 | describe ('lib | UploadAction', function () { 5 | describe ('constructor', function () { 6 | it ('should create an UploadAction object', function () { 7 | let action = new UploadAction ({uploadPath: './temp'}); 8 | 9 | expect (action).to.have.property ('uploadPath', './temp'); 10 | expect (action).to.have.property ('_upload'); 11 | expect (action.storageType).to.equal ('disk'); 12 | }); 13 | }); 14 | }); 15 | --------------------------------------------------------------------------------