@ez4/database 0.26.0 → 0.28.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.mjs CHANGED
@@ -1,142 +1,144 @@
1
- var De=Object.defineProperty;var n=(e,r)=>De(e,"name",{value:r,configurable:!0});import{registerTriggers as lr}from"@ez4/common/library";import{registerTriggers as mr}from"@ez4/schema/library";
2
- import{createTrigger as cr}from"@ez4/project/library";import{DuplicateServiceError as Yt,InvalidServicePropertyError as Zt,isExternalDeclaration as Lt,
3
- getLinkedServiceList as er,getLinkedVariableList as tr,getPropertyTuple as rr,getModelMembers as nr}from"@ez4/common/library";
4
- import{isModelProperty as ar}from"@ez4/reflection";var F="@ez4/database",ur=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
- lationAliasError")}};import{InvalidServicePropertyError as Re,getModelMembers as Ae,getPropertyNumber as we,
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{n(this,"IncompleteScalabilityError")}constructor(r,t){
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=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
- 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:(a.push(new S([...s],e.file)),null)},"getTypeFromM\
32
- embers");import{isModelProperty as Ve,isTypeObject as $e,isTypeReference as Ge}from"@ez4/reflection";
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{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={},
1
+ var he=Object.defineProperty;var a=(e,r)=>he(e,"name",{value:r,configurable:!0});import{registerTriggers as mr}from"@ez4/common/library";import{registerTriggers as cr}from"@ez4/schema/library";
2
+ import{createTrigger as dr}from"@ez4/project/library";import{DuplicateServiceError as Zt,InvalidServicePropertyError as Lt,isExternalDeclaration as er,
3
+ getLinkedServiceList as tr,getLinkedVariableList as rr,getPropertyTuple as nr,getModelMembers as ar}from"@ez4/common/library";
4
+ import{isModelProperty as or}from"@ez4/reflection";var F="@ez4/database",br=a(e=>e.type===F,"isDatabaseService");import{IncompleteTypeError as ve}from"@ez4/common/library";var T=class extends ve{static{a(this,"IncompleteServiceError")}constructor(r,t){
5
+ super("Incomplete database service",r,t)}};import{IncorrectTypeError as Ee,InvalidTypeError as Pe,TypeError as I}from"@ez4/common/library";var y=class extends Pe{static{a(this,"InvalidRelationsTypeError")}constructor(r){
6
+ super("Invalid table relations type",void 0,"Database.Relations",r)}},f=class extends Ee{constructor(t,o){
7
+ super("Incorrect table relations type",t,"Database.Relations",o);this.schemaType=
8
+ t}static{a(this,"IncorrectRelationsTypeError")}},x=class extends I{constructor(t,o){
9
+ super(`Target ${t} must follow the pattern 'column@alias'.`,o);this.relationSource=
10
+ t}static{a(this,"InvalidRelationTargetError")}},g=class extends I{constructor(t,o){
11
+ super(`Relation table ${t} don't exists.`,o);this.relationTable=t}static{a(this,
12
+ "InvalidRelationTableError")}},b=class extends I{constructor(t,o){super(`Relatio\
13
+ n column ${t} don't exists.`,o);this.relationColumn=t}static{a(this,"InvalidRela\
14
+ tionColumnError")}},M=class extends I{constructor(t,o){super(`Relation alias ${t}\
15
+ can't override table columns.`,o);this.relationAlias=t}static{a(this,"InvalidRe\
16
+ lationAliasError")}};import{InvalidServicePropertyError as we,getModelMembers as je,getPropertyNumber as Ce,
17
+ getObjectMembers as Ue,getReferenceType as ze}from"@ez4/common/library";import{isModelProperty as Ne,
18
+ isTypeObject as He,isTypeReference as Fe}from"@ez4/reflection";import{isAnyNumber as q}from"@ez4/utils";import{IncompleteTypeError as Oe}from"@ez4/common/library";var S=class extends Oe{static{a(this,"IncompleteScalabilityError")}constructor(r,t){
19
+ super("Incomplete database scalability",r,t)}};import{hasHeritageType as c,isClassDeclaration as ke,isModelDeclaration as $}from"@ez4/common/library";
20
+ import{isTypeCallback as Re,isTypeFunction as Ae}from"@ez4/reflection";var D=a(e=>ke(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=>Re(e)||Ae(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,o)=>{if(!Fe(e))return W(e,r,o);let n=ze(e,t);return n?W(n,r,o):null},
26
+ "getDatabaseScalability"),qe=a(e=>q(e.minCapacity)&&q(e.maxCapacity),"isValidSca\
27
+ lability"),W=a((e,r,t)=>h(e)?X(e,r,je(e),t):He(e)?X(e,r,Ue(e),t):null,"getTypeSc\
28
+ alability"),X=a((e,r,t,o)=>{let n={},s=new Set(["minCapacity","maxCapacity"]);for(let i of t)
29
+ if(!(!Ne(i)||i.inherited))switch(i.name){default:o.push(new we(r.name,i.name,e.file));
30
+ break;case"minCapacity":case"maxCapacity":let p=Ce(i);q(p)&&(n[i.name]=p,s.delete(
31
+ i.name));break}return qe(n)?n:(o.push(new S([...s],e.file)),null)},"getTypeFromM\
32
+ embers");import{isModelProperty as $e,isTypeObject as Ge,isTypeReference as Qe}from"@ez4/reflection";
33
+ import{InvalidServicePropertyError as Be,getModelMembers as _e,getObjectMembers as Je,
34
+ getPropertyString as Ke,getPropertyStringIn as d,getReferenceType as We}from"@ez4/common/library";import{IncompleteTypeError as Ve}from"@ez4/common/library";var v=class extends Ve{static{a(this,"IncompleteEngineError")}constructor(r,t){super(
35
+ "Incomplete database engine",r,t)}};var ee=a((e,r,t,o)=>{if(!Qe(e))return Z(e,r,o);let n=We(e,t);return n?Z(n,r,o):null},
36
+ "getDatabaseEngine"),Xe=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,_e(e),t):Ge(e)?L(e,r,Je(e),t):null,"getTypeEngine"),L=a((e,r,t,o)=>{let n={},
39
39
  s=new Set(["name","parametersMode","transactionMode","insensitiveMode","paginati\
40
- onMode","orderMode"]);for(let i of t)if(!(!Ve(i)||i.inherited))switch(i.name){default:
41
- a.push(new Qe(r.name,i.name,e.file));break;case"name":(o.name=Je(i))&&s.delete(i.
42
- name);break;case"parametersMode":(o.parametersMode=b(i,["index","both"]))&&s.delete(
43
- i.name);break;case"transactionMode":(o.transactionMode=b(i,["static","interactiv\
44
- e"]))&&s.delete(i.name);break;case"insensitiveMode":(o.insensitiveMode=b(i,["uns\
45
- upported","enabled"]))&&s.delete(i.name);break;case"paginationMode":(o.paginationMode=
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:(a.push(new v([...s],
48
- e.file)),null)},"getTypeFromMembers");import{InvalidServicePropertyError as Vt,getModelMembers as $t,getObjectMembers as Gt,
49
- getPropertyString as Qt,getReferenceType as Bt}from"@ez4/common/library";import{
50
- isModelProperty as _t,isTypeObject as Jt,isTypeReference as Kt}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
- getReferenceType as nt}from"@ez4/common/library";import{isModelProperty as at,isTypeObject as ot,
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(
40
+ onMode","orderMode"]);for(let i of t)if(!(!$e(i)||i.inherited))switch(i.name){default:
41
+ o.push(new Be(r.name,i.name,e.file));break;case"name":(n.name=Ke(i))&&s.delete(i.
42
+ name);break;case"parametersMode":(n.parametersMode=d(i,["index","both"]))&&s.delete(
43
+ i.name);break;case"transactionMode":(n.transactionMode=d(i,["static","interactiv\
44
+ e"]))&&s.delete(i.name);break;case"insensitiveMode":(n.insensitiveMode=d(i,["uns\
45
+ upported","enabled"]))&&s.delete(i.name);break;case"paginationMode":(n.paginationMode=
46
+ d(i,["cursor","offset"]))&&s.delete(i.name);break;case"orderMode":(n.orderMode=d(
47
+ i,["any","index"]))&&s.delete(i.name);break;case"lockMode":(n.lockMode=d(i,["uns\
48
+ upported","supported"]))&&s.delete(i.name);break}return Xe(n)?n:(o.push(new v([...s],
49
+ e.file)),null)},"getTypeFromMembers");import{InvalidServicePropertyError as $t,getModelMembers as Gt,getObjectMembers as Qt,
50
+ getPropertyString as Bt,getReferenceType as _t}from"@ez4/common/library";import{
51
+ isModelProperty as Jt,isTypeObject as Kt,isTypeReference as Wt}from"@ez4/reflection";import{IncompleteTypeError as Ye}from"@ez4/common/library";var E=class extends Ye{static{a(this,"IncompleteTableError")}constructor(r,t){super(
52
+ "Incomplete database table",r,t)}};import{IncorrectTypeError as Ze,InvalidTypeError as Le,TypeError as te}from"@ez4/common/library";var P=class extends Le{static{a(this,"InvalidIndexesTypeError")}constructor(r){super(
53
+ "Invalid table indexes type",void 0,"Database.Indexes",r)}},O=class extends Ze{constructor(t,o){
54
+ super("Incorrect table indexes type",t,"Database.Indexes",o);this.schemaType=t}static{
55
+ a(this,"IncorrectIndexesTypeError")}},k=class extends te{constructor(t,o){super(
56
+ `Invalid index type, ${t} must follow one of the Index options.`,o);this.indexName=
57
+ t}static{a(this,"InvalidIndexTypeError")}},R=class extends te{constructor(t,o){super(
58
+ `Invalid index reference, ${t} must be valid column.`,o);this.indexName=t}static{
59
+ a(this,"InvalidIndexReferenceError")}};import{isModelDeclaration as et,getModelMembers as tt,getObjectMembers as rt,getPropertyString as nt,
60
+ getReferenceType as at}from"@ez4/common/library";import{isModelProperty as ot,isTypeObject as st,
61
+ isTypeReference as it}from"@ez4/reflection";var ae=a((e,r,t,o)=>{if(!it(e))return re(e,r,o);let n=at(e,t);return n?re(n,r,o):
62
+ null},"getTableRelations"),re=a((e,r,t)=>st(e)?ne(e,rt(e),t):et(e)?B(e)?ne(e,tt(
62
63
  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
- 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);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
- getReferenceType as ct}from"@ez4/common/library";import{isModelProperty as dt,isTypeObject as ut,
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
- t):(t.push(new P(e.name,e.file)),null):(t.push(new j(r.file)),null),"getTypeInde\
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
- {name:s,columns:s.split(":"),type:i});break;default:return t.push(new O(s,e.file)),
74
- null}}return a},"getTypeFromMembers");import{createSchemaContext as ft,getObjectSchema as xt,isObjectSchema as gt}from"@ez4/schema/library";
75
- import{getReferenceType as Mt,isModelDeclaration as It}from"@ez4/common/library";
76
- import{isTypeObject as St,isTypeReference as Dt}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(!Dt(e))return pe(e,r,t,a);let o=Mt(e,t);return o?pe(o,r,
80
- t,a):null},"getTableSchema"),pe=n((e,r,t,a)=>St(e)?le(e,t):It(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
- (e,r)=>{let t=xt(e,r,ft({nullish:!0}));return t&&gt(t)?t:null},"getSchema");import{InvalidServicePropertyError as Ot,isModelDeclaration as kt,getLinkedVariableList as Rt,
83
- getModelMembers as At,getObjectMembers as wt,getPropertyNumber as Ct,getServiceListener as zt,
84
- getReferenceType as Ut}from"@ez4/common/library";import{isModelProperty as Nt,isTypeObject as Ht,
85
- isTypeReference as Ft}from"@ez4/reflection";import{IncompleteTypeError as ht,IncorrectTypeError as vt,InvalidTypeError as Et}from"@ez4/common/library";var w=class extends ht{static{n(this,"IncompleteStreamError")}constructor(r,t){super(
86
- "Incomplete table stream",r,t)}},C=class extends Et{static{n(this,"InvalidStream\
64
+ elations"),ne=a((e,r,t)=>{let o=[];for(let n of r){if(!ot(n)||n.inherited)continue;
65
+ let s=nt(n),i=n.name;if(!s)return t.push(new x(i,e.file)),null;let[p,l]=i.split(
66
+ "@",2),[m,u]=s.split(":",2);o.push({sourceTable:m,sourceColumn:u,targetColumn:p,
67
+ targetAlias:l})}return o},"getTypeFromMembers");import{isModelDeclaration as pt,getModelMembers as lt,getObjectMembers as mt,getPropertyString as ct,
68
+ getReferenceType as dt}from"@ez4/common/library";import{isModelProperty as ut,isTypeObject as bt,
69
+ isTypeReference as Tt}from"@ez4/reflection";var oe=(n=>(n.Primary="primary",n.Secondary="secondary",n.Unique="unique",n.TTL=
70
+ "ttl",n))(oe||{});var pe=a((e,r,t,o)=>{if(!Tt(e))return se(e,r,o);let n=dt(e,t);return n?se(n,r,o):
71
+ null},"getTableIndexes"),se=a((e,r,t)=>bt(e)?ie(e,mt(e),t):pt(e)?_(e)?ie(e,lt(e),
72
+ t):(t.push(new O(e.name,e.file)),null):(t.push(new P(r.file)),null),"getTypeInde\
73
+ xes"),ie=a((e,r,t)=>{let o=[];for(let n of r){if(!ut(n)||n.inherited)continue;let s=n.
74
+ name,i=ct(n);switch(i){case"primary":case"secondary":case"unique":case"ttl":o.push(
75
+ {name:s,columns:s.split(":"),type:i});break;default:return t.push(new k(s,e.file)),
76
+ null}}return o},"getTypeFromMembers");import{createSchemaContext as xt,getObjectSchema as gt,isObjectSchema as Mt}from"@ez4/schema/library";
77
+ import{getReferenceType as It,isModelDeclaration as St}from"@ez4/common/library";
78
+ import{isTypeObject as Dt,isTypeReference as ht}from"@ez4/reflection";import{IncorrectTypeError as yt,InvalidTypeError as ft}from"@ez4/common/library";var A=class extends ft{static{a(this,"InvalidSchemaTypeError")}constructor(r){super(
79
+ "Invalid table schema type",void 0,"Database.Schema",r)}},w=class extends yt{constructor(t,o){
80
+ super("Incorrect table schema type",t,"Database.Schema",o);this.schemaType=t}static{
81
+ a(this,"IncorrectSchemaTypeError")}};var ce=a((e,r,t,o)=>{if(!ht(e))return le(e,r,t,o);let n=It(e,t);return n?le(n,r,
82
+ t,o):null},"getTableSchema"),le=a((e,r,t,o)=>Dt(e)?me(e,t):St(e)?J(e)?me(e,t):(o.
83
+ push(new w(e.name,e.file)),null):(o.push(new A(r.file)),null),"getTypeSchema"),me=a(
84
+ (e,r)=>{let t=gt(e,r,xt({nullish:!0}));return t&&Mt(t)?t:null},"getSchema");import{InvalidServicePropertyError as Rt,isModelDeclaration as At,getLinkedVariableList as wt,
85
+ getModelMembers as jt,getObjectMembers as Ct,getPropertyNumber as Ut,getServiceListener as zt,
86
+ getReferenceType as Nt}from"@ez4/common/library";import{isModelProperty as Ht,isTypeObject as Ft,
87
+ isTypeReference as qt}from"@ez4/reflection";import{IncompleteTypeError as vt,IncorrectTypeError as Et,InvalidTypeError as Pt}from"@ez4/common/library";var j=class extends vt{static{a(this,"IncompleteStreamError")}constructor(r,t){super(
88
+ "Incomplete table stream",r,t)}},C=class extends Pt{static{a(this,"InvalidStream\
87
89
  TypeError")}constructor(r){super("Invalid table stream type",void 0,"Database.St\
88
- ream",r)}},z=class extends vt{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 jt}from"@ez4/common/library";var U=class extends jt{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=
90
+ ream",r)}},U=class extends Et{constructor(t,o){super("Incorrect table stream typ\
91
+ e",t,"Database.Stream",o);this.streamType=t}static{a(this,"IncorrectStreamTypeEr\
92
+ ror")}};import{IncompleteTypeError as Ot}from"@ez4/common/library";var z=class extends Ot{static{a(this,"IncompleteHandlerError")}constructor(r,t){
93
+ super("Incomplete stream handler",r,t)}};var de=a((e,r,t)=>{if(!Q(e))return null;let{description:o,module:n}=e,s={...o&&{
94
+ description:o},...n&&{module:n}},i=new Set(["name","file","change"]);return(s.name=
93
95
  e.name)&&i.delete("name"),(s.file=e.file)&&i.delete("file"),e.parameters&&i.delete(
94
- "change"),i.size===0&&Pt(s)?s:(t.push(new U([...i],e.file)),null)},"getStreamHan\
95
- dler"),Pt=n(e=>!!e.name&&!!e.file,"isValidHandler");var be=n((e,r,t,a)=>{if(!Ft(e))return de(e,r,t,a);let o=Ut(e,t);return o?de(o,r,
96
- t,a):null},"getTableStream"),qt=n(e=>!!e.handler,"isValidStream"),de=n((e,r,t,a)=>Ht(
97
- e)?ue(e,r,wt(e),t,a):kt(e)?K(e)?ue(e,r,At(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
- i=new Set(["handler"]);for(let p of t)if(!(!Nt(p)||p.inherited))switch(p.name){default:
100
- o.push(new Ot(r.name,p.name,e.file));break;case"handler":s.handler=ce(p.value,a,
101
- o);break;case"listener":s.listener=zt(p.value,o);break;case"memory":case"logRete\
102
- ntion":case"timeout":s[p.name]=Ct(p);break;case"variables":s.variables=Rt(p,o);break}
103
- return qt(s)?s:(o.push(new w([...i],e.file)),null)},"getTypeFromMembers");var fe=n((e,r,t,a)=>{if(!Kt(e))return Te(e,r,t,a);let o=Bt(e,t);return o?Te(o,r,
104
- t,a):null},"getDatabaseTable"),Wt=n(e=>!!e.name&&!!e.schema&&!!e.indexes,"isVali\
105
- dTable"),Te=n((e,r,t,a)=>G(e)?ye(e,r,$t(e),t,a):Jt(e)?ye(e,r,Gt(e),t,a):null,"ge\
106
- tTypeTable"),ye=n((e,r,t,a,o)=>{let s={},i=new Set(["name","schema","indexes"]);
107
- for(let l of t)if(!(!_t(l)||l.inherited))switch(l.name){default:o.push(new Vt(r.
108
- name,l.name,e.file));break;case"name":(s.name=Qt(l))&&i.delete(l.name);break;case"\
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(!Wt(s))return o.push(
112
- new E([...i],e.file)),null;let p=Xt(e,s.indexes,s.schema);return p.length?(o.push(
113
- ...p),null):s},"getTypeFromMembers"),Xt=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)||Lt(o))continue;let s={
116
- type:F,extras:{}},i=new Set(["engine","tables"]),p=o.file;s.name=o.name;for(let m of nr(
117
- o))if(!(!ar(m)||m.inherited))switch(m.name){default:t.push(new Zt(s.name,m.name,
118
- p));break;case"client":break;case"scalability":(s.scalability=Y(m.value,o,e,t))&&
119
- i.delete(m.name);break;case"engine":(s.engine=ee(m.value,o,e,t))&&i.delete(m.name);
120
- break;case"tables":(s.tables=sr(m,o,e,t))&&i.delete(m.name);break;case"variables":
121
- s.variables=tr(m,t);break;case"services":s.services=er(m,e,t);break}if(!or(s)){t.
122
- push(new T([...i],p));continue}let l=ir(o,s.tables);if(l.length){t.push(...l);continue}
123
- if(r[o.name]){t.push(new Yt(o.name,p));continue}r[o.name]=s}return{services:r,errors:t}},
124
- "getDatabaseServices"),or=n(e=>!!e.name&&!!e.tables&&!!e.extras,"isValidService"),
125
- sr=n((e,r,t,a)=>{let o=rr(e)??[],s=[];for(let i of o){let p=fe(i,r,t,a);p&&s.push(
126
- p)}return s},"getAllTables"),ir=n((e,r)=>{let t=pr(r),a=[];for(let{relations:o,schema:s,
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]||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"),pr=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,Ra=n(()=>{Ie||(lr(),mr(),cr("@ez4/database",{"metadata:getServices":ge,
134
- "metadata:getLinkedService":Me}),Ie=!0)},"registerTriggers");export{v as IncompleteEngineError,U as IncompleteHandlerError,S as IncompleteScalabilityError,
135
- T as IncompleteServiceError,w as IncompleteStreamError,E as IncompleteTableError,
136
- P as IncorrectIndexesTypeError,f as IncorrectRelationsTypeError,A as IncorrectSchemaTypeError,
137
- z as IncorrectStreamTypeError,k as InvalidIndexReferenceError,O as InvalidIndexTypeError,
138
- j as InvalidIndexesTypeError,M as InvalidRelationAliasError,u as InvalidRelationColumnError,
96
+ "change"),i.size===0&&kt(s)?s:(t.push(new z([...i],e.file)),null)},"getStreamHan\
97
+ dler"),kt=a(e=>!!e.name&&!!e.file,"isValidHandler");var Te=a((e,r,t,o)=>{if(!qt(e))return ue(e,r,t,o);let n=Nt(e,t);return n?ue(n,r,
98
+ t,o):null},"getTableStream"),Vt=a(e=>!!e.handler,"isValidStream"),ue=a((e,r,t,o)=>Ft(
99
+ e)?be(e,r,Ct(e),t,o):At(e)?K(e)?be(e,r,jt(e),t,o):(o.push(new U(e.name,e.file)),
100
+ null):(o.push(new C(r.file)),null),"getTypeStream"),be=a((e,r,t,o,n)=>{let s={},
101
+ i=new Set(["handler"]);for(let p of t)if(!(!Ht(p)||p.inherited))switch(p.name){default:
102
+ n.push(new Rt(r.name,p.name,e.file));break;case"handler":s.handler=de(p.value,o,
103
+ n);break;case"listener":s.listener=zt(p.value,n);break;case"memory":case"logRete\
104
+ ntion":case"timeout":s[p.name]=Ut(p);break;case"variables":s.variables=wt(p,n);break}
105
+ return Vt(s)?s:(n.push(new j([...i],e.file)),null)},"getTypeFromMembers");var xe=a((e,r,t,o)=>{if(!Wt(e))return ye(e,r,t,o);let n=_t(e,t);return n?ye(n,r,
106
+ t,o):null},"getDatabaseTable"),Xt=a(e=>!!e.name&&!!e.schema&&!!e.indexes,"isVali\
107
+ dTable"),ye=a((e,r,t,o)=>G(e)?fe(e,r,Gt(e),t,o):Kt(e)?fe(e,r,Qt(e),t,o):null,"ge\
108
+ tTypeTable"),fe=a((e,r,t,o,n)=>{let s={},i=new Set(["name","schema","indexes"]);
109
+ for(let l of t)if(!(!Jt(l)||l.inherited))switch(l.name){default:n.push(new $t(r.
110
+ name,l.name,e.file));break;case"name":(s.name=Bt(l))&&i.delete(l.name);break;case"\
111
+ schema":(s.schema=ce(l.value,e,o,n))&&i.delete(l.name);break;case"indexes":(s.indexes=
112
+ pe(l.value,e,o,n))&&i.delete(l.name);break;case"relations":s.relations=ae(l.value,
113
+ e,o,n);break;case"stream":s.stream=Te(l.value,r,o,n);break}if(!Xt(s))return n.push(
114
+ new E([...i],e.file)),null;let p=Yt(e,s.indexes,s.schema);return p.length?(n.push(
115
+ ...p),null):s},"getTypeFromMembers"),Yt=a((e,r,t)=>{let o=t.properties,n=[];for(let{
116
+ name:s,columns:i}of r)i.some(l=>!o[l])&&n.push(new R(s,e.file));return n},"valid\
117
+ ateIndexes");var Me=a(e=>{let r={},t=[];for(let o in e){let n=e[o];if(!D(n)||er(n))continue;let s={
118
+ type:F,extras:{}},i=new Set(["engine","tables"]),p=n.file;s.name=n.name;for(let m of ar(
119
+ n))if(!(!or(m)||m.inherited))switch(m.name){default:t.push(new Lt(s.name,m.name,
120
+ p));break;case"client":break;case"scalability":(s.scalability=Y(m.value,n,e,t))&&
121
+ i.delete(m.name);break;case"engine":(s.engine=ee(m.value,n,e,t))&&i.delete(m.name);
122
+ break;case"tables":(s.tables=ir(m,n,e,t))&&i.delete(m.name);break;case"variables":
123
+ s.variables=rr(m,t);break;case"services":s.services=tr(m,e,t);break}if(!sr(s)){t.
124
+ push(new T([...i],p));continue}let l=pr(n,s.tables);if(l.length){t.push(...l);continue}
125
+ if(r[n.name]){t.push(new Zt(n.name,p));continue}r[n.name]=s}return{services:r,errors:t}},
126
+ "getDatabaseServices"),sr=a(e=>!!e.name&&!!e.tables&&!!e.extras,"isValidService"),
127
+ ir=a((e,r,t,o)=>{let n=nr(e)??[],s=[];for(let i of n){let p=xe(i,r,t,o);p&&s.push(
128
+ p)}return s},"getAllTables"),pr=a((e,r)=>{let t=lr(r),o=[];for(let{relations:n,schema:s,
129
+ indexes:i}of r){if(!n)continue;let p=s.properties;for(let l of n){let{sourceTable:m,
130
+ sourceColumn:u,targetColumn:N,targetAlias:V}=l;p[N]||o.push(new b(N,e.file)),p[V]&&
131
+ o.push(new M(V,e.file));let H=t[m]?.schema.properties;H||o.push(new g(m,e.file)),
132
+ H&&!H[u]&&o.push(new b(u,e.file));let De=t[m]?.indexes??[];l.sourceIndex=ge(De,u),
133
+ l.targetIndex=ge(i,N)}}return o},"validateRelations"),ge=a((e,r)=>e.find(({name:t})=>t===
134
+ r)?.type,"getIndexType"),lr=a(e=>e.reduce((r,t)=>({...r,[t.name]:t}),{}),"getTab\
135
+ leMap");var Ie=a(e=>D(e)?e.name:null,"getLinkedService");var Se=!1,Ca=a(()=>{Se||(mr(),cr(),dr("@ez4/database",{"metadata:getServices":Me,
136
+ "metadata:getLinkedService":Ie}),Se=!0)},"registerTriggers");export{v as IncompleteEngineError,z as IncompleteHandlerError,S as IncompleteScalabilityError,
137
+ T as IncompleteServiceError,j as IncompleteStreamError,E as IncompleteTableError,
138
+ O as IncorrectIndexesTypeError,f as IncorrectRelationsTypeError,w as IncorrectSchemaTypeError,
139
+ U as IncorrectStreamTypeError,oe as Index,R as InvalidIndexReferenceError,k as InvalidIndexTypeError,
140
+ P as InvalidIndexesTypeError,M as InvalidRelationAliasError,b as InvalidRelationColumnError,
139
141
  g as InvalidRelationTableError,x as InvalidRelationTargetError,y as InvalidRelationsTypeError,
140
- R as InvalidSchemaTypeError,C as InvalidStreamTypeError,F as ServiceType,ge as getDatabaseServices,
141
- fe as getDatabaseTable,me as getTableSchema,ur as isDatabaseService,Ra as registerTriggers};
142
+ A as InvalidSchemaTypeError,C as InvalidStreamTypeError,F as ServiceType,Me as getDatabaseServices,
143
+ xe as getDatabaseTable,ce as getTableSchema,br as isDatabaseService,Ca as registerTriggers};
142
144
  //# sourceMappingURL=library.mjs.map
package/dist/main.cjs CHANGED
@@ -1,9 +1,9 @@
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
- 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 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,
1
+ "use strict";var o=Object.defineProperty;var b=Object.getOwnPropertyDescriptor;var u=Object.getOwnPropertyNames;var I=Object.prototype.hasOwnProperty;var g=(a,n)=>{for(var e in n)o(a,e,{get:n[e],enumerable:!0})},f=(a,n,e,r)=>{if(n&&
2
+ typeof n=="object"||typeof n=="function")for(let t of u(n))!I.call(a,t)&&t!==e&&
3
+ o(a,t,{get:()=>n[t],enumerable:!(r=b(n,t))||r.enumerable});return a};var S=a=>f(o({},"__esModule",{value:!0}),a);var D={};g(D,{Database:()=>c,Index:()=>y,InsensitiveMode:()=>p,LockMode:()=>T,Order:()=>m,
4
+ OrderMode:()=>x,PaginationMode:()=>d,ParametersMode:()=>s,StreamType:()=>l,TransactionMode:()=>i});
5
+ module.exports=S(D);var l=(r=>(r.Insert="insert",r.Update="update",r.Delete="delete",r))(l||{});var s=(e=>(e.NameAndIndex="both",e.OnlyIndex="index",e))(s||{});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=(e=>(e.Unsupported="unsupported",e.Supported="supported",e))(T||{});var c;(a=>{})(c||={});var y=(t=>(t.Primary="primary",t.Secondary="secondary",t.Unique="unique",t.TTL="\
7
+ ttl",t))(y||{});0&&(module.exports={Database,Index,InsensitiveMode,LockMode,Order,OrderMode,PaginationMode,
8
8
  ParametersMode,StreamType,TransactionMode});
9
9
  //# sourceMappingURL=main.cjs.map
package/dist/main.d.ts CHANGED
@@ -1,13 +1,14 @@
1
- export * from './services/streams.js';
2
- export { Client } from './services/client.js';
3
- export { RelationMetadata } from './services/relations.js';
4
- export { TableMetadata, Table } from './services/table.js';
5
- export { ParametersMode, ParametersUtils } from './services/parameters.js';
6
- export { TransactionMode, TransactionUtils } from './services/transaction.js';
7
- export { InsensitiveMode, InsensitiveUtils } from './services/insensitive.js';
8
- export { PaginationMode, PaginationUtils } from './services/pagination.js';
9
- export { Order, OrderMode, OrderUtils } from './services/order.js';
10
- export { EngineUtils } from './services/engine.js';
11
- export { Database } from './services/database.js';
12
- export { Index } from './services/indexes.js';
13
- export { Query } from './services/query.js';
1
+ export * from './services/streams';
2
+ export { Client } from './services/client';
3
+ export { RelationMetadata } from './services/relations';
4
+ export { TableMetadata, Table } from './services/table';
5
+ export { ParametersMode, ParametersModeUtils } from './services/parameters';
6
+ export { TransactionMode, TransactionModeUtils } from './services/transaction';
7
+ export { InsensitiveMode, InsensitiveModeUtils } from './services/insensitive';
8
+ export { PaginationMode, PaginationModeUtils } from './services/pagination';
9
+ export { Order, OrderMode, OrderModeUtils } from './services/order';
10
+ export { LockMode, LockModeUtils } from './services/lock';
11
+ export { EngineUtils } from './services/engine';
12
+ export { Database } from './services/database';
13
+ export { Index } from './services/indexes';
14
+ export { Query } from './services/query';
package/dist/main.mjs CHANGED
@@ -1,5 +1,5 @@
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 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
- a as ParametersMode,x as StreamType,r as TransactionMode};
1
+ var T=(n=>(n.Insert="insert",n.Update="update",n.Delete="delete",n))(T||{});var a=(e=>(e.NameAndIndex="both",e.OnlyIndex="index",e))(a||{});var r=(e=>(e.Interactive="interactive",e.Static="static",e))(r||{});var o=(e=>(e.Unsupported="unsupported",e.Enabled="enabled",e))(o||{});var s=(e=>(e.Cursor="cursor",e.Offset="offset",e))(s||{});var i=(e=>(e.Asc="asc",e.Desc="desc",e))(i||{}),p=(e=>(e.IndexColumns="index",e.
2
+ AnyColumns="any",e))(p||{});var d=(e=>(e.Unsupported="unsupported",e.Supported="supported",e))(d||{});var m;(c=>{})(m||={});var x=(t=>(t.Primary="primary",t.Secondary="secondary",t.Unique="unique",t.TTL="\
3
+ ttl",t))(x||{});export{m as Database,x as Index,o as InsensitiveMode,d as LockMode,i as Order,p as OrderMode,
4
+ s as PaginationMode,a as ParametersMode,T 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 type { DatabaseEngine } from '../types/engine.js';
2
+ import type { DatabaseEngine } from '../types/engine';
3
3
  export declare const getDatabaseEngine: (type: AllType, parent: TypeModel, reflection: SourceMap, errorList: Error[]) => DatabaseEngine | null;
@@ -1,3 +1,3 @@
1
1
  import type { AllType, SourceMap } from '@ez4/reflection';
2
- import type { StreamHandler } from '../types/handler.js';
2
+ import type { StreamHandler } from '../types/handler';
3
3
  export declare const getStreamHandler: (type: AllType, _reflection: SourceMap, errorList: Error[]) => StreamHandler | null;
@@ -1,5 +1,5 @@
1
1
  import type { AllType, SourceMap, TypeModel, TypeObject } from '@ez4/reflection';
2
- import type { TableIndex } from '../types/indexes.js';
2
+ import type { TableIndex } from '../types/indexes';
3
3
  type TypeParent = TypeModel | TypeObject;
4
4
  export declare const getTableIndexes: (type: AllType, parent: TypeParent, reflection: SourceMap, errorList: Error[]) => TableIndex[] | null;
5
5
  export {};
@@ -1,5 +1,5 @@
1
1
  import type { AllType, SourceMap, TypeModel, TypeObject } from '@ez4/reflection';
2
- import type { TableRelation } from '../types/relations.js';
2
+ import type { TableRelation } from '../types/relations';
3
3
  type TypeParent = TypeModel | TypeObject;
4
4
  export declare const getTableRelations: (type: AllType, parent: TypeParent, reflection: SourceMap, errorList: Error[]) => TableRelation[] | null;
5
5
  export {};
@@ -1,3 +1,3 @@
1
1
  import type { AllType, SourceMap, TypeModel } from '@ez4/reflection';
2
- import type { DatabaseScalability } from '../types/scalability.js';
2
+ import type { DatabaseScalability } from '../types/scalability';
3
3
  export declare const getDatabaseScalability: (type: AllType, parent: TypeModel, reflection: SourceMap, errorList: Error[]) => DatabaseScalability | null;
@@ -1,4 +1,4 @@
1
1
  import type { AllType, SourceMap, TypeModel, TypeObject } from '@ez4/reflection';
2
2
  type TypeParent = TypeModel | TypeObject;
3
- export declare const getTableSchema: (type: AllType, parent: TypeParent, reflection: SourceMap, errorList: Error[]) => import("@ez4/schema/library").ObjectSchema | null;
3
+ export declare const getTableSchema: (type: AllType, parent: TypeParent, reflection: SourceMap, errorList: Error[]) => import("@ez4/schema").ObjectSchema | null;
4
4
  export {};
@@ -1,5 +1,5 @@
1
1
  import type { SourceMap } from '@ez4/reflection';
2
- import type { DatabaseService } from '../types/service.js';
2
+ import type { DatabaseService } from '../types/service';
3
3
  export declare const getDatabaseServices: (reflection: SourceMap) => {
4
4
  services: Record<string, DatabaseService>;
5
5
  errors: Error[];
@@ -1,3 +1,3 @@
1
1
  import type { AllType, SourceMap, TypeModel } from '@ez4/reflection';
2
- import type { TableStream } from '../types/stream.js';
2
+ import type { TableStream } from '../types/stream';
3
3
  export declare const getTableStream: (type: AllType, parent: TypeModel, reflection: SourceMap, errorList: Error[]) => TableStream | null;
@@ -1,3 +1,3 @@
1
1
  import type { AllType, SourceMap, TypeModel } from '@ez4/reflection';
2
- import type { DatabaseTable } from '../types/table.js';
2
+ import type { DatabaseTable } from '../types/table';
3
3
  export declare const getDatabaseTable: (type: AllType, parent: TypeModel, reflection: SourceMap, errorList: Error[]) => DatabaseTable | null;
@@ -1,7 +1,7 @@
1
- import type { ParametersUtils } from './parameters.js';
2
- import type { TransactionUtils } from './transaction.js';
3
- import type { TableClients } from './table.js';
4
- import type { Database } from './database.js';
1
+ import type { ParametersModeUtils } from './parameters';
2
+ import type { TransactionModeUtils } from './transaction';
3
+ import type { TableClients } from './table';
4
+ import type { Database } from './database';
5
5
  /**
6
6
  * Database client.
7
7
  */
@@ -13,12 +13,12 @@ export type Client<T extends Database.Service> = TableClients<T> & {
13
13
  * @param parameters Parameters in use by the given query.
14
14
  * @returns Returns the results for the given query.
15
15
  */
16
- rawQuery(query: string, parameters?: ParametersUtils.Type<T>): Promise<Record<string, unknown>[]>;
16
+ rawQuery(query: string, parameters?: ParametersModeUtils.Type<T>): Promise<Record<string, unknown>[]>;
17
17
  /**
18
18
  * Prepare and execute the given transaction.
19
19
  *
20
20
  * @param operation Transaction operation.
21
21
  * @returns Returns the transaction result if the given transaction is interactive.
22
22
  */
23
- transaction<O extends TransactionUtils.Type<T, R>, R>(operation: O): Promise<TransactionUtils.Result<O>>;
23
+ transaction<O extends TransactionModeUtils.Type<T, R>, R>(operation: O): Promise<TransactionModeUtils.Result<O>>;
24
24
  };
@@ -1,8 +1,8 @@
1
1
  import type { Service as CommonService } from '@ez4/common';
2
2
  import type { LinkedVariables } from '@ez4/project/library';
3
- import type { StreamChange } from './streams.js';
4
- import type { DatabaseEngine } from './engine.js';
5
- import type { Client } from './client.js';
3
+ import type { StreamChange } from './streams';
4
+ import type { DatabaseEngine } from './engine';
5
+ import type { Client } from './client';
6
6
  /**
7
7
  * Given a database service `T`, it returns all its table.
8
8
  */
@@ -1,9 +1,10 @@
1
- import type { ParametersMode } from './parameters.js';
2
- import type { TransactionMode } from './transaction.js';
3
- import type { InsensitiveMode } from './insensitive.js';
4
- import type { PaginationMode } from './pagination.js';
5
- import type { OrderMode } from './order.js';
6
- import type { Database } from './database.js';
1
+ import type { ParametersMode } from './parameters';
2
+ import type { TransactionMode } from './transaction';
3
+ import type { InsensitiveMode } from './insensitive';
4
+ import type { PaginationMode } from './pagination';
5
+ import type { Database } from './database';
6
+ import type { OrderMode } from './order';
7
+ import type { LockMode } from './lock';
7
8
  /**
8
9
  * Database engine.
9
10
  */
@@ -13,6 +14,7 @@ export type DatabaseEngine = {
13
14
  insensitiveMode: InsensitiveMode;
14
15
  paginationMode: PaginationMode;
15
16
  orderMode: OrderMode;
17
+ lockMode: LockMode;
16
18
  name: string;
17
19
  };
18
20
  /**
@@ -49,4 +51,10 @@ export declare namespace EngineUtils {
49
51
  type GetOrderMode<T extends Database.Service> = T['engine'] extends {
50
52
  orderMode: infer M;
51
53
  } ? M : never;
54
+ /**
55
+ * Get the lock mode from the given database service.
56
+ */
57
+ type GetLockMode<T extends Database.Service> = T['engine'] extends {
58
+ lockMode: infer M;
59
+ } ? M : never;
52
60
  }
@@ -1,5 +1,5 @@
1
1
  import type { ArrayRest, IsArrayEmpty } from '@ez4/utils';
2
- import type { Database, DatabaseTables } from './database.js';
2
+ import type { Database, DatabaseTables } from './database';
3
3
  /**
4
4
  * All supported index types.
5
5
  */
@@ -1,4 +1,4 @@
1
- import type { DatabaseEngine, EngineUtils } from './engine.js';
1
+ import type { DatabaseEngine, EngineUtils } from './engine';
2
2
  /**
3
3
  * Insensitive mode.
4
4
  */
@@ -7,9 +7,9 @@ export declare const enum InsensitiveMode {
7
7
  Enabled = "enabled"
8
8
  }
9
9
  /**
10
- * Insensitive utils.
10
+ * Insensitive mode utils.
11
11
  */
12
- export declare namespace InsensitiveUtils {
12
+ export declare namespace InsensitiveModeUtils {
13
13
  /**
14
14
  * Get the insensitive input based on the given database engine.
15
15
  */
@@ -0,0 +1,17 @@
1
+ import type { TableMetadata } from './table';
2
+ /**
3
+ * Lock mode.
4
+ */
5
+ export declare const enum LockMode {
6
+ Unsupported = "unsupported",
7
+ Supported = "supported"
8
+ }
9
+ /**
10
+ * Lock mode utils.
11
+ */
12
+ export declare namespace LockModeUtils {
13
+ /**
14
+ * Lock mode input type based on the table metadata.
15
+ */
16
+ type Input<T extends TableMetadata> = T['engine']['lockMode'] extends LockMode.Unsupported ? never : boolean;
17
+ }