@ez4/storage 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.
@@ -1,4 +1,4 @@
1
1
  import { IncompleteTypeError } from '@ez4/common/library';
2
2
  export declare class IncompleteHandlerError extends IncompleteTypeError {
3
- constructor(properties: string[], fileName?: string);
3
+ constructor(fileName?: string);
4
4
  }
package/dist/library.cjs CHANGED
@@ -1,62 +1,66 @@
1
- "use strict";var E=Object.defineProperty;var L=Object.getOwnPropertyDescriptor;var Q=Object.getOwnPropertyNames;var U=Object.prototype.hasOwnProperty;var o=(e,r)=>E(e,"name",{value:r,configurable:!0});var W=(e,r)=>{for(var t in r)E(e,t,{get:r[t],enumerable:!0})},X=(e,r,t,i)=>{if(r&&
2
- typeof r=="object"||typeof r=="function")for(let n of Q(r))!U.call(e,n)&&n!==t&&
3
- E(e,n,{get:()=>r[n],enumerable:!(i=L(r,n))||i.enumerable});return e};var Y=e=>X(E({},"__esModule",{value:!0}),e);var ie={};W(ie,{IncompleteCorsError:()=>S,IncompleteEventError:()=>k,IncompleteServiceError:()=>g,
4
- IncorrectCorsTypeError:()=>M,IncorrectEventTypeError:()=>b,InvalidCorsTypeError:()=>x,
5
- InvalidEventTypeError:()=>T,ServiceType:()=>B,getBucketCors:()=>P,getBucketEvent:()=>z,
6
- getBucketServices:()=>O,getEventHandler:()=>w,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"),q=require("@ez4/reflection");var B="@ez4/bucket",Z=o(e=>e.type===B,"isBucketService");var A=require("@ez4/common/library");var g=class extends A.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"),H=o(e=>(0,h.isTypeCallback)(e)||(0,h.isTypeFunction)(e),"isEv\
10
- entHandler"),j=o(e=>(0,u.hasHeritageType)(e,"Bucket.Event"),"isBucketEvent"),R=o(
11
- e=>(0,u.hasHeritageType)(e,"Bucket.Cors"),"isBucketCors");var m=require("@ez4/common/library"),d=require("@ez4/reflection");var f=require("@ez4/common/library");var k=class extends f.IncompleteTypeError{static{o(this,"IncompleteEventError")}constructor(r,t){
12
- super("Incomplete bucket event",r,t)}},T=class extends f.InvalidTypeError{static{
1
+ "use strict";var M=Object.defineProperty;var Y=Object.getOwnPropertyDescriptor;var Z=Object.getOwnPropertyNames;var _=Object.prototype.hasOwnProperty;var o=(e,r)=>M(e,"name",{value:r,configurable:!0});var $=(e,r)=>{for(var t in r)M(e,t,{get:r[t],enumerable:!0})},ee=(e,r,t,s)=>{if(r&&
2
+ typeof r=="object"||typeof r=="function")for(let n of Z(r))!_.call(e,n)&&n!==t&&
3
+ M(e,n,{get:()=>r[n],enumerable:!(s=Y(r,n))||s.enumerable});return e};var re=e=>ee(M({},"__esModule",{value:!0}),e);var se={};$(se,{IncompleteCorsError:()=>T,IncompleteEventError:()=>g,IncompleteServiceError:()=>v,
4
+ IncorrectCorsTypeError:()=>S,IncorrectEventTypeError:()=>k,InvalidCorsTypeError:()=>x,
5
+ InvalidEventTypeError:()=>b,ServiceType:()=>R,createBucketService:()=>O,getBucketCorsMetadata:()=>w,
6
+ getBucketEventMetadata:()=>I,getBucketServicesMetadata:()=>A,getEventHandlerMetadata:()=>C,
7
+ isBucketCorsDeclaration:()=>q,isBucketEventDeclaration:()=>V,isBucketService:()=>ne,
8
+ isBucketServiceDeclaration:()=>B,isEventHandlerDeclaration:()=>j,registerTriggers:()=>ce});
9
+ module.exports=re(se);var U=require("@ez4/common/library"),X=require("@ez4/project/library");var a=require("@ez4/common/library"),J=require("@ez4/reflection"),K=require("@ez4/utils");var z=require("@ez4/common/library");var v=class extends z.IncompleteTypeError{static{o(this,"IncompleteServiceError")}constructor(r,t){
10
+ super("Incomplete bucket service",r,t)}};var c=require("@ez4/common/library"),f=require("@ez4/reflection"),N=require("@ez4/utils");var u=require("@ez4/common/library");var g=class extends u.IncompleteTypeError{static{o(this,"IncompleteEventError")}constructor(r,t){
11
+ super("Incomplete bucket event",r,t)}},b=class extends u.InvalidTypeError{static{
13
12
  o(this,"InvalidEventTypeError")}constructor(r){super("Invalid bucket event type",
14
- void 0,"Bucket.Event",r)}},b=class extends f.IncorrectTypeError{constructor(t,i){
15
- super("Incorrect bucket event type",t,"Bucket.Event",i);this.eventType=t}static{
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(!H(e))return;let{description:i,module:n}=e,c={...i&&{description:i},
18
- ...n&&{module:n}},p=new Set(["name","file"]);if((c.name=e.name)&&p.delete("name"),
19
- (c.file=e.file)&&p.delete("file"),p.size===0&&$(c))return c;t.push(new C([...p],
20
- e.file))},"getEventHandler"),$=o(e=>!!e.name&&!!e.file,"isValidHandler");var z=o((e,r,t,i)=>{if(!(0,d.isTypeReference)(e))return V(e,r,t,i);let n=(0,m.getReferenceType)(
21
- e,t);if(n)return V(n,r,t,i)},"getBucketEvent"),ee=o(e=>!!e.handler,"isValidEvent"),
22
- V=o((e,r,t,i)=>{if((0,d.isTypeObject)(e))return N(e,r,(0,m.getObjectMembers)(e),
23
- t,i);if(!(0,m.isModelDeclaration)(e)){i.push(new T(r.file));return}if(!j(e)){i.push(
24
- new b(e.name,e.file));return}return N(e,r,(0,m.getModelMembers)(e),t,i)},"getTyp\
25
- eEvent"),N=o((e,r,t,i,n)=>{let c={},p=new Set(["handler"]);for(let s of t)if(!(!(0,d.isModelProperty)(
26
- s)||s.inherited))switch(s.name){default:n.push(new m.InvalidServicePropertyError(
27
- r.name,s.name,e.file));break;case"path":c.path=(0,m.getPropertyString)(s);break;case"\
28
- listener":c.listener=(0,m.getServiceListener)(s.value,n);break;case"handler":c.handler=
29
- w(s.value,i,n);break;case"memory":case"logRetention":case"timeout":c[s.name]=(0,m.getPropertyNumber)(
30
- s);break;case"variables":c.variables=(0,m.getLinkedVariableList)(s,n);break}if(ee(
31
- c))return c;n.push(new k([...p],e.file))},"getTypeFromMembers");var a=require("@ez4/common/library"),v=require("@ez4/reflection");var y=require("@ez4/common/library");var S=class extends y.IncompleteTypeError{static{o(this,"IncompleteCorsError")}constructor(r,t){
32
- super("Incomplete bucket CORS",r,t)}},x=class extends y.InvalidTypeError{static{
13
+ void 0,"Bucket.Event",r)}},k=class extends u.IncorrectTypeError{constructor(t,s){
14
+ super("Incorrect bucket event type",t,"Bucket.Event",s);this.eventType=t}static{
15
+ o(this,"IncorrectEventTypeError")}};var E=require("@ez4/reflection"),D=require("@ez4/common/library");var P=require("@ez4/common/library");var h=class extends P.IncompleteTypeError{static{o(this,"IncompleteHandlerError")}constructor(r){
16
+ super("Incomplete event handler",[],r)}};var j=o(e=>(0,E.isTypeCallback)(e)||(0,E.isTypeFunction)(e),"isEventHandlerDecla\
17
+ ration"),C=o((e,r)=>{if(!j(e))return;let t=(0,D.getFunctionSignature)(e);return t||
18
+ r.push(new h(e.file)),t},"getEventHandlerMetadata");var V=o(e=>(0,c.hasHeritageType)(e,"Bucket.Event"),"isBucketEventDeclaration"),I=o(
19
+ (e,r,t,s)=>{if(!(0,f.isTypeReference)(e))return H(e,r,s);let n=(0,c.getReferenceType)(
20
+ e,t);if(n)return H(n,r,s)},"getBucketEventMetadata"),te=o(e=>(0,N.isObjectWith)(
21
+ e,["handler"]),"isCompleteEvent"),H=o((e,r,t)=>{if((0,f.isTypeObject)(e))return F(
22
+ e,r,(0,c.getObjectMembers)(e),t);if(!(0,c.isModelDeclaration)(e)){t.push(new b(r.
23
+ file));return}if(!V(e)){t.push(new k(e.name,e.file));return}return F(e,r,(0,c.getModelMembers)(
24
+ e),t)},"getTypeEvent"),F=o((e,r,t,s)=>{let n={},l=new Set(["handler"]);for(let i of t)
25
+ if(!(!(0,f.isModelProperty)(i)||i.inherited))switch(i.name){default:{s.push(new c.InvalidServicePropertyError(
26
+ r.name,i.name,e.file));break}case"path":{n.path=(0,c.getPropertyString)(i);break}case"\
27
+ listener":{n.listener=(0,c.getServiceListener)(i.value,s);break}case"handler":{n.
28
+ handler=C(i.value,s);break}case"memory":case"logRetention":case"timeout":{n[i.name]=
29
+ (0,c.getPropertyNumber)(i);break}case"architecture":{n[i.name]=(0,c.getServiceArchitecture)(
30
+ i);break}case"runtime":{n[i.name]=(0,c.getServiceRuntime)(i);break}case"variable\
31
+ s":{n.variables=(0,c.getLinkedVariableList)(i,s);break}}if(!te(n)){s.push(new g(
32
+ [...l],e.file));return}return n},"getTypeFromMembers");var p=require("@ez4/common/library"),y=require("@ez4/reflection");var d=require("@ez4/common/library");var T=class extends d.IncompleteTypeError{static{o(this,"IncompleteCorsError")}constructor(r,t){
33
+ super("Incomplete bucket CORS",r,t)}},x=class extends d.InvalidTypeError{static{
33
34
  o(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{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);if(n)return F(n,r,i)},"getBucketCors"),re=o(e=>!!e.allowOrigins?.length,"is\
38
- ValidCors"),F=o((e,r,t)=>{if((0,v.isTypeObject)(e))return _(e,r,(0,a.getObjectMembers)(
39
- e),t);if(!(0,a.isModelDeclaration)(e)){t.push(new x(r.file));return}if(!R(e)){t.
40
- push(new M(e.name,e.file));return}return _(e,r,(0,a.getModelMembers)(e),t)},"get\
41
- TypeCors"),_=o((e,r,t,i)=>{let n={},c=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]=te(p);break;case"maxAge":n.maxAge=(0,a.getPropertyNumber)(
45
- p);break}if(re(n))return n;i.push(new S([...c],e.file))},"getTypeFromMembers"),te=o(
46
- 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 O=o(e=>{let r={},t=[];for(let i in e){let n=e[i];if(!I(n)||(0,l.isExternalDeclaration)(
48
- n))continue;let c={type:B,context:{}},p=n.file;c.name=n.name;for(let s of(0,l.getModelMembers)(
49
- n))if(!(!(0,q.isModelProperty)(s)||s.inherited))switch(s.name){default:t.push(new l.InvalidServicePropertyError(
50
- c.name,s.name,p));break;case"client":break;case"localPath":case"globalName":c[s.
51
- name]=(0,l.getPropertyString)(s);break;case"autoExpireDays":c.autoExpireDays=(0,l.getPropertyNumber)(
52
- s);break;case"events":c.events=z(s.value,n,e,t);break;case"cors":c.cors=P(s.value,
53
- n,e,t);break;case"variables":c.variables=(0,l.getLinkedVariableList)(s,t);break;case"\
54
- services":c.services=(0,l.getLinkedServiceList)(s,e,t);break}if(!oe(c)){t.push(new g(
55
- [],p));continue}if(r[n.name]){t.push(new l.DuplicateServiceError(n.name,p));continue}
56
- r[n.name]=c}return{services:r,errors:t}},"getBucketServices"),oe=o(e=>!!e.name&&
57
- !!e.context,"isValidService");var G=o(e=>I(e)?e.name:null,"getLinkedService");var ne=o(()=>{(0,J.registerTriggers)(),(0,K.tryCreateTrigger)("@ez4/bucket",{"me\
58
- tadata:getServices":O,"metadata:getLinkedService":G})},"registerTriggers");0&&(module.exports={IncompleteCorsError,IncompleteEventError,IncompleteServiceError,
35
+ "Bucket.Cors",r)}},S=class extends d.IncorrectTypeError{constructor(t,s){super("\
36
+ Incorrect bucket CORS type",t,"Bucket.Cors",s);this.fallbackType=t}static{o(this,
37
+ "IncorrectCorsTypeError")}};var q=o(e=>(0,p.hasHeritageType)(e,"Bucket.Cors"),"isBucketCorsDeclaration"),w=o(
38
+ (e,r,t,s)=>{if(!(0,y.isTypeReference)(e))return L(e,r,s);let n=(0,p.getReferenceType)(
39
+ e,t);if(n)return L(n,r,s)},"getBucketCorsMetadata"),oe=o(e=>!!e.allowOrigins?.length,
40
+ "isCompleteCors"),L=o((e,r,t)=>{if((0,y.isTypeObject)(e))return W(e,r,(0,p.getObjectMembers)(
41
+ e),t);if(!(0,p.isModelDeclaration)(e)){t.push(new x(r.file));return}if(!q(e)){t.
42
+ push(new S(e.name,e.file));return}return W(e,r,(0,p.getModelMembers)(e),t)},"get\
43
+ TypeCors"),W=o((e,r,t,s)=>{let n={},l=new Set(["allowOrigins"]);for(let i of t)if(!(!(0,y.isModelProperty)(
44
+ i)||i.inherited))switch(i.name){default:{s.push(new p.InvalidServicePropertyError(
45
+ r.name,i.name,e.file));break}case"allowOrigins":case"allowMethods":case"allowHea\
46
+ ders":case"exposeHeaders":{n[i.name]=(0,p.getPropertyStringList)(i);break}case"m\
47
+ axAge":{n.maxAge=(0,p.getPropertyNumber)(i);break}}if(!oe(n)){s.push(new T([...l],
48
+ e.file));return}return n},"getTypeFromMembers");var G=require("@ez4/project/library");var R="@ez4/bucket",ne=o(e=>e.type===R,"isBucketService"),O=o(e=>({...(0,G.createServiceMetadata)(
49
+ R,e),variables:{},services:{}}),"createBucketService");var B=o(e=>(0,a.isClassDeclaration)(e)&&(0,a.hasHeritageType)(e,"Bucket.Service"),
50
+ "isBucketServiceDeclaration"),A=o(e=>{let r={},t=[];for(let s in e){let n=e[s];if(!B(
51
+ n)||(0,a.isExternalDeclaration)(n))continue;let l=O(n.name),i=n.file;for(let m of(0,a.getModelMembers)(
52
+ n))if(!(!(0,J.isModelProperty)(m)||m.inherited))switch(m.name){default:{t.push(new a.InvalidServicePropertyError(
53
+ l.name,m.name,i));break}case"client":break;case"localPath":case"globalName":{l[m.
54
+ name]=(0,a.getPropertyString)(m);break}case"autoExpireDays":{l.autoExpireDays=(0,a.getPropertyNumber)(
55
+ m);break}case"events":{l.events=I(m.value,n,e,t);break}case"cors":{l.cors=w(m.value,
56
+ n,e,t);break}case"variables":{l.variables=(0,a.getLinkedVariableList)(m,t);break}case"\
57
+ services":{l.services=(0,a.getLinkedServiceList)(m,e,t);break}}if(!ie(l)){t.push(
58
+ new v([],i));continue}if(r[n.name]){t.push(new a.DuplicateServiceError(n.name,i));
59
+ continue}r[n.name]=l}return{services:r,errors:t}},"getBucketServicesMetadata"),ie=o(
60
+ e=>(0,K.isObjectWith)(e,["variables","services"]),"isCompleteService");var Q=o(e=>B(e)?e.name:null,"getLinkedService");var ce=o(()=>{(0,U.registerTriggers)(),(0,X.tryCreateTrigger)("@ez4/bucket",{"me\
61
+ tadata:getServices":A,"metadata:getLinkedService":Q})},"registerTriggers");0&&(module.exports={IncompleteCorsError,IncompleteEventError,IncompleteServiceError,
59
62
  IncorrectCorsTypeError,IncorrectEventTypeError,InvalidCorsTypeError,InvalidEventTypeError,
60
- ServiceType,getBucketCors,getBucketEvent,getBucketServices,getEventHandler,isBucketService,
61
- registerTriggers});
63
+ ServiceType,createBucketService,getBucketCorsMetadata,getBucketEventMetadata,getBucketServicesMetadata,
64
+ getEventHandlerMetadata,isBucketCorsDeclaration,isBucketEventDeclaration,isBucketService,
65
+ isBucketServiceDeclaration,isEventHandlerDeclaration,registerTriggers});
62
66
  //# sourceMappingURL=library.cjs.map
package/dist/library.d.ts CHANGED
@@ -3,8 +3,7 @@ export * from './metadata/service';
3
3
  export * from './metadata/event';
4
4
  export * from './metadata/handler';
5
5
  export * from './metadata/cors';
6
+ export * from './metadata/types';
6
7
  export * from './errors/service';
7
8
  export * from './errors/event';
8
9
  export * from './errors/cors';
9
- export * from './types/service';
10
- export * from './types/common';
package/dist/library.mjs CHANGED
@@ -1,56 +1,59 @@
1
- var O=Object.defineProperty;var o=(e,t)=>O(e,"name",{value:t,configurable:!0});import{registerTriggers as Ie}from"@ez4/common/library";import{tryCreateTrigger as Ce}from"@ez4/project/library";import{DuplicateServiceError as ge,InvalidServicePropertyError as ke,isExternalDeclaration as Te,
2
- getLinkedVariableList as be,getLinkedServiceList as Se,getModelMembers as xe,getPropertyNumber as Me,
3
- getPropertyString as Ee}from"@ez4/common/library";import{isModelProperty as Be}from"@ez4/reflection";var k="@ez4/bucket",ze=o(e=>e.type===k,"isBucketService");import{IncompleteTypeError as A}from"@ez4/common/library";var m=class extends A{static{o(this,"IncompleteServiceError")}constructor(t,r){super(
4
- "Incomplete bucket service",t,r)}};import{hasHeritageType as T,isClassDeclaration as H}from"@ez4/common/library";import{
5
- isTypeCallback as j,isTypeFunction as R}from"@ez4/reflection";var a=o(e=>H(e)&&T(e,"Bucket.Service"),"isBucketService"),b=o(e=>j(e)||R(e),"isE\
6
- ventHandler"),S=o(e=>T(e,"Bucket.Event"),"isBucketEvent"),x=o(e=>T(e,"Bucket.Cor\
7
- s"),"isBucketCors");import{InvalidServicePropertyError as q,isModelDeclaration as G,getLinkedVariableList as J,
8
- getModelMembers as K,getObjectMembers as L,getPropertyNumber as Q,getPropertyString as U,
9
- getServiceListener as W,getReferenceType as X}from"@ez4/common/library";import{isModelProperty as Y,
10
- isTypeObject as Z,isTypeReference as $}from"@ez4/reflection";import{IncompleteTypeError as D,IncorrectTypeError as V,InvalidTypeError as N}from"@ez4/common/library";var l=class extends D{static{o(this,"IncompleteEventError")}constructor(t,r){super(
11
- "Incomplete bucket event",t,r)}},u=class extends N{static{o(this,"InvalidEventTy\
12
- peError")}constructor(t){super("Invalid bucket event type",void 0,"Bucket.Event",
13
- t)}},f=class extends V{constructor(r,i){super("Incorrect bucket event type",r,"B\
14
- ucket.Event",i);this.eventType=r}static{o(this,"IncorrectEventTypeError")}};import{IncompleteTypeError as F}from"@ez4/common/library";var d=class extends F{static{o(this,"IncompleteHandlerError")}constructor(t,r){super(
15
- "Incomplete event handler",t,r)}};var M=o((e,t,r)=>{if(!b(e))return;let{description:i,module:n}=e,c={...i&&{description:i},
16
- ...n&&{module:n}},p=new Set(["name","file"]);if((c.name=e.name)&&p.delete("name"),
17
- (c.file=e.file)&&p.delete("file"),p.size===0&&_(c))return c;r.push(new d([...p],
18
- e.file))},"getEventHandler"),_=o(e=>!!e.name&&!!e.file,"isValidHandler");var h=o((e,t,r,i)=>{if(!$(e))return E(e,t,r,i);let n=X(e,r);if(n)return E(n,t,r,
19
- i)},"getBucketEvent"),ee=o(e=>!!e.handler,"isValidEvent"),E=o((e,t,r,i)=>{if(Z(e))
20
- return B(e,t,L(e),r,i);if(!G(e)){i.push(new u(t.file));return}if(!S(e)){i.push(new f(
21
- e.name,e.file));return}return B(e,t,K(e),r,i)},"getTypeEvent"),B=o((e,t,r,i,n)=>{
22
- let c={},p=new Set(["handler"]);for(let s of r)if(!(!Y(s)||s.inherited))switch(s.
23
- name){default:n.push(new q(t.name,s.name,e.file));break;case"path":c.path=U(s);break;case"\
24
- listener":c.listener=W(s.value,n);break;case"handler":c.handler=M(s.value,i,n);break;case"\
25
- memory":case"logRetention":case"timeout":c[s.name]=Q(s);break;case"variables":c.
26
- variables=J(s,n);break}if(ee(c))return c;n.push(new l([...p],e.file))},"getTypeF\
27
- romMembers");import{InvalidServicePropertyError as ne,isModelDeclaration as ie,getLiteralString as ce,
28
- getModelMembers as se,getObjectMembers as pe,getPropertyNumber as me,getPropertyTuple as ae,
29
- getReferenceType as le}from"@ez4/common/library";import{isModelProperty as ue,isTypeObject as fe,
30
- isTypeReference as de}from"@ez4/reflection";import{IncompleteTypeError as re,IncorrectTypeError as te,InvalidTypeError as oe}from"@ez4/common/library";var y=class extends re{static{o(this,"IncompleteCorsError")}constructor(t,r){super(
31
- "Incomplete bucket CORS",t,r)}},v=class extends oe{static{o(this,"InvalidCorsTyp\
32
- eError")}constructor(t){super("Invalid bucket CORS type",void 0,"Bucket.Cors",t)}},
33
- g=class extends te{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(!de(e))return I(e,t,i);let n=le(e,r);if(n)return I(n,t,i)},
35
- "getBucketCors"),ye=o(e=>!!e.allowOrigins?.length,"isValidCors"),I=o((e,t,r)=>{if(fe(
36
- e))return C(e,t,pe(e),r);if(!ie(e)){r.push(new v(t.file));return}if(!x(e)){r.push(
37
- new g(e.name,e.file));return}return C(e,t,se(e),r)},"getTypeCors"),C=o((e,t,r,i)=>{
38
- let n={},c=new Set(["allowOrigins"]);for(let p of r)if(!(!ue(p)||p.inherited))switch(p.
39
- name){default:i.push(new ne(t.name,p.name,e.file));break;case"allowOrigins":case"\
40
- allowMethods":case"allowHeaders":case"exposeHeaders":n[p.name]=ve(p);break;case"\
41
- maxAge":n.maxAge=me(p);break}if(ye(n))return n;i.push(new y([...c],e.file))},"ge\
42
- tTypeFromMembers"),ve=o(e=>{let t=ae(e)??[],r=[];for(let i of t){let n=ce(i);n&&
43
- r.push(n)}return r},"getStringValues");var z=o(e=>{let t={},r=[];for(let i in e){let n=e[i];if(!a(n)||Te(n))continue;let c={
44
- type:k,context:{}},p=n.file;c.name=n.name;for(let s of xe(n))if(!(!Be(s)||s.inherited))
45
- switch(s.name){default:r.push(new ke(c.name,s.name,p));break;case"client":break;case"\
46
- localPath":case"globalName":c[s.name]=Ee(s);break;case"autoExpireDays":c.autoExpireDays=
47
- Me(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=be(s,r);break;case"services":c.services=
49
- Se(s,e,r);break}if(!he(c)){r.push(new m([],p));continue}if(t[n.name]){r.push(new ge(
50
- n.name,p));continue}t[n.name]=c}return{services:t,errors:r}},"getBucketServices"),
51
- he=o(e=>!!e.name&&!!e.context,"isValidService");var P=o(e=>a(e)?e.name:null,"getLinkedService");var Cr=o(()=>{Ie(),Ce("@ez4/bucket",{"metadata:getServices":z,"metadata:getLinke\
52
- dService":P})},"registerTriggers");export{y as IncompleteCorsError,l as IncompleteEventError,m as IncompleteServiceError,
53
- g as IncorrectCorsTypeError,f as IncorrectEventTypeError,v as InvalidCorsTypeError,
54
- u as InvalidEventTypeError,k as ServiceType,w as getBucketCors,h as getBucketEvent,
55
- z as getBucketServices,M as getEventHandler,ze as isBucketService,Cr as registerTriggers};
1
+ var w=Object.defineProperty;var o=(e,r)=>w(e,"name",{value:r,configurable:!0});import{registerTriggers as ze}from"@ez4/common/library";import{tryCreateTrigger as Pe}from"@ez4/project/library";import{DuplicateServiceError as Te,InvalidServicePropertyError as xe,isExternalDeclaration as Se,
2
+ isClassDeclaration as Me,getLinkedVariableList as he,getLinkedServiceList as Ee,
3
+ getModelMembers as Be,getPropertyNumber as Ce,getPropertyString as Ie,hasHeritageType as we}from"@ez4/common/library";
4
+ import{isModelProperty as Re}from"@ez4/reflection";import{isObjectWith as Oe}from"@ez4/utils";import{IncompleteTypeError as R}from"@ez4/common/library";var p=class extends R{static{o(this,"IncompleteServiceError")}constructor(r,t){super(
5
+ "Incomplete bucket service",r,t)}};import{InvalidServicePropertyError as N,isModelDeclaration as V,getLinkedVariableList as L,
6
+ getModelMembers as W,getObjectMembers as q,getPropertyNumber as G,getPropertyString as J,
7
+ getServiceListener as K,getServiceArchitecture as Q,getServiceRuntime as U,getReferenceType as X,
8
+ hasHeritageType as Y}from"@ez4/common/library";import{isModelProperty as Z,isTypeObject as _,
9
+ isTypeReference as $}from"@ez4/reflection";import{isObjectWith as ee}from"@ez4/utils";import{IncompleteTypeError as O,IncorrectTypeError as A,InvalidTypeError as z}from"@ez4/common/library";var l=class extends O{static{o(this,"IncompleteEventError")}constructor(r,t){super(
10
+ "Incomplete bucket event",r,t)}},m=class extends z{static{o(this,"InvalidEventTy\
11
+ peError")}constructor(r){super("Invalid bucket event type",void 0,"Bucket.Event",
12
+ r)}},u=class extends A{constructor(t,c){super("Incorrect bucket event type",t,"B\
13
+ ucket.Event",c);this.eventType=t}static{o(this,"IncorrectEventTypeError")}};import{isTypeCallback as D,isTypeFunction as j}from"@ez4/reflection";import{getFunctionSignature as H}from"@ez4/common/library";import{IncompleteTypeError as P}from"@ez4/common/library";var f=class extends P{static{o(this,"IncompleteHandlerError")}constructor(r){super(
14
+ "Incomplete event handler",[],r)}};var F=o(e=>D(e)||j(e),"isEventHandlerDeclaration"),b=o((e,r)=>{if(!F(e))return;let t=H(
15
+ e);return t||r.push(new f(e.file)),t},"getEventHandlerMetadata");var re=o(e=>Y(e,"Bucket.Event"),"isBucketEventDeclaration"),x=o((e,r,t,c)=>{if(!$(
16
+ e))return k(e,r,c);let n=X(e,t);if(n)return k(n,r,c)},"getBucketEventMetadata"),
17
+ te=o(e=>ee(e,["handler"]),"isCompleteEvent"),k=o((e,r,t)=>{if(_(e))return T(e,r,
18
+ q(e),t);if(!V(e)){t.push(new m(r.file));return}if(!re(e)){t.push(new u(e.name,e.
19
+ file));return}return T(e,r,W(e),t)},"getTypeEvent"),T=o((e,r,t,c)=>{let n={},s=new Set(
20
+ ["handler"]);for(let i of t)if(!(!Z(i)||i.inherited))switch(i.name){default:{c.push(
21
+ new N(r.name,i.name,e.file));break}case"path":{n.path=J(i);break}case"listener":{
22
+ n.listener=K(i.value,c);break}case"handler":{n.handler=b(i.value,c);break}case"m\
23
+ emory":case"logRetention":case"timeout":{n[i.name]=G(i);break}case"architecture":{
24
+ n[i.name]=Q(i);break}case"runtime":{n[i.name]=U(i);break}case"variables":{n.variables=
25
+ L(i,c);break}}if(!te(n)){c.push(new l([...s],e.file));return}return n},"getTypeF\
26
+ romMembers");import{InvalidServicePropertyError as ce,isModelDeclaration as se,getModelMembers as ae,
27
+ getObjectMembers as pe,getPropertyNumber as le,getPropertyStringList as me,getReferenceType as ue,
28
+ hasHeritageType as fe}from"@ez4/common/library";import{isModelProperty as de,isTypeObject as ye,
29
+ isTypeReference as ve}from"@ez4/reflection";import{IncompleteTypeError as oe,IncorrectTypeError as ne,InvalidTypeError as ie}from"@ez4/common/library";var d=class extends oe{static{o(this,"IncompleteCorsError")}constructor(r,t){super(
30
+ "Incomplete bucket CORS",r,t)}},y=class extends ie{static{o(this,"InvalidCorsTyp\
31
+ eError")}constructor(r){super("Invalid bucket CORS type",void 0,"Bucket.Cors",r)}},
32
+ v=class extends ne{constructor(t,c){super("Incorrect bucket CORS type",t,"Bucket\
33
+ .Cors",c);this.fallbackType=t}static{o(this,"IncorrectCorsTypeError")}};var ge=o(e=>fe(e,"Bucket.Cors"),"isBucketCorsDeclaration"),h=o((e,r,t,c)=>{if(!ve(
34
+ e))return S(e,r,c);let n=ue(e,t);if(n)return S(n,r,c)},"getBucketCorsMetadata"),
35
+ be=o(e=>!!e.allowOrigins?.length,"isCompleteCors"),S=o((e,r,t)=>{if(ye(e))return M(
36
+ e,r,pe(e),t);if(!se(e)){t.push(new y(r.file));return}if(!ge(e)){t.push(new v(e.name,
37
+ e.file));return}return M(e,r,ae(e),t)},"getTypeCors"),M=o((e,r,t,c)=>{let n={},s=new Set(
38
+ ["allowOrigins"]);for(let i of t)if(!(!de(i)||i.inherited))switch(i.name){default:{
39
+ c.push(new ce(r.name,i.name,e.file));break}case"allowOrigins":case"allowMethods":case"\
40
+ allowHeaders":case"exposeHeaders":{n[i.name]=me(i);break}case"maxAge":{n.maxAge=
41
+ le(i);break}}if(!be(n)){c.push(new d([...s],e.file));return}return n},"getTypeFr\
42
+ omMembers");import{createServiceMetadata as ke}from"@ez4/project/library";var E="@ez4/bucket",ur=o(e=>e.type===E,"isBucketService"),B=o(e=>({...ke(E,e),variables:{},
43
+ services:{}}),"createBucketService");var g=o(e=>Me(e)&&we(e,"Bucket.Service"),"isBucketServiceDeclaration"),C=o(e=>{let r={},
44
+ t=[];for(let c in e){let n=e[c];if(!g(n)||Se(n))continue;let s=B(n.name),i=n.file;
45
+ for(let a of Be(n))if(!(!Re(a)||a.inherited))switch(a.name){default:{t.push(new xe(
46
+ s.name,a.name,i));break}case"client":break;case"localPath":case"globalName":{s[a.
47
+ name]=Ie(a);break}case"autoExpireDays":{s.autoExpireDays=Ce(a);break}case"events":{
48
+ s.events=x(a.value,n,e,t);break}case"cors":{s.cors=h(a.value,n,e,t);break}case"v\
49
+ ariables":{s.variables=he(a,t);break}case"services":{s.services=Ee(a,e,t);break}}
50
+ if(!Ae(s)){t.push(new p([],i));continue}if(r[n.name]){t.push(new Te(n.name,i));continue}
51
+ r[n.name]=s}return{services:r,errors:t}},"getBucketServicesMetadata"),Ae=o(e=>Oe(
52
+ e,["variables","services"]),"isCompleteService");var I=o(e=>g(e)?e.name:null,"getLinkedService");var Or=o(()=>{ze(),Pe("@ez4/bucket",{"metadata:getServices":C,"metadata:getLinke\
53
+ dService":I})},"registerTriggers");export{d as IncompleteCorsError,l as IncompleteEventError,p as IncompleteServiceError,
54
+ v as IncorrectCorsTypeError,u as IncorrectEventTypeError,y as InvalidCorsTypeError,
55
+ m as InvalidEventTypeError,E as ServiceType,B as createBucketService,h as getBucketCorsMetadata,
56
+ x as getBucketEventMetadata,C as getBucketServicesMetadata,b as getEventHandlerMetadata,
57
+ ge as isBucketCorsDeclaration,re as isBucketEventDeclaration,ur as isBucketService,
58
+ g as isBucketServiceDeclaration,F as isEventHandlerDeclaration,Or as registerTriggers};
56
59
  //# sourceMappingURL=library.mjs.map
package/dist/main.cjs CHANGED
@@ -1,4 +1,4 @@
1
- "use strict";var n=Object.defineProperty;var p=Object.getOwnPropertyDescriptor;var s=Object.getOwnPropertyNames;var v=Object.prototype.hasOwnProperty;var u=(t,e)=>{for(var r in e)n(t,r,{get:e[r],enumerable:!0})},a=(t,e,r,i)=>{if(e&&
2
- typeof e=="object"||typeof e=="function")for(let o of s(e))!v.call(t,o)&&o!==r&&
3
- n(t,o,{get:()=>e[o],enumerable:!(i=p(e,o))||i.enumerable});return t};var y=t=>a(n({},"__esModule",{value:!0}),t);var d={};u(d,{Bucket:()=>m,BucketEventType:()=>c});module.exports=y(d);var c=(r=>(r.Create="create",r.Delete="delete",r))(c||{});var m;(t=>{})(m||={});0&&(module.exports={Bucket,BucketEventType});
1
+ "use strict";var n=Object.defineProperty;var s=Object.getOwnPropertyDescriptor;var c=Object.getOwnPropertyNames;var a=Object.prototype.hasOwnProperty;var v=(t,e)=>{for(var r in e)n(t,r,{get:e[r],enumerable:!0})},l=(t,e,r,m)=>{if(e&&
2
+ typeof e=="object"||typeof e=="function")for(let o of c(e))!a.call(t,o)&&o!==r&&
3
+ n(t,o,{get:()=>e[o],enumerable:!(m=s(e,o))||m.enumerable});return t};var y=t=>l(n({},"__esModule",{value:!0}),t);var u={};v(u,{Bucket:()=>i,BucketEventType:()=>p});module.exports=y(u);var i;(t=>{})(i||={});var p=(r=>(r.Create="create",r.Delete="delete",r))(p||{});0&&(module.exports={Bucket,BucketEventType});
4
4
  //# sourceMappingURL=main.cjs.map
package/dist/main.d.ts CHANGED
@@ -1,3 +1,3 @@
1
- export { BucketEventType } from './services/common';
2
1
  export * from './services/contract';
3
2
  export * from './services/client';
3
+ export * from './types/event';
package/dist/main.mjs CHANGED
@@ -1,2 +1,2 @@
1
- var t=(e=>(e.Create="create",e.Delete="delete",e))(t||{});var r;(o=>{})(r||={});export{r as Bucket,t as BucketEventType};
1
+ var t;(o=>{})(t||={});var r=(e=>(e.Create="create",e.Delete="delete",e))(r||{});export{t as Bucket,r as BucketEventType};
2
2
  //# sourceMappingURL=main.mjs.map
@@ -1,3 +1,4 @@
1
- import type { AllType, SourceMap, TypeModel } from '@ez4/reflection';
2
- import type { BucketCors } from '../types/common';
3
- export declare const getBucketCors: (type: AllType, parent: TypeModel, reflection: SourceMap, errorList: Error[]) => BucketCors | undefined;
1
+ import type { AllType, ReflectionTypes, TypeModel } from '@ez4/reflection';
2
+ import type { BucketCors } from './types';
3
+ export declare const isBucketCorsDeclaration: (type: TypeModel) => boolean;
4
+ export declare const getBucketCorsMetadata: (type: AllType, parent: TypeModel, reflection: ReflectionTypes, errorList: Error[]) => BucketCors | undefined;
@@ -1,3 +1,4 @@
1
- import type { AllType, SourceMap, TypeModel } from '@ez4/reflection';
2
- import type { BucketEvent } from '../types/common';
3
- export declare const getBucketEvent: (type: AllType, parent: TypeModel, reflection: SourceMap, errorList: Error[]) => BucketEvent | undefined;
1
+ import type { AllType, ReflectionTypes, TypeModel } from '@ez4/reflection';
2
+ import type { BucketEvent } from './types';
3
+ export declare const isBucketEventDeclaration: (type: TypeModel) => boolean;
4
+ export declare const getBucketEventMetadata: (type: AllType, parent: TypeModel, reflection: ReflectionTypes, errorList: Error[]) => BucketEvent | undefined;
@@ -1,3 +1,3 @@
1
- import type { AllType, SourceMap } from '@ez4/reflection';
2
- import type { EventHandler } from '../types/common';
3
- export declare const getEventHandler: (type: AllType, _reflection: SourceMap, errorList: Error[]) => EventHandler | undefined;
1
+ import type { AllType, TypeCallback, TypeFunction } from '@ez4/reflection';
2
+ export declare const isEventHandlerDeclaration: (type: AllType) => type is TypeCallback | TypeFunction;
3
+ export declare const getEventHandlerMetadata: (type: AllType, errorList: Error[]) => import("@ez4/common/library").FunctionSignature | undefined;
@@ -1,6 +1,7 @@
1
- import type { SourceMap } from '@ez4/reflection';
2
- import type { BucketService } from '../types/service';
3
- export declare const getBucketServices: (reflection: SourceMap) => {
1
+ import type { AllType, ReflectionTypes, TypeClass } from '@ez4/reflection';
2
+ import type { BucketService } from './types';
3
+ export declare const isBucketServiceDeclaration: (type: AllType) => type is TypeClass;
4
+ export declare const getBucketServicesMetadata: (reflection: ReflectionTypes) => {
4
5
  services: Record<string, BucketService>;
5
6
  errors: Error[];
6
7
  };
@@ -0,0 +1,45 @@
1
+ import type { FunctionSignature, ServiceListener } from '@ez4/common/library';
2
+ import type { LinkedVariables, ServiceMetadata } from '@ez4/project/library';
3
+ import type { ArchitectureType, RuntimeType } from '@ez4/project';
4
+ export declare const ServiceType = "@ez4/bucket";
5
+ export type BucketService = Omit<ServiceMetadata, 'variables' | 'services'> & Required<Pick<ServiceMetadata, 'variables' | 'services'>> & {
6
+ type: typeof ServiceType;
7
+ name: string;
8
+ localPath?: string;
9
+ globalName?: string;
10
+ autoExpireDays?: number;
11
+ events?: BucketEvent;
12
+ cors?: BucketCors;
13
+ };
14
+ export type BucketCors = {
15
+ allowOrigins: string[];
16
+ allowMethods?: string[];
17
+ exposeHeaders?: string[];
18
+ allowHeaders?: string[];
19
+ maxAge?: number;
20
+ };
21
+ export type EventHandler = FunctionSignature;
22
+ export type BucketEvent = {
23
+ path?: string;
24
+ listener?: ServiceListener;
25
+ handler: EventHandler;
26
+ variables?: LinkedVariables;
27
+ architecture?: ArchitectureType;
28
+ runtime?: RuntimeType;
29
+ logRetention?: number;
30
+ timeout?: number;
31
+ memory?: number;
32
+ };
33
+ export declare const isBucketService: (service: ServiceMetadata) => service is BucketService;
34
+ export declare const createBucketService: (name: string) => {
35
+ variables: {};
36
+ services: {};
37
+ type: "@ez4/bucket";
38
+ name: string;
39
+ context: Record<string, import("@ez4/project/library").LinkedContext>;
40
+ localPath?: string | null | undefined;
41
+ globalName?: string | null | undefined;
42
+ autoExpireDays?: number | null | undefined;
43
+ events?: BucketEvent | null | undefined;
44
+ cors?: BucketCors | null | undefined;
45
+ };
@@ -1,7 +1,11 @@
1
1
  import type { Service as CommonService } from '@ez4/common';
2
2
  import type { LinkedVariables } from '@ez4/project/library';
3
- import type { BucketEvent, BucketHandler, BucketIncoming, BucketListener, BucketRequest } from './common';
3
+ import type { BucketIncoming } from './incoming';
4
+ import type { BucketListener } from './listener';
5
+ import type { BucketRequest } from './request';
6
+ import type { BucketHandler } from './handler';
4
7
  import type { BucketEvents } from './events';
8
+ import type { BucketEvent } from './event';
5
9
  import type { BucketCors } from './cors';
6
10
  import type { Client } from './client';
7
11
  /**
@@ -0,0 +1,22 @@
1
+ import type { BucketEventType } from '../types/event';
2
+ /**
3
+ * Bucket event.
4
+ */
5
+ export type BucketEvent = {
6
+ /**
7
+ * Type of event.
8
+ */
9
+ readonly eventType: BucketEventType;
10
+ /**
11
+ * Bucket from the event.
12
+ */
13
+ readonly bucketName: string;
14
+ /**
15
+ * Object key in the bucket.
16
+ */
17
+ readonly objectKey: string;
18
+ /**
19
+ * Size of the created object.
20
+ */
21
+ readonly objectSize?: number;
22
+ };
@@ -1,5 +1,8 @@
1
+ import type { ArchitectureType, RuntimeType } from '@ez4/project';
1
2
  import type { LinkedVariables } from '@ez4/project/library';
2
- import type { BucketEvent, BucketHandler, BucketListener } from './common';
3
+ import type { BucketListener } from './listener';
4
+ import type { BucketHandler } from './handler';
5
+ import type { BucketEvent } from './event';
3
6
  /**
4
7
  * Bucket events.
5
8
  */
@@ -32,4 +35,12 @@ export interface BucketEvents {
32
35
  * Amount of memory available (in megabytes) for the handler.
33
36
  */
34
37
  readonly memory?: number;
38
+ /**
39
+ * Architecture for the handler.
40
+ */
41
+ readonly architecture?: ArchitectureType;
42
+ /**
43
+ * Runtime for the handler.
44
+ */
45
+ readonly runtime?: RuntimeType;
35
46
  }
@@ -0,0 +1,8 @@
1
+ import type { Service } from '@ez4/common';
2
+ import type { BucketIncoming } from './incoming';
3
+ import type { BucketEvent } from './event';
4
+ import type { Bucket } from './contract';
5
+ /**
6
+ * Bucket event handler.
7
+ */
8
+ export type BucketHandler<T extends BucketEvent> = (request: BucketIncoming<T> | T, context: Service.Context<Bucket.Service>) => Promise<void> | void;
@@ -0,0 +1,6 @@
1
+ import type { BucketRequest } from './request';
2
+ import type { BucketEvent } from './event';
3
+ /**
4
+ * Incoming event.
5
+ */
6
+ export type BucketIncoming<T extends BucketEvent> = T & BucketRequest;
@@ -0,0 +1,8 @@
1
+ import type { Service } from '@ez4/common';
2
+ import type { BucketIncoming } from './incoming';
3
+ import type { BucketEvent } from './event';
4
+ import type { Bucket } from './contract';
5
+ /**
6
+ * Bucket event listener.
7
+ */
8
+ export type BucketListener<T extends BucketEvent> = (event: Service.AnyEvent<BucketIncoming<T>>, context: Service.Context<Bucket.Service>) => Promise<void> | void;
@@ -0,0 +1,13 @@
1
+ /**
2
+ * Bucket request.
3
+ */
4
+ export type BucketRequest = {
5
+ /**
6
+ * Unique identifier for the request.
7
+ */
8
+ readonly requestId: string;
9
+ /**
10
+ * Unique identifier across multiple services.
11
+ */
12
+ readonly traceId?: string;
13
+ };
@@ -0,0 +1,7 @@
1
+ /**
2
+ * Bucket event type.
3
+ */
4
+ export declare const enum BucketEventType {
5
+ Create = "create",
6
+ Delete = "delete"
7
+ }
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.36.0",
4
+ "version": "0.38.0",
5
5
  "author": "Silas B.",
6
6
  "license": "MIT",
7
7
  "type": "module",
@@ -46,9 +46,9 @@
46
46
  "live:publish": "npm run build && npm publish --access public"
47
47
  },
48
48
  "dependencies": {
49
- "@ez4/common": "^0.36.0",
50
- "@ez4/project": "^0.36.0",
51
- "@ez4/reflection": "^0.36.0",
52
- "@ez4/utils": "^0.36.0"
49
+ "@ez4/common": "^0.38.0",
50
+ "@ez4/project": "^0.38.0",
51
+ "@ez4/reflection": "^0.38.0",
52
+ "@ez4/utils": "^0.38.0"
53
53
  }
54
54
  }
@@ -1,5 +0,0 @@
1
- import type { AllType, TypeCallback, TypeClass, TypeFunction, TypeModel } from '@ez4/reflection';
2
- export declare const isBucketService: (type: AllType) => type is TypeClass;
3
- export declare const isEventHandler: (type: AllType) => type is TypeCallback | TypeFunction;
4
- export declare const isBucketEvent: (type: TypeModel) => boolean;
5
- export declare const isBucketCors: (type: TypeModel) => boolean;
@@ -1,51 +0,0 @@
1
- import type { Service } from '@ez4/common';
2
- import type { Bucket } from './contract';
3
- /**
4
- * Bucket event type.
5
- */
6
- export declare const enum BucketEventType {
7
- Create = "create",
8
- Delete = "delete"
9
- }
10
- /**
11
- * Bucket event.
12
- */
13
- export type BucketEvent = {
14
- /**
15
- * Type of event.
16
- */
17
- readonly eventType: BucketEventType;
18
- /**
19
- * Bucket from the event.
20
- */
21
- readonly bucketName: string;
22
- /**
23
- * Object key in the bucket.
24
- */
25
- readonly objectKey: string;
26
- /**
27
- * Size of the created object.
28
- */
29
- readonly objectSize?: number;
30
- };
31
- /**
32
- * Incoming event.
33
- */
34
- export type BucketIncoming<T extends BucketEvent> = T & BucketRequest;
35
- /**
36
- * Bucket request.
37
- */
38
- export type BucketRequest = {
39
- /**
40
- * Request tracking Id.
41
- */
42
- readonly requestId: string;
43
- };
44
- /**
45
- * Bucket event listener.
46
- */
47
- export type BucketListener<T extends BucketEvent> = (event: Service.AnyEvent<BucketIncoming<T>>, context: Service.Context<Bucket.Service>) => Promise<void> | void;
48
- /**
49
- * Bucket event handler.
50
- */
51
- export type BucketHandler<T extends BucketEvent> = (request: BucketIncoming<T> | T, context: Service.Context<Bucket.Service>) => Promise<void> | void;
@@ -1,24 +0,0 @@
1
- import type { LinkedVariables } from '@ez4/project/library';
2
- import type { ServiceListener } from '@ez4/common/library';
3
- export type BucketCors = {
4
- allowOrigins: string[];
5
- allowMethods?: string[];
6
- exposeHeaders?: string[];
7
- allowHeaders?: string[];
8
- maxAge?: number;
9
- };
10
- export type EventHandler = {
11
- file: string;
12
- module?: string;
13
- name: string;
14
- description?: string;
15
- };
16
- export type BucketEvent = {
17
- path?: string;
18
- listener?: ServiceListener;
19
- handler: EventHandler;
20
- variables?: LinkedVariables;
21
- logRetention?: number;
22
- timeout?: number;
23
- memory?: number;
24
- };
@@ -1,13 +0,0 @@
1
- import type { ServiceMetadata } from '@ez4/project/library';
2
- import type { BucketCors, BucketEvent } from './common';
3
- export declare const ServiceType = "@ez4/bucket";
4
- export type BucketService = ServiceMetadata & {
5
- type: typeof ServiceType;
6
- name: string;
7
- localPath?: string;
8
- globalName?: string;
9
- autoExpireDays?: number;
10
- events?: BucketEvent;
11
- cors?: BucketCors;
12
- };
13
- export declare const isBucketService: (service: ServiceMetadata) => service is BucketService;