@joystick.js/node-canary 0.0.0-canary.414 → 0.0.0-canary.415
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/app/index.js +1 -1
- package/package.json +1 -1
- package/src/app/index.js +2 -0
package/dist/app/index.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import m from"./api/accounts/authenticated.js";import h from"./api/accounts/login.js";import g from"./api/accounts/logout.js";import f from"./api/accounts/recover_password.js";import d from"./api/accounts/reset_password.js";import l from"./api/accounts/signup.js";import b from"./api/accounts/user.js";import x from"./api/accounts/verify_email.js";import j from"./api/push/health.js";import w from"./api/test/accounts/delete.js";import y from"./api/test/accounts/signup.js";import q from"./api/test/bootstrap.js";import v from"./api/test/process.js";import O from"./api/test/queues.js";import k from"./databases/mongodb/create_indexes.js";import R from"./databases/postgresql/create_indexes.js";import E from"./databases/postgresql/create_tables.js";import N from"./generate_machine_id.js";import
|
|
1
|
+
import m from"./api/accounts/authenticated.js";import h from"./api/accounts/login.js";import g from"./api/accounts/logout.js";import f from"./api/accounts/recover_password.js";import d from"./api/accounts/reset_password.js";import l from"./api/accounts/signup.js";import b from"./api/accounts/user.js";import x from"./api/accounts/verify_email.js";import j from"./api/push/health.js";import w from"./api/test/accounts/delete.js";import y from"./api/test/accounts/signup.js";import q from"./api/test/bootstrap.js";import v from"./api/test/process.js";import O from"./api/test/queues.js";import k from"./databases/mongodb/create_indexes.js";import R from"./databases/postgresql/create_indexes.js";import E from"./databases/postgresql/create_tables.js";import N from"./generate_machine_id.js";import A from"./generate_process_id.js";import _ from"./databases/get_target_database_connection.js";import P from"./handle_process_errors.js";import D from"./settings/load.js";import T from"./queues/index.js";import I from"./register_app_options.js";import J from"./cron_jobs/register.js";import S from"./databases/register_database.js";import U from"./api/register_getters.js";import V from"./routes/register_route_from_function.js";import B from"./routes/register_route_from_object.js";import L from"./api/register_setters.js";import Q from"./uploaders/register.js";import $ from"./websockets/register.js";import z from"./start_express.js";import C from"./start_node_as_cluster.js";import p from"../lib/types.js";const F=D();class G{constructor(t={}){P(t?.events),I(this,t),this.generate_machine_id(),this.generate_process_id(),console.log("APP ENV AT STARTUP",process.env.NODE_ENV),process.title=process.env.NODE_ENV==="test"?"joystick_test_app":"joystick_app",process.joystick={app_options:t}}async connect_databases(){const t=F?.config?.databases;for(let s=0;s<t?.length;s+=1){const e=t[s],r=parseInt(process.env.PORT,10)+10+s,a=t?.filter(n=>e?.provider===n?.provider)?.length>1;await S(e,r,a)}if(t?.length>0){const s=_("queues"),e=_("sessions"),r=_("users");process.databases._queues=s?.connection,process.databases._sessions=e?.connection,process.databases._users=r?.connection;const a=[s,e,r],n=a?.filter(i=>i?.provider==="mongodb")?.map(i=>i?.database_type);await k(n);const c=a?.filter(i=>i?.provider==="postgresql")?.map(i=>i?.database_type);await E(c),await R(c)}}async generate_machine_id(){this.joystick_machine_id=await N()}async generate_process_id(){this.joystick_process_id=await A()}on_after_start_server(t={}){process.on("message",s=>{typeof s=="string"&&JSON.parse(s)?.type==="BUILD_ERROR"&&(process.BUILD_ERROR=JSON.parse(s))}),console.log(`App running at: http://localhost:${t.port}`)}register_accounts(){this.express.app.get("/api/_accounts/authenticated",m),this.express.app.post("/api/_accounts/user",b),this.express.app.post("/api/_accounts/login",h),this.express.app.post("/api/_accounts/logout",g),this.express.app.post("/api/_accounts/recover-password",f),this.express.app.post("/api/_accounts/reset-password",d),this.express.app.post("/api/_accounts/signup",l),this.express.app.post("/api/_accounts/verify-email",x)}register_api(){const t=this?.options?.api?.getters,s=this?.options?.api?.setters,e=this?.options?.api?.options,r=this?.options?.api?.context;t&&p.is_object(t)&&Object.keys(t||{}).length>0&&U(this.express.app,Object.entries(t||{}),r,e),s&&p.is_object(s)&&Object.keys(s||{}).length>0&&L(this.express.app,Object.entries(s||{}),r,e)}register_cron_jobs(){J(this.options.cronJobs||this.options.cron_jobs)}register_fixtures(){p.is_function(this.options.fixtures)&&this.options.fixtures()}register_indexes(){p.is_function(this.options.indexes)&&this.options.indexes()}register_push(){this.express.app.get("/api/_push/health",j)}register_queues(){if(p.is_object(this.options.queues)){const t=Object.entries(this.options.queues||{});for(let s=0;s<t.length;s+=1){const[e,r]=t[s];process.queues={...process.queues||{},[e]:new T(e,r)}}}}register_routes(){const t=Object.entries(this?.options?.routes||{});for(let s=0;s<t?.length;s+=1){const[e,r]=t[s],a=p.is_object(r);p.is_function(r)&&V(this.express.app,e,r),a&&B(this.express.app,e,r)}}register_tests(){this.express.app.get("/api/_test/bootstrap",(t={},s={})=>q(t,s,this)),this.express.app.get("/api/_test/process",v),this.express.app.delete("/api/_test/accounts",w),this.express.app.post("/api/_test/accounts/signup",y),this.express.app.post("/api/_test/queues",(t={},s={})=>O(t,s,this))}register_uploaders(){Q(this.options.uploaders,this)}register_websockets(){$(this.options.websockets,this)}async start(){await this.connect_databases(),this.register_cron_jobs(),this.register_queues(),this.start_express(),this.register_tests(),this.register_accounts(),this.register_api(),this.register_routes(),this.register_websockets(),this.register_uploaders(),this.register_push(),this.register_fixtures(),this.register_indexes()}start_express(){this.express=z(this.on_after_start_server,this)}}const u=async(o={})=>{const t=new G(o);return await t.start(o),t},H=(o={})=>new Promise(async t=>{if(o?.cluster)C(async()=>{const s=await u(o);return t(s.express)});else{const s=await u(o);return t(s.express)}});var Ns=H;export{Ns as default};
|
package/package.json
CHANGED
package/src/app/index.js
CHANGED
|
@@ -45,6 +45,8 @@ class App {
|
|
|
45
45
|
this.generate_machine_id();
|
|
46
46
|
this.generate_process_id();
|
|
47
47
|
|
|
48
|
+
console.log('APP ENV AT STARTUP', process.env.NODE_ENV);
|
|
49
|
+
|
|
48
50
|
process.title = process.env.NODE_ENV === 'test' ? "joystick_test_app" : 'joystick_app';
|
|
49
51
|
|
|
50
52
|
// NOTE: Make app_options passed to node.app() accessible globally. This is used
|