@ez4/database 0.23.0 → 0.24.0

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/library.cjs CHANGED
@@ -26,8 +26,8 @@ e"),"isDatabaseService"),L=o(e=>(0,b.isModelDeclaration)(e)&&(0,b.hasHeritageTyp
26
26
  e,"Database.Engine"),"isDatabaseEngine"),ue=o(e=>(0,b.isModelDeclaration)(e)&&(0,b.hasHeritageType)(
27
27
  e,"Database.Table"),"isDatabaseTable"),be=o(e=>(0,Y.isTypeCallback)(e)||(0,Y.isTypeFunction)(
28
28
  e),"isStreamHandler"),Te=o(e=>(0,b.hasHeritageType)(e,"Database.Relations"),"isT\
29
- ableRelations"),fe=o(e=>(0,b.hasHeritageType)(e,"Database.Indexes"),"isTableInde\
30
- xes"),ye=o(e=>(0,b.hasHeritageType)(e,"Database.Schema"),"isTableSchema"),xe=o(e=>(0,b.hasHeritageType)(
29
+ ableRelations"),ye=o(e=>(0,b.hasHeritageType)(e,"Database.Indexes"),"isTableInde\
30
+ xes"),fe=o(e=>(0,b.hasHeritageType)(e,"Database.Schema"),"isTableSchema"),xe=o(e=>(0,b.hasHeritageType)(
31
31
  e,"Database.Stream"),"isTableStream");var Ie=o((e,r,t,n)=>{if(!(0,S.isTypeReference)(e))return ge(e,r,n);let a=(0,T.getReferenceType)(
32
32
  e,t);return a?ge(a,r,n):null},"getDatabaseScalability"),nt=o(e=>(0,ee.isAnyNumber)(
33
33
  e.minCapacity)&&(0,ee.isAnyNumber)(e.maxCapacity),"isValidScalability"),ge=o((e,r,t)=>L(
@@ -62,19 +62,19 @@ o(this,"IncorrectIndexesTypeError")}},V=class extends M.TypeError{constructor(t,
62
62
  super(`Invalid index type, ${t} must follow one of the Index options.`,n);this.indexName=
63
63
  t}static{o(this,"InvalidIndexTypeError")}},$=class extends M.TypeError{constructor(t,n){
64
64
  super(`Invalid index reference, ${t} must be valid column.`,n);this.indexName=t}static{
65
- o(this,"InvalidIndexReferenceError")}};var f=require("@ez4/common/library"),h=require("@ez4/reflection");var Oe=o((e,r,t,n)=>{if(!(0,h.isTypeReference)(e))return je(e,r,n);let a=(0,f.getReferenceType)(
65
+ o(this,"InvalidIndexReferenceError")}};var y=require("@ez4/common/library"),h=require("@ez4/reflection");var Oe=o((e,r,t,n)=>{if(!(0,h.isTypeReference)(e))return je(e,r,n);let a=(0,y.getReferenceType)(
66
66
  e,t);return a?je(a,r,n):null},"getTableRelations"),je=o((e,r,t)=>(0,h.isTypeObject)(
67
- e)?Pe(e,(0,f.getObjectMembers)(e),t):(0,f.isModelDeclaration)(e)?Te(e)?Pe(e,(0,f.getModelMembers)(
67
+ e)?Pe(e,(0,y.getObjectMembers)(e),t):(0,y.isModelDeclaration)(e)?Te(e)?Pe(e,(0,y.getModelMembers)(
68
68
  e),t):(t.push(new A(e.name,e.file)),null):(t.push(new R(r.file)),null),"getTypeR\
69
69
  elations"),Pe=o((e,r,t)=>{let n=[];for(let a of r){if(!(0,h.isModelProperty)(a)||
70
- a.inherited)continue;let s=(0,f.getPropertyString)(a),i=a.name;if(!s)return t.push(
70
+ a.inherited)continue;let s=(0,y.getPropertyString)(a),i=a.name;if(!s)return t.push(
71
71
  new w(i,e.file)),null;let[p,l]=i.split("@",2),[m,O]=s.split(":",2);n.push({sourceTable:m,
72
- sourceColumn:O,targetColumn:p,targetAlias:l})}return n},"getTypeFromMembers");var y=require("@ez4/common/library"),v=require("@ez4/reflection");var Ae=o((e,r,t,n)=>{if(!(0,v.isTypeReference)(e))return ke(e,r,n);let a=(0,y.getReferenceType)(
72
+ sourceColumn:O,targetColumn:p,targetAlias:l})}return n},"getTypeFromMembers");var f=require("@ez4/common/library"),v=require("@ez4/reflection");var Ae=o((e,r,t,n)=>{if(!(0,v.isTypeReference)(e))return ke(e,r,n);let a=(0,f.getReferenceType)(
73
73
  e,t);return a?ke(a,r,n):null},"getTableIndexes"),ke=o((e,r,t)=>(0,v.isTypeObject)(
74
- e)?Re(e,(0,y.getObjectMembers)(e),t):(0,y.isModelDeclaration)(e)?fe(e)?Re(e,(0,y.getModelMembers)(
74
+ e)?Re(e,(0,f.getObjectMembers)(e),t):(0,f.isModelDeclaration)(e)?ye(e)?Re(e,(0,f.getModelMembers)(
75
75
  e),t):(t.push(new q(e.name,e.file)),null):(t.push(new F(r.file)),null),"getTypeI\
76
76
  ndexes"),Re=o((e,r,t)=>{let n=[];for(let a of r){if(!(0,v.isModelProperty)(a)||a.
77
- inherited)continue;let s=a.name,i=(0,y.getPropertyString)(a);switch(i){case"prim\
77
+ inherited)continue;let s=a.name,i=(0,f.getPropertyString)(a);switch(i){case"prim\
78
78
  ary":case"secondary":case"unique":case"ttl":n.push({name:s,columns:s.split(":"),
79
79
  type:i});break;default:return t.push(new V(s,e.file)),null}}return n},"getTypeFr\
80
80
  omMembers");var re=require("@ez4/common/library"),ne=require("@ez4/schema/library"),ae=require("@ez4/reflection");var te=require("@ez4/common/library");var G=class extends te.InvalidTypeError{static{o(this,"InvalidSchemaTypeError")}constructor(r){
@@ -82,7 +82,7 @@ super("Invalid table schema type",void 0,"Database.Schema",r)}},Q=class extends
82
82
  super("Incorrect table schema type",t,"Database.Schema",n);this.schemaType=t}static{
83
83
  o(this,"IncorrectSchemaTypeError")}};var ie=o((e,r,t,n)=>{if(!(0,ae.isTypeReference)(e))return we(e,r,t,n);let a=(0,re.getReferenceType)(
84
84
  e,t);return a?we(a,r,t,n):null},"getTableSchema"),we=o((e,r,t,n)=>(0,ae.isTypeObject)(
85
- e)?Ce(e,t):(0,re.isModelDeclaration)(e)?ye(e)?Ce(e,t):(n.push(new Q(e.name,e.file)),
85
+ e)?Ce(e,t):(0,re.isModelDeclaration)(e)?fe(e)?Ce(e,t):(n.push(new Q(e.name,e.file)),
86
86
  null):(n.push(new G(r.file)),null),"getTypeSchema"),Ce=o((e,r)=>{let t=(0,ne.getObjectSchema)(
87
87
  e,r);return t&&(0,ne.isObjectSchema)(t)?t:null},"getSchema");var d=require("@ez4/common/library"),j=require("@ez4/reflection");var E=require("@ez4/common/library");var B=class extends E.IncompleteTypeError{static{o(this,"IncompleteStreamError")}constructor(r,t){
88
88
  super("Incomplete table stream",r,t)}},_=class extends E.InvalidTypeError{static{
@@ -90,11 +90,11 @@ o(this,"InvalidStreamTypeError")}constructor(r){super("Invalid table stream type
90
90
  void 0,"Database.Stream",r)}},J=class extends E.IncorrectTypeError{constructor(t,n){
91
91
  super("Incorrect table stream type",t,"Database.Stream",n);this.streamType=t}static{
92
92
  o(this,"IncorrectStreamTypeError")}};var ze=require("@ez4/common/library");var K=class extends ze.IncompleteTypeError{static{o(this,"IncompleteHandlerError")}constructor(r,t){
93
- super("Incomplete stream handler",r,t)}};var Ue=o((e,r,t)=>{if(!be(e))return null;let n={},a=new Set(["name","file","chan\
94
- ge"]);return e.description&&(n.description=e.description),(n.name=e.name)&&a.delete(
95
- "name"),(n.file=e.file)&&a.delete("file"),e.parameters&&a.delete("change"),a.size===
96
- 0&&ot(n)?n:(t.push(new K([...a],e.file)),null)},"getStreamHandler"),ot=o(e=>!!e.
97
- name&&!!e.file,"isValidHandler");var Fe=o((e,r,t,n)=>{if(!(0,j.isTypeReference)(e))return Ne(e,r,t,n);let a=(0,d.getReferenceType)(
93
+ super("Incomplete stream handler",r,t)}};var Ue=o((e,r,t)=>{if(!be(e))return null;let{description:n,module:a}=e,s={...n&&
94
+ {description:n},...a&&{module:a}},i=new Set(["name","file","change"]);return(s.name=
95
+ e.name)&&i.delete("name"),(s.file=e.file)&&i.delete("file"),e.parameters&&i.delete(
96
+ "change"),i.size===0&&ot(s)?s:(t.push(new K([...i],e.file)),null)},"getStreamHan\
97
+ dler"),ot=o(e=>!!e.name&&!!e.file,"isValidHandler");var Fe=o((e,r,t,n)=>{if(!(0,j.isTypeReference)(e))return Ne(e,r,t,n);let a=(0,d.getReferenceType)(
98
98
  e,t);return a?Ne(a,r,t,n):null},"getTableStream"),st=o(e=>!!e.handler,"isValidSt\
99
99
  ream"),Ne=o((e,r,t,n)=>(0,j.isTypeObject)(e)?He(e,r,(0,d.getObjectMembers)(e),t,
100
100
  n):(0,d.isModelDeclaration)(e)?xe(e)?He(e,r,(0,d.getModelMembers)(e),t,n):(n.push(
package/dist/library.mjs CHANGED
@@ -1,118 +1,118 @@
1
- var De=Object.defineProperty;var a=(e,r)=>De(e,"name",{value:r,configurable:!0});import{registerTriggers as pr}from"@ez4/common/library";import{registerTriggers as lr}from"@ez4/schema/library";
1
+ var De=Object.defineProperty;var n=(e,r)=>De(e,"name",{value:r,configurable:!0});import{registerTriggers as pr}from"@ez4/common/library";import{registerTriggers as lr}from"@ez4/schema/library";
2
2
  import{createTrigger as mr}from"@ez4/project/library";import{DuplicateServiceError as Xt,InvalidServicePropertyError as Yt,isExternalDeclaration as Zt,
3
3
  getLinkedServiceList as Lt,getLinkedVariableList as er,getPropertyTuple as tr,getModelMembers as rr}from"@ez4/common/library";
4
- import{isModelProperty as nr}from"@ez4/reflection";var F="@ez4/database",dr=a(e=>e.type===F,"isDatabaseService");import{IncompleteTypeError as he}from"@ez4/common/library";var T=class extends he{static{a(this,"IncompleteServiceError")}constructor(r,t){
5
- super("Incomplete database service",r,t)}};import{IncorrectTypeError as ve,InvalidTypeError as Ee,TypeError as I}from"@ez4/common/library";var f=class extends Ee{static{a(this,"InvalidRelationsTypeError")}constructor(r){
6
- super("Invalid table relations type",void 0,"Database.Relations",r)}},y=class extends ve{constructor(t,n){
7
- super("Incorrect table relations type",t,"Database.Relations",n);this.schemaType=
8
- t}static{a(this,"IncorrectRelationsTypeError")}},x=class extends I{constructor(t,n){
9
- super(`Target ${t} must follow the pattern 'column@alias'.`,n);this.relationSource=
10
- t}static{a(this,"InvalidRelationTargetError")}},g=class extends I{constructor(t,n){
11
- super(`Relation table ${t} don't exists.`,n);this.relationTable=t}static{a(this,
12
- "InvalidRelationTableError")}},u=class extends I{constructor(t,n){super(`Relatio\
13
- n column ${t} don't exists.`,n);this.relationColumn=t}static{a(this,"InvalidRela\
14
- tionColumnError")}},M=class extends I{constructor(t,n){super(`Relation alias ${t}\
15
- can't override table columns.`,n);this.relationAlias=t}static{a(this,"InvalidRe\
4
+ import{isModelProperty as nr}from"@ez4/reflection";var F="@ez4/database",dr=n(e=>e.type===F,"isDatabaseService");import{IncompleteTypeError as he}from"@ez4/common/library";var T=class extends he{static{n(this,"IncompleteServiceError")}constructor(r,t){
5
+ super("Incomplete database service",r,t)}};import{IncorrectTypeError as ve,InvalidTypeError as Ee,TypeError as I}from"@ez4/common/library";var y=class extends Ee{static{n(this,"InvalidRelationsTypeError")}constructor(r){
6
+ super("Invalid table relations type",void 0,"Database.Relations",r)}},f=class extends ve{constructor(t,a){
7
+ super("Incorrect table relations type",t,"Database.Relations",a);this.schemaType=
8
+ t}static{n(this,"IncorrectRelationsTypeError")}},x=class extends I{constructor(t,a){
9
+ super(`Target ${t} must follow the pattern 'column@alias'.`,a);this.relationSource=
10
+ t}static{n(this,"InvalidRelationTargetError")}},g=class extends I{constructor(t,a){
11
+ super(`Relation table ${t} don't exists.`,a);this.relationTable=t}static{n(this,
12
+ "InvalidRelationTableError")}},u=class extends I{constructor(t,a){super(`Relatio\
13
+ n column ${t} don't exists.`,a);this.relationColumn=t}static{n(this,"InvalidRela\
14
+ tionColumnError")}},M=class extends I{constructor(t,a){super(`Relation alias ${t}\
15
+ can't override table columns.`,a);this.relationAlias=t}static{n(this,"InvalidRe\
16
16
  lationAliasError")}};import{InvalidServicePropertyError as Re,getModelMembers as Ae,getPropertyNumber as we,
17
17
  getObjectMembers as Ce,getReferenceType as ze}from"@ez4/common/library";import{isModelProperty as Ue,
18
- isTypeObject as Ne,isTypeReference as He}from"@ez4/reflection";import{isAnyNumber as q}from"@ez4/utils";import{IncompleteTypeError as je}from"@ez4/common/library";var S=class extends je{static{a(this,"IncompleteScalabilityError")}constructor(r,t){
18
+ isTypeObject as Ne,isTypeReference as He}from"@ez4/reflection";import{isAnyNumber as q}from"@ez4/utils";import{IncompleteTypeError as je}from"@ez4/common/library";var S=class extends je{static{n(this,"IncompleteScalabilityError")}constructor(r,t){
19
19
  super("Incomplete database scalability",r,t)}};import{hasHeritageType as c,isClassDeclaration as Pe,isModelDeclaration as $}from"@ez4/common/library";
20
- import{isTypeCallback as Oe,isTypeFunction as ke}from"@ez4/reflection";var D=a(e=>Pe(e)&&c(e,"Database.Service"),"isDatabaseService"),h=a(e=>$(e)&&c(e,
21
- "Database.Engine"),"isDatabaseEngine"),G=a(e=>$(e)&&c(e,"Database.Table"),"isDat\
22
- abaseTable"),Q=a(e=>Oe(e)||ke(e),"isStreamHandler"),B=a(e=>c(e,"Database.Relatio\
23
- ns"),"isTableRelations"),_=a(e=>c(e,"Database.Indexes"),"isTableIndexes"),J=a(e=>c(
24
- e,"Database.Schema"),"isTableSchema"),K=a(e=>c(e,"Database.Stream"),"isTableStre\
25
- am");var Y=a((e,r,t,n)=>{if(!He(e))return W(e,r,n);let o=ze(e,t);return o?W(o,r,n):null},
26
- "getDatabaseScalability"),Fe=a(e=>q(e.minCapacity)&&q(e.maxCapacity),"isValidSca\
27
- lability"),W=a((e,r,t)=>h(e)?X(e,r,Ae(e),t):Ne(e)?X(e,r,Ce(e),t):null,"getTypeSc\
28
- alability"),X=a((e,r,t,n)=>{let o={},s=new Set(["minCapacity","maxCapacity"]);for(let i of t)
29
- if(!(!Ue(i)||i.inherited))switch(i.name){default:n.push(new Re(r.name,i.name,e.file));
20
+ import{isTypeCallback as Oe,isTypeFunction as ke}from"@ez4/reflection";var D=n(e=>Pe(e)&&c(e,"Database.Service"),"isDatabaseService"),h=n(e=>$(e)&&c(e,
21
+ "Database.Engine"),"isDatabaseEngine"),G=n(e=>$(e)&&c(e,"Database.Table"),"isDat\
22
+ abaseTable"),Q=n(e=>Oe(e)||ke(e),"isStreamHandler"),B=n(e=>c(e,"Database.Relatio\
23
+ ns"),"isTableRelations"),_=n(e=>c(e,"Database.Indexes"),"isTableIndexes"),J=n(e=>c(
24
+ e,"Database.Schema"),"isTableSchema"),K=n(e=>c(e,"Database.Stream"),"isTableStre\
25
+ am");var Y=n((e,r,t,a)=>{if(!He(e))return W(e,r,a);let o=ze(e,t);return o?W(o,r,a):null},
26
+ "getDatabaseScalability"),Fe=n(e=>q(e.minCapacity)&&q(e.maxCapacity),"isValidSca\
27
+ lability"),W=n((e,r,t)=>h(e)?X(e,r,Ae(e),t):Ne(e)?X(e,r,Ce(e),t):null,"getTypeSc\
28
+ alability"),X=n((e,r,t,a)=>{let o={},s=new Set(["minCapacity","maxCapacity"]);for(let i of t)
29
+ if(!(!Ue(i)||i.inherited))switch(i.name){default:a.push(new Re(r.name,i.name,e.file));
30
30
  break;case"minCapacity":case"maxCapacity":let p=we(i);q(p)&&(o[i.name]=p,s.delete(
31
- i.name));break}return Fe(o)?o:(n.push(new S([...s],e.file)),null)},"getTypeFromM\
31
+ i.name));break}return Fe(o)?o:(a.push(new S([...s],e.file)),null)},"getTypeFromM\
32
32
  embers");import{isModelProperty as Ve,isTypeObject as $e,isTypeReference as Ge}from"@ez4/reflection";
33
33
  import{InvalidServicePropertyError as Qe,getModelMembers as Be,getObjectMembers as _e,
34
- getPropertyString as Je,getPropertyStringIn as b,getReferenceType as Ke}from"@ez4/common/library";import{IncompleteTypeError as qe}from"@ez4/common/library";var v=class extends qe{static{a(this,"IncompleteEngineError")}constructor(r,t){super(
35
- "Incomplete database engine",r,t)}};var ee=a((e,r,t,n)=>{if(!Ge(e))return Z(e,r,n);let o=Ke(e,t);return o?Z(o,r,n):null},
36
- "getDatabaseEngine"),We=a(e=>!!e.name&&!!e.parametersMode&&!!e.transactionMode&&
37
- !!e.insensitiveMode&&!!e.paginationMode&&!!e.orderMode,"isValidEngine"),Z=a((e,r,t)=>h(
38
- e)?L(e,r,Be(e),t):$e(e)?L(e,r,_e(e),t):null,"getTypeEngine"),L=a((e,r,t,n)=>{let o={},
34
+ getPropertyString as Je,getPropertyStringIn as b,getReferenceType as Ke}from"@ez4/common/library";import{IncompleteTypeError as qe}from"@ez4/common/library";var v=class extends qe{static{n(this,"IncompleteEngineError")}constructor(r,t){super(
35
+ "Incomplete database engine",r,t)}};var ee=n((e,r,t,a)=>{if(!Ge(e))return Z(e,r,a);let o=Ke(e,t);return o?Z(o,r,a):null},
36
+ "getDatabaseEngine"),We=n(e=>!!e.name&&!!e.parametersMode&&!!e.transactionMode&&
37
+ !!e.insensitiveMode&&!!e.paginationMode&&!!e.orderMode,"isValidEngine"),Z=n((e,r,t)=>h(
38
+ e)?L(e,r,Be(e),t):$e(e)?L(e,r,_e(e),t):null,"getTypeEngine"),L=n((e,r,t,a)=>{let o={},
39
39
  s=new Set(["name","parametersMode","transactionMode","insensitiveMode","paginati\
40
40
  onMode","orderMode"]);for(let i of t)if(!(!Ve(i)||i.inherited))switch(i.name){default:
41
- n.push(new Qe(r.name,i.name,e.file));break;case"name":(o.name=Je(i))&&s.delete(i.
41
+ a.push(new Qe(r.name,i.name,e.file));break;case"name":(o.name=Je(i))&&s.delete(i.
42
42
  name);break;case"parametersMode":(o.parametersMode=b(i,["index","both"]))&&s.delete(
43
43
  i.name);break;case"transactionMode":(o.transactionMode=b(i,["static","interactiv\
44
44
  e"]))&&s.delete(i.name);break;case"insensitiveMode":(o.insensitiveMode=b(i,["uns\
45
45
  upported","enabled"]))&&s.delete(i.name);break;case"paginationMode":(o.paginationMode=
46
46
  b(i,["cursor","offset"]))&&s.delete(i.name);break;case"orderMode":(o.orderMode=b(
47
- i,["any","index"]))&&s.delete(i.name);break}return We(o)?o:(n.push(new v([...s],
47
+ i,["any","index"]))&&s.delete(i.name);break}return We(o)?o:(a.push(new v([...s],
48
48
  e.file)),null)},"getTypeFromMembers");import{InvalidServicePropertyError as qt,getModelMembers as Vt,getObjectMembers as $t,
49
49
  getPropertyString as Gt,getReferenceType as Qt}from"@ez4/common/library";import{
50
- isModelProperty as Bt,isTypeObject as _t,isTypeReference as Jt}from"@ez4/reflection";import{IncompleteTypeError as Xe}from"@ez4/common/library";var E=class extends Xe{static{a(this,"IncompleteTableError")}constructor(r,t){super(
51
- "Incomplete database table",r,t)}};import{IncorrectTypeError as Ye,InvalidTypeError as Ze,TypeError as te}from"@ez4/common/library";var j=class extends Ze{static{a(this,"InvalidIndexesTypeError")}constructor(r){super(
52
- "Invalid table indexes type",void 0,"Database.Indexes",r)}},P=class extends Ye{constructor(t,n){
53
- super("Incorrect table indexes type",t,"Database.Indexes",n);this.schemaType=t}static{
54
- a(this,"IncorrectIndexesTypeError")}},O=class extends te{constructor(t,n){super(
55
- `Invalid index type, ${t} must follow one of the Index options.`,n);this.indexName=
56
- t}static{a(this,"InvalidIndexTypeError")}},k=class extends te{constructor(t,n){super(
57
- `Invalid index reference, ${t} must be valid column.`,n);this.indexName=t}static{
58
- a(this,"InvalidIndexReferenceError")}};import{isModelDeclaration as Le,getModelMembers as et,getObjectMembers as tt,getPropertyString as rt,
50
+ isModelProperty as Bt,isTypeObject as _t,isTypeReference as Jt}from"@ez4/reflection";import{IncompleteTypeError as Xe}from"@ez4/common/library";var E=class extends Xe{static{n(this,"IncompleteTableError")}constructor(r,t){super(
51
+ "Incomplete database table",r,t)}};import{IncorrectTypeError as Ye,InvalidTypeError as Ze,TypeError as te}from"@ez4/common/library";var j=class extends Ze{static{n(this,"InvalidIndexesTypeError")}constructor(r){super(
52
+ "Invalid table indexes type",void 0,"Database.Indexes",r)}},P=class extends Ye{constructor(t,a){
53
+ super("Incorrect table indexes type",t,"Database.Indexes",a);this.schemaType=t}static{
54
+ n(this,"IncorrectIndexesTypeError")}},O=class extends te{constructor(t,a){super(
55
+ `Invalid index type, ${t} must follow one of the Index options.`,a);this.indexName=
56
+ t}static{n(this,"InvalidIndexTypeError")}},k=class extends te{constructor(t,a){super(
57
+ `Invalid index reference, ${t} must be valid column.`,a);this.indexName=t}static{
58
+ n(this,"InvalidIndexReferenceError")}};import{isModelDeclaration as Le,getModelMembers as et,getObjectMembers as tt,getPropertyString as rt,
59
59
  getReferenceType as nt}from"@ez4/common/library";import{isModelProperty as at,isTypeObject as ot,
60
- isTypeReference as st}from"@ez4/reflection";var ae=a((e,r,t,n)=>{if(!st(e))return re(e,r,n);let o=nt(e,t);return o?re(o,r,n):
61
- null},"getTableRelations"),re=a((e,r,t)=>ot(e)?ne(e,tt(e),t):Le(e)?B(e)?ne(e,et(
62
- e),t):(t.push(new y(e.name,e.file)),null):(t.push(new f(r.file)),null),"getTypeR\
63
- elations"),ne=a((e,r,t)=>{let n=[];for(let o of r){if(!at(o)||o.inherited)continue;
60
+ isTypeReference as st}from"@ez4/reflection";var ae=n((e,r,t,a)=>{if(!st(e))return re(e,r,a);let o=nt(e,t);return o?re(o,r,a):
61
+ null},"getTableRelations"),re=n((e,r,t)=>ot(e)?ne(e,tt(e),t):Le(e)?B(e)?ne(e,et(
62
+ e),t):(t.push(new f(e.name,e.file)),null):(t.push(new y(r.file)),null),"getTypeR\
63
+ elations"),ne=n((e,r,t)=>{let a=[];for(let o of r){if(!at(o)||o.inherited)continue;
64
64
  let s=rt(o),i=o.name;if(!s)return t.push(new x(i,e.file)),null;let[p,l]=i.split(
65
- "@",2),[m,d]=s.split(":",2);n.push({sourceTable:m,sourceColumn:d,targetColumn:p,
66
- targetAlias:l})}return n},"getTypeFromMembers");import{isModelDeclaration as it,getModelMembers as pt,getObjectMembers as lt,getPropertyString as mt,
65
+ "@",2),[m,d]=s.split(":",2);a.push({sourceTable:m,sourceColumn:d,targetColumn:p,
66
+ targetAlias:l})}return a},"getTypeFromMembers");import{isModelDeclaration as it,getModelMembers as pt,getObjectMembers as lt,getPropertyString as mt,
67
67
  getReferenceType as ct}from"@ez4/common/library";import{isModelProperty as dt,isTypeObject as ut,
68
- isTypeReference as bt}from"@ez4/reflection";var ie=a((e,r,t,n)=>{if(!bt(e))return oe(e,r,n);let o=ct(e,t);return o?oe(o,r,n):
69
- null},"getTableIndexes"),oe=a((e,r,t)=>ut(e)?se(e,lt(e),t):it(e)?_(e)?se(e,pt(e),
68
+ isTypeReference as bt}from"@ez4/reflection";var ie=n((e,r,t,a)=>{if(!bt(e))return oe(e,r,a);let o=ct(e,t);return o?oe(o,r,a):
69
+ null},"getTableIndexes"),oe=n((e,r,t)=>ut(e)?se(e,lt(e),t):it(e)?_(e)?se(e,pt(e),
70
70
  t):(t.push(new P(e.name,e.file)),null):(t.push(new j(r.file)),null),"getTypeInde\
71
- xes"),se=a((e,r,t)=>{let n=[];for(let o of r){if(!dt(o)||o.inherited)continue;let s=o.
72
- name,i=mt(o);switch(i){case"primary":case"secondary":case"unique":case"ttl":n.push(
71
+ xes"),se=n((e,r,t)=>{let a=[];for(let o of r){if(!dt(o)||o.inherited)continue;let s=o.
72
+ name,i=mt(o);switch(i){case"primary":case"secondary":case"unique":case"ttl":a.push(
73
73
  {name:s,columns:s.split(":"),type:i});break;default:return t.push(new O(s,e.file)),
74
- null}}return n},"getTypeFromMembers");import{getReferenceType as yt,isModelDeclaration as xt}from"@ez4/common/library";
74
+ null}}return a},"getTypeFromMembers");import{getReferenceType as ft,isModelDeclaration as xt}from"@ez4/common/library";
75
75
  import{getObjectSchema as gt,isObjectSchema as Mt}from"@ez4/schema/library";import{
76
- isTypeObject as It,isTypeReference as St}from"@ez4/reflection";import{IncorrectTypeError as Tt,InvalidTypeError as ft}from"@ez4/common/library";var R=class extends ft{static{a(this,"InvalidSchemaTypeError")}constructor(r){super(
77
- "Invalid table schema type",void 0,"Database.Schema",r)}},A=class extends Tt{constructor(t,n){
78
- super("Incorrect table schema type",t,"Database.Schema",n);this.schemaType=t}static{
79
- a(this,"IncorrectSchemaTypeError")}};var me=a((e,r,t,n)=>{if(!St(e))return pe(e,r,t,n);let o=yt(e,t);return o?pe(o,r,
80
- t,n):null},"getTableSchema"),pe=a((e,r,t,n)=>It(e)?le(e,t):xt(e)?J(e)?le(e,t):(n.
81
- push(new A(e.name,e.file)),null):(n.push(new R(r.file)),null),"getTypeSchema"),le=a(
76
+ isTypeObject as It,isTypeReference as St}from"@ez4/reflection";import{IncorrectTypeError as Tt,InvalidTypeError as yt}from"@ez4/common/library";var R=class extends yt{static{n(this,"InvalidSchemaTypeError")}constructor(r){super(
77
+ "Invalid table schema type",void 0,"Database.Schema",r)}},A=class extends Tt{constructor(t,a){
78
+ super("Incorrect table schema type",t,"Database.Schema",a);this.schemaType=t}static{
79
+ n(this,"IncorrectSchemaTypeError")}};var me=n((e,r,t,a)=>{if(!St(e))return pe(e,r,t,a);let o=ft(e,t);return o?pe(o,r,
80
+ t,a):null},"getTableSchema"),pe=n((e,r,t,a)=>It(e)?le(e,t):xt(e)?J(e)?le(e,t):(a.
81
+ push(new A(e.name,e.file)),null):(a.push(new R(r.file)),null),"getTypeSchema"),le=n(
82
82
  (e,r)=>{let t=gt(e,r);return t&&Mt(t)?t:null},"getSchema");import{InvalidServicePropertyError as Pt,isModelDeclaration as Ot,getLinkedVariableList as kt,
83
83
  getModelMembers as Rt,getObjectMembers as At,getPropertyNumber as wt,getServiceListener as Ct,
84
84
  getReferenceType as zt}from"@ez4/common/library";import{isModelProperty as Ut,isTypeObject as Nt,
85
- isTypeReference as Ht}from"@ez4/reflection";import{IncompleteTypeError as Dt,IncorrectTypeError as ht,InvalidTypeError as vt}from"@ez4/common/library";var w=class extends Dt{static{a(this,"IncompleteStreamError")}constructor(r,t){super(
86
- "Incomplete table stream",r,t)}},C=class extends vt{static{a(this,"InvalidStream\
85
+ isTypeReference as Ht}from"@ez4/reflection";import{IncompleteTypeError as Dt,IncorrectTypeError as ht,InvalidTypeError as vt}from"@ez4/common/library";var w=class extends Dt{static{n(this,"IncompleteStreamError")}constructor(r,t){super(
86
+ "Incomplete table stream",r,t)}},C=class extends vt{static{n(this,"InvalidStream\
87
87
  TypeError")}constructor(r){super("Invalid table stream type",void 0,"Database.St\
88
- ream",r)}},z=class extends ht{constructor(t,n){super("Incorrect table stream typ\
89
- e",t,"Database.Stream",n);this.streamType=t}static{a(this,"IncorrectStreamTypeEr\
90
- ror")}};import{IncompleteTypeError as Et}from"@ez4/common/library";var U=class extends Et{static{a(this,"IncompleteHandlerError")}constructor(r,t){
91
- super("Incomplete stream handler",r,t)}};var ce=a((e,r,t)=>{if(!Q(e))return null;let n={},o=new Set(["name","file","chang\
92
- e"]);return e.description&&(n.description=e.description),(n.name=e.name)&&o.delete(
93
- "name"),(n.file=e.file)&&o.delete("file"),e.parameters&&o.delete("change"),o.size===
94
- 0&&jt(n)?n:(t.push(new U([...o],e.file)),null)},"getStreamHandler"),jt=a(e=>!!e.
95
- name&&!!e.file,"isValidHandler");var be=a((e,r,t,n)=>{if(!Ht(e))return de(e,r,t,n);let o=zt(e,t);return o?de(o,r,
96
- t,n):null},"getTableStream"),Ft=a(e=>!!e.handler,"isValidStream"),de=a((e,r,t,n)=>Nt(
97
- e)?ue(e,r,At(e),t,n):Ot(e)?K(e)?ue(e,r,Rt(e),t,n):(n.push(new z(e.name,e.file)),
98
- null):(n.push(new C(r.file)),null),"getTypeStream"),ue=a((e,r,t,n,o)=>{let s={},
88
+ ream",r)}},z=class extends ht{constructor(t,a){super("Incorrect table stream typ\
89
+ e",t,"Database.Stream",a);this.streamType=t}static{n(this,"IncorrectStreamTypeEr\
90
+ ror")}};import{IncompleteTypeError as Et}from"@ez4/common/library";var U=class extends Et{static{n(this,"IncompleteHandlerError")}constructor(r,t){
91
+ super("Incomplete stream handler",r,t)}};var ce=n((e,r,t)=>{if(!Q(e))return null;let{description:a,module:o}=e,s={...a&&{
92
+ description:a},...o&&{module:o}},i=new Set(["name","file","change"]);return(s.name=
93
+ e.name)&&i.delete("name"),(s.file=e.file)&&i.delete("file"),e.parameters&&i.delete(
94
+ "change"),i.size===0&&jt(s)?s:(t.push(new U([...i],e.file)),null)},"getStreamHan\
95
+ dler"),jt=n(e=>!!e.name&&!!e.file,"isValidHandler");var be=n((e,r,t,a)=>{if(!Ht(e))return de(e,r,t,a);let o=zt(e,t);return o?de(o,r,
96
+ t,a):null},"getTableStream"),Ft=n(e=>!!e.handler,"isValidStream"),de=n((e,r,t,a)=>Nt(
97
+ e)?ue(e,r,At(e),t,a):Ot(e)?K(e)?ue(e,r,Rt(e),t,a):(a.push(new z(e.name,e.file)),
98
+ null):(a.push(new C(r.file)),null),"getTypeStream"),ue=n((e,r,t,a,o)=>{let s={},
99
99
  i=new Set(["handler"]);for(let p of t)if(!(!Ut(p)||p.inherited))switch(p.name){default:
100
- o.push(new Pt(r.name,p.name,e.file));break;case"handler":s.handler=ce(p.value,n,
100
+ o.push(new Pt(r.name,p.name,e.file));break;case"handler":s.handler=ce(p.value,a,
101
101
  o);break;case"listener":s.listener=Ct(p.value,o);break;case"memory":case"logRete\
102
102
  ntion":case"timeout":s[p.name]=wt(p);break;case"variables":s.variables=kt(p,o);break}
103
- return Ft(s)?s:(o.push(new w([...i],e.file)),null)},"getTypeFromMembers");var ye=a((e,r,t,n)=>{if(!Jt(e))return Te(e,r,t,n);let o=Qt(e,t);return o?Te(o,r,
104
- t,n):null},"getDatabaseTable"),Kt=a(e=>!!e.name&&!!e.schema&&!!e.indexes,"isVali\
105
- dTable"),Te=a((e,r,t,n)=>G(e)?fe(e,r,Vt(e),t,n):_t(e)?fe(e,r,$t(e),t,n):null,"ge\
106
- tTypeTable"),fe=a((e,r,t,n,o)=>{let s={},i=new Set(["name","schema","indexes"]);
103
+ return Ft(s)?s:(o.push(new w([...i],e.file)),null)},"getTypeFromMembers");var fe=n((e,r,t,a)=>{if(!Jt(e))return Te(e,r,t,a);let o=Qt(e,t);return o?Te(o,r,
104
+ t,a):null},"getDatabaseTable"),Kt=n(e=>!!e.name&&!!e.schema&&!!e.indexes,"isVali\
105
+ dTable"),Te=n((e,r,t,a)=>G(e)?ye(e,r,Vt(e),t,a):_t(e)?ye(e,r,$t(e),t,a):null,"ge\
106
+ tTypeTable"),ye=n((e,r,t,a,o)=>{let s={},i=new Set(["name","schema","indexes"]);
107
107
  for(let l of t)if(!(!Bt(l)||l.inherited))switch(l.name){default:o.push(new qt(r.
108
108
  name,l.name,e.file));break;case"name":(s.name=Gt(l))&&i.delete(l.name);break;case"\
109
- schema":(s.schema=me(l.value,e,n,o))&&i.delete(l.name);break;case"indexes":(s.indexes=
110
- ie(l.value,e,n,o))&&i.delete(l.name);break;case"relations":s.relations=ae(l.value,
111
- e,n,o);break;case"stream":s.stream=be(l.value,r,n,o);break}if(!Kt(s))return o.push(
109
+ schema":(s.schema=me(l.value,e,a,o))&&i.delete(l.name);break;case"indexes":(s.indexes=
110
+ ie(l.value,e,a,o))&&i.delete(l.name);break;case"relations":s.relations=ae(l.value,
111
+ e,a,o);break;case"stream":s.stream=be(l.value,r,a,o);break}if(!Kt(s))return o.push(
112
112
  new E([...i],e.file)),null;let p=Wt(e,s.indexes,s.schema);return p.length?(o.push(
113
- ...p),null):s},"getTypeFromMembers"),Wt=a((e,r,t)=>{let n=t.properties,o=[];for(let{
114
- name:s,columns:i}of r)i.some(l=>!n[l])&&o.push(new k(s,e.file));return o},"valid\
115
- ateIndexes");var ge=a(e=>{let r={},t=[];for(let n in e){let o=e[n];if(!D(o)||Zt(o))continue;let s={
113
+ ...p),null):s},"getTypeFromMembers"),Wt=n((e,r,t)=>{let a=t.properties,o=[];for(let{
114
+ name:s,columns:i}of r)i.some(l=>!a[l])&&o.push(new k(s,e.file));return o},"valid\
115
+ ateIndexes");var ge=n(e=>{let r={},t=[];for(let a in e){let o=e[a];if(!D(o)||Zt(o))continue;let s={
116
116
  type:F,extras:{}},i=new Set(["engine","tables"]),p=o.file;s.name=o.name;for(let m of rr(
117
117
  o))if(!(!nr(m)||m.inherited))switch(m.name){default:t.push(new Yt(s.name,m.name,
118
118
  p));break;case"client":break;case"scalability":(s.scalability=Y(m.value,o,e,t))&&
@@ -121,22 +121,22 @@ break;case"tables":(s.tables=or(m,o,e,t))&&i.delete(m.name);break;case"variables
121
121
  s.variables=er(m,t);break;case"services":s.services=Lt(m,e,t);break}if(!ar(s)){t.
122
122
  push(new T([...i],p));continue}let l=sr(o,s.tables);if(l.length){t.push(...l);continue}
123
123
  if(r[o.name]){t.push(new Xt(o.name,p));continue}r[o.name]=s}return{services:r,errors:t}},
124
- "getDatabaseServices"),ar=a(e=>!!e.name&&!!e.tables&&!!e.extras,"isValidService"),
125
- or=a((e,r,t,n)=>{let o=tr(e)??[],s=[];for(let i of o){let p=ye(i,r,t,n);p&&s.push(
126
- p)}return s},"getAllTables"),sr=a((e,r)=>{let t=ir(r),n=[];for(let{relations:o,schema:s,
124
+ "getDatabaseServices"),ar=n(e=>!!e.name&&!!e.tables&&!!e.extras,"isValidService"),
125
+ or=n((e,r,t,a)=>{let o=tr(e)??[],s=[];for(let i of o){let p=fe(i,r,t,a);p&&s.push(
126
+ p)}return s},"getAllTables"),sr=n((e,r)=>{let t=ir(r),a=[];for(let{relations:o,schema:s,
127
127
  indexes:i}of r){if(!o)continue;let p=s.properties;for(let l of o){let{sourceTable:m,
128
- sourceColumn:d,targetColumn:N,targetAlias:V}=l;p[N]||n.push(new u(N,e.file)),p[V]&&
129
- n.push(new M(V,e.file));let H=t[m]?.schema.properties;H||n.push(new g(m,e.file)),
130
- H&&!H[d]&&n.push(new u(d,e.file));let Se=t[m]?.indexes??[];l.sourceIndex=xe(Se,d),
131
- l.targetIndex=xe(i,N)}}return n},"validateRelations"),xe=a((e,r)=>e.find(({name:t})=>t===
132
- r)?.type,"getIndexType"),ir=a(e=>e.reduce((r,t)=>({...r,[t.name]:t}),{}),"getTab\
133
- leMap");var Me=a(e=>D(e)?e.name:null,"getLinkedService");var Ie=!1,ka=a(()=>{Ie||(pr(),lr(),mr("@ez4/database",{"metadata:getServices":ge,
128
+ sourceColumn:d,targetColumn:N,targetAlias:V}=l;p[N]||a.push(new u(N,e.file)),p[V]&&
129
+ a.push(new M(V,e.file));let H=t[m]?.schema.properties;H||a.push(new g(m,e.file)),
130
+ H&&!H[d]&&a.push(new u(d,e.file));let Se=t[m]?.indexes??[];l.sourceIndex=xe(Se,d),
131
+ l.targetIndex=xe(i,N)}}return a},"validateRelations"),xe=n((e,r)=>e.find(({name:t})=>t===
132
+ r)?.type,"getIndexType"),ir=n(e=>e.reduce((r,t)=>({...r,[t.name]:t}),{}),"getTab\
133
+ leMap");var Me=n(e=>D(e)?e.name:null,"getLinkedService");var Ie=!1,ka=n(()=>{Ie||(pr(),lr(),mr("@ez4/database",{"metadata:getServices":ge,
134
134
  "metadata:getLinkedService":Me}),Ie=!0)},"registerTriggers");export{v as IncompleteEngineError,U as IncompleteHandlerError,S as IncompleteScalabilityError,
135
135
  T as IncompleteServiceError,w as IncompleteStreamError,E as IncompleteTableError,
136
- P as IncorrectIndexesTypeError,y as IncorrectRelationsTypeError,A as IncorrectSchemaTypeError,
136
+ P as IncorrectIndexesTypeError,f as IncorrectRelationsTypeError,A as IncorrectSchemaTypeError,
137
137
  z as IncorrectStreamTypeError,k as InvalidIndexReferenceError,O as InvalidIndexTypeError,
138
138
  j as InvalidIndexesTypeError,M as InvalidRelationAliasError,u as InvalidRelationColumnError,
139
- g as InvalidRelationTableError,x as InvalidRelationTargetError,f as InvalidRelationsTypeError,
139
+ g as InvalidRelationTableError,x as InvalidRelationTargetError,y as InvalidRelationsTypeError,
140
140
  R as InvalidSchemaTypeError,C as InvalidStreamTypeError,F as ServiceType,ge as getDatabaseServices,
141
- ye as getDatabaseTable,me as getTableSchema,dr as isDatabaseService,ka as registerTriggers};
141
+ fe as getDatabaseTable,me as getTableSchema,dr as isDatabaseService,ka as registerTriggers};
142
142
  //# sourceMappingURL=library.mjs.map
package/dist/main.cjs CHANGED
@@ -1,9 +1,9 @@
1
1
  "use strict";var s=Object.defineProperty;var l=Object.getOwnPropertyDescriptor;var b=Object.getOwnPropertyNames;var I=Object.prototype.hasOwnProperty;var u=(a,n)=>{for(var e in n)s(a,e,{get:n[e],enumerable:!0})},g=(a,n,e,r)=>{if(n&&
2
2
  typeof n=="object"||typeof n=="function")for(let t of b(n))!I.call(a,t)&&t!==e&&
3
- s(a,t,{get:()=>n[t],enumerable:!(r=l(n,t))||r.enumerable});return a};var f=a=>g(s({},"__esModule",{value:!0}),a);var S={};u(S,{Database:()=>T,Index:()=>y,InsensitiveMode:()=>p,Order:()=>m,OrderMode:()=>x,
4
- PaginationMode:()=>d,ParametersMode:()=>o,StreamType:()=>c,TransactionMode:()=>i});
5
- module.exports=f(S);var c=(r=>(r.Insert="insert",r.Update="update",r.Delete="delete",r))(c||{});var o=(e=>(e.NameAndIndex="both",e.OnlyIndex="index",e))(o||{});var i=(e=>(e.Interactive="interactive",e.Static="static",e))(i||{});var p=(e=>(e.Unsupported="unsupported",e.Enabled="enabled",e))(p||{});var d=(e=>(e.Cursor="cursor",e.Offset="offset",e))(d||{});var m=(e=>(e.Asc="asc",e.Desc="desc",e))(m||{}),x=(e=>(e.IndexColumns="index",e.
6
- AnyColumns="any",e))(x||{});var T;(a=>{})(T||={});var y=(t=>(t.Primary="primary",t.Secondary="secondary",t.Unique="unique",t.TTL="\
7
- ttl",t))(y||{});0&&(module.exports={Database,Index,InsensitiveMode,Order,OrderMode,PaginationMode,
3
+ s(a,t,{get:()=>n[t],enumerable:!(r=l(n,t))||r.enumerable});return a};var S=a=>g(s({},"__esModule",{value:!0}),a);var f={};u(f,{Database:()=>T,Index:()=>c,InsensitiveMode:()=>p,Order:()=>d,OrderMode:()=>x,
4
+ PaginationMode:()=>m,ParametersMode:()=>o,StreamType:()=>y,TransactionMode:()=>i});
5
+ module.exports=S(f);var y=(r=>(r.Insert="insert",r.Update="update",r.Delete="delete",r))(y||{});var o=(e=>(e.NameAndIndex="both",e.OnlyIndex="index",e))(o||{});var i=(e=>(e.Interactive="interactive",e.Static="static",e))(i||{});var p=(e=>(e.Unsupported="unsupported",e.Enabled="enabled",e))(p||{});var m=(e=>(e.Cursor="cursor",e.Offset="offset",e))(m||{});var d=(e=>(e.Asc="asc",e.Desc="desc",e))(d||{}),x=(e=>(e.IndexColumns="index",e.
6
+ AnyColumns="any",e))(x||{});var T;(a=>{})(T||={});var c=(t=>(t.Primary="primary",t.Secondary="secondary",t.Unique="unique",t.TTL="\
7
+ ttl",t))(c||{});0&&(module.exports={Database,Index,InsensitiveMode,Order,OrderMode,PaginationMode,
8
8
  ParametersMode,StreamType,TransactionMode});
9
9
  //# sourceMappingURL=main.cjs.map
package/dist/main.mjs CHANGED
@@ -1,5 +1,5 @@
1
1
  var x=(n=>(n.Insert="insert",n.Update="update",n.Delete="delete",n))(x||{});var a=(e=>(e.NameAndIndex="both",e.OnlyIndex="index",e))(a||{});var r=(e=>(e.Interactive="interactive",e.Static="static",e))(r||{});var s=(e=>(e.Unsupported="unsupported",e.Enabled="enabled",e))(s||{});var o=(e=>(e.Cursor="cursor",e.Offset="offset",e))(o||{});var i=(e=>(e.Asc="asc",e.Desc="desc",e))(i||{}),p=(e=>(e.IndexColumns="index",e.
2
- AnyColumns="any",e))(p||{});var d;(T=>{})(d||={});var m=(t=>(t.Primary="primary",t.Secondary="secondary",t.Unique="unique",t.TTL="\
3
- ttl",t))(m||{});export{d as Database,m as Index,s as InsensitiveMode,i as Order,p as OrderMode,o as PaginationMode,
2
+ AnyColumns="any",e))(p||{});var m;(T=>{})(m||={});var d=(t=>(t.Primary="primary",t.Secondary="secondary",t.Unique="unique",t.TTL="\
3
+ ttl",t))(d||{});export{m as Database,d as Index,s as InsensitiveMode,i as Order,p as OrderMode,o as PaginationMode,
4
4
  a as ParametersMode,x as StreamType,r as TransactionMode};
5
5
  //# sourceMappingURL=main.mjs.map
@@ -1,3 +1,3 @@
1
1
  import type { AllType, SourceMap, TypeModel } from '@ez4/reflection';
2
- import { DatabaseScalability } from '../types/scalability.js';
2
+ import type { DatabaseScalability } from '../types/scalability.js';
3
3
  export declare const getDatabaseScalability: (type: AllType, parent: TypeModel, reflection: SourceMap, errorList: Error[]) => DatabaseScalability | null;
@@ -1,5 +1,5 @@
1
+ import type { Service as CommonService } from '@ez4/common';
1
2
  import type { LinkedVariables } from '@ez4/project/library';
2
- import type { Service } from '@ez4/common';
3
3
  import type { StreamChange } from './streams.js';
4
4
  import type { DatabaseEngine } from './engine.js';
5
5
  import type { Client } from './client.js';
@@ -30,24 +30,28 @@ export declare namespace Database {
30
30
  /**
31
31
  * Incoming stream event.
32
32
  */
33
- type Incoming<T extends Schema> = StreamChange<T & {
33
+ type Incoming<T extends Schema> = StreamChange<T> & Request;
34
+ /**
35
+ * Incoming request.
36
+ */
37
+ type Request = {
34
38
  /**
35
39
  * Request tracking Id.
36
40
  */
37
41
  requestId: string;
38
- }>;
42
+ };
39
43
  /**
40
44
  * Stream listener.
41
45
  */
42
- type Listener<T extends Schema> = (event: Service.Event<Incoming<T>>, context: Service.Context<Database.Service>) => Promise<void> | void;
46
+ type Listener<T extends Schema> = (event: CommonService.AnyEvent<Incoming<T>>, context: CommonService.Context<Database.Service>) => Promise<void> | void;
43
47
  /**
44
48
  * Stream handler.
45
49
  */
46
- type Handler<T extends Schema> = (request: Incoming<T>, context: Service.Context<Database.Service>) => Promise<void> | void;
50
+ type Handler<T extends Schema> = (request: Incoming<T>, context: CommonService.Context<Database.Service>) => Promise<void> | void;
47
51
  /**
48
52
  * Service event.
49
53
  */
50
- type ServiceEvent<T extends Schema = Schema> = Service.Event<Incoming<T>>;
54
+ type ServiceEvent<T extends Schema = Schema> = CommonService.BeginEvent<Request> | CommonService.ReadyEvent<Incoming<T>> | CommonService.ErrorEvent<Request | Incoming<T>> | CommonService.EndEvent<Request>;
51
55
  /**
52
56
  * Service engine.
53
57
  */
@@ -116,7 +120,7 @@ export declare namespace Database {
116
120
  /**
117
121
  * Database service.
118
122
  */
119
- abstract class Service implements Service.Provider {
123
+ abstract class Service implements CommonService.Provider {
120
124
  /**
121
125
  * Determines which database engine to use.
122
126
  * Check the provider package to know all the possible values.
@@ -1,8 +1,8 @@
1
- import { ParametersMode } from '../services/parameters.js';
2
- import { TransactionMode } from '../services/transaction.js';
3
- import { InsensitiveMode } from '../services/insensitive.js';
4
- import { PaginationMode } from '../services/pagination.js';
5
- import { OrderMode } from '../services/order.js';
1
+ import type { ParametersMode } from '../services/parameters.js';
2
+ import type { TransactionMode } from '../services/transaction.js';
3
+ import type { InsensitiveMode } from '../services/insensitive.js';
4
+ import type { PaginationMode } from '../services/pagination.js';
5
+ import type { OrderMode } from '../services/order.js';
6
6
  export type DatabaseEngine = {
7
7
  parametersMode: ParametersMode;
8
8
  transactionMode: TransactionMode;
@@ -1,5 +1,6 @@
1
1
  export type StreamHandler = {
2
2
  name: string;
3
+ module?: string;
3
4
  file: string;
4
5
  description?: string;
5
6
  };
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@ez4/database",
3
3
  "description": "EZ4: Components to build database services",
4
- "version": "0.23.0",
4
+ "version": "0.24.0",
5
5
  "author": "Silas B.",
6
6
  "license": "MIT",
7
7
  "type": "module",
@@ -32,6 +32,7 @@
32
32
  "packages/*"
33
33
  ],
34
34
  "scripts": {
35
+ "lint": "eslint --cache",
35
36
  "clean": "rm -f *.tsbuildinfo && rm -rf dist/*",
36
37
  "build": "tsc -p tsconfig.json && node tools/bundler.mjs",
37
38
  "test": "npm run test:types && node --test --import ../../tools/tsnode.mjs test/*.spec.ts",
@@ -42,10 +43,10 @@
42
43
  "live:publish": "npm run test && npm publish --access public"
43
44
  },
44
45
  "dependencies": {
45
- "@ez4/common": "^0.23.0",
46
- "@ez4/project": "^0.23.0",
47
- "@ez4/reflection": "^0.23.0",
48
- "@ez4/schema": "^0.23.0",
49
- "@ez4/utils": "^0.23.0"
46
+ "@ez4/common": "^0.24.0",
47
+ "@ez4/project": "^0.24.0",
48
+ "@ez4/reflection": "^0.24.0",
49
+ "@ez4/schema": "^0.24.0",
50
+ "@ez4/utils": "^0.24.0"
50
51
  }
51
52
  }