@ez4/storage 0.23.0 → 0.25.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,60 +1,60 @@
1
- "use strict";var E=Object.defineProperty;var Q=Object.getOwnPropertyDescriptor;var U=Object.getOwnPropertyNames;var W=Object.prototype.hasOwnProperty;var n=(e,r)=>E(e,"name",{value:r,configurable:!0});var X=(e,r)=>{for(var t in r)E(e,t,{get:r[t],enumerable:!0})},Y=(e,r,t,i)=>{if(r&&
2
- typeof r=="object"||typeof r=="function")for(let o of U(r))!W.call(e,o)&&o!==t&&
3
- E(e,o,{get:()=>r[o],enumerable:!(i=Q(r,o))||i.enumerable});return e};var Z=e=>Y(E({},"__esModule",{value:!0}),e);var se={};X(se,{IncompleteCorsError:()=>S,IncompleteEventError:()=>k,IncompleteServiceError:()=>g,
1
+ "use strict";var E=Object.defineProperty;var Q=Object.getOwnPropertyDescriptor;var U=Object.getOwnPropertyNames;var W=Object.prototype.hasOwnProperty;var o=(e,r)=>E(e,"name",{value:r,configurable:!0});var X=(e,r)=>{for(var t in r)E(e,t,{get:r[t],enumerable:!0})},Y=(e,r,t,i)=>{if(r&&
2
+ typeof r=="object"||typeof r=="function")for(let n of U(r))!W.call(e,n)&&n!==t&&
3
+ E(e,n,{get:()=>r[n],enumerable:!(i=Q(r,n))||i.enumerable});return e};var Z=e=>Y(E({},"__esModule",{value:!0}),e);var se={};X(se,{IncompleteCorsError:()=>S,IncompleteEventError:()=>k,IncompleteServiceError:()=>g,
4
4
  IncorrectCorsTypeError:()=>M,IncorrectEventTypeError:()=>b,InvalidCorsTypeError:()=>x,
5
5
  InvalidEventTypeError:()=>T,ServiceType:()=>B,getBucketCors:()=>P,getBucketEvent:()=>z,
6
6
  getBucketServices:()=>j,getEventHandler:()=>w,isBucketService:()=>$,registerTriggers:()=>ie});
7
- module.exports=Z(se);var K=require("@ez4/common/library"),L=require("@ez4/project/library");var a=require("@ez4/common/library"),q=require("@ez4/reflection");var B="@ez4/bucket",$=n(e=>e.type===B,"isBucketService");var O=require("@ez4/common/library");var g=class extends O.IncompleteTypeError{static{n(this,"IncompleteServiceError")}constructor(r,t){
8
- super("Incomplete bucket service",r,t)}};var u=require("@ez4/common/library"),h=require("@ez4/reflection");var I=n(e=>(0,u.isClassDeclaration)(e)&&(0,u.hasHeritageType)(e,"Bucket.Service"),
9
- "isBucketService"),A=n(e=>(0,h.isTypeCallback)(e)||(0,h.isTypeFunction)(e),"isEv\
10
- entHandler"),H=n(e=>(0,u.hasHeritageType)(e,"Bucket.Event"),"isBucketEvent"),R=n(
11
- e=>(0,u.hasHeritageType)(e,"Bucket.Cors"),"isBucketCors");var p=require("@ez4/common/library"),d=require("@ez4/reflection");var f=require("@ez4/common/library");var k=class extends f.IncompleteTypeError{static{n(this,"IncompleteEventError")}constructor(r,t){
7
+ module.exports=Z(se);var K=require("@ez4/common/library"),L=require("@ez4/project/library");var m=require("@ez4/common/library"),q=require("@ez4/reflection");var B="@ez4/bucket",$=o(e=>e.type===B,"isBucketService");var O=require("@ez4/common/library");var g=class extends O.IncompleteTypeError{static{o(this,"IncompleteServiceError")}constructor(r,t){
8
+ super("Incomplete bucket service",r,t)}};var u=require("@ez4/common/library"),h=require("@ez4/reflection");var I=o(e=>(0,u.isClassDeclaration)(e)&&(0,u.hasHeritageType)(e,"Bucket.Service"),
9
+ "isBucketService"),A=o(e=>(0,h.isTypeCallback)(e)||(0,h.isTypeFunction)(e),"isEv\
10
+ entHandler"),H=o(e=>(0,u.hasHeritageType)(e,"Bucket.Event"),"isBucketEvent"),R=o(
11
+ e=>(0,u.hasHeritageType)(e,"Bucket.Cors"),"isBucketCors");var l=require("@ez4/common/library"),y=require("@ez4/reflection");var f=require("@ez4/common/library");var k=class extends f.IncompleteTypeError{static{o(this,"IncompleteEventError")}constructor(r,t){
12
12
  super("Incomplete bucket event",r,t)}},T=class extends f.InvalidTypeError{static{
13
- n(this,"InvalidEventTypeError")}constructor(r){super("Invalid bucket event type",
13
+ o(this,"InvalidEventTypeError")}constructor(r){super("Invalid bucket event type",
14
14
  void 0,"Bucket.Event",r)}},b=class extends f.IncorrectTypeError{constructor(t,i){
15
15
  super("Incorrect bucket event type",t,"Bucket.Event",i);this.eventType=t}static{
16
- n(this,"IncorrectEventTypeError")}};var D=require("@ez4/common/library");var C=class extends D.IncompleteTypeError{static{n(this,"IncompleteHandlerError")}constructor(r,t){
17
- super("Incomplete event handler",r,t)}};var w=n((e,r,t)=>{if(!A(e))return null;let i={},o=new Set(["name","file"]);return e.
18
- description&&(i.description=e.description),(i.name=e.name)&&o.delete("name"),(i.
19
- file=e.file)&&o.delete("file"),o.size===0&&ee(i)?i:(t.push(new C([...o],e.file)),
20
- null)},"getEventHandler"),ee=n(e=>!!e.name&&!!e.file,"isValidHandler");var z=n((e,r,t,i)=>{if(!(0,d.isTypeReference)(e))return V(e,r,t,i);let o=(0,p.getReferenceType)(
21
- e,t);return o?V(o,r,t,i):null},"getBucketEvent"),re=n(e=>!!e.handler,"isValidEve\
22
- nt"),V=n((e,r,t,i)=>(0,d.isTypeObject)(e)?N(e,r,(0,p.getObjectMembers)(e),t,i):(0,p.isModelDeclaration)(
23
- e)?H(e)?N(e,r,(0,p.getModelMembers)(e),t,i):(i.push(new b(e.name,e.file)),null):
24
- (i.push(new T(r.file)),null),"getTypeEvent"),N=n((e,r,t,i,o)=>{let c={},m=new Set(
25
- ["handler"]);for(let s of t)if(!(!(0,d.isModelProperty)(s)||s.inherited))switch(s.
26
- name){default:o.push(new p.InvalidServicePropertyError(r.name,s.name,e.file));break;case"\
27
- path":c.path=(0,p.getPropertyString)(s);break;case"listener":c.listener=(0,p.getServiceListener)(
28
- s.value,o);break;case"handler":c.handler=w(s.value,i,o);break;case"memory":case"\
29
- logRetention":case"timeout":c[s.name]=(0,p.getPropertyNumber)(s);break;case"vari\
30
- ables":c.variables=(0,p.getLinkedVariableList)(s,o);break}return re(c)?c:(o.push(
31
- new k([...m],e.file)),null)},"getTypeFromMembers");var l=require("@ez4/common/library"),v=require("@ez4/reflection");var y=require("@ez4/common/library");var S=class extends y.IncompleteTypeError{static{n(this,"IncompleteCorsError")}constructor(r,t){
32
- super("Incomplete bucket CORS",r,t)}},x=class extends y.InvalidTypeError{static{
33
- n(this,"InvalidCorsTypeError")}constructor(r){super("Invalid bucket CORS type",void 0,
34
- "Bucket.Cors",r)}},M=class extends y.IncorrectTypeError{constructor(t,i){super("\
35
- Incorrect bucket CORS type",t,"Bucket.Cors",i);this.fallbackType=t}static{n(this,
36
- "IncorrectCorsTypeError")}};var P=n((e,r,t,i)=>{if(!(0,v.isTypeReference)(e))return F(e,r,i);let o=(0,l.getReferenceType)(
37
- e,t);return o?F(o,r,i):null},"getBucketCors"),te=n(e=>!!e.allowOrigins?.length,"\
38
- isValidCors"),F=n((e,r,t)=>(0,v.isTypeObject)(e)?_(e,r,(0,l.getObjectMembers)(e),
39
- t):(0,l.isModelDeclaration)(e)?R(e)?_(e,r,(0,l.getModelMembers)(e),t):(t.push(new M(
40
- e.name,e.file)),null):(t.push(new x(r.file)),null),"getTypeCors"),_=n((e,r,t,i)=>{
41
- let o={},c=new Set(["allowOrigins"]);for(let m of t)if(!(!(0,v.isModelProperty)(
42
- m)||m.inherited))switch(m.name){default:i.push(new l.InvalidServicePropertyError(
43
- r.name,m.name,e.file));break;case"allowOrigins":case"allowMethods":case"allowHea\
44
- ders":case"exposeHeaders":o[m.name]=oe(m);break;case"maxAge":o.maxAge=(0,l.getPropertyNumber)(
45
- m);break}return te(o)?o:(i.push(new S([...c],e.file)),null)},"getTypeFromMembers"),
46
- oe=n(e=>{let r=(0,l.getPropertyTuple)(e)??[],t=[];for(let i of r){let o=(0,l.getLiteralString)(
47
- i);o&&t.push(o)}return t},"getStringValues");var j=n(e=>{let r={},t=[];for(let i in e){let o=e[i];if(!I(o)||(0,a.isExternalDeclaration)(
48
- o))continue;let c={type:B,extras:{}},m=o.file;c.name=o.name;for(let s of(0,a.getModelMembers)(
49
- o))if(!(!(0,q.isModelProperty)(s)||s.inherited))switch(s.name){default:t.push(new a.InvalidServicePropertyError(
50
- c.name,s.name,m));break;case"client":break;case"localPath":case"globalName":c[s.
51
- name]=(0,a.getPropertyString)(s);break;case"autoExpireDays":c.autoExpireDays=(0,a.getPropertyNumber)(
52
- s);break;case"events":c.events=z(s.value,o,e,t);break;case"cors":c.cors=P(s.value,
53
- o,e,t);break;case"variables":c.variables=(0,a.getLinkedVariableList)(s,t);break;case"\
54
- services":c.services=(0,a.getLinkedServiceList)(s,e,t);break}if(!ne(c)){t.push(new g(
55
- [],m));continue}if(r[o.name]){t.push(new a.DuplicateServiceError(o.name,m));continue}
56
- r[o.name]=c}return{services:r,errors:t}},"getBucketServices"),ne=n(e=>!!e.name&&
57
- !!e.extras&&!!e.extras,"isValidService");var G=n(e=>I(e)?e.name:null,"getLinkedService");var J=!1,ie=n(()=>{J||((0,K.registerTriggers)(),(0,L.createTrigger)("@ez4/bucket",
16
+ o(this,"IncorrectEventTypeError")}};var D=require("@ez4/common/library");var C=class extends D.IncompleteTypeError{static{o(this,"IncompleteHandlerError")}constructor(r,t){
17
+ super("Incomplete event handler",r,t)}};var w=o((e,r,t)=>{if(!A(e))return null;let{description:i,module:n}=e,s={...i&&{description:i},
18
+ ...n&&{module:n}},p=new Set(["name","file"]);return(s.name=e.name)&&p.delete("na\
19
+ me"),(s.file=e.file)&&p.delete("file"),p.size===0&&ee(s)?s:(t.push(new C([...p],
20
+ e.file)),null)},"getEventHandler"),ee=o(e=>!!e.name&&!!e.file,"isValidHandler");var z=o((e,r,t,i)=>{if(!(0,y.isTypeReference)(e))return V(e,r,t,i);let n=(0,l.getReferenceType)(
21
+ e,t);return n?V(n,r,t,i):null},"getBucketEvent"),re=o(e=>!!e.handler,"isValidEve\
22
+ nt"),V=o((e,r,t,i)=>(0,y.isTypeObject)(e)?N(e,r,(0,l.getObjectMembers)(e),t,i):(0,l.isModelDeclaration)(
23
+ e)?H(e)?N(e,r,(0,l.getModelMembers)(e),t,i):(i.push(new b(e.name,e.file)),null):
24
+ (i.push(new T(r.file)),null),"getTypeEvent"),N=o((e,r,t,i,n)=>{let s={},p=new Set(
25
+ ["handler"]);for(let c of t)if(!(!(0,y.isModelProperty)(c)||c.inherited))switch(c.
26
+ name){default:n.push(new l.InvalidServicePropertyError(r.name,c.name,e.file));break;case"\
27
+ path":s.path=(0,l.getPropertyString)(c);break;case"listener":s.listener=(0,l.getServiceListener)(
28
+ c.value,n);break;case"handler":s.handler=w(c.value,i,n);break;case"memory":case"\
29
+ logRetention":case"timeout":s[c.name]=(0,l.getPropertyNumber)(c);break;case"vari\
30
+ ables":s.variables=(0,l.getLinkedVariableList)(c,n);break}return re(s)?s:(n.push(
31
+ new k([...p],e.file)),null)},"getTypeFromMembers");var a=require("@ez4/common/library"),v=require("@ez4/reflection");var d=require("@ez4/common/library");var S=class extends d.IncompleteTypeError{static{o(this,"IncompleteCorsError")}constructor(r,t){
32
+ super("Incomplete bucket CORS",r,t)}},x=class extends d.InvalidTypeError{static{
33
+ o(this,"InvalidCorsTypeError")}constructor(r){super("Invalid bucket CORS type",void 0,
34
+ "Bucket.Cors",r)}},M=class extends d.IncorrectTypeError{constructor(t,i){super("\
35
+ Incorrect bucket CORS type",t,"Bucket.Cors",i);this.fallbackType=t}static{o(this,
36
+ "IncorrectCorsTypeError")}};var P=o((e,r,t,i)=>{if(!(0,v.isTypeReference)(e))return F(e,r,i);let n=(0,a.getReferenceType)(
37
+ e,t);return n?F(n,r,i):null},"getBucketCors"),te=o(e=>!!e.allowOrigins?.length,"\
38
+ isValidCors"),F=o((e,r,t)=>(0,v.isTypeObject)(e)?_(e,r,(0,a.getObjectMembers)(e),
39
+ t):(0,a.isModelDeclaration)(e)?R(e)?_(e,r,(0,a.getModelMembers)(e),t):(t.push(new M(
40
+ e.name,e.file)),null):(t.push(new x(r.file)),null),"getTypeCors"),_=o((e,r,t,i)=>{
41
+ let n={},s=new Set(["allowOrigins"]);for(let p of t)if(!(!(0,v.isModelProperty)(
42
+ p)||p.inherited))switch(p.name){default:i.push(new a.InvalidServicePropertyError(
43
+ r.name,p.name,e.file));break;case"allowOrigins":case"allowMethods":case"allowHea\
44
+ ders":case"exposeHeaders":n[p.name]=oe(p);break;case"maxAge":n.maxAge=(0,a.getPropertyNumber)(
45
+ p);break}return te(n)?n:(i.push(new S([...s],e.file)),null)},"getTypeFromMembers"),
46
+ oe=o(e=>{let r=(0,a.getPropertyTuple)(e)??[],t=[];for(let i of r){let n=(0,a.getLiteralString)(
47
+ i);n&&t.push(n)}return t},"getStringValues");var j=o(e=>{let r={},t=[];for(let i in e){let n=e[i];if(!I(n)||(0,m.isExternalDeclaration)(
48
+ n))continue;let s={type:B,extras:{}},p=n.file;s.name=n.name;for(let c of(0,m.getModelMembers)(
49
+ n))if(!(!(0,q.isModelProperty)(c)||c.inherited))switch(c.name){default:t.push(new m.InvalidServicePropertyError(
50
+ s.name,c.name,p));break;case"client":break;case"localPath":case"globalName":s[c.
51
+ name]=(0,m.getPropertyString)(c);break;case"autoExpireDays":s.autoExpireDays=(0,m.getPropertyNumber)(
52
+ c);break;case"events":s.events=z(c.value,n,e,t);break;case"cors":s.cors=P(c.value,
53
+ n,e,t);break;case"variables":s.variables=(0,m.getLinkedVariableList)(c,t);break;case"\
54
+ services":s.services=(0,m.getLinkedServiceList)(c,e,t);break}if(!ne(s)){t.push(new g(
55
+ [],p));continue}if(r[n.name]){t.push(new m.DuplicateServiceError(n.name,p));continue}
56
+ r[n.name]=s}return{services:r,errors:t}},"getBucketServices"),ne=o(e=>!!e.name&&
57
+ !!e.extras&&!!e.extras,"isValidService");var G=o(e=>I(e)?e.name:null,"getLinkedService");var J=!1,ie=o(()=>{J||((0,K.registerTriggers)(),(0,L.createTrigger)("@ez4/bucket",
58
58
  {"metadata:getServices":j,"metadata:getLinkedService":G}),J=!0)},"registerTrigge\
59
59
  rs");0&&(module.exports={IncompleteCorsError,IncompleteEventError,IncompleteServiceError,
60
60
  IncorrectCorsTypeError,IncorrectEventTypeError,InvalidCorsTypeError,InvalidEventTypeError,
package/dist/library.mjs CHANGED
@@ -11,45 +11,45 @@ isTypeObject as $,isTypeReference as ee}from"@ez4/reflection";import{IncompleteT
11
11
  "Incomplete bucket event",t,r)}},u=class extends F{static{o(this,"InvalidEventTy\
12
12
  peError")}constructor(t){super("Invalid bucket event type",void 0,"Bucket.Event",
13
13
  t)}},f=class extends N{constructor(r,i){super("Incorrect bucket event type",r,"B\
14
- ucket.Event",i);this.eventType=r}static{o(this,"IncorrectEventTypeError")}};import{IncompleteTypeError as _}from"@ez4/common/library";var d=class extends _{static{o(this,"IncompleteHandlerError")}constructor(t,r){super(
15
- "Incomplete event handler",t,r)}};var M=o((e,t,r)=>{if(!b(e))return null;let i={},n=new Set(["name","file"]);return e.
16
- description&&(i.description=e.description),(i.name=e.name)&&n.delete("name"),(i.
17
- file=e.file)&&n.delete("file"),n.size===0&&q(i)?i:(r.push(new d([...n],e.file)),
18
- null)},"getEventHandler"),q=o(e=>!!e.name&&!!e.file,"isValidHandler");var h=o((e,t,r,i)=>{if(!ee(e))return E(e,t,r,i);let n=Y(e,r);return n?E(n,t,r,i):
14
+ ucket.Event",i);this.eventType=r}static{o(this,"IncorrectEventTypeError")}};import{IncompleteTypeError as _}from"@ez4/common/library";var y=class extends _{static{o(this,"IncompleteHandlerError")}constructor(t,r){super(
15
+ "Incomplete event handler",t,r)}};var M=o((e,t,r)=>{if(!b(e))return null;let{description:i,module:n}=e,s={...i&&{description:i},
16
+ ...n&&{module:n}},p=new Set(["name","file"]);return(s.name=e.name)&&p.delete("na\
17
+ me"),(s.file=e.file)&&p.delete("file"),p.size===0&&q(s)?s:(r.push(new y([...p],e.
18
+ file)),null)},"getEventHandler"),q=o(e=>!!e.name&&!!e.file,"isValidHandler");var h=o((e,t,r,i)=>{if(!ee(e))return E(e,t,r,i);let n=Y(e,r);return n?E(n,t,r,i):
19
19
  null},"getBucketEvent"),re=o(e=>!!e.handler,"isValidEvent"),E=o((e,t,r,i)=>$(e)?
20
20
  B(e,t,Q(e),r,i):J(e)?S(e)?B(e,t,L(e),r,i):(i.push(new f(e.name,e.file)),null):(i.
21
- push(new u(t.file)),null),"getTypeEvent"),B=o((e,t,r,i,n)=>{let c={},p=new Set([
22
- "handler"]);for(let s of r)if(!(!Z(s)||s.inherited))switch(s.name){default:n.push(
23
- new G(t.name,s.name,e.file));break;case"path":c.path=W(s);break;case"listener":c.
24
- listener=X(s.value,n);break;case"handler":c.handler=M(s.value,i,n);break;case"me\
25
- mory":case"logRetention":case"timeout":c[s.name]=U(s);break;case"variables":c.variables=
26
- K(s,n);break}return re(c)?c:(n.push(new m([...p],e.file)),null)},"getTypeFromMem\
21
+ push(new u(t.file)),null),"getTypeEvent"),B=o((e,t,r,i,n)=>{let s={},p=new Set([
22
+ "handler"]);for(let c of r)if(!(!Z(c)||c.inherited))switch(c.name){default:n.push(
23
+ new G(t.name,c.name,e.file));break;case"path":s.path=W(c);break;case"listener":s.
24
+ listener=X(c.value,n);break;case"handler":s.handler=M(c.value,i,n);break;case"me\
25
+ mory":case"logRetention":case"timeout":s[c.name]=U(c);break;case"variables":s.variables=
26
+ K(c,n);break}return re(s)?s:(n.push(new m([...p],e.file)),null)},"getTypeFromMem\
27
27
  bers");import{InvalidServicePropertyError as ie,isModelDeclaration as se,getLiteralString as ce,
28
28
  getModelMembers as pe,getObjectMembers as le,getPropertyNumber as ae,getPropertyTuple as me,
29
- getReferenceType as ue}from"@ez4/common/library";import{isModelProperty as fe,isTypeObject as de,
30
- isTypeReference as ye}from"@ez4/reflection";import{IncompleteTypeError as te,IncorrectTypeError as oe,InvalidTypeError as ne}from"@ez4/common/library";var y=class extends te{static{o(this,"IncompleteCorsError")}constructor(t,r){super(
29
+ getReferenceType as ue}from"@ez4/common/library";import{isModelProperty as fe,isTypeObject as ye,
30
+ isTypeReference as de}from"@ez4/reflection";import{IncompleteTypeError as te,IncorrectTypeError as oe,InvalidTypeError as ne}from"@ez4/common/library";var d=class extends te{static{o(this,"IncompleteCorsError")}constructor(t,r){super(
31
31
  "Incomplete bucket CORS",t,r)}},v=class extends ne{static{o(this,"InvalidCorsTyp\
32
32
  eError")}constructor(t){super("Invalid bucket CORS type",void 0,"Bucket.Cors",t)}},
33
33
  g=class extends oe{constructor(r,i){super("Incorrect bucket CORS type",r,"Bucket\
34
- .Cors",i);this.fallbackType=r}static{o(this,"IncorrectCorsTypeError")}};var w=o((e,t,r,i)=>{if(!ye(e))return I(e,t,i);let n=ue(e,r);return n?I(n,t,i):null},
35
- "getBucketCors"),ve=o(e=>!!e.allowOrigins?.length,"isValidCors"),I=o((e,t,r)=>de(
34
+ .Cors",i);this.fallbackType=r}static{o(this,"IncorrectCorsTypeError")}};var w=o((e,t,r,i)=>{if(!de(e))return I(e,t,i);let n=ue(e,r);return n?I(n,t,i):null},
35
+ "getBucketCors"),ve=o(e=>!!e.allowOrigins?.length,"isValidCors"),I=o((e,t,r)=>ye(
36
36
  e)?C(e,t,le(e),r):se(e)?x(e)?C(e,t,pe(e),r):(r.push(new g(e.name,e.file)),null):
37
- (r.push(new v(t.file)),null),"getTypeCors"),C=o((e,t,r,i)=>{let n={},c=new Set([
37
+ (r.push(new v(t.file)),null),"getTypeCors"),C=o((e,t,r,i)=>{let n={},s=new Set([
38
38
  "allowOrigins"]);for(let p of r)if(!(!fe(p)||p.inherited))switch(p.name){default:
39
39
  i.push(new ie(t.name,p.name,e.file));break;case"allowOrigins":case"allowMethods":case"\
40
40
  allowHeaders":case"exposeHeaders":n[p.name]=ge(p);break;case"maxAge":n.maxAge=ae(
41
- p);break}return ve(n)?n:(i.push(new y([...c],e.file)),null)},"getTypeFromMembers"),
41
+ p);break}return ve(n)?n:(i.push(new d([...s],e.file)),null)},"getTypeFromMembers"),
42
42
  ge=o(e=>{let t=me(e)??[],r=[];for(let i of t){let n=ce(i);n&&r.push(n)}return r},
43
- "getStringValues");var z=o(e=>{let t={},r=[];for(let i in e){let n=e[i];if(!a(n)||be(n))continue;let c={
44
- type:k,extras:{}},p=n.file;c.name=n.name;for(let s of Me(n))if(!(!he(s)||s.inherited))
45
- switch(s.name){default:r.push(new Te(c.name,s.name,p));break;case"client":break;case"\
46
- localPath":case"globalName":c[s.name]=Be(s);break;case"autoExpireDays":c.autoExpireDays=
47
- Ee(s);break;case"events":c.events=h(s.value,n,e,r);break;case"cors":c.cors=w(s.value,
48
- n,e,r);break;case"variables":c.variables=Se(s,r);break;case"services":c.services=
49
- xe(s,e,r);break}if(!Ie(c)){r.push(new l([],p));continue}if(t[n.name]){r.push(new ke(
50
- n.name,p));continue}t[n.name]=c}return{services:t,errors:r}},"getBucketServices"),
43
+ "getStringValues");var z=o(e=>{let t={},r=[];for(let i in e){let n=e[i];if(!a(n)||be(n))continue;let s={
44
+ type:k,extras:{}},p=n.file;s.name=n.name;for(let c of Me(n))if(!(!he(c)||c.inherited))
45
+ switch(c.name){default:r.push(new Te(s.name,c.name,p));break;case"client":break;case"\
46
+ localPath":case"globalName":s[c.name]=Be(c);break;case"autoExpireDays":s.autoExpireDays=
47
+ Ee(c);break;case"events":s.events=h(c.value,n,e,r);break;case"cors":s.cors=w(c.value,
48
+ n,e,r);break;case"variables":s.variables=Se(c,r);break;case"services":s.services=
49
+ xe(c,e,r);break}if(!Ie(s)){r.push(new l([],p));continue}if(t[n.name]){r.push(new ke(
50
+ n.name,p));continue}t[n.name]=s}return{services:t,errors:r}},"getBucketServices"),
51
51
  Ie=o(e=>!!e.name&&!!e.extras&&!!e.extras,"isValidService");var P=o(e=>a(e)?e.name:null,"getLinkedService");var j=!1,wr=o(()=>{j||(Ce(),we("@ez4/bucket",{"metadata:getServices":z,"metadata\
52
- :getLinkedService":P}),j=!0)},"registerTriggers");export{y as IncompleteCorsError,m as IncompleteEventError,l as IncompleteServiceError,
52
+ :getLinkedService":P}),j=!0)},"registerTriggers");export{d as IncompleteCorsError,m as IncompleteEventError,l as IncompleteServiceError,
53
53
  g as IncorrectCorsTypeError,f as IncorrectEventTypeError,v as InvalidCorsTypeError,
54
54
  u as InvalidEventTypeError,k as ServiceType,w as getBucketCors,h as getBucketEvent,
55
55
  z as getBucketServices,M as getEventHandler,Pe as isBucketService,wr as registerTriggers};
package/dist/main.cjs CHANGED
@@ -1,4 +1,4 @@
1
- "use strict";var o=Object.defineProperty;var p=Object.getOwnPropertyDescriptor;var m=Object.getOwnPropertyNames;var a=Object.prototype.hasOwnProperty;var v=(t,e)=>{for(var r in e)o(t,r,{get:e[r],enumerable:!0})},u=(t,e,r,c)=>{if(e&&
2
- typeof e=="object"||typeof e=="function")for(let n of m(e))!a.call(t,n)&&n!==r&&
3
- o(t,n,{get:()=>e[n],enumerable:!(c=p(e,n))||c.enumerable});return t};var l=t=>u(o({},"__esModule",{value:!0}),t);var x={};v(x,{Bucket:()=>s,BucketEventType:()=>i});module.exports=l(x);var i=(r=>(r.Create="create",r.Delete="delete",r))(i||{});var s;(t=>{})(s||={});0&&(module.exports={Bucket,BucketEventType});
1
+ "use strict";var o=Object.defineProperty;var m=Object.getOwnPropertyDescriptor;var p=Object.getOwnPropertyNames;var u=Object.prototype.hasOwnProperty;var a=(t,e)=>{for(var r in e)o(t,r,{get:e[r],enumerable:!0})},v=(t,e,r,c)=>{if(e&&
2
+ typeof e=="object"||typeof e=="function")for(let n of p(e))!u.call(t,n)&&n!==r&&
3
+ o(t,n,{get:()=>e[n],enumerable:!(c=m(e,n))||c.enumerable});return t};var l=t=>v(o({},"__esModule",{value:!0}),t);var k={};a(k,{Bucket:()=>s,BucketEventType:()=>i});module.exports=l(k);var i=(r=>(r.Create="create",r.Delete="delete",r))(i||{});var s;(t=>{})(s||={});0&&(module.exports={Bucket,BucketEventType});
4
4
  //# sourceMappingURL=main.cjs.map
@@ -56,7 +56,11 @@ export interface BucketCors {
56
56
  /**
57
57
  * Incoming event.
58
58
  */
59
- export type BucketIncoming<T extends BucketEvent> = T & {
59
+ export type BucketIncoming<T extends BucketEvent> = T & BucketRequest;
60
+ /**
61
+ * Bucket request.
62
+ */
63
+ export type BucketRequest = {
60
64
  /**
61
65
  * Request tracking Id.
62
66
  */
@@ -65,7 +69,7 @@ export type BucketIncoming<T extends BucketEvent> = T & {
65
69
  /**
66
70
  * Message listener.
67
71
  */
68
- export type BucketListener<T extends BucketEvent> = (event: Service.Event<BucketIncoming<T>>, context: Service.Context<Bucket.Service>) => Promise<void> | void;
72
+ export type BucketListener<T extends BucketEvent> = (event: Service.AnyEvent<BucketIncoming<T>>, context: Service.Context<Bucket.Service>) => Promise<void> | void;
69
73
  /**
70
74
  * Event handler.
71
75
  */
@@ -1,7 +1,7 @@
1
+ import type { Service as CommonService } from '@ez4/common';
1
2
  import type { LinkedVariables } from '@ez4/project/library';
2
- import type { Service } from '@ez4/common';
3
3
  import type { Client } from './client.js';
4
- import type { BucketCors, BucketEvent, BucketHandler, BucketIncoming, BucketListener } from './common.js';
4
+ import type { BucketCors, BucketEvent, BucketHandler, BucketIncoming, BucketListener, BucketRequest } from './common.js';
5
5
  /**
6
6
  * Provide all contracts for a self-managed Bucket service.
7
7
  */
@@ -9,9 +9,10 @@ export declare namespace Bucket {
9
9
  type Cors = BucketCors;
10
10
  type Event = BucketEvent;
11
11
  type Incoming = BucketIncoming<Event>;
12
+ type Request = BucketRequest;
12
13
  type Listener = BucketListener<Event>;
13
14
  type Handler = BucketHandler<Event>;
14
- type ServiceEvent = Service.Event<Incoming>;
15
+ type ServiceEvent = CommonService.BeginEvent<Request> | CommonService.ReadyEvent<Incoming> | CommonService.ErrorEvent<Request | Incoming> | CommonService.EndEvent<Request>;
15
16
  /**
16
17
  * Bucket events.
17
18
  */
@@ -48,7 +49,7 @@ export declare namespace Bucket {
48
49
  /**
49
50
  * Bucket service.
50
51
  */
51
- abstract class Service implements Service.Provider {
52
+ abstract class Service implements CommonService.Provider {
52
53
  /**
53
54
  * Overwrite the global bucket name.
54
55
  */
@@ -8,8 +8,9 @@ export type BucketCors = {
8
8
  maxAge?: number;
9
9
  };
10
10
  export type EventHandler = {
11
- name: string;
12
11
  file: string;
12
+ module?: string;
13
+ name: string;
13
14
  description?: string;
14
15
  };
15
16
  export type BucketEvent = {
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.23.0",
4
+ "version": "0.25.0",
5
5
  "author": "Silas B.",
6
6
  "license": "MIT",
7
7
  "type": "module",
@@ -32,6 +32,7 @@
32
32
  "packages/*"
33
33
  ],
34
34
  "scripts": {
35
+ "lint": "eslint --cache",
35
36
  "clean": "rm -f *.tsbuildinfo && rm -rf dist/*",
36
37
  "build": "tsc -p tsconfig.json && node tools/bundler.mjs",
37
38
  "test": "npm run test:types && node --test --import ../../tools/tsnode.mjs test/*.spec.ts",
@@ -39,12 +40,12 @@
39
40
  "test:types": "npm run build && tsc -p tsconfig.test.json",
40
41
  "local:publish": "npm run build && npm run clean:registry && npm publish --registry http://localhost:4873",
41
42
  "clean:registry": "rm -rf ../../.registry/@ez4/storage",
42
- "live:publish": "npm run test && npm publish --access public"
43
+ "live:publish": "npm publish --access public"
43
44
  },
44
45
  "dependencies": {
45
- "@ez4/common": "^0.23.0",
46
- "@ez4/project": "^0.23.0",
47
- "@ez4/reflection": "^0.23.0",
48
- "@ez4/utils": "^0.23.0"
46
+ "@ez4/common": "^0.25.0",
47
+ "@ez4/project": "^0.25.0",
48
+ "@ez4/reflection": "^0.25.0",
49
+ "@ez4/utils": "^0.25.0"
49
50
  }
50
51
  }