UNPKG

@ahoo-wang/fetcher-wow

Version:

Support for Wow(https://github.com/Ahoo-Wang/Wow) in Fetcher

3 lines (2 loc) 14.3 kB
(function(i,C){typeof exports=="object"&&typeof module<"u"?C(exports,require("@ahoo-wang/fetcher"),require("@ahoo-wang/fetcher-eventstream"),require("@ahoo-wang/fetcher-decorator")):typeof define=="function"&&define.amd?define(["exports","@ahoo-wang/fetcher","@ahoo-wang/fetcher-eventstream","@ahoo-wang/fetcher-decorator"],C):(i=typeof globalThis<"u"?globalThis:i||self,C(i.FetcherWow={},i.Fetcher,i.FetcherEventStream,i.FetcherDecorator))})(this,(function(i,C,W,T){"use strict";var x=Object.defineProperty,tt=Object.getOwnPropertyDescriptor,V=(t,E,n,A)=>{for(var I=A>1?void 0:A?tt(E,n):E,l=t.length-1,a;l>=0;l--)(a=t[l])&&(I=(A?a(E,n,I):a(I))||I);return A&&I&&x(E,n,I),I},y=(t,E)=>(n,A)=>E(n,A,t);i.CommandClient=class{constructor(E){this.apiMetadata=E}send(E,n){throw T.autoGeneratedError(E,n)}sendAndWaitStream(E,n){throw T.autoGeneratedError(E,n)}},V([T.endpoint(),y(0,T.request()),y(1,T.attribute())],i.CommandClient.prototype,"send",1),V([T.endpoint(void 0,void 0,{headers:{Accept:C.ContentTypeValues.TEXT_EVENT_STREAM},resultExtractor:W.JsonEventStreamResultExtractor}),y(0,T.request()),y(1,T.attribute())],i.CommandClient.prototype,"sendAndWaitStream",1),i.CommandClient=V([T.api()],i.CommandClient);const s=class s{};s.COMMAND_HEADERS_PREFIX="Command-",s.TENANT_ID=`${s.COMMAND_HEADERS_PREFIX}Tenant-Id`,s.OWNER_ID=`${s.COMMAND_HEADERS_PREFIX}Owner-Id`,s.AGGREGATE_ID=`${s.COMMAND_HEADERS_PREFIX}Aggregate-Id`,s.AGGREGATE_VERSION=`${s.COMMAND_HEADERS_PREFIX}Aggregate-Version`,s.WAIT_PREFIX=`${s.COMMAND_HEADERS_PREFIX}Wait-`,s.WAIT_TIME_OUT=`${s.WAIT_PREFIX}Timeout`,s.WAIT_STAGE=`${s.WAIT_PREFIX}Stage`,s.WAIT_CONTEXT=`${s.WAIT_PREFIX}Context`,s.WAIT_PROCESSOR=`${s.WAIT_PREFIX}Processor`,s.WAIT_FUNCTION=`${s.WAIT_PREFIX}Function`,s.WAIT_TAIL_PREFIX=`${s.WAIT_PREFIX}Tail-`,s.WAIT_TAIL_STAGE=`${s.WAIT_TAIL_PREFIX}Stage`,s.WAIT_TAIL_CONTEXT=`${s.WAIT_TAIL_PREFIX}Context`,s.WAIT_TAIL_PROCESSOR=`${s.WAIT_TAIL_PREFIX}Processor`,s.WAIT_TAIL_FUNCTION=`${s.WAIT_TAIL_PREFIX}Function`,s.REQUEST_ID=`${s.COMMAND_HEADERS_PREFIX}Request-Id`,s.LOCAL_FIRST=`${s.COMMAND_HEADERS_PREFIX}Local-First`,s.COMMAND_AGGREGATE_CONTEXT=`${s.COMMAND_HEADERS_PREFIX}Aggregate-Context`,s.COMMAND_AGGREGATE_NAME=`${s.COMMAND_HEADERS_PREFIX}Aggregate-Name`,s.COMMAND_TYPE=`${s.COMMAND_HEADERS_PREFIX}Type`,s.COMMAND_HEADER_X_PREFIX=`${s.COMMAND_HEADERS_PREFIX}Header-`;let $=s;var Y=(t=>(t.SENT="SENT",t.PROCESSED="PROCESSED",t.SNAPSHOT="SNAPSHOT",t.PROJECTED="PROJECTED",t.EVENT_HANDLED="EVENT_HANDLED",t.SAGA_HANDLED="SAGA_HANDLED",t))(Y||{}),u=(t=>(t.AND="AND",t.OR="OR",t.NOR="NOR",t.ID="ID",t.IDS="IDS",t.AGGREGATE_ID="AGGREGATE_ID",t.AGGREGATE_IDS="AGGREGATE_IDS",t.TENANT_ID="TENANT_ID",t.OWNER_ID="OWNER_ID",t.DELETED="DELETED",t.ALL="ALL",t.EQ="EQ",t.NE="NE",t.GT="GT",t.LT="LT",t.GTE="GTE",t.LTE="LTE",t.CONTAINS="CONTAINS",t.IN="IN",t.NOT_IN="NOT_IN",t.BETWEEN="BETWEEN",t.ALL_IN="ALL_IN",t.STARTS_WITH="STARTS_WITH",t.ENDS_WITH="ENDS_WITH",t.ELEM_MATCH="ELEM_MATCH",t.NULL="NULL",t.NOT_NULL="NOT_NULL",t.TRUE="TRUE",t.FALSE="FALSE",t.EXISTS="EXISTS",t.TODAY="TODAY",t.BEFORE_TODAY="BEFORE_TODAY",t.TOMORROW="TOMORROW",t.THIS_WEEK="THIS_WEEK",t.NEXT_WEEK="NEXT_WEEK",t.LAST_WEEK="LAST_WEEK",t.THIS_MONTH="THIS_MONTH",t.LAST_MONTH="LAST_MONTH",t.RECENT_DAYS="RECENT_DAYS",t.EARLIER_DAYS="EARLIER_DAYS",t.RAW="RAW",t))(u||{});function f(t){return!!t}const h=class h{};h.IGNORE_CASE_OPTION_KEY="ignoreCase",h.ZONE_ID_OPTION_KEY="zoneId",h.DATE_PATTERN_OPTION_KEY="datePattern";let v=h;function U(t){if(!(typeof t>"u"))return{ignoreCase:t}}function c(t,E){if(typeof t>"u"&&typeof E>"u")return;const n={};return typeof t<"u"&&(n.datePattern=t),typeof E<"u"&&(n.zoneId=E),n}var d=(t=>(t.ACTIVE="ACTIVE",t.DELETED="DELETED",t.ALL="ALL",t))(d||{});function F(...t){if(t.length===0)return o();if(t.length===1)return f(t[0])?t[0]:o();const E=[];return t.forEach(n=>{n?.operator===u.ALL||!f(n)||(n.operator===u.AND&&n.children?E.push(...n.children):E.push(n))}),{operator:u.AND,children:E}}function Et(...t){const E=t?.filter(n=>f(n));return E.length===0?o():{operator:u.OR,children:E}}function it(...t){return t.length===0?o():{operator:u.NOR,children:t}}function nt(t){return{operator:u.ID,value:t}}function Tt(t){return{operator:u.IDS,value:t}}function At(t){return{operator:u.AGGREGATE_ID,value:t}}function ut(...t){return{operator:u.AGGREGATE_IDS,value:t}}function st(t){return{operator:u.TENANT_ID,value:t}}function It(t){return{operator:u.OWNER_ID,value:t}}function H(t){return{operator:u.DELETED,value:t}}function Nt(){return H("ACTIVE")}function o(){return{operator:u.ALL}}function Rt(t,E){return{field:t,operator:u.EQ,value:E}}function St(t,E){return{field:t,operator:u.NE,value:E}}function Q(t,E){return{field:t,operator:u.GT,value:E}}function B(t,E){return{field:t,operator:u.LT,value:E}}function et(t,E){return{field:t,operator:u.GTE,value:E}}function Ot(t,E){return{field:t,operator:u.LTE,value:E}}function _t(t,E,n){const A=U(n);return{field:t,operator:u.CONTAINS,value:E,options:A}}function ct(t,...E){return{field:t,operator:u.IN,value:E}}function lt(t,...E){return{field:t,operator:u.NOT_IN,value:E}}function at(t,E,n){return{field:t,operator:u.BETWEEN,value:[E,n]}}function rt(t,...E){return{field:t,operator:u.ALL_IN,value:E}}function Lt(t,E,n){const A=U(n);return{field:t,operator:u.STARTS_WITH,value:E,options:A}}function Ct(t,E,n){const A=U(n);return{field:t,operator:u.ENDS_WITH,value:E,options:A}}function ot(t,E){return{field:t,operator:u.ELEM_MATCH,children:[E]}}function Dt(t){return{field:t,operator:u.NULL}}function Gt(t){return{field:t,operator:u.NOT_NULL}}function gt(t){return{field:t,operator:u.TRUE}}function Mt(t){return{field:t,operator:u.FALSE}}function Pt(t,E=!0){return{field:t,operator:u.EXISTS,value:E}}function ht(t,E,n){const A=c(E,n);return{field:t,operator:u.TODAY,options:A}}function Wt(t,E,n,A){const I=c(n,A);return{field:t,operator:u.BEFORE_TODAY,value:E,options:I}}function yt(t,E,n){const A=c(E,n);return{field:t,operator:u.TOMORROW,options:A}}function ft(t,E,n){const A=c(E,n);return{field:t,operator:u.THIS_WEEK,options:A}}function Ut(t,E,n){const A=c(E,n);return{field:t,operator:u.NEXT_WEEK,options:A}}function Vt(t,E,n){const A=c(E,n);return{field:t,operator:u.LAST_WEEK,options:A}}function $t(t,E,n){const A=c(E,n);return{field:t,operator:u.THIS_MONTH,options:A}}function vt(t,E,n){const A=c(E,n);return{field:t,operator:u.LAST_MONTH,options:A}}function wt(t,E,n,A){const I=c(n,A);return{field:t,operator:u.RECENT_DAYS,value:E,options:I}}function bt(t,E,n,A){const I=c(n,A);return{field:t,operator:u.EARLIER_DAYS,value:E,options:I}}function Xt(t){return{operator:u.RAW,value:t}}const g={index:1,size:10};function Yt({index:t=g.index,size:E=g.size}=g){return{index:t,size:E}}const q={};function p(){return q}function dt({include:t,exclude:E}=p()){return{include:t,exclude:E}}function Ft({condition:t=o(),projection:E,sort:n}={}){return{condition:t,projection:E,sort:n}}function Ht({condition:t=o(),projection:E,sort:n,limit:A=g.size}={}){return{condition:t,projection:E,sort:n,limit:A}}function Qt({condition:t=o(),projection:E,sort:n,pagination:A=g}={}){return{condition:t,projection:E,sort:n,pagination:A}}const j={total:0,list:[]};function Bt({total:t,list:E=[]}=j){return t===void 0&&(t=E.length),{total:t,list:E}}var M=(t=>(t.ASC="ASC",t.DESC="DESC",t))(M||{});function qt(t){return{field:t,direction:"ASC"}}function pt(t){return{field:t,direction:"DESC"}}const N=class N{};N.HEADER="header",N.COMMAND_OPERATOR=`${N.HEADER}.command_operator`,N.AGGREGATE_ID="aggregateId",N.TENANT_ID="tenantId",N.OWNER_ID="ownerId",N.COMMAND_ID="commandId",N.REQUEST_ID="requestId",N.VERSION="version",N.BODY="body",N.BODY_ID=`${N.BODY}.id`,N.BODY_NAME=`${N.BODY}.name`,N.BODY_TYPE=`${N.BODY}.bodyType`,N.BODY_REVISION=`${N.BODY}.revision`,N.BODY_BODY=`${N.BODY}.body`,N.CREATE_TIME="createTime";let w=N;const L=class L{};L.EVENT_STREAM_RESOURCE_NAME="event",L.COUNT=`${L.EVENT_STREAM_RESOURCE_NAME}/count`,L.LIST=`${L.EVENT_STREAM_RESOURCE_NAME}/list`,L.PAGED=`${L.EVENT_STREAM_RESOURCE_NAME}/paged`;let G=L;var jt=Object.defineProperty,Jt=Object.getOwnPropertyDescriptor,P=(t,E,n,A)=>{for(var I=A>1?void 0:A?Jt(E,n):E,l=t.length-1,a;l>=0;l--)(a=t[l])&&(I=(A?a(E,n,I):a(I))||I);return A&&I&&jt(E,n,I),I},D=(t,E)=>(n,A)=>E(n,A,t);i.EventStreamQueryClient=class{constructor(E){this.apiMetadata=E}count(E,n){throw T.autoGeneratedError(E,n)}list(E,n){throw T.autoGeneratedError(E,n)}listStream(E,n){throw T.autoGeneratedError(E,n)}paged(E,n){throw T.autoGeneratedError(E,n)}},P([T.post(G.COUNT),D(0,T.body()),D(1,T.attribute())],i.EventStreamQueryClient.prototype,"count",1),P([T.post(G.LIST),D(0,T.body()),D(1,T.attribute())],i.EventStreamQueryClient.prototype,"list",1),P([T.post(G.LIST,{headers:{Accept:C.ContentTypeValues.TEXT_EVENT_STREAM},resultExtractor:W.JsonEventStreamResultExtractor}),D(0,T.body()),D(1,T.attribute())],i.EventStreamQueryClient.prototype,"listStream",1),P([T.post(G.PAGED),D(0,T.body()),D(1,T.attribute())],i.EventStreamQueryClient.prototype,"paged",1),i.EventStreamQueryClient=P([T.api()],i.EventStreamQueryClient);const O=class O{};O.VERSION="version",O.TENANT_ID="tenantId",O.OWNER_ID="ownerId",O.EVENT_ID="eventId",O.FIRST_EVENT_TIME="firstEventTime",O.EVENT_TIME="eventTime",O.FIRST_OPERATOR="firstOperator",O.OPERATOR="operator",O.SNAPSHOT_TIME="snapshotTime",O.DELETED="deleted",O.STATE="state";let b=O;const e=class e{};e.SNAPSHOT_RESOURCE_NAME="snapshot",e.COUNT=`${e.SNAPSHOT_RESOURCE_NAME}/count`,e.LIST=`${e.SNAPSHOT_RESOURCE_NAME}/list`,e.LIST_STATE=`${e.LIST}/state`,e.PAGED=`${e.SNAPSHOT_RESOURCE_NAME}/paged`,e.PAGED_STATE=`${e.PAGED}/state`,e.SINGLE=`${e.SNAPSHOT_RESOURCE_NAME}/single`,e.SINGLE_STATE=`${e.SINGLE}/state`;let _=e;var Kt=Object.defineProperty,zt=Object.getOwnPropertyDescriptor,r=(t,E,n,A)=>{for(var I=A>1?void 0:A?zt(E,n):E,l=t.length-1,a;l>=0;l--)(a=t[l])&&(I=(A?a(E,n,I):a(I))||I);return A&&I&&Kt(E,n,I),I},S=(t,E)=>(n,A)=>E(n,A,t);i.SnapshotQueryClient=class{constructor(E){this.apiMetadata=E}count(E,n){throw T.autoGeneratedError(E,n)}list(E,n){throw T.autoGeneratedError(E,n)}listStream(E,n){throw T.autoGeneratedError(E,n)}listState(E,n){throw T.autoGeneratedError(E,n)}listStateStream(E,n){throw T.autoGeneratedError(E,n)}paged(E,n){throw T.autoGeneratedError(E,n)}pagedState(E,n){throw T.autoGeneratedError(E,n)}single(E,n){throw T.autoGeneratedError(E,n)}singleState(E,n){throw T.autoGeneratedError(E,n)}},r([T.post(_.COUNT),S(0,T.body()),S(1,T.attribute())],i.SnapshotQueryClient.prototype,"count",1),r([T.post(_.LIST),S(0,T.body()),S(1,T.attribute())],i.SnapshotQueryClient.prototype,"list",1),r([T.post(_.LIST,{headers:{Accept:C.ContentTypeValues.TEXT_EVENT_STREAM},resultExtractor:W.JsonEventStreamResultExtractor}),S(0,T.body()),S(1,T.attribute())],i.SnapshotQueryClient.prototype,"listStream",1),r([T.post(_.LIST_STATE),S(0,T.body()),S(1,T.attribute())],i.SnapshotQueryClient.prototype,"listState",1),r([T.post(_.LIST_STATE,{headers:{Accept:C.ContentTypeValues.TEXT_EVENT_STREAM},resultExtractor:W.JsonEventStreamResultExtractor}),S(0,T.body()),S(1,T.attribute())],i.SnapshotQueryClient.prototype,"listStateStream",1),r([T.post(_.PAGED),S(0,T.body()),S(1,T.attribute())],i.SnapshotQueryClient.prototype,"paged",1),r([T.post(_.PAGED_STATE),S(0,T.body()),S(1,T.attribute())],i.SnapshotQueryClient.prototype,"pagedState",1),r([T.post(_.SINGLE),S(0,T.body()),S(1,T.attribute())],i.SnapshotQueryClient.prototype,"single",1),r([T.post(_.SINGLE_STATE),S(0,T.body()),S(1,T.attribute())],i.SnapshotQueryClient.prototype,"singleState",1),i.SnapshotQueryClient=r([T.api()],i.SnapshotQueryClient);const J="~";function K({field:t,cursorId:E=J,direction:n=M.DESC}){return n===M.ASC?Q(t,E):B(t,E)}function z({field:t,direction:E=M.DESC}){return{field:t,direction:E}}function Zt(t){const E=t.query,n=F(K(t),E.condition),A=z(t);return{...E,condition:n,sort:[A]}}var Z=(t=>(t.RECOVERABLE="RECOVERABLE",t.UNKNOWN="UNKNOWN",t.UNRECOVERABLE="UNRECOVERABLE",t))(Z||{});const R=class R{static isSucceeded(E){return E===R.SUCCEEDED}static isError(E){return!R.isSucceeded(E)}};R.SUCCEEDED="Ok",R.SUCCEEDED_MESSAGE="",R.NOT_FOUND="NotFound",R.NOT_FOUND_MESSAGE="Not found resource!",R.BAD_REQUEST="BadRequest",R.ILLEGAL_ARGUMENT="IllegalArgument",R.ILLEGAL_STATE="IllegalState",R.REQUEST_TIMEOUT="RequestTimeout",R.TOO_MANY_REQUESTS="TooManyRequests",R.DUPLICATE_REQUEST_ID="DuplicateRequestId",R.COMMAND_VALIDATION="CommandValidation",R.REWRITE_NO_COMMAND="RewriteNoCommand",R.EVENT_VERSION_CONFLICT="EventVersionConflict",R.DUPLICATE_AGGREGATE_ID="DuplicateAggregateId",R.COMMAND_EXPECT_VERSION_CONFLICT="CommandExpectVersionConflict",R.SOURCING_VERSION_CONFLICT="SourcingVersionConflict",R.ILLEGAL_ACCESS_DELETED_AGGREGATE="IllegalAccessDeletedAggregate",R.ILLEGAL_ACCESS_OWNER_AGGREGATE="IllegalAccessOwnerAggregate",R.INTERNAL_SERVER_ERROR="InternalServerError";let X=R;var k=(t=>(t.COMMAND="COMMAND",t.ERROR="ERROR",t.EVENT="EVENT",t.SOURCING="SOURCING",t.STATE_EVENT="STATE_EVENT",t))(k||{});const kt="";var m=(t=>(t.MAP="MAP",t.STRING="STRING",t))(m||{});i.CURSOR_ID_START=J,i.CommandHeaders=$,i.CommandStage=Y,i.ConditionOptionKey=v,i.DEFAULT_OWNER_ID=kt,i.DEFAULT_PAGINATION=g,i.DEFAULT_PROJECTION=q,i.DeletionState=d,i.DomainEventStreamMetadataFields=w,i.EMPTY_PAGED_LIST=j,i.ErrorCodes=X,i.EventStreamQueryEndpointPaths=G,i.FunctionKind=k,i.MessageHeaderSqlType=m,i.Operator=u,i.RecoverableType=Z,i.SnapshotMetadataFields=b,i.SnapshotQueryEndpointPaths=_,i.SortDirection=M,i.active=Nt,i.aggregateId=At,i.aggregateIds=ut,i.all=o,i.allIn=rt,i.and=F,i.asc=qt,i.beforeToday=Wt,i.between=at,i.contains=_t,i.cursorCondition=K,i.cursorQuery=Zt,i.cursorSort=z,i.dateOptions=c,i.defaultProjection=p,i.deleted=H,i.desc=pt,i.earlierDays=bt,i.elemMatch=ot,i.endsWith=Ct,i.eq=Rt,i.exists=Pt,i.gt=Q,i.gte=et,i.id=nt,i.ids=Tt,i.ignoreCaseOptions=U,i.isFalse=Mt,i.isIn=ct,i.isNull=Dt,i.isTrue=gt,i.isValidateCondition=f,i.lastMonth=vt,i.lastWeek=Vt,i.listQuery=Ht,i.lt=B,i.lte=Ot,i.ne=St,i.nextWeek=Ut,i.nor=it,i.notIn=lt,i.notNull=Gt,i.or=Et,i.ownerId=It,i.pagedList=Bt,i.pagedQuery=Qt,i.pagination=Yt,i.projection=dt,i.raw=Xt,i.recentDays=wt,i.singleQuery=Ft,i.startsWith=Lt,i.tenantId=st,i.thisMonth=$t,i.thisWeek=ft,i.today=ht,i.tomorrow=yt,Object.defineProperty(i,Symbol.toStringTag,{value:"Module"})})); //# sourceMappingURL=index.umd.js.map