@flecks/db
Advanced tools
Comparing version 3.2.4 to 4.0.0
{ | ||
"name": "@flecks/db", | ||
"version": "3.2.4", | ||
"version": "4.0.0", | ||
"author": "cha0s", | ||
@@ -31,3 +31,3 @@ "license": "MIT", | ||
"dependencies": { | ||
"@flecks/core": "^3.2.1", | ||
"@flecks/core": "^4.0.0", | ||
"sequelize": "^6.3.5", | ||
@@ -37,5 +37,5 @@ "sqlite3": "^5.0.2" | ||
"devDependencies": { | ||
"@flecks/build": "^3.2.4", | ||
"@flecks/fleck": "^3.2.4" | ||
"@flecks/build": "^4.0.0", | ||
"@flecks/fleck": "^4.0.0" | ||
} | ||
} |
@@ -1,2 +0,2 @@ | ||
!function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t(require("@flecks/core"),require("sequelize")):"function"==typeof define&&define.amd?define("@flecks/db",["@flecks/core","sequelize"],t):"object"==typeof exports?exports["@flecks/db"]=t(require("@flecks/core"),require("sequelize")):e["@flecks/db"]=t(e["@flecks/core"],e.sequelize)}(global,((e,t)=>(()=>{"use strict";var r={826:(e,t,r)=>{r.d(t,{Z:()=>o});var a=r(236);class s extends a.Model{static associate(){}static get attributes(){return{}}static get isManagedByFlecks(){return!0}}const o=s},652:t=>{t.exports=e},236:e=>{e.exports=t}},a={};function s(e){var t=a[e];if(void 0!==t)return t.exports;var o=a[e]={exports:{}};return r[e](o,o.exports,s),o.exports}s.n=e=>{var t=e&&e.__esModule?()=>e.default:()=>e;return s.d(t,{a:t}),t},s.d=(e,t)=>{for(var r in t)s.o(t,r)&&!s.o(e,r)&&Object.defineProperty(e,r,{enumerable:!0,get:t[r]})},s.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),s.r=e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})};var o={};return(()=>{s.r(o),s.d(o,{Model:()=>d.Z,Op:()=>t.Op,Sequelize:()=>r(),Transaction:()=>t.Transaction,Types:()=>t.DataTypes,createDatabaseConnection:()=>l,hooks:()=>f,mixin:()=>u});var e=s(652),t=s(236),r=s.n(t);function a(){return a=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var a in r)Object.prototype.hasOwnProperty.call(r,a)&&(e[a]=r[a])}return e},a.apply(this,arguments)}const n=async function(e,t){Object.values(e).filter((e=>e.attributes)).forEach((e=>{e.init(e.attributes,a({sequelize:t,underscored:!0},e.modelOptions||{}))}));var r={};Object.values(e).forEach((t=>{t.associate(e)})),Object.values(e).forEach((e=>{for(var t=Object.entries(e.associations),a=0;a<t.length;a++)if(!t[a][1].isSelfAssociation){if("BelongsToMany"===t[a][1].associationType&&t[a][1].through.model.isManagedByFlecks){var{name:s}=t[a][1].through.model;r[s]||(r[s]=new Set),r[s].add(e.name)}"BelongsTo"===t[a][1].associationType&&(r[e.name]||(r[e.name]=new Set),r[e.name].add(t[a][1].target.name))}}));for(var s=Object.values(e),o=s.length;s.length>0;){for(var n=0;n<s.length;n++){var i=s[n];if(!r[i.name]||0===r[i.name].length){await i.sync(),await i.sync();for(var c=Object.keys(r),l=0;l<c.length;l++){var d=c[l];r[d].has(i.name)&&(r[d].delete(i.name),0===r[d].size&&delete r[d])}s.splice(n,1);break}}if(s.length===o)throw new TypeError("@flecks/db circular dependencies: '".concat(s.join("', '"),"'"));o=s.length}};function i(){return i=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var a in r)Object.prototype.hasOwnProperty.call(r,a)&&(e[a]=r[a])}return e},i.apply(this,arguments)}var c=(0,e.D)("@flecks/db/server/connection");async function l(t){var a,{dialect:s,username:o,password:l,host:d,port:f,database:u}=t.get("@flecks/db");c("config: %O",i(i({},a="sqlite"===s?{dialect:"sqlite",storage:u}:{dialect:s,username:o,password:l,host:d,port:f,database:u}),a.password?{password:"*** REDACTED ***"}:{}));for(var b=new(r())(i({logging:!1},a));;)try{await b.authenticate();break}catch(e){await new Promise((e=>{setTimeout(e,250)}))}var p=t.db.Models[e.ByType];return await n(p,b),c("synchronizing..."),await b.sync(),c("synchronized"),b}var d=s(826),f={"@flecks/core.hmr.gathered":(e,t,r)=>{"@flecks/db.models"===t&&n(e,r.db.sequelize)},"@flecks/server.up":e.Flecks.priority((async e=>{e.db.sequelize=await l(e)}),{after:"@flecks/docker/server"})},u=e=>class extends e{constructor(e){var t;super(e),this.db||(this.db={}),Object.defineProperty(this.db,"Models",{get:()=>this.gathered("@flecks/db.models")});var r=e=>e();Object.defineProperty(this.db,"sequelize",{get:()=>t,set:e=>{t=e,r=e.transaction.bind(e)}}),Object.defineProperty(this.db,"transaction",{get:()=>r})}}})(),o})())); | ||
!function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t(require("@flecks/core"),require("sequelize")):"function"==typeof define&&define.amd?define("@flecks/db",["@flecks/core","sequelize"],t):"object"==typeof exports?exports["@flecks/db"]=t(require("@flecks/core"),require("sequelize")):e["@flecks/db"]=t(e["@flecks/core"],e.sequelize)}(global,((e,t)=>(()=>{var r={592:e=>{e.exports=e=>{const{dialect:t,username:r,password:s,port:a,database:o}=e.get("@flecks/db");let n,i,c={app:{host:"sequelize"}},l={};switch(t){case"mysql":c={...c,sequelize:{MYSQL_USER:r,MYSQL_DATABASE:o,MYSQL_ROOT_PASSWORD:s}},n="mysql",i="/var/lib/mysql",l={[a||3306]:3306};break;case"postgres":c={...c,sequelize:{POSTGRES_USER:r,POSTGRES_DB:o,POSTGRES_PASSWORD:s}},n="postgres",i="/var/lib/postgresql/data",l={[a||5432]:5432}}return n?{sequelize:{environment:c,image:n,mount:i,ports:l}}:{}}},540:t=>{"use strict";t.exports=e},706:e=>{"use strict";e.exports=t}},s={};function a(e){var t=s[e];if(void 0!==t)return t.exports;var o=s[e]={exports:{}};return r[e](o,o.exports,a),o.exports}a.n=e=>{var t=e&&e.__esModule?()=>e.default:()=>e;return a.d(t,{a:t}),t},a.d=(e,t)=>{for(var r in t)a.o(t,r)&&!a.o(e,r)&&Object.defineProperty(e,r,{enumerable:!0,get:t[r]})},a.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),a.r=e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})};var o={};return(()=>{"use strict";a.r(o),a.d(o,{Model:()=>p,Op:()=>s.Op,Sequelize:()=>n(),Transaction:()=>s.Transaction,Types:()=>s.DataTypes,createDatabaseConnection:()=>u,hooks:()=>b,mixin:()=>g});var e=a(540),t=a(592),r=a.n(t),s=a(706),n=a.n(s);function i(){return i=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var s in r)Object.prototype.hasOwnProperty.call(r,s)&&(e[s]=r[s])}return e},i.apply(this,arguments)}const c=async function(e,t){Object.values(e).filter((e=>e.attributes)).forEach((e=>{e.init(e.attributes,i({sequelize:t,underscored:!0},e.modelOptions||{}))}));var r={};Object.values(e).forEach((t=>{t.associate(e)})),Object.values(e).forEach((e=>{for(var t=Object.entries(e.associations),s=0;s<t.length;s++)if(!t[s][1].isSelfAssociation){if("BelongsToMany"===t[s][1].associationType&&t[s][1].through.model.isManagedByFlecks){var{name:a}=t[s][1].through.model;r[a]||(r[a]=new Set),r[a].add(e.name)}"BelongsTo"===t[s][1].associationType&&(r[e.name]||(r[e.name]=new Set),r[e.name].add(t[s][1].target.name))}}));for(var s=Object.values(e),a=s.length;s.length>0;){for(var o=0;o<s.length;o++){var n=s[o];if(!r[n.name]||0===r[n.name].length){await n.sync(),await n.sync();for(var c=Object.keys(r),l=0;l<c.length;l++){var d=c[l];r[d].has(n.name)&&(r[d].delete(n.name),0===r[d].size&&delete r[d])}s.splice(o,1);break}}if(s.length===a)throw new TypeError("@flecks/db circular dependencies: '".concat(s.join("', '"),"'"));a=s.length}};function l(){return l=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var s in r)Object.prototype.hasOwnProperty.call(r,s)&&(e[s]=r[s])}return e},l.apply(this,arguments)}var d=(0,e.D)("@flecks/db/server/connection");async function u(t){var r,{dialect:s,username:a,password:o,host:i,port:u,database:f}=t.get("@flecks/db");d("config: %O",l(l({},r="sqlite"===s?{dialect:"sqlite",storage:f}:{dialect:s,username:a,password:o,host:i,port:u,database:f}),r.password?{password:"*** REDACTED ***"}:{}));for(var p=new(n())(l({logging:!1},r));;)try{await p.authenticate();break}catch(e){await new Promise((e=>{setTimeout(e,250)}))}var b=t.db.Models[e.ByType];return await c(b,p),d("synchronizing..."),await p.sync(),d("synchronized"),p}class f extends s.Model{static associate(){}static get attributes(){return{}}static get isManagedByFlecks(){return!0}}const p=f;var b={"@flecks/core.hmr.gathered":(e,t,r)=>{"@flecks/db.models"===t&&c(e,r.db.sequelize)},"@flecks/docker.containers":r(),"@flecks/server.up":e.Flecks.priority((async e=>{e.db.sequelize=await u(e)}),{after:"@flecks/docker/server"})},g=e=>class extends e{constructor(e){var t;super(e),this.db||(this.db={}),Object.defineProperty(this.db,"Models",{get:()=>this.gathered("@flecks/db.models")});var r=e=>e();Object.defineProperty(this.db,"sequelize",{get:()=>t,set:e=>{t=e,r=e.transaction.bind(e)}}),Object.defineProperty(this.db,"transaction",{get:()=>r})}}})(),o})())); | ||
//# sourceMappingURL=server.js.map |
import {Flecks} from '@flecks/core'; | ||
import containers from '../build/containers'; | ||
import {createDatabaseConnection} from './connection'; | ||
@@ -23,2 +24,3 @@ import register from './register'; | ||
}, | ||
'@flecks/docker.containers': containers, | ||
'@flecks/server.up': Flecks.priority( | ||
@@ -25,0 +27,0 @@ async (flecks) => { |
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
33490
350
15
+ Added@flecks/core@4.2.4(transitive)
+ Addedargparse@2.0.1(transitive)
+ Addedcallsites@3.1.0(transitive)
+ Addedjs-yaml@4.1.0(transitive)
+ Addedminimatch@5.1.6(transitive)
- Removed@flecks/core@3.2.1(transitive)
Updated@flecks/core@^4.0.0