@activepieces/piece-duckdb 0.0.6 → 0.0.8
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/package.json +7 -11
- package/src/index.js +16 -18
- package/src/index.d.ts +0 -2
- package/src/index.d.ts.map +0 -1
- package/src/index.js.map +0 -1
- package/src/lib/actions/create-and-query-db.d.ts +0 -7
- package/src/lib/actions/create-and-query-db.d.ts.map +0 -1
- package/src/lib/actions/create-and-query-db.js +0 -106
- package/src/lib/actions/create-and-query-db.js.map +0 -1
package/package.json
CHANGED
|
@@ -1,18 +1,14 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@activepieces/piece-duckdb",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.8",
|
|
4
4
|
"type": "commonjs",
|
|
5
5
|
"main": "./src/index.js",
|
|
6
|
-
"types": "./src/index.d.ts",
|
|
7
6
|
"dependencies": {
|
|
8
|
-
"@
|
|
9
|
-
"@activepieces/pieces-framework": "0.30.0",
|
|
10
|
-
"@activepieces/shared": "0.87.1",
|
|
11
|
-
"@duckdb/node-api": "1.4.3-r.2",
|
|
12
|
-
"tslib": "2.3.0"
|
|
7
|
+
"@duckdb/node-api": "1.4.3-r.2"
|
|
13
8
|
},
|
|
14
|
-
"
|
|
15
|
-
"
|
|
16
|
-
"
|
|
17
|
-
|
|
9
|
+
"files": [
|
|
10
|
+
"src/index.js",
|
|
11
|
+
"package.json",
|
|
12
|
+
"src/i18n"
|
|
13
|
+
]
|
|
18
14
|
}
|
package/src/index.js
CHANGED
|
@@ -1,18 +1,16 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
});
|
|
18
|
-
//# sourceMappingURL=index.js.map
|
|
1
|
+
"use strict";var $o=Object.create;var be=Object.defineProperty;var Eo=Object.getOwnPropertyDescriptor;var bo=Object.getOwnPropertyNames;var So=Object.getPrototypeOf,zo=Object.prototype.hasOwnProperty;var o=(e,t)=>be(e,"name",{value:t,configurable:!0});var Ao=(e,t)=>()=>{try{return t||e((t={exports:{}}).exports,t),t.exports}catch(r){throw t=0,r}},er=(e,t)=>{for(var r in t)be(e,r,{get:t[r],enumerable:!0})},tr=(e,t,r,i)=>{if(t&&typeof t=="object"||typeof t=="function")for(let s of bo(t))!zo.call(e,s)&&s!==r&&be(e,s,{get:()=>t[s],enumerable:!(i=Eo(t,s))||i.enumerable});return e};var We=(e,t,r)=>(r=e!=null?$o(So(e)):{},tr(t||!e||!e.__esModule?be(r,"default",{value:e,enumerable:!0}):r,e)),Oo=e=>tr(be({},"__esModule",{value:!0}),e);var bn=Ao((En,dt)=>{(function(e){"use strict";let t="(0?\\d+|0x[a-f0-9]+)",r={fourOctet:new RegExp(`^${t}\\.${t}\\.${t}\\.${t}$`,"i"),threeOctet:new RegExp(`^${t}\\.${t}\\.${t}$`,"i"),twoOctet:new RegExp(`^${t}\\.${t}$`,"i"),longValue:new RegExp(`^${t}$`,"i")},i=new RegExp("^0[0-7]+$","i"),s=new RegExp("^0x[a-f0-9]+$","i"),l="%[0-9a-z]{1,}",d="(?:[0-9a-f]+::?)+",m={zoneIndex:new RegExp(l,"i"),native:new RegExp(`^(::)?(${d})?([0-9a-f]+)?(::)?(${l})?$`,"i"),deprecatedTransitional:new RegExp(`^(?:::)(${t}\\.${t}\\.${t}\\.${t}(${l})?)$`,"i"),transitional:new RegExp(`^((?:${d})|(?:::)(?:${d})?)${t}\\.${t}\\.${t}\\.${t}(${l})?$`,"i")};function h(a,c){if(a.indexOf("::")!==a.lastIndexOf("::"))return null;let g=0,p=-1,y=(a.match(m.zoneIndex)||[])[0],x,M;for(y&&(y=y.substring(1),a=a.replace(/%.+$/,""));(p=a.indexOf(":",p+1))>=0;)g++;if(a.substr(0,2)==="::"&&g--,a.substr(-2,2)==="::"&&g--,g>c)return null;for(M=c-g,x=":";M--;)x+="0:";return a=a.replace("::",x),a[0]===":"&&(a=a.slice(1)),a[a.length-1]===":"&&(a=a.slice(0,-1)),c=(function(){let Yt=a.split(":"),Qt=[];for(let ft=0;ft<Yt.length;ft++)Qt.push(parseInt(Yt[ft],16));return Qt})(),{parts:c,zoneId:y}}o(h,"expandIPv6");function v(a,c,g,p){if(a.length!==c.length)throw new Error("ipaddr: cannot match CIDR for objects with different lengths");let y=0,x;for(;p>0;){if(x=g-p,x<0&&(x=0),a[y]>>x!==c[y]>>x)return!1;p-=g,y+=1}return!0}o(v,"matchCIDR");function P(a){if(s.test(a))return parseInt(a,16);if(a[0]==="0"&&!isNaN(parseInt(a[1],10))){if(i.test(a))return parseInt(a,8);throw new Error(`ipaddr: cannot parse ${a} as octal`)}return parseInt(a,10)}o(P,"parseIntAuto");function N(a,c){for(;a.length<c;)a=`0${a}`;return a}o(N,"padPart");let _={};_.IPv4=(function(){function a(c){if(c.length!==4)throw new Error("ipaddr: ipv4 octet count should be 4");let g,p;for(g=0;g<c.length;g++)if(p=c[g],!(0<=p&&p<=255))throw new Error("ipaddr: ipv4 octet should fit in 8 bits");this.octets=c}return o(a,"IPv4"),a.prototype.SpecialRanges={unspecified:[[new a([0,0,0,0]),8]],broadcast:[[new a([255,255,255,255]),32]],multicast:[[new a([224,0,0,0]),4]],linkLocal:[[new a([169,254,0,0]),16]],loopback:[[new a([127,0,0,0]),8]],carrierGradeNat:[[new a([100,64,0,0]),10]],private:[[new a([10,0,0,0]),8],[new a([172,16,0,0]),12],[new a([192,168,0,0]),16]],reserved:[[new a([192,0,0,0]),24],[new a([192,0,2,0]),24],[new a([192,88,99,0]),24],[new a([198,18,0,0]),15],[new a([198,51,100,0]),24],[new a([203,0,113,0]),24],[new a([240,0,0,0]),4]],as112:[[new a([192,175,48,0]),24],[new a([192,31,196,0]),24]],amt:[[new a([192,52,193,0]),24]]},a.prototype.kind=function(){return"ipv4"},a.prototype.match=function(c,g){let p;if(g===void 0&&(p=c,c=p[0],g=p[1]),c.kind()!=="ipv4")throw new Error("ipaddr: cannot match ipv4 address with non-ipv4 one");return v(this.octets,c.octets,8,g)},a.prototype.prefixLengthFromSubnetMask=function(){let c=0,g=!1,p={0:8,128:7,192:6,224:5,240:4,248:3,252:2,254:1,255:0},y,x,M;for(y=3;y>=0;y-=1)if(x=this.octets[y],x in p){if(M=p[x],g&&M!==0)return null;M!==8&&(g=!0),c+=M}else return null;return 32-c},a.prototype.range=function(){return _.subnetMatch(this,this.SpecialRanges)},a.prototype.toByteArray=function(){return this.octets.slice(0)},a.prototype.toIPv4MappedAddress=function(){return _.IPv6.parse(`::ffff:${this.toString()}`)},a.prototype.toNormalizedString=function(){return this.toString()},a.prototype.toString=function(){return this.octets.join(".")},a})(),_.IPv4.broadcastAddressFromCIDR=function(a){try{let c=this.parseCIDR(a),g=c[0].toByteArray(),p=this.subnetMaskFromPrefixLength(c[1]).toByteArray(),y=[],x=0;for(;x<4;)y.push(parseInt(g[x],10)|parseInt(p[x],10)^255),x++;return new this(y)}catch{throw new Error("ipaddr: the address does not have IPv4 CIDR format")}},_.IPv4.isIPv4=function(a){return this.parser(a)!==null},_.IPv4.isValid=function(a){try{return new this(this.parser(a)),!0}catch{return!1}},_.IPv4.isValidCIDR=function(a){try{return this.parseCIDR(a),!0}catch{return!1}},_.IPv4.isValidFourPartDecimal=function(a){return!!(_.IPv4.isValid(a)&&a.match(/^(0|[1-9]\d*)(\.(0|[1-9]\d*)){3}$/))},_.IPv4.isValidCIDRFourPartDecimal=function(a){let c=a.match(/^(.+)\/(\d+)$/);return!_.IPv4.isValidCIDR(a)||!c?!1:_.IPv4.isValidFourPartDecimal(c[1])},_.IPv4.networkAddressFromCIDR=function(a){let c,g,p,y,x;try{for(c=this.parseCIDR(a),p=c[0].toByteArray(),x=this.subnetMaskFromPrefixLength(c[1]).toByteArray(),y=[],g=0;g<4;)y.push(parseInt(p[g],10)&parseInt(x[g],10)),g++;return new this(y)}catch{throw new Error("ipaddr: the address does not have IPv4 CIDR format")}},_.IPv4.parse=function(a){let c=this.parser(a);if(c===null)throw new Error("ipaddr: string is not formatted like an IPv4 Address");return new this(c)},_.IPv4.parseCIDR=function(a){let c;if(c=a.match(/^(.+)\/(\d+)$/)){let g=parseInt(c[2]);if(g>=0&&g<=32){let p=[this.parse(c[1]),g];return Object.defineProperty(p,"toString",{value:o(function(){return this.join("/")},"value")}),p}}throw new Error("ipaddr: string is not formatted like an IPv4 CIDR range")},_.IPv4.parser=function(a){let c,g,p;if(c=a.match(r.fourOctet))return(function(){let y=c.slice(1,6),x=[];for(let M=0;M<y.length;M++)g=y[M],x.push(P(g));return x})();if(c=a.match(r.longValue)){if(p=P(c[1]),p>4294967295||p<0)throw new Error("ipaddr: address outside defined range");return(function(){let y=[],x;for(x=0;x<=24;x+=8)y.push(p>>x&255);return y})().reverse()}else return(c=a.match(r.twoOctet))?(function(){let y=c.slice(1,4),x=[];if(p=P(y[1]),p>16777215||p<0)throw new Error("ipaddr: address outside defined range");return x.push(P(y[0])),x.push(p>>16&255),x.push(p>>8&255),x.push(p&255),x})():(c=a.match(r.threeOctet))?(function(){let y=c.slice(1,5),x=[];if(p=P(y[2]),p>65535||p<0)throw new Error("ipaddr: address outside defined range");return x.push(P(y[0])),x.push(P(y[1])),x.push(p>>8&255),x.push(p&255),x})():null},_.IPv4.subnetMaskFromPrefixLength=function(a){if(a=parseInt(a),a<0||a>32)throw new Error("ipaddr: invalid IPv4 prefix length");let c=[0,0,0,0],g=0,p=Math.floor(a/8);for(;g<p;)c[g]=255,g++;return p<4&&(c[p]=Math.pow(2,a%8)-1<<8-a%8),new this(c)},_.IPv6=(function(){function a(c,g){let p,y;if(c.length===16)for(this.parts=[],p=0;p<=14;p+=2)this.parts.push(c[p]<<8|c[p+1]);else if(c.length===8)this.parts=c;else throw new Error("ipaddr: ipv6 part count should be 8 or 16");for(p=0;p<this.parts.length;p++)if(y=this.parts[p],!(0<=y&&y<=65535))throw new Error("ipaddr: ipv6 part should fit in 16 bits");g&&(this.zoneId=g)}return o(a,"IPv6"),a.prototype.SpecialRanges={unspecified:[new a([0,0,0,0,0,0,0,0]),128],linkLocal:[new a([65152,0,0,0,0,0,0,0]),10],multicast:[new a([65280,0,0,0,0,0,0,0]),8],loopback:[new a([0,0,0,0,0,0,0,1]),128],uniqueLocal:[new a([64512,0,0,0,0,0,0,0]),7],ipv4Mapped:[new a([0,0,0,0,0,65535,0,0]),96],discard:[new a([256,0,0,0,0,0,0,0]),64],rfc6145:[new a([0,0,0,0,65535,0,0,0]),96],rfc6052:[new a([100,65435,0,0,0,0,0,0]),96],"6to4":[new a([8194,0,0,0,0,0,0,0]),16],teredo:[new a([8193,0,0,0,0,0,0,0]),32],benchmarking:[new a([8193,2,0,0,0,0,0,0]),48],amt:[new a([8193,3,0,0,0,0,0,0]),32],as112v6:[[new a([8193,4,274,0,0,0,0,0]),48],[new a([9760,79,32768,0,0,0,0,0]),48]],deprecated:[new a([8193,16,0,0,0,0,0,0]),28],orchid2:[new a([8193,32,0,0,0,0,0,0]),28],droneRemoteIdProtocolEntityTags:[new a([8193,48,0,0,0,0,0,0]),28],reserved:[[new a([8193,0,0,0,0,0,0,0]),23],[new a([8193,3512,0,0,0,0,0,0]),32]]},a.prototype.isIPv4MappedAddress=function(){return this.range()==="ipv4Mapped"},a.prototype.kind=function(){return"ipv6"},a.prototype.match=function(c,g){let p;if(g===void 0&&(p=c,c=p[0],g=p[1]),c.kind()!=="ipv6")throw new Error("ipaddr: cannot match ipv6 address with non-ipv6 one");return v(this.parts,c.parts,16,g)},a.prototype.prefixLengthFromSubnetMask=function(){let c=0,g=!1,p={0:16,32768:15,49152:14,57344:13,61440:12,63488:11,64512:10,65024:9,65280:8,65408:7,65472:6,65504:5,65520:4,65528:3,65532:2,65534:1,65535:0},y,x;for(let M=7;M>=0;M-=1)if(y=this.parts[M],y in p){if(x=p[y],g&&x!==0)return null;x!==16&&(g=!0),c+=x}else return null;return 128-c},a.prototype.range=function(){return _.subnetMatch(this,this.SpecialRanges)},a.prototype.toByteArray=function(){let c,g=[],p=this.parts;for(let y=0;y<p.length;y++)c=p[y],g.push(c>>8),g.push(c&255);return g},a.prototype.toFixedLengthString=function(){let c=(function(){let p=[];for(let y=0;y<this.parts.length;y++)p.push(N(this.parts[y].toString(16),4));return p}).call(this).join(":"),g="";return this.zoneId&&(g=`%${this.zoneId}`),c+g},a.prototype.toIPv4Address=function(){if(!this.isIPv4MappedAddress())throw new Error("ipaddr: trying to convert a generic ipv6 address to ipv4");let c=this.parts.slice(-2),g=c[0],p=c[1];return new _.IPv4([g>>8,g&255,p>>8,p&255])},a.prototype.toNormalizedString=function(){let c=(function(){let p=[];for(let y=0;y<this.parts.length;y++)p.push(this.parts[y].toString(16));return p}).call(this).join(":"),g="";return this.zoneId&&(g=`%${this.zoneId}`),c+g},a.prototype.toRFC5952String=function(){let c=/((^|:)(0(:|$)){2,})/g,g=this.toNormalizedString(),p=0,y=-1,x;for(;x=c.exec(g);)x[0].length>y&&(p=x.index,y=x[0].length);return y<0?g:`${g.substring(0,p)}::${g.substring(p+y)}`},a.prototype.toString=function(){return this.toRFC5952String()},a})(),_.IPv6.broadcastAddressFromCIDR=function(a){try{let c=this.parseCIDR(a),g=c[0].toByteArray(),p=this.subnetMaskFromPrefixLength(c[1]).toByteArray(),y=[],x=0;for(;x<16;)y.push(parseInt(g[x],10)|parseInt(p[x],10)^255),x++;return new this(y)}catch(c){throw new Error(`ipaddr: the address does not have IPv6 CIDR format (${c})`)}},_.IPv6.isIPv6=function(a){return this.parser(a)!==null},_.IPv6.isValid=function(a){if(typeof a=="string"&&a.indexOf(":")===-1)return!1;try{let c=this.parser(a);return new this(c.parts,c.zoneId),!0}catch{return!1}},_.IPv6.isValidCIDR=function(a){if(typeof a=="string"&&a.indexOf(":")===-1)return!1;try{return this.parseCIDR(a),!0}catch{return!1}},_.IPv6.networkAddressFromCIDR=function(a){let c,g,p,y,x;try{for(c=this.parseCIDR(a),p=c[0].toByteArray(),x=this.subnetMaskFromPrefixLength(c[1]).toByteArray(),y=[],g=0;g<16;)y.push(parseInt(p[g],10)&parseInt(x[g],10)),g++;return new this(y)}catch(M){throw new Error(`ipaddr: the address does not have IPv6 CIDR format (${M})`)}},_.IPv6.parse=function(a){let c=this.parser(a);if(c.parts===null)throw new Error("ipaddr: string is not formatted like an IPv6 Address");return new this(c.parts,c.zoneId)},_.IPv6.parseCIDR=function(a){let c,g,p;if((g=a.match(/^(.+)\/(\d+)$/))&&(c=parseInt(g[2]),c>=0&&c<=128))return p=[this.parse(g[1]),c],Object.defineProperty(p,"toString",{value:o(function(){return this.join("/")},"value")}),p;throw new Error("ipaddr: string is not formatted like an IPv6 CIDR range")},_.IPv6.parser=function(a){let c,g,p,y,x,M;if(p=a.match(m.deprecatedTransitional))return this.parser(`::ffff:${p[1]}`);if(m.native.test(a))return h(a,8);if((p=a.match(m.transitional))&&(M=p[6]||"",c=p[1],p[1].endsWith("::")||(c=c.slice(0,-1)),c=h(c+M,6),c.parts)){for(x=[parseInt(p[2]),parseInt(p[3]),parseInt(p[4]),parseInt(p[5])],g=0;g<x.length;g++)if(y=x[g],!(0<=y&&y<=255))return null;return c.parts.push(x[0]<<8|x[1]),c.parts.push(x[2]<<8|x[3]),{parts:c.parts,zoneId:c.zoneId}}return null},_.IPv6.subnetMaskFromPrefixLength=function(a){if(a=parseInt(a),a<0||a>128)throw new Error("ipaddr: invalid IPv6 prefix length");let c=[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],g=0,p=Math.floor(a/8);for(;g<p;)c[g]=255,g++;return p<16&&(c[p]=Math.pow(2,a%8)-1<<8-a%8),new this(c)},_.fromByteArray=function(a){let c=a.length;if(c===4)return new _.IPv4(a);if(c===16)return new _.IPv6(a);throw new Error("ipaddr: the binary input is neither an IPv6 nor IPv4 address")},_.isValid=function(a){return _.IPv6.isValid(a)||_.IPv4.isValid(a)},_.isValidCIDR=function(a){return _.IPv6.isValidCIDR(a)||_.IPv4.isValidCIDR(a)},_.parse=function(a){if(_.IPv6.isValid(a))return _.IPv6.parse(a);if(_.IPv4.isValid(a))return _.IPv4.parse(a);throw new Error("ipaddr: the address has neither IPv6 nor IPv4 format")},_.parseCIDR=function(a){try{return _.IPv6.parseCIDR(a)}catch{try{return _.IPv4.parseCIDR(a)}catch{throw new Error("ipaddr: the address has neither IPv6 nor IPv4 CIDR format")}}},_.process=function(a){let c=this.parse(a);return c.kind()==="ipv6"&&c.isIPv4MappedAddress()?c.toIPv4Address():c},_.subnetMatch=function(a,c,g){let p,y,x,M;g==null&&(g="unicast");for(y in c)if(Object.prototype.hasOwnProperty.call(c,y)){for(x=c[y],x[0]&&!(x[0]instanceof Array)&&(x=[x]),p=0;p<x.length;p++)if(M=x[p],a.kind()===M[0].kind()&&a.match.apply(a,M))return y}return g},typeof dt<"u"&&dt.exports?dt.exports=_:e.ipaddr=_})(En)});var ss={};er(ss,{duckdb:()=>as});module.exports=Oo(ss);var ko=Object.freeze({status:"aborted"});function I(e,t,r){function i(m,h){if(m._zod||Object.defineProperty(m,"_zod",{value:{def:h,constr:d,traits:new Set},enumerable:!1}),m._zod.traits.has(e))return;m._zod.traits.add(e),t(m,h);let v=d.prototype,P=Object.keys(v);for(let N=0;N<P.length;N++){let _=P[N];_ in m||(m[_]=v[_].bind(m))}}o(i,"init");let s=r?.Parent??Object;class l extends s{static{o(this,"Definition")}}Object.defineProperty(l,"name",{value:e});function d(m){var h;let v=r?.Parent?new l:this;i(v,m),(h=v._zod).deferred??(h.deferred=[]);for(let P of v._zod.deferred)P();return v}return o(d,"_"),Object.defineProperty(d,"init",{value:i}),Object.defineProperty(d,Symbol.hasInstance,{value:o(m=>r?.Parent&&m instanceof r.Parent?!0:m?._zod?.traits?.has(e),"value")}),Object.defineProperty(d,"name",{value:e}),d}o(I,"$constructor");var X=class extends Error{static{o(this,"$ZodAsyncError")}constructor(){super("Encountered Promise during synchronous parse. Use .parseAsync() instead.")}},He=class extends Error{static{o(this,"$ZodEncodeError")}constructor(t){super(`Encountered unidirectional transform during encode: ${t}`),this.name="ZodEncodeError"}},gt={};function Q(e){return e&&Object.assign(gt,e),gt}o(Q,"config");function ht(e){let t=Object.values(e).filter(i=>typeof i=="number");return Object.entries(e).filter(([i,s])=>t.indexOf(+i)===-1).map(([i,s])=>s)}o(ht,"getEnumValues");function nr(e,t){return typeof t=="bigint"?t.toString():t}o(nr,"jsonStringifyReplacer");function Je(e){return{get value(){{let r=e();return Object.defineProperty(this,"value",{value:r}),r}throw new Error("cached value already set")}}}o(Je,"cached");function or(e){return e==null}o(or,"nullish");function Xe(e){let t=e.startsWith("^")?1:0,r=e.endsWith("$")?e.length-1:e.length;return e.slice(t,r)}o(Xe,"cleanRegex");var rr=Symbol("evaluating");function V(e,t,r){let i;Object.defineProperty(e,t,{get(){if(i!==rr)return i===void 0&&(i=rr,i=r()),i},set(s){Object.defineProperty(e,t,{value:s})},configurable:!0})}o(V,"defineLazy");var vt="captureStackTrace"in Error?Error.captureStackTrace:(...e)=>{};function Se(e){return typeof e=="object"&&e!==null&&!Array.isArray(e)}o(Se,"isObject");var Ro=Je(()=>{if(typeof navigator<"u"&&navigator?.userAgent?.includes("Cloudflare"))return!1;try{let e=Function;return new e(""),!0}catch{return!1}});function ir(e){if(Se(e)===!1)return!1;let t=e.constructor;if(t===void 0||typeof t!="function")return!0;let r=t.prototype;return!(Se(r)===!1||Object.prototype.hasOwnProperty.call(r,"isPrototypeOf")===!1)}o(ir,"isPlainObject");var ar=new Set(["string","number","symbol"]);function xe(e){return e.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}o(xe,"escapeRegex");function qe(e,t,r){let i=new e._zod.constr(t??e._zod.def);return(!t||r?.parent)&&(i._zod.parent=e),i}o(qe,"clone");function L(e){let t=e;if(!t)return{};if(typeof t=="string")return{error:o(()=>t,"error")};if(t?.message!==void 0){if(t?.error!==void 0)throw new Error("Cannot specify both `message` and `error` params");t.error=t.message}return delete t.message,typeof t.error=="string"?{...t,error:o(()=>t.error,"error")}:t}o(L,"normalizeParams");function sr(e){return Object.keys(e).filter(t=>e[t]._zod.optin==="optional"&&e[t]._zod.optout==="optional")}o(sr,"optionalKeys");var ur={safeint:[Number.MIN_SAFE_INTEGER,Number.MAX_SAFE_INTEGER],int32:[-2147483648,2147483647],uint32:[0,4294967295],float32:[-34028234663852886e22,34028234663852886e22],float64:[-Number.MAX_VALUE,Number.MAX_VALUE]};function _e(e,t=0){if(e.aborted===!0)return!0;for(let r=t;r<e.issues.length;r++)if(e.issues[r]?.continue!==!0)return!0;return!1}o(_e,"aborted");function ae(e,t){return t.map(r=>{var i;return(i=r).path??(i.path=[]),r.path.unshift(e),r})}o(ae,"prefixIssues");function Ke(e){return typeof e=="string"?e:e?.message}o(Ke,"unwrapMessage");function se(e,t,r){let i={...e,path:e.path??[]};if(!e.message){let s=Ke(e.inst?._zod.def?.error?.(e))??Ke(t?.error?.(e))??Ke(r.customError?.(e))??Ke(r.localeError?.(e))??"Invalid input";i.message=s}return delete i.inst,delete i.continue,t?.reportInput||delete i.input,i}o(se,"finalizeIssue");function cr(e){return Array.isArray(e)?"array":typeof e=="string"?"string":"unknown"}o(cr,"getLengthableOrigin");function xt(...e){let[t,r,i]=e;return typeof t=="string"?{message:t,code:"custom",input:r,inst:i}:{...t}}o(xt,"issue");var lr=o((e,t)=>{e.name="$ZodError",Object.defineProperty(e,"_zod",{value:e._zod,enumerable:!1}),Object.defineProperty(e,"issues",{value:t,enumerable:!1}),e.message=JSON.stringify(t,nr,2),Object.defineProperty(e,"toString",{value:o(()=>e.message,"value"),enumerable:!1})},"initializer"),pr=I("$ZodError",lr),ze=I("$ZodError",lr,{Parent:Error});var Do=o(e=>(t,r,i,s)=>{let l=i?Object.assign(i,{async:!1}):{async:!1},d=t._zod.run({value:r,issues:[]},l);if(d instanceof Promise)throw new X;if(d.issues.length){let m=new(s?.Err??e)(d.issues.map(h=>se(h,l,Q())));throw vt(m,s?.callee),m}return d.value},"_parse"),Ye=Do(ze),No=o(e=>async(t,r,i,s)=>{let l=i?Object.assign(i,{async:!0}):{async:!0},d=t._zod.run({value:r,issues:[]},l);if(d instanceof Promise&&(d=await d),d.issues.length){let m=new(s?.Err??e)(d.issues.map(h=>se(h,l,Q())));throw vt(m,s?.callee),m}return d.value},"_parseAsync"),Qe=No(ze),Co=o(e=>(t,r,i)=>{let s=i?{...i,async:!1}:{async:!1},l=t._zod.run({value:r,issues:[]},s);if(l instanceof Promise)throw new X;return l.issues.length?{success:!1,error:new(e??pr)(l.issues.map(d=>se(d,s,Q())))}:{success:!0,data:l.value}},"_safeParse"),Ae=Co(ze),Uo=o(e=>async(t,r,i)=>{let s=i?Object.assign(i,{async:!0}):{async:!0},l=t._zod.run({value:r,issues:[]},s);return l instanceof Promise&&(l=await l),l.issues.length?{success:!1,error:new e(l.issues.map(d=>se(d,s,Q())))}:{success:!0,data:l.value}},"_safeParseAsync"),Oe=Uo(ze);var Mo="(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))",Lo=new RegExp(`^${Mo}$`);var dr=o(e=>{let t=e?`[\\s\\S]{${e?.minimum??0},${e?.maximum??""}}`:"[\\s\\S]*";return new RegExp(`^${t}$`)},"string"),mr=/^-?\d+n?$/,fr=/^-?\d+$/,_t=/^-?\d+(?:\.\d+)?$/,gr=/^(?:true|false)$/i;var ue=I("$ZodCheck",(e,t)=>{var r;e._zod??(e._zod={}),e._zod.def=t,(r=e._zod).onattach??(r.onattach=[])}),jo={number:"number",bigint:"bigint",object:"date"};var yr=I("$ZodCheckGreaterThan",(e,t)=>{ue.init(e,t);let r=jo[typeof t.value];e._zod.onattach.push(i=>{let s=i._zod.bag,l=(t.inclusive?s.minimum:s.exclusiveMinimum)??Number.NEGATIVE_INFINITY;t.value>l&&(t.inclusive?s.minimum=t.value:s.exclusiveMinimum=t.value)}),e._zod.check=i=>{(t.inclusive?i.value>=t.value:i.value>t.value)||i.issues.push({origin:r,code:"too_small",minimum:typeof t.value=="object"?t.value.getTime():t.value,input:i.value,inclusive:t.inclusive,inst:e,continue:!t.abort})}});var hr=I("$ZodCheckNumberFormat",(e,t)=>{ue.init(e,t),t.format=t.format||"float64";let r=t.format?.includes("int"),i=r?"int":"number",[s,l]=ur[t.format];e._zod.onattach.push(d=>{let m=d._zod.bag;m.format=t.format,m.minimum=s,m.maximum=l,r&&(m.pattern=fr)}),e._zod.check=d=>{let m=d.value;if(r){if(!Number.isInteger(m)){d.issues.push({expected:i,format:t.format,code:"invalid_type",continue:!1,input:m,inst:e});return}if(!Number.isSafeInteger(m)){m>0?d.issues.push({input:m,code:"too_big",maximum:Number.MAX_SAFE_INTEGER,note:"Integers must be within the safe integer range.",inst:e,origin:i,inclusive:!0,continue:!t.abort}):d.issues.push({input:m,code:"too_small",minimum:Number.MIN_SAFE_INTEGER,note:"Integers must be within the safe integer range.",inst:e,origin:i,inclusive:!0,continue:!t.abort});return}}m<s&&d.issues.push({origin:"number",input:m,code:"too_small",minimum:s,inclusive:!0,inst:e,continue:!t.abort}),m>l&&d.issues.push({origin:"number",input:m,code:"too_big",maximum:l,inclusive:!0,inst:e,continue:!t.abort})}});var vr=I("$ZodCheckMinLength",(e,t)=>{var r;ue.init(e,t),(r=e._zod.def).when??(r.when=i=>{let s=i.value;return!or(s)&&s.length!==void 0}),e._zod.onattach.push(i=>{let s=i._zod.bag.minimum??Number.NEGATIVE_INFINITY;t.minimum>s&&(i._zod.bag.minimum=t.minimum)}),e._zod.check=i=>{let s=i.value;if(s.length>=t.minimum)return;let d=cr(s);i.issues.push({origin:d,code:"too_small",minimum:t.minimum,inclusive:!0,input:s,inst:e,continue:!t.abort})}});var Pt=I("$ZodCheckStringFormat",(e,t)=>{var r,i;ue.init(e,t),e._zod.onattach.push(s=>{let l=s._zod.bag;l.format=t.format,t.pattern&&(l.patterns??(l.patterns=new Set),l.patterns.add(t.pattern))}),t.pattern?(r=e._zod).check??(r.check=s=>{t.pattern.lastIndex=0,!t.pattern.test(s.value)&&s.issues.push({origin:"string",code:"invalid_format",format:t.format,input:s.value,...t.pattern?{pattern:t.pattern.toString()}:{},inst:e,continue:!t.abort})}):(i=e._zod).check??(i.check=()=>{})}),xr=I("$ZodCheckRegex",(e,t)=>{Pt.init(e,t),e._zod.check=r=>{t.pattern.lastIndex=0,!t.pattern.test(r.value)&&r.issues.push({origin:"string",code:"invalid_format",format:"regex",input:r.value,pattern:t.pattern.toString(),inst:e,continue:!t.abort})}});var Pr={major:4,minor:3,patch:6};var Z=I("$ZodType",(e,t)=>{var r;e??(e={}),e._zod.def=t,e._zod.bag=e._zod.bag||{},e._zod.version=Pr;let i=[...e._zod.def.checks??[]];e._zod.traits.has("$ZodCheck")&&i.unshift(e);for(let s of i)for(let l of s._zod.onattach)l(e);if(i.length===0)(r=e._zod).deferred??(r.deferred=[]),e._zod.deferred?.push(()=>{e._zod.run=e._zod.parse});else{let s=o((d,m,h)=>{let v=_e(d),P;for(let N of m){if(N._zod.def.when){if(!N._zod.def.when(d))continue}else if(v)continue;let _=d.issues.length,a=N._zod.check(d);if(a instanceof Promise&&h?.async===!1)throw new X;if(P||a instanceof Promise)P=(P??Promise.resolve()).then(async()=>{await a,d.issues.length!==_&&(v||(v=_e(d,_)))});else{if(d.issues.length===_)continue;v||(v=_e(d,_))}}return P?P.then(()=>d):d},"runChecks"),l=o((d,m,h)=>{if(_e(d))return d.aborted=!0,d;let v=s(m,i,h);if(v instanceof Promise){if(h.async===!1)throw new X;return v.then(P=>e._zod.parse(P,h))}return e._zod.parse(v,h)},"handleCanaryResult");e._zod.run=(d,m)=>{if(m.skipChecks)return e._zod.parse(d,m);if(m.direction==="backward"){let v=e._zod.parse({value:d.value,issues:[]},{...m,skipChecks:!0});return v instanceof Promise?v.then(P=>l(P,d,m)):l(v,d,m)}let h=e._zod.parse(d,m);if(h instanceof Promise){if(m.async===!1)throw new X;return h.then(v=>s(v,i,m))}return s(h,i,m)}}V(e,"~standard",()=>({validate:o(s=>{try{let l=Ae(e,s);return l.success?{value:l.data}:{issues:l.error?.issues}}catch{return Oe(e,s).then(d=>d.success?{value:d.data}:{issues:d.error?.issues})}},"validate"),vendor:"zod",version:1}))}),rt=I("$ZodString",(e,t)=>{Z.init(e,t),e._zod.pattern=[...e?._zod.bag?.patterns??[]].pop()??dr(e._zod.bag),e._zod.parse=(r,i)=>{if(t.coerce)try{r.value=String(r.value)}catch{}return typeof r.value=="string"||r.issues.push({expected:"string",code:"invalid_type",input:r.value,inst:e}),r}}),It=I("$ZodStringFormat",(e,t)=>{Pt.init(e,t),rt.init(e,t)});var br=I("$ZodURL",(e,t)=>{It.init(e,t),e._zod.check=r=>{try{let i=r.value.trim(),s=new URL(i);t.hostname&&(t.hostname.lastIndex=0,t.hostname.test(s.hostname)||r.issues.push({code:"invalid_format",format:"url",note:"Invalid hostname",pattern:t.hostname.source,input:r.value,inst:e,continue:!t.abort})),t.protocol&&(t.protocol.lastIndex=0,t.protocol.test(s.protocol.endsWith(":")?s.protocol.slice(0,-1):s.protocol)||r.issues.push({code:"invalid_format",format:"url",note:"Invalid protocol",pattern:t.protocol.source,input:r.value,inst:e,continue:!t.abort})),t.normalize?r.value=s.href:r.value=i;return}catch{r.issues.push({code:"invalid_format",format:"url",input:r.value,inst:e,continue:!t.abort})}}});var Tt=I("$ZodNumber",(e,t)=>{Z.init(e,t),e._zod.pattern=e._zod.bag.pattern??_t,e._zod.parse=(r,i)=>{if(t.coerce)try{r.value=Number(r.value)}catch{}let s=r.value;if(typeof s=="number"&&!Number.isNaN(s)&&Number.isFinite(s))return r;let l=typeof s=="number"?Number.isNaN(s)?"NaN":Number.isFinite(s)?void 0:"Infinity":void 0;return r.issues.push({expected:"number",code:"invalid_type",input:s,inst:e,...l?{received:l}:{}}),r}}),Sr=I("$ZodNumberFormat",(e,t)=>{hr.init(e,t),Tt.init(e,t)}),$t=I("$ZodBoolean",(e,t)=>{Z.init(e,t),e._zod.pattern=gr,e._zod.parse=(r,i)=>{if(t.coerce)try{r.value=!!r.value}catch{}let s=r.value;return typeof s=="boolean"||r.issues.push({expected:"boolean",code:"invalid_type",input:s,inst:e}),r}}),zr=I("$ZodBigInt",(e,t)=>{Z.init(e,t),e._zod.pattern=mr,e._zod.parse=(r,i)=>{if(t.coerce)try{r.value=BigInt(r.value)}catch{}return typeof r.value=="bigint"||r.issues.push({expected:"bigint",code:"invalid_type",input:r.value,inst:e}),r}});var Ar=I("$ZodAny",(e,t)=>{Z.init(e,t),e._zod.parse=r=>r}),Or=I("$ZodUnknown",(e,t)=>{Z.init(e,t),e._zod.parse=r=>r});var kr=I("$ZodVoid",(e,t)=>{Z.init(e,t),e._zod.parse=(r,i)=>{let s=r.value;return typeof s>"u"||r.issues.push({expected:"void",code:"invalid_type",input:s,inst:e}),r}}),Rr=I("$ZodDate",(e,t)=>{Z.init(e,t),e._zod.parse=(r,i)=>{if(t.coerce)try{r.value=new Date(r.value)}catch{}let s=r.value,l=s instanceof Date;return l&&!Number.isNaN(s.getTime())||r.issues.push({expected:"date",code:"invalid_type",input:s,...l?{received:"Invalid Date"}:{},inst:e}),r}});function Ir(e,t,r){e.issues.length&&t.issues.push(...ae(r,e.issues)),t.value[r]=e.value}o(Ir,"handleArrayResult");var wr=I("$ZodArray",(e,t)=>{Z.init(e,t),e._zod.parse=(r,i)=>{let s=r.value;if(!Array.isArray(s))return r.issues.push({expected:"array",code:"invalid_type",input:s,inst:e}),r;r.value=Array(s.length);let l=[];for(let d=0;d<s.length;d++){let m=s[d],h=t.element._zod.run({value:m,issues:[]},i);h instanceof Promise?l.push(h.then(v=>Ir(v,r,d))):Ir(h,r,d)}return l.length?Promise.all(l).then(()=>r):r}});function tt(e,t,r,i,s){if(e.issues.length){if(s&&!(r in i))return;t.issues.push(...ae(r,e.issues))}e.value===void 0?r in i&&(t.value[r]=void 0):t.value[r]=e.value}o(tt,"handlePropertyResult");function Zo(e){let t=Object.keys(e.shape);for(let i of t)if(!e.shape?.[i]?._zod?.traits?.has("$ZodType"))throw new Error(`Invalid element at key "${i}": expected a Zod schema`);let r=sr(e.shape);return{...e,keys:t,keySet:new Set(t),numKeys:t.length,optionalKeys:new Set(r)}}o(Zo,"normalizeDef");function Fo(e,t,r,i,s,l){let d=[],m=s.keySet,h=s.catchall._zod,v=h.def.type,P=h.optout==="optional";for(let N in t){if(m.has(N))continue;if(v==="never"){d.push(N);continue}let _=h.run({value:t[N],issues:[]},i);_ instanceof Promise?e.push(_.then(a=>tt(a,r,N,t,P))):tt(_,r,N,t,P)}return d.length&&r.issues.push({code:"unrecognized_keys",keys:d,input:t,inst:l}),e.length?Promise.all(e).then(()=>r):r}o(Fo,"handleCatchall");var Dr=I("$ZodObject",(e,t)=>{if(Z.init(e,t),!Object.getOwnPropertyDescriptor(t,"shape")?.get){let m=t.shape;Object.defineProperty(t,"shape",{get:o(()=>{let h={...m};return Object.defineProperty(t,"shape",{value:h}),h},"get")})}let i=Je(()=>Zo(t));V(e._zod,"propValues",()=>{let m=t.shape,h={};for(let v in m){let P=m[v]._zod;if(P.values){h[v]??(h[v]=new Set);for(let N of P.values)h[v].add(N)}}return h});let s=Se,l=t.catchall,d;e._zod.parse=(m,h)=>{d??(d=i.value);let v=m.value;if(!s(v))return m.issues.push({expected:"object",code:"invalid_type",input:v,inst:e}),m;m.value={};let P=[],N=d.shape;for(let _ of d.keys){let a=N[_],c=a._zod.optout==="optional",g=a._zod.run({value:v[_],issues:[]},h);g instanceof Promise?P.push(g.then(p=>tt(p,m,_,v,c))):tt(g,m,_,v,c)}return l?Fo(P,v,m,h,i.value,e):P.length?Promise.all(P).then(()=>m):m}});function Tr(e,t,r,i){for(let l of e)if(l.issues.length===0)return t.value=l.value,t;let s=e.filter(l=>!_e(l));return s.length===1?(t.value=s[0].value,s[0]):(t.issues.push({code:"invalid_union",input:t.value,inst:r,errors:e.map(l=>l.issues.map(d=>se(d,i,Q())))}),t)}o(Tr,"handleUnionResults");var Et=I("$ZodUnion",(e,t)=>{Z.init(e,t),V(e._zod,"optin",()=>t.options.some(s=>s._zod.optin==="optional")?"optional":void 0),V(e._zod,"optout",()=>t.options.some(s=>s._zod.optout==="optional")?"optional":void 0),V(e._zod,"values",()=>{if(t.options.every(s=>s._zod.values))return new Set(t.options.flatMap(s=>Array.from(s._zod.values)))}),V(e._zod,"pattern",()=>{if(t.options.every(s=>s._zod.pattern)){let s=t.options.map(l=>l._zod.pattern);return new RegExp(`^(${s.map(l=>Xe(l.source)).join("|")})$`)}});let r=t.options.length===1,i=t.options[0]._zod.run;e._zod.parse=(s,l)=>{if(r)return i(s,l);let d=!1,m=[];for(let h of t.options){let v=h._zod.run({value:s.value,issues:[]},l);if(v instanceof Promise)m.push(v),d=!0;else{if(v.issues.length===0)return v;m.push(v)}}return d?Promise.all(m).then(h=>Tr(h,s,e,l)):Tr(m,s,e,l)}});var Nr=I("$ZodDiscriminatedUnion",(e,t)=>{t.inclusive=!1,Et.init(e,t);let r=e._zod.parse;V(e._zod,"propValues",()=>{let s={};for(let l of t.options){let d=l._zod.propValues;if(!d||Object.keys(d).length===0)throw new Error(`Invalid discriminated union option at index "${t.options.indexOf(l)}"`);for(let[m,h]of Object.entries(d)){s[m]||(s[m]=new Set);for(let v of h)s[m].add(v)}}return s});let i=Je(()=>{let s=t.options,l=new Map;for(let d of s){let m=d._zod.propValues?.[t.discriminator];if(!m||m.size===0)throw new Error(`Invalid discriminated union option at index "${t.options.indexOf(d)}"`);for(let h of m){if(l.has(h))throw new Error(`Duplicate discriminator value "${String(h)}"`);l.set(h,d)}}return l});e._zod.parse=(s,l)=>{let d=s.value;if(!Se(d))return s.issues.push({code:"invalid_type",expected:"object",input:d,inst:e}),s;let m=i.value.get(d?.[t.discriminator]);return m?m._zod.run(s,l):t.unionFallback?r(s,l):(s.issues.push({code:"invalid_union",errors:[],note:"No matching discriminator",discriminator:t.discriminator,input:d,path:[t.discriminator],inst:e}),s)}});var Cr=I("$ZodRecord",(e,t)=>{Z.init(e,t),e._zod.parse=(r,i)=>{let s=r.value;if(!ir(s))return r.issues.push({expected:"record",code:"invalid_type",input:s,inst:e}),r;let l=[],d=t.keyType._zod.values;if(d){r.value={};let m=new Set;for(let v of d)if(typeof v=="string"||typeof v=="number"||typeof v=="symbol"){m.add(typeof v=="number"?v.toString():v);let P=t.valueType._zod.run({value:s[v],issues:[]},i);P instanceof Promise?l.push(P.then(N=>{N.issues.length&&r.issues.push(...ae(v,N.issues)),r.value[v]=N.value})):(P.issues.length&&r.issues.push(...ae(v,P.issues)),r.value[v]=P.value)}let h;for(let v in s)m.has(v)||(h=h??[],h.push(v));h&&h.length>0&&r.issues.push({code:"unrecognized_keys",input:s,inst:e,keys:h})}else{r.value={};for(let m of Reflect.ownKeys(s)){if(m==="__proto__")continue;let h=t.keyType._zod.run({value:m,issues:[]},i);if(h instanceof Promise)throw new Error("Async schemas not supported in object keys currently");if(typeof m=="string"&&_t.test(m)&&h.issues.length){let N=t.keyType._zod.run({value:Number(m),issues:[]},i);if(N instanceof Promise)throw new Error("Async schemas not supported in object keys currently");N.issues.length===0&&(h=N)}if(h.issues.length){t.mode==="loose"?r.value[m]=s[m]:r.issues.push({code:"invalid_key",origin:"record",issues:h.issues.map(N=>se(N,i,Q())),input:m,path:[m],inst:e});continue}let P=t.valueType._zod.run({value:s[m],issues:[]},i);P instanceof Promise?l.push(P.then(N=>{N.issues.length&&r.issues.push(...ae(m,N.issues)),r.value[h.value]=N.value})):(P.issues.length&&r.issues.push(...ae(m,P.issues)),r.value[h.value]=P.value)}}return l.length?Promise.all(l).then(()=>r):r}});var Ur=I("$ZodEnum",(e,t)=>{Z.init(e,t);let r=ht(t.entries),i=new Set(r);e._zod.values=i,e._zod.pattern=new RegExp(`^(${r.filter(s=>ar.has(typeof s)).map(s=>typeof s=="string"?xe(s):s.toString()).join("|")})$`),e._zod.parse=(s,l)=>{let d=s.value;return i.has(d)||s.issues.push({code:"invalid_value",values:r,input:d,inst:e}),s}}),Mr=I("$ZodLiteral",(e,t)=>{if(Z.init(e,t),t.values.length===0)throw new Error("Cannot create literal schema with no valid values");let r=new Set(t.values);e._zod.values=r,e._zod.pattern=new RegExp(`^(${t.values.map(i=>typeof i=="string"?xe(i):i?xe(i.toString()):String(i)).join("|")})$`),e._zod.parse=(i,s)=>{let l=i.value;return r.has(l)||i.issues.push({code:"invalid_value",values:t.values,input:l,inst:e}),i}});var Lr=I("$ZodTransform",(e,t)=>{Z.init(e,t),e._zod.parse=(r,i)=>{if(i.direction==="backward")throw new He(e.constructor.name);let s=t.transform(r.value,r);if(i.async)return(s instanceof Promise?s:Promise.resolve(s)).then(d=>(r.value=d,r));if(s instanceof Promise)throw new X;return r.value=s,r}});function $r(e,t){return e.issues.length&&t===void 0?{issues:[],value:void 0}:e}o($r,"handleOptionalResult");var jr=I("$ZodOptional",(e,t)=>{Z.init(e,t),e._zod.optin="optional",e._zod.optout="optional",V(e._zod,"values",()=>t.innerType._zod.values?new Set([...t.innerType._zod.values,void 0]):void 0),V(e._zod,"pattern",()=>{let r=t.innerType._zod.pattern;return r?new RegExp(`^(${Xe(r.source)})?$`):void 0}),e._zod.parse=(r,i)=>{if(t.innerType._zod.optin==="optional"){let s=t.innerType._zod.run(r,i);return s instanceof Promise?s.then(l=>$r(l,r.value)):$r(s,r.value)}return r.value===void 0?r:t.innerType._zod.run(r,i)}});var Zr=I("$ZodNullable",(e,t)=>{Z.init(e,t),V(e._zod,"optin",()=>t.innerType._zod.optin),V(e._zod,"optout",()=>t.innerType._zod.optout),V(e._zod,"pattern",()=>{let r=t.innerType._zod.pattern;return r?new RegExp(`^(${Xe(r.source)}|null)$`):void 0}),V(e._zod,"values",()=>t.innerType._zod.values?new Set([...t.innerType._zod.values,null]):void 0),e._zod.parse=(r,i)=>r.value===null?r:t.innerType._zod.run(r,i)});var Fr=I("$ZodPipe",(e,t)=>{Z.init(e,t),V(e._zod,"values",()=>t.in._zod.values),V(e._zod,"optin",()=>t.in._zod.optin),V(e._zod,"optout",()=>t.out._zod.optout),V(e._zod,"propValues",()=>t.in._zod.propValues),e._zod.parse=(r,i)=>{if(i.direction==="backward"){let l=t.out._zod.run(r,i);return l instanceof Promise?l.then(d=>et(d,t.in,i)):et(l,t.in,i)}let s=t.in._zod.run(r,i);return s instanceof Promise?s.then(l=>et(l,t.out,i)):et(s,t.out,i)}});function et(e,t,r){return e.issues.length?(e.aborted=!0,e):t._zod.run({value:e.value,issues:e.issues},r)}o(et,"handlePipeResult");var Vr=I("$ZodCustom",(e,t)=>{ue.init(e,t),Z.init(e,t),e._zod.parse=(r,i)=>r,e._zod.check=r=>{let i=r.value,s=t.fn(i);if(s instanceof Promise)return s.then(l=>Er(l,r,i,e));Er(s,r,i,e)}});function Er(e,t,r,i){if(!e){let s={code:"custom",input:r,inst:i,path:[...i._zod.def.path??[]],continue:!i._zod.def.abort};i._zod.def.params&&(s.params=i._zod.def.params),t.issues.push(xt(s))}}o(Er,"handleRefineResult");var Gr;var bt=class{static{o(this,"$ZodRegistry")}constructor(){this._map=new WeakMap,this._idmap=new Map}add(t,...r){let i=r[0];return this._map.set(t,i),i&&typeof i=="object"&&"id"in i&&this._idmap.set(i.id,t),this}clear(){return this._map=new WeakMap,this._idmap=new Map,this}remove(t){let r=this._map.get(t);return r&&typeof r=="object"&&"id"in r&&this._idmap.delete(r.id),this._map.delete(t),this}get(t){let r=t._zod.parent;if(r){let i={...this.get(r)??{}};delete i.id;let s={...i,...this._map.get(t)};return Object.keys(s).length?s:void 0}return this._map.get(t)}has(t){return this._map.has(t)}};function Wr(){return new bt}o(Wr,"registry");(Gr=globalThis).__zod_globalRegistry??(Gr.__zod_globalRegistry=Wr());var St=globalThis.__zod_globalRegistry;function Hr(e,t){return new e({type:"string",...L(t)})}o(Hr,"_string");function Kr(e,t){return new e({type:"string",coerce:!0,...L(t)})}o(Kr,"_coercedString");function Jr(e,t){return new e({type:"string",format:"url",check:"string_format",abort:!1,...L(t)})}o(Jr,"_url");function Xr(e,t){return new e({type:"number",checks:[],...L(t)})}o(Xr,"_number");function qr(e,t){return new e({type:"number",coerce:!0,checks:[],...L(t)})}o(qr,"_coercedNumber");function Yr(e,t){return new e({type:"number",check:"number_format",abort:!1,format:"safeint",...L(t)})}o(Yr,"_int");function Qr(e,t){return new e({type:"boolean",...L(t)})}o(Qr,"_boolean");function en(e,t){return new e({type:"boolean",coerce:!0,...L(t)})}o(en,"_coercedBoolean");function tn(e,t){return new e({type:"bigint",coerce:!0,...L(t)})}o(tn,"_coercedBigint");function rn(e){return new e({type:"any"})}o(rn,"_any");function nn(e){return new e({type:"unknown"})}o(nn,"_unknown");function on(e,t){return new e({type:"void",...L(t)})}o(on,"_void");function an(e,t){return new e({type:"date",coerce:!0,...L(t)})}o(an,"_coercedDate");function nt(e,t){return new yr({check:"greater_than",...L(t),value:e,inclusive:!0})}o(nt,"_gte");function J(e,t){return new vr({check:"min_length",...L(t),minimum:e})}o(J,"_minLength");function ce(e,t){return new xr({check:"string_format",format:"regex",...L(t),pattern:e})}o(ce,"_regex");function sn(e,t,r){let i=L(r);return i.abort??(i.abort=!0),new e({type:"custom",check:"custom",fn:t,...i})}o(sn,"_custom");var B=I("ZodMiniType",(e,t)=>{if(!e._zod)throw new Error("Uninitialized schema in ZodMiniType.");Z.init(e,t),e.def=t,e.type=t.type,e.parse=(r,i)=>Ye(e,r,i,{callee:e.parse}),e.safeParse=(r,i)=>Ae(e,r,i),e.parseAsync=async(r,i)=>Qe(e,r,i,{callee:e.parseAsync}),e.safeParseAsync=async(r,i)=>Oe(e,r,i),e.check=(...r)=>e.clone({...t,checks:[...t.checks??[],...r.map(i=>typeof i=="function"?{_zod:{check:i,def:{check:"custom"},onattach:[]}}:i)]},{parent:!0}),e.with=e.check,e.clone=(r,i)=>qe(e,r,i),e.brand=()=>e,e.register=((r,i)=>(r.add(e,i),e)),e.apply=r=>r(e)}),it=I("ZodMiniString",(e,t)=>{rt.init(e,t),B.init(e,t)});function n(e){return Hr(it,e)}o(n,"string");var un=I("ZodMiniStringFormat",(e,t)=>{It.init(e,t),it.init(e,t)});var ti=I("ZodMiniURL",(e,t)=>{br.init(e,t),un.init(e,t)});function cn(e){return Jr(ti,e)}o(cn,"url");var at=I("ZodMiniNumber",(e,t)=>{Tt.init(e,t),B.init(e,t)});function G(e){return Xr(at,e)}o(G,"number");var ri=I("ZodMiniNumberFormat",(e,t)=>{Sr.init(e,t),at.init(e,t)});function ln(e){return Yr(ri,e)}o(ln,"int");var zt=I("ZodMiniBoolean",(e,t)=>{$t.init(e,t),B.init(e,t)});function U(e){return Qr(zt,e)}o(U,"boolean");var pn=I("ZodMiniBigInt",(e,t)=>{zr.init(e,t),B.init(e,t)});var ni=I("ZodMiniAny",(e,t)=>{Ar.init(e,t),B.init(e,t)});function Re(){return rn(ni)}o(Re,"any");var oi=I("ZodMiniUnknown",(e,t)=>{Or.init(e,t),B.init(e,t)});function z(){return nn(oi)}o(z,"unknown");var ii=I("ZodMiniVoid",(e,t)=>{kr.init(e,t),B.init(e,t)});function dn(e){return on(ii,e)}o(dn,"_void");var mn=I("ZodMiniDate",(e,t)=>{Rr.init(e,t),B.init(e,t)});var ai=I("ZodMiniArray",(e,t)=>{wr.init(e,t),B.init(e,t)});function k(e,t){return new ai({type:"array",element:e,...L(t)})}o(k,"array");var si=I("ZodMiniObject",(e,t)=>{Dr.init(e,t),B.init(e,t),V(e,"shape",()=>t.shape)});function u(e,t){let r={type:"object",shape:e??{},...L(t)};return new si(r)}o(u,"object");var ui=I("ZodMiniUnion",(e,t)=>{Et.init(e,t),B.init(e,t)});function R(e,t){return new ui({type:"union",options:e,...L(t)})}o(R,"union");var ci=I("ZodMiniDiscriminatedUnion",(e,t)=>{Nr.init(e,t),B.init(e,t)});function le(e,t,r){return new ci({type:"union",options:t,discriminator:e,...L(r)})}o(le,"discriminatedUnion");var li=I("ZodMiniRecord",(e,t)=>{Cr.init(e,t),B.init(e,t)});function A(e,t,r){return new li({type:"record",keyType:e,valueType:t,...L(r)})}o(A,"record");var pi=I("ZodMiniEnum",(e,t)=>{Ur.init(e,t),B.init(e,t),e.options=Object.values(t.entries)});function D(e,t){let r=Array.isArray(e)?Object.fromEntries(e.map(i=>[i,i])):e;return new pi({type:"enum",entries:r,...L(t)})}o(D,"_enum");var di=I("ZodMiniLiteral",(e,t)=>{Mr.init(e,t),B.init(e,t)});function $(e,t){return new di({type:"literal",values:Array.isArray(e)?e:[e],...L(t)})}o($,"literal");var mi=I("ZodMiniTransform",(e,t)=>{Lr.init(e,t),B.init(e,t)});function pe(e){return new mi({type:"transform",transform:e})}o(pe,"transform");var fi=I("ZodMiniOptional",(e,t)=>{jr.init(e,t),B.init(e,t)});function f(e){return new fi({type:"optional",innerType:e})}o(f,"optional");var gi=I("ZodMiniNullable",(e,t)=>{Zr.init(e,t),B.init(e,t)});function we(e){return new gi({type:"nullable",innerType:e})}o(we,"nullable");var yi=I("ZodMiniPipe",(e,t)=>{Fr.init(e,t),B.init(e,t)});function de(e,t){return new yi({type:"pipe",in:e,out:t})}o(de,"pipe");var hi=I("ZodMiniCustom",(e,t)=>{Vr.init(e,t),B.init(e,t)});function st(e,t){return sn(hi,e??(()=>!0),t)}o(st,"custom");var De={};er(De,{bigint:()=>Ti,boolean:()=>Ii,date:()=>$i,number:()=>Pi,string:()=>_i});function _i(e){return Kr(it,e)}o(_i,"string");function Pi(e){return qr(at,e)}o(Pi,"number");function Ii(e){return en(zt,e)}o(Ii,"boolean");function Ti(e){return tn(pn,e)}o(Ti,"bigint");function $i(e){return an(mn,e)}o($i,"date");var Ot=u({retryOnFailure:u({defaultValue:f(U()),hide:f(U())}),continueOnFailure:u({defaultValue:f(U()),hide:f(U())})}),At=class{constructor(t,r,i,s,l,d,m,h,v,P,N){this.name=t;this.displayName=r;this.description=i;this.props=s;this.run=l;this.test=d;this.requireAuth=m;this.errorHandlingOptions=h;this.outputSchema=v;this.audience=P;this.aiMetadata=N}static{o(this,"IAction")}},gn=o(e=>new At(e.name,e.displayName,e.description,e.props,e.run,e.test??e.run,e.requireAuth??!0,e.errorHandlingOptions??{continueOnFailure:{defaultValue:!1},retryOnFailure:{defaultValue:!1}},e.outputSchema,e.audience,e.aiMetadata),"createAction");var C=u({displayName:n(),description:f(n())}),w=o((e,t)=>u({type:$(t),required:U(),defaultValue:f(Re())}),"TPropertyValue");var W=u({...C.shape,...w(n(),"SHORT_TEXT").shape}),ee=u({...C.shape,...w(n(),"LONG_TEXT").shape});var yn=u({label:n(),value:z()}),ut=u({disabled:f(U()),placeholder:f(n()),options:k(yn)});var H=u({...C.shape,options:ut,...w(z(),"STATIC_DROPDOWN").shape}),te=u({...C.shape,options:ut,...w(k(z()),"STATIC_MULTI_SELECT_DROPDOWN").shape});var kt=u({...C.shape,...w(z(),"DROPDOWN").shape,refreshers:k(n())}),Ne=u({...C.shape,...w(k(z()),"MULTI_SELECT_DROPDOWN").shape,refreshers:k(n())});var re=u({...C.shape,...w(U(),"CHECKBOX").shape});var ne=u({...C.shape,...w(G(),"NUMBER").shape});var Ce=u({...C.shape,streaming:f(U()),...w(z(),"FILE").shape});var Ue=u({...C.shape,...w(n(),"DATE_TIME").shape});var hn=A(n(),R([W,ee,H,Ne,te,re,ne,Ce,Ue])),Me=u({...C.shape,properties:hn,...w(k(z()),"ARRAY").shape});var Le=u({...C.shape,...w(R([A(n(),z())]),"JSON").shape});var vn=R([W,H,Le,Me,te]),bi=A(n(),vn),Rt=u({refreshers:k(n()),...C.shape,...w(z(),"DYNAMIC").shape});var ct=u({...C.shape,...w(dn(),"MARKDOWN").shape});var je=(r=>(r.ARCHIVE="ARCHIVE",r.REGISTRY="REGISTRY",r))(je||{}),Pe=(r=>(r.CUSTOM="CUSTOM",r.OFFICIAL="OFFICIAL",r))(Pe||{}),Ie=(y=>(y.ARTIFICIAL_INTELLIGENCE="ARTIFICIAL_INTELLIGENCE",y.COMMUNICATION="COMMUNICATION",y.COMMERCE="COMMERCE",y.CORE="CORE",y.UNIVERSAL_AI="UNIVERSAL_AI",y.FLOW_CONTROL="FLOW_CONTROL",y.BUSINESS_INTELLIGENCE="BUSINESS_INTELLIGENCE",y.ACCOUNTING="ACCOUNTING",y.PRODUCTIVITY="PRODUCTIVITY",y.CONTENT_AND_FILES="CONTENT_AND_FILES",y.DEVELOPER_TOOLS="DEVELOPER_TOOLS",y.CUSTOMER_SUPPORT="CUSTOMER_SUPPORT",y.FORMS_AND_SURVEYS="FORMS_AND_SURVEYS",y.HUMAN_RESOURCES="HUMAN_RESOURCES",y.PAYMENT_PROCESSING="PAYMENT_PROCESSING",y.MARKETING="MARKETING",y.SALES_AND_CRM="SALES_AND_CRM",y))(Ie||{});var Ze=(r=>(r.AUTHORIZATION_CODE="authorization_code",r.CLIENT_CREDENTIALS="client_credentials",r))(Ze||{}),wt="both_client_credentials_and_authorization_code";var fe=(s=>(s.POLLING="POLLING",s.WEBHOOK="WEBHOOK",s.APP_WEBHOOK="APP_WEBHOOK",s.MANUAL="MANUAL",s))(fe||{}),Fe=(l=>(l.NONE="NONE",l.HEADER_PRESENT="HEADER_PRESENT",l.QUERY_PRESENT="QUERY_PRESENT",l.BODY_PARAM_PRESENT="BODY_PARAM_PRESENT",l.HEAD_REQUEST="HEAD_REQUEST",l))(Fe||{}),Si=u({strategy:D(Fe),paramName:f(n())}),Ve=(r=>(r.SIMULATION="SIMULATION",r.TEST_FUNCTION="TEST_FUNCTION",r))(Ve||{});var lt=(r=>(r.WEBSOCKET="WEBSOCKET",r.NONE="NONE",r))(lt||{}),xn=u({status:f(G()),body:f(z()),headers:f(A(n(),n()))}),_n=u({type:$("DELAY"),resumeDateTime:n(),requestIdToReply:f(n()),handlerId:f(n()),streamStepProgress:f(D(lt))}),Pn=u({type:$("WEBHOOK"),requestId:n(),requestIdToReply:f(n()),response:xn,handlerId:f(n()),streamStepProgress:f(D(lt))}),zi=R([_n,Pn]);var Ai=u({body:z(),rawBody:f(z()),headers:A(n(),n()),queryParams:A(n(),n())});var Dt=We(require("crypto"),1);var Oi=128,ye,Te,ki=o(e=>{!ye||ye.length<e?(ye=Buffer.allocUnsafe(e*Oi),Dt.default.randomFillSync(ye),Te=0):Te+e>ye.length&&(Dt.default.randomFillSync(ye),Te=0),Te+=e},"fillPool"),Ri=o(e=>(ki(e|=0),ye.subarray(Te-e,Te)),"random"),wi=o((e,t,r)=>{let i=(2<<31-Math.clz32(e.length-1|1))-1,s=Math.ceil(1.6*i*t/e.length);return(l=t)=>{let d="";for(;;){let m=r(s),h=s;for(;h--;)if(d+=e[m[h]&i]||"",d.length===l)return d}}},"customRandom"),Tn=o((e,t=21)=>wi(e,t,Ri),"customAlphabet");var Di="0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz",$n=21,Fy=n().check(ce(new RegExp(`^[0-9a-zA-Z]{${$n}}$`))),Ni=Tn(Di,$n);var me=de(pe(e=>e instanceof Date?e.toISOString():e),n()),K={id:n(),created:me,updated:me},j=o(e=>f(we(e)),"Nullable");function Nt(e){return f(we(D(e)))}o(Nt,"NullableEnum");var Gy=de(pe(e=>e==="true"||e===!0?!0:e==="false"||e===!1?!1:void 0),f(U())),pt=o(e=>de(pe(t=>Array.isArray(t)?t:t!==void 0?[t]:void 0),f(k(e))),"OptionalArrayFromQuery");var Ky=A(n(),z());var Be=(P=>(P.OPENAI="openai",P.OPENROUTER="openrouter",P.ANTHROPIC="anthropic",P.AZURE="azure",P.GOOGLE="google",P.ACTIVEPIECES="activepieces",P.CLOUDFLARE_GATEWAY="cloudflare-gateway",P.CUSTOM="custom",P.BEDROCK="bedrock",P.MISTRAL="mistral",P))(Be||{});var ah=n().check(ce(/^#[0-9A-Fa-f]{6}$/));var uh=u({filename:n(),data:z(),type:$("file"),mimetype:f(n())});var Ci=We(bn());var gh=u({...K,name:n(),permissions:k(n()),platformId:j(n()),type:n(),userCount:f(G())});var Sn=(i=>(i.AGENT_DECIDE="agent-decide",i.CHOOSE_YOURSELF="choose-yourself",i.LEAVE_EMPTY="leave-empty",i))(Sn||{}),Ct=(r=>(r.FILE="FILE",r.TABLE="TABLE",r))(Ct||{}),Ut=(i=>(i.SSE="sse",i.STREAMABLE_HTTP="streamable-http",i.SIMPLE_HTTP="http",i))(Ut||{});var Mt=(i=>(i.TEXT="text",i.NUMBER="number",i.BOOLEAN="boolean",i))(Mt||{});var Lt=(r=>(r.IN_PROGRESS="in-progress",r.COMPLETED="completed",r))(Lt||{});var Ui=u({mode:D(Sn),value:z()}),Mi=u({auth:f(n()),fields:A(n(),Ui)}),Li=u({pieceName:n(),pieceVersion:n(),actionName:n(),predefinedInput:f(Mi)}),ji=u({type:$("PIECE"),toolName:n().check(J(1)),pieceMetadata:Li}),Zi=u({type:$("none")}),Fi=u({type:$("access_token"),accessToken:n()}),Vi=u({type:$("api_key"),apiKey:n(),apiKeyHeader:n()}),Bi=u({type:$("headers"),headers:A(n(),n())}),Gi=le("type",[Zi,Fi,Vi,Bi]),zn=u({type:$("FLOW"),toolName:n().check(J(1)),externalFlowId:n(),flowDisplayName:f(n())}),An=u({type:$("MCP"),toolName:n().check(J(1)),serverUrl:cn(),protocol:D(Ut),auth:Gi}),On=u({type:$("KNOWLEDGE_BASE"),toolName:n().check(J(1)),sourceType:D(Ct),sourceId:n(),sourceName:n()}),Wi=le("type",[ji,zn,An,On]),Hi=u({displayName:n(),description:f(n()),type:D(Mt)}),kn=u({type:$("MARKDOWN"),markdown:n()}),$e={type:$("TOOL_CALL"),input:j(A(n(),z())),output:f(z()),toolName:n(),status:D(Lt),toolCallId:n(),startTime:n(),endTime:f(n())},Wh=u($e),Rn=le("toolCallType",[u({...$e,toolCallType:$("PIECE"),pieceName:n(),pieceVersion:n(),actionName:n()}),u({...$e,toolCallType:$("FLOW"),displayName:n(),externalFlowId:n()}),u({...$e,toolCallType:$("MCP"),displayName:n(),serverUrl:n()}),u({...$e,toolCallType:$("KNOWLEDGE_BASE"),displayName:n(),sourceType:n()}),u({...$e,toolCallType:$("UNKNOWN"),displayName:n()})]),Ki=R([kn,Rn]);var jt=(r=>(r.IMAGE="image",r.TEXT="text",r))(jt||{}),oe=u({apiKey:n()}),Ji=oe,Xi=u({apiKey:n(),apiKeyHash:n()}),qi=oe,Yi=oe,Qi=oe,ea=oe,ta=oe,ra=oe,na=oe,Un=u({accessKeyId:n().check(J(1)),secretAccessKey:n().check(J(1))}),oa=u({}),ia=u({}),aa=u({}),sa=u({}),ua=u({}),ca=u({}),Mn=u({modelId:n(),modelName:n(),modelType:D(jt)}),Ln=u({apiKeyHeader:n(),baseUrl:n(),models:k(Mn),defaultHeaders:f(A(n(),n()))}),jn=u({accountId:n(),gatewayId:n(),models:k(Mn),vertexProject:f(n()),vertexRegion:f(n())}),Zn=u({resourceName:n(),apiVersion:de(pe(e=>typeof e=="string"&&e.trim().length===0?void 0:e),f(n()))}),Fn=u({region:n().check(J(1))}),la=R([Ji,Qi,ea,ta,ra,Yi,qi,Xi,Un,na]),Vn=R([Ln,jn,Zn,Fn,oa,aa,sa,ua,ia,ca]),pa=u({id:n(),name:n(),type:D(jt)}),da=u({id:n(),name:n(),provider:D(Be),config:Vn,enabledForChat:U()}),ma=u({provider:D(Be),config:Vn,auth:la,platformId:n()});var Xh={openai:"openai",anthropic:"anthropic","google-ai-studio":"google","google-vertex-ai":"google"},wn=["gpt-5.5","gpt-5.4-mini","gpt-5.4-nano","gpt-4.1","gpt-4.1-mini"],fa=["claude-sonnet-4-6","claude-opus-4-7","claude-haiku-4-5"],ga=["claude-sonnet-4.6","claude-opus-4.7","claude-haiku-4.5"],Dn=["gemini-2.5-pro","gemini-2.5-flash","gemini-3.1-pro-preview","gemini-3-flash-preview"],ya=["grok-4.20","grok-4.1-fast"],ha={openai:wn,anthropic:fa,google:Dn,activepieces:[...ga.map(e=>`anthropic/${e}`),...wn.map(e=>`openai/${e}`),...Dn.map(e=>`google/${e}`),...ya.map(e=>`x-ai/${e}`)]};var Nn=128e3,va={openai:128e3,anthropic:2e5,google:1048576,bedrock:2e5,azure:128e3,openrouter:128e3,activepieces:2e5,mistral:128e3};function xa({provider:e}){return e?va[e]??Nn:Nn}o(xa,"getMaxContextTokens");var Cn={openai:"text-embedding-3-small",google:"text-embedding-004",azure:"text-embedding-3-small",activepieces:"text-embedding-3-small",openrouter:"openai/text-embedding-3-small"},_a={anthropic:"native",google:"native",openrouter:"plugin",activepieces:"plugin"},Pa=new Set(["anthropic","mistral"]);function q(e){return{chatModels:ha[e],maxContextTokens:xa({provider:e}),defaultEmbeddingModel:Cn[e],supportsEmbedding:Cn[e]!==void 0,supportsImageGeneration:!Pa.has(e),webSearch:_a[e]}}o(q,"buildProviderCapabilities");var Ia={openai:q("openai"),anthropic:q("anthropic"),openrouter:q("openrouter"),azure:q("azure"),google:q("google"),"cloudflare-gateway":q("cloudflare-gateway"),custom:q("custom"),bedrock:q("bedrock"),mistral:q("mistral"),activepieces:q("activepieces")};var Ta=u({base64Url:n(),fileName:n(),extension:f(n())}),$a=u({mimeType:n(),url:n(),fileName:f(n())}),Zt=R([Ta,$a]);var Ea=R([u({type:$("file"),value:Zt}),u({type:$("markdown"),value:n(),files:f(k(Zt))})]),ba=u({sessionId:n(),message:n(),files:f(k(n()))});var Gn=(r=>(r.ON_NEW_RECORD="ON_NEW_RECORD",r.ON_UPDATE_RECORD="ON_UPDATE_RECORD",r))(Gn||{}),Wn=(r=>(r.ENABLED="ENABLED",r.DISABLED="DISABLED",r))(Wn||{}),Ft=(i=>(i.RECORD_CREATED="RECORD_CREATED",i.RECORD_UPDATED="RECORD_UPDATED",i.RECORD_DELETED="RECORD_DELETED",i))(Ft||{});var Sa=R([u({...K,name:n(),externalId:n(),type:$("STATIC_DROPDOWN"),tableId:n(),projectId:n(),data:u({options:k(u({value:n()}))})}),u({...K,name:n(),externalId:n(),type:R([$("TEXT"),$("NUMBER"),$("DATE")]),tableId:n(),projectId:n()})]),za=u({...K,name:n(),folderId:j(n()),projectId:n(),externalId:n(),status:Nt(Wn),trigger:Nt(Gn)}),Aa=u({...K,tableId:n(),projectId:n(),cells:A(n(),u({updated:n(),created:n(),value:z(),fieldName:n()}))}),Oa=u({events:k(D(Ft)),webhookUrl:n(),flowId:n()}),ka=u({fields:k(u({id:n(),name:n()})),rows:k(A(n(),n())),name:n()}),Ra=u({projectId:n(),limit:f(De.number()),cursor:f(n()),name:f(n()),externalIds:pt(n()),folderId:f(n()),folderIds:pt(n())}),wa=u({records:k(k(u({fieldId:n(),value:Kn()}))),tableId:n()}),Da=u({cells:f(k(u({fieldId:n(),value:Kn()}))),tableId:n(),agentUpdate:f(U())}),Hn=le("operator",[he("eq"),he("neq"),he("gt"),he("gte"),he("lt"),he("lte"),he("co"),Bn("exists"),Bn("not_exists")]),Na=u({tableId:n(),limit:f(De.number()),cursor:f(n()),filters:pt(Hn)});function Kn(){return de(pe(e=>e==null?e:String(e)),we(n()))}o(Kn,"coerceToString");function he(e){return u({fieldId:n(),operator:$(e),value:n()})}o(he,"valueFilter");function Bn(e){return u({fieldId:n(),operator:$(e)})}o(Bn,"existenceFilter");var Ca=u({status:f(G()),body:f(z()),headers:f(A(n(),n()))}),Ua=u({...K,deleted:j(me),ownerId:n(),displayName:n(),platformId:n(),externalId:j(n())});var Jn=u({name:n(),description:f(n()),type:n(),required:U()}),Ma=u({pieceName:n(),triggerName:n(),input:u({toolName:n(),toolDescription:n(),inputSchema:k(Jn),returnsResponse:U()})});var Xn="^[0-9]+\\.[0-9]+\\.[0-9]+$",gv=new RegExp(Xn),ja="^([~^])?[0-9]+\\.[0-9]+\\.[0-9]+$",yv=n().check(ce(new RegExp(Xn))),hv=n().check(ce(new RegExp(ja))),Za=u({packageType:$("ARCHIVE"),pieceType:D(Pe),pieceName:n(),pieceVersion:n(),archiveId:n(),platformId:n()}),qn=u({packageType:$("REGISTRY"),pieceType:$("OFFICIAL"),pieceName:n(),pieceVersion:n()}),Yn=u({packageType:$("REGISTRY"),pieceType:$("CUSTOM"),pieceName:n(),pieceVersion:n(),platformId:n()}),vv=R([qn,Yn]),xv=R([Za,qn,Yn]);var Fa=le("type",[u({type:$("CRON_EXPRESSION"),cronExpression:n(),timezone:n()}),u({type:$("INTERVAL"),intervalMs:ln().check(nt(6e4))})]),_v=u({...K,type:D(fe),projectId:n(),flowId:n(),triggerName:n(),schedule:j(Fa),flowVersionId:n(),pieceName:n(),pieceVersion:n(),deleted:j(n()),simulate:U()}),Qn=(p=>(p.UNKNOWN="UNKNOWN",p.FLOW_RUN_LOG="FLOW_RUN_LOG",p.FLOW_RUN_LOG_SLICE="FLOW_RUN_LOG_SLICE",p.PACKAGE_ARCHIVE="PACKAGE_ARCHIVE",p.FLOW_STEP_FILE="FLOW_STEP_FILE",p.SAMPLE_DATA="SAMPLE_DATA",p.TRIGGER_PAYLOAD="TRIGGER_PAYLOAD",p.SAMPLE_DATA_INPUT="SAMPLE_DATA_INPUT",p.TRIGGER_EVENT_FILE="TRIGGER_EVENT_FILE",p.PROJECT_RELEASE="PROJECT_RELEASE",p.FLOW_VERSION_BACKUP="FLOW_VERSION_BACKUP",p.PLATFORM_ASSET="PLATFORM_ASSET",p.USER_PROFILE_PICTURE="USER_PROFILE_PICTURE",p.WEBHOOK_PAYLOAD="WEBHOOK_PAYLOAD",p.KNOWLEDGE_BASE="KNOWLEDGE_BASE",p.FLOW_BUNDLE="FLOW_BUNDLE",p))(Qn||{}),eo=(r=>(r.NONE="NONE",r.ZSTD="ZSTD",r))(eo||{}),to=(r=>(r.S3="S3",r.DB="DB",r))(to||{}),Pv=u({...K,projectId:j(n()),platformId:j(n()),type:D(Qn),compression:D(eo),data:f(z()),location:D(to),size:j(G()),fileName:j(n()),s3Key:j(n()),metadata:j(A(n(),n()))}),ro=(i=>(i.ADMIN="ADMIN",i.MEMBER="MEMBER",i.OPERATOR="OPERATOR",i))(ro||{}),no=(r=>(r.ACTIVE="ACTIVE",r.INACTIVE="INACTIVE",r))(no||{}),Iv=u({id:n(),email:n(),firstName:n(),status:D(no),externalId:j(n()),platformId:j(n()),platformRole:D(ro),lastName:n(),created:me,updated:me,lastActiveDate:j(me),imageUrl:j(n())});var Vt=u({...C.shape,...w(A(n(),z()),"OBJECT").shape});var so=u({...C.shape,...w(n(),"COLOR").shape});var Bt=R([W,ee,ct,re,H,te,kt,Ne,Rt,ne,Me,Vt,Le,Ue,Ce,so]),ie={ShortText(e){return{...e,valueSchema:void 0,type:"SHORT_TEXT"}},Checkbox(e){return{...e,valueSchema:void 0,type:"CHECKBOX"}},LongText(e){return{...e,valueSchema:void 0,type:"LONG_TEXT"}},MarkDown(e){return{displayName:"Markdown",required:!1,description:e.value,type:"MARKDOWN",valueSchema:void 0,variant:e.variant??"INFO"}},Number(e){return{...e,valueSchema:void 0,type:"NUMBER"}},Json(e){return{...e,valueSchema:void 0,type:"JSON"}},Array(e){return{...e,valueSchema:void 0,type:"ARRAY"}},Object(e){return{...e,valueSchema:void 0,type:"OBJECT"}},Dropdown(e){return{...e,valueSchema:void 0,type:"DROPDOWN"}},StaticDropdown(e){return{...e,valueSchema:void 0,type:"STATIC_DROPDOWN"}},MultiSelectDropdown(e){return{...e,valueSchema:void 0,type:"MULTI_SELECT_DROPDOWN"}},DynamicProperties(e){return{...e,valueSchema:void 0,type:"DYNAMIC"}},StaticMultiSelectDropdown(e){return{...e,valueSchema:void 0,type:"STATIC_MULTI_SELECT_DROPDOWN"}},DateTime(e){return{...e,valueSchema:void 0,type:"DATE_TIME"}},File(e){return{...e,valueSchema:void 0,type:"FILE"}},Custom(e){let t=e.code.toString();return{...e,code:t,valueSchema:void 0,type:"CUSTOM"}},Color(e){return{...e,valueSchema:void 0,type:"COLOR"}}};var Y=u({displayName:n(),description:f(n())});var uo=u({username:n(),password:n()}),Gt=u({...Y.shape,username:u({displayName:n(),description:f(n())}),password:u({displayName:n(),description:f(n())}),...w(uo,"BASIC_AUTH").shape});var Wa=A(n(),R([W,ee,ne,re,H])),Wt=u({...Y.shape,props:Wa,...w(z(),"CUSTOM_AUTH").shape});var ve=u({...Y.shape,...w(u({auth:n()}),"SECRET_TEXT").shape});var Ha=A(n(),R([W,ee,ve,ne,re,H,te,ct])),co=u({...Y.shape,props:Ha,...w(z(),"OIDC").shape});var Ht=(r=>(r.HEADER="HEADER",r.BODY="BODY",r))(Ht||{}),lo=R([W,ve,H]),po=A(n(),lo),Ka=u({props:f(A(n(),lo)),authUrl:n(),tokenUrl:n(),scope:k(n()),prompt:f(R([$("none"),$("consent"),$("login"),$("omit")])),pkce:f(U()),pkceMethod:f(R([$("plain"),$("S256")])),authorizationMethod:f(D(Ht)),grantType:f(R([D(Ze),$(wt)])),extra:f(A(n(),n()))}),mo=u({access_token:n(),props:f(po),data:A(n(),Re())}),Kt=u({...Y.shape,...Ka.shape,...w(mo,"OAUTH2").shape});var Ee=R([Gt,Wt,co,Kt,ve]),Ge="Connection",Jt={SecretText(e){return{...e,valueSchema:void 0,type:"SECRET_TEXT"}},OAuth2(e){return{...e,valueSchema:void 0,type:"OAUTH2",displayName:e.displayName||Ge}},BasicAuth(e){return{...e,valueSchema:void 0,type:"BASIC_AUTH",displayName:e.displayName||Ge,required:!0}},CustomAuth(e){return{...e,valueSchema:void 0,type:"CUSTOM_AUTH",displayName:e.displayName||Ge}},OIDC(e){return{...e,valueSchema:void 0,type:"OIDC",displayName:e.displayName||Ge}},None(){}};var e_={OAUTH2:"OAUTH2",CLOUD_OAUTH2:"OAUTH2",PLATFORM_OAUTH2:"OAUTH2",BASIC_AUTH:"BASIC_AUTH",CUSTOM_AUTH:"CUSTOM_AUTH",OIDC:"OIDC",SECRET_TEXT:"SECRET_TEXT",NO_AUTH:void 0};var Ja=u({...C.shape,...w(z(),"CUSTOM").shape,code:n()});var qa=R([Bt,Ee]),Xt=A(n(),qa),__=A(n(),Bt);var fo=R([u({strategy:$("CRON"),cronExpression:n()}),u({strategy:$("NONE")})]);var go="2",mt="0.82.0";var qt=class{constructor(t,r,i,s,l,d,m,h,v=mt,P,N="",_){this.displayName=t;this.logoUrl=r;this.authors=i;this.events=s;this.categories=m;this.auth=h;this.minimumSupportedRelease=v;this.maximumSupportedRelease=P;this.description=N;this.deprecated=_;this._actions={};this._triggers={};this.getContextInfo=o(()=>({version:go}),"getContextInfo");(!Ya(v)||Qa(v,mt))&&(this.minimumSupportedRelease=mt),l.forEach(a=>this._actions[a.name]=a),d.forEach(a=>this._triggers[a.name]=a)}static{o(this,"Piece")}metadata(){return{displayName:this.displayName,logoUrl:this.logoUrl,actions:this._actions,triggers:this._triggers,categories:this.categories,description:this.description,authors:this.authors,auth:this.auth,minimumSupportedRelease:this.minimumSupportedRelease,maximumSupportedRelease:this.maximumSupportedRelease,deprecated:this.deprecated,contextInfo:this.getContextInfo?.()}}getAction(t){return this._actions[t]}getTrigger(t){return this._triggers[t]}actions(){return this._actions}triggers(){return this._triggers}},yo=o(e=>{if(e.auth&&Array.isArray(e.auth)&&!e.auth.every((r,i,s)=>i===s.findIndex(l=>l.type===r.type)))throw new Error("Auth properties must be unique by type");return new qt(e.displayName,e.logoUrl,e.authors??[],e.events,e.actions,e.triggers,e.categories??[],e.auth,e.minimumSupportedRelease,e.maximumSupportedRelease,e.description,e.deprecated)},"createPiece");function Ya(e){return/^\d+\.\d+\.\d+$/.test(e)}o(Ya,"isValidSimpleSemver");function Qa(e,t){let[r,i,s]=e.split(".").map(Number),[l,d,m]=t.split(".").map(Number);return r!==l?r<l:i!==d?i<d:s<m}o(Qa,"isSemverLessThan");var es=f(A(n(),A(n(),n()))),ho=u({id:f(n()),name:n(),displayName:n(),logoUrl:n(),description:n(),authors:k(n()),platformId:f(n()),directoryPath:f(n()),auth:f(R([Ee,k(Ee)])),version:n(),categories:f(k(D(Ie))),minimumSupportedRelease:f(n()),maximumSupportedRelease:f(n()),deprecated:f(U()),i18n:es}),ts=D(["human","ai","both"]),vo=u({description:f(n()),idempotent:f(U())}),xo=u({name:n(),displayName:n(),description:n(),props:Xt,requireAuth:U(),errorHandlingOptions:f(Ot),outputSchema:f(st()),audience:f(ts),aiMetadata:f(vo)}),_o=u({name:n(),displayName:n(),description:n(),props:Xt,errorHandlingOptions:f(Ot),type:D(fe),sampleData:z(),handshakeConfiguration:f(st()),renewConfiguration:f(fo),testStrategy:D(Ve),outputSchema:f(st()),aiMetadata:f(vo)}),rs=u({...ho.shape,actions:A(n(),xo),triggers:A(n(),_o)}),ns=u({...ho.shape,actions:G(),triggers:G(),suggestedActions:f(k(xo)),suggestedTriggers:f(k(_o))}),Po=u({projectUsage:G(),pieceType:D(Pe),packageType:D(je),platformId:f(n()),archiveId:f(n())}),_P=u({...rs.shape,...Po.shape}),PP=u({...ns.shape,...Po.shape}),IP=u({name:n(),version:n()});var os=We(require("path")),is=We(require("fs/promises"));var Io=require("@duckdb/node-api"),To=gn({name:"createAndQueryDB",displayName:"Create and Query DB",description:"Create DB from data and run query",audience:"both",aiMetadata:{description:"Spins up a throwaway in-memory DuckDB, loads one or more tables from supplied JSON arrays (column names taken from object keys; schema can be given explicitly or autodetected), then runs a SQL query against them and returns the rows. Use to run SQL joins, aggregations, or transforms over JSON data you already have in the flow, without any external database. Use parameterized placeholders ($1, $2, ...) with the args list rather than interpolating values into the query string. Read-only with respect to external systems: the database exists only for this call, so repeating with the same input yields the same result.",idempotent:!0},props:{markdown:ie.MarkDown({value:`
|
|
2
|
+
**DO NOT** insert dynamic input directly into the query string. Instead, use $1, $2, $3 and add them in args for parameterized queries to prevent **SQL injection.**`}),tables:ie.Array({displayName:"Tables",description:"List of tables to create in the database",required:!0,properties:{name:ie.ShortText({displayName:"Table Name",description:"Name of the table to create",required:!0}),data:ie.Json({displayName:"JSON Data",description:"Table data in the form of a JSON array of objects. Object keys would be taken as column names.",required:!0,defaultValue:[]}),schema:ie.Json({displayName:"Schema in JSON format",description:`
|
|
3
|
+
Provide the schema as a JSON object. Note that only the specified columns would be loaded.
|
|
4
|
+
Leave empty to autodetect schema, although it is recommended to specify the schema for consistency and avoid unexpected behaviour.
|
|
5
|
+
|
|
6
|
+
More information on data types and accepted values:
|
|
7
|
+
- https://duckdb.org/2023/03/03/json
|
|
8
|
+
- https://duckdb.org/docs/stable/sql/data_types/overview
|
|
9
|
+
`.trim(),required:!1,defaultValue:{}})}}),query:ie.ShortText({displayName:"Query",description:"Please use $1, $2, etc. for parameterized queries to avoid SQL injection.",required:!0}),args:ie.Array({displayName:"Arguments",description:"Arguments to be used in the query",required:!1})},async run(e){let r=await(await Io.DuckDBInstance.create(":memory:")).connect();await r.run(`
|
|
10
|
+
SET enable_logging = 0;
|
|
11
|
+
SET enable_external_access = false;
|
|
12
|
+
SET lock_configuration = true;
|
|
13
|
+
`);let i=e.propsValue.tables??[];for(let h of i){let v=JSON.stringify(h.data),P=null;h.schema?P=JSON.stringify([h.schema]):P=(await(await r.run("SELECT json_structure($sourceData) AS schema",{sourceData:v})).getRows())[0][0],await r.run(`
|
|
14
|
+
CREATE TABLE ${h.name} AS
|
|
15
|
+
SELECT UNNEST(JSON_TRANSFORM($sourceData, $sourceSchema), recursive := true);
|
|
16
|
+
`,{sourceData:v,sourceSchema:P})}let s=e.propsValue.args??[],l={};for(let h=0;h<s.length;h++){let v=(h+1).toString();l[v]=s[h]}let m=(await r.runAndReadAll(e.propsValue.query,l)).getRowObjectsJson();return r.closeSync(),m}});var as=yo({displayName:"DuckDB",auth:Jt.None(),minimumSupportedRelease:"0.36.1",logoUrl:"https://cdn.activepieces.com/pieces/duckdb.png",description:"Run SQL queries on an in-memory DuckDB database.",categories:["DEVELOPER_TOOLS"],authors:["danielpoonwj"],actions:[To],triggers:[]});0&&(module.exports={duckdb});
|
package/src/index.d.ts
DELETED
package/src/index.d.ts.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAKA,eAAO,MAAM,MAAM,2DAUjB,CAAC"}
|
package/src/index.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":";;;AAAA,qEAAwE;AAExE,2EAAqE;AACrE,iDAAqD;AAExC,QAAA,MAAM,GAAG,IAAA,8BAAW,EAAC;IAChC,WAAW,EAAE,QAAQ;IACrB,IAAI,EAAE,4BAAS,CAAC,IAAI,EAAE;IACtB,uBAAuB,EAAE,QAAQ;IACjC,OAAO,EAAE,gDAAgD;IACzD,WAAW,EAAE,kDAAkD;IAC/D,UAAU,EAAE,CAAC,sBAAa,CAAC,eAAe,CAAC;IAC3C,OAAO,EAAE,CAAC,cAAc,CAAC;IACzB,OAAO,EAAE,CAAC,sCAAgB,CAAC;IAC3B,QAAQ,EAAE,EAAE;CACb,CAAC,CAAC"}
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
export declare const createAndQueryDB: import("@activepieces/pieces-framework").IAction<import("@activepieces/pieces-framework").PieceAuthProperty, {
|
|
2
|
-
markdown: import("@activepieces/pieces-framework/dist/src/lib/property/input/markdown-property").MarkDownProperty;
|
|
3
|
-
tables: import("@activepieces/pieces-framework").ArrayProperty<true> | import("@activepieces/pieces-framework").ArrayProperty<false>;
|
|
4
|
-
query: import("@activepieces/pieces-framework").ShortTextProperty<true>;
|
|
5
|
-
args: import("@activepieces/pieces-framework").ArrayProperty<false>;
|
|
6
|
-
}>;
|
|
7
|
-
//# sourceMappingURL=create-and-query-db.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"create-and-query-db.d.ts","sourceRoot":"","sources":["../../../../src/lib/actions/create-and-query-db.ts"],"names":[],"mappings":"AAIA,eAAO,MAAM,gBAAgB;;;;;EAmH3B,CAAC"}
|
|
@@ -1,106 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.createAndQueryDB = void 0;
|
|
4
|
-
const tslib_1 = require("tslib");
|
|
5
|
-
const pieces_framework_1 = require("@activepieces/pieces-framework");
|
|
6
|
-
const node_api_1 = require("@duckdb/node-api");
|
|
7
|
-
exports.createAndQueryDB = (0, pieces_framework_1.createAction)({
|
|
8
|
-
name: 'createAndQueryDB',
|
|
9
|
-
displayName: 'Create and Query DB',
|
|
10
|
-
description: 'Create DB from data and run query',
|
|
11
|
-
audience: 'both',
|
|
12
|
-
aiMetadata: {
|
|
13
|
-
description: 'Spins up a throwaway in-memory DuckDB, loads one or more tables from supplied JSON arrays (column names taken from object keys; schema can be given explicitly or autodetected), then runs a SQL query against them and returns the rows. Use to run SQL joins, aggregations, or transforms over JSON data you already have in the flow, without any external database. Use parameterized placeholders ($1, $2, ...) with the args list rather than interpolating values into the query string. Read-only with respect to external systems: the database exists only for this call, so repeating with the same input yields the same result.',
|
|
14
|
-
idempotent: true,
|
|
15
|
-
},
|
|
16
|
-
props: {
|
|
17
|
-
markdown: pieces_framework_1.Property.MarkDown({
|
|
18
|
-
value: `
|
|
19
|
-
**DO NOT** insert dynamic input directly into the query string. Instead, use $1, $2, $3 and add them in args for parameterized queries to prevent **SQL injection.**`,
|
|
20
|
-
}),
|
|
21
|
-
tables: pieces_framework_1.Property.Array({
|
|
22
|
-
displayName: 'Tables',
|
|
23
|
-
description: 'List of tables to create in the database',
|
|
24
|
-
required: true,
|
|
25
|
-
properties: {
|
|
26
|
-
name: pieces_framework_1.Property.ShortText({
|
|
27
|
-
displayName: 'Table Name',
|
|
28
|
-
description: 'Name of the table to create',
|
|
29
|
-
required: true,
|
|
30
|
-
}),
|
|
31
|
-
data: pieces_framework_1.Property.Json({
|
|
32
|
-
displayName: 'JSON Data',
|
|
33
|
-
description: 'Table data in the form of a JSON array of objects. Object keys would be taken as column names.',
|
|
34
|
-
required: true,
|
|
35
|
-
defaultValue: [],
|
|
36
|
-
}),
|
|
37
|
-
schema: pieces_framework_1.Property.Json({
|
|
38
|
-
displayName: 'Schema in JSON format',
|
|
39
|
-
description: `
|
|
40
|
-
Provide the schema as a JSON object. Note that only the specified columns would be loaded.
|
|
41
|
-
Leave empty to autodetect schema, although it is recommended to specify the schema for consistency and avoid unexpected behaviour.
|
|
42
|
-
|
|
43
|
-
More information on data types and accepted values:
|
|
44
|
-
- https://duckdb.org/2023/03/03/json
|
|
45
|
-
- https://duckdb.org/docs/stable/sql/data_types/overview
|
|
46
|
-
`.trim(),
|
|
47
|
-
required: false,
|
|
48
|
-
defaultValue: {},
|
|
49
|
-
}),
|
|
50
|
-
},
|
|
51
|
-
}),
|
|
52
|
-
query: pieces_framework_1.Property.ShortText({
|
|
53
|
-
displayName: 'Query',
|
|
54
|
-
description: 'Please use $1, $2, etc. for parameterized queries to avoid SQL injection.',
|
|
55
|
-
required: true,
|
|
56
|
-
}),
|
|
57
|
-
args: pieces_framework_1.Property.Array({
|
|
58
|
-
displayName: 'Arguments',
|
|
59
|
-
description: 'Arguments to be used in the query',
|
|
60
|
-
required: false,
|
|
61
|
-
}),
|
|
62
|
-
},
|
|
63
|
-
run(context) {
|
|
64
|
-
return tslib_1.__awaiter(this, void 0, void 0, function* () {
|
|
65
|
-
var _a, _b;
|
|
66
|
-
const instance = yield node_api_1.DuckDBInstance.create(':memory:');
|
|
67
|
-
const connection = yield instance.connect();
|
|
68
|
-
yield connection.run(`
|
|
69
|
-
SET enable_logging = 0;
|
|
70
|
-
SET enable_external_access = false;
|
|
71
|
-
SET lock_configuration = true;
|
|
72
|
-
`);
|
|
73
|
-
const dbTables = (_a = context.propsValue.tables) !== null && _a !== void 0 ? _a : [];
|
|
74
|
-
for (const dbTable of dbTables) {
|
|
75
|
-
const dbData = JSON.stringify(dbTable.data);
|
|
76
|
-
let dbSchema = null;
|
|
77
|
-
if (dbTable.schema) {
|
|
78
|
-
dbSchema = JSON.stringify([dbTable.schema]);
|
|
79
|
-
}
|
|
80
|
-
else {
|
|
81
|
-
const schemaResult = yield connection.run('SELECT json_structure($sourceData) AS schema', { sourceData: dbData });
|
|
82
|
-
const detectedSchema = yield schemaResult.getRows();
|
|
83
|
-
dbSchema = detectedSchema[0][0];
|
|
84
|
-
}
|
|
85
|
-
yield connection.run(`
|
|
86
|
-
CREATE TABLE ${dbTable.name} AS
|
|
87
|
-
SELECT UNNEST(JSON_TRANSFORM($sourceData, $sourceSchema), recursive := true);
|
|
88
|
-
`, {
|
|
89
|
-
sourceData: dbData,
|
|
90
|
-
sourceSchema: dbSchema,
|
|
91
|
-
});
|
|
92
|
-
}
|
|
93
|
-
const queryArgs = (_b = context.propsValue.args) !== null && _b !== void 0 ? _b : [];
|
|
94
|
-
const formattedArgs = {};
|
|
95
|
-
for (let i = 0; i < queryArgs.length; i++) {
|
|
96
|
-
const idx = (i + 1).toString();
|
|
97
|
-
formattedArgs[idx] = queryArgs[i];
|
|
98
|
-
}
|
|
99
|
-
const reader = yield connection.runAndReadAll(context.propsValue.query, formattedArgs);
|
|
100
|
-
const results = reader.getRowObjectsJson();
|
|
101
|
-
connection.closeSync();
|
|
102
|
-
return results;
|
|
103
|
-
});
|
|
104
|
-
},
|
|
105
|
-
});
|
|
106
|
-
//# sourceMappingURL=create-and-query-db.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"create-and-query-db.js","sourceRoot":"","sources":["../../../../src/lib/actions/create-and-query-db.ts"],"names":[],"mappings":";;;;AAAA,qEAAwE;AAExE,+CAAkD;AAErC,QAAA,gBAAgB,GAAG,IAAA,+BAAY,EAAC;IAC3C,IAAI,EAAE,kBAAkB;IACxB,WAAW,EAAE,qBAAqB;IAClC,WAAW,EAAE,mCAAmC;IAChD,QAAQ,EAAE,MAAM;IAChB,UAAU,EAAE;QACV,WAAW,EAAE,8mBAA8mB;QAC3nB,UAAU,EAAE,IAAI;KACjB;IACD,KAAK,EAAE;QACL,QAAQ,EAAE,2BAAQ,CAAC,QAAQ,CAAC;YAC1B,KAAK,EAAE;2KAC8J;SACtK,CAAC;QACF,MAAM,EAAE,2BAAQ,CAAC,KAAK,CAAC;YACrB,WAAW,EAAE,QAAQ;YACrB,WAAW,EAAE,0CAA0C;YACvD,QAAQ,EAAE,IAAI;YACd,UAAU,EAAE;gBACV,IAAI,EAAE,2BAAQ,CAAC,SAAS,CAAC;oBACvB,WAAW,EAAE,YAAY;oBACzB,WAAW,EAAE,6BAA6B;oBAC1C,QAAQ,EAAE,IAAI;iBACf,CAAC;gBACF,IAAI,EAAE,2BAAQ,CAAC,IAAI,CAAC;oBAClB,WAAW,EAAE,WAAW;oBACxB,WAAW,EACT,gGAAgG;oBAClG,QAAQ,EAAE,IAAI;oBACd,YAAY,EAAE,EAAE;iBACjB,CAAC;gBACF,MAAM,EAAE,2BAAQ,CAAC,IAAI,CAAC;oBACpB,WAAW,EAAE,uBAAuB;oBACpC,WAAW,EAAE;;;;;;;WAOZ,CAAC,IAAI,EAAE;oBACR,QAAQ,EAAE,KAAK;oBACf,YAAY,EAAE,EAAE;iBACjB,CAAC;aACH;SACF,CAAC;QACF,KAAK,EAAE,2BAAQ,CAAC,SAAS,CAAC;YACxB,WAAW,EAAE,OAAO;YACpB,WAAW,EACT,2EAA2E;YAC7E,QAAQ,EAAE,IAAI;SACf,CAAC;QACF,IAAI,EAAE,2BAAQ,CAAC,KAAK,CAAC;YACnB,WAAW,EAAE,WAAW;YACxB,WAAW,EAAE,mCAAmC;YAChD,QAAQ,EAAE,KAAK;SAChB,CAAC;KACH;IACK,GAAG,CAAC,OAAO;;;YACf,MAAM,QAAQ,GAAG,MAAM,yBAAc,CAAC,MAAM,CAAC,UAAU,CAAC,CAAC;YACzD,MAAM,UAAU,GAAG,MAAM,QAAQ,CAAC,OAAO,EAAE,CAAC;YAE5C,MAAM,UAAU,CAAC,GAAG,CAAC;;;;KAIpB,CAAC,CAAC;YAEH,MAAM,QAAQ,GAAU,MAAA,OAAO,CAAC,UAAU,CAAC,MAAM,mCAAI,EAAE,CAAC;YACxD,KAAK,MAAM,OAAO,IAAI,QAAQ,EAAE,CAAC;gBAC/B,MAAM,MAAM,GAAG,IAAI,CAAC,SAAS,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC;gBAC5C,IAAI,QAAQ,GAAG,IAAI,CAAC;gBAEpB,IAAI,OAAO,CAAC,MAAM,EAAE,CAAC;oBACnB,QAAQ,GAAG,IAAI,CAAC,SAAS,CAAC,CAAC,OAAO,CAAC,MAAM,CAAC,CAAC,CAAC;gBAC9C,CAAC;qBAAM,CAAC;oBACN,MAAM,YAAY,GAAG,MAAM,UAAU,CAAC,GAAG,CACvC,8CAA8C,EAC9C,EAAE,UAAU,EAAE,MAAM,EAAE,CACvB,CAAC;oBAEF,MAAM,cAAc,GAAG,MAAM,YAAY,CAAC,OAAO,EAAE,CAAC;oBACpD,QAAQ,GAAG,cAAc,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;gBAClC,CAAC;gBAED,MAAM,UAAU,CAAC,GAAG,CAClB;yBACiB,OAAO,CAAC,IAAI;;SAE5B,EACD;oBACE,UAAU,EAAE,MAAM;oBAClB,YAAY,EAAE,QAAQ;iBACvB,CACF,CAAC;YACJ,CAAC;YAED,MAAM,SAAS,GAAG,MAAA,OAAO,CAAC,UAAU,CAAC,IAAI,mCAAI,EAAE,CAAC;YAChD,MAAM,aAAa,GAAwB,EAAE,CAAC;YAC9C,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,SAAS,CAAC,MAAM,EAAE,CAAC,EAAE,EAAE,CAAC;gBAC1C,MAAM,GAAG,GAAG,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,QAAQ,EAAE,CAAC;gBAC/B,aAAa,CAAC,GAAG,CAAC,GAAG,SAAS,CAAC,CAAC,CAAC,CAAC;YACpC,CAAC;YAED,MAAM,MAAM,GAAG,MAAM,UAAU,CAAC,aAAa,CAC3C,OAAO,CAAC,UAAU,CAAC,KAAK,EACxB,aAAa,CACd,CAAC;YAEF,MAAM,OAAO,GAAG,MAAM,CAAC,iBAAiB,EAAE,CAAC;YAE3C,UAAU,CAAC,SAAS,EAAE,CAAC;YAEvB,OAAO,OAAO,CAAC;QACjB,CAAC;KAAA;CACF,CAAC,CAAC"}
|