@synnaxlabs/x 0.42.3 → 0.44.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/.turbo/turbo-build.log +78 -78
- package/.vscode/settings.json +4 -6
- package/README.md +1 -7
- package/dist/array.cjs +1 -0
- package/dist/array.js +7 -0
- package/dist/binary.cjs +1 -1
- package/dist/binary.js +1 -1
- package/dist/bounds-D6e9xoHt.cjs +1 -0
- package/dist/bounds-Dj9nG39I.js +174 -0
- package/dist/bounds.cjs +1 -1
- package/dist/bounds.js +1 -1
- package/dist/{box-0YrQibkB.cjs → box-BcGdqkt4.cjs} +1 -1
- package/dist/{box-Cc8IzcNo.js → box-D_qdUyEe.js} +2 -2
- package/dist/box.cjs +1 -1
- package/dist/box.js +1 -1
- package/dist/caseconv.cjs +1 -1
- package/dist/caseconv.js +1 -1
- package/dist/compare.cjs +1 -1
- package/dist/compare.js +1 -1
- package/dist/deep.cjs +1 -1
- package/dist/deep.js +100 -88
- package/dist/{direction-C-b6XTeU.cjs → direction-386XDm2w.cjs} +1 -1
- package/dist/{direction-BL0PhD1k.js → direction-8etxfKaR.js} +4 -3
- package/dist/direction.cjs +1 -1
- package/dist/direction.js +1 -1
- package/dist/external-B9AAGv50.cjs +1 -0
- package/dist/external-BFgJjMcS.js +23 -0
- package/dist/{external-DqPrWKvU.js → external-BYuXBYJh.js} +10 -17
- package/dist/external-mffsMzJx.cjs +1 -0
- package/dist/index-B1m2qvBT.cjs +1 -0
- package/dist/index-B5l_quQn.js +92 -0
- package/dist/index-BQe8OIgm.cjs +3 -0
- package/dist/index-D2xcvEO5.js +46 -0
- package/dist/index-DdhM_E4k.cjs +1 -0
- package/dist/{index-QGplUHuy.js → index-PNh31WTW.js} +64 -37
- package/dist/index.cjs +3 -3
- package/dist/index.js +472 -428
- package/dist/kv.cjs +1 -1
- package/dist/kv.js +1 -1
- package/dist/{location-C3aeu046.js → location-Ar5y2DX2.js} +1 -1
- package/dist/{location-BGl5Ddds.cjs → location-DZi8ftXp.cjs} +1 -1
- package/dist/location.cjs +1 -1
- package/dist/location.js +1 -1
- package/dist/observe.cjs +1 -1
- package/dist/observe.js +16 -20
- package/dist/path-BXdMenka.js +101 -0
- package/dist/path-st_E5-LJ.cjs +1 -0
- package/dist/position-DAL0Qqdf.cjs +1 -0
- package/dist/position-bA6pUwLn.js +85 -0
- package/dist/position.cjs +1 -1
- package/dist/position.js +1 -1
- package/dist/record-CAcQ5PNX.js +14 -0
- package/dist/record-YvCh7bzB.cjs +1 -0
- package/dist/record.cjs +1 -1
- package/dist/record.js +2 -10
- package/dist/scale-Bzn1Cl0r.cjs +1 -0
- package/dist/{scale-DfJe9755.js → scale-CdTNWu-d.js} +55 -59
- package/dist/scale.cjs +1 -1
- package/dist/scale.js +1 -1
- package/dist/series-BeJyqCoP.js +2568 -0
- package/dist/series-anlpaR_I.cjs +6 -0
- package/dist/spatial.cjs +1 -1
- package/dist/spatial.js +6 -6
- package/dist/src/array/index.d.ts +2 -0
- package/dist/src/array/index.d.ts.map +1 -0
- package/dist/src/array/toArray.d.ts +19 -0
- package/dist/src/array/toArray.d.ts.map +1 -0
- package/dist/src/array/toArray.spec.d.ts +2 -0
- package/dist/src/array/toArray.spec.d.ts.map +1 -0
- package/dist/src/binary/codec.d.ts +7 -15
- package/dist/src/binary/codec.d.ts.map +1 -1
- package/dist/src/breaker/breaker.d.ts +5 -5
- package/dist/src/breaker/breaker.d.ts.map +1 -1
- package/dist/src/caseconv/caseconv.d.ts +0 -1
- package/dist/src/caseconv/caseconv.d.ts.map +1 -1
- package/dist/src/change/change.d.ts +2 -2
- package/dist/src/change/change.d.ts.map +1 -1
- package/dist/src/color/color.d.ts +60 -36
- package/dist/src/color/color.d.ts.map +1 -1
- package/dist/src/color/external.d.ts +0 -1
- package/dist/src/color/external.d.ts.map +1 -1
- package/dist/src/color/gradient.d.ts +6 -6
- package/dist/src/color/gradient.d.ts.map +1 -1
- package/dist/src/color/palette.d.ts +9 -9
- package/dist/src/color/palette.d.ts.map +1 -1
- package/dist/src/compare/compare.d.ts +8 -8
- package/dist/src/compare/compare.d.ts.map +1 -1
- package/dist/src/control/control.d.ts +39 -39
- package/dist/src/control/control.d.ts.map +1 -1
- package/dist/src/debounce/debounce.d.ts +1 -1
- package/dist/src/debounce/debounce.d.ts.map +1 -1
- package/dist/src/deep/delete.d.ts +1 -1
- package/dist/src/deep/delete.d.ts.map +1 -1
- package/dist/src/deep/difference.d.ts.map +1 -1
- package/dist/src/deep/equal.d.ts +4 -4
- package/dist/src/deep/equal.d.ts.map +1 -1
- package/dist/src/deep/merge.d.ts.map +1 -1
- package/dist/src/deep/path.d.ts +6 -6
- package/dist/src/deep/path.d.ts.map +1 -1
- package/dist/src/destructor.d.ts +6 -2
- package/dist/src/destructor.d.ts.map +1 -1
- package/dist/src/errors/errors.d.ts +65 -35
- package/dist/src/errors/errors.d.ts.map +1 -1
- package/dist/src/flush.d.ts +11 -0
- package/dist/src/flush.d.ts.map +1 -0
- package/dist/src/id/id.d.ts +1 -0
- package/dist/src/id/id.d.ts.map +1 -1
- package/dist/src/identity.d.ts +2 -2
- package/dist/src/identity.d.ts.map +1 -1
- package/dist/src/index.d.ts +7 -2
- package/dist/src/index.d.ts.map +1 -1
- package/dist/src/instance/index.d.ts +2 -0
- package/dist/src/instance/index.d.ts.map +1 -0
- package/dist/src/instance/matcher.d.ts +79 -0
- package/dist/src/instance/matcher.d.ts.map +1 -0
- package/dist/src/instance/matcher.spec.d.ts +2 -0
- package/dist/src/instance/matcher.spec.d.ts.map +1 -0
- package/dist/src/jsonrpc/jsonrpc.d.ts +39 -8
- package/dist/src/jsonrpc/jsonrpc.d.ts.map +1 -1
- package/dist/src/kv/types.d.ts +1 -1
- package/dist/src/kv/types.d.ts.map +1 -1
- package/dist/src/map/index.d.ts +2 -0
- package/dist/src/map/index.d.ts.map +1 -0
- package/dist/src/map/map.d.ts +2 -0
- package/dist/src/map/map.d.ts.map +1 -0
- package/dist/src/map/map.spec.d.ts +2 -0
- package/dist/src/map/map.spec.d.ts.map +1 -0
- package/dist/src/math/math.d.ts +2 -4
- package/dist/src/math/math.d.ts.map +1 -1
- package/dist/src/migrate/migrate.d.ts +4 -4
- package/dist/src/migrate/migrate.d.ts.map +1 -1
- package/dist/src/optional.d.ts +0 -3
- package/dist/src/optional.d.ts.map +1 -1
- package/dist/src/primitive/index.d.ts +2 -0
- package/dist/src/primitive/index.d.ts.map +1 -0
- package/dist/src/primitive/primitive.d.ts +39 -0
- package/dist/src/primitive/primitive.d.ts.map +1 -0
- package/dist/src/primitive/primitive.spec.d.ts +2 -0
- package/dist/src/primitive/primitive.spec.d.ts.map +1 -0
- package/dist/src/record/index.d.ts +2 -0
- package/dist/src/record/index.d.ts.map +1 -0
- package/dist/src/record/record.d.ts +90 -0
- package/dist/src/record/record.d.ts.map +1 -0
- package/dist/src/record/record.spec.d.ts.map +1 -0
- package/dist/src/renderable.d.ts +1 -1
- package/dist/src/renderable.d.ts.map +1 -1
- package/dist/src/replace.d.ts.map +1 -1
- package/dist/src/runtime/detect.d.ts.map +1 -1
- package/dist/src/spatial/base.d.ts +9 -9
- package/dist/src/spatial/base.d.ts.map +1 -1
- package/dist/src/spatial/bounds/bounds.d.ts +82 -16
- package/dist/src/spatial/bounds/bounds.d.ts.map +1 -1
- package/dist/src/spatial/box/box.d.ts +6 -6
- package/dist/src/spatial/box/box.d.ts.map +1 -1
- package/dist/src/spatial/dimensions/dimensions.d.ts +4 -4
- package/dist/src/spatial/dimensions/dimensions.d.ts.map +1 -1
- package/dist/src/spatial/direction/direction.d.ts +2 -2
- package/dist/src/spatial/direction/direction.d.ts.map +1 -1
- package/dist/src/spatial/location/location.d.ts +3 -3
- package/dist/src/spatial/location/location.d.ts.map +1 -1
- package/dist/src/spatial/scale/scale.d.ts +10 -10
- package/dist/src/spatial/scale/scale.d.ts.map +1 -1
- package/dist/src/spatial/xy/xy.d.ts +4 -4
- package/dist/src/spatial/xy/xy.d.ts.map +1 -1
- package/dist/src/status/index.d.ts +2 -0
- package/dist/src/status/index.d.ts.map +1 -0
- package/dist/src/status/status.d.ts +42 -0
- package/dist/src/status/status.d.ts.map +1 -0
- package/dist/src/status/status.spec.d.ts +2 -0
- package/dist/src/status/status.spec.d.ts.map +1 -0
- package/dist/src/strings/strings.d.ts +16 -0
- package/dist/src/strings/strings.d.ts.map +1 -1
- package/dist/src/sync/index.d.ts.map +1 -1
- package/dist/src/sync/mutex.d.ts +0 -1
- package/dist/src/sync/mutex.d.ts.map +1 -1
- package/dist/src/telem/series.d.ts +473 -66
- package/dist/src/telem/series.d.ts.map +1 -1
- package/dist/src/telem/telem.d.ts +274 -61
- package/dist/src/telem/telem.d.ts.map +1 -1
- package/dist/src/testutil/testutil.d.ts +1 -0
- package/dist/src/testutil/testutil.d.ts.map +1 -1
- package/dist/src/testutil/testutil.spec.d.ts +2 -0
- package/dist/src/testutil/testutil.spec.d.ts.map +1 -0
- package/dist/src/uuid/index.d.ts +2 -0
- package/dist/src/uuid/index.d.ts.map +1 -0
- package/dist/src/uuid/uuid.d.ts +35 -0
- package/dist/src/uuid/uuid.d.ts.map +1 -0
- package/dist/src/uuid/uuid.spec.d.ts +2 -0
- package/dist/src/uuid/uuid.spec.d.ts.map +1 -0
- package/dist/src/zod/external.d.ts +2 -1
- package/dist/src/zod/external.d.ts.map +1 -1
- package/dist/src/zod/nullToUndefined.d.ts +3 -0
- package/dist/src/zod/nullToUndefined.d.ts.map +1 -0
- package/dist/src/zod/nullToUndefined.spec.d.ts +2 -0
- package/dist/src/zod/nullToUndefined.spec.d.ts.map +1 -0
- package/dist/src/zod/toArray.d.ts +3 -0
- package/dist/src/zod/toArray.d.ts.map +1 -0
- package/dist/src/zod/toArray.spec.d.ts +2 -0
- package/dist/src/zod/toArray.spec.d.ts.map +1 -0
- package/dist/src/zod/util.d.ts +1 -1
- package/dist/src/zod/util.d.ts.map +1 -1
- package/dist/telem.cjs +1 -1
- package/dist/telem.js +10 -11
- package/dist/url.cjs +1 -1
- package/dist/url.js +16 -19
- package/dist/worker.cjs +1 -1
- package/dist/worker.js +18 -22
- package/dist/zod.cjs +1 -1
- package/dist/zod.js +1 -1
- package/eslint.config.js +1 -1
- package/package.json +20 -23
- package/src/array/index.ts +10 -0
- package/src/array/toArray.spec.ts +56 -0
- package/src/array/toArray.ts +28 -0
- package/src/binary/codec.spec.ts +200 -277
- package/src/binary/codec.ts +19 -75
- package/src/breaker/breaker.ts +2 -2
- package/src/caseconv/caseconv.ts +14 -14
- package/src/change/change.ts +1 -1
- package/src/color/color.spec.ts +113 -2
- package/src/color/color.ts +88 -58
- package/src/color/external.ts +0 -1
- package/src/color/gradient.ts +19 -27
- package/src/compare/compare.ts +10 -10
- package/src/control/control.ts +22 -19
- package/src/debounce/debounce.ts +1 -1
- package/src/deep/delete.ts +5 -4
- package/src/deep/difference.ts +6 -2
- package/src/deep/equal.spec.ts +1 -1
- package/src/deep/equal.ts +5 -5
- package/src/deep/merge.spec.ts +1 -2
- package/src/deep/merge.ts +15 -6
- package/src/deep/path.spec.ts +41 -0
- package/src/deep/path.ts +48 -17
- package/src/destructor.ts +6 -2
- package/src/errors/errors.spec.ts +20 -20
- package/src/errors/errors.ts +67 -43
- package/src/flush.ts +21 -0
- package/src/id/id.spec.ts +1 -1
- package/src/id/id.ts +3 -1
- package/src/identity.ts +2 -2
- package/src/index.ts +7 -2
- package/src/instance/index.ts +10 -0
- package/src/instance/matcher.spec.ts +78 -0
- package/src/instance/matcher.ts +98 -0
- package/src/jsonrpc/jsonrpc.spec.ts +2 -1
- package/src/jsonrpc/jsonrpc.ts +35 -6
- package/src/map/index.ts +10 -0
- package/src/map/map.spec.ts +132 -0
- package/src/map/map.ts +17 -0
- package/src/math/math.ts +19 -27
- package/src/migrate/migrate.spec.ts +1 -1
- package/src/migrate/migrate.ts +7 -7
- package/src/optional.ts +0 -4
- package/src/primitive/index.ts +10 -0
- package/src/primitive/primitive.spec.ts +126 -0
- package/src/primitive/primitive.ts +82 -0
- package/src/record/index.ts +10 -0
- package/src/record/record.spec.ts +319 -0
- package/src/record/record.ts +118 -0
- package/src/renderable.ts +1 -1
- package/src/replace.ts +9 -0
- package/src/runtime/detect.ts +0 -2
- package/src/spatial/bounds/bounds.spec.ts +20 -0
- package/src/spatial/bounds/bounds.ts +101 -18
- package/src/spatial/dimensions/dimensions.ts +2 -2
- package/src/spatial/direction/direction.ts +1 -1
- package/src/status/index.ts +10 -0
- package/src/status/status.spec.ts +25 -0
- package/src/status/status.ts +91 -0
- package/src/strings/strings.spec.ts +51 -13
- package/src/strings/strings.ts +20 -0
- package/src/sync/index.ts +9 -0
- package/src/sync/mutex.ts +9 -4
- package/src/telem/series.spec.ts +912 -105
- package/src/telem/series.ts +577 -201
- package/src/telem/telem.spec.ts +262 -90
- package/src/telem/telem.ts +335 -125
- package/src/testutil/testutil.spec.ts +161 -0
- package/src/testutil/testutil.ts +12 -0
- package/src/uuid/index.ts +10 -0
- package/src/uuid/uuid.spec.ts +82 -0
- package/src/uuid/uuid.ts +48 -0
- package/src/zod/external.ts +2 -1
- package/src/zod/nullToUndefined.spec.ts +31 -0
- package/src/zod/nullToUndefined.ts +23 -0
- package/src/zod/toArray.spec.ts +182 -0
- package/src/{toArray.ts → zod/toArray.ts} +3 -4
- package/src/zod/util.spec.ts +1 -1
- package/src/zod/util.ts +7 -7
- package/tsconfig.json +1 -1
- package/tsconfig.tsbuildinfo +1 -1
- package/vite.config.ts +2 -3
- package/dist/bounds-BQo7rvs9.cjs +0 -1
- package/dist/bounds-Bn5_l4Z3.js +0 -173
- package/dist/external-C-dNgNQw.cjs +0 -1
- package/dist/external-C8TFju8Q.js +0 -29
- package/dist/external-DWQITF5_.cjs +0 -1
- package/dist/index-BywOGO8U.js +0 -1074
- package/dist/index-CYYjI7Uf.cjs +0 -1
- package/dist/index-C_6NXBlg.cjs +0 -3
- package/dist/index-Dd8DLyMx.cjs +0 -1
- package/dist/index-DizUWH6z.js +0 -47
- package/dist/path-1tZLZ4AN.cjs +0 -1
- package/dist/path-DD6ytXzr.js +0 -76
- package/dist/position-Cai5-wi1.cjs +0 -1
- package/dist/position-DIglP1l2.js +0 -85
- package/dist/scale-BtZINJ-A.cjs +0 -1
- package/dist/search.cjs +0 -1
- package/dist/search.js +0 -14
- package/dist/series-B9JERcqi.js +0 -1977
- package/dist/series-DqJ6f97G.cjs +0 -11
- package/dist/src/color/transformColorsToHex.d.ts +0 -6
- package/dist/src/color/transformColorsToHex.d.ts.map +0 -1
- package/dist/src/primitive.d.ts +0 -9
- package/dist/src/primitive.d.ts.map +0 -1
- package/dist/src/record.d.ts +0 -18
- package/dist/src/record.d.ts.map +0 -1
- package/dist/src/record.spec.d.ts.map +0 -1
- package/dist/src/search.d.ts +0 -18
- package/dist/src/search.d.ts.map +0 -1
- package/dist/src/toArray.d.ts +0 -3
- package/dist/src/toArray.d.ts.map +0 -1
- package/dist/src/zod/integer.d.ts +0 -10
- package/dist/src/zod/integer.d.ts.map +0 -1
- package/dist/src/zod/integer.spec.d.ts +0 -2
- package/dist/src/zod/integer.spec.d.ts.map +0 -1
- package/dist/toArray.cjs +0 -1
- package/dist/toArray.js +0 -5
- package/src/color/transformColorsToHex.ts +0 -30
- package/src/primitive.ts +0 -46
- package/src/record.spec.ts +0 -38
- package/src/record.ts +0 -47
- package/src/search.ts +0 -42
- package/src/zod/integer.spec.ts +0 -148
- package/src/zod/integer.ts +0 -38
- /package/dist/src/{record.spec.d.ts → record/record.spec.d.ts} +0 -0
package/dist/series-DqJ6f97G.cjs
DELETED
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
"use strict";var rt=Object.defineProperty;var st=(o,t,e)=>t in o?rt(o,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):o[t]=e;var s=(o,t,e)=>st(o,typeof t!="symbol"?t+"":t,e);const l=require("zod"),D=require("./index-C_6NXBlg.cjs"),it=require("./index-Dd8DLyMx.cjs"),at=require("./index-CYYjI7Uf.cjs"),b=require("./bounds-BQo7rvs9.cjs");require("./box-0YrQibkB.cjs");require("./dimensions-D2QGoNXO.cjs");require("./base-BAM2mqCy.cjs");require("./location-BGl5Ddds.cjs");require("./scale-BtZINJ-A.cjs");require("./xy-B7065J2S.cjs");let ut=(o,t=21)=>(e=t)=>{let n="",i=e|0;for(;i--;)n+=o[Math.random()*o.length|0];return n};const ot="0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz",lt=ut(ot,11),Q=()=>lt(),ct=Object.freeze(Object.defineProperty({__proto__:null,create:Q},Symbol.toStringTag,{value:"Module"})),ft=l.z.enum(["static","dynamic"]),_=(o,t)=>{const e=new m(t);if(![O.DAY,O.HOUR,O.MINUTE,O.SECOND,O.MILLISECOND,O.MICROSECOND,O.NANOSECOND].some(i=>i.equals(e)))throw new Error("Invalid argument for remainder. Must be an even TimeSpan or Timestamp");const n=o.valueOf()%e.valueOf();return o instanceof m?new m(n):new O(n)},a=class a{constructor(t,e="UTC"){s(this,"value");s(this,"encodeValue",!0);if(t==null)this.value=a.now().valueOf();else if(t instanceof Date)this.value=BigInt(t.getTime())*a.MILLISECOND.valueOf();else if(typeof t=="string")this.value=a.parseDateTimeString(t,e).valueOf();else if(Array.isArray(t))this.value=a.parseDate(t);else{let n=BigInt(0);t instanceof Number&&(t=t.valueOf()),e==="local"&&(n=a.utcOffset.valueOf()),typeof t=="number"&&(isFinite(t)?t=Math.trunc(t):(isNaN(t)&&(t=0),t===1/0?t=a.MAX:t=a.MIN)),this.value=BigInt(t.valueOf())+n}}static parseDate([t=1970,e=1,n=1]){const i=new Date(t,e-1,n,0,0,0,0);return new a(BigInt(i.getTime())*a.MILLISECOND.valueOf()).truncate(a.DAY).valueOf()}valueOf(){return this.value}static parseTimeString(t,e="UTC"){const[n,i,f]=t.split(":");let h="00",A="00";f!=null&&([h,A]=f.split("."));let y=a.hours(parseInt(n??"00")).add(a.minutes(parseInt(i??"00"))).add(a.seconds(parseInt(h??"00"))).add(a.milliseconds(parseInt(A??"00")));return e==="local"&&(y=y.add(a.utcOffset)),y.valueOf()}static parseDateTimeString(t,e="UTC"){if(!t.includes("/")&&!t.includes("-"))return a.parseTimeString(t,e);const n=new Date(t);return t.includes(":")||n.setUTCHours(0,0,0,0),new a(BigInt(n.getTime())*a.MILLISECOND.valueOf(),e).valueOf()}fString(t="ISO",e="UTC"){switch(t){case"ISODate":return this.toISOString(e).slice(0,10);case"ISOTime":return this.toISOString(e).slice(11,23);case"time":return this.timeString(!1,e);case"preciseTime":return this.timeString(!0,e);case"date":return this.dateString();case"preciseDate":return`${this.dateString()} ${this.timeString(!0,e)}`;case"dateTime":return`${this.dateString()} ${this.timeString(!1,e)}`;default:return this.toISOString(e)}}toISOString(t="UTC"){return t==="UTC"?this.date().toISOString():this.sub(a.utcOffset).date().toISOString()}timeString(t=!1,e="UTC"){const n=this.toISOString(e);return t?n.slice(11,23):n.slice(11,19)}dateString(){const t=this.date(),e=t.toLocaleString("default",{month:"short"}),n=t.toLocaleString("default",{day:"numeric"});return`${e} ${n}`}static get utcOffset(){return new O(BigInt(new Date().getTimezoneOffset())*a.MINUTE.valueOf())}static since(t){return new a().span(t)}date(){return new Date(this.milliseconds)}equals(t){return this.valueOf()===new a(t).valueOf()}span(t){return this.range(t).span}range(t){return new p(this,t).makeValid()}spanRange(t){return this.range(this.add(t)).makeValid()}get isZero(){return this.valueOf()===BigInt(0)}after(t){return this.valueOf()>new a(t).valueOf()}afterEq(t){return this.valueOf()>=new a(t).valueOf()}before(t){return this.valueOf()<new a(t).valueOf()}beforeEq(t){return this.valueOf()<=new a(t).valueOf()}add(t){return new a(this.valueOf()+BigInt(t.valueOf()))}sub(t){return new a(this.valueOf()-BigInt(t.valueOf()))}get hours(){return Number(this.valueOf())/Number(O.HOUR.valueOf())}get minutes(){return Number(this.valueOf())/Number(O.MINUTE.valueOf())}get days(){return Number(this.valueOf())/Number(O.DAY.valueOf())}get seconds(){return Number(this.valueOf())/Number(O.SECOND.valueOf())}get milliseconds(){return Number(this.valueOf())/Number(a.MILLISECOND.valueOf())}get microseconds(){return Number(this.valueOf())/Number(a.MICROSECOND.valueOf())}get nanoseconds(){return Number(this.valueOf())}get year(){return this.date().getFullYear()}setYear(t){const e=this.date();return e.setFullYear(t),new a(e)}get month(){return this.date().getUTCMonth()}setMonth(t){const e=this.date();return e.setUTCMonth(t),new a(e)}get day(){return this.date().getUTCDate()}setDay(t){const e=this.date();return e.setUTCDate(t),new a(e)}get hour(){return this.date().getUTCHours()}setHour(t){const e=this.date();return e.setUTCHours(t),new a(e,"UTC")}get minute(){return this.date().getMinutes()}setMinute(t){const e=this.date();return e.setUTCMinutes(t),new a(e)}get second(){return this.date().getSeconds()}setSecond(t){const e=this.date();return e.setUTCSeconds(t),new a(e)}get millisecond(){return this.date().getMilliseconds()}setMillisecond(t){const e=this.date();return e.setMilliseconds(t),new a(e)}toString(){return this.date().toISOString()}remainder(t){return _(this,t)}get isToday(){return this.truncate(O.DAY).equals(a.now().truncate(O.DAY))}truncate(t){return this.sub(this.remainder(t))}static now(){return new a(new Date)}static max(...t){let e=a.MIN;for(const n of t){const i=new a(n);i.after(e)&&(e=i)}return e}static min(...t){let e=a.MAX;for(const n of t){const i=new a(n);i.before(e)&&(e=i)}return e}static nanoseconds(t,e="UTC"){return new a(t,e)}static microseconds(t,e="UTC"){return a.nanoseconds(t*1e3,e)}static milliseconds(t,e="UTC"){return a.microseconds(t*1e3,e)}static seconds(t,e="UTC"){return a.milliseconds(t*1e3,e)}static minutes(t,e="UTC"){return a.seconds(t*60,e)}static hours(t,e="UTC"){return a.minutes(t*60,e)}static days(t,e="UTC"){return a.hours(t*24,e)}};s(a,"NANOSECOND",a.nanoseconds(1)),s(a,"MICROSECOND",a.microseconds(1)),s(a,"MILLISECOND",a.milliseconds(1)),s(a,"SECOND",a.seconds(1)),s(a,"MINUTE",a.minutes(1)),s(a,"HOUR",a.hours(1)),s(a,"DAY",a.days(1)),s(a,"MAX",new a((1n<<63n)-1n)),s(a,"MIN",new a(0)),s(a,"ZERO",new a(0)),s(a,"z",l.z.union([l.z.object({value:l.z.bigint()}).transform(t=>new a(t.value)),l.z.string().transform(t=>new a(BigInt(t))),l.z.instanceof(Number).transform(t=>new a(t)),l.z.number().transform(t=>new a(t)),l.z.instanceof(a)]));let m=a;const u=class u{constructor(t){s(this,"value");s(this,"encodeValue",!0);typeof t=="number"&&(t=Math.trunc(t.valueOf())),this.value=BigInt(t.valueOf())}static fromSeconds(t){return t instanceof u?t:t instanceof L?t.period:t instanceof m?new u(t):["number","bigint"].includes(typeof t)?u.seconds(t):new u(t)}static fromMilliseconds(t){return t instanceof u?t:t instanceof L?t.period:t instanceof m?new u(t):["number","bigint"].includes(typeof t)?u.milliseconds(t):new u(t)}encode(){return this.value.toString()}valueOf(){return this.value}lessThan(t){return this.valueOf()<new u(t).valueOf()}greaterThan(t){return this.valueOf()>new u(t).valueOf()}lessThanOrEqual(t){return this.valueOf()<=new u(t).valueOf()}greaterThanOrEqual(t){return this.valueOf()>=new u(t).valueOf()}remainder(t){return _(this,t)}truncate(t){return new u(BigInt(Math.trunc(Number(this.valueOf()/t.valueOf())))*t.valueOf())}toString(){const t=this.truncate(u.DAY),e=this.truncate(u.HOUR),n=this.truncate(u.MINUTE),i=this.truncate(u.SECOND),f=this.truncate(u.MILLISECOND),h=this.truncate(u.MICROSECOND),A=this.truncate(u.NANOSECOND),y=t,S=e.sub(t),E=n.sub(e),c=i.sub(n),U=f.sub(i),v=h.sub(f),V=A.sub(h);let M="";return y.isZero||(M+=`${y.days}d `),S.isZero||(M+=`${S.hours}h `),E.isZero||(M+=`${E.minutes}m `),c.isZero||(M+=`${c.seconds}s `),U.isZero||(M+=`${U.milliseconds}ms `),v.isZero||(M+=`${v.microseconds}µs `),V.isZero||(M+=`${V.nanoseconds}ns`),M.trim()}mult(t){return new u(this.valueOf()*BigInt(t))}get days(){return Number(this.valueOf())/Number(u.DAY.valueOf())}get hours(){return Number(this.valueOf())/Number(u.HOUR.valueOf())}get minutes(){return Number(this.valueOf())/Number(u.MINUTE.valueOf())}get seconds(){return Number(this.valueOf())/Number(u.SECOND.valueOf())}get milliseconds(){return Number(this.valueOf())/Number(u.MILLISECOND.valueOf())}get microseconds(){return Number(this.valueOf())/Number(u.MICROSECOND.valueOf())}get nanoseconds(){return Number(this.valueOf())}get isZero(){return this.valueOf()===BigInt(0)}equals(t){return this.valueOf()===new u(t).valueOf()}add(t){return new u(this.valueOf()+new u(t).valueOf())}sub(t){return new u(this.valueOf()-new u(t).valueOf())}static nanoseconds(t=1){return new u(t)}static microseconds(t=1){return u.nanoseconds(b.mult(t,1e3))}static milliseconds(t=1){return u.microseconds(b.mult(t,1e3))}static seconds(t=1){return u.milliseconds(b.mult(t,1e3))}static minutes(t=1){return u.seconds(b.mult(t,60))}static hours(t){return u.minutes(b.mult(t,60))}static days(t){return u.hours(b.mult(t,24))}};s(u,"NANOSECOND",u.nanoseconds(1)),s(u,"MICROSECOND",u.microseconds(1)),s(u,"MILLISECOND",u.milliseconds(1)),s(u,"SECOND",u.seconds(1)),s(u,"MINUTE",u.minutes(1)),s(u,"HOUR",u.hours(1)),s(u,"DAY",u.days(1)),s(u,"MAX",new u((1n<<63n)-1n)),s(u,"MIN",new u(0)),s(u,"ZERO",new u(0)),s(u,"z",l.z.union([l.z.object({value:l.z.bigint()}).transform(t=>new u(t.value)),l.z.string().transform(t=>new u(BigInt(t))),l.z.instanceof(Number).transform(t=>new u(t)),l.z.number().transform(t=>new u(t)),l.z.instanceof(u)]));let O=u;const B=class B extends Number{constructor(t){t instanceof Number?super(t.valueOf()):super(t)}toString(){return`${this.valueOf()} Hz`}equals(t){return this.valueOf()===new B(t).valueOf()}get period(){return O.seconds(1/this.valueOf())}sampleCount(t){return new O(t).seconds*this.valueOf()}byteCount(t,e){return this.sampleCount(t)*new T(e).valueOf()}span(t){return O.seconds(t/this.valueOf())}byteSpan(t,e){return this.span(t.valueOf()/e.valueOf())}static hz(t){return new B(t)}static khz(t){return B.hz(t*1e3)}};s(B,"z",l.z.union([l.z.number().transform(t=>new B(t)),l.z.instanceof(Number).transform(t=>new B(t)),l.z.instanceof(B)]));let L=B;const w=class w extends Number{constructor(t){t instanceof Number?super(t.valueOf()):super(t)}length(t){return t.valueOf()/this.valueOf()}size(t){return new R(t*this.valueOf())}};s(w,"UNKNOWN",new w(0)),s(w,"BIT128",new w(16)),s(w,"BIT64",new w(8)),s(w,"BIT32",new w(4)),s(w,"BIT16",new w(2)),s(w,"BIT8",new w(1)),s(w,"z",l.z.union([l.z.number().transform(t=>new w(t)),l.z.instanceof(Number).transform(t=>new w(t)),l.z.instanceof(w)]));let T=w;const I=class I{constructor(t,e){s(this,"start");s(this,"end");typeof t=="object"&&"start"in t?(this.start=new m(t.start),this.end=new m(t.end)):(this.start=new m(t),this.end=new m(e))}get span(){return new O(this.end.valueOf()-this.start.valueOf())}get isValid(){return this.start.valueOf()<=this.end.valueOf()}makeValid(){return this.isValid?this:this.swap()}get isZero(){return this.span.isZero}get numeric(){return{start:Number(this.start.valueOf()),end:Number(this.end.valueOf())}}swap(){return new I(this.end,this.start)}get numericBounds(){return{lower:Number(this.start.valueOf()),upper:Number(this.end.valueOf())}}equals(t,e=O.ZERO){if(e.isZero)return this.start.equals(t.start)&&this.end.equals(t.end);let n=this.start.sub(t.start).valueOf(),i=this.end.sub(t.end).valueOf();return n<0&&(n=-n),i<0&&(i=-i),n<=e.valueOf()&&i<=e.valueOf()}toString(){return`${this.start.toString()} - ${this.end.toString()}`}toPrettyString(){return`${this.start.fString("preciseDate")} - ${this.span.toString()}`}overlapsWith(t,e=O.ZERO){t=t.makeValid();const n=this.makeValid();if(this.equals(t))return!0;if(t.end.equals(n.start)||n.end.equals(t.start))return!1;const i=m.max(n.start,t.start),f=m.min(n.end,t.end);return f.before(i)?!1:new O(f.sub(i)).greaterThanOrEqual(e)}contains(t){return t instanceof I?this.contains(t.start)&&this.contains(t.end):this.start.beforeEq(t)&&this.end.after(t)}boundBy(t){const e=new I(this.start,this.end);return t.start.after(this.start)&&(e.start=t.start),t.start.after(this.end)&&(e.end=t.start),t.end.before(this.end)&&(e.end=t.end),t.end.before(this.start)&&(e.start=t.end),e}static max(...t){return new I(m.min(...t.map(e=>e.start)),m.max(...t.map(e=>e.end)))}};s(I,"MAX",new I(m.MIN,m.MAX)),s(I,"MIN",new I(m.MAX,m.MIN)),s(I,"ZERO",new I(m.ZERO,m.ZERO)),s(I,"z",l.z.union([l.z.object({start:m.z,end:m.z}).transform(t=>new I(t.start,t.end)),l.z.instanceof(I)]));let p=I;const ht=(o,t)=>o.start.before(t.start)?-1:o.start.after(t.start)?1:o.end.before(t.end)?-1:o.end.after(t.end)?1:0,r=class r{constructor(t){s(this,"value");s(this,"encodeValue",!0);if(t instanceof r||typeof t=="string"||typeof t.valueOf()=="string"){this.value=t.valueOf();return}const e=r.ARRAY_CONSTRUCTOR_DATA_TYPES.get(t.constructor.name);if(e!=null){this.value=e.valueOf();return}throw this.value=r.UNKNOWN.valueOf(),new Error(`unable to find data type for ${t.toString()}`)}valueOf(){return this.value}get Array(){const t=r.ARRAY_CONSTRUCTORS.get(this.toString());if(t==null)throw new Error(`unable to find array constructor for ${this.valueOf()}`);return t}equals(t){return this.valueOf()===t.valueOf()}matches(...t){return t.some(e=>this.equals(e))}toString(){return this.valueOf()}get isVariable(){return this.equals(r.JSON)||this.equals(r.STRING)}get isNumeric(){return!this.isVariable&&!this.equals(r.UUID)}get isInteger(){const t=this.toString();return t.startsWith("int")||t.startsWith("uint")}get isFloat(){return this.toString().startsWith("float")}get density(){const t=r.DENSITIES.get(this.toString());if(t==null)throw new Error(`unable to find density for ${this.valueOf()}`);return t}get isUnsigned(){return this.equals(r.UINT8)||this.equals(r.UINT16)||this.equals(r.UINT32)||this.equals(r.UINT64)}get isSigned(){return this.equals(r.INT8)||this.equals(r.INT16)||this.equals(r.INT32)||this.equals(r.INT64)}canSafelyCastTo(t){return this.equals(t)?!0:!this.isNumeric||!t.isNumeric||this.isVariable||t.isVariable||this.isUnsigned&&t.isSigned?!1:this.isFloat?t.isFloat&&this.density.valueOf()<=t.density.valueOf():this.equals(r.INT32)&&t.equals(r.FLOAT64)||this.equals(r.INT8)&&t.equals(r.FLOAT32)?!0:this.isInteger&&t.isInteger?this.density.valueOf()<=t.density.valueOf()&&this.isUnsigned===t.isUnsigned:!1}canCastTo(t){return this.isNumeric&&t.isNumeric?!0:this.equals(t)}toJSON(){return this.toString()}get usesBigInt(){return r.BIG_INT_TYPES.some(t=>t.equals(this))}};s(r,"UNKNOWN",new r("unknown")),s(r,"FLOAT64",new r("float64")),s(r,"FLOAT32",new r("float32")),s(r,"INT64",new r("int64")),s(r,"INT32",new r("int32")),s(r,"INT16",new r("int16")),s(r,"INT8",new r("int8")),s(r,"UINT64",new r("uint64")),s(r,"UINT32",new r("uint32")),s(r,"UINT16",new r("uint16")),s(r,"UINT8",new r("uint8")),s(r,"BOOLEAN",r.UINT8),s(r,"TIMESTAMP",new r("timestamp")),s(r,"UUID",new r("uuid")),s(r,"STRING",new r("string")),s(r,"JSON",new r("json")),s(r,"ARRAY_CONSTRUCTORS",new Map([[r.UINT8.toString(),Uint8Array],[r.UINT16.toString(),Uint16Array],[r.UINT32.toString(),Uint32Array],[r.UINT64.toString(),BigUint64Array],[r.FLOAT32.toString(),Float32Array],[r.FLOAT64.toString(),Float64Array],[r.INT8.toString(),Int8Array],[r.INT16.toString(),Int16Array],[r.INT32.toString(),Int32Array],[r.INT64.toString(),BigInt64Array],[r.TIMESTAMP.toString(),BigInt64Array],[r.STRING.toString(),Uint8Array],[r.JSON.toString(),Uint8Array],[r.UUID.toString(),Uint8Array]])),s(r,"ARRAY_CONSTRUCTOR_DATA_TYPES",new Map([[Uint8Array.name,r.UINT8],[Uint16Array.name,r.UINT16],[Uint32Array.name,r.UINT32],[BigUint64Array.name,r.UINT64],[Float32Array.name,r.FLOAT32],[Float64Array.name,r.FLOAT64],[Int8Array.name,r.INT8],[Int16Array.name,r.INT16],[Int32Array.name,r.INT32],[BigInt64Array.name,r.INT64]])),s(r,"DENSITIES",new Map([[r.UINT8.toString(),T.BIT8],[r.UINT16.toString(),T.BIT16],[r.UINT32.toString(),T.BIT32],[r.UINT64.toString(),T.BIT64],[r.FLOAT32.toString(),T.BIT32],[r.FLOAT64.toString(),T.BIT64],[r.INT8.toString(),T.BIT8],[r.INT16.toString(),T.BIT16],[r.INT32.toString(),T.BIT32],[r.INT64.toString(),T.BIT64],[r.TIMESTAMP.toString(),T.BIT64],[r.STRING.toString(),T.UNKNOWN],[r.JSON.toString(),T.UNKNOWN],[r.UUID.toString(),T.BIT128]])),s(r,"ALL",[r.UNKNOWN,r.FLOAT64,r.FLOAT32,r.INT64,r.INT32,r.INT16,r.INT8,r.UINT64,r.UINT32,r.UINT16,r.UINT8,r.TIMESTAMP,r.UUID,r.STRING,r.JSON]),s(r,"BIG_INT_TYPES",[r.INT64,r.UINT64,r.TIMESTAMP]),s(r,"z",l.z.union([l.z.string().transform(t=>new r(t)),l.z.instanceof(r)]));let g=r;const d=class d extends Number{constructor(t){super(t.valueOf())}largerThan(t){return this.valueOf()>t.valueOf()}smallerThan(t){return this.valueOf()<t.valueOf()}add(t){return d.bytes(this.valueOf()+t.valueOf())}sub(t){return d.bytes(this.valueOf()-t.valueOf())}truncate(t){return new d(Math.trunc(this.valueOf()/t.valueOf())*t.valueOf())}remainder(t){return d.bytes(this.valueOf()%t.valueOf())}get gigabytes(){return this.valueOf()/d.GIGABYTE.valueOf()}get megabytes(){return this.valueOf()/d.MEGABYTE.valueOf()}get kilobytes(){return this.valueOf()/d.KILOBYTE.valueOf()}get terabytes(){return this.valueOf()/d.TERABYTE.valueOf()}toString(){const t=this.truncate(d.TERABYTE),e=this.truncate(d.GIGABYTE),n=this.truncate(d.MEGABYTE),i=this.truncate(d.KILOBYTE),f=this.truncate(d.BYTE),h=t,A=e.sub(t),y=n.sub(e),S=i.sub(n),E=f.sub(i);let c="";return h.isZero||(c+=`${h.terabytes}TB `),A.isZero||(c+=`${A.gigabytes}GB `),y.isZero||(c+=`${y.megabytes}MB `),S.isZero||(c+=`${S.kilobytes}KB `),(!E.isZero||c==="")&&(c+=`${E.valueOf()}B`),c.trim()}static bytes(t=1){return new d(t)}static kilobytes(t=1){return d.bytes(t.valueOf()*1e3)}static megabytes(t=1){return d.kilobytes(t.valueOf()*1e3)}static gigabytes(t=1){return d.megabytes(t.valueOf()*1e3)}static terabytes(t){return d.gigabytes(t.valueOf()*1e3)}get isZero(){return this.valueOf()===0}};s(d,"BYTE",new d(1)),s(d,"KILOBYTE",d.kilobytes(1)),s(d,"MEGABYTE",d.megabytes(1)),s(d,"GIGABYTE",d.gigabytes(1)),s(d,"TERABYTE",d.terabytes(1)),s(d,"ZERO",new d(0)),s(d,"z",l.z.union([l.z.number().transform(t=>new d(t)),l.z.instanceof(d)]));let R=d;const dt=l.z.union([l.z.instanceof(Uint8Array),l.z.instanceof(Uint16Array),l.z.instanceof(Uint32Array),l.z.instanceof(BigUint64Array),l.z.instanceof(Float32Array),l.z.instanceof(Float64Array),l.z.instanceof(Int8Array),l.z.instanceof(Int16Array),l.z.instanceof(Int32Array),l.z.instanceof(BigInt64Array)]),Z=o=>{const t=typeof o;return t==="string"||t==="number"||t==="boolean"||t==="bigint"||o instanceof m||o instanceof O||o instanceof Date},tt=(o,t,e,n=0)=>o.usesBigInt&&!t.usesBigInt?Number(e)-Number(n):!o.usesBigInt&&t.usesBigInt?BigInt(e.valueOf())-BigInt(n.valueOf()):x(e,-n).valueOf(),x=(o,t)=>t==0?o:o==0?t:typeof o=="bigint"&&typeof t=="bigint"||typeof o=="number"&&typeof t=="number"?o+t:Number(o)+Number(t),et=o=>o==null?!1:Array.isArray(o)||o instanceof ArrayBuffer||ArrayBuffer.isView(o)&&!(o instanceof DataView)||o instanceof z?!0:Z(o),C=-1,P={[Symbol.iterator]:()=>P,next:()=>({done:!0,value:void 0})},gt=l.z.string().transform(o=>new Uint8Array(atob(o).split("").map(t=>t.charCodeAt(0))).buffer),mt=l.z.union([l.z.null(),l.z.undefined()]).transform(()=>new Uint8Array().buffer),F=10,nt=(o,t)=>{if(o==="string"&&!t.isVariable)throw new Error(`cannot convert series of type ${t.toString()} to string`);if(o==="number"&&!t.isNumeric)throw new Error(`cannot convert series of type ${t.toString()} to number`);if(o==="bigint"&&!t.usesBigInt)throw new Error(`cannot convert series of type ${t.toString()} to bigint`)},N=class N{constructor(t){s(this,"key","");s(this,"isSynnaxSeries",!0);s(this,"dataType");s(this,"sampleOffset");s(this,"gl");s(this,"_data");s(this,"timeRange",p.ZERO);s(this,"alignment",0n);s(this,"_cachedMin");s(this,"_cachedMax");s(this,"writePos",C);s(this,"_refCount",0);s(this,"_cachedLength");s(this,"_cachedIndexes");et(t)&&(t={data:t});const{dataType:e,timeRange:n,sampleOffset:i=0,glBufferUsage:f="static",alignment:h=0n,key:A=Q()}=t,y=t.data??[];if(y instanceof N||typeof y=="object"&&"isSynnaxSeries"in y&&y.isSynnaxSeries===!0){const c=y;this.key=c.key,this.dataType=c.dataType,this.sampleOffset=c.sampleOffset,this.gl=c.gl,this._data=c._data,this.timeRange=c.timeRange,this.alignment=c.alignment,this._cachedMin=c._cachedMin,this._cachedMax=c._cachedMax,this.writePos=c.writePos,this._refCount=c._refCount,this._cachedLength=c._cachedLength;return}const S=Z(y),E=Array.isArray(y);if(e!=null)this.dataType=new g(e);else{if(y instanceof ArrayBuffer)throw new Error("cannot infer data type from an ArrayBuffer instance when constructing a Series. Please provide a data type.");if(E||S){let c=y;if(!S){if(y.length===0)throw new Error("cannot infer data type from a zero length JS array when constructing a Series. Please provide a data type.");c=y[0]}if(typeof c=="string")this.dataType=g.STRING;else if(typeof c=="number")this.dataType=g.FLOAT64;else if(typeof c=="bigint")this.dataType=g.INT64;else if(typeof c=="boolean")this.dataType=g.BOOLEAN;else if(c instanceof m||c instanceof Date||c instanceof m)this.dataType=g.TIMESTAMP;else if(typeof c=="object")this.dataType=g.JSON;else throw new Error(`cannot infer data type of ${typeof c} when constructing a Series from a JS array`)}else this.dataType=new g(y)}if(!E&&!S)this._data=y;else{let c=S?[y]:y;const U=c[0];(U instanceof m||U instanceof Date||U instanceof O)&&(c=c.map(v=>new m(v).valueOf())),this.dataType.equals(g.STRING)?(this._cachedLength=c.length,this._data=new TextEncoder().encode(`${c.join(`
|
|
2
|
-
`)}
|
|
3
|
-
`).buffer):this.dataType.equals(g.JSON)?(this._cachedLength=c.length,this._data=new TextEncoder().encode(`${c.map(v=>D.JSON_CODEC.encodeString(v)).join(`
|
|
4
|
-
`)}
|
|
5
|
-
`).buffer):this.dataType.usesBigInt&&typeof U=="number"?this._data=new this.dataType.Array(c.map(v=>BigInt(Math.round(v)))).buffer:!this.dataType.usesBigInt&&typeof U=="bigint"?this._data=new this.dataType.Array(c.map(v=>Number(v))).buffer:this._data=new this.dataType.Array(c).buffer}this.key=A,this.alignment=h,this.sampleOffset=i??0,this.timeRange=n??p.ZERO,this.gl={control:null,buffer:null,prevBuffer:0,bufferUsage:f}}static alloc({capacity:t,dataType:e,...n}){if(t===0)throw new Error("[Series] - cannot allocate an array of length 0");const i=new new g(e).Array(t),f=new N({data:i.buffer,dataType:e,...n});return f.writePos=0,f}static createTimestamps(t,e,n){const i=n.spanRange(e.span(t)),f=new BigInt64Array(t);for(let h=0;h<t;h++)f[h]=BigInt(n.add(e.span(h)).valueOf());return new N({data:f,dataType:g.TIMESTAMP,timeRange:i})}get refCount(){return this._refCount}static fromStrings(t,e){const n=new TextEncoder().encode(`${t.join(`
|
|
6
|
-
`)}
|
|
7
|
-
`);return new N({data:n,dataType:g.STRING,timeRange:e})}static fromJSON(t,e){const n=new TextEncoder().encode(`${t.map(i=>D.JSON_CODEC.encodeString(i)).join(`
|
|
8
|
-
`)}
|
|
9
|
-
`);return new N({data:n,dataType:g.JSON,timeRange:e})}acquire(t){this._refCount++,t!=null&&this.updateGLBuffer(t)}release(){if(this._refCount<=0){console.warn("attempted to release a series with a negative reference count");return}this._refCount--,this._refCount===0&&this.gl.control!=null&&this.maybeGarbageCollectGLBuffer(this.gl.control)}write(t){if(!t.dataType.equals(this.dataType))throw new Error("buffer must be of the same type as this array");return this.dataType.isVariable?this.writeVariable(t):this.writeFixed(t)}writeVariable(t){if(this.writePos===C)return 0;const e=this.byteCapacity.valueOf()-this.writePos,n=t.subBytes(0,e);return this.writeToUnderlyingData(n),this.writePos+=n.byteLength.valueOf(),this._cachedLength!=null&&(this._cachedLength+=n.length,this.calculateCachedLength()),n.length}writeFixed(t){if(this.writePos===C)return 0;const e=this.capacity-this.writePos,n=t.sub(0,e);return this.writeToUnderlyingData(n),this._cachedLength=void 0,this.maybeRecomputeMinMax(n),this.writePos+=n.length,n.length}writeToUnderlyingData(t){this.underlyingData.set(t.data,this.writePos)}get buffer(){return typeof this._data=="object"&&"buffer"in this._data?this._data.buffer:this._data}get underlyingData(){return new this.dataType.Array(this._data)}get data(){return this.writePos===C?this.underlyingData:new this.dataType.Array(this._data,0,this.writePos)}toStrings(){if(!this.dataType.matches(g.STRING,g.UUID))throw new Error("cannot convert non-string series to strings");return new TextDecoder().decode(this.underlyingData).split(`
|
|
10
|
-
`).slice(0,-1)}toUUIDs(){if(!this.dataType.equals(g.UUID))throw new Error("cannot convert non-uuid series to uuids");const t=g.UUID.density.valueOf(),e=Array(this.length);for(let n=0;n<this.length;n++){const i=this.underlyingData.slice(n*t,(n+1)*t),f=Array.from(new Uint8Array(i.buffer),h=>h.toString(16).padStart(2,"0")).join("").replace(/(.{8})(.{4})(.{4})(.{4})(.{12})/,"$1-$2-$3-$4-$5");e[n]=f}return e}parseJSON(t){if(!this.dataType.equals(g.JSON))throw new Error("cannot parse non-JSON series as JSON");return new TextDecoder().decode(this.underlyingData).split(`
|
|
11
|
-
`).slice(0,-1).map(e=>t.parse(D.JSON_CODEC.decodeString(e)))}get byteCapacity(){return new R(this.underlyingData.byteLength)}get capacity(){return this.dataType.isVariable?this.byteCapacity.valueOf():this.dataType.density.length(this.byteCapacity)}get byteLength(){return this.writePos===C?this.byteCapacity:this.dataType.isVariable?new R(this.writePos):this.dataType.density.size(this.writePos)}get length(){return this._cachedLength!=null?this._cachedLength:this.dataType.isVariable?this.calculateCachedLength():this.writePos===C?this.data.length:this.writePos}calculateCachedLength(){if(!this.dataType.isVariable)throw new Error("cannot calculate length of a non-variable length data type");let t=0;const e=[0];return this.data.forEach((n,i)=>{n===F&&(t++,e.push(i+1))}),this._cachedIndexes=e,this._cachedLength=t,t}convert(t,e=0){if(this.dataType.equals(t))return this;const n=new t.Array(this.length);for(let i=0;i<this.length;i++)n[i]=tt(this.dataType,t,this.data[i],e);return new N({data:n.buffer,dataType:t,timeRange:this.timeRange,sampleOffset:e,glBufferUsage:this.gl.bufferUsage,alignment:this.alignment})}calcRawMax(){if(this.length===0)return-1/0;if(this.dataType.equals(g.TIMESTAMP))this._cachedMax=this.data[this.data.length-1];else if(this.dataType.usesBigInt){const t=this.data;this._cachedMax=t.reduce((e,n)=>e>n?e:n)}else{const t=this.data;this._cachedMax=t.reduce((e,n)=>e>n?e:n)}return this._cachedMax}get max(){if(this.dataType.isVariable)throw new Error("cannot calculate maximum on a variable length data type");return this.writePos===0?-1/0:(this._cachedMax??(this._cachedMax=this.calcRawMax()),x(this._cachedMax,this.sampleOffset))}calcRawMin(){if(this.length===0)return 1/0;if(this.dataType.equals(g.TIMESTAMP))this._cachedMin=this.data[0];else if(this.dataType.usesBigInt){const t=this.data;this._cachedMin=t.reduce((e,n)=>e<n?e:n)}else{const t=this.data;this._cachedMin=t.reduce((e,n)=>e<n?e:n)}return this._cachedMin}get min(){if(this.dataType.isVariable)throw new Error("cannot calculate minimum on a variable length data type");return this.writePos===0?1/0:(this._cachedMin??(this._cachedMin=this.calcRawMin()),x(this._cachedMin,this.sampleOffset))}get bounds(){return b.construct(Number(this.min),Number(this.max))}maybeRecomputeMinMax(t){if(this._cachedMin!=null){const e=t._cachedMin??t.calcRawMin();e<this._cachedMin&&(this._cachedMin=e)}if(this._cachedMax!=null){const e=t._cachedMax??t.calcRawMax();e>this._cachedMax&&(this._cachedMax=e)}}enrich(){this.max,this.min}get range(){return x(this.max,-this.min)}atAlignment(t,e){const n=Number(t-this.alignment);if(n<0||n>=this.length){if(e===!0)throw new Error(`[series] - no value at index ${n}`);return}return this.at(n,e)}at(t,e){if(this.dataType.isVariable)return this.atVariable(t,e??!1);t<0&&(t=this.length+t);const n=this.data[t];if(n==null){if(e===!0)throw new Error(`[series] - no value at index ${t}`);return}return x(n,this.sampleOffset)}atVariable(t,e){let n=0,i=0;if(this._cachedIndexes!=null)n=this._cachedIndexes[t],i=this._cachedIndexes[t+1]-1;else{t<0&&(t=this.length+t);for(let h=0;h<this.data.length;h++)if(this.data[h]===F){if(t===0){i=h;break}n=h+1,t--}if(i===0&&(i=this.data.length),n>=i||t>0){if(e)throw new Error(`[series] - no value at index ${t}`);return}}const f=this.data.slice(n,i);return this.dataType.equals(g.STRING)?new TextDecoder().decode(f):it.snakeToCamel(JSON.parse(new TextDecoder().decode(f)))}binarySearch(t){let e=0,n=this.length-1;const i=at.newF(t);for(;e<=n;){const f=Math.floor((e+n)/2),h=i(this.at(f,!0),t);if(h===0)return f;h<0?e=f+1:n=f-1}return e}updateGLBuffer(t){if(this.gl.control=t,!this.dataType.equals(g.FLOAT32)&&!this.dataType.equals(g.UINT8))throw new Error("Only FLOAT32 and UINT8 arrays can be used in WebGL");const{buffer:e,bufferUsage:n,prevBuffer:i}=this.gl;if(e==null&&(this.gl.buffer=t.createBuffer()),this.writePos!==i)if(t.bindBuffer(t.ARRAY_BUFFER,this.gl.buffer),this.writePos!==C){i===0&&t.bufferData(t.ARRAY_BUFFER,this.byteCapacity.valueOf(),t.STATIC_DRAW);const f=this.dataType.density.size(i).valueOf(),h=this.underlyingData.slice(this.gl.prevBuffer,this.writePos);t.bufferSubData(t.ARRAY_BUFFER,f,h.buffer),this.gl.prevBuffer=this.writePos}else t.bufferData(t.ARRAY_BUFFER,this.buffer,n==="static"?t.STATIC_DRAW:t.DYNAMIC_DRAW),this.gl.prevBuffer=C}as(t){return nt(t,this.dataType),this}get digest(){var t;return{key:this.key,dataType:this.dataType.toString(),sampleOffset:this.sampleOffset,alignment:{lower:G(this.alignmentBounds.lower),upper:G(this.alignmentBounds.upper)},timeRange:(t=this.timeRange)==null?void 0:t.toString(),length:this.length,capacity:this.capacity}}get memInfo(){return{key:this.key,length:this.length,byteLength:this.byteLength,glBuffer:this.gl.buffer!=null}}get alignmentBounds(){return b.construct(this.alignment,this.alignment+BigInt(this.length))}maybeGarbageCollectGLBuffer(t){this.gl.buffer!=null&&(t.deleteBuffer(this.gl.buffer),this.gl.buffer=null,this.gl.prevBuffer=0,this.gl.control=null)}get glBuffer(){if(this.gl.buffer==null)throw new Error("gl buffer not initialized");return this.gl.prevBuffer!==this.writePos&&console.warn("buffer not updated"),this.gl.buffer}[Symbol.iterator](){if(this.dataType.isVariable){const t=new Ot(this);return this.dataType.equals(g.JSON)?new Y(t):t}return new yt(this)}slice(t,e){return this.sliceSub(!1,t,e)}sub(t,e){return this.sliceSub(!0,t,e)}subIterator(t,e){return new k(this,t,e??this.length)}subAlignmentIterator(t,e){return new k(this,Number(t-this.alignment),Number(e-this.alignment))}subBytes(t,e){if(t>=0&&(e==null||e>=this.byteLength.valueOf()))return this;const n=this.data.subarray(t,e);return new N({data:n,dataType:this.dataType,timeRange:this.timeRange,sampleOffset:this.sampleOffset,glBufferUsage:this.gl.bufferUsage,alignment:this.alignment+BigInt(t)})}sliceSub(t,e,n){if(e<=0&&(n==null||n>=this.length))return this;let i;return t?i=this.data.subarray(e,n):i=this.data.slice(e,n),new N({data:i,dataType:this.dataType,timeRange:this.timeRange,sampleOffset:this.sampleOffset,glBufferUsage:this.gl.bufferUsage,alignment:this.alignment+BigInt(e)})}reAlign(t){return new N({data:this.buffer,dataType:this.dataType,timeRange:p.ZERO,sampleOffset:this.sampleOffset,glBufferUsage:"static",alignment:t})}toString(){var e,n;let t=`${this.dataType.toString()} ${this.length} [`;if(this.length<=10)t+=Array.from(this).map(i=>i.toString());else{for(let i=0;i<5;i++)t+=`${(e=this.at(i))==null?void 0:e.toString()}`,i<4&&(t+=",");t+="...";for(let i=-5;i<0;i++)t+=(n=this.at(i))==null?void 0:n.toString(),i<-1&&(t+=",")}return t+="]",t}};s(N,"crudeZ",l.z.object({timeRange:p.z.optional(),dataType:g.z,alignment:l.z.coerce.bigint().optional(),data:l.z.union([gt,mt,l.z.instanceof(ArrayBuffer),l.z.instanceof(Uint8Array)]),glBufferUsage:ft.optional().default("static").optional()})),s(N,"z",N.crudeZ.transform(t=>new N(t)));let z=N;class k{constructor(t,e,n){s(this,"series");s(this,"end");s(this,"index");this.series=t;const i=b.construct(0,t.length);this.end=b.clamp(i,n),this.index=b.clamp(i,e)}next(){return this.index>=this.end?{done:!0,value:void 0}:{done:!1,value:this.series.at(this.index++,!0)}}[Symbol.iterator](){return this}}class Ot{constructor(t){s(this,"series");s(this,"index");s(this,"decoder");if(!t.dataType.isVariable)throw new Error("cannot create a variable series iterator for a non-variable series");this.series=t,this.index=0,this.decoder=new TextDecoder}next(){const t=this.index,e=this.series.data;for(;this.index<e.length&&e[this.index]!==F;)this.index++;const n=this.index;return t===n?{done:!0,value:void 0}:(this.index++,{done:!1,value:this.decoder.decode(this.series.buffer.slice(t,n))})}[Symbol.iterator](){return this}}var J,W;const q=class q{constructor(t){s(this,"wrapped");s(this,J,"JSONSeriesIterator");this.wrapped=t}next(){const t=this.wrapped.next();return t.done===!0?{done:!0,value:void 0}:{done:!1,value:D.JSON_CODEC.decodeString(t.value,q.SCHEMA)}}[(W=Symbol.iterator,J=Symbol.toStringTag,W)](){return this}};s(q,"SCHEMA",l.z.record(l.z.string(),l.z.unknown()));let Y=q;var H,j;class yt{constructor(t){s(this,"series");s(this,"index");s(this,H,"SeriesIterator");this.series=t,this.index=0}next(){return this.index>=this.series.length?{done:!0,value:void 0}:{done:!1,value:this.series.at(this.index++,!0)}}[(j=Symbol.iterator,H=Symbol.toStringTag,j)](){return this}}class bt{constructor(t=[]){s(this,"series");if(t.length!==0){const e=t[0].dataType;for(let n=1;n<t.length;n++)if(!t[n].dataType.equals(e))throw new Error("[multi-series] - series must have the same data type")}this.series=t}as(t){return nt(t,this.dataType),this}get dataType(){return this.series.length===0?g.UNKNOWN:this.series[0].dataType}get timeRange(){return this.series.length===0?p.ZERO:new p(this.series[0].timeRange.start,this.series[this.series.length-1].timeRange.end)}get alignment(){return this.series.length===0?0n:this.series[0].alignment}get alignmentBounds(){return this.series.length===0?b.construct(0n,0n):b.construct(this.series[0].alignmentBounds.lower,this.series[this.series.length-1].alignmentBounds.upper)}push(t){"isSynnaxSeries"in t&&t.isSynnaxSeries?this.series.push(t):this.series.push(...t.series)}get length(){return this.series.reduce((t,e)=>t+e.length,0)}atAlignment(t,e){if(this.series.length===0){if(e)throw new Error(`[series] - no value at alignment ${t}`);return}for(const n of this.series)if(b.contains(n.alignmentBounds,t))return n.atAlignment(t,e);if(e)throw new Error(`[series] - no value at alignment ${t}`)}at(t,e=!1){t<0&&(t=this.length+t);for(const n of this.series){if(t<n.length)return n.at(t,e);t-=n.length}if(e)throw new Error(`[series] - no value at index ${t}`)}subIterator(t,e){return new $(this,t,e??this.length)}subAlignmentIterator(t,e){if(t>=this.alignmentBounds.upper||e<=this.alignmentBounds.lower)return P;let n=0;for(let f=0;f<this.series.length;f++){const h=this.series[f];if(t<h.alignment)break;if(t>=h.alignmentBounds.upper)n+=h.length;else if(b.contains(h.alignmentBounds,t)){n+=Number(t-h.alignment);break}}let i=0;for(let f=0;f<this.series.length;f++){const h=this.series[f];if(e<h.alignment)break;if(e>=h.alignmentBounds.upper)i+=h.length;else if(b.contains(h.alignmentBounds,e)){i+=Number(e-h.alignment);break}}return new $(this,n,i)}subAlignmentSpanIterator(t,e){if(t>=this.alignmentBounds.upper)return P;let n=0;for(let i=0;i<this.series.length;i++){const f=this.series[i];if(t<f.alignment)break;if(t>=f.alignmentBounds.upper)n+=f.length;else if(b.contains(f.alignmentBounds,t)){n+=Number(t-f.alignment);break}}return new $(this,n,n+e)}updateGLBuffer(t){this.series.forEach(e=>e.updateGLBuffer(t))}get bounds(){return b.max(this.series.map(t=>t.bounds))}get byteLength(){return new R(this.series.reduce((t,e)=>t+e.byteLength.valueOf(),0))}get data(){const t=new this.dataType.Array(this.length);let e=0;for(const n of this.series)t.set(n.data,e),e+=n.length;return new this.dataType.Array(t.buffer)}traverseAlignment(t,e){const n=this.series.map(i=>i.alignmentBounds);return b.traverse(n,t,e)}acquire(){this.series.forEach(t=>t.acquire())}release(){this.series.forEach(t=>t.release())}distance(t,e){const n=this.series.map(i=>i.alignmentBounds);return b.distance(n,t,e)}parseJSON(t){if(!this.dataType.equals(g.JSON))throw new Error("cannot parse non-JSON series as JSON");return this.series.flatMap(e=>e.parseJSON(t))}[Symbol.iterator](){return this.series.length===0?{next(){return{done:!0,value:void 0}}}:new wt(this.series)}}var K,X;class wt{constructor(t){s(this,"series");s(this,"seriesIndex");s(this,"internal");s(this,K,"MultiSeriesIterator");this.series=t,this.seriesIndex=0,this.internal=t[0][Symbol.iterator]()}next(){const t=this.internal.next();return t.done===!1?t:this.seriesIndex===this.series.length-1?{done:!0,value:void 0}:(this.internal=this.series[++this.seriesIndex][Symbol.iterator](),this.next())}[(X=Symbol.iterator,K=Symbol.toStringTag,X)](){return this}}class ${constructor(t,e,n){s(this,"series");s(this,"index");s(this,"end");this.series=t,this.end=n,this.index=e}next(){return this.index>=this.end?{done:!0,value:void 0}:{done:!1,value:this.series.at(this.index++,!0)}}[Symbol.iterator](){return this}}const G=o=>{const t=o>>32n,e=o&0xffffffffn;return{domain:t,sample:e}};exports.DataType=g;exports.Density=T;exports.MultiSeries=bt;exports.Rate=L;exports.Series=z;exports.Size=R;exports.TimeRange=p;exports.TimeSpan=O;exports.TimeStamp=m;exports.addSamples=x;exports.convertDataType=tt;exports.id=ct;exports.isCrudeSeries=et;exports.isTelemValue=Z;exports.sortTimeRange=ht;exports.typedArrayZ=dt;
|
|
@@ -1,6 +0,0 @@
|
|
|
1
|
-
import { Color } from './color';
|
|
2
|
-
export type ReplaceColorWithHex<T> = T extends Color ? string : T extends Array<infer U> ? Array<ReplaceColorWithHex<U>> : T extends object ? {
|
|
3
|
-
[K in keyof T]: ReplaceColorWithHex<T[K]>;
|
|
4
|
-
} : T;
|
|
5
|
-
export declare const transformColorsToHex: <T>(obj: T) => ReplaceColorWithHex<T>;
|
|
6
|
-
//# sourceMappingURL=transformColorsToHex.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"transformColorsToHex.d.ts","sourceRoot":"","sources":["../../../src/color/transformColorsToHex.ts"],"names":[],"mappings":"AASA,OAAO,EAAE,KAAK,KAAK,EAAe,MAAM,eAAe,CAAC;AAExD,MAAM,MAAM,mBAAmB,CAAC,CAAC,IAAI,CAAC,SAAS,KAAK,GAChD,MAAM,GACN,CAAC,SAAS,KAAK,CAAC,MAAM,CAAC,CAAC,GACtB,KAAK,CAAC,mBAAmB,CAAC,CAAC,CAAC,CAAC,GAC7B,CAAC,SAAS,MAAM,GACd;KAAG,CAAC,IAAI,MAAM,CAAC,GAAG,mBAAmB,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;CAAE,GAC7C,CAAC,CAAC;AAEV,eAAO,MAAM,oBAAoB,GAAI,CAAC,EAAE,KAAK,CAAC,KAAG,mBAAmB,CAAC,CAAC,CAUrE,CAAC"}
|
package/dist/src/primitive.d.ts
DELETED
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
import { Key } from './record';
|
|
2
|
-
export type Primitive = string | number | bigint | boolean | Stringer | null | undefined;
|
|
3
|
-
export interface Stringer {
|
|
4
|
-
toString: () => string;
|
|
5
|
-
}
|
|
6
|
-
export declare const isStringer: (value: unknown) => boolean;
|
|
7
|
-
export type PrimitiveRecord = Record<Key, Primitive>;
|
|
8
|
-
export declare const primitiveIsZero: <V extends Primitive>(value: V) => boolean;
|
|
9
|
-
//# sourceMappingURL=primitive.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"primitive.d.ts","sourceRoot":"","sources":["../../src/primitive.ts"],"names":[],"mappings":"AASA,OAAO,EAAE,KAAK,GAAG,EAAE,MAAM,UAAU,CAAC;AAEpC,MAAM,MAAM,SAAS,GACjB,MAAM,GACN,MAAM,GACN,MAAM,GACN,OAAO,GACP,QAAQ,GACR,IAAI,GACJ,SAAS,CAAC;AAEd,MAAM,WAAW,QAAQ;IACvB,QAAQ,EAAE,MAAM,MAAM,CAAC;CACxB;AAED,eAAO,MAAM,UAAU,GAAI,OAAO,OAAO,KAAG,OACuB,CAAC;AAEpE,MAAM,MAAM,eAAe,GAAG,MAAM,CAAC,GAAG,EAAE,SAAS,CAAC,CAAC;AAErD,eAAO,MAAM,eAAe,GAAI,CAAC,SAAS,SAAS,EAAE,OAAO,CAAC,KAAG,OAgB/D,CAAC"}
|
package/dist/src/record.d.ts
DELETED
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
import { z } from 'zod';
|
|
2
|
-
export type Key = string | number;
|
|
3
|
-
export type UnknownRecord = Record<Key, unknown>;
|
|
4
|
-
export type UnknownStringRecord = Record<string, unknown>;
|
|
5
|
-
export interface Keyed<K extends Key> {
|
|
6
|
-
key: K;
|
|
7
|
-
}
|
|
8
|
-
export interface KeyedNamed<K extends Key = string> {
|
|
9
|
-
key: K;
|
|
10
|
-
name: string;
|
|
11
|
-
}
|
|
12
|
-
export declare const unknownRecordZ: z.ZodRecord<z.ZodUnion<readonly [z.ZodNumber, z.ZodString, z.ZodSymbol]>, z.ZodUnknown>;
|
|
13
|
-
export type Entries<T> = Array<{
|
|
14
|
-
[K in keyof T]: [K, T[K]];
|
|
15
|
-
}[keyof T]>;
|
|
16
|
-
export declare const getEntries: <T extends Record<Key, unknown>>(obj: T) => Entries<T>;
|
|
17
|
-
export declare const mapValues: <T extends Record<Key, unknown>, U>(obj: T, fn: (value: T[keyof T], key: Key) => U) => Record<Key, U>;
|
|
18
|
-
//# sourceMappingURL=record.d.ts.map
|
package/dist/src/record.d.ts.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"record.d.ts","sourceRoot":"","sources":["../../src/record.ts"],"names":[],"mappings":"AASA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB,MAAM,MAAM,GAAG,GAAG,MAAM,GAAG,MAAM,CAAC;AAElC,MAAM,MAAM,aAAa,GAAG,MAAM,CAAC,GAAG,EAAE,OAAO,CAAC,CAAC;AAEjD,MAAM,MAAM,mBAAmB,GAAG,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;AAE1D,MAAM,WAAW,KAAK,CAAC,CAAC,SAAS,GAAG;IAClC,GAAG,EAAE,CAAC,CAAC;CACR;AAED,MAAM,WAAW,UAAU,CAAC,CAAC,SAAS,GAAG,GAAG,MAAM;IAChD,GAAG,EAAE,CAAC,CAAC;IACP,IAAI,EAAE,MAAM,CAAC;CACd;AAED,eAAO,MAAM,cAAc,yFAG1B,CAAC;AAEF,MAAM,MAAM,OAAO,CAAC,CAAC,IAAI,KAAK,CAC5B;KACG,CAAC,IAAI,MAAM,CAAC,GAAG,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC,CAAC;CAC1B,CAAC,MAAM,CAAC,CAAC,CACX,CAAC;AAEF,eAAO,MAAM,UAAU,GAAI,CAAC,SAAS,MAAM,CAAC,GAAG,EAAE,OAAO,CAAC,EAAE,KAAK,CAAC,KAAG,OAAO,CAAC,CAAC,CAC1C,CAAC;AAEpC,eAAO,MAAM,SAAS,GAAI,CAAC,SAAS,MAAM,CAAC,GAAG,EAAE,OAAO,CAAC,EAAE,CAAC,EACzD,KAAK,CAAC,EACN,IAAI,CAAC,KAAK,EAAE,CAAC,CAAC,MAAM,CAAC,CAAC,EAAE,GAAG,EAAE,GAAG,KAAK,CAAC,KACrC,MAAM,CAAC,GAAG,EAAE,CAAC,CAGb,CAAC"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"record.spec.d.ts","sourceRoot":"","sources":["../../src/record.spec.ts"],"names":[],"mappings":""}
|
package/dist/src/search.d.ts
DELETED
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
import { CompareF } from './compare/compare';
|
|
2
|
-
import { Key, Keyed } from './record';
|
|
3
|
-
export declare const Search: {
|
|
4
|
-
binary: <T>(arr: T[], target: T, compare: CompareF<T>) => number;
|
|
5
|
-
};
|
|
6
|
-
export interface TermSearcher<T, K extends Key, E extends Keyed<K>> {
|
|
7
|
-
readonly type: string;
|
|
8
|
-
search: (term: T) => E[];
|
|
9
|
-
retrieve: (keys: K[]) => E[];
|
|
10
|
-
page: (offset: number, limit: number) => E[];
|
|
11
|
-
}
|
|
12
|
-
export interface AsyncTermSearcher<T, K extends Key, E extends Keyed<K>> {
|
|
13
|
-
readonly type: string;
|
|
14
|
-
search: (term: T) => Promise<E[]>;
|
|
15
|
-
retrieve: (keys: K[]) => Promise<E[]>;
|
|
16
|
-
page: (offset: number, limit: number) => Promise<E[]>;
|
|
17
|
-
}
|
|
18
|
-
//# sourceMappingURL=search.d.ts.map
|
package/dist/src/search.d.ts.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"search.d.ts","sourceRoot":"","sources":["../../src/search.ts"],"names":[],"mappings":"AASA,OAAO,EAAE,KAAK,QAAQ,EAAE,MAAM,mBAAmB,CAAC;AAClD,OAAO,EAAE,KAAK,GAAG,EAAE,KAAK,KAAK,EAAE,MAAM,UAAU,CAAC;AAehD,eAAO,MAAM,MAAM;aAbH,CAAC,OAAO,CAAC,EAAE,UAAU,CAAC,WAAW,QAAQ,CAAC,CAAC,CAAC,KAAG,MAAM;CAepE,CAAC;AAEF,MAAM,WAAW,YAAY,CAAC,CAAC,EAAE,CAAC,SAAS,GAAG,EAAE,CAAC,SAAS,KAAK,CAAC,CAAC,CAAC;IAChE,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IACtB,MAAM,EAAE,CAAC,IAAI,EAAE,CAAC,KAAK,CAAC,EAAE,CAAC;IACzB,QAAQ,EAAE,CAAC,IAAI,EAAE,CAAC,EAAE,KAAK,CAAC,EAAE,CAAC;IAC7B,IAAI,EAAE,CAAC,MAAM,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,KAAK,CAAC,EAAE,CAAC;CAC9C;AAED,MAAM,WAAW,iBAAiB,CAAC,CAAC,EAAE,CAAC,SAAS,GAAG,EAAE,CAAC,SAAS,KAAK,CAAC,CAAC,CAAC;IACrE,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IACtB,MAAM,EAAE,CAAC,IAAI,EAAE,CAAC,KAAK,OAAO,CAAC,CAAC,EAAE,CAAC,CAAC;IAClC,QAAQ,EAAE,CAAC,IAAI,EAAE,CAAC,EAAE,KAAK,OAAO,CAAC,CAAC,EAAE,CAAC,CAAC;IACtC,IAAI,EAAE,CAAC,MAAM,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,KAAK,OAAO,CAAC,CAAC,EAAE,CAAC,CAAC;CACvD"}
|
package/dist/src/toArray.d.ts
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"toArray.d.ts","sourceRoot":"","sources":["../../src/toArray.ts"],"names":[],"mappings":"AASA,eAAO,MAAM,OAAO,GAAI,CAAC,EAAE,OAAO,CAAC,GAAG,CAAC,EAAE,KAAG,CAAC,EACL,CAAC;AAEzC,eAAO,MAAM,SAAS,GAAI,CAAC,EAAE,OAAO,CAAC,GAAG,CAAC,EAAE,GAAG,IAAI,GAAG,SAAS,KAAG,CAAC,EACL,CAAC"}
|
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
import { z } from 'zod';
|
|
2
|
-
export declare const int8: z.ZodNumber;
|
|
3
|
-
export declare const int16: z.ZodNumber;
|
|
4
|
-
export declare const int32: z.ZodNumber;
|
|
5
|
-
export declare const int64: z.ZodBigInt;
|
|
6
|
-
export declare const uint8: z.ZodNumber;
|
|
7
|
-
export declare const uint16: z.ZodNumber;
|
|
8
|
-
export declare const uint32: z.ZodNumber;
|
|
9
|
-
export declare const uint64: z.ZodBigInt;
|
|
10
|
-
//# sourceMappingURL=integer.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"integer.d.ts","sourceRoot":"","sources":["../../../src/zod/integer.ts"],"names":[],"mappings":"AASA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAIxB,eAAO,MAAM,IAAI,aAA+C,CAAC;AAIjE,eAAO,MAAM,KAAK,aAAiD,CAAC;AAIpE,eAAO,MAAM,KAAK,aAAiD,CAAC;AAIpE,eAAO,MAAM,KAAK,aAA2C,CAAC;AAG9D,eAAO,MAAM,KAAK,aAAyC,CAAC;AAG5D,eAAO,MAAM,MAAM,aAA0C,CAAC;AAG9D,eAAO,MAAM,MAAM,aAA0C,CAAC;AAG9D,eAAO,MAAM,MAAM,aAAqC,CAAC"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"integer.spec.d.ts","sourceRoot":"","sources":["../../../src/zod/integer.spec.ts"],"names":[],"mappings":""}
|
package/dist/toArray.cjs
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const o=r=>Array.isArray(r)?r:[r],t=r=>Array.isArray(r)?r:r==null?[]:[r];exports.nullToArr=t;exports.toArray=o;
|
package/dist/toArray.js
DELETED
|
@@ -1,30 +0,0 @@
|
|
|
1
|
-
// Copyright 2025 Synnax Labs, Inc.
|
|
2
|
-
//
|
|
3
|
-
// Use of this software is governed by the Business Source License included in the file
|
|
4
|
-
// licenses/BSL.txt.
|
|
5
|
-
//
|
|
6
|
-
// As of the Change Date specified in that file, in accordance with the Business Source
|
|
7
|
-
// License, use of this software will be governed by the Apache License, Version 2.0,
|
|
8
|
-
// included in the file licenses/APL.txt.
|
|
9
|
-
|
|
10
|
-
import { type Color, colorZ, hex } from "@/color/color";
|
|
11
|
-
|
|
12
|
-
export type ReplaceColorWithHex<T> = T extends Color
|
|
13
|
-
? string
|
|
14
|
-
: T extends Array<infer U>
|
|
15
|
-
? Array<ReplaceColorWithHex<U>>
|
|
16
|
-
: T extends object
|
|
17
|
-
? { [K in keyof T]: ReplaceColorWithHex<T[K]> }
|
|
18
|
-
: T;
|
|
19
|
-
|
|
20
|
-
export const transformColorsToHex = <T>(obj: T): ReplaceColorWithHex<T> => {
|
|
21
|
-
const parsed = colorZ.safeParse(obj);
|
|
22
|
-
if (parsed.success) return hex(parsed.data) as ReplaceColorWithHex<T>;
|
|
23
|
-
if (typeof obj === "object" && obj != null) {
|
|
24
|
-
const newObj: any = Array.isArray(obj) ? [] : {};
|
|
25
|
-
for (const key of Object.keys(obj))
|
|
26
|
-
newObj[key] = transformColorsToHex((obj as any)[key]);
|
|
27
|
-
return newObj as ReplaceColorWithHex<T>;
|
|
28
|
-
}
|
|
29
|
-
return obj as ReplaceColorWithHex<T>;
|
|
30
|
-
};
|
package/src/primitive.ts
DELETED
|
@@ -1,46 +0,0 @@
|
|
|
1
|
-
// Copyright 2025 Synnax Labs, Inc.
|
|
2
|
-
//
|
|
3
|
-
// Use of this software is governed by the Business Source License included in the file
|
|
4
|
-
// licenses/BSL.txt.
|
|
5
|
-
//
|
|
6
|
-
// As of the Change Date specified in that file, in accordance with the Business Source
|
|
7
|
-
// License, use of this software will be governed by the Apache License, Version 2.0,
|
|
8
|
-
// included in the file licenses/APL.txt.
|
|
9
|
-
|
|
10
|
-
import { type Key } from "@/record";
|
|
11
|
-
|
|
12
|
-
export type Primitive =
|
|
13
|
-
| string
|
|
14
|
-
| number
|
|
15
|
-
| bigint
|
|
16
|
-
| boolean
|
|
17
|
-
| Stringer
|
|
18
|
-
| null
|
|
19
|
-
| undefined;
|
|
20
|
-
|
|
21
|
-
export interface Stringer {
|
|
22
|
-
toString: () => string;
|
|
23
|
-
}
|
|
24
|
-
|
|
25
|
-
export const isStringer = (value: unknown): boolean =>
|
|
26
|
-
value != null && typeof value === "object" && "toString" in value;
|
|
27
|
-
|
|
28
|
-
export type PrimitiveRecord = Record<Key, Primitive>;
|
|
29
|
-
|
|
30
|
-
export const primitiveIsZero = <V extends Primitive>(value: V): boolean => {
|
|
31
|
-
if (isStringer(value)) return value?.toString().length === 0;
|
|
32
|
-
switch (typeof value) {
|
|
33
|
-
case "string":
|
|
34
|
-
return value.length === 0;
|
|
35
|
-
case "number":
|
|
36
|
-
return value === 0;
|
|
37
|
-
case "bigint":
|
|
38
|
-
return value === 0n;
|
|
39
|
-
case "boolean":
|
|
40
|
-
return !value;
|
|
41
|
-
case "undefined":
|
|
42
|
-
return true;
|
|
43
|
-
case "object":
|
|
44
|
-
return true;
|
|
45
|
-
}
|
|
46
|
-
};
|
package/src/record.spec.ts
DELETED
|
@@ -1,38 +0,0 @@
|
|
|
1
|
-
// Copyright 2025 Synnax Labs, Inc.
|
|
2
|
-
//
|
|
3
|
-
// Use of this software is governed by the Business Source License included in the file
|
|
4
|
-
// licenses/BSL.txt.
|
|
5
|
-
//
|
|
6
|
-
// As of the Change Date specified in that file, in accordance with the Business Source
|
|
7
|
-
// License, use of this software will be governed by the Apache License, Version 2.0,
|
|
8
|
-
// included in the file licenses/APL.txt.
|
|
9
|
-
|
|
10
|
-
import { describe, expect, it } from "vitest";
|
|
11
|
-
|
|
12
|
-
import { mapValues } from "@/record";
|
|
13
|
-
|
|
14
|
-
describe("mapValues", () => {
|
|
15
|
-
it("should map values of a record using the provided function", () => {
|
|
16
|
-
const input = { a: 1, b: 2, c: 3 };
|
|
17
|
-
const result = mapValues(input, (x) => x * 2);
|
|
18
|
-
expect(result).toEqual({ a: 2, b: 4, c: 6 });
|
|
19
|
-
});
|
|
20
|
-
|
|
21
|
-
it("should handle empty objects", () => {
|
|
22
|
-
const input = {};
|
|
23
|
-
const result = mapValues(input, (x) => x * 2);
|
|
24
|
-
expect(result).toEqual({});
|
|
25
|
-
});
|
|
26
|
-
|
|
27
|
-
it("should handle different value types", () => {
|
|
28
|
-
const input = { name: "John", age: 30 };
|
|
29
|
-
const result = mapValues(input, (value) => String(value));
|
|
30
|
-
expect(result).toEqual({ name: "John", age: "30" });
|
|
31
|
-
});
|
|
32
|
-
|
|
33
|
-
it("should preserve keys while transforming values", () => {
|
|
34
|
-
const input = { x: "hello", y: "world" };
|
|
35
|
-
const result = mapValues(input, (str) => str.toUpperCase());
|
|
36
|
-
expect(result).toEqual({ x: "HELLO", y: "WORLD" });
|
|
37
|
-
});
|
|
38
|
-
});
|
package/src/record.ts
DELETED
|
@@ -1,47 +0,0 @@
|
|
|
1
|
-
// Copyright 2025 Synnax Labs, Inc.
|
|
2
|
-
//
|
|
3
|
-
// Use of this software is governed by the Business Source License included in the file
|
|
4
|
-
// licenses/BSL.txt.
|
|
5
|
-
//
|
|
6
|
-
// As of the Change Date specified in that file, in accordance with the Business Source
|
|
7
|
-
// License, use of this software will be governed by the Apache License, Version 2.0,
|
|
8
|
-
// included in the file licenses/APL.txt.
|
|
9
|
-
|
|
10
|
-
import { z } from "zod";
|
|
11
|
-
|
|
12
|
-
export type Key = string | number;
|
|
13
|
-
|
|
14
|
-
export type UnknownRecord = Record<Key, unknown>;
|
|
15
|
-
|
|
16
|
-
export type UnknownStringRecord = Record<string, unknown>;
|
|
17
|
-
|
|
18
|
-
export interface Keyed<K extends Key> {
|
|
19
|
-
key: K;
|
|
20
|
-
}
|
|
21
|
-
|
|
22
|
-
export interface KeyedNamed<K extends Key = string> {
|
|
23
|
-
key: K;
|
|
24
|
-
name: string;
|
|
25
|
-
}
|
|
26
|
-
|
|
27
|
-
export const unknownRecordZ = z.record(
|
|
28
|
-
z.union([z.number(), z.string(), z.symbol()]),
|
|
29
|
-
z.unknown(),
|
|
30
|
-
);
|
|
31
|
-
|
|
32
|
-
export type Entries<T> = Array<
|
|
33
|
-
{
|
|
34
|
-
[K in keyof T]: [K, T[K]];
|
|
35
|
-
}[keyof T]
|
|
36
|
-
>;
|
|
37
|
-
|
|
38
|
-
export const getEntries = <T extends Record<Key, unknown>>(obj: T): Entries<T> =>
|
|
39
|
-
Object.entries(obj) as Entries<T>;
|
|
40
|
-
|
|
41
|
-
export const mapValues = <T extends Record<Key, unknown>, U>(
|
|
42
|
-
obj: T,
|
|
43
|
-
fn: (value: T[keyof T], key: Key) => U,
|
|
44
|
-
): Record<Key, U> =>
|
|
45
|
-
Object.fromEntries(
|
|
46
|
-
getEntries(obj).map(([key, value]) => [key, fn(value, key as Key)]),
|
|
47
|
-
);
|
package/src/search.ts
DELETED
|
@@ -1,42 +0,0 @@
|
|
|
1
|
-
// Copyright 2025 Synnax Labs, Inc.
|
|
2
|
-
//
|
|
3
|
-
// Use of this software is governed by the Business Source License included in the file
|
|
4
|
-
// licenses/BSL.txt.
|
|
5
|
-
//
|
|
6
|
-
// As of the Change Date specified in that file, in accordance with the Business Source
|
|
7
|
-
// License, use of this software will be governed by the Apache License, Version 2.0,
|
|
8
|
-
// included in the file licenses/APL.txt.
|
|
9
|
-
|
|
10
|
-
import { type CompareF } from "@/compare/compare";
|
|
11
|
-
import { type Key, type Keyed } from "@/record";
|
|
12
|
-
|
|
13
|
-
const binary = <T>(arr: T[], target: T, compare: CompareF<T>): number => {
|
|
14
|
-
let left = 0;
|
|
15
|
-
let right = arr.length - 1;
|
|
16
|
-
while (left <= right) {
|
|
17
|
-
const mid = Math.floor((left + right) / 2);
|
|
18
|
-
const cmp = compare(arr[mid], target);
|
|
19
|
-
if (cmp === 0) return mid;
|
|
20
|
-
if (cmp < 0) left = mid + 1;
|
|
21
|
-
else right = mid - 1;
|
|
22
|
-
}
|
|
23
|
-
return -1;
|
|
24
|
-
};
|
|
25
|
-
|
|
26
|
-
export const Search = {
|
|
27
|
-
binary,
|
|
28
|
-
};
|
|
29
|
-
|
|
30
|
-
export interface TermSearcher<T, K extends Key, E extends Keyed<K>> {
|
|
31
|
-
readonly type: string;
|
|
32
|
-
search: (term: T) => E[];
|
|
33
|
-
retrieve: (keys: K[]) => E[];
|
|
34
|
-
page: (offset: number, limit: number) => E[];
|
|
35
|
-
}
|
|
36
|
-
|
|
37
|
-
export interface AsyncTermSearcher<T, K extends Key, E extends Keyed<K>> {
|
|
38
|
-
readonly type: string;
|
|
39
|
-
search: (term: T) => Promise<E[]>;
|
|
40
|
-
retrieve: (keys: K[]) => Promise<E[]>;
|
|
41
|
-
page: (offset: number, limit: number) => Promise<E[]>;
|
|
42
|
-
}
|
package/src/zod/integer.spec.ts
DELETED
|
@@ -1,148 +0,0 @@
|
|
|
1
|
-
// Copyright 2025 Synnax Labs, Inc.
|
|
2
|
-
//
|
|
3
|
-
// Use of this software is governed by the Business Source License included in the file
|
|
4
|
-
// licenses/BSL.txt.
|
|
5
|
-
//
|
|
6
|
-
// As of the Change Date specified in that file, in accordance with the Business Source
|
|
7
|
-
// License, use of this software will be governed by the Apache License, Version 2.0,
|
|
8
|
-
// included in the file licenses/APL.txt.
|
|
9
|
-
|
|
10
|
-
import { describe, expect, it } from "vitest";
|
|
11
|
-
import { type z } from "zod";
|
|
12
|
-
|
|
13
|
-
import { zod } from "@/zod";
|
|
14
|
-
|
|
15
|
-
interface TestCase<T extends number | bigint> {
|
|
16
|
-
value: T;
|
|
17
|
-
success: boolean;
|
|
18
|
-
}
|
|
19
|
-
|
|
20
|
-
const test = <T extends number | bigint>(
|
|
21
|
-
schema: z.ZodSchema<T>,
|
|
22
|
-
cases: TestCase<T>[],
|
|
23
|
-
) => {
|
|
24
|
-
cases.forEach(({ value, success }) => {
|
|
25
|
-
if (success)
|
|
26
|
-
it(`should parse ${value}`, () => {
|
|
27
|
-
expect(schema.parse(value)).toBe(value);
|
|
28
|
-
});
|
|
29
|
-
else
|
|
30
|
-
it(`should reject ${value}`, () => {
|
|
31
|
-
expect(() => schema.parse(value)).toThrow();
|
|
32
|
-
});
|
|
33
|
-
});
|
|
34
|
-
};
|
|
35
|
-
|
|
36
|
-
describe("Zod Integer Schemas", () => {
|
|
37
|
-
describe("int8", () => {
|
|
38
|
-
test(zod.int8, [
|
|
39
|
-
{ value: -Infinity, success: false },
|
|
40
|
-
{ value: -129, success: false },
|
|
41
|
-
{ value: -128, success: true },
|
|
42
|
-
{ value: -1, success: true },
|
|
43
|
-
{ value: 0, success: true },
|
|
44
|
-
{ value: 1, success: true },
|
|
45
|
-
{ value: 1.5, success: false },
|
|
46
|
-
{ value: 127, success: true },
|
|
47
|
-
{ value: 128, success: false },
|
|
48
|
-
{ value: Infinity, success: false },
|
|
49
|
-
{ value: NaN, success: false },
|
|
50
|
-
]);
|
|
51
|
-
});
|
|
52
|
-
|
|
53
|
-
describe("int16", () => {
|
|
54
|
-
test(zod.int16, [
|
|
55
|
-
{ value: -Infinity, success: false },
|
|
56
|
-
{ value: -32769, success: false },
|
|
57
|
-
{ value: -32768, success: true },
|
|
58
|
-
{ value: -1, success: true },
|
|
59
|
-
{ value: 0, success: true },
|
|
60
|
-
{ value: 1, success: true },
|
|
61
|
-
{ value: 1.5, success: false },
|
|
62
|
-
{ value: 32767, success: true },
|
|
63
|
-
{ value: 32768, success: false },
|
|
64
|
-
{ value: Infinity, success: false },
|
|
65
|
-
{ value: NaN, success: false },
|
|
66
|
-
]);
|
|
67
|
-
});
|
|
68
|
-
|
|
69
|
-
describe("int32", () => {
|
|
70
|
-
test(zod.int32, [
|
|
71
|
-
{ value: -Infinity, success: false },
|
|
72
|
-
{ value: -2147483649, success: false },
|
|
73
|
-
{ value: -2147483648, success: true },
|
|
74
|
-
{ value: -1, success: true },
|
|
75
|
-
{ value: 0, success: true },
|
|
76
|
-
{ value: 1, success: true },
|
|
77
|
-
{ value: 1.5, success: false },
|
|
78
|
-
{ value: 2147483647, success: true },
|
|
79
|
-
{ value: 2147483648, success: false },
|
|
80
|
-
{ value: Infinity, success: false },
|
|
81
|
-
{ value: NaN, success: false },
|
|
82
|
-
]);
|
|
83
|
-
});
|
|
84
|
-
|
|
85
|
-
describe("int64", () => {
|
|
86
|
-
test(zod.int64, [
|
|
87
|
-
{ value: -9223372036854775809n, success: false },
|
|
88
|
-
{ value: -9223372036854775808n, success: true },
|
|
89
|
-
{ value: -1n, success: true },
|
|
90
|
-
{ value: 0n, success: true },
|
|
91
|
-
{ value: 1n, success: true },
|
|
92
|
-
{ value: 9223372036854775807n, success: true },
|
|
93
|
-
{ value: 9223372036854775808n, success: false },
|
|
94
|
-
]);
|
|
95
|
-
});
|
|
96
|
-
|
|
97
|
-
describe("uint8", () => {
|
|
98
|
-
test(zod.uint8, [
|
|
99
|
-
{ value: -Infinity, success: false },
|
|
100
|
-
{ value: -1, success: false },
|
|
101
|
-
{ value: 0, success: true },
|
|
102
|
-
{ value: 1, success: true },
|
|
103
|
-
{ value: 1.5, success: false },
|
|
104
|
-
{ value: 255, success: true },
|
|
105
|
-
{ value: 256, success: false },
|
|
106
|
-
{ value: Infinity, success: false },
|
|
107
|
-
{ value: NaN, success: false },
|
|
108
|
-
]);
|
|
109
|
-
});
|
|
110
|
-
|
|
111
|
-
describe("uint16", () => {
|
|
112
|
-
test(zod.uint16, [
|
|
113
|
-
{ value: -Infinity, success: false },
|
|
114
|
-
{ value: -1, success: false },
|
|
115
|
-
{ value: 0, success: true },
|
|
116
|
-
{ value: 1, success: true },
|
|
117
|
-
{ value: 1.5, success: false },
|
|
118
|
-
{ value: 65535, success: true },
|
|
119
|
-
{ value: 65536, success: false },
|
|
120
|
-
{ value: Infinity, success: false },
|
|
121
|
-
{ value: NaN, success: false },
|
|
122
|
-
]);
|
|
123
|
-
});
|
|
124
|
-
|
|
125
|
-
describe("uint32", () => {
|
|
126
|
-
test(zod.uint32, [
|
|
127
|
-
{ value: -Infinity, success: false },
|
|
128
|
-
{ value: -1, success: false },
|
|
129
|
-
{ value: 0, success: true },
|
|
130
|
-
{ value: 1, success: true },
|
|
131
|
-
{ value: 1.5, success: false },
|
|
132
|
-
{ value: 4294967295, success: true },
|
|
133
|
-
{ value: 4294967296, success: false },
|
|
134
|
-
{ value: Infinity, success: false },
|
|
135
|
-
{ value: NaN, success: false },
|
|
136
|
-
]);
|
|
137
|
-
});
|
|
138
|
-
|
|
139
|
-
describe("uint64", () => {
|
|
140
|
-
test(zod.uint64, [
|
|
141
|
-
{ value: -1n, success: false },
|
|
142
|
-
{ value: 0n, success: true },
|
|
143
|
-
{ value: 1n, success: true },
|
|
144
|
-
{ value: 18446744073709551615n, success: true },
|
|
145
|
-
{ value: 18446744073709551616n, success: false },
|
|
146
|
-
]);
|
|
147
|
-
});
|
|
148
|
-
});
|
package/src/zod/integer.ts
DELETED
|
@@ -1,38 +0,0 @@
|
|
|
1
|
-
// Copyright 2025 Synnax Labs, Inc.
|
|
2
|
-
//
|
|
3
|
-
// Use of this software is governed by the Business Source License included in the file
|
|
4
|
-
// licenses/BSL.txt.
|
|
5
|
-
//
|
|
6
|
-
// As of the Change Date specified in that file, in accordance with the Business Source
|
|
7
|
-
// License, use of this software will be governed by the Apache License, Version 2.0,
|
|
8
|
-
// included in the file licenses/APL.txt.
|
|
9
|
-
|
|
10
|
-
import { z } from "zod";
|
|
11
|
-
|
|
12
|
-
const INT8_MIN = -128;
|
|
13
|
-
const INT8_MAX = 127;
|
|
14
|
-
export const int8 = z.number().int().min(INT8_MIN).max(INT8_MAX);
|
|
15
|
-
|
|
16
|
-
const INT16_MIN = -32768;
|
|
17
|
-
const INT16_MAX = 32767;
|
|
18
|
-
export const int16 = z.number().int().min(INT16_MIN).max(INT16_MAX);
|
|
19
|
-
|
|
20
|
-
const INT32_MIN = -2147483648;
|
|
21
|
-
const INT32_MAX = 2147483647;
|
|
22
|
-
export const int32 = z.number().int().min(INT32_MIN).max(INT32_MAX);
|
|
23
|
-
|
|
24
|
-
const INT64_MIN = -9223372036854775808n;
|
|
25
|
-
const INT64_MAX = 9223372036854775807n;
|
|
26
|
-
export const int64 = z.bigint().min(INT64_MIN).max(INT64_MAX);
|
|
27
|
-
|
|
28
|
-
const UINT8_MAX = 255;
|
|
29
|
-
export const uint8 = z.number().int().min(0).max(UINT8_MAX);
|
|
30
|
-
|
|
31
|
-
const UINT16_MAX = 65535;
|
|
32
|
-
export const uint16 = z.number().int().min(0).max(UINT16_MAX);
|
|
33
|
-
|
|
34
|
-
const UINT32_MAX = 4294967295;
|
|
35
|
-
export const uint32 = z.number().int().min(0).max(UINT32_MAX);
|
|
36
|
-
|
|
37
|
-
const UINT64_MAX = 18446744073709551615n;
|
|
38
|
-
export const uint64 = z.bigint().min(0n).max(UINT64_MAX);
|
|
File without changes
|