@ez4/database 0.36.0 → 0.38.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/errors/engine.d.ts +8 -1
- package/dist/errors/indexes.d.ts +2 -2
- package/dist/errors/relations.d.ts +2 -2
- package/dist/errors/scalability.d.ts +8 -1
- package/dist/errors/table.d.ts +8 -1
- package/dist/library.cjs +175 -150
- package/dist/library.d.ts +2 -6
- package/dist/library.mjs +170 -145
- package/dist/main.cjs +10 -7
- package/dist/main.d.ts +9 -7
- package/dist/main.mjs +7 -4
- package/dist/metadata/engine.d.ts +4 -3
- package/dist/metadata/handler.d.ts +3 -3
- package/dist/metadata/indexes.d.ts +4 -3
- package/dist/metadata/relations.d.ts +4 -3
- package/dist/metadata/scalability.d.ts +4 -3
- package/dist/metadata/schema.d.ts +3 -2
- package/dist/metadata/service.d.ts +4 -3
- package/dist/metadata/stream.d.ts +4 -3
- package/dist/metadata/table.d.ts +4 -3
- package/dist/metadata/types.d.ts +70 -0
- package/dist/services/contract.d.ts +4 -1
- package/dist/services/engine.d.ts +1 -6
- package/dist/services/handler.d.ts +8 -0
- package/dist/services/incoming.d.ts +7 -0
- package/dist/services/indexes.d.ts +1 -9
- package/dist/services/insensitive.d.ts +1 -7
- package/dist/services/listener.d.ts +8 -0
- package/dist/services/lock.d.ts +1 -7
- package/dist/services/order.d.ts +2 -14
- package/dist/services/pagination.d.ts +1 -7
- package/dist/services/parameters.d.ts +1 -7
- package/dist/services/request.d.ts +13 -0
- package/dist/services/scalability.d.ts +6 -0
- package/dist/services/streams.d.ts +11 -1
- package/dist/services/transaction.d.ts +1 -7
- package/dist/types/index.d.ts +9 -0
- package/dist/types/mode.d.ts +42 -0
- package/dist/types/order.d.ts +7 -0
- package/package.json +6 -6
- package/dist/metadata/utils.d.ts +0 -9
- package/dist/services/common.d.ts +0 -25
- package/dist/types/engine.d.ts +0 -15
- package/dist/types/handler.d.ts +0 -6
- package/dist/types/indexes.d.ts +0 -6
- package/dist/types/relations.d.ts +0 -9
- package/dist/types/scalability.d.ts +0 -4
- package/dist/types/schema.d.ts +0 -2
- package/dist/types/service.d.ts +0 -13
- package/dist/types/stream.d.ts +0 -11
- package/dist/types/table.d.ts +0 -11
package/dist/library.mjs
CHANGED
|
@@ -1,146 +1,171 @@
|
|
|
1
|
-
var
|
|
2
|
-
import{tryCreateTrigger as
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
super("
|
|
8
|
-
|
|
9
|
-
super(
|
|
10
|
-
|
|
11
|
-
super(`
|
|
12
|
-
"
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
import{
|
|
21
|
-
"
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
"
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
push(new
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
"
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
"
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
"
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
getReferenceType as
|
|
61
|
-
isTypeReference as
|
|
62
|
-
|
|
63
|
-
r
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
"
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
"
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
e
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
"
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
e)
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
"
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
e
|
|
111
|
-
"
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
i.
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
a.
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
1
|
+
var Me=Object.defineProperty;var n=(e,r)=>Me(e,"name",{value:r,configurable:!0});import{registerTriggers as $r}from"@ez4/common/library";import{registerTriggers as Wr}from"@ez4/schema/library";
|
|
2
|
+
import{tryCreateTrigger as Vr}from"@ez4/project/library";import{DuplicateServiceError as Ir,InvalidServicePropertyError as Dr,isExternalDeclaration as Er,
|
|
3
|
+
isClassDeclaration as Rr,getLinkedServiceList as Or,getLinkedVariableList as kr,
|
|
4
|
+
getPropertyTuple as wr,getModelMembers as jr,hasHeritageType as Pr}from"@ez4/common/library";
|
|
5
|
+
import{isModelProperty as Ar}from"@ez4/reflection";import{isObjectWith as Cr}from"@ez4/utils";import{createServiceMetadata as xe}from"@ez4/project/library";var _="@ez4/database",_r=n(e=>e.type===_,"isDatabaseService"),B=n(e=>({...xe(_,e),
|
|
6
|
+
variables:{},services:{}}),"createDatabaseService");import{IncompleteTypeError as he}from"@ez4/common/library";var u=class extends he{static{n(this,"IncompleteServiceError")}constructor(r,t){
|
|
7
|
+
super("Incomplete database service",r,t)}};import{IncorrectTypeError as Se,InvalidTypeError as ve,TypeError as x}from"@ez4/common/library";var f=class extends ve{static{n(this,"InvalidRelationsTypeError")}constructor(r){
|
|
8
|
+
super("Invalid table relations type",void 0,"Database.Relations",r)}},y=class extends Se{constructor(t,a){
|
|
9
|
+
super("Incorrect table relations type",t,"Database.Relations",a);this.relationType=
|
|
10
|
+
t}static{n(this,"IncorrectRelationsTypeError")}},T=class extends x{constructor(t,a){
|
|
11
|
+
super(`Target ${t} must follow the pattern 'column@alias'.`,a);this.relationSource=
|
|
12
|
+
t}static{n(this,"InvalidRelationTargetError")}},g=class extends x{constructor(t,a){
|
|
13
|
+
super(`Relation table ${t} don't exists.`,a);this.relationTable=t}static{n(this,
|
|
14
|
+
"InvalidRelationTableError")}},b=class extends x{constructor(t,a){super(`Relatio\
|
|
15
|
+
n column ${t} don't exists.`,a);this.relationColumn=t}static{n(this,"InvalidRela\
|
|
16
|
+
tionColumnError")}},M=class extends x{constructor(t,a){super(`Relation alias ${t}\
|
|
17
|
+
can't override table columns.`,a);this.relationAlias=t}static{n(this,"InvalidRe\
|
|
18
|
+
lationAliasError")}};import{InvalidServicePropertyError as Re,isModelDeclaration as Oe,getModelMembers as ke,
|
|
19
|
+
getPropertyNumber as we,getObjectMembers as je,getReferenceType as Pe,hasHeritageType as Ae}from"@ez4/common/library";
|
|
20
|
+
import{isModelProperty as Ce,isTypeObject as ze,isTypeReference as He}from"@ez4/reflection";
|
|
21
|
+
import{isAnyNumber as Fe,isObjectWith as Ne}from"@ez4/utils";import{IncompleteTypeError as Ie,IncorrectTypeError as De,InvalidTypeError as Ee}from"@ez4/common/library";var h=class extends Ie{static{n(this,"IncompleteScalabilityError")}constructor(r,t){
|
|
22
|
+
super("Incomplete database scalability",r,t)}},S=class extends Ee{static{n(this,
|
|
23
|
+
"InvalidScalabilityTypeError")}constructor(r){super("Invalid database scalabilit\
|
|
24
|
+
y type",void 0,"Database.Scalability",r)}},v=class extends De{constructor(t,a){super(
|
|
25
|
+
"Incorrect database scalability type",t,"Database.Scalability",a);this.scalabilityType=
|
|
26
|
+
t}static{n(this,"IncorrectScalabilityTypeError")}};var $e=n(e=>Ae(e,"Database.Scalability"),"isDatabaseScalabilityDeclaration"),K=n(
|
|
27
|
+
(e,r,t,a)=>{if(!He(e))return G(e,r,a);let o=Pe(e,t);if(o)return G(o,r,a)},"getDa\
|
|
28
|
+
tabaseScalabilityMetadata"),We=n(e=>Ne(e,["minCapacity","maxCapacity"]),"isCompl\
|
|
29
|
+
eteScalability"),G=n((e,r,t)=>{if(ze(e))return J(e,r,je(e),t);if(!Oe(e)){t.push(
|
|
30
|
+
new S(r.file));return}if(!$e(e)){t.push(new v(e.name,e.file));return}return J(e,
|
|
31
|
+
r,ke(e),t)},"getTypeScalability"),J=n((e,r,t,a)=>{let o={},i=new Set(["minCapaci\
|
|
32
|
+
ty","maxCapacity"]);for(let s of t)if(!(!Ce(s)||s.inherited))switch(s.name){default:{
|
|
33
|
+
a.push(new Re(r.name,s.name,e.file));break}case"minCapacity":case"maxCapacity":{
|
|
34
|
+
let c=we(s);Fe(c)&&(o[s.name]=c,i.delete(s.name));break}}if(!We(o)){a.push(new h(
|
|
35
|
+
[...i],e.file));return}return o},"getTypeFromMembers");import{isModelProperty as _e,isTypeObject as Be,isTypeReference as Ge}from"@ez4/reflection";
|
|
36
|
+
import{isObjectWith as Je}from"@ez4/utils";import{InvalidServicePropertyError as Ke,
|
|
37
|
+
isModelDeclaration as Qe,getModelMembers as Xe,getObjectMembers as Ye,getPropertyString as Ze,
|
|
38
|
+
getPropertyStringIn as m,getReferenceType as Le,hasHeritageType as et}from"@ez4/common/library";import{IncompleteTypeError as Ve,IncorrectTypeError as Ue,InvalidTypeError as qe}from"@ez4/common/library";var I=class extends Ve{static{n(this,"IncompleteEngineError")}constructor(r,t){super(
|
|
39
|
+
"Incomplete database engine",r,t)}},D=class extends qe{static{n(this,"InvalidEng\
|
|
40
|
+
ineTypeError")}constructor(r){super("Invalid database engine type",void 0,"Datab\
|
|
41
|
+
ase.Engine",r)}},E=class extends Ue{constructor(t,a){super("Incorrect database e\
|
|
42
|
+
ngine type",t,"Database.Engine",a);this.engineType=t}static{n(this,"IncorrectEng\
|
|
43
|
+
ineTypeError")}};var tt=n(e=>et(e,"Database.Engine"),"isDatabaseEngineDeclaration"),Y=n((e,r,t,a)=>{
|
|
44
|
+
if(!Ge(e))return Q(e,r,a);let o=Le(e,t);if(o)return Q(o,r,a)},"getDatabaseEngine\
|
|
45
|
+
Metadata"),rt=n(e=>Je(e,["name","parametersMode","transactionMode","insensitiveM\
|
|
46
|
+
ode","paginationMode","orderMode"]),"isCompleteEngine"),Q=n((e,r,t)=>{if(Be(e))return X(
|
|
47
|
+
e,r,Ye(e),t);if(!Qe(e)){t.push(new D(r.file));return}if(!tt(e)){t.push(new E(e.name,
|
|
48
|
+
e.file));return}return X(e,r,Xe(e),t)},"getTypeEngine"),X=n((e,r,t,a)=>{let o={},
|
|
49
|
+
i=new Set(["name","parametersMode","transactionMode","insensitiveMode","paginati\
|
|
50
|
+
onMode","orderMode"]);for(let s of t)if(!(!_e(s)||s.inherited))switch(s.name){default:{
|
|
51
|
+
a.push(new Ke(r.name,s.name,e.file));break}case"name":{(o.name=Ze(s))&&i.delete(
|
|
52
|
+
s.name);break}case"parametersMode":{(o.parametersMode=m(s,["index","both"]))&&i.
|
|
53
|
+
delete(s.name);break}case"transactionMode":{(o.transactionMode=m(s,["static","in\
|
|
54
|
+
teractive"]))&&i.delete(s.name);break}case"insensitiveMode":{(o.insensitiveMode=
|
|
55
|
+
m(s,["unsupported","enabled"]))&&i.delete(s.name);break}case"paginationMode":{(o.
|
|
56
|
+
paginationMode=m(s,["cursor","offset"]))&&i.delete(s.name);break}case"orderMode":{
|
|
57
|
+
(o.orderMode=m(s,["any","index"]))&&i.delete(s.name);break}case"lockMode":{(o.lockMode=
|
|
58
|
+
m(s,["unsupported","supported"]))&&i.delete(s.name);break}}if(!rt(o)){a.push(new I(
|
|
59
|
+
[...i],e.file));return}return o},"getTypeFromMembers");import{InvalidServicePropertyError as pr,isModelDeclaration as mr,getModelMembers as dr,
|
|
60
|
+
getObjectMembers as br,getPropertyString as ur,getReferenceType as fr,hasHeritageType as yr}from"@ez4/common/library";
|
|
61
|
+
import{isModelProperty as Tr,isTypeObject as gr,isTypeReference as Mr}from"@ez4/reflection";
|
|
62
|
+
import{isObjectWith as xr}from"@ez4/utils";import{IncompleteTypeError as at,IncorrectTypeError as nt,InvalidTypeError as ot}from"@ez4/common/library";var R=class extends at{static{n(this,"IncompleteTableError")}constructor(r,t){super(
|
|
63
|
+
"Incomplete database table",r,t)}},O=class extends ot{static{n(this,"InvalidTabl\
|
|
64
|
+
eTypeError")}constructor(r){super("Invalid database table type",void 0,"Database\
|
|
65
|
+
.Table",r)}},k=class extends nt{constructor(t,a){super("Incorrect database table\
|
|
66
|
+
type",t,"Database.Table",a);this.tableType=t}static{n(this,"IncorrectTableTypeE\
|
|
67
|
+
rror")}};import{IncorrectTypeError as it,InvalidTypeError as st,TypeError as Z}from"@ez4/common/library";var w=class extends st{static{n(this,"InvalidIndexesTypeError")}constructor(r){super(
|
|
68
|
+
"Invalid table indexes type",void 0,"Database.Indexes",r)}},j=class extends it{constructor(t,a){
|
|
69
|
+
super("Incorrect table indexes type",t,"Database.Indexes",a);this.indexType=t}static{
|
|
70
|
+
n(this,"IncorrectIndexesTypeError")}},P=class extends Z{constructor(t,a){super(`\
|
|
71
|
+
Invalid index type, ${t} must follow one of the Index options.`,a);this.indexName=
|
|
72
|
+
t}static{n(this,"InvalidIndexTypeError")}},A=class extends Z{constructor(t,a){super(
|
|
73
|
+
`Invalid index reference, ${t} must be valid column.`,a);this.indexName=t}static{
|
|
74
|
+
n(this,"InvalidIndexReferenceError")}};import{isModelDeclaration as ct,getModelMembers as lt,getObjectMembers as pt,getPropertyString as mt,
|
|
75
|
+
getReferenceType as dt,hasHeritageType as bt}from"@ez4/common/library";import{isModelProperty as ut,
|
|
76
|
+
isTypeObject as ft,isTypeReference as yt}from"@ez4/reflection";var Tt=n(e=>bt(e,"Database.Relations"),"isTableRelationsDeclaration"),te=n((e,r,t,a)=>{
|
|
77
|
+
if(!yt(e))return L(e,r,a);let o=dt(e,t);if(o)return L(o,r,a)},"getTableRelations\
|
|
78
|
+
Metadata"),L=n((e,r,t)=>{if(ft(e))return ee(e,pt(e),t);if(!ct(e)){t.push(new f(r.
|
|
79
|
+
file));return}if(!Tt(e)){t.push(new y(e.name,e.file));return}return ee(e,lt(e),t)},
|
|
80
|
+
"getTypeRelations"),ee=n((e,r,t)=>{let a=[];for(let o of r){if(!ut(o)||o.inherited)
|
|
81
|
+
continue;let i=mt(o),s=o.name;if(!i){t.push(new T(s,e.file));return}let[c,l]=s.split(
|
|
82
|
+
"@",2),[p,d]=i.split(":",2);a.push({sourceTable:p,sourceColumn:d,targetColumn:c,
|
|
83
|
+
targetAlias:l})}return a},"getTypeFromMembers");import{isModelDeclaration as gt,getModelMembers as Mt,getObjectMembers as xt,getPropertyString as ht,
|
|
84
|
+
getReferenceType as St,hasHeritageType as vt}from"@ez4/common/library";import{isModelProperty as It,
|
|
85
|
+
isTypeObject as Dt,isTypeReference as Et}from"@ez4/reflection";var Rt=n(e=>vt(e,"Database.Indexes"),"isTableIndexesDeclaration"),ne=n((e,r,t,a)=>{
|
|
86
|
+
if(!Et(e))return re(e,r,a);let o=St(e,t);if(o)return re(o,r,a)},"getTableIndexes\
|
|
87
|
+
Metadata"),re=n((e,r,t)=>{if(Dt(e))return ae(e,xt(e),t);if(!gt(e)){t.push(new w(
|
|
88
|
+
r.file));return}if(!Rt(e)){t.push(new j(e.name,e.file));return}return ae(e,Mt(e),
|
|
89
|
+
t)},"getTypeIndexes"),ae=n((e,r,t)=>{let a=[];for(let o of r){if(!It(o)||o.inherited)
|
|
90
|
+
continue;let i=o.name,s=ht(o);switch(s){case"primary":case"secondary":case"uniqu\
|
|
91
|
+
e":case"ttl":{a.push({name:i,columns:i.split(":"),type:s});break}default:{t.push(
|
|
92
|
+
new P(i,e.file));return}}}return a},"getTypeFromMembers");import{isTypeObject as wt,isTypeReference as jt}from"@ez4/reflection";import{getReferenceType as Pt,
|
|
93
|
+
hasHeritageType as At,isModelDeclaration as Ct}from"@ez4/common/library";import{
|
|
94
|
+
createSchemaContext as zt,isObjectSchema as Ht}from"@ez4/schema";import{getObjectSchema as Ft}from"@ez4/schema/library";import{IncorrectTypeError as Ot,InvalidTypeError as kt}from"@ez4/common/library";var C=class extends kt{static{n(this,"InvalidSchemaTypeError")}constructor(r){super(
|
|
95
|
+
"Invalid table schema type",void 0,"Database.Schema",r)}},z=class extends Ot{constructor(t,a){
|
|
96
|
+
super("Incorrect table schema type",t,"Database.Schema",a);this.schemaType=t}static{
|
|
97
|
+
n(this,"IncorrectSchemaTypeError")}};var Nt=n(e=>At(e,"Database.Schema"),"isTableSchemaDeclaration"),se=n((e,r,t,a)=>{
|
|
98
|
+
if(!jt(e))return oe(e,r,t,a);let o=Pt(e,t);if(o)return oe(o,r,t,a)},"getTableSch\
|
|
99
|
+
emaMetadata"),oe=n((e,r,t,a)=>{if(wt(e))return ie(e,t);if(!Ct(e)){a.push(new C(r.
|
|
100
|
+
file));return}if(!Nt(e)){a.push(new z(e.name,e.file));return}return ie(e,t)},"ge\
|
|
101
|
+
tTypeSchema"),ie=n((e,r)=>{let t=Ft(e,r,zt({nullish:!0}));if(t&&Ht(t))return t},
|
|
102
|
+
"getSchema");import{InvalidServicePropertyError as Jt,isModelDeclaration as Kt,getLinkedVariableList as Qt,
|
|
103
|
+
getModelMembers as Xt,getObjectMembers as Yt,getPropertyNumber as Zt,getServiceListener as Lt,
|
|
104
|
+
getServiceArchitecture as er,getServiceRuntime as tr,getReferenceType as rr,hasHeritageType as ar}from"@ez4/common/library";
|
|
105
|
+
import{isModelProperty as nr,isTypeObject as or,isTypeReference as ir}from"@ez4/reflection";
|
|
106
|
+
import{isObjectWith as sr}from"@ez4/utils";import{IncompleteTypeError as $t,IncorrectTypeError as Wt,InvalidTypeError as Vt}from"@ez4/common/library";var H=class extends $t{static{n(this,"IncompleteStreamError")}constructor(r,t){super(
|
|
107
|
+
"Incomplete table stream",r,t)}},F=class extends Vt{static{n(this,"InvalidStream\
|
|
108
|
+
TypeError")}constructor(r){super("Invalid table stream type",void 0,"Database.St\
|
|
109
|
+
ream",r)}},N=class extends Wt{constructor(t,a){super("Incorrect table stream typ\
|
|
110
|
+
e",t,"Database.Stream",a);this.streamType=t}static{n(this,"IncorrectStreamTypeEr\
|
|
111
|
+
ror")}};import{isTypeCallback as qt,isTypeFunction as _t}from"@ez4/reflection";import{getFunctionSignature as Bt}from"@ez4/common/library";import{IncompleteTypeError as Ut}from"@ez4/common/library";var $=class extends Ut{static{n(this,"IncompleteHandlerError")}constructor(r,t){
|
|
112
|
+
super("Incomplete stream handler",r,t)}};var Gt=n(e=>qt(e)||_t(e),"isStreamHandlerDeclaration"),ce=n((e,r,t)=>{if(!Gt(e))
|
|
113
|
+
return;let a=Bt(e),o=new Set(["change"]);if(e.parameters&&o.delete("change"),!a||
|
|
114
|
+
o.size){t.push(new $([...o],e.file));return}return a},"getStreamHandlerMetadata");var cr=n(e=>ar(e,"Database.Stream"),"isTableStreamDeclaration"),me=n((e,r,t,a)=>{
|
|
115
|
+
if(!ir(e))return le(e,r,t,a);let o=rr(e,t);if(o)return le(o,r,t,a)},"getTableStr\
|
|
116
|
+
eamMetadata"),lr=n(e=>sr(e,["handler"]),"isCompleteStream"),le=n((e,r,t,a)=>{if(or(
|
|
117
|
+
e))return pe(e,r,Yt(e),t,a);if(!Kt(e)){a.push(new F(r.file));return}if(!cr(e)){a.
|
|
118
|
+
push(new N(e.name,e.file));return}return pe(e,r,Xt(e),t,a)},"getTypeStream"),pe=n(
|
|
119
|
+
(e,r,t,a,o)=>{let i={},s=new Set(["handler"]);for(let c of t)if(!(!nr(c)||c.inherited))
|
|
120
|
+
switch(c.name){default:{o.push(new Jt(r.name,c.name,e.file));break}case"handler":{
|
|
121
|
+
i.handler=ce(c.value,a,o);break}case"listener":{i.listener=Lt(c.value,o);break}case"\
|
|
122
|
+
memory":case"logRetention":case"timeout":{i[c.name]=Zt(c);break}case"architectur\
|
|
123
|
+
e":{i[c.name]=er(c);break}case"runtime":{i[c.name]=tr(c);break}case"variables":{
|
|
124
|
+
i.variables=Qt(c,o);break}}if(!lr(i)){o.push(new H([...s],e.file));return}return i},
|
|
125
|
+
"getTypeFromMembers");var hr=n(e=>yr(e,"Database.Table"),"isDatabaseTableDeclaration"),ue=n((e,r,t,a)=>{
|
|
126
|
+
if(!Mr(e))return de(e,r,t,a);let o=fr(e,t);if(o)return de(o,r,t,a)},"getDatabase\
|
|
127
|
+
TableMetadata"),Sr=n(e=>xr(e,["name","schema","indexes"]),"isCompleteTable"),de=n(
|
|
128
|
+
(e,r,t,a)=>{if(gr(e))return be(e,r,br(e),t,a);if(!mr(e)){a.push(new O(r.file));return}
|
|
129
|
+
if(!hr(e)){a.push(new k(e.name,e.file));return}return be(e,r,dr(e),t,a)},"getTyp\
|
|
130
|
+
eTable"),be=n((e,r,t,a,o)=>{let i={},s=new Set(["name","schema","indexes"]);for(let l of t)
|
|
131
|
+
if(!(!Tr(l)||l.inherited))switch(l.name){default:{o.push(new pr(r.name,l.name,e.
|
|
132
|
+
file));break}case"name":{(i.name=ur(l))&&s.delete(l.name);break}case"schema":{(i.
|
|
133
|
+
schema=se(l.value,e,a,o))&&s.delete(l.name);break}case"indexes":{(i.indexes=ne(l.
|
|
134
|
+
value,e,a,o))&&s.delete(l.name);break}case"relations":{i.relations=te(l.value,e,
|
|
135
|
+
a,o);break}case"stream":{i.stream=me(l.value,r,a,o);break}}if(!Sr(i)){o.push(new R(
|
|
136
|
+
[...s],e.file));return}let c=vr(e,i.indexes,i.schema);if(c.length){o.push(...c);
|
|
137
|
+
return}return i},"getTypeFromMembers"),vr=n((e,r,t)=>{let a=t.properties,o=[];for(let{
|
|
138
|
+
name:i,columns:s}of r)s.some(l=>!a[l])&&o.push(new A(i,e.file));return o},"valid\
|
|
139
|
+
ateIndexes");var U=n(e=>Rr(e)&&Pr(e,"Database.Service"),"isDatabaseServiceDeclaration"),ye=n(
|
|
140
|
+
e=>{let r={},t=[];for(let a in e){let o=e[a];if(!U(o)||Er(o))continue;let i=B(o.
|
|
141
|
+
name),s=new Set(["engine","tables"]),c=o.file;for(let p of jr(o))if(!(!Ar(p)||p.
|
|
142
|
+
inherited))switch(p.name){default:{t.push(new Dr(i.name,p.name,c));break}case"cl\
|
|
143
|
+
ient":break;case"scalability":{i.scalability=K(p.value,o,e,t);break}case"engine":{
|
|
144
|
+
(i.engine=Y(p.value,o,e,t))&&s.delete(p.name);break}case"tables":{(i.tables=Hr(p,
|
|
145
|
+
o,e,t))&&s.delete(p.name);break}case"variables":{i.variables=kr(p,t);break}case"\
|
|
146
|
+
services":{i.services=Or(p,e,t);break}}if(!zr(i)){t.push(new u([...s],c));continue}
|
|
147
|
+
let l=Fr(o,i.tables);if(l.length){t.push(...l);continue}if(r[o.name]){t.push(new Ir(
|
|
148
|
+
o.name,c));continue}r[o.name]=i}return{services:r,errors:t}},"getDatabaseService\
|
|
149
|
+
sMetadata"),zr=n(e=>Cr(e,["engine","tables","variables","services"]),"isComplete\
|
|
150
|
+
Service"),Hr=n((e,r,t,a)=>{let o=wr(e)??[],i=[];for(let s of o){let c=ue(s,r,t,a);
|
|
151
|
+
c&&i.push(c)}return i},"getAllTables"),Fr=n((e,r)=>{let t=Nr(r),a=[];for(let{relations:o,
|
|
152
|
+
schema:i,indexes:s}of r){if(!o)continue;let c=i.properties;for(let l of o){let{sourceTable:p,
|
|
153
|
+
sourceColumn:d,targetColumn:W,targetAlias:q}=l;c[W]||a.push(new b(W,e.file)),c[q]&&
|
|
154
|
+
a.push(new M(q,e.file));let V=t[p]?.schema.properties;V||a.push(new g(p,e.file)),
|
|
155
|
+
V&&!V[d]&&a.push(new b(d,e.file));let ge=t[p]?.indexes??[];l.sourceIndex=fe(ge,d),
|
|
156
|
+
l.targetIndex=fe(s,W)}}return a},"validateRelations"),fe=n((e,r)=>e.find(({name:t})=>t===
|
|
157
|
+
r)?.type,"getIndexType"),Nr=n(e=>e.reduce((r,t)=>({...r,[t.name]:t}),{}),"getTab\
|
|
158
|
+
leMap");var Te=n(e=>U(e)?e.name:null,"getLinkedService");var Nn=n(()=>{$r(),Wr(),Vr("@ez4/database",{"metadata:getServices":ye,"metadata:\
|
|
159
|
+
getLinkedService":Te})},"registerTriggers");export{I as IncompleteEngineError,$ as IncompleteHandlerError,h as IncompleteScalabilityError,
|
|
160
|
+
u as IncompleteServiceError,H as IncompleteStreamError,R as IncompleteTableError,
|
|
161
|
+
E as IncorrectEngineTypeError,j as IncorrectIndexesTypeError,y as IncorrectRelationsTypeError,
|
|
162
|
+
v as IncorrectScalabilityTypeError,z as IncorrectSchemaTypeError,N as IncorrectStreamTypeError,
|
|
163
|
+
k as IncorrectTableTypeError,D as InvalidEngineTypeError,A as InvalidIndexReferenceError,
|
|
164
|
+
P as InvalidIndexTypeError,w as InvalidIndexesTypeError,M as InvalidRelationAliasError,
|
|
165
|
+
b as InvalidRelationColumnError,g as InvalidRelationTableError,T as InvalidRelationTargetError,
|
|
166
|
+
f as InvalidRelationsTypeError,S as InvalidScalabilityTypeError,C as InvalidSchemaTypeError,
|
|
167
|
+
F as InvalidStreamTypeError,O as InvalidTableTypeError,_ as ServiceType,B as createDatabaseService,
|
|
168
|
+
ye as getDatabaseServicesMetadata,ue as getDatabaseTableMetadata,se as getTableSchemaMetadata,
|
|
169
|
+
_r as isDatabaseService,U as isDatabaseServiceDeclaration,hr as isDatabaseTableDeclaration,
|
|
170
|
+
Nt as isTableSchemaDeclaration,Nn as registerTriggers};
|
|
146
171
|
//# sourceMappingURL=library.mjs.map
|
package/dist/main.cjs
CHANGED
|
@@ -1,9 +1,12 @@
|
|
|
1
|
-
"use strict";var o=Object.defineProperty;var
|
|
2
|
-
typeof
|
|
3
|
-
o(
|
|
4
|
-
OrderMode:()=>
|
|
5
|
-
TransactionMode:()=>
|
|
6
|
-
|
|
7
|
-
|
|
1
|
+
"use strict";var o=Object.defineProperty;var x=Object.getOwnPropertyDescriptor;var S=Object.getOwnPropertyNames;var u=Object.prototype.hasOwnProperty;var f=(a,r)=>{for(var e in r)o(a,e,{get:r[e],enumerable:!0})},h=(a,r,e,n)=>{if(r&&
|
|
2
|
+
typeof r=="object"||typeof r=="function")for(let t of S(r))!u.call(a,t)&&t!==e&&
|
|
3
|
+
o(a,t,{get:()=>r[t],enumerable:!(n=x(r,t))||n.enumerable});return a};var g=a=>h(o({},"__esModule",{value:!0}),a);var C={};f(C,{Database:()=>p,Index:()=>l,InsensitiveMode:()=>c,LockMode:()=>b,Order:()=>i,
|
|
4
|
+
OrderMode:()=>d,PaginationMode:()=>T,ParametersMode:()=>s,StreamChangeType:()=>m,
|
|
5
|
+
TransactionMode:()=>y});module.exports=g(C);var m=(n=>(n.Insert="insert",n.Update="update",n.Delete="delete",n))(m||{});var p;(a=>{})(p||={});var l=(t=>(t.Primary="primary",t.Secondary="secondary",t.Unique="unique",t.TTL="\
|
|
6
|
+
ttl",t))(l||{});var i=(e=>(e.Asc="asc",e.Desc="desc",e))(i||{});var s=(e=>(e.NameAndIndex="both",e.OnlyIndex="index",e))(s||{}),y=(e=>(e.Interactive=
|
|
7
|
+
"interactive",e.Static="static",e))(y||{}),c=(e=>(e.Unsupported="unsupported",e.
|
|
8
|
+
Enabled="enabled",e))(c||{}),T=(e=>(e.Cursor="cursor",e.Offset="offset",e))(T||{}),
|
|
9
|
+
d=(e=>(e.IndexColumns="index",e.AnyColumns="any",e))(d||{}),b=(e=>(e.Unsupported=
|
|
10
|
+
"unsupported",e.Supported="supported",e))(b||{});0&&(module.exports={Database,Index,InsensitiveMode,LockMode,Order,OrderMode,PaginationMode,
|
|
8
11
|
ParametersMode,StreamChangeType,TransactionMode});
|
|
9
12
|
//# sourceMappingURL=main.cjs.map
|
package/dist/main.d.ts
CHANGED
|
@@ -2,13 +2,15 @@ export { StreamAnyChange, StreamDeleteChange, StreamInsertChange, StreamUpdateCh
|
|
|
2
2
|
export { Client } from './services/client';
|
|
3
3
|
export { RelationMetadata } from './services/relations';
|
|
4
4
|
export { TableMetadata, Table } from './services/table';
|
|
5
|
-
export {
|
|
6
|
-
export {
|
|
7
|
-
export {
|
|
8
|
-
export {
|
|
9
|
-
export {
|
|
10
|
-
export {
|
|
5
|
+
export { ParametersModeUtils } from './services/parameters';
|
|
6
|
+
export { TransactionModeUtils } from './services/transaction';
|
|
7
|
+
export { InsensitiveModeUtils } from './services/insensitive';
|
|
8
|
+
export { PaginationModeUtils } from './services/pagination';
|
|
9
|
+
export { OrderModeUtils } from './services/order';
|
|
10
|
+
export { LockModeUtils } from './services/lock';
|
|
11
11
|
export { EngineUtils } from './services/engine';
|
|
12
12
|
export { Database } from './services/contract';
|
|
13
|
-
export { Index } from './services/indexes';
|
|
14
13
|
export { Query } from './services/query';
|
|
14
|
+
export * from './types/index';
|
|
15
|
+
export * from './types/order';
|
|
16
|
+
export * from './types/mode';
|
package/dist/main.mjs
CHANGED
|
@@ -1,5 +1,8 @@
|
|
|
1
|
-
var
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
1
|
+
var a=(r=>(r.Insert="insert",r.Update="update",r.Delete="delete",r))(a||{});var n;(T=>{})(n||={});var o=(t=>(t.Primary="primary",t.Secondary="secondary",t.Unique="unique",t.TTL="\
|
|
2
|
+
ttl",t))(o||{});var m=(e=>(e.Asc="asc",e.Desc="desc",e))(m||{});var p=(e=>(e.NameAndIndex="both",e.OnlyIndex="index",e))(p||{}),l=(e=>(e.Interactive=
|
|
3
|
+
"interactive",e.Static="static",e))(l||{}),i=(e=>(e.Unsupported="unsupported",e.
|
|
4
|
+
Enabled="enabled",e))(i||{}),s=(e=>(e.Cursor="cursor",e.Offset="offset",e))(s||{}),
|
|
5
|
+
y=(e=>(e.IndexColumns="index",e.AnyColumns="any",e))(y||{}),c=(e=>(e.Unsupported=
|
|
6
|
+
"unsupported",e.Supported="supported",e))(c||{});export{n as Database,o as Index,i as InsensitiveMode,c as LockMode,m as Order,y as OrderMode,
|
|
7
|
+
s as PaginationMode,p as ParametersMode,a as StreamChangeType,l as TransactionMode};
|
|
5
8
|
//# sourceMappingURL=main.mjs.map
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
-
import type { AllType,
|
|
2
|
-
import type { DatabaseEngine } from '
|
|
3
|
-
export declare const
|
|
1
|
+
import type { AllType, ReflectionTypes, TypeModel } from '@ez4/reflection';
|
|
2
|
+
import type { DatabaseEngine } from './types';
|
|
3
|
+
export declare const isDatabaseEngineDeclaration: (type: TypeModel) => boolean;
|
|
4
|
+
export declare const getDatabaseEngineMetadata: (type: AllType, parent: TypeModel, reflection: ReflectionTypes, errorList: Error[]) => DatabaseEngine | undefined;
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import type { AllType,
|
|
2
|
-
|
|
3
|
-
export declare const
|
|
1
|
+
import type { AllType, ReflectionTypes, TypeCallback, TypeFunction } from '@ez4/reflection';
|
|
2
|
+
export declare const isStreamHandlerDeclaration: (type: AllType) => type is TypeCallback | TypeFunction;
|
|
3
|
+
export declare const getStreamHandlerMetadata: (type: AllType, _reflection: ReflectionTypes, errorList: Error[]) => import("@ez4/common/library").FunctionSignature | undefined;
|
|
@@ -1,5 +1,6 @@
|
|
|
1
|
-
import type { AllType,
|
|
2
|
-
import type { TableIndex } from '
|
|
1
|
+
import type { AllType, ReflectionTypes, TypeModel, TypeObject } from '@ez4/reflection';
|
|
2
|
+
import type { TableIndex } from './types';
|
|
3
3
|
type TypeParent = TypeModel | TypeObject;
|
|
4
|
-
export declare const
|
|
4
|
+
export declare const isTableIndexesDeclaration: (type: TypeModel) => boolean;
|
|
5
|
+
export declare const getTableIndexesMetadata: (type: AllType, parent: TypeParent, reflection: ReflectionTypes, errorList: Error[]) => TableIndex[] | undefined;
|
|
5
6
|
export {};
|
|
@@ -1,5 +1,6 @@
|
|
|
1
|
-
import type { AllType,
|
|
2
|
-
import type { TableRelation } from '
|
|
1
|
+
import type { AllType, ReflectionTypes, TypeModel, TypeObject } from '@ez4/reflection';
|
|
2
|
+
import type { TableRelation } from './types';
|
|
3
3
|
type TypeParent = TypeModel | TypeObject;
|
|
4
|
-
export declare const
|
|
4
|
+
export declare const isTableRelationsDeclaration: (type: TypeModel) => boolean;
|
|
5
|
+
export declare const getTableRelationsMetadata: (type: AllType, parent: TypeParent, reflection: ReflectionTypes, errorList: Error[]) => TableRelation[] | undefined;
|
|
5
6
|
export {};
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
-
import type { AllType,
|
|
2
|
-
import type { DatabaseScalability } from '
|
|
3
|
-
export declare const
|
|
1
|
+
import type { AllType, ReflectionTypes, TypeModel } from '@ez4/reflection';
|
|
2
|
+
import type { DatabaseScalability } from './types';
|
|
3
|
+
export declare const isDatabaseScalabilityDeclaration: (type: TypeModel) => boolean;
|
|
4
|
+
export declare const getDatabaseScalabilityMetadata: (type: AllType, parent: TypeModel, reflection: ReflectionTypes, errorList: Error[]) => DatabaseScalability | undefined;
|
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
import type { AllType,
|
|
1
|
+
import type { AllType, ReflectionTypes, TypeModel, TypeObject } from '@ez4/reflection';
|
|
2
2
|
type TypeParent = TypeModel | TypeObject;
|
|
3
|
-
export declare const
|
|
3
|
+
export declare const isTableSchemaDeclaration: (type: TypeModel) => boolean;
|
|
4
|
+
export declare const getTableSchemaMetadata: (type: AllType, parent: TypeParent, reflection: ReflectionTypes, errorList: Error[]) => import("@ez4/schema").ObjectSchema | undefined;
|
|
4
5
|
export {};
|
|
@@ -1,6 +1,7 @@
|
|
|
1
|
-
import type {
|
|
2
|
-
import type { DatabaseService } from '
|
|
3
|
-
export declare const
|
|
1
|
+
import type { AllType, ReflectionTypes, TypeClass } from '@ez4/reflection';
|
|
2
|
+
import type { DatabaseService } from './types';
|
|
3
|
+
export declare const isDatabaseServiceDeclaration: (type: AllType) => type is TypeClass;
|
|
4
|
+
export declare const getDatabaseServicesMetadata: (reflection: ReflectionTypes) => {
|
|
4
5
|
services: Record<string, DatabaseService>;
|
|
5
6
|
errors: Error[];
|
|
6
7
|
};
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
-
import type { AllType,
|
|
2
|
-
import type { TableStream } from '
|
|
3
|
-
export declare const
|
|
1
|
+
import type { AllType, ReflectionTypes, TypeModel } from '@ez4/reflection';
|
|
2
|
+
import type { TableStream } from './types';
|
|
3
|
+
export declare const isTableStreamDeclaration: (type: TypeModel) => boolean;
|
|
4
|
+
export declare const getTableStreamMetadata: (type: AllType, parent: TypeModel, reflection: ReflectionTypes, errorList: Error[]) => TableStream | undefined;
|
package/dist/metadata/table.d.ts
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
-
import type { AllType,
|
|
2
|
-
import type { DatabaseTable } from '
|
|
3
|
-
export declare const
|
|
1
|
+
import type { AllType, ReflectionTypes, TypeModel } from '@ez4/reflection';
|
|
2
|
+
import type { DatabaseTable } from './types';
|
|
3
|
+
export declare const isDatabaseTableDeclaration: (type: TypeModel) => boolean;
|
|
4
|
+
export declare const getDatabaseTableMetadata: (type: AllType, parent: TypeModel, reflection: ReflectionTypes, errorList: Error[]) => DatabaseTable | undefined;
|