@ez4/storage 0.19.0 → 0.20.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
@@ -5,9 +5,9 @@ IncorrectCorsTypeError:()=>x,IncorrectEventTypeError:()=>T,InvalidCorsTypeError:
5
5
  InvalidEventTypeError:()=>k,ServiceType:()=>M,getBucketCors:()=>z,getBucketEvent:()=>w,
6
6
  getBucketServices:()=>P,getEventHandler:()=>C,isBucketService:()=>Z,registerTriggers:()=>ne});
7
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\
8
+ super("Incomplete bucket service",r,t)}};var m=require("@ez4/common/library"),E=require("@ez4/reflection"),B=e=>(0,m.isClassDeclaration)(
9
+ e)&&(0,m.hasHeritageType)(e,"Bucket.Service"),O=e=>(0,E.isTypeCallback)(e)||(0,E.isTypeFunction)(
10
+ e),A=e=>(0,m.hasHeritageType)(e,"Bucket.Event"),H=e=>(0,m.hasHeritageType)(e,"Bu\
11
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
12
  super("Incomplete bucket event",r,t)}},k=class extends u.InvalidTypeError{constructor(r){
13
13
  super("Invalid bucket event type",void 0,"Bucket.Event",r)}},T=class extends u.IncorrectTypeError{constructor(t,n){
@@ -19,34 +19,34 @@ null)},$=e=>!!e.name&&!!e.file;var w=(e,r,t,n)=>{if(!(0,f.isTypeReference)(e))re
19
19
  e,t);return o?D(o,r,t,n):null},ee=e=>!!e.handler,D=(e,r,t,n)=>(0,f.isTypeObject)(
20
20
  e)?V(e,r,(0,c.getObjectMembers)(e),t,n):(0,c.isModelDeclaration)(e)?A(e)?V(e,r,(0,c.getModelMembers)(
21
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.
22
+ let s={},a=new Set(["handler"]);for(let i of t)if(!(!(0,f.isModelProperty)(i)||i.
23
23
  inherited))switch(i.name){default:o.push(new c.InvalidServicePropertyError(r.name,
24
24
  i.name,e.file));break;case"path":s.path=(0,c.getPropertyString)(i);break;case"li\
25
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":case"retention":s[i.name]=(0,c.getPropertyNumber)(
26
+ C(i.value,n,o);break;case"memory":case"logRetention":case"timeout":s[i.name]=(0,c.getPropertyNumber)(
27
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)(
28
+ s)?s:(o.push(new g([...a],e.file)),null)};var p=require("@ez4/common/library"),y=require("@ez4/reflection");var d=require("@ez4/common/library"),b=class extends d.IncompleteTypeError{constructor(r,t){
29
+ super("Incomplete bucket CORS",r,t)}},S=class extends d.InvalidTypeError{constructor(r){
30
+ super("Invalid bucket CORS type",void 0,"Bucket.Cors",r)}},x=class extends d.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,y.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,y.isTypeObject)(
33
33
  e)?F(e,r,(0,p.getObjectMembers)(e),t):(0,p.isModelDeclaration)(e)?H(e)?F(e,r,(0,p.getModelMembers)(
34
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)(
35
+ let o={},s=new Set(["allowOrigins"]);for(let a of t)if(!(!(0,y.isModelProperty)(
36
+ a)||a.inherited))switch(a.name){default:n.push(new p.InvalidServicePropertyError(
37
+ r.name,a.name,e.file));break;case"allowOrigins":case"allowMethods":case"allowHea\
38
+ ders":case"exposeHeaders":o[a.name]=te(a);break;case"maxAge":o.maxAge=(0,p.getPropertyNumber)(
39
+ a);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.isExternalDeclaration)(
41
+ o))continue;let s={type:M,extras:{}},a=o.file;s.name=o.name;for(let i of(0,l.getModelMembers)(
42
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",
43
+ s.name,i.name,a));break;case"client":break;case"localPath":case"globalName":s[i.
44
+ name]=(0,l.getPropertyString)(i);break;case"autoExpireDays":s.autoExpireDays=(0,l.getPropertyNumber)(
45
+ i);break;case"events":s.events=w(i.value,o,e,t);break;case"cors":s.cors=z(i.value,
46
+ o,e,t);break;case"variables":s.variables=(0,l.getLinkedVariableList)(i,t);break;case"\
47
+ services":s.services=(0,l.getLinkedServiceList)(i,e,t);break}if(!oe(s)){t.push(new v(
48
+ [],a));continue}if(r[o.name]){t.push(new l.DuplicateServiceError(o.name,a));continue}
49
+ r[o.name]=s}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
50
  {"metadata:getServices":P,"metadata:getLinkedService":q}),G=!0)};0&&(module.exports={IncompleteCorsError,IncompleteEventError,IncompleteServiceError,
51
51
  IncorrectCorsTypeError,IncorrectEventTypeError,InvalidCorsTypeError,InvalidEventTypeError,
52
52
  ServiceType,getBucketCors,getBucketEvent,getBucketServices,getEventHandler,isBucketService,
package/dist/library.mjs CHANGED
@@ -1,4 +1,4 @@
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,
1
+ import{registerTriggers as he}from"@ez4/common/library";import{createTrigger as Ie}from"@ez4/project/library";import{DuplicateServiceError as ve,InvalidServicePropertyError as ge,isExternalDeclaration as ke,
2
2
  getLinkedVariableList as Te,getLinkedServiceList as be,getModelMembers as Se,getPropertyNumber as xe,
3
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
4
  super("Incomplete bucket service",t,r)}};import{hasHeritageType as k,isClassDeclaration as O}from"@ez4/common/library";import{
@@ -7,7 +7,7 @@ isTypeCallback as A,isTypeFunction as H}from"@ez4/reflection";var l=e=>O(e)&&k(e
7
7
  getModelMembers as J,getObjectMembers as K,getPropertyNumber as L,getPropertyString as Q,
8
8
  getServiceListener as U,getReferenceType as W}from"@ez4/common/library";import{isModelProperty as X,
9
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){
10
+ var a=class extends R{constructor(t,r){super("Incomplete bucket event",t,r)}},m=class extends V{constructor(t){
11
11
  super("Invalid bucket event type",void 0,"Bucket.Event",t)}},u=class extends D{constructor(r,n){
12
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
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.
@@ -15,34 +15,35 @@ description&&(n.description=e.description),(n.name=e.name)&&o.delete("name"),(n.
15
15
  file=e.file)&&o.delete("file"),o.size===0&&F(n)?n:(r.push(new f([...o],e.file)),
16
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
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={},
18
+ push(new u(e.name,e.file)),null):(n.push(new m(t.file)),null),E=(e,t,r,n,o)=>{let s={},
19
19
  c=new Set(["handler"]);for(let i of r)if(!(!X(i)||i.inherited))switch(i.name){default:
20
20
  o.push(new _(t.name,i.name,e.file));break;case"path":s.path=Q(i);break;case"list\
21
21
  ener":s.listener=U(i.value,o);break;case"handler":s.handler=x(i.value,n,o);break;case"\
22
- memory":case"timeout":case"retention":s[i.name]=L(i);break;case"variables":s.variables=
23
- G(i,o);break}return $(s)?s:(o.push(new m([...c],e.file)),null)};import{InvalidServicePropertyError as oe,isModelDeclaration as ne,getLiteralString as ie,
22
+ memory":case"logRetention":case"timeout":s[i.name]=L(i);break;case"variables":s.
23
+ variables=G(i,o);break}return $(s)?s:(o.push(new a([...c],e.file)),null)};import{InvalidServicePropertyError as oe,isModelDeclaration as ne,getLiteralString as ie,
24
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,
25
+ getReferenceType as ae}from"@ez4/common/library";import{isModelProperty as me,isTypeObject as ue,
26
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){
27
+ var d=class extends ee{constructor(t,r){super("Incomplete bucket CORS",t,r)}},y=class extends te{constructor(t){
28
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.
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=ae(e,r);return o?h(o,t,n):null},
30
+ de=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 y(t.file)),null),I=(e,t,r,n)=>{
32
+ let o={},s=new Set(["allowOrigins"]);for(let c of r)if(!(!me(c)||c.inherited))switch(c.
33
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={
34
+ allowMethods":case"allowHeaders":case"exposeHeaders":o[c.name]=ye(c);break;case"\
35
+ maxAge":o.maxAge=pe(c);break}return de(o)?o:(n.push(new d([...s],e.file)),null)},
36
+ ye=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
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};
38
+ switch(i.name){default:r.push(new ge(s.name,i.name,c));break;case"client":break;case"\
39
+ localPath":case"globalName":s[i.name]=Me(i);break;case"autoExpireDays":s.autoExpireDays=
40
+ xe(i);break;case"events":s.events=B(i.value,o,e,r);break;case"cors":s.cors=C(i.value,
41
+ o,e,r);break;case"variables":s.variables=Te(i,r);break;case"services":s.services=
42
+ be(i,e,r);break}if(!Be(s)){r.push(new p([],c));continue}if(t[o.name]){r.push(new ve(
43
+ o.name,c));continue}t[o.name]=s}return{services:t,errors:r}},Be=e=>!!e.name&&!!e.
44
+ extras&&!!e.extras;var z=e=>l(e)?e.name:null;var P=!1,yr=()=>{P||(he(),Ie("@ez4/bucket",{"metadata:getServices":w,"metadata:g\
45
+ etLinkedService":z}),P=!0)};export{d as IncompleteCorsError,a as IncompleteEventError,p as IncompleteServiceError,
46
+ v as IncorrectCorsTypeError,u as IncorrectEventTypeError,y as InvalidCorsTypeError,
47
+ m as InvalidEventTypeError,g as ServiceType,C as getBucketCors,B as getBucketEvent,
48
+ w as getBucketServices,x as getEventHandler,Ce as isBucketService,yr as registerTriggers};
48
49
  //# sourceMappingURL=library.mjs.map
@@ -35,7 +35,7 @@ export declare namespace Bucket {
35
35
  /**
36
36
  * Log retention (in days) for the handler.
37
37
  */
38
- retention?: number;
38
+ logRetention?: number;
39
39
  /**
40
40
  * Max execution time (in seconds) for the handler.
41
41
  */
@@ -0,0 +1,2 @@
1
+ import type { TypeClass } from '@ez4/reflection';
2
+ export declare const getLinkedService: (declaration: TypeClass) => string | null;
@@ -13,11 +13,11 @@ export type EventHandler = {
13
13
  description?: string;
14
14
  };
15
15
  export type BucketEvent = {
16
+ path?: string;
16
17
  listener?: ServiceListener;
17
18
  handler: EventHandler;
18
- path?: string;
19
19
  variables?: LinkedVariables | null;
20
- retention?: number;
20
+ logRetention?: number;
21
21
  timeout?: number;
22
22
  memory?: number;
23
23
  };
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.19.0",
4
+ "version": "0.20.0",
5
5
  "author": "Silas B.",
6
6
  "license": "MIT",
7
7
  "type": "module",
@@ -42,9 +42,9 @@
42
42
  "live:publish": "npm run test && npm publish --access public"
43
43
  },
44
44
  "dependencies": {
45
- "@ez4/common": "^0.19.0",
46
- "@ez4/project": "^0.19.0",
47
- "@ez4/reflection": "^0.19.0",
48
- "@ez4/utils": "^0.19.0"
45
+ "@ez4/common": "^0.20.0",
46
+ "@ez4/project": "^0.20.0",
47
+ "@ez4/reflection": "^0.20.0",
48
+ "@ez4/utils": "^0.20.0"
49
49
  }
50
50
  }