odm-client 0.0.1 → 0.0.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cloudbase-index.cjs +1 -1
- package/dist/cloudbase-index.js +1 -1
- package/dist/index.cjs +1 -1
- package/dist/index.d.ts +0 -1
- package/dist/index.js +4 -29
- package/dist/mongodb-index.cjs +1 -1
- package/dist/mongodb-index.js +1 -1
- package/package.json +1 -1
- package/dist/decorators/index.d.ts +0 -48
- /package/dist/deps/{query-builder-h6B2D2BCoQ-4ajykqs3m.js → query-builder-h6B2D2BCoQ-7t1lrgoqc.js} +0 -0
- /package/dist/deps/{query-builder-h6B2D2BCoQ-wqso6i87o.js → query-builder-h6B2D2BCoQ-lveomig6j.js} +0 -0
package/dist/cloudbase-index.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";var F=Object.defineProperty;var q=(u,t,e)=>t in u?F(u,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):u[t]=e;var f=(u,t,e)=>q(u,typeof t!="symbol"?t+"":t,e);Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const a=require("./deps/query-builder-h6B2D2BCoQ-
|
|
1
|
+
"use strict";var F=Object.defineProperty;var q=(u,t,e)=>t in u?F(u,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):u[t]=e;var f=(u,t,e)=>q(u,typeof t!="symbol"?t+"":t,e);Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const a=require("./deps/query-builder-h6B2D2BCoQ-lveomig6j.js");class C{constructor(t,e,r){f(this,"client");f(this,"schemaMeta");f(this,"context");f(this,"fieldMetaMap",{});f(this,"idField","_id");this.client=t,this.schemaMeta=e,this.context=r,this.fieldMetaMap=Object.entries(e).reduce((i,[d,c])=>(i[d]=c.columns.reduce((n,h)=>(n[h.name]=h,n),{}),i),{})}async findUnique(t,{where:e,select:r}){var n,h,s,w;const i=Object.keys(e??{});if(i.length===1&&i[0]===this.idField){if(r){const y=await this.client.collection(t).doc(e[this.idField]).field(r).get();return((n=y==null?void 0:y.data)==null?void 0:n[0])??null}const l=await this.client.collection(t).doc(e[this.idField]).get();return((h=l==null?void 0:l.data)==null?void 0:h[0])??null}const d=a.QueryBuilder.buildCloudBaseQuery(e,this.fieldMetaMap[t]);if(r){const l=await this.client.collection(t).where(d).field(r).get();return((s=l==null?void 0:l.data)==null?void 0:s[0])??null}const c=await this.client.collection(t).where(d).get();return((w=c==null?void 0:c.data)==null?void 0:w[0])??null}async findUniqueOrThrow(t,{where:e,select:r}){const i=await this.findUnique(t,{where:e,select:r});if(!i)throw new Error("Data Not Found");return i}async findFirst(t,e){const{data:r}=await this.findManyInner(t,{where:e==null?void 0:e.where,orderBy:e==null?void 0:e.orderBy,select:e==null?void 0:e.select,limit:1,offset:0});return(r==null?void 0:r[0])??null}async findFirstOrThrow(t,e){const r=await this.findFirst(t,e);if(!r)throw new Error("Data Not Found");return r}getFindQuery(t,e){const r=a.QueryBuilder.buildCloudBaseQuery((e==null?void 0:e.where)??{},this.fieldMetaMap[t]),i=a.QueryBuilder.getOrderByArray(e==null?void 0:e.orderBy);let d;return e!=null&&e.select?d=this.client.collection(t).where(r).field(e==null?void 0:e.select).skip((e==null?void 0:e.offset)??0):d=this.client.collection(t).where(r).skip((e==null?void 0:e.offset)??0),(e==null?void 0:e.limit)!=null&&(d=d.limit(e.limit)),i.length>0&&i.forEach(c=>{d=d.orderBy(c.fieldName,c.order)}),d}async findManyInner(t,e){return await this.getFindQuery(t,e).get()}async findMany(t,e){const r=e==null?void 0:e.where,i=e==null?void 0:e.orderBy,d=e==null?void 0:e.select,{data:c}=await this.findManyInner(t,{where:r,orderBy:i,select:d,limit:1e3,offset:0});return c}async findPage(t,e){const i=(e==null?void 0:e.limit)||10;if(i>1e3)throw new Error("limit must be less than or equal to 1000");const d=e==null?void 0:e.where,c=e==null?void 0:e.orderBy,n=(e==null?void 0:e.page)||1,h=e==null?void 0:e.select,s=(n-1)*i,w=this.findManyInner(t,{where:d,orderBy:c,select:h,limit:i,offset:s}),l=this.count(t,{where:d}),{data:y}=await w,B=await l,M=Math.ceil(B/i);return{data:y,total:B,page:n,pageCount:M,limit:i,hasPrev:n>1,hasNext:n<M}}async create(t,{data:e}){const r=a.applyDefaultValues(e,this.schemaMeta[t],this.context),i=await this.client.collection(t).add(r);return{_id:(i==null?void 0:i.id)??(i==null?void 0:i[this.idField])}}async update(t,{where:e,data:r}){const i=a.applyUpdateValues(r,this.schemaMeta[t]),d=Object.keys(e??{});if(d.length===1&&d[0]===this.idField){await this.client.collection(t).doc(e[this.idField]).update(i);return}const c=a.QueryBuilder.buildCloudBaseQuery(e,this.fieldMetaMap[t]);await this.client.collection(t).where(c).update(i)}async delete(t,{where:e}){const r=Object.keys(e??{});if(r.length===1&&r[0]===this.idField)return await this.client.collection(t).doc(e[this.idField]).remove();const i=a.QueryBuilder.buildCloudBaseQuery(e,this.fieldMetaMap[t]);await this.client.collection(t).where(i).remove()}async count(t,e){try{const r=this.getFindQuery(t,{where:e==null?void 0:e.where,offset:0}),{total:i}=await r.count();return i}catch(r){throw console.error("count error:",r),r}}}function O(u,t,e){const r=new C(u,t,e),i={};return Object.keys(t).forEach(d=>{i[d]={findUnique:c=>r.findUnique(d,c),findUniqueOrThrow:c=>r.findUniqueOrThrow(d,c),findFirst:c=>r.findFirst(d,c),findFirstOrThrow:c=>r.findFirstOrThrow(d,c),findMany:c=>r.findMany(d,c),findPage:c=>r.findPage(d,c),create:c=>r.create(d,c),update:c=>r.update(d,c),delete:c=>r.delete(d,c),count:c=>r.count(d,c)}}),i}exports.createCloudBaseClient=O;
|
package/dist/cloudbase-index.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
var B = Object.defineProperty;
|
|
2
2
|
var q = (u, t, e) => t in u ? B(u, t, { enumerable: !0, configurable: !0, writable: !0, value: e }) : u[t] = e;
|
|
3
3
|
var a = (u, t, e) => q(u, typeof t != "symbol" ? t + "" : t, e);
|
|
4
|
-
import { Q as y, a as O, b as C } from "./deps/query-builder-h6B2D2BCoQ-
|
|
4
|
+
import { Q as y, a as O, b as C } from "./deps/query-builder-h6B2D2BCoQ-7t1lrgoqc.js";
|
|
5
5
|
class k {
|
|
6
6
|
constructor(t, e, r) {
|
|
7
7
|
a(this, "client");
|
package/dist/index.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("./cloudbase-index.cjs"),t=require("./mongodb-index.cjs");exports.createCloudBaseClient=e.createCloudBaseClient;exports.createMongoDBClient=t.createMongoDBClient;
|
package/dist/index.d.ts
CHANGED
package/dist/index.js
CHANGED
|
@@ -1,31 +1,6 @@
|
|
|
1
|
-
import { createCloudBaseClient as
|
|
2
|
-
import { createMongoDBClient as
|
|
3
|
-
function o(t) {
|
|
4
|
-
return (e) => {
|
|
5
|
-
};
|
|
6
|
-
}
|
|
7
|
-
function n() {
|
|
8
|
-
return (t, e) => {
|
|
9
|
-
};
|
|
10
|
-
}
|
|
11
|
-
function p(t) {
|
|
12
|
-
return (e, r) => {
|
|
13
|
-
};
|
|
14
|
-
}
|
|
15
|
-
function i(t) {
|
|
16
|
-
return (e, r) => {
|
|
17
|
-
};
|
|
18
|
-
}
|
|
19
|
-
function a(t) {
|
|
20
|
-
return (e, r) => {
|
|
21
|
-
};
|
|
22
|
-
}
|
|
1
|
+
import { createCloudBaseClient as r } from "./cloudbase-index.js";
|
|
2
|
+
import { createMongoDBClient as a } from "./mongodb-index.js";
|
|
23
3
|
export {
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
n as PrimaryKey,
|
|
27
|
-
o as Table,
|
|
28
|
-
a as UpdatedAt,
|
|
29
|
-
c as createCloudBaseClient,
|
|
30
|
-
g as createMongoDBClient
|
|
4
|
+
r as createCloudBaseClient,
|
|
5
|
+
a as createMongoDBClient
|
|
31
6
|
};
|
package/dist/mongodb-index.cjs
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
"use strict";var Ql=Object.defineProperty;var Zl=(e,t,r)=>t in e?Ql(e,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[t]=r;var se=(e,t,r)=>Zl(e,typeof t!="symbol"?t+"":t,r);Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const Ht=require("./deps/query-builder-h6B2D2BCoQ-wqso6i87o.js"),gn=require("timers"),Mc=require("crypto"),D1=require("fs"),$l=require("http"),Ar=require("process"),ao=require("stream"),e2=require("events"),t2=require("util"),Fc=require("timers/promises"),T1=require("dns"),Rc=require("os"),r2=require("url"),Nc=require("zlib"),B1=require("net"),Ic=require("fs/promises"),vc=require("tls"),n2=require("child_process");var jt=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{};function pr(e){if(e.__esModule)return e;var t=e.default;if(typeof t=="function"){var r=function n(){return this instanceof n?Reflect.construct(t,arguments,this.constructor):t.apply(this,arguments)};r.prototype=t.prototype}else r={};return Object.defineProperty(r,"__esModule",{value:!0}),Object.keys(e).forEach(function(n){var i=Object.getOwnPropertyDescriptor(e,n);Object.defineProperty(r,n,i.get?i:{enumerable:!0,get:function(){return e[n]}})}),r}var is={},ei={},pe={},Oe={};const i2=(()=>{const e=Object.getOwnPropertyDescriptor(Object.getPrototypeOf(Uint8Array.prototype),Symbol.toStringTag).get;return t=>e.call(t)})();function hr(e){return i2(e)==="Uint8Array"}function b1(e){return typeof e=="object"&&e!=null&&Symbol.toStringTag in e&&(e[Symbol.toStringTag]==="ArrayBuffer"||e[Symbol.toStringTag]==="SharedArrayBuffer")}function un(e){return e instanceof RegExp||Object.prototype.toString.call(e)==="[object RegExp]"}function M1(e){return typeof e=="object"&&e!=null&&Symbol.toStringTag in e&&e[Symbol.toStringTag]==="Map"}function an(e){return e instanceof Date||Object.prototype.toString.call(e)==="[object Date]"}function Et(e,t){return JSON.stringify(e,(r,n)=>typeof n=="bigint"?{$numberLong:`${n}`}:M1(n)?Object.fromEntries(n):n)}function o2(e){if(e!=null&&typeof e=="object"&&"stylize"in e&&typeof e.stylize=="function")return e.stylize}const Rr=7,dn=Symbol.for("@@mdb.bson.version"),ti=2147483647,ri=-2147483648,Pc=Math.pow(2,63)-1,Lc=-Math.pow(2,63),kc=Math.pow(2,53),Uc=-Math.pow(2,53),F1=1,jc=2,R1=3,xc=4,N1=5,s2=6,zc=7,Vc=8,Wc=9,I1=10,Yi=11,u2=12,v1=13,Gc=14,qc=15,Hn=16,Hc=17,P1=18,Kc=19,Yc=255,Xc=127,a2=0,L1=4,Jc=Object.freeze({double:1,string:2,object:3,array:4,binData:5,undefined:6,objectId:7,bool:8,date:9,null:10,regex:11,dbPointer:12,javascript:13,symbol:14,javascriptWithScope:15,int:16,timestamp:17,long:18,decimal:19,minKey:-1,maxKey:127});class q extends Error{get bsonError(){return!0}get name(){return"BSONError"}constructor(t,r){super(t,r)}static isBSONError(t){return t!=null&&typeof t=="object"&&"bsonError"in t&&t.bsonError===!0&&"name"in t&&"message"in t&&"stack"in t}}class Nr extends q{get name(){return"BSONVersionError"}constructor(){super(`Unsupported BSON version, bson types must be from bson ${Rr}.x.x`)}}class Xi extends q{get name(){return"BSONRuntimeError"}constructor(t){super(t)}}class xt extends q{constructor(r,n,i){super(`${r}. offset: ${n}`,i);se(this,"offset");this.offset=n}get name(){return"BSONOffsetError"}}let Ru,Nu;function Qc(e,t,r,n){if(n){Ru??(Ru=new TextDecoder("utf8",{fatal:!0}));try{return Ru.decode(e.subarray(t,r))}catch(i){throw new q("Invalid UTF-8 string in BSON document",{cause:i})}}return Nu??(Nu=new TextDecoder("utf8",{fatal:!1})),Nu.decode(e.subarray(t,r))}function Zc(e,t,r){if(e.length===0)return"";const n=r-t;if(n===0)return"";if(n>20)return null;if(n===1&&e[t]<128)return String.fromCharCode(e[t]);if(n===2&&e[t]<128&&e[t+1]<128)return String.fromCharCode(e[t])+String.fromCharCode(e[t+1]);if(n===3&&e[t]<128&&e[t+1]<128&&e[t+2]<128)return String.fromCharCode(e[t])+String.fromCharCode(e[t+1])+String.fromCharCode(e[t+2]);const i=[];for(let o=t;o<r;o++){const u=e[o];if(u>127)return null;i.push(u)}return String.fromCharCode(...i)}function c2(e,t,r){if(t.length===0)return 0;if(t.length>25||e.length-r<t.length)return null;for(let n=0,i=r;n<t.length;n++,i++){const o=t.charCodeAt(n);if(o>127)return null;e[i]=o}return t.length}function l2(e){return yt.fromNumberArray(Array.from({length:e},()=>Math.floor(Math.random()*256)))}function h2(e){return crypto.getRandomValues(yt.allocate(e))}const d2=(()=>{const{crypto:e}=globalThis;return e!=null&&typeof e.getRandomValues=="function"?h2:l2})(),yt={isUint8Array:hr,toLocalBufferType(e){if(Buffer.isBuffer(e))return e;if(ArrayBuffer.isView(e))return Buffer.from(e.buffer,e.byteOffset,e.byteLength);const t=(e==null?void 0:e[Symbol.toStringTag])??Object.prototype.toString.call(e);if(t==="ArrayBuffer"||t==="SharedArrayBuffer"||t==="[object ArrayBuffer]"||t==="[object SharedArrayBuffer]")return Buffer.from(e);throw new q("Cannot create Buffer from the passed potentialBuffer.")},allocate(e){return Buffer.alloc(e)},allocateUnsafe(e){return Buffer.allocUnsafe(e)},compare(e,t){return yt.toLocalBufferType(e).compare(t)},concat(e){return Buffer.concat(e)},copy(e,t,r,n,i){return yt.toLocalBufferType(e).copy(t,r??0,n??0,i??e.length)},equals(e,t){return yt.toLocalBufferType(e).equals(t)},fromNumberArray(e){return Buffer.from(e)},fromBase64(e){return Buffer.from(e,"base64")},fromUTF8(e){return Buffer.from(e,"utf8")},toBase64(e){return yt.toLocalBufferType(e).toString("base64")},fromISO88591(e){return Buffer.from(e,"binary")},toISO88591(e){return yt.toLocalBufferType(e).toString("binary")},fromHex(e){return Buffer.from(e,"hex")},toHex(e){return yt.toLocalBufferType(e).toString("hex")},toUTF8(e,t,r,n){const i=r-t<=20?Zc(e,t,r):null;if(i!=null)return i;const o=yt.toLocalBufferType(e).toString("utf8",t,r);if(n){for(let u=0;u<o.length;u++)if(o.charCodeAt(u)===65533){Qc(e,t,r,!0);break}}return o},utf8ByteLength(e){return Buffer.byteLength(e,"utf8")},encodeUTF8Into(e,t,r){const n=c2(e,t,r);return n??yt.toLocalBufferType(e).write(t,r,void 0,"utf8")},randomBytes:d2,swap32(e){return yt.toLocalBufferType(e).swap32()}};function f2(){const{navigator:e}=globalThis;return typeof e=="object"&&e.product==="ReactNative"}function m2(e){if(e<0)throw new RangeError(`The argument 'byteLength' is invalid. Received ${e}`);return Mr.fromNumberArray(Array.from({length:e},()=>Math.floor(Math.random()*256)))}const E2=(()=>{var t;const{crypto:e}=globalThis;if(e!=null&&typeof e.getRandomValues=="function")return r=>e.getRandomValues(Mr.allocate(r));if(f2()){const{console:r}=globalThis;(t=r==null?void 0:r.warn)==null||t.call(r,"BSON: For React Native please polyfill crypto.getRandomValues, e.g. using: https://www.npmjs.com/package/react-native-get-random-values.")}return m2})(),Iu=/(\d|[a-f])/i,Mr={isUint8Array:hr,toLocalBufferType(e){const t=(e==null?void 0:e[Symbol.toStringTag])??Object.prototype.toString.call(e);if(t==="Uint8Array")return e;if(ArrayBuffer.isView(e))return new Uint8Array(e.buffer.slice(e.byteOffset,e.byteOffset+e.byteLength));if(t==="ArrayBuffer"||t==="SharedArrayBuffer"||t==="[object ArrayBuffer]"||t==="[object SharedArrayBuffer]")return new Uint8Array(e);throw new q("Cannot make a Uint8Array from passed potentialBuffer.")},allocate(e){if(typeof e!="number")throw new TypeError(`The "size" argument must be of type number. Received ${String(e)}`);return new Uint8Array(e)},allocateUnsafe(e){return Mr.allocate(e)},compare(e,t){if(e===t)return 0;const r=Math.min(e.length,t.length);for(let n=0;n<r;n++){if(e[n]<t[n])return-1;if(e[n]>t[n])return 1}return e.length<t.length?-1:e.length>t.length?1:0},concat(e){if(e.length===0)return Mr.allocate(0);let t=0;for(const i of e)t+=i.length;const r=Mr.allocate(t);let n=0;for(const i of e)r.set(i,n),n+=i.length;return r},copy(e,t,r,n,i){if(i!==void 0&&i<0)throw new RangeError(`The value of "sourceEnd" is out of range. It must be >= 0. Received ${i}`);if(i=i??e.length,n!==void 0&&(n<0||n>i))throw new RangeError(`The value of "sourceStart" is out of range. It must be >= 0 and <= ${i}. Received ${n}`);if(n=n??0,r!==void 0&&r<0)throw new RangeError(`The value of "targetStart" is out of range. It must be >= 0. Received ${r}`);r=r??0;const o=e.subarray(n,i),u=Math.min(o.length,t.length-r);return u<=0?0:(t.set(o.subarray(0,u),r),u)},equals(e,t){if(e.byteLength!==t.byteLength)return!1;for(let r=0;r<e.byteLength;r++)if(e[r]!==t[r])return!1;return!0},fromNumberArray(e){return Uint8Array.from(e)},fromBase64(e){return Uint8Array.from(atob(e),t=>t.charCodeAt(0))},fromUTF8(e){return new TextEncoder().encode(e)},toBase64(e){return btoa(Mr.toISO88591(e))},fromISO88591(e){return Uint8Array.from(e,t=>t.charCodeAt(0)&255)},toISO88591(e){return Array.from(Uint16Array.from(e),t=>String.fromCharCode(t)).join("")},fromHex(e){const t=e.length%2===0?e:e.slice(0,e.length-1),r=[];for(let n=0;n<t.length;n+=2){const i=t[n],o=t[n+1];if(!Iu.test(i)||!Iu.test(o))break;const u=Number.parseInt(`${i}${o}`,16);r.push(u)}return Uint8Array.from(r)},toHex(e){return Array.from(e,t=>t.toString(16).padStart(2,"0")).join("")},toUTF8(e,t,r,n){const i=r-t<=20?Zc(e,t,r):null;return i??Qc(e,t,r,n)},utf8ByteLength(e){return new TextEncoder().encode(e).byteLength},encodeUTF8Into(e,t,r){const n=new TextEncoder().encode(t);return e.set(n,r),n.byteLength},randomBytes:E2,swap32(e){if(e.length%4!==0)throw new RangeError("Buffer size must be a multiple of 32-bits");for(let t=0;t<e.length;t+=4){const r=e[t],n=e[t+1],i=e[t+2],o=e[t+3];e[t]=o,e[t+1]=i,e[t+2]=n,e[t+3]=r}return e}};var bc;const g2=typeof Buffer=="function"&&((bc=Buffer.prototype)==null?void 0:bc._isBuffer)!==!0,W=g2?yt:Mr,co=Symbol.for("@@mdb.bson.type");class at{get[co](){return this._bsontype}get[dn](){return Rr}[Symbol.for("nodejs.util.inspect.custom")](t,r,n){return this.inspect(t,r,n)}}const cn=new Float64Array(1),we=new Uint8Array(cn.buffer,0,8);cn[0]=-1;const os=we[7]===0,ue={isBigEndian:os,getNonnegativeInt32LE(e,t){if(e[t+3]>127)throw new RangeError(`Size cannot be negative at offset: ${t}`);return e[t]|e[t+1]<<8|e[t+2]<<16|e[t+3]<<24},getInt32LE(e,t){return e[t]|e[t+1]<<8|e[t+2]<<16|e[t+3]<<24},getUint32LE(e,t){return e[t]+e[t+1]*256+e[t+2]*65536+e[t+3]*16777216},getUint32BE(e,t){return e[t+3]+e[t+2]*256+e[t+1]*65536+e[t]*16777216},getBigInt64LE(e,t){const r=BigInt(e[t+4]+e[t+5]*256+e[t+6]*65536+(e[t+7]<<24)),n=BigInt(e[t]+e[t+1]*256+e[t+2]*65536+e[t+3]*16777216);return(r<<32n)+n},getFloat64LE:os?(e,t)=>(we[7]=e[t],we[6]=e[t+1],we[5]=e[t+2],we[4]=e[t+3],we[3]=e[t+4],we[2]=e[t+5],we[1]=e[t+6],we[0]=e[t+7],cn[0]):(e,t)=>(we[0]=e[t],we[1]=e[t+1],we[2]=e[t+2],we[3]=e[t+3],we[4]=e[t+4],we[5]=e[t+5],we[6]=e[t+6],we[7]=e[t+7],cn[0]),setInt32BE(e,t,r){return e[t+3]=r,r>>>=8,e[t+2]=r,r>>>=8,e[t+1]=r,r>>>=8,e[t]=r,4},setInt32LE(e,t,r){return e[t]=r,r>>>=8,e[t+1]=r,r>>>=8,e[t+2]=r,r>>>=8,e[t+3]=r,4},setBigInt64LE(e,t,r){const n=0xffffffffn;let i=Number(r&n);e[t]=i,i>>=8,e[t+1]=i,i>>=8,e[t+2]=i,i>>=8,e[t+3]=i;let o=Number(r>>32n&n);return e[t+4]=o,o>>=8,e[t+5]=o,o>>=8,e[t+6]=o,o>>=8,e[t+7]=o,8},setFloat64LE:os?(e,t,r)=>(cn[0]=r,e[t]=we[7],e[t+1]=we[6],e[t+2]=we[5],e[t+3]=we[4],e[t+4]=we[3],e[t+5]=we[2],e[t+6]=we[1],e[t+7]=we[0],8):(e,t,r)=>(cn[0]=r,e[t]=we[0],e[t+1]=we[1],e[t+2]=we[2],e[t+3]=we[3],e[t+4]=we[4],e[t+5]=we[5],e[t+6]=we[6],e[t+7]=we[7],8)},ge=class ge extends at{constructor(r,n){super();se(this,"buffer");se(this,"sub_type");se(this,"position");if(r!=null&&typeof r=="string"&&!ArrayBuffer.isView(r)&&!b1(r)&&!Array.isArray(r))throw new q("Binary can only be constructed from Uint8Array or number[]");this.sub_type=n??ge.BSON_BINARY_SUBTYPE_DEFAULT,r==null?(this.buffer=W.allocate(ge.BUFFER_SIZE),this.position=0):(this.buffer=Array.isArray(r)?W.fromNumberArray(r):W.toLocalBufferType(r),this.position=this.buffer.byteLength)}get _bsontype(){return"Binary"}put(r){if(typeof r=="string"&&r.length!==1)throw new q("only accepts single character String");if(typeof r!="number"&&r.length!==1)throw new q("only accepts single character Uint8Array or Array");let n;if(typeof r=="string"?n=r.charCodeAt(0):typeof r=="number"?n=r:n=r[0],n<0||n>255)throw new q("only accepts number in a valid unsigned byte range 0-255");if(this.buffer.byteLength>this.position)this.buffer[this.position++]=n;else{const i=W.allocate(ge.BUFFER_SIZE+this.buffer.length);i.set(this.buffer,0),this.buffer=i,this.buffer[this.position++]=n}}write(r,n){if(n=typeof n=="number"?n:this.position,this.buffer.byteLength<n+r.length){const i=W.allocate(this.buffer.byteLength+r.length);i.set(this.buffer,0),this.buffer=i}if(ArrayBuffer.isView(r))this.buffer.set(W.toLocalBufferType(r),n),this.position=n+r.byteLength>this.position?n+r.length:this.position;else if(typeof r=="string")throw new q("input cannot be string")}read(r,n){n=n&&n>0?n:this.position;const i=r+n;return this.buffer.subarray(r,i>this.position?this.position:i)}value(){return this.buffer.length===this.position?this.buffer:this.buffer.subarray(0,this.position)}length(){return this.position}toJSON(){return W.toBase64(this.buffer.subarray(0,this.position))}toString(r){return r==="hex"?W.toHex(this.buffer.subarray(0,this.position)):r==="base64"?W.toBase64(this.buffer.subarray(0,this.position)):r==="utf8"||r==="utf-8"?W.toUTF8(this.buffer,0,this.position,!1):W.toUTF8(this.buffer,0,this.position,!1)}toExtendedJSON(r){r=r||{},this.sub_type===ge.SUBTYPE_VECTOR&&Yt(this);const n=W.toBase64(this.buffer),i=Number(this.sub_type).toString(16);return r.legacy?{$binary:n,$type:i.length===1?"0"+i:i}:{$binary:{base64:n,subType:i.length===1?"0"+i:i}}}toUUID(){if(this.sub_type===ge.SUBTYPE_UUID)return new Xe(this.buffer.subarray(0,this.position));throw new q(`Binary sub_type "${this.sub_type}" is not supported for converting to UUID. Only "${ge.SUBTYPE_UUID}" is currently supported.`)}static createFromHexString(r,n){return new ge(W.fromHex(r),n)}static createFromBase64(r,n){return new ge(W.fromBase64(r),n)}static fromExtendedJSON(r,n){n=n||{};let i,o;if("$binary"in r?n.legacy&&typeof r.$binary=="string"&&"$type"in r?(o=r.$type?parseInt(r.$type,16):0,i=W.fromBase64(r.$binary)):typeof r.$binary!="string"&&(o=r.$binary.subType?parseInt(r.$binary.subType,16):0,i=W.fromBase64(r.$binary.base64)):"$uuid"in r&&(o=4,i=Xe.bytesFromString(r.$uuid)),!i)throw new q(`Unexpected Binary Extended JSON format ${JSON.stringify(r)}`);return o===L1?new Xe(i):new ge(i,o)}inspect(r,n,i){i??(i=Et);const o=W.toBase64(this.buffer.subarray(0,this.position)),u=i(o,n),h=i(this.sub_type,n);return`Binary.createFromBase64(${u}, ${h})`}toInt8Array(){if(this.sub_type!==ge.SUBTYPE_VECTOR)throw new q("Binary sub_type is not Vector");if(this.buffer[0]!==ge.VECTOR_TYPE.Int8)throw new q("Binary datatype field is not Int8");return Yt(this),new Int8Array(this.buffer.buffer.slice(this.buffer.byteOffset+2,this.buffer.byteOffset+this.position))}toFloat32Array(){if(this.sub_type!==ge.SUBTYPE_VECTOR)throw new q("Binary sub_type is not Vector");if(this.buffer[0]!==ge.VECTOR_TYPE.Float32)throw new q("Binary datatype field is not Float32");Yt(this);const r=new Uint8Array(this.buffer.buffer.slice(this.buffer.byteOffset+2,this.buffer.byteOffset+this.position));return ue.isBigEndian&&W.swap32(r),new Float32Array(r.buffer)}toPackedBits(){if(this.sub_type!==ge.SUBTYPE_VECTOR)throw new q("Binary sub_type is not Vector");if(this.buffer[0]!==ge.VECTOR_TYPE.PackedBit)throw new q("Binary datatype field is not packed bit");return Yt(this),new Uint8Array(this.buffer.buffer.slice(this.buffer.byteOffset+2,this.buffer.byteOffset+this.position))}toBits(){if(this.sub_type!==ge.SUBTYPE_VECTOR)throw new q("Binary sub_type is not Vector");if(this.buffer[0]!==ge.VECTOR_TYPE.PackedBit)throw new q("Binary datatype field is not packed bit");Yt(this);const n=(this.length()-2)*8-this.buffer[1],i=new Int8Array(n);for(let o=0;o<i.length;o++){const u=o/8|0,h=this.buffer[u+2],s=7-o%8,a=h>>s&1;i[o]=a}return i}static fromInt8Array(r){const n=W.allocate(r.byteLength+2);n[0]=ge.VECTOR_TYPE.Int8,n[1]=0;const i=new Uint8Array(r.buffer,r.byteOffset,r.byteLength);n.set(i,2);const o=new this(n,this.SUBTYPE_VECTOR);return Yt(o),o}static fromFloat32Array(r){const n=W.allocate(r.byteLength+2);n[0]=ge.VECTOR_TYPE.Float32,n[1]=0;const i=new Uint8Array(r.buffer,r.byteOffset,r.byteLength);n.set(i,2),ue.isBigEndian&&W.swap32(new Uint8Array(n.buffer,2));const o=new this(n,this.SUBTYPE_VECTOR);return Yt(o),o}static fromPackedBits(r,n=0){const i=W.allocate(r.byteLength+2);i[0]=ge.VECTOR_TYPE.PackedBit,i[1]=n,i.set(r,2);const o=new this(i,this.SUBTYPE_VECTOR);return Yt(o),o}static fromBits(r){const n=r.length+7>>>3,i=new Uint8Array(n+2);i[0]=ge.VECTOR_TYPE.PackedBit;const o=r.length%8;i[1]=o===0?0:8-o;for(let u=0;u<r.length;u++){const h=u>>>3,s=r[u];if(s!==0&&s!==1)throw new q(`Invalid bit value at ${u}: must be 0 or 1, found ${r[u]}`);if(s===0)continue;const a=7-u%8;i[h+2]|=s<<a}return new this(i,ge.SUBTYPE_VECTOR)}};se(ge,"BSON_BINARY_SUBTYPE_DEFAULT",0),se(ge,"BUFFER_SIZE",256),se(ge,"SUBTYPE_DEFAULT",0),se(ge,"SUBTYPE_FUNCTION",1),se(ge,"SUBTYPE_BYTE_ARRAY",2),se(ge,"SUBTYPE_UUID_OLD",3),se(ge,"SUBTYPE_UUID",4),se(ge,"SUBTYPE_MD5",5),se(ge,"SUBTYPE_ENCRYPTED",6),se(ge,"SUBTYPE_COLUMN",7),se(ge,"SUBTYPE_SENSITIVE",8),se(ge,"SUBTYPE_VECTOR",9),se(ge,"SUBTYPE_USER_DEFINED",128),se(ge,"VECTOR_TYPE",Object.freeze({Int8:3,Float32:39,PackedBit:16}));let je=ge;function Yt(e){if(e.sub_type!==je.SUBTYPE_VECTOR)return;const t=e.position,r=e.buffer[0],n=e.buffer[1];if((r===je.VECTOR_TYPE.Float32||r===je.VECTOR_TYPE.Int8)&&n!==0)throw new q("Invalid Vector: padding must be zero for int8 and float32 vectors");if(r===je.VECTOR_TYPE.Float32&&t!==0&&t-2!==0&&(t-2)%4!==0)throw new q("Invalid Vector: Float32 vector must contain a multiple of 4 bytes");if(r===je.VECTOR_TYPE.PackedBit&&n!==0&&t===2)throw new q("Invalid Vector: padding must be zero for packed bit vectors that are empty");if(r===je.VECTOR_TYPE.PackedBit&&n>7)throw new q(`Invalid Vector: padding must be a value between 0 and 7. found: ${n}`)}const ss=16,A2=/^[0-9A-F]{32}$/i,p2=/^[0-9A-F]{8}-[0-9A-F]{4}-[0-9A-F]{4}-[0-9A-F]{4}-[0-9A-F]{12}$/i;class Xe extends je{constructor(t){let r;if(t==null)r=Xe.generate();else if(t instanceof Xe)r=W.toLocalBufferType(new Uint8Array(t.buffer));else if(ArrayBuffer.isView(t)&&t.byteLength===ss)r=W.toLocalBufferType(t);else if(typeof t=="string")r=Xe.bytesFromString(t);else throw new q("Argument passed in UUID constructor must be a UUID, a 16 byte Buffer or a 32/36 character hex string (dashes excluded/included, format: xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx).");super(r,L1)}get id(){return this.buffer}set id(t){this.buffer=t}toHexString(t=!0){return t?[W.toHex(this.buffer.subarray(0,4)),W.toHex(this.buffer.subarray(4,6)),W.toHex(this.buffer.subarray(6,8)),W.toHex(this.buffer.subarray(8,10)),W.toHex(this.buffer.subarray(10,16))].join("-"):W.toHex(this.buffer)}toString(t){return t==="hex"?W.toHex(this.id):t==="base64"?W.toBase64(this.id):this.toHexString()}toJSON(){return this.toHexString()}equals(t){if(!t)return!1;if(t instanceof Xe)return W.equals(t.id,this.id);try{return W.equals(new Xe(t).id,this.id)}catch{return!1}}toBinary(){return new je(this.id,je.SUBTYPE_UUID)}static generate(){const t=W.randomBytes(ss);return t[6]=t[6]&15|64,t[8]=t[8]&63|128,t}static isValid(t){return t?typeof t=="string"?Xe.isValidUUIDString(t):hr(t)?t.byteLength===ss:t._bsontype==="Binary"&&t.sub_type===this.SUBTYPE_UUID&&t.buffer.byteLength===16:!1}static createFromHexString(t){const r=Xe.bytesFromString(t);return new Xe(r)}static createFromBase64(t){return new Xe(W.fromBase64(t))}static bytesFromString(t){if(!Xe.isValidUUIDString(t))throw new q("UUID string representation must be 32 hex digits or canonical hyphenated representation");return W.fromHex(t.replace(/-/g,""))}static isValidUUIDString(t){return A2.test(t)||p2.test(t)}inspect(t,r,n){return n??(n=Et),`new UUID(${n(this.toHexString(),r)})`}}class $t extends at{constructor(r,n){super();se(this,"code");se(this,"scope");this.code=r.toString(),this.scope=n??null}get _bsontype(){return"Code"}toJSON(){return this.scope!=null?{code:this.code,scope:this.scope}:{code:this.code}}toExtendedJSON(){return this.scope?{$code:this.code,$scope:this.scope}:{$code:this.code}}static fromExtendedJSON(r){return new $t(r.$code,r.$scope)}inspect(r,n,i){i??(i=Et);let o=i(this.code,n);const u=o.includes(`
|
|
1
|
+
"use strict";var Ql=Object.defineProperty;var Zl=(e,t,r)=>t in e?Ql(e,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[t]=r;var se=(e,t,r)=>Zl(e,typeof t!="symbol"?t+"":t,r);Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const Ht=require("./deps/query-builder-h6B2D2BCoQ-lveomig6j.js"),gn=require("timers"),Mc=require("crypto"),D1=require("fs"),$l=require("http"),Ar=require("process"),ao=require("stream"),e2=require("events"),t2=require("util"),Fc=require("timers/promises"),T1=require("dns"),Rc=require("os"),r2=require("url"),Nc=require("zlib"),B1=require("net"),Ic=require("fs/promises"),vc=require("tls"),n2=require("child_process");var jt=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{};function pr(e){if(e.__esModule)return e;var t=e.default;if(typeof t=="function"){var r=function n(){return this instanceof n?Reflect.construct(t,arguments,this.constructor):t.apply(this,arguments)};r.prototype=t.prototype}else r={};return Object.defineProperty(r,"__esModule",{value:!0}),Object.keys(e).forEach(function(n){var i=Object.getOwnPropertyDescriptor(e,n);Object.defineProperty(r,n,i.get?i:{enumerable:!0,get:function(){return e[n]}})}),r}var is={},ei={},pe={},Oe={};const i2=(()=>{const e=Object.getOwnPropertyDescriptor(Object.getPrototypeOf(Uint8Array.prototype),Symbol.toStringTag).get;return t=>e.call(t)})();function hr(e){return i2(e)==="Uint8Array"}function b1(e){return typeof e=="object"&&e!=null&&Symbol.toStringTag in e&&(e[Symbol.toStringTag]==="ArrayBuffer"||e[Symbol.toStringTag]==="SharedArrayBuffer")}function un(e){return e instanceof RegExp||Object.prototype.toString.call(e)==="[object RegExp]"}function M1(e){return typeof e=="object"&&e!=null&&Symbol.toStringTag in e&&e[Symbol.toStringTag]==="Map"}function an(e){return e instanceof Date||Object.prototype.toString.call(e)==="[object Date]"}function Et(e,t){return JSON.stringify(e,(r,n)=>typeof n=="bigint"?{$numberLong:`${n}`}:M1(n)?Object.fromEntries(n):n)}function o2(e){if(e!=null&&typeof e=="object"&&"stylize"in e&&typeof e.stylize=="function")return e.stylize}const Rr=7,dn=Symbol.for("@@mdb.bson.version"),ti=2147483647,ri=-2147483648,Pc=Math.pow(2,63)-1,Lc=-Math.pow(2,63),kc=Math.pow(2,53),Uc=-Math.pow(2,53),F1=1,jc=2,R1=3,xc=4,N1=5,s2=6,zc=7,Vc=8,Wc=9,I1=10,Yi=11,u2=12,v1=13,Gc=14,qc=15,Hn=16,Hc=17,P1=18,Kc=19,Yc=255,Xc=127,a2=0,L1=4,Jc=Object.freeze({double:1,string:2,object:3,array:4,binData:5,undefined:6,objectId:7,bool:8,date:9,null:10,regex:11,dbPointer:12,javascript:13,symbol:14,javascriptWithScope:15,int:16,timestamp:17,long:18,decimal:19,minKey:-1,maxKey:127});class q extends Error{get bsonError(){return!0}get name(){return"BSONError"}constructor(t,r){super(t,r)}static isBSONError(t){return t!=null&&typeof t=="object"&&"bsonError"in t&&t.bsonError===!0&&"name"in t&&"message"in t&&"stack"in t}}class Nr extends q{get name(){return"BSONVersionError"}constructor(){super(`Unsupported BSON version, bson types must be from bson ${Rr}.x.x`)}}class Xi extends q{get name(){return"BSONRuntimeError"}constructor(t){super(t)}}class xt extends q{constructor(r,n,i){super(`${r}. offset: ${n}`,i);se(this,"offset");this.offset=n}get name(){return"BSONOffsetError"}}let Ru,Nu;function Qc(e,t,r,n){if(n){Ru??(Ru=new TextDecoder("utf8",{fatal:!0}));try{return Ru.decode(e.subarray(t,r))}catch(i){throw new q("Invalid UTF-8 string in BSON document",{cause:i})}}return Nu??(Nu=new TextDecoder("utf8",{fatal:!1})),Nu.decode(e.subarray(t,r))}function Zc(e,t,r){if(e.length===0)return"";const n=r-t;if(n===0)return"";if(n>20)return null;if(n===1&&e[t]<128)return String.fromCharCode(e[t]);if(n===2&&e[t]<128&&e[t+1]<128)return String.fromCharCode(e[t])+String.fromCharCode(e[t+1]);if(n===3&&e[t]<128&&e[t+1]<128&&e[t+2]<128)return String.fromCharCode(e[t])+String.fromCharCode(e[t+1])+String.fromCharCode(e[t+2]);const i=[];for(let o=t;o<r;o++){const u=e[o];if(u>127)return null;i.push(u)}return String.fromCharCode(...i)}function c2(e,t,r){if(t.length===0)return 0;if(t.length>25||e.length-r<t.length)return null;for(let n=0,i=r;n<t.length;n++,i++){const o=t.charCodeAt(n);if(o>127)return null;e[i]=o}return t.length}function l2(e){return yt.fromNumberArray(Array.from({length:e},()=>Math.floor(Math.random()*256)))}function h2(e){return crypto.getRandomValues(yt.allocate(e))}const d2=(()=>{const{crypto:e}=globalThis;return e!=null&&typeof e.getRandomValues=="function"?h2:l2})(),yt={isUint8Array:hr,toLocalBufferType(e){if(Buffer.isBuffer(e))return e;if(ArrayBuffer.isView(e))return Buffer.from(e.buffer,e.byteOffset,e.byteLength);const t=(e==null?void 0:e[Symbol.toStringTag])??Object.prototype.toString.call(e);if(t==="ArrayBuffer"||t==="SharedArrayBuffer"||t==="[object ArrayBuffer]"||t==="[object SharedArrayBuffer]")return Buffer.from(e);throw new q("Cannot create Buffer from the passed potentialBuffer.")},allocate(e){return Buffer.alloc(e)},allocateUnsafe(e){return Buffer.allocUnsafe(e)},compare(e,t){return yt.toLocalBufferType(e).compare(t)},concat(e){return Buffer.concat(e)},copy(e,t,r,n,i){return yt.toLocalBufferType(e).copy(t,r??0,n??0,i??e.length)},equals(e,t){return yt.toLocalBufferType(e).equals(t)},fromNumberArray(e){return Buffer.from(e)},fromBase64(e){return Buffer.from(e,"base64")},fromUTF8(e){return Buffer.from(e,"utf8")},toBase64(e){return yt.toLocalBufferType(e).toString("base64")},fromISO88591(e){return Buffer.from(e,"binary")},toISO88591(e){return yt.toLocalBufferType(e).toString("binary")},fromHex(e){return Buffer.from(e,"hex")},toHex(e){return yt.toLocalBufferType(e).toString("hex")},toUTF8(e,t,r,n){const i=r-t<=20?Zc(e,t,r):null;if(i!=null)return i;const o=yt.toLocalBufferType(e).toString("utf8",t,r);if(n){for(let u=0;u<o.length;u++)if(o.charCodeAt(u)===65533){Qc(e,t,r,!0);break}}return o},utf8ByteLength(e){return Buffer.byteLength(e,"utf8")},encodeUTF8Into(e,t,r){const n=c2(e,t,r);return n??yt.toLocalBufferType(e).write(t,r,void 0,"utf8")},randomBytes:d2,swap32(e){return yt.toLocalBufferType(e).swap32()}};function f2(){const{navigator:e}=globalThis;return typeof e=="object"&&e.product==="ReactNative"}function m2(e){if(e<0)throw new RangeError(`The argument 'byteLength' is invalid. Received ${e}`);return Mr.fromNumberArray(Array.from({length:e},()=>Math.floor(Math.random()*256)))}const E2=(()=>{var t;const{crypto:e}=globalThis;if(e!=null&&typeof e.getRandomValues=="function")return r=>e.getRandomValues(Mr.allocate(r));if(f2()){const{console:r}=globalThis;(t=r==null?void 0:r.warn)==null||t.call(r,"BSON: For React Native please polyfill crypto.getRandomValues, e.g. using: https://www.npmjs.com/package/react-native-get-random-values.")}return m2})(),Iu=/(\d|[a-f])/i,Mr={isUint8Array:hr,toLocalBufferType(e){const t=(e==null?void 0:e[Symbol.toStringTag])??Object.prototype.toString.call(e);if(t==="Uint8Array")return e;if(ArrayBuffer.isView(e))return new Uint8Array(e.buffer.slice(e.byteOffset,e.byteOffset+e.byteLength));if(t==="ArrayBuffer"||t==="SharedArrayBuffer"||t==="[object ArrayBuffer]"||t==="[object SharedArrayBuffer]")return new Uint8Array(e);throw new q("Cannot make a Uint8Array from passed potentialBuffer.")},allocate(e){if(typeof e!="number")throw new TypeError(`The "size" argument must be of type number. Received ${String(e)}`);return new Uint8Array(e)},allocateUnsafe(e){return Mr.allocate(e)},compare(e,t){if(e===t)return 0;const r=Math.min(e.length,t.length);for(let n=0;n<r;n++){if(e[n]<t[n])return-1;if(e[n]>t[n])return 1}return e.length<t.length?-1:e.length>t.length?1:0},concat(e){if(e.length===0)return Mr.allocate(0);let t=0;for(const i of e)t+=i.length;const r=Mr.allocate(t);let n=0;for(const i of e)r.set(i,n),n+=i.length;return r},copy(e,t,r,n,i){if(i!==void 0&&i<0)throw new RangeError(`The value of "sourceEnd" is out of range. It must be >= 0. Received ${i}`);if(i=i??e.length,n!==void 0&&(n<0||n>i))throw new RangeError(`The value of "sourceStart" is out of range. It must be >= 0 and <= ${i}. Received ${n}`);if(n=n??0,r!==void 0&&r<0)throw new RangeError(`The value of "targetStart" is out of range. It must be >= 0. Received ${r}`);r=r??0;const o=e.subarray(n,i),u=Math.min(o.length,t.length-r);return u<=0?0:(t.set(o.subarray(0,u),r),u)},equals(e,t){if(e.byteLength!==t.byteLength)return!1;for(let r=0;r<e.byteLength;r++)if(e[r]!==t[r])return!1;return!0},fromNumberArray(e){return Uint8Array.from(e)},fromBase64(e){return Uint8Array.from(atob(e),t=>t.charCodeAt(0))},fromUTF8(e){return new TextEncoder().encode(e)},toBase64(e){return btoa(Mr.toISO88591(e))},fromISO88591(e){return Uint8Array.from(e,t=>t.charCodeAt(0)&255)},toISO88591(e){return Array.from(Uint16Array.from(e),t=>String.fromCharCode(t)).join("")},fromHex(e){const t=e.length%2===0?e:e.slice(0,e.length-1),r=[];for(let n=0;n<t.length;n+=2){const i=t[n],o=t[n+1];if(!Iu.test(i)||!Iu.test(o))break;const u=Number.parseInt(`${i}${o}`,16);r.push(u)}return Uint8Array.from(r)},toHex(e){return Array.from(e,t=>t.toString(16).padStart(2,"0")).join("")},toUTF8(e,t,r,n){const i=r-t<=20?Zc(e,t,r):null;return i??Qc(e,t,r,n)},utf8ByteLength(e){return new TextEncoder().encode(e).byteLength},encodeUTF8Into(e,t,r){const n=new TextEncoder().encode(t);return e.set(n,r),n.byteLength},randomBytes:E2,swap32(e){if(e.length%4!==0)throw new RangeError("Buffer size must be a multiple of 32-bits");for(let t=0;t<e.length;t+=4){const r=e[t],n=e[t+1],i=e[t+2],o=e[t+3];e[t]=o,e[t+1]=i,e[t+2]=n,e[t+3]=r}return e}};var bc;const g2=typeof Buffer=="function"&&((bc=Buffer.prototype)==null?void 0:bc._isBuffer)!==!0,W=g2?yt:Mr,co=Symbol.for("@@mdb.bson.type");class at{get[co](){return this._bsontype}get[dn](){return Rr}[Symbol.for("nodejs.util.inspect.custom")](t,r,n){return this.inspect(t,r,n)}}const cn=new Float64Array(1),we=new Uint8Array(cn.buffer,0,8);cn[0]=-1;const os=we[7]===0,ue={isBigEndian:os,getNonnegativeInt32LE(e,t){if(e[t+3]>127)throw new RangeError(`Size cannot be negative at offset: ${t}`);return e[t]|e[t+1]<<8|e[t+2]<<16|e[t+3]<<24},getInt32LE(e,t){return e[t]|e[t+1]<<8|e[t+2]<<16|e[t+3]<<24},getUint32LE(e,t){return e[t]+e[t+1]*256+e[t+2]*65536+e[t+3]*16777216},getUint32BE(e,t){return e[t+3]+e[t+2]*256+e[t+1]*65536+e[t]*16777216},getBigInt64LE(e,t){const r=BigInt(e[t+4]+e[t+5]*256+e[t+6]*65536+(e[t+7]<<24)),n=BigInt(e[t]+e[t+1]*256+e[t+2]*65536+e[t+3]*16777216);return(r<<32n)+n},getFloat64LE:os?(e,t)=>(we[7]=e[t],we[6]=e[t+1],we[5]=e[t+2],we[4]=e[t+3],we[3]=e[t+4],we[2]=e[t+5],we[1]=e[t+6],we[0]=e[t+7],cn[0]):(e,t)=>(we[0]=e[t],we[1]=e[t+1],we[2]=e[t+2],we[3]=e[t+3],we[4]=e[t+4],we[5]=e[t+5],we[6]=e[t+6],we[7]=e[t+7],cn[0]),setInt32BE(e,t,r){return e[t+3]=r,r>>>=8,e[t+2]=r,r>>>=8,e[t+1]=r,r>>>=8,e[t]=r,4},setInt32LE(e,t,r){return e[t]=r,r>>>=8,e[t+1]=r,r>>>=8,e[t+2]=r,r>>>=8,e[t+3]=r,4},setBigInt64LE(e,t,r){const n=0xffffffffn;let i=Number(r&n);e[t]=i,i>>=8,e[t+1]=i,i>>=8,e[t+2]=i,i>>=8,e[t+3]=i;let o=Number(r>>32n&n);return e[t+4]=o,o>>=8,e[t+5]=o,o>>=8,e[t+6]=o,o>>=8,e[t+7]=o,8},setFloat64LE:os?(e,t,r)=>(cn[0]=r,e[t]=we[7],e[t+1]=we[6],e[t+2]=we[5],e[t+3]=we[4],e[t+4]=we[3],e[t+5]=we[2],e[t+6]=we[1],e[t+7]=we[0],8):(e,t,r)=>(cn[0]=r,e[t]=we[0],e[t+1]=we[1],e[t+2]=we[2],e[t+3]=we[3],e[t+4]=we[4],e[t+5]=we[5],e[t+6]=we[6],e[t+7]=we[7],8)},ge=class ge extends at{constructor(r,n){super();se(this,"buffer");se(this,"sub_type");se(this,"position");if(r!=null&&typeof r=="string"&&!ArrayBuffer.isView(r)&&!b1(r)&&!Array.isArray(r))throw new q("Binary can only be constructed from Uint8Array or number[]");this.sub_type=n??ge.BSON_BINARY_SUBTYPE_DEFAULT,r==null?(this.buffer=W.allocate(ge.BUFFER_SIZE),this.position=0):(this.buffer=Array.isArray(r)?W.fromNumberArray(r):W.toLocalBufferType(r),this.position=this.buffer.byteLength)}get _bsontype(){return"Binary"}put(r){if(typeof r=="string"&&r.length!==1)throw new q("only accepts single character String");if(typeof r!="number"&&r.length!==1)throw new q("only accepts single character Uint8Array or Array");let n;if(typeof r=="string"?n=r.charCodeAt(0):typeof r=="number"?n=r:n=r[0],n<0||n>255)throw new q("only accepts number in a valid unsigned byte range 0-255");if(this.buffer.byteLength>this.position)this.buffer[this.position++]=n;else{const i=W.allocate(ge.BUFFER_SIZE+this.buffer.length);i.set(this.buffer,0),this.buffer=i,this.buffer[this.position++]=n}}write(r,n){if(n=typeof n=="number"?n:this.position,this.buffer.byteLength<n+r.length){const i=W.allocate(this.buffer.byteLength+r.length);i.set(this.buffer,0),this.buffer=i}if(ArrayBuffer.isView(r))this.buffer.set(W.toLocalBufferType(r),n),this.position=n+r.byteLength>this.position?n+r.length:this.position;else if(typeof r=="string")throw new q("input cannot be string")}read(r,n){n=n&&n>0?n:this.position;const i=r+n;return this.buffer.subarray(r,i>this.position?this.position:i)}value(){return this.buffer.length===this.position?this.buffer:this.buffer.subarray(0,this.position)}length(){return this.position}toJSON(){return W.toBase64(this.buffer.subarray(0,this.position))}toString(r){return r==="hex"?W.toHex(this.buffer.subarray(0,this.position)):r==="base64"?W.toBase64(this.buffer.subarray(0,this.position)):r==="utf8"||r==="utf-8"?W.toUTF8(this.buffer,0,this.position,!1):W.toUTF8(this.buffer,0,this.position,!1)}toExtendedJSON(r){r=r||{},this.sub_type===ge.SUBTYPE_VECTOR&&Yt(this);const n=W.toBase64(this.buffer),i=Number(this.sub_type).toString(16);return r.legacy?{$binary:n,$type:i.length===1?"0"+i:i}:{$binary:{base64:n,subType:i.length===1?"0"+i:i}}}toUUID(){if(this.sub_type===ge.SUBTYPE_UUID)return new Xe(this.buffer.subarray(0,this.position));throw new q(`Binary sub_type "${this.sub_type}" is not supported for converting to UUID. Only "${ge.SUBTYPE_UUID}" is currently supported.`)}static createFromHexString(r,n){return new ge(W.fromHex(r),n)}static createFromBase64(r,n){return new ge(W.fromBase64(r),n)}static fromExtendedJSON(r,n){n=n||{};let i,o;if("$binary"in r?n.legacy&&typeof r.$binary=="string"&&"$type"in r?(o=r.$type?parseInt(r.$type,16):0,i=W.fromBase64(r.$binary)):typeof r.$binary!="string"&&(o=r.$binary.subType?parseInt(r.$binary.subType,16):0,i=W.fromBase64(r.$binary.base64)):"$uuid"in r&&(o=4,i=Xe.bytesFromString(r.$uuid)),!i)throw new q(`Unexpected Binary Extended JSON format ${JSON.stringify(r)}`);return o===L1?new Xe(i):new ge(i,o)}inspect(r,n,i){i??(i=Et);const o=W.toBase64(this.buffer.subarray(0,this.position)),u=i(o,n),h=i(this.sub_type,n);return`Binary.createFromBase64(${u}, ${h})`}toInt8Array(){if(this.sub_type!==ge.SUBTYPE_VECTOR)throw new q("Binary sub_type is not Vector");if(this.buffer[0]!==ge.VECTOR_TYPE.Int8)throw new q("Binary datatype field is not Int8");return Yt(this),new Int8Array(this.buffer.buffer.slice(this.buffer.byteOffset+2,this.buffer.byteOffset+this.position))}toFloat32Array(){if(this.sub_type!==ge.SUBTYPE_VECTOR)throw new q("Binary sub_type is not Vector");if(this.buffer[0]!==ge.VECTOR_TYPE.Float32)throw new q("Binary datatype field is not Float32");Yt(this);const r=new Uint8Array(this.buffer.buffer.slice(this.buffer.byteOffset+2,this.buffer.byteOffset+this.position));return ue.isBigEndian&&W.swap32(r),new Float32Array(r.buffer)}toPackedBits(){if(this.sub_type!==ge.SUBTYPE_VECTOR)throw new q("Binary sub_type is not Vector");if(this.buffer[0]!==ge.VECTOR_TYPE.PackedBit)throw new q("Binary datatype field is not packed bit");return Yt(this),new Uint8Array(this.buffer.buffer.slice(this.buffer.byteOffset+2,this.buffer.byteOffset+this.position))}toBits(){if(this.sub_type!==ge.SUBTYPE_VECTOR)throw new q("Binary sub_type is not Vector");if(this.buffer[0]!==ge.VECTOR_TYPE.PackedBit)throw new q("Binary datatype field is not packed bit");Yt(this);const n=(this.length()-2)*8-this.buffer[1],i=new Int8Array(n);for(let o=0;o<i.length;o++){const u=o/8|0,h=this.buffer[u+2],s=7-o%8,a=h>>s&1;i[o]=a}return i}static fromInt8Array(r){const n=W.allocate(r.byteLength+2);n[0]=ge.VECTOR_TYPE.Int8,n[1]=0;const i=new Uint8Array(r.buffer,r.byteOffset,r.byteLength);n.set(i,2);const o=new this(n,this.SUBTYPE_VECTOR);return Yt(o),o}static fromFloat32Array(r){const n=W.allocate(r.byteLength+2);n[0]=ge.VECTOR_TYPE.Float32,n[1]=0;const i=new Uint8Array(r.buffer,r.byteOffset,r.byteLength);n.set(i,2),ue.isBigEndian&&W.swap32(new Uint8Array(n.buffer,2));const o=new this(n,this.SUBTYPE_VECTOR);return Yt(o),o}static fromPackedBits(r,n=0){const i=W.allocate(r.byteLength+2);i[0]=ge.VECTOR_TYPE.PackedBit,i[1]=n,i.set(r,2);const o=new this(i,this.SUBTYPE_VECTOR);return Yt(o),o}static fromBits(r){const n=r.length+7>>>3,i=new Uint8Array(n+2);i[0]=ge.VECTOR_TYPE.PackedBit;const o=r.length%8;i[1]=o===0?0:8-o;for(let u=0;u<r.length;u++){const h=u>>>3,s=r[u];if(s!==0&&s!==1)throw new q(`Invalid bit value at ${u}: must be 0 or 1, found ${r[u]}`);if(s===0)continue;const a=7-u%8;i[h+2]|=s<<a}return new this(i,ge.SUBTYPE_VECTOR)}};se(ge,"BSON_BINARY_SUBTYPE_DEFAULT",0),se(ge,"BUFFER_SIZE",256),se(ge,"SUBTYPE_DEFAULT",0),se(ge,"SUBTYPE_FUNCTION",1),se(ge,"SUBTYPE_BYTE_ARRAY",2),se(ge,"SUBTYPE_UUID_OLD",3),se(ge,"SUBTYPE_UUID",4),se(ge,"SUBTYPE_MD5",5),se(ge,"SUBTYPE_ENCRYPTED",6),se(ge,"SUBTYPE_COLUMN",7),se(ge,"SUBTYPE_SENSITIVE",8),se(ge,"SUBTYPE_VECTOR",9),se(ge,"SUBTYPE_USER_DEFINED",128),se(ge,"VECTOR_TYPE",Object.freeze({Int8:3,Float32:39,PackedBit:16}));let je=ge;function Yt(e){if(e.sub_type!==je.SUBTYPE_VECTOR)return;const t=e.position,r=e.buffer[0],n=e.buffer[1];if((r===je.VECTOR_TYPE.Float32||r===je.VECTOR_TYPE.Int8)&&n!==0)throw new q("Invalid Vector: padding must be zero for int8 and float32 vectors");if(r===je.VECTOR_TYPE.Float32&&t!==0&&t-2!==0&&(t-2)%4!==0)throw new q("Invalid Vector: Float32 vector must contain a multiple of 4 bytes");if(r===je.VECTOR_TYPE.PackedBit&&n!==0&&t===2)throw new q("Invalid Vector: padding must be zero for packed bit vectors that are empty");if(r===je.VECTOR_TYPE.PackedBit&&n>7)throw new q(`Invalid Vector: padding must be a value between 0 and 7. found: ${n}`)}const ss=16,A2=/^[0-9A-F]{32}$/i,p2=/^[0-9A-F]{8}-[0-9A-F]{4}-[0-9A-F]{4}-[0-9A-F]{4}-[0-9A-F]{12}$/i;class Xe extends je{constructor(t){let r;if(t==null)r=Xe.generate();else if(t instanceof Xe)r=W.toLocalBufferType(new Uint8Array(t.buffer));else if(ArrayBuffer.isView(t)&&t.byteLength===ss)r=W.toLocalBufferType(t);else if(typeof t=="string")r=Xe.bytesFromString(t);else throw new q("Argument passed in UUID constructor must be a UUID, a 16 byte Buffer or a 32/36 character hex string (dashes excluded/included, format: xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx).");super(r,L1)}get id(){return this.buffer}set id(t){this.buffer=t}toHexString(t=!0){return t?[W.toHex(this.buffer.subarray(0,4)),W.toHex(this.buffer.subarray(4,6)),W.toHex(this.buffer.subarray(6,8)),W.toHex(this.buffer.subarray(8,10)),W.toHex(this.buffer.subarray(10,16))].join("-"):W.toHex(this.buffer)}toString(t){return t==="hex"?W.toHex(this.id):t==="base64"?W.toBase64(this.id):this.toHexString()}toJSON(){return this.toHexString()}equals(t){if(!t)return!1;if(t instanceof Xe)return W.equals(t.id,this.id);try{return W.equals(new Xe(t).id,this.id)}catch{return!1}}toBinary(){return new je(this.id,je.SUBTYPE_UUID)}static generate(){const t=W.randomBytes(ss);return t[6]=t[6]&15|64,t[8]=t[8]&63|128,t}static isValid(t){return t?typeof t=="string"?Xe.isValidUUIDString(t):hr(t)?t.byteLength===ss:t._bsontype==="Binary"&&t.sub_type===this.SUBTYPE_UUID&&t.buffer.byteLength===16:!1}static createFromHexString(t){const r=Xe.bytesFromString(t);return new Xe(r)}static createFromBase64(t){return new Xe(W.fromBase64(t))}static bytesFromString(t){if(!Xe.isValidUUIDString(t))throw new q("UUID string representation must be 32 hex digits or canonical hyphenated representation");return W.fromHex(t.replace(/-/g,""))}static isValidUUIDString(t){return A2.test(t)||p2.test(t)}inspect(t,r,n){return n??(n=Et),`new UUID(${n(this.toHexString(),r)})`}}class $t extends at{constructor(r,n){super();se(this,"code");se(this,"scope");this.code=r.toString(),this.scope=n??null}get _bsontype(){return"Code"}toJSON(){return this.scope!=null?{code:this.code,scope:this.scope}:{code:this.code}}toExtendedJSON(){return this.scope?{$code:this.code,$scope:this.scope}:{$code:this.code}}static fromExtendedJSON(r){return new $t(r.$code,r.$scope)}inspect(r,n,i){i??(i=Et);let o=i(this.code,n);const u=o.includes(`
|
|
2
2
|
`);this.scope!=null&&(o+=`,${u?`
|
|
3
3
|
`:" "}${i(this.scope,n)}`);const h=u&&this.scope===null;return`new Code(${u?`
|
|
4
4
|
`:""}${o}${h?`
|
package/dist/mongodb-index.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
var Ql = Object.defineProperty;
|
|
2
2
|
var Zl = (e, t, r) => t in e ? Ql(e, t, { enumerable: !0, configurable: !0, writable: !0, value: r }) : e[t] = r;
|
|
3
3
|
var se = (e, t, r) => Zl(e, typeof t != "symbol" ? t + "" : t, r);
|
|
4
|
-
import { Q as Sr, a as $l, b as e2 } from "./deps/query-builder-h6B2D2BCoQ-
|
|
4
|
+
import { Q as Sr, a as $l, b as e2 } from "./deps/query-builder-h6B2D2BCoQ-7t1lrgoqc.js";
|
|
5
5
|
import gn from "timers";
|
|
6
6
|
import Mc from "crypto";
|
|
7
7
|
import D1 from "fs";
|
package/package.json
CHANGED
|
@@ -1,48 +0,0 @@
|
|
|
1
|
-
import { ColumnType, SearchIndexSort } from '../types';
|
|
2
|
-
|
|
3
|
-
export interface TableOptions {
|
|
4
|
-
name: string;
|
|
5
|
-
}
|
|
6
|
-
export interface FieldOptions {
|
|
7
|
-
type: ColumnType;
|
|
8
|
-
default?: any | ((data: any, context?: any) => any);
|
|
9
|
-
isIndex?: boolean;
|
|
10
|
-
indexSort?: SearchIndexSort;
|
|
11
|
-
indexOptions?: {
|
|
12
|
-
unique: boolean;
|
|
13
|
-
};
|
|
14
|
-
}
|
|
15
|
-
export interface CreatedAtOptions {
|
|
16
|
-
isIndex?: boolean;
|
|
17
|
-
indexSort?: SearchIndexSort;
|
|
18
|
-
indexOptions?: {
|
|
19
|
-
unique: boolean;
|
|
20
|
-
};
|
|
21
|
-
}
|
|
22
|
-
export interface UpdatedAtOptions {
|
|
23
|
-
isIndex?: boolean;
|
|
24
|
-
indexSort?: SearchIndexSort;
|
|
25
|
-
indexOptions?: {
|
|
26
|
-
unique: boolean;
|
|
27
|
-
};
|
|
28
|
-
}
|
|
29
|
-
/**
|
|
30
|
-
* 表装饰器:标记一个类为表格存储的表定义
|
|
31
|
-
*/
|
|
32
|
-
export declare function Table(options: TableOptions): ClassDecorator;
|
|
33
|
-
/**
|
|
34
|
-
* 主键字段装饰器:标记一个字段为主键列
|
|
35
|
-
*/
|
|
36
|
-
export declare function PrimaryKey(): PropertyDecorator;
|
|
37
|
-
/**
|
|
38
|
-
* 普通字段装饰器:标记一个字段为数据列
|
|
39
|
-
*/
|
|
40
|
-
export declare function Field(options: FieldOptions): PropertyDecorator;
|
|
41
|
-
/**
|
|
42
|
-
* 创建时间装饰器:标记一个字段为创建时间
|
|
43
|
-
*/
|
|
44
|
-
export declare function CreatedAt(options?: CreatedAtOptions): PropertyDecorator;
|
|
45
|
-
/**
|
|
46
|
-
* 更新时间装饰器:标记一个字段为更新时间
|
|
47
|
-
*/
|
|
48
|
-
export declare function UpdatedAt(options?: UpdatedAtOptions): PropertyDecorator;
|
/package/dist/deps/{query-builder-h6B2D2BCoQ-4ajykqs3m.js → query-builder-h6B2D2BCoQ-7t1lrgoqc.js}
RENAMED
|
File without changes
|
/package/dist/deps/{query-builder-h6B2D2BCoQ-wqso6i87o.js → query-builder-h6B2D2BCoQ-lveomig6j.js}
RENAMED
|
File without changes
|