@ez4/storage 0.15.0 → 0.16.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
@@ -1,55 +1,53 @@
1
- "use strict";var I=Object.defineProperty;var W=Object.getOwnPropertyDescriptor;var X=Object.getOwnPropertyNames;var Y=Object.prototype.hasOwnProperty;var Z=(e,t)=>{for(var r in t)I(e,r,{get:t[r],enumerable:!0})},$=(e,t,r,n)=>{if(t&&
2
- typeof t=="object"||typeof t=="function")for(let o of X(t))!Y.call(e,o)&&o!==r&&
3
- I(e,o,{get:()=>t[o],enumerable:!(n=W(t,o))||n.enumerable});return e};var ee=e=>$(I({},"__esModule",{value:!0}),e);var pe={};Z(pe,{IncompleteCorsError:()=>T,IncompleteEventError:()=>g,IncompleteServiceError:()=>d,
4
- IncorrectCorsTypeError:()=>E,IncorrectEventTypeError:()=>b,InvalidCorsTypeError:()=>S,
5
- InvalidEventTypeError:()=>k,ServiceType:()=>x,getBucketCors:()=>P,getBucketEvent:()=>w,
6
- getBucketServices:()=>j,getEventHandler:()=>C,isBucketService:()=>re,registerTriggers:()=>ce});
7
- module.exports=ee(pe);var Q=require("@ez4/common/library"),U=require("@ez4/project/library");var p=require("@ez4/common/library"),G=require("@ez4/reflection"),J=require("@ez4/utils");var x="@ez4/bucket",re=e=>e.type===x;var z=require("@ez4/common/library"),d=class extends z.IncompleteTypeError{constructor(t,r){
8
- super("Incomplete bucket service",t,r)}};var l=require("@ez4/common/library"),M=require("@ez4/reflection"),B=e=>(0,l.isClassDeclaration)(
9
- e)&&(0,l.hasHeritageType)(e,"Bucket.Service"),O=e=>(0,M.isTypeCallback)(e)||(0,M.isTypeFunction)(
10
- e),A=e=>(0,l.hasHeritageType)(e,"Bucket.Event"),H=e=>(0,l.hasHeritageType)(e,"Bu\
11
- cket.Cors");var c=require("@ez4/common/library"),f=require("@ez4/reflection"),V=require("@ez4/utils");var u=require("@ez4/common/library"),g=class extends u.IncompleteTypeError{constructor(t,r){
12
- super("Incomplete bucket event",t,r)}},k=class extends u.InvalidTypeError{constructor(t){
13
- super("Invalid bucket event type",void 0,"Bucket.Event",t)}},b=class extends u.IncorrectTypeError{constructor(r,n){
14
- super("Incorrect bucket event type",r,"Bucket.Event",n);this.eventType=r}};var N=require("@ez4/common/library"),h=class extends N.IncompleteTypeError{constructor(t,r){
15
- super("Incomplete event handler",t,r)}};var C=(e,t,r)=>{if(!O(e))return null;let n={},o=new Set(["name","file"]);return e.
1
+ "use strict";var I=Object.defineProperty;var L=Object.getOwnPropertyDescriptor;var Q=Object.getOwnPropertyNames;var U=Object.prototype.hasOwnProperty;var W=(e,r)=>{for(var t in r)I(e,t,{get:r[t],enumerable:!0})},X=(e,r,t,n)=>{if(r&&
2
+ typeof r=="object"||typeof r=="function")for(let o of Q(r))!U.call(e,o)&&o!==t&&
3
+ I(e,o,{get:()=>r[o],enumerable:!(n=L(r,o))||n.enumerable});return e};var Y=e=>X(I({},"__esModule",{value:!0}),e);var ie={};W(ie,{IncompleteCorsError:()=>b,IncompleteEventError:()=>g,IncompleteServiceError:()=>v,
4
+ IncorrectCorsTypeError:()=>x,IncorrectEventTypeError:()=>T,InvalidCorsTypeError:()=>S,
5
+ InvalidEventTypeError:()=>k,ServiceType:()=>M,getBucketCors:()=>z,getBucketEvent:()=>w,
6
+ getBucketServices:()=>P,getEventHandler:()=>C,isBucketService:()=>Z,registerTriggers:()=>ne});
7
+ module.exports=Y(ie);var J=require("@ez4/common/library"),K=require("@ez4/project/library");var l=require("@ez4/common/library"),_=require("@ez4/reflection");var M="@ez4/bucket",Z=e=>e.type===M;var j=require("@ez4/common/library"),v=class extends j.IncompleteTypeError{constructor(r,t){
8
+ super("Incomplete bucket service",r,t)}};var a=require("@ez4/common/library"),E=require("@ez4/reflection"),B=e=>(0,a.isClassDeclaration)(
9
+ e)&&(0,a.hasHeritageType)(e,"Bucket.Service"),O=e=>(0,E.isTypeCallback)(e)||(0,E.isTypeFunction)(
10
+ e),A=e=>(0,a.hasHeritageType)(e,"Bucket.Event"),H=e=>(0,a.hasHeritageType)(e,"Bu\
11
+ cket.Cors");var c=require("@ez4/common/library"),f=require("@ez4/reflection");var u=require("@ez4/common/library"),g=class extends u.IncompleteTypeError{constructor(r,t){
12
+ super("Incomplete bucket event",r,t)}},k=class extends u.InvalidTypeError{constructor(r){
13
+ super("Invalid bucket event type",void 0,"Bucket.Event",r)}},T=class extends u.IncorrectTypeError{constructor(t,n){
14
+ super("Incorrect bucket event type",t,"Bucket.Event",n);this.eventType=t}};var R=require("@ez4/common/library"),h=class extends R.IncompleteTypeError{constructor(r,t){
15
+ super("Incomplete event handler",r,t)}};var C=(e,r,t)=>{if(!O(e))return null;let n={},o=new Set(["name","file"]);return e.
16
16
  description&&(n.description=e.description),(n.name=e.name)&&o.delete("name"),(n.
17
- file=e.file)&&o.delete("file"),o.size===0&&te(n)?n:(r.push(new h([...o],e.file)),
18
- null)},te=e=>!!e.name&&!!e.file;var w=(e,t,r,n)=>{if(!(0,f.isTypeReference)(e))return D(e,t,r,n);let o=r[e.path];
19
- return o?D(o,t,r,n):null},oe=e=>!!e.handler,D=(e,t,r,n)=>(0,f.isTypeObject)(e)?R(
20
- e,(0,c.getObjectMembers)(e),r,n):(0,c.isModelDeclaration)(e)?A(e)?R(e,(0,c.getModelMembers)(
21
- e),r,n):(n.push(new b(e.name,e.file)),null):(n.push(new k(t.file)),null),R=(e,t,r,n)=>{
22
- let o={},s=new Set(["handler"]);for(let i of t)if(!(!(0,f.isModelProperty)(i)||i.
23
- inherited))switch(i.name){default:n.push(new c.InvalidServicePropertyError(parent.
24
- name,i.name,e.file));break;case"listener":{let a=(0,c.getServiceListener)(i.value,
25
- n);a&&(o.listener=a);break}case"handler":o.handler=C(i.value,r,n);break;case"pat\
26
- h":{let a=(0,c.getPropertyString)(i);a&&(o[i.name]=a);break}case"timeout":case"m\
27
- emory":{let a=(0,c.getPropertyNumber)(i);(0,V.isAnyNumber)(a)&&(o[i.name]=a);break}case"\
28
- variables":o.variables=(0,c.getLinkedVariableList)(i,n);break}return oe(o)?o:(n.
29
- push(new g([...s],e.file)),null)};var m=require("@ez4/common/library"),v=require("@ez4/reflection"),q=require("@ez4/utils");var y=require("@ez4/common/library"),T=class extends y.IncompleteTypeError{constructor(t,r){
30
- super("Incomplete bucket CORS",t,r)}},S=class extends y.InvalidTypeError{constructor(t){
31
- super("Invalid bucket CORS type",void 0,"Bucket.Cors",t)}},E=class extends y.IncorrectTypeError{constructor(r,n){
32
- super("Incorrect bucket CORS type",r,"Bucket.Cors",n);this.fallbackType=r}};var P=(e,t,r,n)=>{if(!(0,v.isTypeReference)(e))return F(e,t,n);let o=r[e.path];return o?
33
- F(o,t,n):null},ne=e=>!!e.allowOrigins?.length,F=(e,t,r)=>(0,v.isTypeObject)(e)?_(
34
- e,(0,m.getObjectMembers)(e),r):(0,m.isModelDeclaration)(e)?H(e)?_(e,(0,m.getModelMembers)(
35
- e),r):(r.push(new E(e.name,e.file)),null):(r.push(new S(t.file)),null),_=(e,t,r)=>{
36
- let n={},o=new Set(["allowOrigins"]);for(let s of t)if(!(!(0,v.isModelProperty)(
37
- s)||s.inherited))switch(s.name){default:r.push(new m.InvalidServicePropertyError(
38
- parent.name,s.name,e.file));break;case"allowOrigins":case"allowMethods":case"all\
39
- owHeaders":case"exposeHeaders":{let i=ie(s);i.length&&(n[s.name]=i);break}case"m\
40
- axAge":{let i=(0,m.getPropertyNumber)(s);(0,q.isAnyNumber)(i)&&(n[s.name]=i);break}}
41
- return ne(n)?n:(r.push(new T([...o],e.file)),null)},ie=e=>{let t=(0,m.getPropertyTuple)(
42
- e)??[],r=[];for(let n of t){let o=(0,m.getLiteralString)(n);o&&r.push(o)}return r};var j=e=>{let t={},r=[];for(let n in e){let o=e[n];if(!B(o)||(0,p.isExternalStatement)(
43
- o))continue;let s={type:x};s.name=o.name;for(let i of(0,p.getModelMembers)(o))if(!(!(0,G.isModelProperty)(
44
- i)||i.inherited))switch(i.name){default:r.push(new p.InvalidServicePropertyError(
45
- parent.name,i.name,o.file));break;case"localPath":case"globalName":{let a=(0,p.getPropertyString)(
46
- i);a&&(s[i.name]=a);break}case"autoExpireDays":{let a=(0,p.getPropertyNumber)(i);
47
- (0,J.isAnyNumber)(a)&&(s.autoExpireDays=a);break}case"events":s.events=w(i.value,
48
- o,e,r);break;case"cors":s.cors=P(i.value,o,e,r);break;case"variables":s.variables=
49
- (0,p.getLinkedVariableList)(i,r);break;case"services":s.services=(0,p.getLinkedServiceList)(
50
- i,e,r);break}if(!se(s)){r.push(new d([],o.file));continue}if(t[o.name]){r.push(new p.DuplicateServiceError(
51
- o.name,o.file));continue}t[o.name]=s}return{services:t,errors:r}},se=e=>!!e.name;var K=e=>B(e)?e.name:null;var L=!1,ce=()=>{L||((0,Q.registerTriggers)(),(0,U.createTrigger)("@ez4/bucket",
52
- {"metadata:getServices":j,"metadata:getLinkedService":K}),L=!0)};0&&(module.exports={IncompleteCorsError,IncompleteEventError,IncompleteServiceError,
17
+ file=e.file)&&o.delete("file"),o.size===0&&$(n)?n:(t.push(new h([...o],e.file)),
18
+ null)},$=e=>!!e.name&&!!e.file;var w=(e,r,t,n)=>{if(!(0,f.isTypeReference)(e))return D(e,r,t,n);let o=(0,c.getReferenceType)(
19
+ e,t);return o?D(o,r,t,n):null},ee=e=>!!e.handler,D=(e,r,t,n)=>(0,f.isTypeObject)(
20
+ e)?V(e,r,(0,c.getObjectMembers)(e),t,n):(0,c.isModelDeclaration)(e)?A(e)?V(e,r,(0,c.getModelMembers)(
21
+ e),t,n):(n.push(new T(e.name,e.file)),null):(n.push(new k(r.file)),null),V=(e,r,t,n,o)=>{
22
+ let s={},m=new Set(["handler"]);for(let i of t)if(!(!(0,f.isModelProperty)(i)||i.
23
+ inherited))switch(i.name){default:o.push(new c.InvalidServicePropertyError(r.name,
24
+ i.name,e.file));break;case"path":s.path=(0,c.getPropertyString)(i);break;case"li\
25
+ stener":s.listener=(0,c.getServiceListener)(i.value,o);break;case"handler":s.handler=
26
+ C(i.value,n,o);break;case"memory":case"timeout":s[i.name]=(0,c.getPropertyNumber)(
27
+ i);break;case"variables":s.variables=(0,c.getLinkedVariableList)(i,o);break}return ee(
28
+ s)?s:(o.push(new g([...m],e.file)),null)};var p=require("@ez4/common/library"),d=require("@ez4/reflection");var y=require("@ez4/common/library"),b=class extends y.IncompleteTypeError{constructor(r,t){
29
+ super("Incomplete bucket CORS",r,t)}},S=class extends y.InvalidTypeError{constructor(r){
30
+ super("Invalid bucket CORS type",void 0,"Bucket.Cors",r)}},x=class extends y.IncorrectTypeError{constructor(t,n){
31
+ super("Incorrect bucket CORS type",t,"Bucket.Cors",n);this.fallbackType=t}};var z=(e,r,t,n)=>{if(!(0,d.isTypeReference)(e))return N(e,r,n);let o=(0,p.getReferenceType)(
32
+ e,t);return o?N(o,r,n):null},re=e=>!!e.allowOrigins?.length,N=(e,r,t)=>(0,d.isTypeObject)(
33
+ e)?F(e,r,(0,p.getObjectMembers)(e),t):(0,p.isModelDeclaration)(e)?H(e)?F(e,r,(0,p.getModelMembers)(
34
+ e),t):(t.push(new x(e.name,e.file)),null):(t.push(new S(r.file)),null),F=(e,r,t,n)=>{
35
+ let o={},s=new Set(["allowOrigins"]);for(let m of t)if(!(!(0,d.isModelProperty)(
36
+ m)||m.inherited))switch(m.name){default:n.push(new p.InvalidServicePropertyError(
37
+ r.name,m.name,e.file));break;case"allowOrigins":case"allowMethods":case"allowHea\
38
+ ders":case"exposeHeaders":o[m.name]=te(m);break;case"maxAge":o.maxAge=(0,p.getPropertyNumber)(
39
+ m);break}return re(o)?o:(n.push(new b([...s],e.file)),null)},te=e=>{let r=(0,p.getPropertyTuple)(
40
+ e)??[],t=[];for(let n of r){let o=(0,p.getLiteralString)(n);o&&t.push(o)}return t};var P=e=>{let r={},t=[];for(let n in e){let o=e[n];if(!B(o)||(0,l.isExternalStatement)(
41
+ o))continue;let s={type:M,extras:{}},m=o.file;s.name=o.name;for(let i of(0,l.getModelMembers)(
42
+ o))if(!(!(0,_.isModelProperty)(i)||i.inherited))switch(i.name){default:t.push(new l.InvalidServicePropertyError(
43
+ s.name,i.name,m));break;case"localPath":case"globalName":s[i.name]=(0,l.getPropertyString)(
44
+ i);break;case"autoExpireDays":s.autoExpireDays=(0,l.getPropertyNumber)(i);break;case"\
45
+ events":s.events=w(i.value,o,e,t);break;case"cors":s.cors=z(i.value,o,e,t);break;case"\
46
+ variables":s.variables=(0,l.getLinkedVariableList)(i,t);break;case"services":s.services=
47
+ (0,l.getLinkedServiceList)(i,e,t);break}if(!oe(s)){t.push(new v([],m));continue}
48
+ if(r[o.name]){t.push(new l.DuplicateServiceError(o.name,m));continue}r[o.name]=s}
49
+ return{services:r,errors:t}},oe=e=>!!e.name&&!!e.extras&&!!e.extras;var q=e=>B(e)?e.name:null;var G=!1,ne=()=>{G||((0,J.registerTriggers)(),(0,K.createTrigger)("@ez4/bucket",
50
+ {"metadata:getServices":P,"metadata:getLinkedService":q}),G=!0)};0&&(module.exports={IncompleteCorsError,IncompleteEventError,IncompleteServiceError,
53
51
  IncorrectCorsTypeError,IncorrectEventTypeError,InvalidCorsTypeError,InvalidEventTypeError,
54
52
  ServiceType,getBucketCors,getBucketEvent,getBucketServices,getEventHandler,isBucketService,
55
53
  registerTriggers});
package/dist/library.mjs CHANGED
@@ -1,51 +1,47 @@
1
- import{registerTriggers as Ie}from"@ez4/common/library";import{createTrigger as Ce}from"@ez4/project/library";import{DuplicateServiceError as de,InvalidServicePropertyError as ge,isExternalStatement as ke,
2
- getLinkedVariableList as be,getLinkedServiceList as Te,getModelMembers as Se,getPropertyNumber as Ee,
3
- getPropertyString as xe}from"@ez4/common/library";import{isModelProperty as Me}from"@ez4/reflection";
4
- import{isAnyNumber as Be}from"@ez4/utils";var g="@ez4/bucket",we=e=>e.type===g;import{IncompleteTypeError as z}from"@ez4/common/library";var p=class extends z{constructor(n,r){
5
- super("Incomplete bucket service",n,r)}};import{hasHeritageType as k,isClassDeclaration as O}from"@ez4/common/library";import{
6
- isTypeCallback as A,isTypeFunction as H}from"@ez4/reflection";var a=e=>O(e)&&k(e,
7
- "Bucket.Service"),b=e=>A(e)||H(e),T=e=>k(e,"Bucket.Event"),S=e=>k(e,"Bucket.Cors");import{InvalidServicePropertyError as _,isModelDeclaration as q,getLinkedVariableList as G,
1
+ import{registerTriggers as he}from"@ez4/common/library";import{createTrigger as Ie}from"@ez4/project/library";import{DuplicateServiceError as ve,InvalidServicePropertyError as ge,isExternalStatement as ke,
2
+ getLinkedVariableList as Te,getLinkedServiceList as be,getModelMembers as Se,getPropertyNumber as xe,
3
+ getPropertyString as Me}from"@ez4/common/library";import{isModelProperty as Ee}from"@ez4/reflection";var g="@ez4/bucket",Ce=e=>e.type===g;import{IncompleteTypeError as j}from"@ez4/common/library";var p=class extends j{constructor(t,r){
4
+ super("Incomplete bucket service",t,r)}};import{hasHeritageType as k,isClassDeclaration as O}from"@ez4/common/library";import{
5
+ isTypeCallback as A,isTypeFunction as H}from"@ez4/reflection";var l=e=>O(e)&&k(e,
6
+ "Bucket.Service"),T=e=>A(e)||H(e),b=e=>k(e,"Bucket.Event"),S=e=>k(e,"Bucket.Cors");import{InvalidServicePropertyError as _,isModelDeclaration as q,getLinkedVariableList as G,
8
7
  getModelMembers as J,getObjectMembers as K,getPropertyNumber as L,getPropertyString as Q,
9
- getServiceListener as U}from"@ez4/common/library";import{isModelProperty as W,isTypeObject as X,
10
- isTypeReference as Y}from"@ez4/reflection";import{isAnyNumber as Z}from"@ez4/utils";import{IncompleteTypeError as N,IncorrectTypeError as D,InvalidTypeError as R}from"@ez4/common/library";
11
- var m=class extends N{constructor(n,r){super("Incomplete bucket event",n,r)}},l=class extends R{constructor(n){
12
- super("Invalid bucket event type",void 0,"Bucket.Event",n)}},u=class extends D{constructor(r,o){
13
- super("Incorrect bucket event type",r,"Bucket.Event",o);this.eventType=r}};import{IncompleteTypeError as V}from"@ez4/common/library";var f=class extends V{constructor(n,r){
14
- super("Incomplete event handler",n,r)}};var E=(e,n,r)=>{if(!b(e))return null;let o={},t=new Set(["name","file"]);return e.
15
- description&&(o.description=e.description),(o.name=e.name)&&t.delete("name"),(o.
16
- file=e.file)&&t.delete("file"),t.size===0&&F(o)?o:(r.push(new f([...t],e.file)),
17
- null)},F=e=>!!e.name&&!!e.file;var B=(e,n,r,o)=>{if(!Y(e))return x(e,n,r,o);let t=r[e.path];return t?x(t,n,r,o):
18
- null},$=e=>!!e.handler,x=(e,n,r,o)=>X(e)?M(e,K(e),r,o):q(e)?T(e)?M(e,J(e),r,o):(o.
19
- push(new u(e.name,e.file)),null):(o.push(new l(n.file)),null),M=(e,n,r,o)=>{let t={},
20
- s=new Set(["handler"]);for(let i of n)if(!(!W(i)||i.inherited))switch(i.name){default:
21
- o.push(new _(parent.name,i.name,e.file));break;case"listener":{let c=U(i.value,o);
22
- c&&(t.listener=c);break}case"handler":t.handler=E(i.value,r,o);break;case"path":{
23
- let c=Q(i);c&&(t[i.name]=c);break}case"timeout":case"memory":{let c=L(i);Z(c)&&(t[i.
24
- name]=c);break}case"variables":t.variables=G(i,o);break}return $(t)?t:(o.push(new m(
25
- [...s],e.file)),null)};import{InvalidServicePropertyError as oe,isModelDeclaration as ne,getLiteralString as ie,
26
- getModelMembers as se,getObjectMembers as ce,getPropertyNumber as pe,getPropertyTuple as ae}from"@ez4/common/library";
27
- import{isModelProperty as me,isTypeObject as le,isTypeReference as ue}from"@ez4/reflection";
28
- import{isAnyNumber as fe}from"@ez4/utils";import{IncompleteTypeError as ee,IncorrectTypeError as re,InvalidTypeError as te}from"@ez4/common/library";
29
- var y=class extends ee{constructor(n,r){super("Incomplete bucket CORS",n,r)}},v=class extends te{constructor(n){
30
- super("Invalid bucket CORS type",void 0,"Bucket.Cors",n)}},d=class extends re{constructor(r,o){
31
- super("Incorrect bucket CORS type",r,"Bucket.Cors",o);this.fallbackType=r}};var C=(e,n,r,o)=>{if(!ue(e))return h(e,n,o);let t=r[e.path];return t?h(t,n,o):null},
32
- ye=e=>!!e.allowOrigins?.length,h=(e,n,r)=>le(e)?I(e,ce(e),r):ne(e)?S(e)?I(e,se(e),
33
- r):(r.push(new d(e.name,e.file)),null):(r.push(new v(n.file)),null),I=(e,n,r)=>{
34
- let o={},t=new Set(["allowOrigins"]);for(let s of n)if(!(!me(s)||s.inherited))switch(s.
35
- name){default:r.push(new oe(parent.name,s.name,e.file));break;case"allowOrigins":case"\
36
- allowMethods":case"allowHeaders":case"exposeHeaders":{let i=ve(s);i.length&&(o[s.
37
- name]=i);break}case"maxAge":{let i=pe(s);fe(i)&&(o[s.name]=i);break}}return ye(o)?
38
- o:(r.push(new y([...t],e.file)),null)},ve=e=>{let n=ae(e)??[],r=[];for(let o of n){
39
- let t=ie(o);t&&r.push(t)}return r};var w=e=>{let n={},r=[];for(let o in e){let t=e[o];if(!a(t)||ke(t))continue;let s={
40
- type:g};s.name=t.name;for(let i of Se(t))if(!(!Me(i)||i.inherited))switch(i.name){default:
41
- r.push(new ge(parent.name,i.name,t.file));break;case"localPath":case"globalName":{
42
- let c=xe(i);c&&(s[i.name]=c);break}case"autoExpireDays":{let c=Ee(i);Be(c)&&(s.autoExpireDays=
43
- c);break}case"events":s.events=B(i.value,t,e,r);break;case"cors":s.cors=C(i.value,
44
- t,e,r);break;case"variables":s.variables=be(i,r);break;case"services":s.services=
45
- Te(i,e,r);break}if(!he(s)){r.push(new p([],t.file));continue}if(n[t.name]){r.push(
46
- new de(t.name,t.file));continue}n[t.name]=s}return{services:n,errors:r}},he=e=>!!e.
47
- name;var P=e=>a(e)?e.name:null;var j=!1,br=()=>{j||(Ie(),Ce("@ez4/bucket",{"metadata:getServices":w,"metadata:g\
48
- etLinkedService":P}),j=!0)};export{y as IncompleteCorsError,m as IncompleteEventError,p as IncompleteServiceError,
49
- d as IncorrectCorsTypeError,u as IncorrectEventTypeError,v as InvalidCorsTypeError,
50
- l as InvalidEventTypeError,g as ServiceType,C as getBucketCors,B as getBucketEvent,
51
- w as getBucketServices,E as getEventHandler,we as isBucketService,br as registerTriggers};
8
+ getServiceListener as U,getReferenceType as W}from"@ez4/common/library";import{isModelProperty as X,
9
+ isTypeObject as Y,isTypeReference as Z}from"@ez4/reflection";import{IncompleteTypeError as R,IncorrectTypeError as D,InvalidTypeError as V}from"@ez4/common/library";
10
+ var m=class extends R{constructor(t,r){super("Incomplete bucket event",t,r)}},a=class extends V{constructor(t){
11
+ super("Invalid bucket event type",void 0,"Bucket.Event",t)}},u=class extends D{constructor(r,n){
12
+ super("Incorrect bucket event type",r,"Bucket.Event",n);this.eventType=r}};import{IncompleteTypeError as N}from"@ez4/common/library";var f=class extends N{constructor(t,r){
13
+ super("Incomplete event handler",t,r)}};var x=(e,t,r)=>{if(!T(e))return null;let n={},o=new Set(["name","file"]);return e.
14
+ description&&(n.description=e.description),(n.name=e.name)&&o.delete("name"),(n.
15
+ file=e.file)&&o.delete("file"),o.size===0&&F(n)?n:(r.push(new f([...o],e.file)),
16
+ null)},F=e=>!!e.name&&!!e.file;var B=(e,t,r,n)=>{if(!Z(e))return M(e,t,r,n);let o=W(e,r);return o?M(o,t,r,n):null},
17
+ $=e=>!!e.handler,M=(e,t,r,n)=>Y(e)?E(e,t,K(e),r,n):q(e)?b(e)?E(e,t,J(e),r,n):(n.
18
+ push(new u(e.name,e.file)),null):(n.push(new a(t.file)),null),E=(e,t,r,n,o)=>{let s={},
19
+ c=new Set(["handler"]);for(let i of r)if(!(!X(i)||i.inherited))switch(i.name){default:
20
+ o.push(new _(t.name,i.name,e.file));break;case"path":s.path=Q(i);break;case"list\
21
+ ener":s.listener=U(i.value,o);break;case"handler":s.handler=x(i.value,n,o);break;case"\
22
+ memory":case"timeout":s[i.name]=L(i);break;case"variables":s.variables=G(i,o);break}
23
+ return $(s)?s:(o.push(new m([...c],e.file)),null)};import{InvalidServicePropertyError as oe,isModelDeclaration as ne,getLiteralString as ie,
24
+ getModelMembers as se,getObjectMembers as ce,getPropertyNumber as pe,getPropertyTuple as le,
25
+ getReferenceType as me}from"@ez4/common/library";import{isModelProperty as ae,isTypeObject as ue,
26
+ isTypeReference as fe}from"@ez4/reflection";import{IncompleteTypeError as ee,IncorrectTypeError as re,InvalidTypeError as te}from"@ez4/common/library";
27
+ var y=class extends ee{constructor(t,r){super("Incomplete bucket CORS",t,r)}},d=class extends te{constructor(t){
28
+ super("Invalid bucket CORS type",void 0,"Bucket.Cors",t)}},v=class extends re{constructor(r,n){
29
+ super("Incorrect bucket CORS type",r,"Bucket.Cors",n);this.fallbackType=r}};var C=(e,t,r,n)=>{if(!fe(e))return h(e,t,n);let o=me(e,r);return o?h(o,t,n):null},
30
+ ye=e=>!!e.allowOrigins?.length,h=(e,t,r)=>ue(e)?I(e,t,ce(e),r):ne(e)?S(e)?I(e,t,
31
+ se(e),r):(r.push(new v(e.name,e.file)),null):(r.push(new d(t.file)),null),I=(e,t,r,n)=>{
32
+ let o={},s=new Set(["allowOrigins"]);for(let c of r)if(!(!ae(c)||c.inherited))switch(c.
33
+ name){default:n.push(new oe(t.name,c.name,e.file));break;case"allowOrigins":case"\
34
+ allowMethods":case"allowHeaders":case"exposeHeaders":o[c.name]=de(c);break;case"\
35
+ maxAge":o.maxAge=pe(c);break}return ye(o)?o:(n.push(new y([...s],e.file)),null)},
36
+ de=e=>{let t=le(e)??[],r=[];for(let n of t){let o=ie(n);o&&r.push(o)}return r};var w=e=>{let t={},r=[];for(let n in e){let o=e[n];if(!l(o)||ke(o))continue;let s={
37
+ type:g,extras:{}},c=o.file;s.name=o.name;for(let i of Se(o))if(!(!Ee(i)||i.inherited))
38
+ switch(i.name){default:r.push(new ge(s.name,i.name,c));break;case"localPath":case"\
39
+ globalName":s[i.name]=Me(i);break;case"autoExpireDays":s.autoExpireDays=xe(i);break;case"\
40
+ events":s.events=B(i.value,o,e,r);break;case"cors":s.cors=C(i.value,o,e,r);break;case"\
41
+ variables":s.variables=Te(i,r);break;case"services":s.services=be(i,e,r);break}if(!Be(
42
+ s)){r.push(new p([],c));continue}if(t[o.name]){r.push(new ve(o.name,c));continue}
43
+ t[o.name]=s}return{services:t,errors:r}},Be=e=>!!e.name&&!!e.extras&&!!e.extras;var z=e=>l(e)?e.name:null;var P=!1,dr=()=>{P||(he(),Ie("@ez4/bucket",{"metadata:getServices":w,"metadata:g\
44
+ etLinkedService":z}),P=!0)};export{y as IncompleteCorsError,m as IncompleteEventError,p as IncompleteServiceError,
45
+ v as IncorrectCorsTypeError,u as IncorrectEventTypeError,d as InvalidCorsTypeError,
46
+ a as InvalidEventTypeError,g as ServiceType,C as getBucketCors,B as getBucketEvent,
47
+ w as getBucketServices,x as getEventHandler,Ce as isBucketService,dr as registerTriggers};
@@ -1,5 +1,3 @@
1
- import type { AllType, SourceMap, TypeModel, TypeObject } from '@ez4/reflection';
1
+ import type { AllType, SourceMap, TypeModel } from '@ez4/reflection';
2
2
  import type { BucketCors } from '../types/common.js';
3
- type TypeParent = TypeModel | TypeObject;
4
- export declare const getBucketCors: (type: AllType, parent: TypeParent, reflection: SourceMap, errorList: Error[]) => BucketCors | null;
5
- export {};
3
+ export declare const getBucketCors: (type: AllType, parent: TypeModel, reflection: SourceMap, errorList: Error[]) => BucketCors | null;
@@ -1,5 +1,3 @@
1
- import type { AllType, SourceMap, TypeModel, TypeObject } from '@ez4/reflection';
1
+ import type { AllType, SourceMap, TypeModel } from '@ez4/reflection';
2
2
  import type { BucketEvent } from '../types/common.js';
3
- type TypeParent = TypeModel | TypeObject;
4
- export declare const getBucketEvent: (type: AllType, parent: TypeParent, reflection: SourceMap, errorList: Error[]) => BucketEvent | null;
5
- export {};
3
+ export declare const getBucketEvent: (type: AllType, parent: TypeModel, reflection: SourceMap, errorList: Error[]) => BucketEvent | null;
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@ez4/storage",
3
3
  "description": "EZ4: Components to build storage services",
4
- "version": "0.15.0",
4
+ "version": "0.16.0",
5
5
  "author": "Silas B.",
6
6
  "license": "MIT",
7
7
  "type": "module",
@@ -14,7 +14,7 @@
14
14
  "directory": "packages/storage"
15
15
  },
16
16
  "engines": {
17
- "node": ">=20.15.0"
17
+ "node": ">=22.3.0"
18
18
  },
19
19
  "exports": {
20
20
  ".": {
@@ -42,8 +42,9 @@
42
42
  "live:publish": "npm run test && npm publish --access public"
43
43
  },
44
44
  "dependencies": {
45
- "@ez4/common": "^0.15.0",
46
- "@ez4/project": "^0.15.0",
47
- "@ez4/reflection": "^0.15.0"
45
+ "@ez4/common": "^0.16.0",
46
+ "@ez4/project": "^0.16.0",
47
+ "@ez4/reflection": "^0.16.0",
48
+ "@ez4/utils": "^0.16.0"
48
49
  }
49
50
  }
@@ -1,34 +0,0 @@
1
- import type { Service } from '@ez4/common';
2
- import type { Client } from './client.js';
3
- import type { BucketCors } from './cors.js';
4
- /**
5
- * Provide all contracts for a self-managed Bucket service.
6
- */
7
- export declare namespace Bucket {
8
- type Cors = BucketCors;
9
- /**
10
- * Bucket service.
11
- */
12
- abstract class Service implements Service.Provider {
13
- /**
14
- * CORS configuration.
15
- */
16
- cors?: Cors;
17
- /**
18
- * Specify a local path to synchronize with the storage.
19
- */
20
- localPath?: string;
21
- /**
22
- * Maximum amount of days an object is stored before its auto-deletion.
23
- */
24
- autoExpireDays?: number;
25
- /**
26
- * Service client.
27
- */
28
- client: Client;
29
- /**
30
- * Services are not allowed in this provider.
31
- */
32
- services: never;
33
- }
34
- }
@@ -1,25 +0,0 @@
1
- /**
2
- * Bucket CORS configuration.
3
- */
4
- export interface BucketCors {
5
- /**
6
- * List of allowed origins.
7
- */
8
- allowOrigins: string[];
9
- /**
10
- * List of allowed methods.
11
- */
12
- allowMethods?: string[];
13
- /**
14
- * List of allowed headers.
15
- */
16
- allowHeaders?: string[];
17
- /**
18
- * List of exposed headers.
19
- */
20
- exposeHeaders?: string[];
21
- /**
22
- * Determines how long the preflight result can be cached.
23
- */
24
- maxAge?: number;
25
- }
@@ -1,7 +0,0 @@
1
- export type BucketCors = {
2
- allowOrigins: string[];
3
- allowMethods?: string[];
4
- exposeHeaders?: string[];
5
- allowHeaders?: string[];
6
- maxAge?: number;
7
- };