@joystick.js/node-canary 0.0.0-canary.429 → 0.0.0-canary.430

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 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 D from"./generate_process_id.js";import _ from"./databases/get_target_database_connection.js";import I from"./handle_process_errors.js";import J from"./settings/load.js";import A from"./queues/index.js";import B from"./register_app_options.js";import L from"./cron_jobs/register.js";import P from"./databases/register_database.js";import S from"./api/register_getters.js";import U from"./routes/register_route_from_function.js";import Q from"./routes/register_route_from_object.js";import T from"./api/register_setters.js";import V 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";import F from"./push_logs.js";const G=J();F();class H{constructor(t={}){I(t?.events),B(this,t),this.generate_machine_id(),this.generate_process_id(),process.title=process.env.NODE_ENV==="test"?"joystick_test_app":"joystick_app",process.joystick={app_options:t}}async connect_databases(){const t=G?.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 P(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 D()}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&&S(this.express.app,Object.entries(t||{}),r,e),s&&p.is_object(s)&&Object.keys(s||{}).length>0&&T(this.express.app,Object.entries(s||{}),r,e)}register_cron_jobs(){L(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 A(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)&&U(this.express.app,e,r),a&&Q(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(){V(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 H(o);return await t.start(o),t},K=(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 Is=K;export{Is as default};
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 E from"./databases/postgresql/create_indexes.js";import R from"./databases/postgresql/create_tables.js";import D from"./generate_machine_id.js";import N from"./generate_process_id.js";import _ from"./databases/get_target_database_connection.js";import I from"./handle_process_errors.js";import P from"./settings/load.js";import S from"./queues/index.js";import J from"./register_app_options.js";import L from"./cron_jobs/register.js";import U from"./databases/register_database.js";import A from"./api/register_getters.js";import B from"./routes/register_route_from_function.js";import V from"./routes/register_route_from_object.js";import H from"./api/register_setters.js";import Q from"./uploaders/register.js";import T from"./websockets/register.js";import Y from"./start_express.js";import $ from"./start_node_as_cluster.js";import p from"../lib/types.js";import z from"./push_logs.js";const C=P();process.env.NODE_ENV!=="development"&&process.env.IS_PUSH_DEPLOYED&&z();class F{constructor(t={}){I(t?.events),J(this,t),this.generate_machine_id(),this.generate_process_id(),process.title=process.env.NODE_ENV==="test"?"joystick_test_app":"joystick_app",process.joystick={app_options:t}}async connect_databases(){const t=C?.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 U(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 R(c),await E(c)}}async generate_machine_id(){this.joystick_machine_id=await D()}async generate_process_id(){this.joystick_process_id=await N()}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&&A(this.express.app,Object.entries(t||{}),r,e),s&&p.is_object(s)&&Object.keys(s||{}).length>0&&H(this.express.app,Object.entries(s||{}),r,e)}register_cron_jobs(){L(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 S(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)&&B(this.express.app,e,r),a&&V(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(){T(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=Y(this.on_after_start_server,this)}}const u=async(o={})=>{const t=new F(o);return await t.start(o),t},G=(o={})=>new Promise(async t=>{if(o?.cluster)$(async()=>{const s=await u(o);return t(s.express)});else{const s=await u(o);return t(s.express)}});var Is=G;export{Is as default};
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@joystick.js/node-canary",
3
3
  "type": "module",
4
- "version": "0.0.0-canary.429",
4
+ "version": "0.0.0-canary.430",
5
5
  "description": "The Node.js framework for Joystick.",
6
6
  "main": "./dist/index.js",
7
7
  "scripts": {
package/src/app/index.js CHANGED
@@ -37,9 +37,9 @@ import push_logs from "./push_logs.js";
37
37
 
38
38
  const app_settings = load_settings();
39
39
 
40
- // if (process.env.NODE_ENV !== "development" && process.env.IS_PUSH_DEPLOYED) {
40
+ if (process.env.NODE_ENV !== "development" && process.env.IS_PUSH_DEPLOYED) {
41
41
  push_logs();
42
- // }
42
+ }
43
43
 
44
44
  class App {
45
45
  constructor(app_options = {}) {