dynatron
Version:
The most advanced ORM for AWS DynamoDB
1 lines • 70.3 kB
JavaScript
(()=>{var e={74:(e,t,r)=>{"use strict";r.r(t),r.d(t,{convertToAttr:()=>n,convertToNative:()=>y,marshall:()=>C,unmarshall:()=>x});const n=(e,t)=>{if(void 0===e)throw new Error("Pass options.removeUndefinedValues=true to remove undefined values from map/array/set.");if(null===e&&"object"==typeof e)return u();if(Array.isArray(e))return s(e,t);if("Set"===e?.constructor?.name)return i(e,t);if("Map"===e?.constructor?.name)return a(e,t);if("Object"===e?.constructor?.name||!e.constructor&&"object"==typeof e)return o(e,t);if(m(e))return 0===e.length&&t?.convertEmptyValues?u():l(e);if("boolean"==typeof e||"Boolean"===e?.constructor?.name)return{BOOL:e.valueOf()};if("number"==typeof e||"Number"===e?.constructor?.name)return p(e);if("bigint"==typeof e)return d(e);if("string"==typeof e||"String"===e?.constructor?.name)return 0===e.length&&t?.convertEmptyValues?u():c(e);if(t?.convertClassInstanceToMap&&"object"==typeof e)return o(e,t);throw new Error(`Unsupported type passed: ${e}. Pass options.convertClassInstanceToMap=true to marshall typeof object as map attribute.`)},s=(e,t)=>({L:e.filter((e=>!t?.removeUndefinedValues||t?.removeUndefinedValues&&void 0!==e)).map((e=>n(e,t)))}),i=(e,t)=>{const r=t?.removeUndefinedValues?new Set([...e].filter((e=>void 0!==e))):e;if(!t?.removeUndefinedValues&&r.has(void 0))throw new Error("Pass options.removeUndefinedValues=true to remove undefined values from map/array/set.");if(0===r.size){if(t?.convertEmptyValues)return u();throw new Error("Pass a non-empty set, or options.convertEmptyValues=true.")}const n=r.values().next().value;if("number"==typeof n)return{NS:Array.from(r).map(p).map((e=>e.N))};if("bigint"==typeof n)return{NS:Array.from(r).map(d).map((e=>e.N))};if("string"==typeof n)return{SS:Array.from(r).map(c).map((e=>e.S))};if(m(n))return{BS:Array.from(r).map(l).map((e=>e.B))};throw new Error("Only Number Set (NS), Binary Set (BS) or String Set (SS) are allowed.")},a=(e,t)=>({M:(e=>{const r={};for(const[s,i]of e)"function"==typeof i||void 0===i&&t?.removeUndefinedValues||(r[s]=n(i,t));return r})(e)}),o=(e,t)=>({M:(e=>{const r={};for(const s in e){const i=e[s];"function"==typeof i||void 0===i&&t?.removeUndefinedValues||(r[s]=n(i,t))}return r})(e)}),u=()=>({NULL:!0}),l=e=>({B:e}),c=e=>({S:e.toString()}),d=e=>({N:e.toString()}),h=e=>{throw new Error(`${e} ${"function"==typeof BigInt?"Use BigInt.":"Pass string value instead."} `)},p=e=>{if([Number.NaN,Number.POSITIVE_INFINITY,Number.NEGATIVE_INFINITY].map((e=>e.toString())).includes(e.toString()))throw new Error(`Special numeric value ${e.toString()} is not allowed`);return e>Number.MAX_SAFE_INTEGER?h(`Number ${e.toString()} is greater than Number.MAX_SAFE_INTEGER.`):e<Number.MIN_SAFE_INTEGER&&h(`Number ${e.toString()} is lesser than Number.MIN_SAFE_INTEGER.`),{N:e.toString()}},m=e=>{const t=["ArrayBuffer","Blob","Buffer","DataView","File","Int8Array","Uint8Array","Uint8ClampedArray","Int16Array","Uint16Array","Int32Array","Uint32Array","Float32Array","Float64Array","BigInt64Array","BigUint64Array"];return!!e?.constructor&&t.includes(e.constructor.name)},y=(e,t)=>{for(const[r,n]of Object.entries(e))if(void 0!==n)switch(r){case"NULL":return null;case"BOOL":return Boolean(n);case"N":return f(n,t);case"B":return T(n);case"S":return b(n);case"L":return v(n,t);case"M":return E(n,t);case"NS":return new Set(n.map((e=>f(e,t))));case"BS":return new Set(n.map(T));case"SS":return new Set(n.map(b));default:throw new Error(`Unsupported type passed: ${r}`)}throw new Error(`No value defined: ${JSON.stringify(e)}`)},f=(e,t)=>{if(t?.wrapNumbers)return{value:e};const r=Number(e),n=[Number.POSITIVE_INFINITY,Number.NEGATIVE_INFINITY];if((r>Number.MAX_SAFE_INTEGER||r<Number.MIN_SAFE_INTEGER)&&!n.includes(r)){if("function"!=typeof BigInt)throw new Error(`${e} is outside SAFE_INTEGER bounds. Set options.wrapNumbers to get string value.`);try{return BigInt(e)}catch(t){throw new Error(`${e} can't be converted to BigInt. Set options.wrapNumbers to get string value.`)}}return r},b=e=>e,T=e=>e,v=(e,t)=>e.map((e=>y(e,t))),E=(e,t)=>Object.entries(e).reduce(((e,[r,n])=>(e[r]=y(n,t),e)),{});function C(e,t){const r=n(e,t),[s,i]=Object.entries(r)[0];switch(s){case"M":case"L":return i;default:return r}}const x=(e,t)=>y({M:e},t)},47:(e,t,r)=>{var n=r(268);e.exports=function(e,t){return new Promise((function(r,s){var i,a=t||{};function o(e){s(e||new Error("Aborted"))}function u(e,t){e.bail?o(e):i.retry(e)?a.onRetry&&a.onRetry(e,t):s(i.mainError())}"randomize"in a||(a.randomize=!0),(i=n.operation(a)).attempt((function(t){var n;try{n=e(o,t)}catch(e){return void u(e,t)}Promise.resolve(n).then(r).catch((function(e){u(e,t)}))}))}))}},41:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.the=t.an=t.a=t.attribute=t.isConditionEmptyDeep=t.truthy=t.isTruthy=t.falsy=t.isFalsy=t.nullish=t.isNullish=t.size=t.any=t.or=t.ne=t.notEquals=t.not=t.lte=t.lessThanOrEquals=t.lt=t.lessThan=t.isIn=t.gte=t.greaterThanOrEquals=t.gt=t.greaterThan=t.eq=t.equals=t.contains=t.between=t.beginsWith=t.type=t.attributeType=t.notExists=t.attributeNotExists=t.exists=t.attributeExists=t.all=t.and=void 0;t.and=(...e)=>({kind:"AND",conditions:e.flatMap((e=>Array.isArray(e)?e:[e]))}),t.all=t.and;t.attributeExists=e=>({kind:"attribute_exists",attributePath:e}),t.exists=t.attributeExists;t.attributeNotExists=e=>({kind:"attribute_not_exists",attributePath:e}),t.notExists=t.attributeNotExists;t.attributeType=(e,t)=>({kind:"attribute_type",attributePath:e,value:{binary:"B",binarySet:"BS",boolean:"BOOL",list:"L",map:"M",null:"NULL",number:"N",numberSet:"NS",string:"S",stringSet:"SS"}[t]}),t.type=t.attributeType;t.beginsWith=(e,t)=>({kind:"begins_with",attributePath:e,value:t});t.between=(e,t)=>({kind:"BETWEEN",attributePath:e,values:t});t.contains=(e,t)=>({kind:"contains",attributePath:e,value:t});t.equals=(e,t)=>({kind:"=",attributePath:e,value:t}),t.eq=t.equals;t.greaterThan=(e,t)=>({kind:">",attributePath:e,value:t}),t.gt=t.greaterThan;t.greaterThanOrEquals=(e,t)=>({kind:">=",attributePath:e,value:t}),t.gte=t.greaterThanOrEquals;t.isIn=(e,t)=>({kind:"IN",attributePath:e,values:t});t.lessThan=(e,t)=>({kind:"<",attributePath:e,value:t}),t.lt=t.lessThan;t.lessThanOrEquals=(e,t)=>({kind:"<=",attributePath:e,value:t}),t.lte=t.lessThanOrEquals;t.not=e=>({kind:"NOT",condition:e});t.notEquals=(e,t)=>({kind:"<>",attributePath:e,value:t}),t.ne=t.notEquals;t.or=(...e)=>({kind:"OR",conditions:e.flatMap((e=>Array.isArray(e)?e:[e]))}),t.any=t.or;t.size=e=>({kind:"size",attributePath:e});t.isNullish=e=>(0,t.or)((0,t.attributeNotExists)(e),(0,t.attributeType)(e,"null"),(0,t.equals)(e,null)),t.nullish=t.isNullish;t.isFalsy=e=>(0,t.or)((0,t.isNullish)(e),(0,t.isIn)(e,[!1,0,-0,""])),t.falsy=t.isFalsy;t.isTruthy=e=>(0,t.not)((0,t.isFalsy)(e)),t.truthy=t.isTruthy;t.isConditionEmptyDeep=e=>e.every((e=>null==e||(Array.isArray(e)?(0,t.isConditionEmptyDeep)(e):("OR"===e.kind||"AND"===e.kind)&&(0,t.isConditionEmptyDeep)(e.conditions))));t.attribute=e=>({attributeExists:(0,t.attributeExists)(e),exists:()=>(0,t.attributeExists)(e),attributeNotExists:()=>(0,t.attributeNotExists)(e),notExists:()=>(0,t.attributeNotExists)(e),doesNotExist:()=>(0,t.attributeNotExists)(e),attributeType:r=>(0,t.attributeType)(e,r),type:r=>(0,t.attributeType)(e,r),isOfType:r=>(0,t.attributeType)(e,r),isBinary:()=>(0,t.attributeType)(e,"binary"),isBinarySet:()=>(0,t.attributeType)(e,"binarySet"),isBoolean:()=>(0,t.attributeType)(e,"boolean"),isList:()=>(0,t.attributeType)(e,"list"),isMap:()=>(0,t.attributeType)(e,"map"),isNull:()=>(0,t.attributeType)(e,"null"),isNumber:()=>(0,t.attributeType)(e,"number"),isNumberSet:()=>(0,t.attributeType)(e,"numberSet"),isString:()=>(0,t.attributeType)(e,"string"),isStringSet:()=>(0,t.attributeType)(e,"stringSet"),isUndefined:()=>(0,t.attributeNotExists)(e),beginsWith:r=>(0,t.beginsWith)(e,r),between:r=>(0,t.between)(e,r),isBetween:r=>(0,t.between)(e,r),contains:r=>(0,t.contains)(e,r),equals:r=>(0,t.equals)(e,r),eq:r=>(0,t.equals)(e,r),isEqualTo:r=>(0,t.equals)(e,r),greaterThan:r=>(0,t.greaterThan)(e,r),gt:r=>(0,t.greaterThan)(e,r),isGreaterThan:r=>(0,t.greaterThan)(e,r),greaterThanOrEquals:r=>(0,t.greaterThanOrEquals)(e,r),gte:r=>(0,t.greaterThanOrEquals)(e,r),isGreaterThanOrEquals:r=>(0,t.greaterThanOrEquals)(e,r),isIn:r=>(0,t.isIn)(e,r),in:r=>(0,t.isIn)(e,r),lessThan:r=>(0,t.lessThan)(e,r),lt:r=>(0,t.lessThan)(e,r),isLessThan:r=>(0,t.lessThan)(e,r),lessThanOrEquals:r=>(0,t.lessThanOrEquals)(e,r),lte:r=>(0,t.lessThanOrEquals)(e,r),isLessThanOrEquals:r=>(0,t.lessThanOrEquals)(e,r),notEquals:r=>(0,t.notEquals)(e,r),ne:r=>(0,t.notEquals)(e,r),isNotEqualTo:r=>(0,t.notEquals)(e,r),size:()=>({between:r=>(0,t.between)((0,t.size)(e),r),isBetween:r=>(0,t.between)((0,t.size)(e),r),equals:r=>(0,t.equals)((0,t.size)(e),r),eq:r=>(0,t.equals)((0,t.size)(e),r),isEqualTo:r=>(0,t.equals)((0,t.size)(e),r),greaterThan:r=>(0,t.greaterThan)((0,t.size)(e),r),gt:r=>(0,t.greaterThan)((0,t.size)(e),r),isGreaterThan:r=>(0,t.greaterThan)((0,t.size)(e),r),greaterThanOrEquals:r=>(0,t.greaterThanOrEquals)((0,t.size)(e),r),gte:r=>(0,t.greaterThanOrEquals)((0,t.size)(e),r),isGreaterThanOrEquals:r=>(0,t.greaterThanOrEquals)((0,t.size)(e),r),isIn:r=>(0,t.isIn)((0,t.size)(e),r),in:r=>(0,t.isIn)((0,t.size)(e),r),lessThan:r=>(0,t.lessThan)((0,t.size)(e),r),lt:r=>(0,t.lessThan)((0,t.size)(e),r),isLessThan:r=>(0,t.lessThan)((0,t.size)(e),r),lessThanOrEquals:r=>(0,t.lessThanOrEquals)((0,t.size)(e),r),lte:r=>(0,t.lessThanOrEquals)((0,t.size)(e),r),isLessThanOrEquals:r=>(0,t.lessThanOrEquals)((0,t.size)(e),r),notEquals:r=>(0,t.notEquals)((0,t.size)(e),r),ne:r=>(0,t.notEquals)((0,t.size)(e),r),isNotEqualTo:r=>(0,t.notEquals)((0,t.size)(e),r)}),isNullish:()=>(0,t.isNullish)(e),nullish:()=>(0,t.isNullish)(e),isFalsy:()=>(0,t.isFalsy)(e),falsy:()=>(0,t.isFalsy)(e),isTruthy:()=>(0,t.isTruthy)(e),truthy:()=>(0,t.isTruthy)(e)}),t.a=t.attribute,t.an=t.attribute,t.the=t.attribute},417:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.Dynatron=t.DynatronClient=void 0;const n=r(317),s=r(41),i=r(570),a=r(468),o=r(656),u=r(641),l=r(178),c=r(92),d=r(270),h=r(815),p=r(805),m=r(986),y=r(519),f=r(295),b=r(629),T=r(396),v=r(724),E=r(854),C=r(302),x=r(182);class DynatronClient extends n.DynamoDBClient{constructor(e){super(e),this.configuration=e,this.returnMetrics=!1,this.returnMetrics=!!e.returnMetrics}}t.DynatronClient=DynatronClient;t.Dynatron=class Dynatron{constructor(e){this.client=e}Items(e){return{check:t=>new i.Check(this.client,e,t),delete:t=>new u.Delete(this.client,e,t),get:t=>new l.Get(this.client,e,t),put:t=>new c.Put(this.client,e,t),query:(t,r)=>new d.Query(this.client,e,(0,s.equals)(t,r)),scan:()=>new h.Scan(this.client,e),update:t=>new p.Update(this.client,e,t)}}get Batch(){return{get:e=>new a.BatchGet(this.client,e),write:e=>new o.BatchWrite(this.client,e)}}get Transact(){return{get:e=>new C.TransactGet(this.client,e),write:e=>new x.TransactWrite(this.client,e)}}get Tables(){return{create:e=>new m.TableCreate(this.client,e),delete:e=>new y.TableDelete(this.client,e),describe:e=>new f.TableDescribe(this.client,e),describeTTL:e=>new T.TableTTLDescribe(this.client,e),list:()=>new b.TableList(this.client),update:e=>new E.TableUpdate(this.client,e),updateTTL:e=>new v.TableTTLUpdate(this.client,e)}}}},837:function(e,t,r){"use strict";var n,s=this&&this.__classPrivateFieldGet||function(e,t,r,n){if("a"===r&&!n)throw new TypeError("Private accessor was defined without a getter");if("function"==typeof t?e!==t||!n:!t.has(e))throw new TypeError("Cannot read private member from an object whose class did not declare it");return"m"===r?n:"a"===r?n.call(e):n?n.value:t.get(e)},i=this&&this.__classPrivateFieldSet||function(e,t,r,n,s){if("m"===n)throw new TypeError("Private method is not writable");if("a"===n&&!s)throw new TypeError("Private accessor was defined without a setter");if("function"==typeof t?e!==t||!s:!t.has(e))throw new TypeError("Cannot write private member to an object whose class did not declare it");return"a"===n?s.call(e,r):s?s.value=r:t.set(e,r),r};Object.defineProperty(t,"__esModule",{value:!0}),t.Amend=void 0;const a=r(317),o=r(65),u=r(645);class Amend extends u.ItemRequest{constructor(){super(...arguments),n.set(this,void 0),this.returnItemCollectionMetrics=(e=a.ReturnItemCollectionMetrics.SIZE)=>(i(this,n,e,"f"),this)}[(n=new WeakMap,o.BUILD)](){return{...super[o.BUILD](),...s(this,n,"f")&&{ReturnItemCollectionMetrics:s(this,n,"f")}}}}t.Amend=Amend},570:function(e,t,r){"use strict";var n,s,i=this&&this.__classPrivateFieldSet||function(e,t,r,n,s){if("m"===n)throw new TypeError("Private method is not writable");if("a"===n&&!s)throw new TypeError("Private accessor was defined without a setter");if("function"==typeof t?e!==t||!s:!t.has(e))throw new TypeError("Cannot write private member to an object whose class did not declare it");return"a"===n?s.call(e,r):s?s.value=r:t.set(e,r),r},a=this&&this.__classPrivateFieldGet||function(e,t,r,n){if("a"===r&&!n)throw new TypeError("Private accessor was defined without a getter");if("function"==typeof t?e!==t||!n:!t.has(e))throw new TypeError("Cannot read private member from an object whose class did not declare it");return"m"===r?n:"a"===r?n.call(e):n?n.value:t.get(e)};Object.defineProperty(t,"__esModule",{value:!0}),t.Check=void 0;const o=r(317),u=r(41),l=r(65),c=r(837);class Check extends c.Amend{constructor(e,t,r){super(e,t),this.key=r,n.set(this,void 0),s.set(this,void 0),this.returnValues=(e=o.ReturnValue.ALL_NEW)=>(i(this,s,e,"f"),this),this.if=(...e)=>{var t;return(0,u.isConditionEmptyDeep)(e)||i(this,n,[...null!==(t=a(this,n,"f"))&&void 0!==t?t:[],...e.flatMap((e=>Array.isArray(e)?e:[e])).filter((e=>null!=e))],"f"),this},r&&(0,l.validateKey)(r)}[(n=new WeakMap,s=new WeakMap,l.BUILD)](){var e;return{...super[l.BUILD](),...this.key&&{_Key:this.key},...(null===(e=a(this,n,"f"))||void 0===e?void 0:e.length)&&{_ConditionExpressions:a(this,n,"f")},ReturnValues:a(this,s,"f")||("Update"===this.constructor.name?o.ReturnValue.ALL_NEW:o.ReturnValue.NONE)}}}t.Check=Check},929:function(e,t,r){"use strict";var n,s,i=this&&this.__classPrivateFieldGet||function(e,t,r,n){if("a"===r&&!n)throw new TypeError("Private accessor was defined without a getter");if("function"==typeof t?e!==t||!n:!t.has(e))throw new TypeError("Cannot read private member from an object whose class did not declare it");return"m"===r?n:"a"===r?n.call(e):n?n.value:t.get(e)},a=this&&this.__classPrivateFieldSet||function(e,t,r,n,s){if("m"===n)throw new TypeError("Private method is not writable");if("a"===n&&!s)throw new TypeError("Private accessor was defined without a setter");if("function"==typeof t?e!==t||!s:!t.has(e))throw new TypeError("Cannot write private member to an object whose class did not declare it");return"a"===n?s.call(e,r):s?s.value=r:t.set(e,r),r};Object.defineProperty(t,"__esModule",{value:!0}),t.Fetch=void 0;const o=r(65),u=r(645);class Fetch extends u.ItemRequest{constructor(){super(...arguments),n.set(this,void 0),s.set(this,void 0),this.consistentRead=(e=!0)=>(a(this,n,e,"f"),this),this.select=(...e)=>{var t,r;if(e.flat().length>0&&!e.every((e=>null==e)))for(const n of e)n&&a(this,s,[...new Set([...null!==(t=i(this,s,"f"))&&void 0!==t?t:[],...null!==(r="string"==typeof n?[n]:n)&&void 0!==r?r:[]])],"f");return this}}[(n=new WeakMap,s=new WeakMap,o.BUILD)](){var e;return{...super[o.BUILD](),...i(this,n,"f")&&{ConsistentRead:i(this,n,"f")},...(null===(e=i(this,s,"f"))||void 0===e?void 0:e.length)&&{_ProjectionExpressions:i(this,s,"f")}}}}t.Fetch=Fetch},892:function(e,t,r){"use strict";var n,s,i,a,o=this&&this.__classPrivateFieldGet||function(e,t,r,n){if("a"===r&&!n)throw new TypeError("Private accessor was defined without a getter");if("function"==typeof t?e!==t||!n:!t.has(e))throw new TypeError("Cannot read private member from an object whose class did not declare it");return"m"===r?n:"a"===r?n.call(e):n?n.value:t.get(e)},u=this&&this.__classPrivateFieldSet||function(e,t,r,n,s){if("m"===n)throw new TypeError("Private method is not writable");if("a"===n&&!s)throw new TypeError("Private accessor was defined without a setter");if("function"==typeof t?e!==t||!s:!t.has(e))throw new TypeError("Cannot write private member to an object whose class did not declare it");return"a"===n?s.call(e,r):s?s.value=r:t.set(e,r),r};Object.defineProperty(t,"__esModule",{value:!0}),t.ListFetch=void 0;const l=r(41),c=r(65),d=r(929);class ListFetch extends d.Fetch{constructor(){super(...arguments),n.set(this,void 0),s.set(this,void 0),i.set(this,void 0),a.set(this,void 0),this.where=(...e)=>{var t;return(0,l.isConditionEmptyDeep)(e)||u(this,s,[...null!==(t=o(this,s,"f"))&&void 0!==t?t:[],...e.flatMap((e=>Array.isArray(e)?e:[e])).filter((e=>null!=e))],"f"),this},this.indexName=e=>(u(this,i,e,"f"),this),this.limit=e=>(u(this,a,e,"f"),this),this.start=e=>(null!=e&&u(this,n,e,"f"),this)}[(n=new WeakMap,s=new WeakMap,i=new WeakMap,a=new WeakMap,c.BUILD)](){var e;return{...super[c.BUILD](),...(null===(e=o(this,s,"f"))||void 0===e?void 0:e.length)&&{_FilterExpressions:o(this,s,"f")},...o(this,i,"f")&&{IndexName:o(this,i,"f")},...o(this,a,"f")&&{Limit:o(this,a,"f")},...o(this,n,"f")&&{_ExclusiveStartKey:o(this,n,"f")}}}}t.ListFetch=ListFetch},645:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.ItemRequest=void 0;const n=r(317),s=r(65),i=r(573);class ItemRequest extends i.Request{constructor(e,t){super(),this.databaseClient=e,this.tableName=t,this.returnConsumedCapacity=(e=n.ReturnConsumedCapacity.TOTAL)=>(this.ReturnConsumedCapacity=e,this),this.ReturnConsumedCapacity=this.databaseClient.returnMetrics?n.ReturnConsumedCapacity.INDEXES:n.ReturnConsumedCapacity.NONE}[s.BUILD](){return{ReturnConsumedCapacity:this.ReturnConsumedCapacity,TableName:this.tableName}}}t.ItemRequest=ItemRequest},573:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.Request=void 0;t.Request=class Request{constructor(){this.patienceRatio=1,this.relaxLatencies=(e=1)=>(this.patienceRatio=e<=0?1:e,this)}}},468:function(e,t,r){"use strict";var n=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0}),t.BatchGet=void 0;const s=n(r(47)),i=r(317),a=r(74),o=r(929),u=r(65),l=r(948);class BatchGet extends o.Fetch{constructor(e,t){super(e),this.items=t,this.batchGetSegment=async e=>{let t=!1;const r={};return(0,s.default)((async(n,s)=>{for(var a,o,l;!t;){const c=(0,u.createShortCircuit)({duration:s*u.LONG_MAX_LATENCY*this.patienceRatio,error:new Error(u.TAKING_TOO_LONG_EXCEPTION)});try{const{ConsumedCapacity:n,Responses:s,UnprocessedKeys:u}=await Promise.race([this.databaseClient.send(new i.BatchGetItemCommand(e)),c.launch()]);if(null!=u&&Object.keys(u).length>0?e.RequestItems=u:t=!0,null!=s)for(const e of Object.keys(s))r.Responses=null!==(a=r.Responses)&&void 0!==a?a:{},r.Responses[e]=[...null!==(o=r.Responses[e])&&void 0!==o?o:[],...s[e]];null!=n&&(r.ConsumedCapacity=[...null!==(l=r.ConsumedCapacity)&&void 0!==l?l:[],...n])}catch(r){if((0,u.isRetryableError)(r))throw r;t=!0,r.$input=e,n(r)}finally{c.halt()}}return r}),u.RETRY_OPTIONS)},this.$=async()=>{var e,t,r,n,s,i,o,c,d,h,p,m;const{ReturnConsumedCapacity:y,ExpressionAttributeNames:f,ProjectionExpression:b,ConsistentRead:T}=(0,l.marshallRequestParameters)(this[u.BUILD]()),v=[];for(let a=0;a<this.items.length;a+=100){const o=this.items.slice(a,a+100),c={RequestItems:{},...y&&{ReturnConsumedCapacity:y}},d={};for(const a of o){const{Key:o,TableName:m,ExpressionAttributeNames:y,ProjectionExpression:v,ConsistentRead:E}=(0,l.marshallRequestParameters)(a[u.BUILD]());if(null==o||null==m)continue;null!==(e=c.RequestItems)&&void 0!==e||(c.RequestItems={}),null!==(t=(h=c.RequestItems)[m])&&void 0!==t||(h[m]={Keys:[]}),null===(r=c.RequestItems[m].Keys)||void 0===r||r.push(o),(T||E)&&(c.RequestItems[m].ConsistentRead=T||E);const C=[[null!=f?f:{},null!=b?b:""],[null!=y?y:{},null!=v?v:""]];for(const[e,t]of C)if(e&&t){let r=t;for(const[t,n]of Object.entries(e))d[n]?r=r.replace(new RegExp(t,"g"),d[n]):d[n]=t;c.RequestItems[m].ProjectionExpression=(null!==(n=c.RequestItems[m].ProjectionExpression)&&void 0!==n?n:"")+(c.RequestItems[m].ProjectionExpression?", ":"")+r}if(c.RequestItems[m].ProjectionExpression){null!==(s=(p=c.RequestItems[m]).ExpressionAttributeNames)&&void 0!==s||(p.ExpressionAttributeNames={});for(const[e,t]of Object.entries(d))c.RequestItems[m].ExpressionAttributeNames[t]=e;c.RequestItems[m].ProjectionExpression=[...new Set(null===(i=c.RequestItems[m].ProjectionExpression)||void 0===i?void 0:i.split(", "))].join(", ")}}v.push(c)}const E=await Promise.all(v.map((e=>this.batchGetSegment(e)))),C={},x={};for(const e of E){if(null!==(o=C.Responses)&&void 0!==o||(C.Responses={}),null!=e.Responses)for(const t of Object.keys(e.Responses))C.Responses[t]=[...null!==(c=C.Responses[t])&&void 0!==c?c:[],...e.Responses[t]];if(null!=e.ConsumedCapacity)for(const t of e.ConsumedCapacity)(null==t?void 0:t.TableName)&&(null!==(d=x[m=t.TableName])&&void 0!==d||(x[m]=0),x[t.TableName]+=t.CapacityUnits)}C.ConsumedCapacity=Object.keys(x).map((e=>({TableName:e,CapacityUnits:x[e]})));const N={};if(null!=C.Responses)for(const e of Object.keys(C.Responses))N[e]=C.Responses[e].map((e=>(0,a.unmarshall)(e)));return{ConsumedCapacity:C.ConsumedCapacity,UnprocessedKeys:C.UnprocessedKeys,data:N}}}}t.BatchGet=BatchGet},656:function(e,t,r){"use strict";var n=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0}),t.BatchWrite=void 0;const s=n(r(47)),i=r(317),a=r(74),o=r(837),u=r(65),l=r(948),c=r(641),d=r(92);class BatchWrite extends o.Amend{constructor(e,t){super(e),this.items=t,this.batchWriteSegment=async e=>{let t=!1;const r={};return(0,s.default)((async(n,s)=>{for(var a,o,l;!t;){const c=(0,u.createShortCircuit)({duration:s*u.LONG_MAX_LATENCY*this.patienceRatio,error:new Error(u.TAKING_TOO_LONG_EXCEPTION)});try{const{ConsumedCapacity:n,ItemCollectionMetrics:s,UnprocessedItems:u}=await Promise.race([this.databaseClient.send(new i.BatchWriteItemCommand(e)),c.launch()]);if(null!=u&&Object.keys(u).length>0?e.RequestItems=u:t=!0,null!=s)for(const e of Object.keys(s))null!==(a=r.ItemCollectionMetrics)&&void 0!==a||(r.ItemCollectionMetrics={}),r.ItemCollectionMetrics[e]=[...null!==(o=r.ItemCollectionMetrics[e])&&void 0!==o?o:[],...s[e]];null!=n&&(r.ConsumedCapacity=[...null!==(l=r.ConsumedCapacity)&&void 0!==l?l:[],...n])}catch(r){if((0,u.isRetryableError)(r))throw r;t=!0,r.$input=e,n(r)}finally{c.halt()}}return r}),u.RETRY_OPTIONS)},this.$=async()=>{var e,t,r,n,s,i,o,h,p,m,y,f,b;const{ReturnConsumedCapacity:T,ReturnItemCollectionMetrics:v}=(0,l.marshallRequestParameters)(this[u.BUILD]()),E=[];for(let s=0;s<this.items.length;s+=25){const i=this.items.slice(s,s+25),a={RequestItems:{},...T&&{ReturnConsumedCapacity:T},...v&&{ReturnItemCollectionMetrics:v}};for(const s of i){const{Item:i,Key:o,TableName:h}=(0,l.marshallRequestParameters)(s[u.BUILD]());null!=h&&(null!==(e=a.RequestItems)&&void 0!==e||(a.RequestItems={}),null!==(t=(f=a.RequestItems)[h])&&void 0!==t||(f[h]=[]),s instanceof c.Delete?null===(r=a.RequestItems[h])||void 0===r||r.push({DeleteRequest:{Key:o}}):s instanceof d.Put&&(null===(n=a.RequestItems[h])||void 0===n||n.push({PutRequest:{Item:i}})))}E.push(a)}const C=await Promise.all(E.map((e=>this.batchWriteSegment(e)))),x={},N={};for(const{ConsumedCapacity:e,ItemCollectionMetrics:t}of C){if(null!=e)for(const t of e)t.TableName&&(null!==(s=N[b=t.TableName])&&void 0!==s||(N[b]=0),N[t.TableName]+=t.CapacityUnits);if(null!=t)for(const e of Object.keys(t))null!==(i=x.ItemCollectionMetrics)&&void 0!==i||(x.ItemCollectionMetrics={}),x.ItemCollectionMetrics[e]=[...null!==(o=x.ItemCollectionMetrics[e])&&void 0!==o?o:[],...t[e]]}x.ConsumedCapacity=Object.keys(N).map((e=>({TableName:e,CapacityUnits:N[e]})));const w={};for(const e of E)for(const t of Object.keys(null!==(h=e.RequestItems)&&void 0!==h?h:{})){null!==(p=w[t])&&void 0!==p||(w[t]=[]);for(const r of(null!==(m=e.RequestItems)&&void 0!==m?m:{})[t])(null===(y=r.PutRequest)||void 0===y?void 0:y.Item)&&w[t].push((0,a.unmarshall)(r.PutRequest.Item))}return{ConsumedCapacity:x.ConsumedCapacity,UnprocessedItems:x.UnprocessedItems,ItemCollectionMetrics:x.ItemCollectionMetrics,data:w}}}}t.BatchWrite=BatchWrite},641:function(e,t,r){"use strict";var n=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0}),t.Delete=void 0;const s=n(r(47)),i=r(317),a=r(74),o=r(570),u=r(65),l=r(948);class Delete extends o.Check{constructor(){super(...arguments),this.$=async()=>{const e=(0,l.marshallRequestParameters)(this[u.BUILD]());return(0,s.default)((async(t,r)=>{const n=(0,u.createShortCircuit)({duration:r*u.SHORT_MAX_LATENCY*this.patienceRatio,error:new Error(u.TAKING_TOO_LONG_EXCEPTION)});try{const{$metadata:t,Attributes:r,...s}=await Promise.race([this.databaseClient.send(new i.DeleteItemCommand(e)),n.launch()]);return{...s,data:r&&(0,a.unmarshall)(r)}}catch(r){if((0,u.isRetryableError)(r))throw r;r.$input=e,t(r)}finally{n.halt()}return{data:void 0}}),u.RETRY_OPTIONS)}}}t.Delete=Delete},178:function(e,t,r){"use strict";var n=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0}),t.Get=void 0;const s=n(r(47)),i=r(317),a=r(74),o=r(929),u=r(65),l=r(948);class Get extends o.Fetch{constructor(e,t,r){super(e,t),this.key=r,this.$=async()=>{const e=(0,l.marshallRequestParameters)(this[u.BUILD]());return(0,s.default)((async(t,r)=>{const n=(0,u.createShortCircuit)({duration:r*u.SHORT_MAX_LATENCY*this.patienceRatio,error:new Error(u.TAKING_TOO_LONG_EXCEPTION)});try{const{$metadata:t,Item:r,...s}=await Promise.race([this.databaseClient.send(new i.GetItemCommand(e)),n.launch()]);return{...s,data:r&&(0,a.unmarshall)(r)}}catch(r){if((0,u.isRetryableError)(r))throw r;r.$input=e,t(r)}finally{n.halt()}return{data:void 0}}),u.RETRY_OPTIONS)},(0,u.validateKey)(r)}[u.BUILD](){return{...super[u.BUILD](),_Key:this.key}}}t.Get=Get},92:function(e,t,r){"use strict";var n=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0}),t.Put=void 0;const s=n(r(47)),i=r(317),a=r(74),o=r(570),u=r(65),l=r(948);class Put extends o.Check{constructor(e,t,r){super(e,t),this.item=r,this.$=async()=>{const e=(0,l.marshallRequestParameters)(this[u.BUILD]());return(0,s.default)((async(t,r)=>{const n=(0,u.createShortCircuit)({duration:r*u.SHORT_MAX_LATENCY*this.patienceRatio,error:new Error(u.TAKING_TOO_LONG_EXCEPTION)});try{const{$metadata:t,Attributes:r,...s}=await Promise.race([this.databaseClient.send(new i.PutItemCommand(e)),n.launch()]);return{...s,data:e.Item&&(0,a.unmarshall)(e.Item)}}catch(r){if((0,u.isRetryableError)(r))throw r;r.$input=e,t(r)}finally{n.halt()}return{data:void 0}}),u.RETRY_OPTIONS)}}[u.BUILD](){return{...super[u.BUILD](),_Item:this.item}}}t.Put=Put},270:function(e,t,r){"use strict";var n,s=this&&this.__classPrivateFieldSet||function(e,t,r,n,s){if("m"===n)throw new TypeError("Private method is not writable");if("a"===n&&!s)throw new TypeError("Private accessor was defined without a setter");if("function"==typeof t?e!==t||!s:!t.has(e))throw new TypeError("Cannot write private member to an object whose class did not declare it");return"a"===n?s.call(e,r):s?s.value=r:t.set(e,r),r},i=this&&this.__classPrivateFieldGet||function(e,t,r,n){if("a"===r&&!n)throw new TypeError("Private accessor was defined without a getter");if("function"==typeof t?e!==t||!n:!t.has(e))throw new TypeError("Cannot read private member from an object whose class did not declare it");return"m"===r?n:"a"===r?n.call(e):n?n.value:t.get(e)},a=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0}),t.Query=void 0;const o=a(r(47)),u=r(317),l=r(74),c=r(892),d=r(41),h=r(65),p=r(948);class Query extends c.ListFetch{constructor(e,t,r){super(e,t),this.partitionKeyCondition=r,n.set(this,void 0),this.having=e=>(null!=e&&(this.sortKeyCondition=e),this),this.sort=e=>("DSC"===e&&s(this,n,!1,"f"),this),this.$=async(e=!1)=>{var t;const r=(0,p.marshallRequestParameters)(this[h.BUILD]());r.IndexName&&delete r.ConsistentRead;let n=0;r.Limit&&r.FilterExpression&&(n=(null!==(t=r.FilterExpression.match(/AND|OR/g))&&void 0!==t?t:[]).length+1);let s=!1;const i={};let a=[];return(0,o.default)((async(t,o)=>{for(var c,d,p,m,y,f,b,T,v,E,C,x,N,w,I,_,g,O,S,P,A;!s;){const l=(0,h.createShortCircuit)({duration:o*h.LONG_MAX_LATENCY*this.patienceRatio,error:new Error(h.TAKING_TOO_LONG_EXCEPTION)}),R={...r,...r.Limit&&{Limit:r.Limit*5**n}};try{const{$metadata:t,...n}=await Promise.race([this.databaseClient.send(new u.QueryCommand(R)),l.launch()]);if(null==n.LastEvaluatedKey||e?s=!0:(r.ExclusiveStartKey=n.LastEvaluatedKey,a=Object.keys(n.LastEvaluatedKey)),n.Items&&(i.Items=[...null!==(c=i.Items)&&void 0!==c?c:[],...n.Items]),n.Count&&(i.Count=(null!==(d=i.Count)&&void 0!==d?d:0)+n.Count),n.ScannedCount&&(i.ScannedCount=(null!==(p=i.ScannedCount)&&void 0!==p?p:0)+n.ScannedCount),n.ConsumedCapacity&&(i.ConsumedCapacity?(i.ConsumedCapacity.CapacityUnits=(null!==(m=i.ConsumedCapacity.CapacityUnits)&&void 0!==m?m:0)+(null!==(y=n.ConsumedCapacity.CapacityUnits)&&void 0!==y?y:0),null!==(f=(S=i.ConsumedCapacity).Table)&&void 0!==f||(S.Table={CapacityUnits:0}),i.ConsumedCapacity.Table.CapacityUnits=(null!==(T=null===(b=i.ConsumedCapacity.Table)||void 0===b?void 0:b.CapacityUnits)&&void 0!==T?T:0)+(null!==(E=null===(v=n.ConsumedCapacity.Table)||void 0===v?void 0:v.CapacityUnits)&&void 0!==E?E:0),null!=r.IndexName&&(null!==(C=(P=i.ConsumedCapacity).GlobalSecondaryIndexes)&&void 0!==C||(P.GlobalSecondaryIndexes={[r.IndexName]:{CapacityUnits:0}}),i.ConsumedCapacity.GlobalSecondaryIndexes[r.IndexName].CapacityUnits=(null!==(x=i.ConsumedCapacity.GlobalSecondaryIndexes[r.IndexName].CapacityUnits)&&void 0!==x?x:0)+(null!==(w=null===(N=n.ConsumedCapacity.GlobalSecondaryIndexes)||void 0===N?void 0:N[r.IndexName].CapacityUnits)&&void 0!==w?w:0)),null!=r.IndexName&&(null!==(I=(A=i.ConsumedCapacity).LocalSecondaryIndexes)&&void 0!==I||(A.LocalSecondaryIndexes={[r.IndexName]:{CapacityUnits:0}}),i.ConsumedCapacity.LocalSecondaryIndexes[r.IndexName].CapacityUnits=(null!==(_=i.ConsumedCapacity.LocalSecondaryIndexes[r.IndexName].CapacityUnits)&&void 0!==_?_:0)+(null!==(O=null===(g=n.ConsumedCapacity.LocalSecondaryIndexes)||void 0===g?void 0:g[r.IndexName].CapacityUnits)&&void 0!==O?O:0))):i.ConsumedCapacity=n.ConsumedCapacity),r.Limit&&null!=i.Items&&i.Items.length>=r.Limit){i.Items=i.Items.slice(0,r.Limit),i.Count=i.Items.length;const e={...i.Items[i.Items.length-1]};for(const t of Object.keys(e))a.includes(t)||delete e[t];i.LastEvaluatedKey=Object.keys(e).length>0?e:n.LastEvaluatedKey,s=!0}e&&null!=n.LastEvaluatedKey&&(i.LastEvaluatedKey=n.LastEvaluatedKey)}catch(e){if((0,h.isRetryableError)(e))throw e;s=!0,e.$input=R,t(e)}finally{l.halt()}}const{Items:R,LastEvaluatedKey:L,...U}=i;return{...U,...L?{LastEvaluatedKey:(0,l.unmarshall)(L)}:{},data:null==R?void 0:R.map((e=>(0,l.unmarshall)(e)))}}),h.RETRY_OPTIONS)}}[(n=new WeakMap,h.BUILD)](){return{...super[h.BUILD](),_KeyConditionExpression:null==this.sortKeyCondition?(0,d.and)(this.partitionKeyCondition):(0,d.and)(this.partitionKeyCondition,this.sortKeyCondition),...null!=i(this,n,"f")&&{ScanIndexForward:i(this,n,"f")}}}}t.Query=Query},815:function(e,t,r){"use strict";var n,s,i,a=this&&this.__classPrivateFieldGet||function(e,t,r,n){if("a"===r&&!n)throw new TypeError("Private accessor was defined without a getter");if("function"==typeof t?e!==t||!n:!t.has(e))throw new TypeError("Cannot read private member from an object whose class did not declare it");return"m"===r?n:"a"===r?n.call(e):n?n.value:t.get(e)},o=this&&this.__classPrivateFieldSet||function(e,t,r,n,s){if("m"===n)throw new TypeError("Private method is not writable");if("a"===n&&!s)throw new TypeError("Private accessor was defined without a setter");if("function"==typeof t?e!==t||!s:!t.has(e))throw new TypeError("Cannot write private member to an object whose class did not declare it");return"a"===n?s.call(e,r):s?s.value=r:t.set(e,r),r},u=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0}),t.Scan=void 0;const l=u(r(47)),c=r(317),d=r(74),h=r(892),p=r(65),m=r(948);class Scan extends h.ListFetch{constructor(){super(...arguments),n.set(this,10),s.set(this,a(this,n,"f")),i.set(this,void 0),this.totalSegments=(e=a(this,n,"f"))=>(o(this,s,e,"f"),this),this.segment=e=>(o(this,i,e,"f"),this),this.disableSegments=()=>(o(this,s,void 0,"f"),this),this.scanSegment=async(e,t)=>{var r;let n=!1;null!=e.Segment&&e.TotalSegments&&(e.Segment=Math.min(Math.max(e.Segment,0),e.TotalSegments-1));let s=0;e.Limit&&e.FilterExpression&&(s=(null!==(r=e.FilterExpression.match(/AND|OR/g))&&void 0!==r?r:[]).length+1);let i=[];const a={};return(0,l.default)((async(r,o)=>{for(var u,l,d,h,m,y,f,b,T,v,E,C,x,N,w,I,_,g,O,S,P;!n;){const A=(0,p.createShortCircuit)({duration:o*p.LONG_MAX_LATENCY*this.patienceRatio,error:new Error(p.TAKING_TOO_LONG_EXCEPTION)}),R={...e,...e.Limit&&{Limit:e.Limit*5**s}};try{const{$metadata:r,...s}=await Promise.race([this.databaseClient.send(new c.ScanCommand(R)),A.launch()]);if(null==s.LastEvaluatedKey||t?n=!0:(e.ExclusiveStartKey=s.LastEvaluatedKey,i=Object.keys(s.LastEvaluatedKey)),s.Items&&(a.Items=[...null!==(u=a.Items)&&void 0!==u?u:[],...s.Items]),s.Count&&(a.Count=(null!==(l=a.Count)&&void 0!==l?l:0)+s.Count),s.ScannedCount&&(a.ScannedCount=(null!==(d=a.ScannedCount)&&void 0!==d?d:0)+s.ScannedCount),s.ConsumedCapacity&&(a.ConsumedCapacity?(a.ConsumedCapacity.CapacityUnits=(null!==(h=a.ConsumedCapacity.CapacityUnits)&&void 0!==h?h:0)+(null!==(m=s.ConsumedCapacity.CapacityUnits)&&void 0!==m?m:0),null!==(y=(O=a.ConsumedCapacity).Table)&&void 0!==y||(O.Table={CapacityUnits:0}),a.ConsumedCapacity.Table.CapacityUnits=(null!==(b=null===(f=a.ConsumedCapacity.Table)||void 0===f?void 0:f.CapacityUnits)&&void 0!==b?b:0)+(null!==(v=null===(T=s.ConsumedCapacity.Table)||void 0===T?void 0:T.CapacityUnits)&&void 0!==v?v:0),null!=R.IndexName&&(null!==(E=(S=a.ConsumedCapacity).GlobalSecondaryIndexes)&&void 0!==E||(S.GlobalSecondaryIndexes={[R.IndexName]:{CapacityUnits:0}}),a.ConsumedCapacity.GlobalSecondaryIndexes[R.IndexName].CapacityUnits=(null!==(C=a.ConsumedCapacity.GlobalSecondaryIndexes[R.IndexName].CapacityUnits)&&void 0!==C?C:0)+(null!==(N=null===(x=s.ConsumedCapacity.GlobalSecondaryIndexes)||void 0===x?void 0:x[R.IndexName].CapacityUnits)&&void 0!==N?N:0)),null!=R.IndexName&&(null!==(w=(P=a.ConsumedCapacity).LocalSecondaryIndexes)&&void 0!==w||(P.LocalSecondaryIndexes={[R.IndexName]:{CapacityUnits:0}}),a.ConsumedCapacity.LocalSecondaryIndexes[R.IndexName].CapacityUnits=(null!==(I=a.ConsumedCapacity.LocalSecondaryIndexes[R.IndexName].CapacityUnits)&&void 0!==I?I:0)+(null!==(g=null===(_=s.ConsumedCapacity.LocalSecondaryIndexes)||void 0===_?void 0:_[R.IndexName].CapacityUnits)&&void 0!==g?g:0))):a.ConsumedCapacity=s.ConsumedCapacity),e.Limit&&null!=a.Items&&a.Items.length>=e.Limit){a.Items=a.Items.slice(0,e.Limit),a.Count=a.Items.length;const t={...a.Items[a.Items.length-1]};for(const e of Object.keys(t))i.includes(e)||delete t[e];a.LastEvaluatedKey=Object.keys(t).length>0?t:s.LastEvaluatedKey,n=!0}t&&null!=s.LastEvaluatedKey&&(a.LastEvaluatedKey=s.LastEvaluatedKey)}catch(e){if((0,p.isRetryableError)(e))throw e;n=!0,e.$input=R,r(e)}finally{A.halt()}}return a}),p.RETRY_OPTIONS)},this.$=async(e=!1)=>{var t,r,n,s,i,a,o,u,l,c,h,y,f,b,T,v,E,C,x,N,w,I,_,g,O,S,P,A,R,L,U,j;const D=(0,m.marshallRequestParameters)(this[p.BUILD]());let q,M;if(D.IndexName&&delete D.ConsistentRead,D.ExclusiveStartKey&&!e&&(delete D.TotalSegments,delete D.Segment),D.TotalSegments&&(D.TotalSegments=Math.max(Math.min(D.TotalSegments,1e6),1),D.Limit&&(q=D.Limit,D.TotalSegments=Math.min(D.Limit,D.TotalSegments),D.Limit=Math.ceil(D.Limit/D.TotalSegments))),null==D.Segment)M=await Promise.all(Array.from({length:null!==(t=D.TotalSegments)&&void 0!==t?t:1}).map((async(t,r)=>{const n={...D};return n.TotalSegments&&(n.Segment=r),this.scanSegment(n,e)})));else{const t={...D};if(t.TotalSegments||(t.TotalSegments=1),(null!==(r=t.Segment)&&void 0!==r?r:0)>=t.TotalSegments)throw new Error(`A segment with index ${t.Segment} does not exist. The segment index can be between 0 and ${t.TotalSegments-1} for ${t.TotalSegments} total segments.`);M=[await this.scanSegment(t,e)]}const $={};for(const e of M)$.Items=[...null!==(n=$.Items)&&void 0!==n?n:[],...null!==(s=e.Items)&&void 0!==s?s:[]],$.Count=(null!==(i=$.Count)&&void 0!==i?i:0)+(null!==(a=e.Count)&&void 0!==a?a:0),$.ScannedCount=(null!==(o=$.ScannedCount)&&void 0!==o?o:0)+(null!==(u=e.ScannedCount)&&void 0!==u?u:0),null!==(l=$.LastEvaluatedKey)&&void 0!==l||($.LastEvaluatedKey=e.LastEvaluatedKey),e.ConsumedCapacity&&($.ConsumedCapacity?($.ConsumedCapacity.CapacityUnits=(null!==(c=$.ConsumedCapacity.CapacityUnits)&&void 0!==c?c:0)+(null!==(h=e.ConsumedCapacity.CapacityUnits)&&void 0!==h?h:0),null!==(y=(L=$.ConsumedCapacity).Table)&&void 0!==y||(L.Table={CapacityUnits:0}),$.ConsumedCapacity.Table.CapacityUnits=(null!==(b=null===(f=$.ConsumedCapacity.Table)||void 0===f?void 0:f.CapacityUnits)&&void 0!==b?b:0)+(null!==(v=null===(T=e.ConsumedCapacity.Table)||void 0===T?void 0:T.CapacityUnits)&&void 0!==v?v:0),null!=D.IndexName&&(null!==(E=(U=$.ConsumedCapacity).GlobalSecondaryIndexes)&&void 0!==E||(U.GlobalSecondaryIndexes={[D.IndexName]:{CapacityUnits:0}}),$.ConsumedCapacity.GlobalSecondaryIndexes[D.IndexName].CapacityUnits=(null!==(C=$.ConsumedCapacity.GlobalSecondaryIndexes[D.IndexName].CapacityUnits)&&void 0!==C?C:0)+(null!==(N=null===(x=e.ConsumedCapacity.GlobalSecondaryIndexes)||void 0===x?void 0:x[D.IndexName].CapacityUnits)&&void 0!==N?N:0)),null!=D.IndexName&&(null!==(w=(j=$.ConsumedCapacity).LocalSecondaryIndexes)&&void 0!==w||(j.LocalSecondaryIndexes={[D.IndexName]:{CapacityUnits:0}}),$.ConsumedCapacity.LocalSecondaryIndexes[D.IndexName].CapacityUnits=(null!==(I=$.ConsumedCapacity.LocalSecondaryIndexes[D.IndexName].CapacityUnits)&&void 0!==I?I:0)+(null!==(g=null===(_=e.ConsumedCapacity.LocalSecondaryIndexes)||void 0===_?void 0:_[D.IndexName].CapacityUnits)&&void 0!==g?g:0))):$.ConsumedCapacity=e.ConsumedCapacity);q&&(null!==(S=null===(O=$.Items)||void 0===O?void 0:O.length)&&void 0!==S?S:0)>=q&&($.Items=null===(P=$.Items)||void 0===P?void 0:P.slice(0,q),$.Count=null!==(R=null===(A=$.Items)||void 0===A?void 0:A.length)&&void 0!==R?R:0);const{Items:G,LastEvaluatedKey:k,...B}=$;return{...B,...k?{LastEvaluatedKey:(0,d.unmarshall)(k)}:{},data:null==G?void 0:G.map((e=>(0,d.unmarshall)(e)))}}}[(n=new WeakMap,s=new WeakMap,i=new WeakMap,p.BUILD)](){return{...super[p.BUILD](),...a(this,s,"f")&&{TotalSegments:a(this,s,"f")},...null!=a(this,i,"f")&&{Segment:a(this,i,"f")}}}}t.Scan=Scan},805:function(e,t,r){"use strict";var n,s=this&&this.__classPrivateFieldGet||function(e,t,r,n){if("a"===r&&!n)throw new TypeError("Private accessor was defined without a getter");if("function"==typeof t?e!==t||!n:!t.has(e))throw new TypeError("Cannot read private member from an object whose class did not declare it");return"m"===r?n:"a"===r?n.call(e):n?n.value:t.get(e)},i=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0}),t.Update=void 0;const a=i(r(47)),o=r(317),u=r(74),l=r(570),c=r(65),d=r(948);class Update extends l.Check{constructor(){super(...arguments),n.set(this,[]),this.$=async()=>{const e=(0,d.marshallRequestParameters)(this[c.BUILD]());return(0,a.default)((async(t,r)=>{const n=(0,c.createShortCircuit)({duration:r*c.SHORT_MAX_LATENCY*this.patienceRatio,error:new Error(c.TAKING_TOO_LONG_EXCEPTION)});try{const{$metadata:t,Attributes:r,...s}=await Promise.race([this.databaseClient.send(new o.UpdateItemCommand(e)),n.launch()]);return{...s,data:r&&(0,u.unmarshall)(r)}}catch(r){if((0,c.isRetryableError)(r))throw r;r.$input=e,t(r)}finally{n.halt()}return{data:void 0}}),c.RETRY_OPTIONS)}}assign(e,t=!1){for(const[r,i]of Object.entries(e))void 0!==i&&s(this,n,"f").push({kind:"set",attributePath:r,value:i,ifDoesNotExist:t});return this}increment(e,t=1,r=!0){return s(this,n,"f").push({kind:r?"add":"increment",attributePath:e,value:t}),this}decrement(e,t=1,r=!0){return this.increment(e,-1*t,r)}append(e,t,r=!0){return s(this,n,"f").push({kind:"append",attributePath:e,value:t,createIfAttributePathDoesNotExist:r}),this}prepend(e,t,r=!0){return s(this,n,"f").push({kind:"prepend",attributePath:e,value:t,createIfAttributePathDoesNotExist:r}),this}add(e,t){return s(this,n,"f").push({kind:"add",attributePath:e,value:t}),this}delete(e,t){return s(this,n,"f").push({kind:"delete",attributePath:e,value:t}),this}drop(e){return s(this,n,"f").push({kind:"remove",attributePath:e}),this}[(n=new WeakMap,c.BUILD)](){return{...super[c.BUILD](),...s(this,n,"f").length>0&&{_UpdateExpressions:s(this,n,"f").filter((e=>{var t;return!Object.keys(null!==(t=this.key)&&void 0!==t?t:{}).includes(e.attributePath)}))}}}}t.Update=Update},986:function(e,t,r){"use strict";var n=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0}),t.TableCreate=void 0;const s=n(r(47)),i=r(317),a=r(573),o=r(65);class TableCreate extends a.Request{constructor(e,t){super(),this.client=e,this.parameters=t,this.$=async()=>{const e=this[o.BUILD]();return(0,s.default)((async(t,r)=>{const n=(0,o.createShortCircuit)({duration:r*o.LONG_MAX_LATENCY*this.patienceRatio,error:new Error(o.TAKING_TOO_LONG_EXCEPTION)});try{const{TableDescription:t}=await Promise.race([this.client.send(new i.CreateTableCommand(e)),n.launch()]);return{data:t}}catch(r){if((0,o.isRetryableError)(r))throw r;r.$input=e,t(r)}finally{n.halt()}return{data:void 0}}),o.RETRY_OPTIONS)}}[o.BUILD](){return{...this.parameters}}}t.TableCreate=TableCreate},519:function(e,t,r){"use strict";var n=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0}),t.TableDelete=void 0;const s=n(r(47)),i=r(317),a=r(573),o=r(65);class TableDelete extends a.Request{constructor(e,t){super(),this.client=e,this.tableName=t,this.$=async()=>{const e=this[o.BUILD]();return(0,s.default)((async(t,r)=>{const n=(0,o.createShortCircuit)({duration:r*o.LONG_MAX_LATENCY*this.patienceRatio,error:new Error(o.TAKING_TOO_LONG_EXCEPTION)});try{const{TableDescription:t}=await Promise.race([this.client.send(new i.DeleteTableCommand(e)),n.launch()]);return{data:t}}catch(r){if((0,o.isRetryableError)(r))throw r;r.$input=e,t(r)}finally{n.halt()}return{data:void 0}}),o.RETRY_OPTIONS)}}[o.BUILD](){return{TableName:this.tableName}}}t.TableDelete=TableDelete},295:function(e,t,r){"use strict";var n=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0}),t.TableDescribe=void 0;const s=n(r(47)),i=r(317),a=r(573),o=r(65);class TableDescribe extends a.Request{constructor(e,t){super(),this.client=e,this.tableName=t,this.$=async()=>{const e=this[o.BUILD]();return(0,s.default)((async(t,r)=>{const n=(0,o.createShortCircuit)({duration:r*o.SHORT_MAX_LATENCY*this.patienceRatio,error:new Error(o.TAKING_TOO_LONG_EXCEPTION)});try{const{Table:t}=await Promise.race([this.client.send(new i.DescribeTableCommand(e)),n.launch()]);return{data:t}}catch(r){if((0,o.isRetryableError)(r))throw r;r.$input=e,t(r)}finally{n.halt()}return{data:void 0}}),o.RETRY_OPTIONS)}}[o.BUILD](){return{TableName:this.tableName}}}t.TableDescribe=TableDescribe},629:function(e,t,r){"use strict";var n,s,i=this&&this.__classPrivateFieldSet||function(e,t,r,n,s){if("m"===n)throw new TypeError("Private method is not writable");if("a"===n&&!s)throw new TypeError("Private accessor was defined without a setter");if("function"==typeof t?e!==t||!s:!t.has(e))throw new TypeError("Cannot write private member to an object whose class did not declare it");return"a"===n?s.call(e,r):s?s.value=r:t.set(e,r),r},a=this&&this.__classPrivateFieldGet||function(e,t,r,n){if("a"===r&&!n)throw new TypeError("Private accessor was defined without a getter");if("function"==typeof t?e!==t||!n:!t.has(e))throw new TypeError("Cannot read private member from an object whose class did not declare it");return"m"===r?n:"a"===r?n.call(e):n?n.value:t.get(e)},o=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0}),t.TableList=void 0;const u=o(r(47)),l=r(317),c=r(573),d=r(65);class TableList extends c.Request{constructor(e){super(),this.client=e,n.set(this,void 0),s.set(this,void 0),this.limit=e=>{if(e<=0||!Number.isInteger(e)||e>100)throw new Error("The limit must be a positive integer less than or equal to 100");return i(this,n,e,"f"),this},this.start=e=>(null!=e&&i(this,s,e,"f"),this),this.$=async()=>{const e=this[d.BUILD]();let t=!1;const r={};return(0,u.default)((async(n,s)=>{for(var i;!t;){const a=(0,d.createShortCircuit)({duration:s*d.LONG_MAX_LATENCY*this.patienceRatio,error:new Error(d.TAKING_TOO_LONG_EXCEPTION)});try{const{LastEvaluatedTableName:n,TableNames:s}=await Promise.race([this.client.send(new l.ListTablesCommand(e)),a.launch()]);null==n?t=!0:e.ExclusiveStartTableName=n,s&&(r.TableNames=[...null!==(i=r.TableNames)&&void 0!==i?i:[],...s]),e.Limit&&r.TableNames&&r.TableNames.length>=e.Limit&&(r.TableNames=r.TableNames.slice(0,e.Limit),t=!0)}catch(r){if((0,d.isRetryableError)(r))throw r;t=!0,r.$input=e,n(r)}finally{a.halt()}}return{data:r.TableNames}}),d.RETRY_OPTIONS)}}[(n=new WeakMap,s=new WeakMap,d.BUILD)](){return{...a(this,n,"f")&&{Limit:a(this,n,"f")},...a(this,s,"f")&&{ExclusiveStartTableName:a(this,s,"f")}}}}t.TableList=TableList},396:function(e,t,r){"use strict";var n=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0}),t.TableTTLDescribe=void 0;const s=n(r(47)),i=r(317),a=r(573),o=r(65);class TableTTLDescribe extends a.Request{constructor(e,t){super(),this.client=e,this.tableName=t,this.$=async()=>{const e=this[o.BUILD]();return(0,s.default)((async(t,r)=>{const n=(0,o.createShortCircuit)({duration:r*o.SHORT_MAX_LATENCY*this.patienceRatio,error:new Error(o.TAKING_TOO_LONG_EXCEPTION)});try{const{TimeToLiveDescription:t}=await Promise.race([this.client.send(new i.DescribeTimeToLiveCommand(e)),n.launch()]);return{data:t}}catch(r){if((0,o.isRetryableError)(r))throw r;r.$input=e,t(r)}finally{n.halt()}return{data:void 0}}),o.RETRY_OPTIONS)}}[o.BUILD](){return{TableName:this.tableName}}}t.TableTTLDescribe=TableTTLDescribe},724:function(e,t,r){"use strict";var n=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0}),t.TableTTLUpdate=void 0;const s=n(r(47)),i=r(317),a=r(573),o=r(65);class TableTTLUpdate extends a.Request{constructor(e,t){super(),this.client=e,this.parameters=t,this.$=async()=>{const e=this[o.BUILD]();return(0,s.default)((async(t,r)=>{const n=(0,o.createShortCircuit)({duration:r*o.SHORT_MAX_LATENCY*this.patienceRatio,error:new Error(o.TAKING_TOO_LONG_EXCEPTION)});try{const{TimeToLiveSpecification:t}=await Promise.race([this.client.send(new i.UpdateTimeToLiveCommand(e)),n.launch()]);return{data:t}}catch(r){if((0,o.isRetryableError)(r))throw r;r.$input=e,t(r)}finally{n.halt()}return{data:void 0}}),o.RETRY_OPTIONS)}}[o.BUILD](){return{...this.parameters}}}t.TableTTLUpdate=TableTTLUpdate},854:function(e,t,r){"use strict";var n=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0}),t.TableUpdate=void 0;const s=n(r(47)),i=r(317),a=r(573),o=r(65);class TableUpdate extends a.Request{constructor(e,t){super(),this.client=e,this.parameters=t,this.$=async()=>{const e=this[o.BUILD]();return(0,s.default)((async(t,r)=>{const n=(0,o.createShortCircuit)({duration:r*o.LONG_MAX_LATENCY*this.patienceRatio,error:new Error(o.TAKING_TOO_LONG_EXCEPTION)});try{const{TableDescription:t}=await Promise.race([this.client.send(new i.UpdateTableCommand(e)),n.launch()]);return{data:t}}catch(r){if((0,o.isRetryableError)(r))throw r;r.$input=e,t(r)}finally{n.halt()}return{data:void 0}}),o.RETRY_OPTIONS)}}[o.BUILD](){return{...this.parameters}}}t.TableUpdate=TableUpdate},302:function(e,t,r){"use strict";var n=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0}),t.TransactGet=void 0;const s=n(r(47)),i=r(317),a=r(74),o=r(645),u=r(65),l=r(948);class TransactGet extends o.ItemRequest{constructor(e,t){super(e),this.items=t,this.$=async()=>{const{ReturnConsumedCapacity:e}=(0,l.marshallRequestParameters)(this[u.BUILD]()),t={...e&&{ReturnConsumedCapacity:e},TransactItems:this.items.map((e=>{const{Key:t,TableName:r,ExpressionAttributeNames:n,ProjectionExpression:s}=(0,l.marshallRequestParameters)(e[u.BUILD]());return{Get:{Key:t,TableName:r,...n&&{ExpressionAttributeNames:n},...s&&{ProjectionExpression:s}}}}))};return(0,s.default)((async(e,r)=>{const n=(0,u.createShortCircuit)({duration:r*u.LONG_MAX_LATENCY*this.patienceRatio,error:new Error(u.TAKING_TOO_LONG_EXCEPTION)});try{const{$metadata:e,Responses:r,...s}=await Promise.race([this.databaseClient.send(new i.TransactGetItemsCommand(t)),n.launch()]);return{...s,data:null==r?void 0:r.map((e=>e.Item&&(0,a.unmarshall)(e.Item)))}}catch(r){if((0,u.isRetryableError)(r))throw r;r.$input=t,e(r)}finally{n.halt()}return{data:void 0}}),u.RETRY_OPTIONS)}}}t.TransactGet=TransactGet},182:function(e,t,r){"use strict";var n,s=this&&this.__classPrivateFieldSet||function(e,t,r,n,s){if("m"===n)throw new TypeError("Private method is not writable");if("a"===n&&!s)throw new TypeError("Private accessor was defined without a set