@ahoo-wang/fetcher-wow 3.18.0 → 4.0.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/index.cjs.js CHANGED
@@ -1,2 +1,2 @@
1
- Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});let e=require("@ahoo-wang/fetcher"),t=require("@ahoo-wang/fetcher-eventstream"),n=require("@ahoo-wang/fetcher-decorator");function r(e,t){if(typeof Reflect==`object`&&typeof Reflect.metadata==`function`)return Reflect.metadata(e,t)}function i(e,t){return function(n,r){t(n,r,e)}}function a(e,t,n,r){var i=arguments.length,a=i<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,n):r,o;if(typeof Reflect==`object`&&typeof Reflect.decorate==`function`)a=Reflect.decorate(e,t,n,r);else for(var s=e.length-1;s>=0;s--)(o=e[s])&&(a=(i<3?o(a):i>3?o(t,n,a):o(t,n))||a);return i>3&&a&&Object.defineProperty(t,n,a),a}var o=class{constructor(e){this.apiMetadata=e}send(e,t){throw(0,n.autoGeneratedError)(e,t)}sendAndWaitStream(e,t){throw(0,n.autoGeneratedError)(e,t)}};a([(0,n.endpoint)(),i(0,(0,n.request)()),i(1,(0,n.attribute)()),r(`design:type`,Function),r(`design:paramtypes`,[Object,typeof Record>`u`?Object:Record]),r(`design:returntype`,typeof Promise>`u`?Object:Promise)],o.prototype,`send`,null),a([(0,n.endpoint)(void 0,void 0,{headers:{Accept:e.ContentTypeValues.TEXT_EVENT_STREAM},resultExtractor:t.JsonEventStreamResultExtractor}),i(0,(0,n.request)()),i(1,(0,n.attribute)()),r(`design:type`,Function),r(`design:paramtypes`,[Object,typeof Record>`u`?Object:Record]),r(`design:returntype`,typeof Promise>`u`?Object:Promise)],o.prototype,`sendAndWaitStream`,null),o=a([(0,n.api)(),r(`design:paramtypes`,[Object])],o);var s=class e{static{this.COMMAND_HEADERS_PREFIX=`Command-`}static{this.TENANT_ID=`${e.COMMAND_HEADERS_PREFIX}Tenant-Id`}static{this.OWNER_ID=`${e.COMMAND_HEADERS_PREFIX}Owner-Id`}static{this.SPACE_ID=`${e.COMMAND_HEADERS_PREFIX}Space-Id`}static{this.AGGREGATE_ID=`${e.COMMAND_HEADERS_PREFIX}Aggregate-Id`}static{this.AGGREGATE_VERSION=`${e.COMMAND_HEADERS_PREFIX}Aggregate-Version`}static{this.WAIT_PREFIX=`${e.COMMAND_HEADERS_PREFIX}Wait-`}static{this.WAIT_TIME_OUT=`${e.WAIT_PREFIX}Timeout`}static{this.WAIT_STAGE=`${e.WAIT_PREFIX}Stage`}static{this.WAIT_CONTEXT=`${e.WAIT_PREFIX}Context`}static{this.WAIT_PROCESSOR=`${e.WAIT_PREFIX}Processor`}static{this.WAIT_FUNCTION=`${e.WAIT_PREFIX}Function`}static{this.WAIT_TAIL_PREFIX=`${e.WAIT_PREFIX}Tail-`}static{this.WAIT_TAIL_STAGE=`${e.WAIT_TAIL_PREFIX}Stage`}static{this.WAIT_TAIL_CONTEXT=`${e.WAIT_TAIL_PREFIX}Context`}static{this.WAIT_TAIL_PROCESSOR=`${e.WAIT_TAIL_PREFIX}Processor`}static{this.WAIT_TAIL_FUNCTION=`${e.WAIT_TAIL_PREFIX}Function`}static{this.REQUEST_ID=`${e.COMMAND_HEADERS_PREFIX}Request-Id`}static{this.LOCAL_FIRST=`${e.COMMAND_HEADERS_PREFIX}Local-First`}static{this.COMMAND_AGGREGATE_CONTEXT=`${e.COMMAND_HEADERS_PREFIX}Aggregate-Context`}static{this.COMMAND_AGGREGATE_NAME=`${e.COMMAND_HEADERS_PREFIX}Aggregate-Name`}static{this.COMMAND_TYPE=`${e.COMMAND_HEADERS_PREFIX}Type`}static{this.COMMAND_HEADER_X_PREFIX=`${e.COMMAND_HEADERS_PREFIX}Header-`}},ee=function(e){return e.SENT=`SENT`,e.PROCESSED=`PROCESSED`,e.SNAPSHOT=`SNAPSHOT`,e.PROJECTED=`PROJECTED`,e.EVENT_HANDLED=`EVENT_HANDLED`,e.SAGA_HANDLED=`SAGA_HANDLED`,e}({}),c=function(e){return e.AND=`AND`,e.OR=`OR`,e.NOR=`NOR`,e.ID=`ID`,e.IDS=`IDS`,e.AGGREGATE_ID=`AGGREGATE_ID`,e.AGGREGATE_IDS=`AGGREGATE_IDS`,e.TENANT_ID=`TENANT_ID`,e.OWNER_ID=`OWNER_ID`,e.SPACE_ID=`SPACE_ID`,e.DELETED=`DELETED`,e.ALL=`ALL`,e.EQ=`EQ`,e.NE=`NE`,e.GT=`GT`,e.LT=`LT`,e.GTE=`GTE`,e.LTE=`LTE`,e.CONTAINS=`CONTAINS`,e.IN=`IN`,e.NOT_IN=`NOT_IN`,e.BETWEEN=`BETWEEN`,e.ALL_IN=`ALL_IN`,e.STARTS_WITH=`STARTS_WITH`,e.ENDS_WITH=`ENDS_WITH`,e.ELEM_MATCH=`ELEM_MATCH`,e.NULL=`NULL`,e.NOT_NULL=`NOT_NULL`,e.TRUE=`TRUE`,e.FALSE=`FALSE`,e.EXISTS=`EXISTS`,e.TODAY=`TODAY`,e.BEFORE_TODAY=`BEFORE_TODAY`,e.TOMORROW=`TOMORROW`,e.THIS_WEEK=`THIS_WEEK`,e.NEXT_WEEK=`NEXT_WEEK`,e.LAST_WEEK=`LAST_WEEK`,e.THIS_MONTH=`THIS_MONTH`,e.LAST_MONTH=`LAST_MONTH`,e.RECENT_DAYS=`RECENT_DAYS`,e.EARLIER_DAYS=`EARLIER_DAYS`,e.MATCH=`MATCH`,e.RAW=`RAW`,e}({}),te=new Set([`AND`,`OR`,`NOR`]),ne=new Set([`NULL`,`NOT_NULL`,`TRUE`,`FALSE`,`EXISTS`,`TODAY`,`TOMORROW`,`THIS_WEEK`,`NEXT_WEEK`,`LAST_WEEK`,`THIS_MONTH`,`LAST_MONTH`]);function l(e){return!!e}var re=class{static{this.IGNORE_CASE_OPTION_KEY=`ignoreCase`}static{this.ZONE_ID_OPTION_KEY=`zoneId`}static{this.DATE_PATTERN_OPTION_KEY=`datePattern`}};function u(e){if(e!==void 0)return{ignoreCase:e}}function d(e,t){if(e===void 0&&t===void 0)return;let n={};return e!==void 0&&(n.datePattern=e),t!==void 0&&(n.zoneId=t),n}var f=function(e){return e.ACTIVE=`ACTIVE`,e.DELETED=`DELETED`,e.ALL=`ALL`,e}({});function p(...e){if(e.length===0)return g();if(e.length===1)return l(e[0])?e[0]:g();let t=[];return e.forEach(e=>{e?.operator===c.ALL||!l(e)||(e.operator===c.AND&&e.children?t.push(...e.children):t.push(e))}),t.length===0?g():{operator:c.AND,children:t}}function ie(...e){let t=e?.filter(e=>l(e));return t.length===0?g():{operator:c.OR,children:t}}function ae(...e){return e.length===0?g():{operator:c.NOR,children:e}}function oe(e){return{operator:c.ID,value:e}}function se(e){return{operator:c.IDS,value:e}}function m(e){return{operator:c.AGGREGATE_ID,value:e}}function ce(e){return{operator:c.AGGREGATE_IDS,value:e}}function le(e){return{operator:c.TENANT_ID,value:e}}function ue(e){return{operator:c.OWNER_ID,value:e}}function de(e){return{operator:c.SPACE_ID,value:e}}function h(e){return{operator:c.DELETED,value:e}}function fe(){return h(`ACTIVE`)}function g(){return{operator:c.ALL}}function pe(e,t){return{field:e,operator:c.EQ,value:t}}function me(e,t){return{field:e,operator:c.NE,value:t}}function _(e,t){return{field:e,operator:c.GT,value:t}}function v(e,t){return{field:e,operator:c.LT,value:t}}function he(e,t){return{field:e,operator:c.GTE,value:t}}function ge(e,t){return{field:e,operator:c.LTE,value:t}}function _e(e,t,n){let r=u(n);return{field:e,operator:c.CONTAINS,value:t,options:r}}function ve(e,...t){return{field:e,operator:c.IN,value:t}}function ye(e,...t){return{field:e,operator:c.NOT_IN,value:t}}function be(e,t,n){return{field:e,operator:c.BETWEEN,value:[t,n]}}function xe(e,...t){return{field:e,operator:c.ALL_IN,value:t}}function Se(e,t,n){let r=u(n);return{field:e,operator:c.STARTS_WITH,value:t,options:r}}function Ce(e,t){return{field:e,operator:c.MATCH,value:t}}function we(e,t,n){let r=u(n);return{field:e,operator:c.ENDS_WITH,value:t,options:r}}function Te(e,t){return{field:e,operator:c.ELEM_MATCH,children:[t]}}function Ee(e){return{field:e,operator:c.NULL}}function De(e){return{field:e,operator:c.NOT_NULL}}function Oe(e){return{field:e,operator:c.TRUE}}function ke(e){return{field:e,operator:c.FALSE}}function Ae(e,t=!0){return{field:e,operator:c.EXISTS,value:t}}function je(e,t,n){let r=d(t,n);return{field:e,operator:c.TODAY,options:r}}function Me(e,t,n,r){let i=d(n,r);return{field:e,operator:c.BEFORE_TODAY,value:t,options:i}}function Ne(e,t,n){let r=d(t,n);return{field:e,operator:c.TOMORROW,options:r}}function Pe(e,t,n){let r=d(t,n);return{field:e,operator:c.THIS_WEEK,options:r}}function Fe(e,t,n){let r=d(t,n);return{field:e,operator:c.NEXT_WEEK,options:r}}function Ie(e,t,n){let r=d(t,n);return{field:e,operator:c.LAST_WEEK,options:r}}function Le(e,t,n){let r=d(t,n);return{field:e,operator:c.THIS_MONTH,options:r}}function Re(e,t,n){let r=d(t,n);return{field:e,operator:c.LAST_MONTH,options:r}}function ze(e,t,n,r){let i=d(n,r);return{field:e,operator:c.RECENT_DAYS,value:t,options:i}}function Be(e,t,n,r){let i=d(n,r);return{field:e,operator:c.EARLIER_DAYS,value:t,options:i}}function Ve(e){return{operator:c.RAW,value:e}}var He=function(e){return e.MATCH_ALL=`MATCH_ALL`,e.MATCH_NONE=`MATCH_NONE`,e.ID=`ID`,e.IDS=`IDS`,e.AGGREGATE_ID=`AGGREGATE_ID`,e.AGGREGATE_IDS=`AGGREGATE_IDS`,e.TENANT_ID=`TENANT_ID`,e.OWNER_ID=`OWNER_ID`,e.SPACE_ID=`SPACE_ID`,e.AND=`AND`,e.OR=`OR`,e.NOR=`NOR`,e.EQ=`EQ`,e.NE=`NE`,e.GT=`GT`,e.GTE=`GTE`,e.LT=`LT`,e.LTE=`LTE`,e.CONTAINS=`CONTAINS`,e.STARTS_WITH=`STARTS_WITH`,e.ENDS_WITH=`ENDS_WITH`,e.IN=`IN`,e.NOT_IN=`NOT_IN`,e.BETWEEN=`BETWEEN`,e.CONTAINS_ALL=`CONTAINS_ALL`,e.IS_EMPTY=`IS_EMPTY`,e.IS_NULL=`IS_NULL`,e.IS_NOT_NULL=`IS_NOT_NULL`,e.EXISTS=`EXISTS`,e.NOT_EXISTS=`NOT_EXISTS`,e.DELETION=`DELETION`,e.ELEMENT_MATCH=`ELEMENT_MATCH`,e.SEARCH=`SEARCH`,e.TODAY=`TODAY`,e.BEFORE_TODAY=`BEFORE_TODAY`,e.TOMORROW=`TOMORROW`,e.THIS_WEEK=`THIS_WEEK`,e.NEXT_WEEK=`NEXT_WEEK`,e.LAST_WEEK=`LAST_WEEK`,e.THIS_MONTH=`THIS_MONTH`,e.LAST_MONTH=`LAST_MONTH`,e.YESTERDAY=`YESTERDAY`,e.NEXT_MONTH=`NEXT_MONTH`,e.LAST_YEAR=`LAST_YEAR`,e.THIS_YEAR=`THIS_YEAR`,e.NEXT_YEAR=`NEXT_YEAR`,e.RECENT_DAYS=`RECENT_DAYS`,e.EARLIER_DAYS=`EARLIER_DAYS`,e}({}),Ue=function(e){return e.CASE_SENSITIVE=`CASE_SENSITIVE`,e.CASE_INSENSITIVE=`CASE_INSENSITIVE`,e}({}),y=function(e){return e.TERMS=`TERMS`,e.PHRASE=`PHRASE`,e}({}),b=function(e){return e.NANOSECONDS=`NANOSECONDS`,e.MICROSECONDS=`MICROSECONDS`,e.MILLISECONDS=`MILLISECONDS`,e.SECONDS=`SECONDS`,e.MINUTES=`MINUTES`,e.HOURS=`HOURS`,e.DAYS=`DAYS`,e}({}),We=/^([01][0-9]|2[0-3]):[0-5][0-9](?::[0-5][0-9](?:\.[0-9]{1,9})?)?$/,Ge=/^@?[A-Za-z_][A-Za-z0-9_-]*(\.(?:@?[A-Za-z_][A-Za-z0-9_-]*|[0-9]+))*$/,Ke=/^(?:UTC|GMT|UT)?[+-](\d{1,2}|\d{4}|\d{6}|\d{2}:\d{2}|\d{2}:\d{2}:\d{2})$/,qe=/^(?:UTC|GMT|UT)?[+-]/,Je={G:5,u:19,y:19,Q:5,q:5,M:5,L:5,D:3,d:2,F:1,E:5,e:5,c:[1,3,4,5],a:1,B:[1,4,5],h:2,H:2,k:2,K:2,m:2,s:2,S:9,A:19,n:19,N:19,V:[2],v:[1,4],z:4,O:[1,4],X:5,x:5,Z:5,W:1,w:2,Y:1/0,g:19};function x(e){if(typeof e!=`string`||!Ge.test(e))throw TypeError(`Logical field is invalid: [${String(e)}].`);return e}function S(e,t){if(!(e===null?t:typeof e==`string`||typeof e==`boolean`||typeof e==`number`&&Number.isFinite(e)))throw TypeError(`Filter value must be a JSON scalar.`);return e}function C(e){return Array.isArray(e)?(e.forEach(e=>S(e,!0)),e):S(e,!0)}function w(e,t){if(typeof t!=`string`)throw TypeError(`${e} must be a string.`);return t}function T(e){if(e!==`CASE_SENSITIVE`&&e!==`CASE_INSENSITIVE`)throw TypeError(`String comparison is invalid: [${String(e)}].`)}function E(e,t){if(t.length===0)throw TypeError(`${e} cannot be empty.`);if(t.some(e=>e==null))throw TypeError(`${e} cannot contain null.`)}function Ye(e){let t=Ke.exec(e);if(!t)return!1;let n=t[1],[r,i=0,a=0]=(n.includes(`:`)?n.split(`:`):n.length<=2?[n]:[n.slice(0,2),n.slice(2,4),n.slice(4,6)]).map(Number);return i<=59&&a<=59&&(r<18||r===18&&i===0&&a===0)}function D({zoneId:e,datePattern:t,timeUnit:n=`MILLISECONDS`}){if(e!==void 0){if(typeof e!=`string`||!e.trim())throw TypeError(`zoneId cannot be blank.`);if(qe.test(e)&&!Ye(e))throw TypeError(`zoneId is invalid: [${e}].`)}if(t!==void 0&&Ze(t),!Object.values(b).includes(n))throw TypeError(`timeUnit is invalid: [${String(n)}].`);return{...e===void 0?{}:{zoneId:e},...t===void 0?{}:{datePattern:t},timeUnit:n}}function Xe(e,t,n){let r=Je[t];if(!(typeof r==`number`?n<=r:r?.includes(n)===!0))throw TypeError(`datePattern is invalid: [${e}].`)}function O(e,t){return e!==void 0&&(`uyDFdhHkKmsSgAnNWwY`.includes(e)||e===`c`&&t===1||`eMLQq`.includes(e)&&t<=2)}function Ze(e){if(typeof e!=`string`||!e.trim())throw TypeError(`datePattern cannot be blank.`);let t=!1,n=0;for(let r=0;r<e.length;r++){let i=e[r];if(i===`'`){e[r+1]===`'`?r++:t=!t;continue}if(!t){if(/[A-Za-z]/.test(i)){let t=i,n=r+1;for(;e[n]===t;)n++;let a=n-r,o=!1;if(t===`p`){if(o=!0,t=e[n],!t||!/[A-Za-z]/.test(t)||t===`p`)throw TypeError(`datePattern is invalid: [${e}].`);let r=n++;for(;e[n]===t;)n++;a=n-r}if(Xe(e,t,a),o&&O(t,a)){let t=e[n],r=n;for(;r<e.length&&e[r]===t;)r++;if(O(t,r-n))throw TypeError(`datePattern is invalid: [${e}].`)}r=n-1}else if(i===`[`)n++;else if(i===`]`){if(n===0)throw TypeError(`datePattern is invalid: [${e}].`);n--}else if(`{}#`.includes(i))throw TypeError(`datePattern is invalid: [${e}].`)}}if(t)throw TypeError(`datePattern is invalid: [${e}].`)}function k(e,t){if(!Number.isInteger(t)||t<1||t>2147483647)throw TypeError(`${e} days must be a positive JVM Int.`)}function A(e){switch(e.op){case`ID`:case`IDS`:case`AGGREGATE_ID`:case`AGGREGATE_IDS`:case`TENANT_ID`:case`OWNER_ID`:case`SPACE_ID`:case`DELETION`:case`SEARCH`:throw TypeError(`ELEMENT_MATCH predicate cannot contain root filters.`);case`AND`:case`OR`:case`NOR`:E(`${e.op} operands`,e.operands),e.operands.forEach(A);break;case`ELEMENT_MATCH`:A(e.predicate)}}function Qe(e){return E(`AND operands`,e),{op:`AND`,operands:[...e]}}function $e(e){return E(`OR operands`,e),{op:`OR`,operands:[...e]}}function et(e){return E(`NOR operands`,e),{op:`NOR`,operands:[...e]}}var j={matchAll(){return{op:`MATCH_ALL`}},matchNone(){return{op:`MATCH_NONE`}},id(e){return{op:`ID`,value:w(`ID value`,e)}},ids(e){return E(`IDS values`,e),e.forEach(e=>w(`IDS value`,e)),{op:`IDS`,values:[...e]}},aggregateId(e){return{op:`AGGREGATE_ID`,value:w(`AGGREGATE_ID value`,e)}},aggregateIds(e){return E(`AGGREGATE_IDS values`,e),e.forEach(e=>w(`AGGREGATE_IDS value`,e)),{op:`AGGREGATE_IDS`,values:[...e]}},tenantId(e){return{op:`TENANT_ID`,value:w(`TENANT_ID value`,e)}},ownerId(e){return{op:`OWNER_ID`,value:w(`OWNER_ID value`,e)}},spaceId(e){return{op:`SPACE_ID`,value:w(`SPACE_ID value`,e)}},and:Qe,or:$e,nor:et,eq(e,t){return{op:`EQ`,field:x(e),value:C(t)}},ne(e,t){return{op:`NE`,field:x(e),value:C(t)}},gt(e,t){return{op:`GT`,field:x(e),value:S(t,!1)}},gte(e,t){return{op:`GTE`,field:x(e),value:S(t,!1)}},lt(e,t){return{op:`LT`,field:x(e),value:S(t,!1)}},lte(e,t){return{op:`LTE`,field:x(e),value:S(t,!1)}},contains(e,t,n=`CASE_SENSITIVE`){return T(n),{op:`CONTAINS`,field:x(e),value:w(`CONTAINS value`,t),stringComparison:n}},startsWith(e,t,n=`CASE_SENSITIVE`){return T(n),{op:`STARTS_WITH`,field:x(e),value:w(`STARTS_WITH value`,t),stringComparison:n}},endsWith(e,t,n=`CASE_SENSITIVE`){return T(n),{op:`ENDS_WITH`,field:x(e),value:w(`ENDS_WITH value`,t),stringComparison:n}},isIn(e,t){return E(`IN values`,t),t.forEach(e=>S(e,!1)),{op:`IN`,field:x(e),values:[...t]}},notIn(e,t){return E(`NOT_IN values`,t),t.forEach(e=>S(e,!1)),{op:`NOT_IN`,field:x(e),values:[...t]}},containsAll(e,t){return E(`CONTAINS_ALL values`,t),t.forEach(e=>S(e,!1)),{op:`CONTAINS_ALL`,field:x(e),values:[...t]}},between(e,t,n){return{op:`BETWEEN`,field:x(e),lowerBound:S(t,!1),upperBound:S(n,!1)}},isEmpty(e){return{op:`IS_EMPTY`,field:x(e)}},isNull(e){return{op:`IS_NULL`,field:x(e)}},isNotNull(e){return{op:`IS_NOT_NULL`,field:x(e)}},exists(e){return{op:`EXISTS`,field:x(e)}},notExists(e){return{op:`NOT_EXISTS`,field:x(e)}},deletion(e){if(e!==f.ACTIVE&&e!==f.DELETED&&e!==f.ALL)throw TypeError(`Deletion state is invalid: [${String(e)}].`);return{op:`DELETION`,state:e}},elementMatch(e,t){return A(t),{op:`ELEMENT_MATCH`,field:x(e),predicate:t}},search(e,t){if(typeof e!=`string`||!e.trim())throw TypeError(`SEARCH query cannot be blank.`);if(t!==void 0&&(typeof t!=`object`||!t||Array.isArray(t)))throw TypeError(`SEARCH options must be a non-null object.`);let{fields:n=[],mode:r=`TERMS`}=t??{};if(!Object.values(y).includes(r))throw TypeError(`SEARCH mode is invalid: [${String(r)}].`);return{op:`SEARCH`,query:e,mode:r,fields:n.map(x)}},today(e,t={}){return{...D(t),op:`TODAY`,field:x(e)}},beforeToday(e,t,n={}){if(typeof t!=`string`||!We.test(t))throw TypeError(`BEFORE_TODAY time is invalid.`);return{...D(n),op:`BEFORE_TODAY`,field:x(e),time:t}},tomorrow(e,t={}){return{...D(t),op:`TOMORROW`,field:x(e)}},thisWeek(e,t={}){return{...D(t),op:`THIS_WEEK`,field:x(e)}},nextWeek(e,t={}){return{...D(t),op:`NEXT_WEEK`,field:x(e)}},lastWeek(e,t={}){return{...D(t),op:`LAST_WEEK`,field:x(e)}},thisMonth(e,t={}){return{...D(t),op:`THIS_MONTH`,field:x(e)}},lastMonth(e,t={}){return{...D(t),op:`LAST_MONTH`,field:x(e)}},yesterday(e,t={}){return{...D(t),op:`YESTERDAY`,field:x(e)}},nextMonth(e,t={}){return{...D(t),op:`NEXT_MONTH`,field:x(e)}},lastYear(e,t={}){return{...D(t),op:`LAST_YEAR`,field:x(e)}},thisYear(e,t={}){return{...D(t),op:`THIS_YEAR`,field:x(e)}},nextYear(e,t={}){return{...D(t),op:`NEXT_YEAR`,field:x(e)}},recentDays(e,t,n={}){return k(`RECENT_DAYS`,t),{...D(n),op:`RECENT_DAYS`,field:x(e),days:t}},earlierDays(e,t,n={}){return k(`EARLIER_DAYS`,t),{...D(n),op:`EARLIER_DAYS`,field:x(e),days:t}}},tt=function(e){return e.TERMS=`TERMS`,e.HISTOGRAM=`HISTOGRAM`,e.DATE_HISTOGRAM=`DATE_HISTOGRAM`,e}({}),nt=function(e){return e.COUNT=`COUNT`,e.NUMERIC=`NUMERIC`,e.ANY=`ANY`,e}({}),rt=function(e){return e.FIELD=`FIELD`,e.CONSTANT=`CONSTANT`,e.BINARY=`BINARY`,e}({}),it=function(e){return e.ADD=`ADD`,e.SUBTRACT=`SUBTRACT`,e.MULTIPLY=`MULTIPLY`,e.DIVIDE=`DIVIDE`,e}({}),M=function(e){return e.YEAR=`YEAR`,e.QUARTER=`QUARTER`,e.MONTH=`MONTH`,e.WEEK=`WEEK`,e.DAY=`DAY`,e.HOUR=`HOUR`,e.MINUTE=`MINUTE`,e.SECOND=`SECOND`,e}({}),at=function(e){return e.SUM=`SUM`,e.AVG=`AVG`,e.MIN=`MIN`,e.MAX=`MAX`,e}({});function N(e){return j.exists(e).field}function P(e){if(N(e),e.includes(`.`))throw TypeError(`aggregation alias must contain one segment.`);if(e.startsWith(`__wow`))throw TypeError(`aggregation alias must not use the reserved __wow prefix.`);return e}function F(e,t,n){return{type:`BINARY`,operator:e,left:t,right:n}}function I(e,t,n){return{type:`NUMERIC`,function:e,expression:t,alias:P(n)}}var ot={element(e,t){let n=N(e);return t===void 0?{path:n}:(j.elementMatch(e,t),{path:n,filter:t})},field(e){return{type:`FIELD`,field:N(e)}},constant(e){if(!Number.isFinite(e))throw TypeError(`aggregation constant must be finite.`);return{type:`CONSTANT`,value:e}},add:(e,t)=>F(`ADD`,e,t),subtract:(e,t)=>F(`SUBTRACT`,e,t),multiply:(e,t)=>F(`MULTIPLY`,e,t),divide:(e,t)=>F(`DIVIDE`,e,t),terms(e,t){return{type:`TERMS`,field:N(e),alias:P(t)}},histogram(e,{interval:t,alias:n}){if(!Number.isFinite(t)||t<=0)throw TypeError(`histogram interval must be finite and greater than 0.`);return{type:`HISTOGRAM`,field:N(e),interval:t,alias:P(n)}},dateHistogram(e,{unit:t,alias:n,timeZone:r=`UTC`}){if(!Object.values(M).includes(t))throw TypeError(`date histogram unit is invalid.`);if(typeof r!=`string`||!r.trim())throw TypeError(`date histogram timeZone cannot be blank.`);return{type:`DATE_HISTOGRAM`,field:N(e),unit:t,alias:P(n),timeZone:r}},any(e,t){return{type:`ANY`,field:N(e),alias:P(t)}},count(e){return{type:`COUNT`,alias:P(e)}},sum:(e,t)=>I(`SUM`,e,t),avg:(e,t)=>I(`AVG`,e,t),min:(e,t)=>I(`MIN`,e,t),max:(e,t)=>I(`MAX`,e,t)},L={index:1,size:10};function st({index:e=L.index,size:t=L.size}=L){return{index:e,size:t}}var R={};function z(){return R}function ct({include:e,exclude:t}=z()){return{include:e,exclude:t}}function B({condition:e,filter:t}){if(t===null)throw TypeError(`filter cannot be null.`);if(t!==void 0)return{filter:t};if(e===null)throw TypeError(`condition cannot be null.`);return{condition:e===void 0?g():e}}function V({condition:e,filter:t,projection:n,sort:r}={}){return{...B({condition:e,filter:t}),projection:n,sort:r}}function H({condition:e,filter:t,projection:n,sort:r,limit:i}={}){return{...B({condition:e,filter:t}),projection:n,sort:r,limit:i??(t===void 0?L.size:0)}}function lt({condition:e,filter:t,projection:n,sort:r,pagination:i=L}={}){return{...B({condition:e,filter:t}),projection:n,sort:r,pagination:i}}var U={total:0,list:[]};function ut({total:e,list:t=[]}=U){return e===void 0&&(e=t.length),{total:e,list:t}}var W=function(e){return e.ASC=`ASC`,e.DESC=`DESC`,e}({});function dt(e){return{field:e,direction:`ASC`}}function ft(e){return{field:e,direction:`DESC`}}var pt=class e{static{this.HEADER=`header`}static{this.COMMAND_OPERATOR=`${e.HEADER}.command_operator`}static{this.AGGREGATE_ID=`aggregateId`}static{this.TENANT_ID=`tenantId`}static{this.OWNER_ID=`ownerId`}static{this.SPACE_ID=`spaceId`}static{this.COMMAND_ID=`commandId`}static{this.REQUEST_ID=`requestId`}static{this.VERSION=`version`}static{this.BODY=`body`}static{this.BODY_ID=`${e.BODY}.id`}static{this.BODY_NAME=`${e.BODY}.name`}static{this.BODY_TYPE=`${e.BODY}.bodyType`}static{this.BODY_REVISION=`${e.BODY}.revision`}static{this.BODY_BODY=`${e.BODY}.body`}static{this.CREATE_TIME=`createTime`}},G=class e{static{this.EVENT_STREAM_RESOURCE_NAME=`event`}static{this.COUNT=`${e.EVENT_STREAM_RESOURCE_NAME}/count`}static{this.LIST=`${e.EVENT_STREAM_RESOURCE_NAME}/list`}static{this.PAGED=`${e.EVENT_STREAM_RESOURCE_NAME}/paged`}},K=class{constructor(e){this.apiMetadata=e}count(e,t,r){throw(0,n.autoGeneratedError)(e,t,r)}list(e,t,r){throw(0,n.autoGeneratedError)(e,t,r)}listStream(e,t,r){throw(0,n.autoGeneratedError)(e,t,r)}paged(e,t,r){throw(0,n.autoGeneratedError)(e,t,r)}};a([(0,n.post)(G.COUNT),i(0,(0,n.body)()),i(1,(0,n.attribute)()),r(`design:type`,Function),r(`design:paramtypes`,[Object,typeof Record>`u`?Object:Record,typeof AbortController>`u`?Object:AbortController]),r(`design:returntype`,typeof Promise>`u`?Object:Promise)],K.prototype,`count`,null),a([(0,n.post)(G.LIST),i(0,(0,n.body)()),i(1,(0,n.attribute)()),r(`design:type`,Function),r(`design:paramtypes`,[Object,typeof Record>`u`?Object:Record,typeof AbortController>`u`?Object:AbortController]),r(`design:returntype`,typeof Promise>`u`?Object:Promise)],K.prototype,`list`,null),a([(0,n.post)(G.LIST,{headers:{Accept:e.ContentTypeValues.TEXT_EVENT_STREAM},resultExtractor:t.JsonEventStreamResultExtractor}),i(0,(0,n.body)()),i(1,(0,n.attribute)()),r(`design:type`,Function),r(`design:paramtypes`,[Object,typeof Record>`u`?Object:Record,typeof AbortController>`u`?Object:AbortController]),r(`design:returntype`,typeof Promise>`u`?Object:Promise)],K.prototype,`listStream`,null),a([(0,n.post)(G.PAGED),i(0,(0,n.body)()),i(1,(0,n.attribute)()),r(`design:type`,Function),r(`design:paramtypes`,[Object,typeof Record>`u`?Object:Record,typeof AbortController>`u`?Object:AbortController]),r(`design:returntype`,typeof Promise>`u`?Object:Promise)],K.prototype,`paged`,null),K=a([(0,n.api)(),r(`design:paramtypes`,[Object])],K);var mt=class{static{this.VERSION=`version`}static{this.TENANT_ID=`tenantId`}static{this.OWNER_ID=`ownerId`}static{this.SPACE_ID=`spaceId`}static{this.EVENT_ID=`eventId`}static{this.FIRST_EVENT_TIME=`firstEventTime`}static{this.EVENT_TIME=`eventTime`}static{this.FIRST_OPERATOR=`firstOperator`}static{this.OPERATOR=`operator`}static{this.SNAPSHOT_TIME=`snapshotTime`}static{this.TAGS=`tags`}static{this.DELETED=`deleted`}static{this.STATE=`state`}},q=class e{static{this.SNAPSHOT_RESOURCE_NAME=`snapshot`}static{this.AGGREGATION=`${e.SNAPSHOT_RESOURCE_NAME}/aggregation`}static{this.COUNT=`${e.SNAPSHOT_RESOURCE_NAME}/count`}static{this.LIST=`${e.SNAPSHOT_RESOURCE_NAME}/list`}static{this.LIST_STATE=`${e.LIST}/state`}static{this.PAGED=`${e.SNAPSHOT_RESOURCE_NAME}/paged`}static{this.PAGED_STATE=`${e.PAGED}/state`}static{this.SINGLE=`${e.SNAPSHOT_RESOURCE_NAME}/single`}static{this.SINGLE_STATE=`${e.SINGLE}/state`}},J=class{constructor(e){this.apiMetadata=e}aggregate(e,t,r){throw(0,n.autoGeneratedError)(e,t,r)}aggregateStream(e,t,r){throw(0,n.autoGeneratedError)(e,t,r)}count(e,t,r){throw(0,n.autoGeneratedError)(e,t,r)}list(e,t,r){throw(0,n.autoGeneratedError)(e,t,r)}listStream(e,t,r){throw(0,n.autoGeneratedError)(e,t,r)}listState(e,t,r){throw(0,n.autoGeneratedError)(e,t,r)}listStateStream(e,t,r){throw(0,n.autoGeneratedError)(e,t,r)}paged(e,t,r){throw(0,n.autoGeneratedError)(e,t,r)}pagedState(e,t,r){throw(0,n.autoGeneratedError)(e,t,r)}single(e,t,r){throw(0,n.autoGeneratedError)(e,t,r)}singleState(e,t,r){throw(0,n.autoGeneratedError)(e,t,r)}getById(e,t,n){let r=V({condition:m(e)});return this.single(r,t,n)}getStateById(e,t,n){let r=V({condition:m(e)});return this.singleState(r,t,n)}getByIds(e,t,n){if(e.length===0)return Promise.resolve([]);let r=H({filter:j.aggregateIds(e),limit:e.length});return this.list(r,t,n)}getStateByIds(e,t,n){if(e.length===0)return Promise.resolve([]);let r=H({filter:j.aggregateIds(e),limit:e.length});return this.listState(r,t,n)}};a([(0,n.post)(q.AGGREGATION),i(0,(0,n.body)()),i(1,(0,n.attribute)()),r(`design:type`,Function),r(`design:paramtypes`,[Object,typeof Record>`u`?Object:Record,typeof AbortController>`u`?Object:AbortController]),r(`design:returntype`,typeof Promise>`u`?Object:Promise)],J.prototype,`aggregate`,null),a([(0,n.post)(q.AGGREGATION,{headers:{Accept:e.ContentTypeValues.TEXT_EVENT_STREAM},resultExtractor:t.JsonEventStreamResultExtractor}),i(0,(0,n.body)()),i(1,(0,n.attribute)()),r(`design:type`,Function),r(`design:paramtypes`,[Object,typeof Record>`u`?Object:Record,typeof AbortController>`u`?Object:AbortController]),r(`design:returntype`,typeof Promise>`u`?Object:Promise)],J.prototype,`aggregateStream`,null),a([(0,n.post)(q.COUNT),i(0,(0,n.body)()),i(1,(0,n.attribute)()),r(`design:type`,Function),r(`design:paramtypes`,[Object,typeof Record>`u`?Object:Record,typeof AbortController>`u`?Object:AbortController]),r(`design:returntype`,typeof Promise>`u`?Object:Promise)],J.prototype,`count`,null),a([(0,n.post)(q.LIST),i(0,(0,n.body)()),i(1,(0,n.attribute)()),r(`design:type`,Function),r(`design:paramtypes`,[Object,typeof Record>`u`?Object:Record,typeof AbortController>`u`?Object:AbortController]),r(`design:returntype`,typeof Promise>`u`?Object:Promise)],J.prototype,`list`,null),a([(0,n.post)(q.LIST,{headers:{Accept:e.ContentTypeValues.TEXT_EVENT_STREAM},resultExtractor:t.JsonEventStreamResultExtractor}),i(0,(0,n.body)()),i(1,(0,n.attribute)()),r(`design:type`,Function),r(`design:paramtypes`,[Object,typeof Record>`u`?Object:Record,typeof AbortController>`u`?Object:AbortController]),r(`design:returntype`,typeof Promise>`u`?Object:Promise)],J.prototype,`listStream`,null),a([(0,n.post)(q.LIST_STATE),i(0,(0,n.body)()),i(1,(0,n.attribute)()),r(`design:type`,Function),r(`design:paramtypes`,[Object,typeof Record>`u`?Object:Record,typeof AbortController>`u`?Object:AbortController]),r(`design:returntype`,typeof Promise>`u`?Object:Promise)],J.prototype,`listState`,null),a([(0,n.post)(q.LIST_STATE,{headers:{Accept:e.ContentTypeValues.TEXT_EVENT_STREAM},resultExtractor:t.JsonEventStreamResultExtractor}),i(0,(0,n.body)()),i(1,(0,n.attribute)()),r(`design:type`,Function),r(`design:paramtypes`,[Object,typeof Record>`u`?Object:Record,typeof AbortController>`u`?Object:AbortController]),r(`design:returntype`,typeof Promise>`u`?Object:Promise)],J.prototype,`listStateStream`,null),a([(0,n.post)(q.PAGED),i(0,(0,n.body)()),i(1,(0,n.attribute)()),r(`design:type`,Function),r(`design:paramtypes`,[Object,typeof Record>`u`?Object:Record,typeof AbortController>`u`?Object:AbortController]),r(`design:returntype`,typeof Promise>`u`?Object:Promise)],J.prototype,`paged`,null),a([(0,n.post)(q.PAGED_STATE),i(0,(0,n.body)()),i(1,(0,n.attribute)()),r(`design:type`,Function),r(`design:paramtypes`,[Object,typeof Record>`u`?Object:Record,typeof AbortController>`u`?Object:AbortController]),r(`design:returntype`,typeof Promise>`u`?Object:Promise)],J.prototype,`pagedState`,null),a([(0,n.post)(q.SINGLE),i(0,(0,n.body)()),i(1,(0,n.attribute)()),r(`design:type`,Function),r(`design:paramtypes`,[Object,typeof Record>`u`?Object:Record,typeof AbortController>`u`?Object:AbortController]),r(`design:returntype`,typeof Promise>`u`?Object:Promise)],J.prototype,`single`,null),a([(0,n.post)(q.SINGLE_STATE),i(0,(0,n.body)()),i(1,(0,n.attribute)()),r(`design:type`,Function),r(`design:paramtypes`,[Object,typeof Record>`u`?Object:Record,typeof AbortController>`u`?Object:AbortController]),r(`design:returntype`,typeof Promise>`u`?Object:Promise)],J.prototype,`singleState`,null),a([i(1,(0,n.attribute)()),r(`design:type`,Function),r(`design:paramtypes`,[String,typeof Record>`u`?Object:Record,typeof AbortController>`u`?Object:AbortController]),r(`design:returntype`,typeof Promise>`u`?Object:Promise)],J.prototype,`getById`,null),a([i(1,(0,n.attribute)()),r(`design:type`,Function),r(`design:paramtypes`,[String,typeof Record>`u`?Object:Record,typeof AbortController>`u`?Object:AbortController]),r(`design:returntype`,typeof Promise>`u`?Object:Promise)],J.prototype,`getStateById`,null),a([i(1,(0,n.attribute)()),r(`design:type`,Function),r(`design:paramtypes`,[Array,typeof Record>`u`?Object:Record,typeof AbortController>`u`?Object:AbortController]),r(`design:returntype`,typeof Promise>`u`?Object:Promise)],J.prototype,`getByIds`,null),a([i(1,(0,n.attribute)()),r(`design:type`,Function),r(`design:paramtypes`,[Array,typeof Record>`u`?Object:Record,typeof AbortController>`u`?Object:AbortController]),r(`design:returntype`,typeof Promise>`u`?Object:Promise)],J.prototype,`getStateByIds`,null),J=a([(0,n.api)(),r(`design:paramtypes`,[Object])],J);var Y=class e{static{this.LOAD=`{id}/state`}static{this.LOAD_VERSIONED=`${e.LOAD}/{version}`}static{this.LOAD_TIME_BASED=`${e.LOAD}/time/{createTime}`}},X=class{constructor(e){this.apiMetadata=e}load(e,t,r){throw(0,n.autoGeneratedError)(e,t,r)}loadVersioned(e,t,r,i){throw(0,n.autoGeneratedError)(e,t,r,i)}loadTimeBased(e,t,r,i){throw(0,n.autoGeneratedError)(e,t,r,i)}};a([(0,n.get)(Y.LOAD),i(0,(0,n.path)(`id`)),i(1,(0,n.attribute)()),r(`design:type`,Function),r(`design:paramtypes`,[String,typeof Record>`u`?Object:Record,typeof AbortController>`u`?Object:AbortController]),r(`design:returntype`,typeof Promise>`u`?Object:Promise)],X.prototype,`load`,null),a([(0,n.get)(Y.LOAD_VERSIONED),i(0,(0,n.path)(`id`)),i(1,(0,n.path)(`version`)),i(2,(0,n.attribute)()),r(`design:type`,Function),r(`design:paramtypes`,[String,Number,typeof Record>`u`?Object:Record,typeof AbortController>`u`?Object:AbortController]),r(`design:returntype`,typeof Promise>`u`?Object:Promise)],X.prototype,`loadVersioned`,null),a([(0,n.get)(Y.LOAD_TIME_BASED),i(0,(0,n.path)(`id`)),i(1,(0,n.path)(`createTime`)),i(2,(0,n.attribute)()),r(`design:type`,Function),r(`design:paramtypes`,[String,Number,typeof Record>`u`?Object:Record,typeof AbortController>`u`?Object:AbortController]),r(`design:returntype`,typeof Promise>`u`?Object:Promise)],X.prototype,`loadTimeBased`,null),X=a([(0,n.api)(),r(`design:paramtypes`,[Object])],X);var Z=class e{static{this.LOAD=`state`}static{this.LOAD_VERSIONED=`${e.LOAD}/{version}`}static{this.LOAD_TIME_BASED=`${e.LOAD}/time/{createTime}`}},Q=class{constructor(e){this.apiMetadata=e}load(e,t){throw(0,n.autoGeneratedError)(e,t)}loadVersioned(e,t,r){throw(0,n.autoGeneratedError)(e,t,r)}loadTimeBased(e,t,r){throw(0,n.autoGeneratedError)(e,t,r)}};a([(0,n.get)(Z.LOAD),i(0,(0,n.attribute)()),r(`design:type`,Function),r(`design:paramtypes`,[typeof Record>`u`?Object:Record,typeof AbortController>`u`?Object:AbortController]),r(`design:returntype`,typeof Promise>`u`?Object:Promise)],Q.prototype,`load`,null),a([(0,n.get)(Z.LOAD_VERSIONED),i(0,(0,n.path)(`version`)),i(1,(0,n.attribute)()),r(`design:type`,Function),r(`design:paramtypes`,[Number,typeof Record>`u`?Object:Record,typeof AbortController>`u`?Object:AbortController]),r(`design:returntype`,typeof Promise>`u`?Object:Promise)],Q.prototype,`loadVersioned`,null),a([(0,n.get)(Z.LOAD_TIME_BASED),i(0,(0,n.path)(`createTime`)),i(1,(0,n.attribute)()),r(`design:type`,Function),r(`design:paramtypes`,[Number,typeof Record>`u`?Object:Record,typeof AbortController>`u`?Object:AbortController]),r(`design:returntype`,typeof Promise>`u`?Object:Promise)],Q.prototype,`loadTimeBased`,null),Q=a([(0,n.api)(),r(`design:paramtypes`,[Object])],Q);var ht=`~`;function gt({field:e,cursorId:t=`~`,direction:n=W.DESC}){return n===W.ASC?_(e,t):v(e,t)}function _t({field:e,cursorId:t=`~`,direction:n=W.DESC}){return n===W.ASC?j.gt(e,t):j.lt(e,t)}function vt({field:e,direction:t=W.DESC}){return{field:e,direction:t}}function yt(e){let t=e.query,n=vt(e),r=`filter`in t?t.filter:void 0;if(r!==void 0)return{...t,filter:j.and([_t(e),r]),sort:[n]};let i=t;return{...t,condition:p(gt(e),i.condition),sort:[n]}}function $(t){let n=(0,e.combineURLs)(t.resourceAttribution??``,t.aggregateName??``);return t.contextAlias&&(n=(0,e.combineURLs)(t.contextAlias,n)),{...t,basePath:n}}var bt=class{constructor(e){this.defaultOptions=e}createSnapshotQueryClient(e){let t=$({...this.defaultOptions,...e});return new J(t)}createLoadStateAggregateClient(e){let t=$({...this.defaultOptions,...e});return new X(t)}createOwnerLoadStateAggregateClient(e){let t=$({...this.defaultOptions,...e});return new Q(t)}createEventStreamQueryClient(e){let t=$({...this.defaultOptions,...e});return new K(t)}},xt={},St=[`*`],Ct=function(e){return e.NONE=``,e.TENANT=`/tenant/{tenantId}`,e.OWNER=`/owner/{ownerId}`,e.TENANT_OWNER=`/tenant/{tenantId}/owner/{ownerId}`,e}({}),wt=function(e){return e.RECOVERABLE=`RECOVERABLE`,e.UNKNOWN=`UNKNOWN`,e.UNRECOVERABLE=`UNRECOVERABLE`,e}({}),Tt=class e{static{this.SUCCEEDED=`Ok`}static{this.SUCCEEDED_MESSAGE=``}static{this.NOT_FOUND=`NotFound`}static{this.NOT_FOUND_MESSAGE=`Not found resource!`}static{this.BAD_REQUEST=`BadRequest`}static{this.ILLEGAL_ARGUMENT=`IllegalArgument`}static{this.ILLEGAL_STATE=`IllegalState`}static{this.REQUEST_TIMEOUT=`RequestTimeout`}static{this.TOO_MANY_REQUESTS=`TooManyRequests`}static{this.DUPLICATE_REQUEST_ID=`DuplicateRequestId`}static{this.COMMAND_VALIDATION=`CommandValidation`}static{this.REWRITE_NO_COMMAND=`RewriteNoCommand`}static{this.EVENT_VERSION_CONFLICT=`EventVersionConflict`}static{this.DUPLICATE_AGGREGATE_ID=`DuplicateAggregateId`}static{this.COMMAND_EXPECT_VERSION_CONFLICT=`CommandExpectVersionConflict`}static{this.SOURCING_VERSION_CONFLICT=`SourcingVersionConflict`}static{this.ILLEGAL_ACCESS_DELETED_AGGREGATE=`IllegalAccessDeletedAggregate`}static{this.ILLEGAL_ACCESS_OWNER_AGGREGATE=`IllegalAccessOwnerAggregate`}static{this.ILLEGAL_ACCESS_SPACE_AGGREGATE=`IllegalAccessSpaceAggregate`}static{this.INTERNAL_SERVER_ERROR=`InternalServerError`}static isSucceeded(t){return t===e.SUCCEEDED}static isError(t){return!e.isSucceeded(t)}},Et=function(e){return e.COMMAND=`COMMAND`,e.ERROR=`ERROR`,e.EVENT=`EVENT`,e.SOURCING=`SOURCING`,e.STATE_EVENT=`STATE_EVENT`,e}({}),Dt=``,Ot=function(e){return e.MAP=`MAP`,e.STRING=`STRING`,e}({});function kt(e,t,n){if(e==null)return n;let r=Array.isArray(t)?t:t.split(`.`).filter(Boolean);if(r.length===0)return e;let i=e;for(let e of r){if(Array.isArray(i)){let t=parseInt(e,10);if(isNaN(t)||t<0||!Number.isInteger(t))return n;i=i[t]}else if(typeof i==`object`)i=i[e];else return n;if(i==null)return n}return i}exports.AggregationDateUnit=M,exports.AggregationExpressionOperator=it,exports.AggregationExpressionType=rt,exports.AggregationFunction=at,exports.AggregationGroupType=tt,exports.AggregationMetricType=nt,exports.CURSOR_ID_START=ht,Object.defineProperty(exports,"CommandClient",{enumerable:!0,get:function(){return o}}),exports.CommandHeaders=s,exports.CommandStage=ee,exports.ConditionOptionKey=re,exports.DEFAULT_OWNER_ID=Dt,exports.DEFAULT_PAGINATION=L,exports.DEFAULT_PROJECTION=R,exports.DeletionState=f,exports.DomainEventStreamMetadataFields=pt,exports.EMPTY_ABAC_TAGS=xt,exports.EMPTY_PAGED_LIST=U,exports.EMPTY_VALUE_OPERATORS=ne,exports.ErrorCodes=Tt,Object.defineProperty(exports,"EventStreamQueryClient",{enumerable:!0,get:function(){return K}}),exports.EventStreamQueryEndpointPaths=G,exports.FilterOperator=He,exports.FunctionKind=Et,exports.LOGICAL_OPERATORS=te,Object.defineProperty(exports,"LoadOwnerStateAggregateClient",{enumerable:!0,get:function(){return Q}}),exports.LoadOwnerStateAggregateEndpointPaths=Z,Object.defineProperty(exports,"LoadStateAggregateClient",{enumerable:!0,get:function(){return X}}),exports.LoadStateAggregateEndpointPaths=Y,exports.MessageHeaderSqlType=Ot,exports.Operator=c,exports.QueryClientFactory=bt,exports.RecoverableType=wt,exports.ResourceAttributionPathSpec=Ct,exports.SearchMode=y,exports.SnapshotMetadataFields=mt,Object.defineProperty(exports,"SnapshotQueryClient",{enumerable:!0,get:function(){return J}}),exports.SnapshotQueryEndpointPaths=q,exports.SortDirection=W,exports.StringComparison=Ue,exports.TimeUnit=b,exports.WILDCARD_ABAC_TAG_VALUES=St,exports.active=fe,exports.aggregateId=m,exports.aggregateIds=ce,exports.aggregation=ot,exports.all=g,exports.allIn=xe,exports.and=p,exports.asc=dt,exports.beforeToday=Me,exports.between=be,exports.contains=_e,exports.createQueryApiMetadata=$,exports.cursorCondition=gt,exports.cursorFilter=_t,exports.cursorQuery=yt,exports.cursorSort=vt,exports.dateOptions=d,exports.defaultProjection=z,exports.deleted=h,exports.desc=ft,exports.earlierDays=Be,exports.elemMatch=Te,exports.endsWith=we,exports.eq=pe,exports.exists=Ae,exports.filter=j,exports.getPropertyValue=kt,exports.gt=_,exports.gte=he,exports.id=oe,exports.ids=se,exports.ignoreCaseOptions=u,exports.isFalse=ke,exports.isIn=ve,exports.isNull=Ee,exports.isTrue=Oe,exports.isValidateCondition=l,exports.lastMonth=Re,exports.lastWeek=Ie,exports.listQuery=H,exports.lt=v,exports.lte=ge,exports.match=Ce,exports.ne=me,exports.nextWeek=Fe,exports.nor=ae,exports.notIn=ye,exports.notNull=De,exports.or=ie,exports.ownerId=ue,exports.pagedList=ut,exports.pagedQuery=lt,exports.pagination=st,exports.projection=ct,exports.raw=Ve,exports.recentDays=ze,exports.singleQuery=V,exports.spaceId=de,exports.startsWith=Se,exports.tenantId=le,exports.thisMonth=Le,exports.thisWeek=Pe,exports.today=je,exports.tomorrow=Ne;
1
+ Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});let e=require("@ahoo-wang/fetcher"),t=require("@ahoo-wang/fetcher-eventstream"),n=require("@ahoo-wang/fetcher-decorator");function r(e,t){if(typeof Reflect==`object`&&typeof Reflect.metadata==`function`)return Reflect.metadata(e,t)}function i(e,t){return function(n,r){t(n,r,e)}}function a(e,t,n,r){var i=arguments.length,a=i<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,n):r,o;if(typeof Reflect==`object`&&typeof Reflect.decorate==`function`)a=Reflect.decorate(e,t,n,r);else for(var s=e.length-1;s>=0;s--)(o=e[s])&&(a=(i<3?o(a):i>3?o(t,n,a):o(t,n))||a);return i>3&&a&&Object.defineProperty(t,n,a),a}var o=class{constructor(e){this.apiMetadata=e}send(e,t){throw(0,n.autoGeneratedError)(e,t)}sendAndWaitStream(e,t){throw(0,n.autoGeneratedError)(e,t)}};a([(0,n.endpoint)(),i(0,(0,n.request)()),i(1,(0,n.attribute)()),r(`design:type`,Function),r(`design:paramtypes`,[Object,typeof Record>`u`?Object:Record]),r(`design:returntype`,typeof Promise>`u`?Object:Promise)],o.prototype,`send`,null),a([(0,n.endpoint)(void 0,void 0,{headers:{Accept:e.ContentTypeValues.TEXT_EVENT_STREAM},resultExtractor:t.JsonEventStreamResultExtractor}),i(0,(0,n.request)()),i(1,(0,n.attribute)()),r(`design:type`,Function),r(`design:paramtypes`,[Object,typeof Record>`u`?Object:Record]),r(`design:returntype`,typeof Promise>`u`?Object:Promise)],o.prototype,`sendAndWaitStream`,null),o=a([(0,n.api)(),r(`design:paramtypes`,[Object])],o);var s=class e{static{this.COMMAND_HEADERS_PREFIX=`Command-`}static{this.TENANT_ID=`${e.COMMAND_HEADERS_PREFIX}Tenant-Id`}static{this.OWNER_ID=`${e.COMMAND_HEADERS_PREFIX}Owner-Id`}static{this.SPACE_ID=`${e.COMMAND_HEADERS_PREFIX}Space-Id`}static{this.AGGREGATE_ID=`${e.COMMAND_HEADERS_PREFIX}Aggregate-Id`}static{this.AGGREGATE_VERSION=`${e.COMMAND_HEADERS_PREFIX}Aggregate-Version`}static{this.WAIT_PREFIX=`${e.COMMAND_HEADERS_PREFIX}Wait-`}static{this.WAIT_TIME_OUT=`${e.WAIT_PREFIX}Timeout`}static{this.WAIT_STAGE=`${e.WAIT_PREFIX}Stage`}static{this.WAIT_CONTEXT=`${e.WAIT_PREFIX}Context`}static{this.WAIT_PROCESSOR=`${e.WAIT_PREFIX}Processor`}static{this.WAIT_FUNCTION=`${e.WAIT_PREFIX}Function`}static{this.WAIT_TAIL_PREFIX=`${e.WAIT_PREFIX}Tail-`}static{this.WAIT_TAIL_STAGE=`${e.WAIT_TAIL_PREFIX}Stage`}static{this.WAIT_TAIL_CONTEXT=`${e.WAIT_TAIL_PREFIX}Context`}static{this.WAIT_TAIL_PROCESSOR=`${e.WAIT_TAIL_PREFIX}Processor`}static{this.WAIT_TAIL_FUNCTION=`${e.WAIT_TAIL_PREFIX}Function`}static{this.REQUEST_ID=`${e.COMMAND_HEADERS_PREFIX}Request-Id`}static{this.LOCAL_FIRST=`${e.COMMAND_HEADERS_PREFIX}Local-First`}static{this.COMMAND_AGGREGATE_CONTEXT=`${e.COMMAND_HEADERS_PREFIX}Aggregate-Context`}static{this.COMMAND_AGGREGATE_NAME=`${e.COMMAND_HEADERS_PREFIX}Aggregate-Name`}static{this.COMMAND_TYPE=`${e.COMMAND_HEADERS_PREFIX}Type`}static{this.COMMAND_HEADER_X_PREFIX=`${e.COMMAND_HEADERS_PREFIX}Header-`}},ee=function(e){return e.SENT=`SENT`,e.PROCESSED=`PROCESSED`,e.SNAPSHOT=`SNAPSHOT`,e.PROJECTED=`PROJECTED`,e.EVENT_HANDLED=`EVENT_HANDLED`,e.SAGA_HANDLED=`SAGA_HANDLED`,e}({}),c=function(e){return e.AND=`AND`,e.OR=`OR`,e.NOR=`NOR`,e.ID=`ID`,e.IDS=`IDS`,e.AGGREGATE_ID=`AGGREGATE_ID`,e.AGGREGATE_IDS=`AGGREGATE_IDS`,e.TENANT_ID=`TENANT_ID`,e.OWNER_ID=`OWNER_ID`,e.SPACE_ID=`SPACE_ID`,e.DELETED=`DELETED`,e.ALL=`ALL`,e.EQ=`EQ`,e.NE=`NE`,e.GT=`GT`,e.LT=`LT`,e.GTE=`GTE`,e.LTE=`LTE`,e.CONTAINS=`CONTAINS`,e.IN=`IN`,e.NOT_IN=`NOT_IN`,e.BETWEEN=`BETWEEN`,e.ALL_IN=`ALL_IN`,e.STARTS_WITH=`STARTS_WITH`,e.ENDS_WITH=`ENDS_WITH`,e.ELEM_MATCH=`ELEM_MATCH`,e.NULL=`NULL`,e.NOT_NULL=`NOT_NULL`,e.TRUE=`TRUE`,e.FALSE=`FALSE`,e.EXISTS=`EXISTS`,e.TODAY=`TODAY`,e.BEFORE_TODAY=`BEFORE_TODAY`,e.TOMORROW=`TOMORROW`,e.THIS_WEEK=`THIS_WEEK`,e.NEXT_WEEK=`NEXT_WEEK`,e.LAST_WEEK=`LAST_WEEK`,e.THIS_MONTH=`THIS_MONTH`,e.LAST_MONTH=`LAST_MONTH`,e.RECENT_DAYS=`RECENT_DAYS`,e.EARLIER_DAYS=`EARLIER_DAYS`,e.MATCH=`MATCH`,e.RAW=`RAW`,e}({}),te=new Set([`AND`,`OR`,`NOR`]),ne=new Set([`NULL`,`NOT_NULL`,`TRUE`,`FALSE`,`EXISTS`,`TODAY`,`TOMORROW`,`THIS_WEEK`,`NEXT_WEEK`,`LAST_WEEK`,`THIS_MONTH`,`LAST_MONTH`]);function l(e){return!!e}var re=class{static{this.IGNORE_CASE_OPTION_KEY=`ignoreCase`}static{this.ZONE_ID_OPTION_KEY=`zoneId`}static{this.DATE_PATTERN_OPTION_KEY=`datePattern`}};function u(e){if(e!==void 0)return{ignoreCase:e}}function d(e,t){if(e===void 0&&t===void 0)return;let n={};return e!==void 0&&(n.datePattern=e),t!==void 0&&(n.zoneId=t),n}var f=function(e){return e.ACTIVE=`ACTIVE`,e.DELETED=`DELETED`,e.ALL=`ALL`,e}({});function ie(...e){if(e.length===0)return h();if(e.length===1)return l(e[0])?e[0]:h();let t=[];return e.forEach(e=>{e?.operator===c.ALL||!l(e)||(e.operator===c.AND&&e.children?t.push(...e.children):t.push(e))}),t.length===0?h():{operator:c.AND,children:t}}function ae(...e){let t=e?.filter(e=>l(e));return t.length===0?h():{operator:c.OR,children:t}}function oe(...e){return e.length===0?h():{operator:c.NOR,children:e}}function se(e){return{operator:c.ID,value:e}}function ce(e){return{operator:c.IDS,value:e}}function p(e){return{operator:c.AGGREGATE_ID,value:e}}function le(e){return{operator:c.AGGREGATE_IDS,value:e}}function ue(e){return{operator:c.TENANT_ID,value:e}}function de(e){return{operator:c.OWNER_ID,value:e}}function fe(e){return{operator:c.SPACE_ID,value:e}}function m(e){return{operator:c.DELETED,value:e}}function pe(){return m(`ACTIVE`)}function h(){return{operator:c.ALL}}function me(e,t){return{field:e,operator:c.EQ,value:t}}function he(e,t){return{field:e,operator:c.NE,value:t}}function ge(e,t){return{field:e,operator:c.GT,value:t}}function _e(e,t){return{field:e,operator:c.LT,value:t}}function ve(e,t){return{field:e,operator:c.GTE,value:t}}function ye(e,t){return{field:e,operator:c.LTE,value:t}}function be(e,t,n){let r=u(n);return{field:e,operator:c.CONTAINS,value:t,options:r}}function xe(e,...t){return{field:e,operator:c.IN,value:t}}function Se(e,...t){return{field:e,operator:c.NOT_IN,value:t}}function Ce(e,t,n){return{field:e,operator:c.BETWEEN,value:[t,n]}}function we(e,...t){return{field:e,operator:c.ALL_IN,value:t}}function Te(e,t,n){let r=u(n);return{field:e,operator:c.STARTS_WITH,value:t,options:r}}function Ee(e,t){return{field:e,operator:c.MATCH,value:t}}function De(e,t,n){let r=u(n);return{field:e,operator:c.ENDS_WITH,value:t,options:r}}function Oe(e,t){return{field:e,operator:c.ELEM_MATCH,children:[t]}}function ke(e){return{field:e,operator:c.NULL}}function Ae(e){return{field:e,operator:c.NOT_NULL}}function je(e){return{field:e,operator:c.TRUE}}function Me(e){return{field:e,operator:c.FALSE}}function Ne(e,t=!0){return{field:e,operator:c.EXISTS,value:t}}function Pe(e,t,n){let r=d(t,n);return{field:e,operator:c.TODAY,options:r}}function Fe(e,t,n,r){let i=d(n,r);return{field:e,operator:c.BEFORE_TODAY,value:t,options:i}}function Ie(e,t,n){let r=d(t,n);return{field:e,operator:c.TOMORROW,options:r}}function g(e,t,n){let r=d(t,n);return{field:e,operator:c.THIS_WEEK,options:r}}function _(e,t,n){let r=d(t,n);return{field:e,operator:c.NEXT_WEEK,options:r}}function Le(e,t,n){let r=d(t,n);return{field:e,operator:c.LAST_WEEK,options:r}}function Re(e,t,n){let r=d(t,n);return{field:e,operator:c.THIS_MONTH,options:r}}function ze(e,t,n){let r=d(t,n);return{field:e,operator:c.LAST_MONTH,options:r}}function Be(e,t,n,r){let i=d(n,r);return{field:e,operator:c.RECENT_DAYS,value:t,options:i}}function Ve(e,t,n,r){let i=d(n,r);return{field:e,operator:c.EARLIER_DAYS,value:t,options:i}}function He(e){return{operator:c.RAW,value:e}}var Ue=function(e){return e.MATCH_ALL=`MATCH_ALL`,e.MATCH_NONE=`MATCH_NONE`,e.ID=`ID`,e.IDS=`IDS`,e.AGGREGATE_ID=`AGGREGATE_ID`,e.AGGREGATE_IDS=`AGGREGATE_IDS`,e.TENANT_ID=`TENANT_ID`,e.OWNER_ID=`OWNER_ID`,e.SPACE_ID=`SPACE_ID`,e.AND=`AND`,e.OR=`OR`,e.NOR=`NOR`,e.EQ=`EQ`,e.NE=`NE`,e.GT=`GT`,e.GTE=`GTE`,e.LT=`LT`,e.LTE=`LTE`,e.CONTAINS=`CONTAINS`,e.STARTS_WITH=`STARTS_WITH`,e.ENDS_WITH=`ENDS_WITH`,e.IN=`IN`,e.NOT_IN=`NOT_IN`,e.BETWEEN=`BETWEEN`,e.CONTAINS_ALL=`CONTAINS_ALL`,e.IS_EMPTY=`IS_EMPTY`,e.IS_EMPTY_STRING=`IS_EMPTY_STRING`,e.IS_NOT_EMPTY_STRING=`IS_NOT_EMPTY_STRING`,e.IS_NULL=`IS_NULL`,e.IS_NOT_NULL=`IS_NOT_NULL`,e.EXISTS=`EXISTS`,e.NOT_EXISTS=`NOT_EXISTS`,e.DELETION=`DELETION`,e.ELEMENT_MATCH=`ELEMENT_MATCH`,e.SEARCH=`SEARCH`,e.TODAY=`TODAY`,e.BEFORE_TODAY=`BEFORE_TODAY`,e.TOMORROW=`TOMORROW`,e.THIS_WEEK=`THIS_WEEK`,e.NEXT_WEEK=`NEXT_WEEK`,e.LAST_WEEK=`LAST_WEEK`,e.THIS_MONTH=`THIS_MONTH`,e.LAST_MONTH=`LAST_MONTH`,e.YESTERDAY=`YESTERDAY`,e.NEXT_MONTH=`NEXT_MONTH`,e.LAST_YEAR=`LAST_YEAR`,e.THIS_YEAR=`THIS_YEAR`,e.NEXT_YEAR=`NEXT_YEAR`,e.RECENT_DAYS=`RECENT_DAYS`,e.EARLIER_DAYS=`EARLIER_DAYS`,e}({}),We=function(e){return e.CASE_SENSITIVE=`CASE_SENSITIVE`,e.CASE_INSENSITIVE=`CASE_INSENSITIVE`,e}({}),v=function(e){return e.TERMS=`TERMS`,e.PHRASE=`PHRASE`,e}({}),y=function(e){return e.NANOSECONDS=`NANOSECONDS`,e.MICROSECONDS=`MICROSECONDS`,e.MILLISECONDS=`MILLISECONDS`,e.SECONDS=`SECONDS`,e.MINUTES=`MINUTES`,e.HOURS=`HOURS`,e.DAYS=`DAYS`,e}({}),Ge=/^([01][0-9]|2[0-3]):[0-5][0-9](?::[0-5][0-9](?:\.[0-9]{1,9})?)?$/,Ke=/^@?[A-Za-z_][A-Za-z0-9_-]*(\.(?:@?[A-Za-z_][A-Za-z0-9_-]*|[0-9]+))*$/,qe=/^(?:UTC|GMT|UT)?[+-](\d{1,2}|\d{4}|\d{6}|\d{2}:\d{2}|\d{2}:\d{2}:\d{2})$/,Je=/^(?:UTC|GMT|UT)?[+-]/,Ye={G:5,u:19,y:19,Q:5,q:5,M:5,L:5,D:3,d:2,F:1,E:5,e:5,c:[1,3,4,5],a:1,B:[1,4,5],h:2,H:2,k:2,K:2,m:2,s:2,S:9,A:19,n:19,N:19,V:[2],v:[1,4],z:4,O:[1,4],X:5,x:5,Z:5,W:1,w:2,Y:1/0,g:19};function b(e){if(typeof e!=`string`||!Ke.test(e))throw TypeError(`Logical field is invalid: [${String(e)}].`);return e}function x(e,t){if(!(e===null?t:typeof e==`string`||typeof e==`boolean`||typeof e==`number`&&Number.isFinite(e)))throw TypeError(`Filter value must be a JSON scalar.`);return e}function S(e){return Array.isArray(e)?(e.forEach(e=>x(e,!0)),e):x(e,!0)}function C(e,t){if(typeof t!=`string`)throw TypeError(`${e} must be a string.`);return t}function w(e){if(e!==`CASE_SENSITIVE`&&e!==`CASE_INSENSITIVE`)throw TypeError(`String comparison is invalid: [${String(e)}].`)}function T(e,t){if(t.length===0)throw TypeError(`${e} cannot be empty.`);if(t.some(e=>e==null))throw TypeError(`${e} cannot contain null.`)}function Xe(e){let t=qe.exec(e);if(!t)return!1;let n=t[1],[r,i=0,a=0]=(n.includes(`:`)?n.split(`:`):n.length<=2?[n]:[n.slice(0,2),n.slice(2,4),n.slice(4,6)]).map(Number);return i<=59&&a<=59&&(r<18||r===18&&i===0&&a===0)}function E({zoneId:e,datePattern:t,timeUnit:n=`MILLISECONDS`}){if(e!==void 0){if(typeof e!=`string`||!e.trim())throw TypeError(`zoneId cannot be blank.`);if(Je.test(e)&&!Xe(e))throw TypeError(`zoneId is invalid: [${e}].`)}if(t!==void 0&&Qe(t),!Object.values(y).includes(n))throw TypeError(`timeUnit is invalid: [${String(n)}].`);return{...e===void 0?{}:{zoneId:e},...t===void 0?{}:{datePattern:t},timeUnit:n}}function Ze(e,t,n){let r=Ye[t];if(!(typeof r==`number`?n<=r:r?.includes(n)===!0))throw TypeError(`datePattern is invalid: [${e}].`)}function D(e,t){return e!==void 0&&(`uyDFdhHkKmsSgAnNWwY`.includes(e)||e===`c`&&t===1||`eMLQq`.includes(e)&&t<=2)}function Qe(e){if(typeof e!=`string`||!e.trim())throw TypeError(`datePattern cannot be blank.`);let t=!1,n=0;for(let r=0;r<e.length;r++){let i=e[r];if(i===`'`){e[r+1]===`'`?r++:t=!t;continue}if(!t){if(/[A-Za-z]/.test(i)){let t=i,n=r+1;for(;e[n]===t;)n++;let a=n-r,o=!1;if(t===`p`){if(o=!0,t=e[n],!t||!/[A-Za-z]/.test(t)||t===`p`)throw TypeError(`datePattern is invalid: [${e}].`);let r=n++;for(;e[n]===t;)n++;a=n-r}if(Ze(e,t,a),o&&D(t,a)){let t=e[n],r=n;for(;r<e.length&&e[r]===t;)r++;if(D(t,r-n))throw TypeError(`datePattern is invalid: [${e}].`)}r=n-1}else if(i===`[`)n++;else if(i===`]`){if(n===0)throw TypeError(`datePattern is invalid: [${e}].`);n--}else if(`{}#`.includes(i))throw TypeError(`datePattern is invalid: [${e}].`)}}if(t)throw TypeError(`datePattern is invalid: [${e}].`)}function O(e,t){if(!Number.isInteger(t)||t<1||t>2147483647)throw TypeError(`${e} days must be a positive JVM Int.`)}function k(e){switch(e.op){case`ID`:case`IDS`:case`AGGREGATE_ID`:case`AGGREGATE_IDS`:case`TENANT_ID`:case`OWNER_ID`:case`SPACE_ID`:case`DELETION`:case`SEARCH`:throw TypeError(`ELEMENT_MATCH predicate cannot contain root filters.`);case`AND`:case`OR`:case`NOR`:T(`${e.op} operands`,e.operands),e.operands.forEach(k);break;case`ELEMENT_MATCH`:k(e.predicate)}}function $e(e){return T(`AND operands`,e),{op:`AND`,operands:[...e]}}function et(e){return T(`OR operands`,e),{op:`OR`,operands:[...e]}}function tt(e){return T(`NOR operands`,e),{op:`NOR`,operands:[...e]}}var A={matchAll(){return{op:`MATCH_ALL`}},matchNone(){return{op:`MATCH_NONE`}},id(e){return{op:`ID`,value:C(`ID value`,e)}},ids(e){return T(`IDS values`,e),e.forEach(e=>C(`IDS value`,e)),{op:`IDS`,values:[...e]}},aggregateId(e){return{op:`AGGREGATE_ID`,value:C(`AGGREGATE_ID value`,e)}},aggregateIds(e){return T(`AGGREGATE_IDS values`,e),e.forEach(e=>C(`AGGREGATE_IDS value`,e)),{op:`AGGREGATE_IDS`,values:[...e]}},tenantId(e){return{op:`TENANT_ID`,value:C(`TENANT_ID value`,e)}},ownerId(e){return{op:`OWNER_ID`,value:C(`OWNER_ID value`,e)}},spaceId(e){return{op:`SPACE_ID`,value:C(`SPACE_ID value`,e)}},and:$e,or:et,nor:tt,eq(e,t){return{op:`EQ`,field:b(e),value:S(t)}},ne(e,t){return{op:`NE`,field:b(e),value:S(t)}},gt(e,t){return{op:`GT`,field:b(e),value:x(t,!1)}},gte(e,t){return{op:`GTE`,field:b(e),value:x(t,!1)}},lt(e,t){return{op:`LT`,field:b(e),value:x(t,!1)}},lte(e,t){return{op:`LTE`,field:b(e),value:x(t,!1)}},contains(e,t,n=`CASE_SENSITIVE`){return w(n),{op:`CONTAINS`,field:b(e),value:C(`CONTAINS value`,t),stringComparison:n}},startsWith(e,t,n=`CASE_SENSITIVE`){return w(n),{op:`STARTS_WITH`,field:b(e),value:C(`STARTS_WITH value`,t),stringComparison:n}},endsWith(e,t,n=`CASE_SENSITIVE`){return w(n),{op:`ENDS_WITH`,field:b(e),value:C(`ENDS_WITH value`,t),stringComparison:n}},isIn(e,t){return T(`IN values`,t),t.forEach(e=>x(e,!1)),{op:`IN`,field:b(e),values:[...t]}},notIn(e,t){return T(`NOT_IN values`,t),t.forEach(e=>x(e,!1)),{op:`NOT_IN`,field:b(e),values:[...t]}},containsAll(e,t){return T(`CONTAINS_ALL values`,t),t.forEach(e=>x(e,!1)),{op:`CONTAINS_ALL`,field:b(e),values:[...t]}},between(e,t,n){return{op:`BETWEEN`,field:b(e),lowerBound:x(t,!1),upperBound:x(n,!1)}},isEmpty(e){return{op:`IS_EMPTY`,field:b(e)}},isEmptyString(e){return{op:`IS_EMPTY_STRING`,field:b(e)}},isNotEmptyString(e){return{op:`IS_NOT_EMPTY_STRING`,field:b(e)}},isNull(e){return{op:`IS_NULL`,field:b(e)}},isNotNull(e){return{op:`IS_NOT_NULL`,field:b(e)}},exists(e){return{op:`EXISTS`,field:b(e)}},notExists(e){return{op:`NOT_EXISTS`,field:b(e)}},deletion(e){if(e!==f.ACTIVE&&e!==f.DELETED&&e!==f.ALL)throw TypeError(`Deletion state is invalid: [${String(e)}].`);return{op:`DELETION`,state:e}},elementMatch(e,t){return k(t),{op:`ELEMENT_MATCH`,field:b(e),predicate:t}},search(e,t){if(typeof e!=`string`||!e.trim())throw TypeError(`SEARCH query cannot be blank.`);if(t!==void 0&&(typeof t!=`object`||!t||Array.isArray(t)))throw TypeError(`SEARCH options must be a non-null object.`);let{fields:n=[],mode:r=`TERMS`}=t??{};if(!Object.values(v).includes(r))throw TypeError(`SEARCH mode is invalid: [${String(r)}].`);return{op:`SEARCH`,query:e,mode:r,fields:n.map(b)}},today(e,t={}){return{...E(t),op:`TODAY`,field:b(e)}},beforeToday(e,t,n={}){if(typeof t!=`string`||!Ge.test(t))throw TypeError(`BEFORE_TODAY time is invalid.`);return{...E(n),op:`BEFORE_TODAY`,field:b(e),time:t}},tomorrow(e,t={}){return{...E(t),op:`TOMORROW`,field:b(e)}},thisWeek(e,t={}){return{...E(t),op:`THIS_WEEK`,field:b(e)}},nextWeek(e,t={}){return{...E(t),op:`NEXT_WEEK`,field:b(e)}},lastWeek(e,t={}){return{...E(t),op:`LAST_WEEK`,field:b(e)}},thisMonth(e,t={}){return{...E(t),op:`THIS_MONTH`,field:b(e)}},lastMonth(e,t={}){return{...E(t),op:`LAST_MONTH`,field:b(e)}},yesterday(e,t={}){return{...E(t),op:`YESTERDAY`,field:b(e)}},nextMonth(e,t={}){return{...E(t),op:`NEXT_MONTH`,field:b(e)}},lastYear(e,t={}){return{...E(t),op:`LAST_YEAR`,field:b(e)}},thisYear(e,t={}){return{...E(t),op:`THIS_YEAR`,field:b(e)}},nextYear(e,t={}){return{...E(t),op:`NEXT_YEAR`,field:b(e)}},recentDays(e,t,n={}){return O(`RECENT_DAYS`,t),{...E(n),op:`RECENT_DAYS`,field:b(e),days:t}},earlierDays(e,t,n={}){return O(`EARLIER_DAYS`,t),{...E(n),op:`EARLIER_DAYS`,field:b(e),days:t}}},nt=function(e){return e.TERMS=`TERMS`,e.HISTOGRAM=`HISTOGRAM`,e.DATE_HISTOGRAM=`DATE_HISTOGRAM`,e}({}),rt=function(e){return e.COUNT=`COUNT`,e.NUMERIC=`NUMERIC`,e.ANY=`ANY`,e}({}),it=function(e){return e.FIELD=`FIELD`,e.CONSTANT=`CONSTANT`,e.BINARY=`BINARY`,e}({}),at=function(e){return e.ADD=`ADD`,e.SUBTRACT=`SUBTRACT`,e.MULTIPLY=`MULTIPLY`,e.DIVIDE=`DIVIDE`,e}({}),j=function(e){return e.YEAR=`YEAR`,e.QUARTER=`QUARTER`,e.MONTH=`MONTH`,e.WEEK=`WEEK`,e.DAY=`DAY`,e.HOUR=`HOUR`,e.MINUTE=`MINUTE`,e.SECOND=`SECOND`,e}({}),ot=function(e){return e.SUM=`SUM`,e.AVG=`AVG`,e.MIN=`MIN`,e.MAX=`MAX`,e}({});function M(e){return A.exists(e).field}function N(e){if(M(e),e.includes(`.`))throw TypeError(`aggregation alias must contain one segment.`);if(e.startsWith(`__wow`))throw TypeError(`aggregation alias must not use the reserved __wow prefix.`);return e}function P(e,t,n){return{type:`BINARY`,operator:e,left:t,right:n}}function F(e,t,n){return{type:`NUMERIC`,function:e,expression:t,alias:N(n)}}var st={element(e,t){let n=M(e);return t===void 0?{path:n}:(A.elementMatch(e,t),{path:n,filter:t})},field(e){return{type:`FIELD`,field:M(e)}},constant(e){if(!Number.isFinite(e))throw TypeError(`aggregation constant must be finite.`);return{type:`CONSTANT`,value:e}},add:(e,t)=>P(`ADD`,e,t),subtract:(e,t)=>P(`SUBTRACT`,e,t),multiply:(e,t)=>P(`MULTIPLY`,e,t),divide:(e,t)=>P(`DIVIDE`,e,t),terms(e,t){return{type:`TERMS`,field:M(e),alias:N(t)}},histogram(e,{interval:t,alias:n}){if(!Number.isFinite(t)||t<=0)throw TypeError(`histogram interval must be finite and greater than 0.`);return{type:`HISTOGRAM`,field:M(e),interval:t,alias:N(n)}},dateHistogram(e,{unit:t,alias:n,timeZone:r=`UTC`}){if(!Object.values(j).includes(t))throw TypeError(`date histogram unit is invalid.`);if(typeof r!=`string`||!r.trim())throw TypeError(`date histogram timeZone cannot be blank.`);return{type:`DATE_HISTOGRAM`,field:M(e),unit:t,alias:N(n),timeZone:r}},any(e,t){return{type:`ANY`,field:M(e),alias:N(t)}},count(e){return{type:`COUNT`,alias:N(e)}},sum:(e,t)=>F(`SUM`,e,t),avg:(e,t)=>F(`AVG`,e,t),min:(e,t)=>F(`MIN`,e,t),max:(e,t)=>F(`MAX`,e,t)},I={index:1,size:10};function ct({index:e=I.index,size:t=I.size}=I){return{index:e,size:t}}var L={};function R(){return L}function lt({include:e,exclude:t}=R()){return{include:e,exclude:t}}function z({condition:e,filter:t}){if(t===null)throw TypeError(`filter cannot be null.`);if(t!==void 0)return{filter:t};if(e===null)throw TypeError(`condition cannot be null.`);return{condition:e===void 0?h():e}}function B({condition:e,filter:t,projection:n,sort:r}={}){return{...z({condition:e,filter:t}),projection:n,sort:r}}function V({condition:e,filter:t,projection:n,sort:r,limit:i}={}){return{...z({condition:e,filter:t}),projection:n,sort:r,limit:i??(t===void 0?I.size:0)}}function ut({condition:e,filter:t,projection:n,sort:r,pagination:i=I}={}){return{...z({condition:e,filter:t}),projection:n,sort:r,pagination:i}}var H={total:0,list:[]};function dt({total:e,list:t=[]}=H){return e===void 0&&(e=t.length),{total:e,list:t}}var ft=function(e){return e.ASC=`ASC`,e.DESC=`DESC`,e}({});function pt(e){return{field:e,direction:`ASC`}}function mt(e){return{field:e,direction:`DESC`}}var ht=class e{static{this.HEADER=`header`}static{this.COMMAND_OPERATOR=`${e.HEADER}.command_operator`}static{this.AGGREGATE_ID=`aggregateId`}static{this.TENANT_ID=`tenantId`}static{this.OWNER_ID=`ownerId`}static{this.SPACE_ID=`spaceId`}static{this.COMMAND_ID=`commandId`}static{this.REQUEST_ID=`requestId`}static{this.VERSION=`version`}static{this.BODY=`body`}static{this.BODY_ID=`${e.BODY}.id`}static{this.BODY_NAME=`${e.BODY}.name`}static{this.BODY_TYPE=`${e.BODY}.bodyType`}static{this.BODY_REVISION=`${e.BODY}.revision`}static{this.BODY_BODY=`${e.BODY}.body`}static{this.CREATE_TIME=`createTime`}},U=class e{static{this.EVENT_STREAM_RESOURCE_NAME=`event`}static{this.AGGREGATION=`${e.EVENT_STREAM_RESOURCE_NAME}/aggregation`}static{this.COUNT=`${e.EVENT_STREAM_RESOURCE_NAME}/count`}static{this.LIST=`${e.EVENT_STREAM_RESOURCE_NAME}/list`}static{this.PAGED=`${e.EVENT_STREAM_RESOURCE_NAME}/paged`}static{this.CURSOR=`${e.EVENT_STREAM_RESOURCE_NAME}/cursor`}},W=class{constructor(e){this.apiMetadata=e}aggregate(e,t,r){throw(0,n.autoGeneratedError)(e,t,r)}aggregateStream(e,t,r){throw(0,n.autoGeneratedError)(e,t,r)}cursor(e,t,r){throw(0,n.autoGeneratedError)(e,t,r)}count(e,t,r){throw(0,n.autoGeneratedError)(e,t,r)}list(e,t,r){throw(0,n.autoGeneratedError)(e,t,r)}listStream(e,t,r){throw(0,n.autoGeneratedError)(e,t,r)}paged(e,t,r){throw(0,n.autoGeneratedError)(e,t,r)}};a([(0,n.post)(U.AGGREGATION),i(0,(0,n.body)()),i(1,(0,n.attribute)()),r(`design:type`,Function),r(`design:paramtypes`,[Object,typeof Record>`u`?Object:Record,typeof AbortController>`u`?Object:AbortController]),r(`design:returntype`,typeof Promise>`u`?Object:Promise)],W.prototype,`aggregate`,null),a([(0,n.post)(U.AGGREGATION,{headers:{Accept:e.ContentTypeValues.TEXT_EVENT_STREAM},resultExtractor:t.JsonEventStreamResultExtractor}),i(0,(0,n.body)()),i(1,(0,n.attribute)()),r(`design:type`,Function),r(`design:paramtypes`,[Object,typeof Record>`u`?Object:Record,typeof AbortController>`u`?Object:AbortController]),r(`design:returntype`,typeof Promise>`u`?Object:Promise)],W.prototype,`aggregateStream`,null),a([(0,n.post)(U.CURSOR),i(0,(0,n.body)()),i(1,(0,n.attribute)()),r(`design:type`,Function),r(`design:paramtypes`,[Object,typeof Record>`u`?Object:Record,typeof AbortController>`u`?Object:AbortController]),r(`design:returntype`,typeof Promise>`u`?Object:Promise)],W.prototype,`cursor`,null),a([(0,n.post)(U.COUNT),i(0,(0,n.body)()),i(1,(0,n.attribute)()),r(`design:type`,Function),r(`design:paramtypes`,[Object,typeof Record>`u`?Object:Record,typeof AbortController>`u`?Object:AbortController]),r(`design:returntype`,typeof Promise>`u`?Object:Promise)],W.prototype,`count`,null),a([(0,n.post)(U.LIST),i(0,(0,n.body)()),i(1,(0,n.attribute)()),r(`design:type`,Function),r(`design:paramtypes`,[Object,typeof Record>`u`?Object:Record,typeof AbortController>`u`?Object:AbortController]),r(`design:returntype`,typeof Promise>`u`?Object:Promise)],W.prototype,`list`,null),a([(0,n.post)(U.LIST,{headers:{Accept:e.ContentTypeValues.TEXT_EVENT_STREAM},resultExtractor:t.JsonEventStreamResultExtractor}),i(0,(0,n.body)()),i(1,(0,n.attribute)()),r(`design:type`,Function),r(`design:paramtypes`,[Object,typeof Record>`u`?Object:Record,typeof AbortController>`u`?Object:AbortController]),r(`design:returntype`,typeof Promise>`u`?Object:Promise)],W.prototype,`listStream`,null),a([(0,n.post)(U.PAGED),i(0,(0,n.body)()),i(1,(0,n.attribute)()),r(`design:type`,Function),r(`design:paramtypes`,[Object,typeof Record>`u`?Object:Record,typeof AbortController>`u`?Object:AbortController]),r(`design:returntype`,typeof Promise>`u`?Object:Promise)],W.prototype,`paged`,null),W=a([(0,n.api)(),r(`design:paramtypes`,[Object])],W);var gt=class{static{this.VERSION=`version`}static{this.TENANT_ID=`tenantId`}static{this.OWNER_ID=`ownerId`}static{this.SPACE_ID=`spaceId`}static{this.EVENT_ID=`eventId`}static{this.FIRST_EVENT_TIME=`firstEventTime`}static{this.EVENT_TIME=`eventTime`}static{this.FIRST_OPERATOR=`firstOperator`}static{this.OPERATOR=`operator`}static{this.SNAPSHOT_TIME=`snapshotTime`}static{this.TAGS=`tags`}static{this.DELETED=`deleted`}static{this.STATE=`state`}},G=class e{static{this.SNAPSHOT_RESOURCE_NAME=`snapshot`}static{this.AGGREGATION=`${e.SNAPSHOT_RESOURCE_NAME}/aggregation`}static{this.COUNT=`${e.SNAPSHOT_RESOURCE_NAME}/count`}static{this.LIST=`${e.SNAPSHOT_RESOURCE_NAME}/list`}static{this.LIST_STATE=`${e.LIST}/state`}static{this.PAGED=`${e.SNAPSHOT_RESOURCE_NAME}/paged`}static{this.PAGED_STATE=`${e.PAGED}/state`}static{this.CURSOR=`${e.SNAPSHOT_RESOURCE_NAME}/cursor`}static{this.CURSOR_STATE=`${e.CURSOR}/state`}static{this.SINGLE=`${e.SNAPSHOT_RESOURCE_NAME}/single`}static{this.SINGLE_STATE=`${e.SINGLE}/state`}},K=class{constructor(e){this.apiMetadata=e}aggregate(e,t,r){throw(0,n.autoGeneratedError)(e,t,r)}aggregateStream(e,t,r){throw(0,n.autoGeneratedError)(e,t,r)}cursor(e,t,r){throw(0,n.autoGeneratedError)(e,t,r)}cursorState(e,t,r){throw(0,n.autoGeneratedError)(e,t,r)}count(e,t,r){throw(0,n.autoGeneratedError)(e,t,r)}list(e,t,r){throw(0,n.autoGeneratedError)(e,t,r)}listStream(e,t,r){throw(0,n.autoGeneratedError)(e,t,r)}listState(e,t,r){throw(0,n.autoGeneratedError)(e,t,r)}listStateStream(e,t,r){throw(0,n.autoGeneratedError)(e,t,r)}paged(e,t,r){throw(0,n.autoGeneratedError)(e,t,r)}pagedState(e,t,r){throw(0,n.autoGeneratedError)(e,t,r)}single(e,t,r){throw(0,n.autoGeneratedError)(e,t,r)}singleState(e,t,r){throw(0,n.autoGeneratedError)(e,t,r)}getById(e,t,n){let r=B({condition:p(e)});return this.single(r,t,n)}getStateById(e,t,n){let r=B({condition:p(e)});return this.singleState(r,t,n)}getByIds(e,t,n){if(e.length===0)return Promise.resolve([]);let r=V({filter:A.aggregateIds(e),limit:e.length});return this.list(r,t,n)}getStateByIds(e,t,n){if(e.length===0)return Promise.resolve([]);let r=V({filter:A.aggregateIds(e),limit:e.length});return this.listState(r,t,n)}};a([(0,n.post)(G.AGGREGATION),i(0,(0,n.body)()),i(1,(0,n.attribute)()),r(`design:type`,Function),r(`design:paramtypes`,[Object,typeof Record>`u`?Object:Record,typeof AbortController>`u`?Object:AbortController]),r(`design:returntype`,typeof Promise>`u`?Object:Promise)],K.prototype,`aggregate`,null),a([(0,n.post)(G.AGGREGATION,{headers:{Accept:e.ContentTypeValues.TEXT_EVENT_STREAM},resultExtractor:t.JsonEventStreamResultExtractor}),i(0,(0,n.body)()),i(1,(0,n.attribute)()),r(`design:type`,Function),r(`design:paramtypes`,[Object,typeof Record>`u`?Object:Record,typeof AbortController>`u`?Object:AbortController]),r(`design:returntype`,typeof Promise>`u`?Object:Promise)],K.prototype,`aggregateStream`,null),a([(0,n.post)(G.CURSOR),i(0,(0,n.body)()),i(1,(0,n.attribute)()),r(`design:type`,Function),r(`design:paramtypes`,[Object,typeof Record>`u`?Object:Record,typeof AbortController>`u`?Object:AbortController]),r(`design:returntype`,typeof Promise>`u`?Object:Promise)],K.prototype,`cursor`,null),a([(0,n.post)(G.CURSOR_STATE),i(0,(0,n.body)()),i(1,(0,n.attribute)()),r(`design:type`,Function),r(`design:paramtypes`,[Object,typeof Record>`u`?Object:Record,typeof AbortController>`u`?Object:AbortController]),r(`design:returntype`,typeof Promise>`u`?Object:Promise)],K.prototype,`cursorState`,null),a([(0,n.post)(G.COUNT),i(0,(0,n.body)()),i(1,(0,n.attribute)()),r(`design:type`,Function),r(`design:paramtypes`,[Object,typeof Record>`u`?Object:Record,typeof AbortController>`u`?Object:AbortController]),r(`design:returntype`,typeof Promise>`u`?Object:Promise)],K.prototype,`count`,null),a([(0,n.post)(G.LIST),i(0,(0,n.body)()),i(1,(0,n.attribute)()),r(`design:type`,Function),r(`design:paramtypes`,[Object,typeof Record>`u`?Object:Record,typeof AbortController>`u`?Object:AbortController]),r(`design:returntype`,typeof Promise>`u`?Object:Promise)],K.prototype,`list`,null),a([(0,n.post)(G.LIST,{headers:{Accept:e.ContentTypeValues.TEXT_EVENT_STREAM},resultExtractor:t.JsonEventStreamResultExtractor}),i(0,(0,n.body)()),i(1,(0,n.attribute)()),r(`design:type`,Function),r(`design:paramtypes`,[Object,typeof Record>`u`?Object:Record,typeof AbortController>`u`?Object:AbortController]),r(`design:returntype`,typeof Promise>`u`?Object:Promise)],K.prototype,`listStream`,null),a([(0,n.post)(G.LIST_STATE),i(0,(0,n.body)()),i(1,(0,n.attribute)()),r(`design:type`,Function),r(`design:paramtypes`,[Object,typeof Record>`u`?Object:Record,typeof AbortController>`u`?Object:AbortController]),r(`design:returntype`,typeof Promise>`u`?Object:Promise)],K.prototype,`listState`,null),a([(0,n.post)(G.LIST_STATE,{headers:{Accept:e.ContentTypeValues.TEXT_EVENT_STREAM},resultExtractor:t.JsonEventStreamResultExtractor}),i(0,(0,n.body)()),i(1,(0,n.attribute)()),r(`design:type`,Function),r(`design:paramtypes`,[Object,typeof Record>`u`?Object:Record,typeof AbortController>`u`?Object:AbortController]),r(`design:returntype`,typeof Promise>`u`?Object:Promise)],K.prototype,`listStateStream`,null),a([(0,n.post)(G.PAGED),i(0,(0,n.body)()),i(1,(0,n.attribute)()),r(`design:type`,Function),r(`design:paramtypes`,[Object,typeof Record>`u`?Object:Record,typeof AbortController>`u`?Object:AbortController]),r(`design:returntype`,typeof Promise>`u`?Object:Promise)],K.prototype,`paged`,null),a([(0,n.post)(G.PAGED_STATE),i(0,(0,n.body)()),i(1,(0,n.attribute)()),r(`design:type`,Function),r(`design:paramtypes`,[Object,typeof Record>`u`?Object:Record,typeof AbortController>`u`?Object:AbortController]),r(`design:returntype`,typeof Promise>`u`?Object:Promise)],K.prototype,`pagedState`,null),a([(0,n.post)(G.SINGLE),i(0,(0,n.body)()),i(1,(0,n.attribute)()),r(`design:type`,Function),r(`design:paramtypes`,[Object,typeof Record>`u`?Object:Record,typeof AbortController>`u`?Object:AbortController]),r(`design:returntype`,typeof Promise>`u`?Object:Promise)],K.prototype,`single`,null),a([(0,n.post)(G.SINGLE_STATE),i(0,(0,n.body)()),i(1,(0,n.attribute)()),r(`design:type`,Function),r(`design:paramtypes`,[Object,typeof Record>`u`?Object:Record,typeof AbortController>`u`?Object:AbortController]),r(`design:returntype`,typeof Promise>`u`?Object:Promise)],K.prototype,`singleState`,null),a([i(1,(0,n.attribute)()),r(`design:type`,Function),r(`design:paramtypes`,[String,typeof Record>`u`?Object:Record,typeof AbortController>`u`?Object:AbortController]),r(`design:returntype`,typeof Promise>`u`?Object:Promise)],K.prototype,`getById`,null),a([i(1,(0,n.attribute)()),r(`design:type`,Function),r(`design:paramtypes`,[String,typeof Record>`u`?Object:Record,typeof AbortController>`u`?Object:AbortController]),r(`design:returntype`,typeof Promise>`u`?Object:Promise)],K.prototype,`getStateById`,null),a([i(1,(0,n.attribute)()),r(`design:type`,Function),r(`design:paramtypes`,[Array,typeof Record>`u`?Object:Record,typeof AbortController>`u`?Object:AbortController]),r(`design:returntype`,typeof Promise>`u`?Object:Promise)],K.prototype,`getByIds`,null),a([i(1,(0,n.attribute)()),r(`design:type`,Function),r(`design:paramtypes`,[Array,typeof Record>`u`?Object:Record,typeof AbortController>`u`?Object:AbortController]),r(`design:returntype`,typeof Promise>`u`?Object:Promise)],K.prototype,`getStateByIds`,null),K=a([(0,n.api)(),r(`design:paramtypes`,[Object])],K);var q=class e{static{this.LOAD=`{id}/state`}static{this.LOAD_VERSIONED=`${e.LOAD}/{version}`}static{this.LOAD_TIME_BASED=`${e.LOAD}/time/{createTime}`}},J=class{constructor(e){this.apiMetadata=e}load(e,t,r){throw(0,n.autoGeneratedError)(e,t,r)}loadVersioned(e,t,r,i){throw(0,n.autoGeneratedError)(e,t,r,i)}loadTimeBased(e,t,r,i){throw(0,n.autoGeneratedError)(e,t,r,i)}};a([(0,n.get)(q.LOAD),i(0,(0,n.path)(`id`)),i(1,(0,n.attribute)()),r(`design:type`,Function),r(`design:paramtypes`,[String,typeof Record>`u`?Object:Record,typeof AbortController>`u`?Object:AbortController]),r(`design:returntype`,typeof Promise>`u`?Object:Promise)],J.prototype,`load`,null),a([(0,n.get)(q.LOAD_VERSIONED),i(0,(0,n.path)(`id`)),i(1,(0,n.path)(`version`)),i(2,(0,n.attribute)()),r(`design:type`,Function),r(`design:paramtypes`,[String,Number,typeof Record>`u`?Object:Record,typeof AbortController>`u`?Object:AbortController]),r(`design:returntype`,typeof Promise>`u`?Object:Promise)],J.prototype,`loadVersioned`,null),a([(0,n.get)(q.LOAD_TIME_BASED),i(0,(0,n.path)(`id`)),i(1,(0,n.path)(`createTime`)),i(2,(0,n.attribute)()),r(`design:type`,Function),r(`design:paramtypes`,[String,Number,typeof Record>`u`?Object:Record,typeof AbortController>`u`?Object:AbortController]),r(`design:returntype`,typeof Promise>`u`?Object:Promise)],J.prototype,`loadTimeBased`,null),J=a([(0,n.api)(),r(`design:paramtypes`,[Object])],J);var Y=class e{static{this.LOAD=`state`}static{this.LOAD_VERSIONED=`${e.LOAD}/{version}`}static{this.LOAD_TIME_BASED=`${e.LOAD}/time/{createTime}`}},X=class{constructor(e){this.apiMetadata=e}load(e,t){throw(0,n.autoGeneratedError)(e,t)}loadVersioned(e,t,r){throw(0,n.autoGeneratedError)(e,t,r)}loadTimeBased(e,t,r){throw(0,n.autoGeneratedError)(e,t,r)}};a([(0,n.get)(Y.LOAD),i(0,(0,n.attribute)()),r(`design:type`,Function),r(`design:paramtypes`,[typeof Record>`u`?Object:Record,typeof AbortController>`u`?Object:AbortController]),r(`design:returntype`,typeof Promise>`u`?Object:Promise)],X.prototype,`load`,null),a([(0,n.get)(Y.LOAD_VERSIONED),i(0,(0,n.path)(`version`)),i(1,(0,n.attribute)()),r(`design:type`,Function),r(`design:paramtypes`,[Number,typeof Record>`u`?Object:Record,typeof AbortController>`u`?Object:AbortController]),r(`design:returntype`,typeof Promise>`u`?Object:Promise)],X.prototype,`loadVersioned`,null),a([(0,n.get)(Y.LOAD_TIME_BASED),i(0,(0,n.path)(`createTime`)),i(1,(0,n.attribute)()),r(`design:type`,Function),r(`design:paramtypes`,[Number,typeof Record>`u`?Object:Record,typeof AbortController>`u`?Object:AbortController]),r(`design:returntype`,typeof Promise>`u`?Object:Promise)],X.prototype,`loadTimeBased`,null),X=a([(0,n.api)(),r(`design:paramtypes`,[Object])],X);var _t=10,Z=2147483646,vt=32;function yt({filter:e,projection:t={},sort:n=[],size:r=10,cursor:i=null}){if(!Number.isInteger(r)||r<1||r>2147483646)throw TypeError(`size must be between 1 and ${Z}.`);if(n.length>32)throw TypeError(`sort must contain at most 32 fields.`);return{filter:e,projection:t,sort:n,size:r,cursor:i}}function Q(t){let n=(0,e.combineURLs)(t.resourceAttribution??``,t.aggregateName??``);return t.contextAlias&&(n=(0,e.combineURLs)(t.contextAlias,n)),{...t,basePath:n}}var bt=class{constructor(e){this.defaultOptions=e}createSnapshotQueryClient(e){let t=Q({...this.defaultOptions,...e});return new K(t)}createLoadStateAggregateClient(e){let t=Q({...this.defaultOptions,...e});return new J(t)}createOwnerLoadStateAggregateClient(e){let t=Q({...this.defaultOptions,...e});return new X(t)}createEventStreamQueryClient(e){let t=Q({...this.defaultOptions,...e});return new W(t)}},xt={},St=[`*`],Ct=function(e){return e.NONE=``,e.TENANT=`/tenant/{tenantId}`,e.OWNER=`/owner/{ownerId}`,e.TENANT_OWNER=`/tenant/{tenantId}/owner/{ownerId}`,e}({}),wt=function(e){return e.RECOVERABLE=`RECOVERABLE`,e.UNKNOWN=`UNKNOWN`,e.UNRECOVERABLE=`UNRECOVERABLE`,e}({}),Tt=class e{static{this.SUCCEEDED=`Ok`}static{this.SUCCEEDED_MESSAGE=``}static{this.NOT_FOUND=`NotFound`}static{this.NOT_FOUND_MESSAGE=`Not found resource!`}static{this.BAD_REQUEST=`BadRequest`}static{this.ILLEGAL_ARGUMENT=`IllegalArgument`}static{this.ILLEGAL_STATE=`IllegalState`}static{this.REQUEST_TIMEOUT=`RequestTimeout`}static{this.TOO_MANY_REQUESTS=`TooManyRequests`}static{this.DUPLICATE_REQUEST_ID=`DuplicateRequestId`}static{this.COMMAND_VALIDATION=`CommandValidation`}static{this.REWRITE_NO_COMMAND=`RewriteNoCommand`}static{this.EVENT_VERSION_CONFLICT=`EventVersionConflict`}static{this.DUPLICATE_AGGREGATE_ID=`DuplicateAggregateId`}static{this.COMMAND_EXPECT_VERSION_CONFLICT=`CommandExpectVersionConflict`}static{this.SOURCING_VERSION_CONFLICT=`SourcingVersionConflict`}static{this.ILLEGAL_ACCESS_DELETED_AGGREGATE=`IllegalAccessDeletedAggregate`}static{this.ILLEGAL_ACCESS_OWNER_AGGREGATE=`IllegalAccessOwnerAggregate`}static{this.ILLEGAL_ACCESS_SPACE_AGGREGATE=`IllegalAccessSpaceAggregate`}static{this.INTERNAL_SERVER_ERROR=`InternalServerError`}static isSucceeded(t){return t===e.SUCCEEDED}static isError(t){return!e.isSucceeded(t)}},$=function(e){return e.COMMAND=`COMMAND`,e.ERROR=`ERROR`,e.EVENT=`EVENT`,e.SOURCING=`SOURCING`,e.STATE_EVENT=`STATE_EVENT`,e}({}),Et=``,Dt=function(e){return e.MAP=`MAP`,e.STRING=`STRING`,e}({});function Ot(e,t,n){if(e==null)return n;let r=Array.isArray(t)?t:t.split(`.`).filter(Boolean);if(r.length===0)return e;let i=e;for(let e of r){if(Array.isArray(i)){let t=parseInt(e,10);if(isNaN(t)||t<0||!Number.isInteger(t))return n;i=i[t]}else if(typeof i==`object`)i=i[e];else return n;if(i==null)return n}return i}exports.AggregationDateUnit=j,exports.AggregationExpressionOperator=at,exports.AggregationExpressionType=it,exports.AggregationFunction=ot,exports.AggregationGroupType=nt,exports.AggregationMetricType=rt,Object.defineProperty(exports,"CommandClient",{enumerable:!0,get:function(){return o}}),exports.CommandHeaders=s,exports.CommandStage=ee,exports.ConditionOptionKey=re,exports.DEFAULT_CURSOR_SIZE=_t,exports.DEFAULT_OWNER_ID=Et,exports.DEFAULT_PAGINATION=I,exports.DEFAULT_PROJECTION=L,exports.DeletionState=f,exports.DomainEventStreamMetadataFields=ht,exports.EMPTY_ABAC_TAGS=xt,exports.EMPTY_PAGED_LIST=H,exports.EMPTY_VALUE_OPERATORS=ne,exports.ErrorCodes=Tt,Object.defineProperty(exports,"EventStreamQueryClient",{enumerable:!0,get:function(){return W}}),exports.EventStreamQueryEndpointPaths=U,exports.FilterOperator=Ue,exports.FunctionKind=$,exports.LOGICAL_OPERATORS=te,Object.defineProperty(exports,"LoadOwnerStateAggregateClient",{enumerable:!0,get:function(){return X}}),exports.LoadOwnerStateAggregateEndpointPaths=Y,Object.defineProperty(exports,"LoadStateAggregateClient",{enumerable:!0,get:function(){return J}}),exports.LoadStateAggregateEndpointPaths=q,exports.MAX_CURSOR_SIZE=Z,exports.MAX_CURSOR_SORT_FIELDS=vt,exports.MessageHeaderSqlType=Dt,exports.Operator=c,exports.QueryClientFactory=bt,exports.RecoverableType=wt,exports.ResourceAttributionPathSpec=Ct,exports.SearchMode=v,exports.SnapshotMetadataFields=gt,Object.defineProperty(exports,"SnapshotQueryClient",{enumerable:!0,get:function(){return K}}),exports.SnapshotQueryEndpointPaths=G,exports.SortDirection=ft,exports.StringComparison=We,exports.TimeUnit=y,exports.WILDCARD_ABAC_TAG_VALUES=St,exports.active=pe,exports.aggregateId=p,exports.aggregateIds=le,exports.aggregation=st,exports.all=h,exports.allIn=we,exports.and=ie,exports.asc=pt,exports.beforeToday=Fe,exports.between=Ce,exports.contains=be,exports.createQueryApiMetadata=Q,exports.cursorQuery=yt,exports.dateOptions=d,exports.defaultProjection=R,exports.deleted=m,exports.desc=mt,exports.earlierDays=Ve,exports.elemMatch=Oe,exports.endsWith=De,exports.eq=me,exports.exists=Ne,exports.filter=A,exports.getPropertyValue=Ot,exports.gt=ge,exports.gte=ve,exports.id=se,exports.ids=ce,exports.ignoreCaseOptions=u,exports.isFalse=Me,exports.isIn=xe,exports.isNull=ke,exports.isTrue=je,exports.isValidateCondition=l,exports.lastMonth=ze,exports.lastWeek=Le,exports.listQuery=V,exports.lt=_e,exports.lte=ye,exports.match=Ee,exports.ne=he,exports.nextWeek=_,exports.nor=oe,exports.notIn=Se,exports.notNull=Ae,exports.or=ae,exports.ownerId=de,exports.pagedList=dt,exports.pagedQuery=ut,exports.pagination=ct,exports.projection=lt,exports.raw=He,exports.recentDays=Be,exports.singleQuery=B,exports.spaceId=fe,exports.startsWith=Te,exports.tenantId=ue,exports.thisMonth=Re,exports.thisWeek=g,exports.today=Pe,exports.tomorrow=Ie;
2
2
  //# sourceMappingURL=index.cjs.js.map