@samarium.sdk/new 0.25.2 → 0.27.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (2) hide show
  1. package/bin/samarium +254 -102
  2. package/package.json +2 -2
package/bin/samarium CHANGED
@@ -344,7 +344,7 @@ ${F.comment}`:F.comment}this.doc.range[2]=F.offset;break}default:this.errors.pus
344
344
  `)+1;while(F!==0)this.onNewLine(this.offset+F),F=this.source.indexOf(`
345
345
  `,F)+1}yield*this.pop();break;default:yield*this.pop(),yield*this.step()}}*blockMap(D){let F=D.items[D.items.length-1];switch(this.type){case"newline":if(this.onKeyLine=!1,F.value){let P="end"in F.value?F.value.end:void 0;if((Array.isArray(P)?P[P.length-1]:void 0)?.type==="comment")P?.push(this.sourceToken);else D.items.push({start:[this.sourceToken]})}else if(F.sep)F.sep.push(this.sourceToken);else F.start.push(this.sourceToken);return;case"space":case"comment":if(F.value)D.items.push({start:[this.sourceToken]});else if(F.sep)F.sep.push(this.sourceToken);else{if(this.atIndentedComment(F.start,D.indent)){let B=D.items[D.items.length-2]?.value?.end;if(Array.isArray(B)){Array.prototype.push.apply(B,F.start),B.push(this.sourceToken),D.items.pop();return}}F.start.push(this.sourceToken)}return}if(this.indent>=D.indent){let P=!this.onKeyLine&&this.indent===D.indent,B=P&&(F.sep||F.explicitKey)&&this.type!=="seq-item-ind",Z=[];if(B&&F.sep&&!F.value){let X=[];for(let q=0;q<F.sep.length;++q){let J=F.sep[q];switch(J.type){case"newline":X.push(q);break;case"space":break;case"comment":if(J.indent>D.indent)X.length=0;break;default:X.length=0}}if(X.length>=2)Z=F.sep.splice(X[1])}switch(this.type){case"anchor":case"tag":if(B||F.value)Z.push(this.sourceToken),D.items.push({start:Z}),this.onKeyLine=!0;else if(F.sep)F.sep.push(this.sourceToken);else F.start.push(this.sourceToken);return;case"explicit-key-ind":if(!F.sep&&!F.explicitKey)F.start.push(this.sourceToken),F.explicitKey=!0;else if(B||F.value)Z.push(this.sourceToken),D.items.push({start:Z,explicitKey:!0});else this.stack.push({type:"block-map",offset:this.offset,indent:this.indent,items:[{start:[this.sourceToken],explicitKey:!0}]});this.onKeyLine=!0;return;case"map-value-ind":if(F.explicitKey)if(!F.sep)if(R0(F.start,"newline"))Object.assign(F,{key:null,sep:[this.sourceToken]});else{let X=y8(F.start);this.stack.push({type:"block-map",offset:this.offset,indent:this.indent,items:[{start:X,key:null,sep:[this.sourceToken]}]})}else if(F.value)D.items.push({start:[],key:null,sep:[this.sourceToken]});else if(R0(F.sep,"map-value-ind"))this.stack.push({type:"block-map",offset:this.offset,indent:this.indent,items:[{start:Z,key:null,sep:[this.sourceToken]}]});else if(Vz(F.key)&&!R0(F.sep,"newline")){let X=y8(F.start),q=F.key,J=F.sep;J.push(this.sourceToken),delete F.key,delete F.sep,this.stack.push({type:"block-map",offset:this.offset,indent:this.indent,items:[{start:X,key:q,sep:J}]})}else if(Z.length>0)F.sep=F.sep.concat(Z,this.sourceToken);else F.sep.push(this.sourceToken);else if(!F.sep)Object.assign(F,{key:null,sep:[this.sourceToken]});else if(F.value||B)D.items.push({start:Z,key:null,sep:[this.sourceToken]});else if(R0(F.sep,"map-value-ind"))this.stack.push({type:"block-map",offset:this.offset,indent:this.indent,items:[{start:[],key:null,sep:[this.sourceToken]}]});else F.sep.push(this.sourceToken);this.onKeyLine=!0;return;case"alias":case"scalar":case"single-quoted-scalar":case"double-quoted-scalar":{let X=this.flowScalar(this.type);if(B||F.value)D.items.push({start:Z,key:X,sep:[]}),this.onKeyLine=!0;else if(F.sep)this.stack.push(X);else Object.assign(F,{key:X,sep:[]}),this.onKeyLine=!0;return}default:{let X=this.startBlockValue(D);if(X){if(X.type==="block-seq"){if(!F.explicitKey&&F.sep&&!R0(F.sep,"newline")){yield*this.pop({type:"error",offset:this.offset,message:"Unexpected block-seq-ind on same line with key",source:this.source});return}}else if(P)D.items.push({start:Z});this.stack.push(X);return}}}}yield*this.pop(),yield*this.step()}*blockSequence(D){let F=D.items[D.items.length-1];switch(this.type){case"newline":if(F.value){let P="end"in F.value?F.value.end:void 0;if((Array.isArray(P)?P[P.length-1]:void 0)?.type==="comment")P?.push(this.sourceToken);else D.items.push({start:[this.sourceToken]})}else F.start.push(this.sourceToken);return;case"space":case"comment":if(F.value)D.items.push({start:[this.sourceToken]});else{if(this.atIndentedComment(F.start,D.indent)){let B=D.items[D.items.length-2]?.value?.end;if(Array.isArray(B)){Array.prototype.push.apply(B,F.start),B.push(this.sourceToken),D.items.pop();return}}F.start.push(this.sourceToken)}return;case"anchor":case"tag":if(F.value||this.indent<=D.indent)break;F.start.push(this.sourceToken);return;case"seq-item-ind":if(this.indent!==D.indent)break;if(F.value||R0(F.start,"seq-item-ind"))D.items.push({start:[this.sourceToken]});else F.start.push(this.sourceToken);return}if(this.indent>D.indent){let P=this.startBlockValue(D);if(P){this.stack.push(P);return}}yield*this.pop(),yield*this.step()}*flowCollection(D){let F=D.items[D.items.length-1];if(this.type==="flow-error-end"){let P;do yield*this.pop(),P=this.peek(1);while(P&&P.type==="flow-collection")}else if(D.end.length===0){switch(this.type){case"comma":case"explicit-key-ind":if(!F||F.sep)D.items.push({start:[this.sourceToken]});else F.start.push(this.sourceToken);return;case"map-value-ind":if(!F||F.value)D.items.push({start:[],key:null,sep:[this.sourceToken]});else if(F.sep)F.sep.push(this.sourceToken);else Object.assign(F,{key:null,sep:[this.sourceToken]});return;case"space":case"comment":case"newline":case"anchor":case"tag":if(!F||F.value)D.items.push({start:[this.sourceToken]});else if(F.sep)F.sep.push(this.sourceToken);else F.start.push(this.sourceToken);return;case"alias":case"scalar":case"single-quoted-scalar":case"double-quoted-scalar":{let B=this.flowScalar(this.type);if(!F||F.value)D.items.push({start:[],key:B,sep:[]});else if(F.sep)this.stack.push(B);else Object.assign(F,{key:B,sep:[]});return}case"flow-map-end":case"flow-seq-end":D.end.push(this.sourceToken);return}let P=this.startBlockValue(D);if(P)this.stack.push(P);else yield*this.pop(),yield*this.step()}else{let P=this.peek(2);if(P.type==="block-map"&&(this.type==="map-value-ind"&&P.indent===D.indent||this.type==="newline"&&!P.items[P.items.length-1].sep))yield*this.pop(),yield*this.step();else if(this.type==="map-value-ind"&&P.type!=="flow-collection"){let B=T5(P),Z=y8(B);Lz(D);let X=D.end.splice(1,D.end.length);X.push(this.sourceToken);let q={type:"block-map",offset:D.offset,indent:D.indent,items:[{start:Z,key:D,sep:X}]};this.onKeyLine=!0,this.stack[this.stack.length-1]=q}else yield*this.lineEnd(D)}}flowScalar(D){if(this.onNewLine){let F=this.source.indexOf(`
346
346
  `)+1;while(F!==0)this.onNewLine(this.offset+F),F=this.source.indexOf(`
347
- `,F)+1}return{type:D,offset:this.offset,indent:this.indent,source:this.source}}startBlockValue(D){switch(this.type){case"alias":case"scalar":case"single-quoted-scalar":case"double-quoted-scalar":return this.flowScalar(this.type);case"block-scalar-header":return{type:"block-scalar",offset:this.offset,indent:this.indent,props:[this.sourceToken],source:""};case"flow-map-start":case"flow-seq-start":return{type:"flow-collection",offset:this.offset,indent:this.indent,start:this.sourceToken,items:[],end:[]};case"seq-item-ind":return{type:"block-seq",offset:this.offset,indent:this.indent,items:[{start:[this.sourceToken]}]};case"explicit-key-ind":{this.onKeyLine=!0;let F=T5(D),P=y8(F);return P.push(this.sourceToken),{type:"block-map",offset:this.offset,indent:this.indent,items:[{start:P,explicitKey:!0}]}}case"map-value-ind":{this.onKeyLine=!0;let F=T5(D),P=y8(F);return{type:"block-map",offset:this.offset,indent:this.indent,items:[{start:P,key:null,sep:[this.sourceToken]}]}}}return null}atIndentedComment(D,F){if(this.type!=="comment")return!1;if(this.indent<=F)return!1;return D.every((P)=>P.type==="newline"||P.type==="space")}*documentEnd(D){if(this.type!=="doc-mode"){if(D.end)D.end.push(this.sourceToken);else D.end=[this.sourceToken];if(this.type==="newline")yield*this.pop()}}*lineEnd(D){switch(this.type){case"comma":case"doc-start":case"doc-end":case"flow-seq-end":case"flow-map-end":case"map-value-ind":yield*this.pop(),yield*this.step();break;case"newline":this.onKeyLine=!1;case"space":case"comment":default:if(D.end)D.end.push(this.sourceToken);else D.end=[this.sourceToken];if(this.type==="newline")yield*this.pop()}}}qg.Parser=wz});var uz=Q((Gg)=>{var jz=DP(),Yg=q1(),O1=J1(),Hg=UF(),Ug=t(),Wg=UP(),bz=WP();function Sz(D){let F=D.prettyErrors!==!1;return{lineCounter:D.lineCounter||F&&new Wg.LineCounter||null,prettyErrors:F}}function Og(D,F={}){let{lineCounter:P,prettyErrors:B}=Sz(F),Z=new bz.Parser(P?.addNewLine),X=new jz.Composer(F),q=Array.from(X.compose(Z.parse(D)));if(B&&P)for(let J of q)J.errors.forEach(O1.prettifyError(D,P)),J.warnings.forEach(O1.prettifyError(D,P));if(q.length>0)return q;return Object.assign([],{empty:!0},X.streamInfo())}function Tz(D,F={}){let{lineCounter:P,prettyErrors:B}=Sz(F),Z=new bz.Parser(P?.addNewLine),X=new jz.Composer(F),q=null;for(let J of X.compose(Z.parse(D),!0,D.length))if(!q)q=J;else if(q.options.logLevel!=="silent"){q.errors.push(new O1.YAMLParseError(J.range.slice(0,2),"MULTIPLE_DOCS","Source contains multiple documents; please use YAML.parseAllDocuments()"));break}if(B&&P)q.errors.forEach(O1.prettifyError(D,P)),q.warnings.forEach(O1.prettifyError(D,P));return q}function zg(D,F,P){let B=void 0;if(typeof F==="function")B=F;else if(P===void 0&&F&&typeof F==="object")P=F;let Z=Tz(D,P);if(!Z)return null;if(Z.warnings.forEach((X)=>Hg.warn(Z.options.logLevel,X)),Z.errors.length>0)if(Z.options.logLevel!=="silent")throw Z.errors[0];else Z.errors=[];return Z.toJS(Object.assign({reviver:B},P))}function Qg(D,F,P){let B=null;if(typeof F==="function"||Array.isArray(F))B=F;else if(P===void 0&&F)P=F;if(typeof P==="string")P=P.length;if(typeof P==="number"){let Z=Math.round(P);P=Z<1?void 0:Z>8?{indent:8}:{indent:Z}}if(D===void 0){let{keepUndefined:Z}=P??F??{};if(!Z)return}if(Ug.isDocument(D)&&!B)return D.toString(P);return new Yg.Document(D,B,P).toString(P)}Gg.parse=zg;Gg.parseAllDocuments=Og;Gg.parseDocument=Tz;Gg.stringify=Qg});var _z=Q((Ng)=>{var Eg=DP(),Kg=q1(),Ag=gF(),OP=J1(),Cg=p6(),I0=t(),Lg=O0(),Vg=CD(),wg=Q0(),jg=G0(),bg=b5(),Sg=HP(),Tg=UP(),ug=WP(),u5=uz(),Nz=c6();Ng.Composer=Eg.Composer;Ng.Document=Kg.Document;Ng.Schema=Ag.Schema;Ng.YAMLError=OP.YAMLError;Ng.YAMLParseError=OP.YAMLParseError;Ng.YAMLWarning=OP.YAMLWarning;Ng.Alias=Cg.Alias;Ng.isAlias=I0.isAlias;Ng.isCollection=I0.isCollection;Ng.isDocument=I0.isDocument;Ng.isMap=I0.isMap;Ng.isNode=I0.isNode;Ng.isPair=I0.isPair;Ng.isScalar=I0.isScalar;Ng.isSeq=I0.isSeq;Ng.Pair=Lg.Pair;Ng.Scalar=Vg.Scalar;Ng.YAMLMap=wg.YAMLMap;Ng.YAMLSeq=jg.YAMLSeq;Ng.CST=bg;Ng.Lexer=Sg.Lexer;Ng.LineCounter=Tg.LineCounter;Ng.Parser=ug.Parser;Ng.parse=u5.parse;Ng.parseAllDocuments=u5.parseAllDocuments;Ng.parseDocument=u5.parseDocument;Ng.stringify=u5.stringify;Ng.visit=Nz.visit;Ng.visitAsync=Nz.visitAsync});var G1={name:"@samarium.sdk/new",version:"0.25.2",main:"bin/samarium",type:"module",repository:{type:"git",url:"https://github.com/liontariai/samarium",directory:"packages/new"},keywords:["graphql","typescript","compiler","api","sdk","openapi","oas3","oas3.1","swagger","graphql-sdk","graphql-codegen"],homepage:"https://liontari.ai",bin:{samarium:"bin/samarium"},publishConfig:{access:"public"},files:["bin/**/*","README.md","package.json"],scripts:{prettier:"prettier --write .",bundle:"bun bundle.ts",prepublishOnly:"bun run bundle",test:"bun test"},prettier:{tabWidth:4},devDependencies:{"bun-types":"^1.2.19","@samarium.sdk/make":"workspace:*"},peerDependencies:{typescript:"^5.0.0"},dependencies:{"@inquirer/prompts":"^5.0.5",commander:"^11.1.0","detect-indent":"^7.0.1",prettier:"^3.2.5",yaml:"^2.6.0"}};var hP=RD(fP(),1),{program:Ev,createCommand:Kv,createArgument:Av,createOption:Cv,CommanderError:Lv,InvalidArgumentError:Vv,InvalidOptionArgumentError:wv,Command:gP,Argument:jv,Option:bv,Help:Sv}=hP.default;var dH=RD(l2(),1);var E3=RD(l2(),1);class P0 extends Error{response;request;constructor(D,F){let P=`${P0.extractMessage(D)}: ${JSON.stringify({response:D,request:F})}`;super(P);if(Object.setPrototypeOf(this,P0.prototype),this.response=D,this.request=F,typeof Error.captureStackTrace==="function")Error.captureStackTrace(this,P0)}static extractMessage(D){return D.errors?.[0]?.message??`GraphQL Error (Code: ${String(D.status)})`}}var W7=(D)=>D.toUpperCase(),Q3=(D)=>{return typeof D==="function"?D():D},O7=(D,F)=>D.map((P,B)=>[P,F[B]]),x0=(D)=>{let F={};if(D instanceof Headers)F=_b(D);else if(Array.isArray(D))D.forEach(([P,B])=>{if(P&&B!==void 0)F[P]=B});else if(D)F=D;return F},_b=(D)=>{let F={};return D.forEach((P,B)=>{F[B]=P}),F},NH=(D)=>{try{let F=D();if(kb(F))return F.catch((P)=>{return uH(P)});return F}catch(F){return uH(F)}},uH=(D)=>{if(D instanceof Error)return D;return Error(String(D))},kb=(D)=>{return typeof D==="object"&&D!==null&&"then"in D&&typeof D.then==="function"&&"catch"in D&&typeof D.catch==="function"&&"finally"in D&&typeof D.finally==="function"},G3=(D)=>{throw Error(`Unhandled case: ${String(D)}`)},S6=(D)=>{return typeof D==="object"&&D!==null&&!Array.isArray(D)};var _H=(D,F)=>{return D.documents?D:{documents:D,requestHeaders:F,signal:void 0}};var kH=(D,F,P)=>{return D.query?D:{query:D,variables:F,requestHeaders:P,signal:void 0}};var hH=RD(l2(),1);var z7="Accept",R3="Content-Type",T6="application/json",I3="application/graphql-response+json";var Q7=(D)=>D.replace(/([\s,]|#[^\n\r]+)+/g," ").trim(),gH=(D)=>{let F=D.toLowerCase();return F.includes(I3)||F.includes(T6)},G7=(D)=>{try{if(Array.isArray(D))return{_tag:"Batch",executionResults:D.map(xH)};else if(S6(D))return{_tag:"Single",executionResult:xH(D)};else throw Error(`Invalid execution result: result is not object or array.
347
+ `,F)+1}return{type:D,offset:this.offset,indent:this.indent,source:this.source}}startBlockValue(D){switch(this.type){case"alias":case"scalar":case"single-quoted-scalar":case"double-quoted-scalar":return this.flowScalar(this.type);case"block-scalar-header":return{type:"block-scalar",offset:this.offset,indent:this.indent,props:[this.sourceToken],source:""};case"flow-map-start":case"flow-seq-start":return{type:"flow-collection",offset:this.offset,indent:this.indent,start:this.sourceToken,items:[],end:[]};case"seq-item-ind":return{type:"block-seq",offset:this.offset,indent:this.indent,items:[{start:[this.sourceToken]}]};case"explicit-key-ind":{this.onKeyLine=!0;let F=T5(D),P=y8(F);return P.push(this.sourceToken),{type:"block-map",offset:this.offset,indent:this.indent,items:[{start:P,explicitKey:!0}]}}case"map-value-ind":{this.onKeyLine=!0;let F=T5(D),P=y8(F);return{type:"block-map",offset:this.offset,indent:this.indent,items:[{start:P,key:null,sep:[this.sourceToken]}]}}}return null}atIndentedComment(D,F){if(this.type!=="comment")return!1;if(this.indent<=F)return!1;return D.every((P)=>P.type==="newline"||P.type==="space")}*documentEnd(D){if(this.type!=="doc-mode"){if(D.end)D.end.push(this.sourceToken);else D.end=[this.sourceToken];if(this.type==="newline")yield*this.pop()}}*lineEnd(D){switch(this.type){case"comma":case"doc-start":case"doc-end":case"flow-seq-end":case"flow-map-end":case"map-value-ind":yield*this.pop(),yield*this.step();break;case"newline":this.onKeyLine=!1;case"space":case"comment":default:if(D.end)D.end.push(this.sourceToken);else D.end=[this.sourceToken];if(this.type==="newline")yield*this.pop()}}}qg.Parser=wz});var uz=Q((Gg)=>{var jz=DP(),Yg=q1(),O1=J1(),Hg=UF(),Ug=t(),Wg=UP(),bz=WP();function Sz(D){let F=D.prettyErrors!==!1;return{lineCounter:D.lineCounter||F&&new Wg.LineCounter||null,prettyErrors:F}}function Og(D,F={}){let{lineCounter:P,prettyErrors:B}=Sz(F),Z=new bz.Parser(P?.addNewLine),X=new jz.Composer(F),q=Array.from(X.compose(Z.parse(D)));if(B&&P)for(let J of q)J.errors.forEach(O1.prettifyError(D,P)),J.warnings.forEach(O1.prettifyError(D,P));if(q.length>0)return q;return Object.assign([],{empty:!0},X.streamInfo())}function Tz(D,F={}){let{lineCounter:P,prettyErrors:B}=Sz(F),Z=new bz.Parser(P?.addNewLine),X=new jz.Composer(F),q=null;for(let J of X.compose(Z.parse(D),!0,D.length))if(!q)q=J;else if(q.options.logLevel!=="silent"){q.errors.push(new O1.YAMLParseError(J.range.slice(0,2),"MULTIPLE_DOCS","Source contains multiple documents; please use YAML.parseAllDocuments()"));break}if(B&&P)q.errors.forEach(O1.prettifyError(D,P)),q.warnings.forEach(O1.prettifyError(D,P));return q}function zg(D,F,P){let B=void 0;if(typeof F==="function")B=F;else if(P===void 0&&F&&typeof F==="object")P=F;let Z=Tz(D,P);if(!Z)return null;if(Z.warnings.forEach((X)=>Hg.warn(Z.options.logLevel,X)),Z.errors.length>0)if(Z.options.logLevel!=="silent")throw Z.errors[0];else Z.errors=[];return Z.toJS(Object.assign({reviver:B},P))}function Qg(D,F,P){let B=null;if(typeof F==="function"||Array.isArray(F))B=F;else if(P===void 0&&F)P=F;if(typeof P==="string")P=P.length;if(typeof P==="number"){let Z=Math.round(P);P=Z<1?void 0:Z>8?{indent:8}:{indent:Z}}if(D===void 0){let{keepUndefined:Z}=P??F??{};if(!Z)return}if(Ug.isDocument(D)&&!B)return D.toString(P);return new Yg.Document(D,B,P).toString(P)}Gg.parse=zg;Gg.parseAllDocuments=Og;Gg.parseDocument=Tz;Gg.stringify=Qg});var _z=Q((Ng)=>{var Eg=DP(),Kg=q1(),Ag=gF(),OP=J1(),Cg=p6(),I0=t(),Lg=O0(),Vg=CD(),wg=Q0(),jg=G0(),bg=b5(),Sg=HP(),Tg=UP(),ug=WP(),u5=uz(),Nz=c6();Ng.Composer=Eg.Composer;Ng.Document=Kg.Document;Ng.Schema=Ag.Schema;Ng.YAMLError=OP.YAMLError;Ng.YAMLParseError=OP.YAMLParseError;Ng.YAMLWarning=OP.YAMLWarning;Ng.Alias=Cg.Alias;Ng.isAlias=I0.isAlias;Ng.isCollection=I0.isCollection;Ng.isDocument=I0.isDocument;Ng.isMap=I0.isMap;Ng.isNode=I0.isNode;Ng.isPair=I0.isPair;Ng.isScalar=I0.isScalar;Ng.isSeq=I0.isSeq;Ng.Pair=Lg.Pair;Ng.Scalar=Vg.Scalar;Ng.YAMLMap=wg.YAMLMap;Ng.YAMLSeq=jg.YAMLSeq;Ng.CST=bg;Ng.Lexer=Sg.Lexer;Ng.LineCounter=Tg.LineCounter;Ng.Parser=ug.Parser;Ng.parse=u5.parse;Ng.parseAllDocuments=u5.parseAllDocuments;Ng.parseDocument=u5.parseDocument;Ng.stringify=u5.stringify;Ng.visit=Nz.visit;Ng.visitAsync=Nz.visitAsync});var G1={name:"@samarium.sdk/new",version:"0.27.0",main:"bin/samarium",type:"module",repository:{type:"git",url:"https://github.com/liontariai/samarium",directory:"packages/new"},keywords:["graphql","typescript","compiler","api","sdk","openapi","oas3","oas3.1","swagger","graphql-sdk","graphql-codegen"],homepage:"https://liontari.ai",bin:{samarium:"bin/samarium"},publishConfig:{access:"public"},files:["bin/**/*","README.md","package.json"],scripts:{prettier:"prettier --write .",bundle:"bun bundle.ts",prepublishOnly:"bun run bundle",test:"bun test"},prettier:{tabWidth:4},devDependencies:{"bun-types":"^1.2.19","@samarium.sdk/make":"workspace:*"},peerDependencies:{typescript:"^5.0.0"},dependencies:{"@inquirer/prompts":"^5.0.5",commander:"^11.1.0","detect-indent":"^7.0.1",prettier:"^3.2.5",yaml:"^2.6.0"}};var hP=RD(fP(),1),{program:Ev,createCommand:Kv,createArgument:Av,createOption:Cv,CommanderError:Lv,InvalidArgumentError:Vv,InvalidOptionArgumentError:wv,Command:gP,Argument:jv,Option:bv,Help:Sv}=hP.default;var dH=RD(l2(),1);var E3=RD(l2(),1);class P0 extends Error{response;request;constructor(D,F){let P=`${P0.extractMessage(D)}: ${JSON.stringify({response:D,request:F})}`;super(P);if(Object.setPrototypeOf(this,P0.prototype),this.response=D,this.request=F,typeof Error.captureStackTrace==="function")Error.captureStackTrace(this,P0)}static extractMessage(D){return D.errors?.[0]?.message??`GraphQL Error (Code: ${String(D.status)})`}}var W7=(D)=>D.toUpperCase(),Q3=(D)=>{return typeof D==="function"?D():D},O7=(D,F)=>D.map((P,B)=>[P,F[B]]),x0=(D)=>{let F={};if(D instanceof Headers)F=_b(D);else if(Array.isArray(D))D.forEach(([P,B])=>{if(P&&B!==void 0)F[P]=B});else if(D)F=D;return F},_b=(D)=>{let F={};return D.forEach((P,B)=>{F[B]=P}),F},NH=(D)=>{try{let F=D();if(kb(F))return F.catch((P)=>{return uH(P)});return F}catch(F){return uH(F)}},uH=(D)=>{if(D instanceof Error)return D;return Error(String(D))},kb=(D)=>{return typeof D==="object"&&D!==null&&"then"in D&&typeof D.then==="function"&&"catch"in D&&typeof D.catch==="function"&&"finally"in D&&typeof D.finally==="function"},G3=(D)=>{throw Error(`Unhandled case: ${String(D)}`)},S6=(D)=>{return typeof D==="object"&&D!==null&&!Array.isArray(D)};var _H=(D,F)=>{return D.documents?D:{documents:D,requestHeaders:F,signal:void 0}};var kH=(D,F,P)=>{return D.query?D:{query:D,variables:F,requestHeaders:P,signal:void 0}};var hH=RD(l2(),1);var z7="Accept",R3="Content-Type",T6="application/json",I3="application/graphql-response+json";var Q7=(D)=>D.replace(/([\s,]|#[^\n\r]+)+/g," ").trim(),gH=(D)=>{let F=D.toLowerCase();return F.includes(I3)||F.includes(T6)},G7=(D)=>{try{if(Array.isArray(D))return{_tag:"Batch",executionResults:D.map(xH)};else if(S6(D))return{_tag:"Single",executionResult:xH(D)};else throw Error(`Invalid execution result: result is not object or array.
348
348
  Got:
349
349
  ${String(D)}`)}catch(F){return F}},xH=(D)=>{if(typeof D!=="object"||D===null)throw Error("Invalid execution result: result is not object");let F=void 0,P=void 0,B=void 0;if("errors"in D){if(!S6(D.errors)&&!Array.isArray(D.errors))throw Error("Invalid execution result: errors is not plain object OR array");F=D.errors}if("data"in D){if(!S6(D.data)&&D.data!==null)throw Error("Invalid execution result: data is not plain object");P=D.data}if("extensions"in D){if(!S6(D.extensions))throw Error("Invalid execution result: extensions is not plain object");B=D.extensions}return{data:P,errors:F,extensions:B}},vH=(D)=>D._tag==="Batch"?D.executionResults.some(fH):fH(D.executionResult),fH=(D)=>Array.isArray(D.errors)?D.errors.length>0:Boolean(D.errors),R7=(D)=>{return typeof D==="object"&&D!==null&&"kind"in D&&D.kind===hH.Kind.OPERATION_DEFINITION};var yH=RD(l2(),1),mH=RD(l2(),1),xb=(D)=>{let F=void 0,P=D.definitions.filter(R7);if(P.length===1)F=P[0].name?.value;return F},fb=(D)=>{let F=!1,P=D.definitions.filter(R7);if(P.length===1)F=P[0].operation==="mutation";return F},u6=(D,F)=>{let P=typeof D==="string"?D:mH.print(D),B=!1,Z=void 0;if(F)return{expression:P,isMutation:B,operationName:Z};let X=NH(()=>typeof D==="string"?yH.parse(D):D);if(X instanceof Error)return{expression:P,isMutation:B,operationName:Z};return Z=xb(X),B=fb(X),{expression:P,operationName:Z,isMutation:B}};var $3=JSON;var M3=async(D)=>{let F={...D,method:D.request._tag==="Single"?D.request.document.isMutation?"POST":W7(D.method??"post"):D.request.hasMutations?"POST":W7(D.method??"post"),fetchOptions:{...D.fetchOptions,errorPolicy:D.fetchOptions.errorPolicy??"none"}},B=await gb(F.method)(F);if(!B.ok)return new P0({status:B.status,headers:B.headers},{query:D.request._tag==="Single"?D.request.document.expression:D.request.query,variables:D.request.variables});let Z=await hb(B,D.fetchOptions.jsonSerializer??$3);if(Z instanceof Error)throw Z;let X={status:B.status,headers:B.headers};if(vH(Z)&&F.fetchOptions.errorPolicy==="none"){let q=Z._tag==="Batch"?{...Z.executionResults,...X}:{...Z.executionResult,...X};return new P0(q,{query:D.request._tag==="Single"?D.request.document.expression:D.request.query,variables:D.request.variables})}switch(Z._tag){case"Single":return{...X,...lH(F)(Z.executionResult)};case"Batch":return{...X,data:Z.executionResults.map(lH(F))};default:G3(Z)}},lH=(D)=>(F)=>{return{extensions:F.extensions,data:F.data,errors:D.fetchOptions.errorPolicy==="all"?F.errors:void 0}},hb=async(D,F)=>{let P=D.headers.get(R3),B=await D.text();if(P&&gH(P))return G7(F.parse(B));else return G7(B)},gb=(D)=>async(F)=>{let P=new Headers(F.headers),B=null,Z=void 0;if(!P.has(z7))P.set(z7,[I3,T6].join(", "));if(D==="POST"){if(Z=(F.fetchOptions.jsonSerializer??$3).stringify(vb(F)),typeof Z==="string"&&!P.has(R3))P.set(R3,T6)}else B=yb(F);let X={method:D,headers:P,body:Z,...F.fetchOptions},q=new URL(F.url),J=X;if(F.middleware){let H=await Promise.resolve(F.middleware({...X,url:F.url,operationName:F.request._tag==="Single"?F.request.document.operationName:void 0,variables:F.request.variables})),{url:U,...W}=H;q=new URL(U),J=W}if(B)B.forEach((H,U)=>{q.searchParams.append(U,H)});return await(F.fetch??fetch)(q,J)},vb=(D)=>{switch(D.request._tag){case"Single":return{query:D.request.document.expression,variables:D.request.variables,operationName:D.request.document.operationName};case"Batch":return O7(D.request.query,D.request.variables??[]).map(([F,P])=>({query:F,variables:P}));default:throw G3(D.request)}},yb=(D)=>{let F=D.fetchOptions.jsonSerializer??$3,P=new URLSearchParams;switch(D.request._tag){case"Single":{if(P.append("query",Q7(D.request.document.expression)),D.request.variables)P.append("variables",F.stringify(D.request.variables));if(D.request.document.operationName)P.append("operationName",D.request.document.operationName);return P}case"Batch":{let B=D.request.variables?.map((q)=>F.stringify(q))??[],Z=D.request.query.map(Q7),X=O7(Z,B).map(([q,J])=>({query:q,variables:J}));return P.append("query",F.stringify(X)),P}default:throw G3(D.request)}};class f0{url;requestConfig;constructor(D,F={}){this.url=D,this.requestConfig=F}rawRequest=async(...D)=>{let[F,P,B]=D,Z=kH(F,P,B),{headers:X,fetch:q=globalThis.fetch,method:J="POST",requestMiddleware:Y,responseMiddleware:H,excludeOperationName:U,...W}=this.requestConfig,{url:O}=this;if(Z.signal!==void 0)W.signal=Z.signal;let z=u6(Z.query,U),I=await M3({url:O,request:{_tag:"Single",document:z,variables:Z.variables},headers:{...x0(Q3(X)),...x0(Z.requestHeaders)},fetch:q,method:J,fetchOptions:W,middleware:Y});if(H)await H(I,{operationName:z.operationName,variables:P,url:this.url});if(I instanceof Error)throw I;return I};async request(D,...F){let[P,B]=F,Z=cH(D,P,B),{headers:X,fetch:q=globalThis.fetch,method:J="POST",requestMiddleware:Y,responseMiddleware:H,excludeOperationName:U,...W}=this.requestConfig,{url:O}=this;if(Z.signal!==void 0)W.signal=Z.signal;let z=u6(Z.document,U),I=await M3({url:O,request:{_tag:"Single",document:z,variables:Z.variables},headers:{...x0(Q3(X)),...x0(Z.requestHeaders)},fetch:q,method:J,fetchOptions:W,middleware:Y});if(H)await H(I,{operationName:z.operationName,variables:Z.variables,url:this.url});if(I instanceof Error)throw I;return I.data}async batchRequests(D,F){let P=_H(D,F),{headers:B,excludeOperationName:Z,...X}=this.requestConfig;if(P.signal!==void 0)X.signal=P.signal;let q=P.documents.map(({document:W})=>u6(W,Z)),J=q.map(({expression:W})=>W),Y=q.some(({isMutation:W})=>W),H=P.documents.map(({variables:W})=>W),U=await M3({url:this.url,request:{_tag:"Batch",operationName:void 0,query:J,hasMutations:Y,variables:H},headers:{...x0(Q3(B)),...x0(P.requestHeaders)},fetch:this.requestConfig.fetch??globalThis.fetch,method:this.requestConfig.method||"POST",fetchOptions:X,middleware:this.requestConfig.requestMiddleware});if(this.requestConfig.responseMiddleware)await this.requestConfig.responseMiddleware(U,{operationName:void 0,variables:H,url:this.url});if(U instanceof Error)throw U;return U.data}setHeaders(D){return this.requestConfig.headers=D,this}setHeader(D,F){let{headers:P}=this.requestConfig;if(P)P[D]=F;else this.requestConfig.headers={[D]:F};return this}setEndpoint(D){return this.url=D,this}}var cH=(D,F,P)=>{return D.document?D:{document:D,variables:F,requestHeaders:P,signal:void 0}};async function h0(D,F){try{let B=await new f0(D).request(E3.getIntrospectionQuery(),void 0,new Headers(F?.map((X)=>X.split("="))));return E3.buildClientSchema(B)}catch(P){throw P}}import mb from"fs";var I7=async(D,F)=>{let P=await h0(D.url,D.headers),B=dH.printSchema(P);mb.writeFileSync(F,B)};var K3=RD(l2(),1),A3=RD(l2(),1),KD=RD(l2(),1),lb=Object.defineProperty,rH=(D,F)=>{for(var P in F)lb(D,P,{get:F[P],enumerable:!0,configurable:!0,set:(B)=>F[P]=()=>B})};class aH{collector;options;authConfig;static FieldValueWrapperType;static EnumTypesMapped;static HelperTypes;static HelperFunctions;typeMeta;typeName;originalFullTypeName;constructor(D,F,P,B){this.collector=F,this.options=P,this.authConfig=B,this.typeMeta=F.getType(D),this.originalFullTypeName=D,this.typeName=this.originalTypeNameToTypescriptFriendlyName(D)}originalTypeNameToTypescriptFriendlyName(D){return D.replaceAll("[","").replaceAll("]","Array").replaceAll("!","NotNull")}originalTypeNameToTypescriptTypeNameWithoutModifiers(D,F=""){return`${D.replaceAll("[","").replaceAll("]","").replaceAll("!","")}${F}`}originalTypeNameToTypescriptTypeName(D,F=""){return`${this.originalTypeNameToTypescriptTypeNameWithoutModifiers(D,F)}${Array.from({length:D.split("[").length-1}).fill("[]").join("")}`}static makeRootOperationFunction(D){throw Error("Method not implemented.")}}var cb=`const Proxy = globalThis.Proxy;
350
350
  Proxy.prototype = {};
@@ -388,6 +388,7 @@ type FnOrPromisOrPrimitive =
388
388
  | { [key: string]: string };
389
389
  export const _ = Symbol("_") as any;
390
390
  export const OPTIONS = Symbol("OPTIONS");
391
+ export const PLUGINS = Symbol("PLUGINS");
391
392
  export class RootOperation {
392
393
  public static authHeaderName = "[AUTH_HEADER_NAME]";
393
394
  private resolveFnOrPromisOrPrimitiveHeaders = (arg?: FnOrPromisOrPrimitive) => {
@@ -454,6 +455,32 @@ export class RootOperation {
454
455
  },
455
456
  };
456
457
 
458
+ private static [PLUGINS]: {
459
+ onSLWConstruct?: (slw: SelectionWrapperImpl<any, any, any, any, any>) => void;
460
+ onSLWSetTrap?: (
461
+ target: SelectionWrapperImpl<any, any, any, any, any>,
462
+ p: PropertyKey,
463
+ newValue: any,
464
+ receiver: any,
465
+ ) => void;
466
+ onGetResultData?: (t: SelectionWrapperImpl<any, any, any, any, any>, path?: string) => void;
467
+ }[] = [];
468
+ private static hasPlugins = false;
469
+ public static setPlugins(plugins: (typeof RootOperation)[typeof PLUGINS]) {
470
+ RootOperation[PLUGINS] = plugins;
471
+ RootOperation.hasPlugins = plugins.length > 0;
472
+ }
473
+ public static runPlugins<N extends keyof (typeof RootOperation)[typeof PLUGINS][number]>(
474
+ name: N,
475
+ ...args: Parameters<NonNullable<(typeof RootOperation)[typeof PLUGINS][number][N]>>
476
+ ) {
477
+ if (!RootOperation.hasPlugins) return;
478
+ for (const plugin of RootOperation[PLUGINS]) {
479
+ const fn = plugin[name as keyof typeof plugin];
480
+ if (fn) (fn as (...args: any[]) => any).apply(undefined, args);
481
+ }
482
+ }
483
+
457
484
  private utilSet = (obj: Record<string, any>, path: string[], value: any) =>
458
485
  path.reduce((o, p, i, a) => (o[p] = a.length - 1 === i ? value : o[p] || {}), obj);
459
486
 
@@ -573,7 +600,7 @@ export class RootOperation {
573
600
  variables: query.variables,
574
601
  }),
575
602
  })) as [string | URL | Request, RequestInit];
576
- const response = await fetch(url, {
603
+ const response = await (RootOperation[OPTIONS].fetcher ?? globalThis.fetch)(url, {
577
604
  ...options,
578
605
  headers: {
579
606
  ...options?.headers,
@@ -936,6 +963,10 @@ export class SelectionWrapperImpl<
936
963
  slw[SLW_OP_RESULT_DATA_OVERRIDE] = overrides.OP_RESULT_DATA;
937
964
  }
938
965
 
966
+ if (this[ROOT_OP_COLLECTOR]) {
967
+ slw[ROOT_OP_COLLECTOR] = this[ROOT_OP_COLLECTOR];
968
+ }
969
+
939
970
  return slw;
940
971
  }
941
972
 
@@ -1007,6 +1038,8 @@ export class SelectionWrapperImpl<
1007
1038
  if (reCreateValueCallback) {
1008
1039
  this[SLW_RECREATE_VALUE_CALLBACK] = reCreateValueCallback;
1009
1040
  }
1041
+
1042
+ RootOperation.runPlugins("onSLWConstruct", this);
1010
1043
  }
1011
1044
 
1012
1045
  [SLW_OP_PATH]?: string;
@@ -1122,10 +1155,14 @@ export class SelectionWrapper<
1122
1155
  const getResultDataForTarget = (
1123
1156
  t: SelectionWrapperImpl<fieldName, typeNamePure, typeArrDepth, valueT, argsT>,
1124
1157
  overrideOpPath?: string,
1158
+ skipPlugins?: boolean,
1125
1159
  ): valueT | undefined => {
1126
1160
  const cache = getCache(t);
1127
1161
 
1128
1162
  const path = overrideOpPath ?? t[SLW_OP_PATH] ?? undefined;
1163
+
1164
+ if (!skipPlugins) RootOperation.runPlugins("onGetResultData", t, path);
1165
+
1129
1166
  if (path && cache.data.has(path) && !t[SLW_NEEDS_CLONE]) return cache.data.get(path);
1130
1167
 
1131
1168
  const data = t[ROOT_OP_COLLECTOR]!.ref.getOperationResultPath<valueT>(
@@ -1155,7 +1192,7 @@ export class SelectionWrapper<
1155
1192
  has(target, prop) {
1156
1193
  if (prop === Symbol.for("nodejs.util.inspect.custom")) return true;
1157
1194
  if (prop === Symbol.iterator && typeArrDepth) {
1158
- const dataArr = getResultDataForTarget(target);
1195
+ const dataArr = getResultDataForTarget(target, undefined, true);
1159
1196
  if (Array.isArray(dataArr)) return true;
1160
1197
  if (dataArr === undefined || dataArr === null) return false;
1161
1198
  }
@@ -1166,6 +1203,8 @@ export class SelectionWrapper<
1166
1203
  return Reflect.has(value ?? {}, prop);
1167
1204
  },
1168
1205
  set(target, p, newValue, receiver) {
1206
+ RootOperation.runPlugins("onSLWSetTrap", target, p, newValue, receiver);
1207
+
1169
1208
  const pstr = String(p);
1170
1209
  if (
1171
1210
  typeof p === "symbol" &&
@@ -1173,6 +1212,7 @@ export class SelectionWrapper<
1173
1212
  ) {
1174
1213
  return Reflect.set(target, p, newValue, receiver);
1175
1214
  }
1215
+
1176
1216
  return Reflect.set(
1177
1217
  target,
1178
1218
  SLW_SETTER_DATA_OVERRIDE,
@@ -1252,6 +1292,8 @@ export class SelectionWrapper<
1252
1292
 
1253
1293
  newRootOpCollectorRef.ref.registerSelection(newThat[SLW_FIELD_NAME]!, newThat);
1254
1294
 
1295
+ const isScalar = newThat[SLW_PARENT_COLLECTOR] === undefined;
1296
+
1255
1297
  const resultProxy = new Proxy(
1256
1298
  {},
1257
1299
  {
@@ -1268,10 +1310,25 @@ export class SelectionWrapper<
1268
1310
  return resolve(newThat);
1269
1311
  }
1270
1312
  if (typeof d === "object" && d && fieldName in d) {
1271
- return resolve(proxify(d[fieldName], newThat as any));
1313
+ const retval = d[fieldName];
1314
+ if (retval === undefined || retval === null) {
1315
+ return resolve(retval);
1316
+ }
1317
+ const ret = isScalar
1318
+ ? getResultDataForTarget(
1319
+ newThat as SelectionWrapper<
1320
+ fieldName,
1321
+ typeNamePure,
1322
+ typeArrDepth,
1323
+ valueT,
1324
+ argsT
1325
+ >,
1326
+ )
1327
+ : proxify(retval, newThat);
1328
+ return resolve(ret);
1272
1329
  }
1273
1330
 
1274
- return resolve(proxify(d, newThat as any));
1331
+ return resolve(newThat);
1275
1332
  });
1276
1333
  });
1277
1334
  if (String(_prop) === "then") {
@@ -1345,28 +1402,33 @@ export class SelectionWrapper<
1345
1402
  if (target[ROOT_OP_COLLECTOR]?.ref.isExecuted) {
1346
1403
  if (prop === Symbol.asyncIterator) {
1347
1404
  const asyncGenRootPath = target[SLW_OP_PATH]?.split(".")?.[0];
1348
- const asyncGen = getResultDataForTarget(target, asyncGenRootPath) as AsyncGenerator<
1349
- valueT,
1350
- any,
1351
- any
1352
- >;
1405
+ const asyncGen = getResultDataForTarget(
1406
+ target,
1407
+ asyncGenRootPath,
1408
+ true,
1409
+ ) as AsyncGenerator<valueT, any, any>;
1410
+ const isScalar = target[SLW_PARENT_COLLECTOR] === undefined;
1353
1411
 
1354
1412
  return function () {
1355
1413
  return {
1356
1414
  next() {
1357
1415
  return asyncGen.next().then((val) => {
1416
+ const clonedSlw = target[SLW_CLONE]({
1417
+ SLW_OP_PATH: asyncGenRootPath,
1418
+ OP_RESULT_DATA: isScalar
1419
+ ? { [asyncGenRootPath!]: val.value }
1420
+ : val.value,
1421
+
1422
+ // this is only for subscriptions
1423
+ SLW_NEEDS_CLONE: true,
1424
+ });
1425
+ const ret =
1426
+ typeof val.value === "object"
1427
+ ? proxify(val.value, clonedSlw)
1428
+ : clonedSlw;
1358
1429
  return {
1359
1430
  done: val.done,
1360
- value: proxify(
1361
- val.value,
1362
- target[SLW_CLONE]({
1363
- SLW_OP_PATH: asyncGenRootPath,
1364
- OP_RESULT_DATA: val.value,
1365
-
1366
- // this is only for subscriptions
1367
- SLW_NEEDS_CLONE: true,
1368
- }),
1369
- ),
1431
+ value: isScalar ? ret[asyncGenRootPath!] : ret,
1370
1432
  };
1371
1433
  });
1372
1434
  },
@@ -1476,7 +1538,10 @@ export class SelectionWrapper<
1476
1538
  }
1477
1539
 
1478
1540
  if (slw instanceof SelectionWrapperImpl && slw[SLW_FIELD_ARR_DEPTH]) {
1479
- const dataArr = getResultDataForTarget(slw) as unknown[] | undefined | null;
1541
+ const dataArr = getResultDataForTarget(slw, undefined, true) as
1542
+ | unknown[]
1543
+ | undefined
1544
+ | null;
1480
1545
  if (dataArr === undefined) return undefined;
1481
1546
  if (dataArr === null) return null;
1482
1547
  if (!dataArr?.length) {
@@ -1487,7 +1552,7 @@ export class SelectionWrapper<
1487
1552
  return proxify(dataArr, slw);
1488
1553
  }
1489
1554
  } else if (slw instanceof SelectionWrapperImpl) {
1490
- const data = getResultDataForTarget(slw) as unknown | undefined | null;
1555
+ const data = getResultDataForTarget(slw, undefined, true) as unknown | undefined | null;
1491
1556
  if (data === undefined) return undefined;
1492
1557
  if (data === null) return null;
1493
1558
 
@@ -1645,9 +1710,79 @@ export class SelectionWrapper<
1645
1710
  : EE[k];
1646
1711
  };
1647
1712
 
1713
+ type SLFNReturned<
1714
+ T extends object,
1715
+ F extends object,
1716
+ E extends { [key: string | number | symbol]: any },
1717
+ TAD extends number,
1718
+ AS_PROMISE,
1719
+ AS_ASYNC_ITER,
1720
+ REP extends string | number | symbol,
1721
+ > =
1722
+ // Overload 1: No 's' provided -> return full transformed F
1723
+ (() => Prettify<
1724
+ ConvertToPromise<
1725
+ ConvertToAsyncIter<
1726
+ ToTArrayWithDepth<
1727
+ Prettify<"$all" extends keyof F ? (F["$all"] extends (...args: any) => any ? ReturnType<F["$all"]> : never) : never>,
1728
+ TAD
1729
+ >,
1730
+ AS_ASYNC_ITER
1731
+ >,
1732
+ AS_PROMISE
1733
+ > &
1734
+ ReplacePlaceHoldersWithTNested<
1735
+ ConvertToAsyncIter<
1736
+ ToTArrayWithDepth<
1737
+ Prettify<"$all" extends keyof F ? (F["$all"] extends (...args: any) => any ? ReturnType<F["$all"]> : never) : never>,
1738
+ TAD
1739
+ >,
1740
+ AS_ASYNC_ITER
1741
+ >,
1742
+ E,
1743
+ REP
1744
+ >
1745
+ >) &
1746
+ // Overload 2: With 's' provided -> infer result from selection
1747
+ (<
1748
+ TT = T,
1749
+ FF = F,
1750
+ EE = E,
1751
+ inferedResult = {
1752
+ [K in keyof TT]: TT[K] extends SelectionWrapperImpl<
1753
+ infer FN,
1754
+ infer TTNP,
1755
+ infer TTAD,
1756
+ infer VT,
1757
+ infer AT
1758
+ >
1759
+ ? ToTArrayWithDepth<SLW_TPN_ToType<TTNP>, TTAD>
1760
+ : TT[K];
1761
+ },
1762
+ >(
1763
+ this: any,
1764
+ s: (selection: FF) => TT,
1765
+ ) => Prettify<
1766
+ ConvertToPromise<
1767
+ ConvertToAsyncIter<
1768
+ ToTArrayWithDepth<inferedResult, TAD>,
1769
+ AS_ASYNC_ITER
1770
+ >,
1771
+ AS_PROMISE
1772
+ > &
1773
+ ReplacePlaceHoldersWithTNested<
1774
+ ConvertToAsyncIter<
1775
+ ToTArrayWithDepth<inferedResult, TAD>,
1776
+ AS_ASYNC_ITER
1777
+ >,
1778
+ EE,
1779
+ REP
1780
+ >
1781
+ >);
1782
+
1648
1783
  export type SLFN<
1649
1784
  T extends object,
1650
- F,
1785
+ F extends object,
1651
1786
  N extends string,
1652
1787
  TNP extends string,
1653
1788
  TAD extends number,
@@ -1660,35 +1795,7 @@ export class SelectionWrapper<
1660
1795
  SLFN_name: N,
1661
1796
  SLFN_typeNamePure: TNP,
1662
1797
  SLFN_typeArrDepth: TAD,
1663
- ) => <
1664
- TT = T,
1665
- FF = F,
1666
- EE = E,
1667
- inferedResult = {
1668
- [K in keyof TT]: TT[K] extends SelectionWrapperImpl<
1669
- infer FN,
1670
- infer TTNP,
1671
- infer TTAD,
1672
- infer VT,
1673
- infer AT
1674
- >
1675
- ? ToTArrayWithDepth<SLW_TPN_ToType<TTNP>, TTAD>
1676
- : TT[K];
1677
- },
1678
- >(
1679
- this: any,
1680
- s: (selection: FF) => TT,
1681
- ) => Prettify<
1682
- ConvertToPromise<
1683
- ConvertToAsyncIter<ToTArrayWithDepth<inferedResult, TAD>, AS_ASYNC_ITER>,
1684
- AS_PROMISE
1685
- > &
1686
- ReplacePlaceHoldersWithTNested<
1687
- ConvertToAsyncIter<ToTArrayWithDepth<inferedResult, TAD>, AS_ASYNC_ITER>,
1688
- EE,
1689
- REP
1690
- >
1691
- >;
1798
+ ) => SLFNReturned<T, F, E, TAD, AS_PROMISE, AS_ASYNC_ITER, REP>;
1692
1799
  `;static HelperFunctions=`
1693
1800
  const selectScalars = (selection: Record<string, any>) =>
1694
1801
  Object.fromEntries(
@@ -1916,7 +2023,7 @@ export class SelectionWrapper<
1916
2023
  const selectAll = <
1917
2024
  S,
1918
2025
  TNP extends string,
1919
- SUB extends ReturnType<SLFN<{}, unknown, string, string, number>>,
2026
+ SUB extends ReturnType<SLFN<{}, object, string, string, number>>,
1920
2027
  V extends
1921
2028
  | (SelectionWrapperImpl<any, any, any> | SUB)
1922
2029
  | ((args: any) => SelectionWrapperImpl<any, any, any> | SUB),
@@ -1946,6 +2053,9 @@ export class SelectionWrapper<
1946
2053
  opts.cyclic as Record<string, string>,
1947
2054
  )
1948
2055
  .filter(([k, v]) => v !== "exclude")
2056
+ .filter(([k, v]) =>
2057
+ v.match(new RegExp(\`\${selectCyclicFieldsOptsStr}(.*)\`)),
2058
+ )
1949
2059
  .map((e) => {
1950
2060
  const levels = parseInt(
1951
2061
  e[1]
@@ -2001,7 +2111,7 @@ export class SelectionWrapper<
2001
2111
 
2002
2112
  const makeSLFN = <
2003
2113
  T extends object,
2004
- F,
2114
+ F extends object,
2005
2115
  N extends string,
2006
2116
  TNP extends string,
2007
2117
  TAD extends number,
@@ -2013,12 +2123,17 @@ export class SelectionWrapper<
2013
2123
  ) => {
2014
2124
  function _SLFN<TT extends T, FF extends F>(
2015
2125
  this: any,
2016
- s: (selection: FF) => TT,
2126
+ _s?: (selection: FF) => TT,
2017
2127
  ) {
2018
2128
  let parent: SelectionFnParent = this ?? {
2019
2129
  collector: new OperationSelectionCollector(),
2020
2130
  };
2021
2131
  function innerFn(this: any) {
2132
+ const s =
2133
+ _s ??
2134
+ ((selection: FF) =>
2135
+ (selection as any)["$all"]({ cyclic: "exclude" }) as TT);
2136
+
2022
2137
  const selection: FF = makeSLFNInput.bind(this)() as any;
2023
2138
  const r = s(selection);
2024
2139
  const _result = new SelectionWrapper(
@@ -2069,7 +2184,7 @@ export class SelectionWrapper<
2069
2184
  `:""}${Z??B.name} = "${B.name}",`}).join(`
2070
2185
  `)}
2071
2186
  };
2072
- `;return this.collector.addEnumType(this.typeMeta,P),D}makeSelectionTypeInputValueForFieldWrapperType(D,F){let P="";if(F.isEnum)P=F.ofType.name.replaceAll("!","").replaceAll("[","").replaceAll("]","");else P=this.ScalarTypeMap().get(F.name.replaceAll("!","").replaceAll("[","").replaceAll("]",""))??(F.scalarTSType?`ScalarTypeMapWithCustom["${F.name.replaceAll("!","").replaceAll("[","").replaceAll("]","")}"]`:"any");if(F.isList)return`${Array.from({length:F.isList}).map((B)=>"Array<").join("")}${P}${Array.from({length:F.isList}).map((B)=>">").join("")}`;return P}makeSelectionTypeInputValueForField(D,F=[],P=!1){let B=()=>{let X=D.args.some((J)=>J.type.isNonNull),q=`${F.join()}${D.name.slice(0,1).toUpperCase()}${D.name.slice(1)}Args`;if(!this.collector.hasArgumentType(q)){let Y=`{ ${D.args.map((H)=>{let U=H.type.isScalar,W=H.type.isEnum,O=H.type.isInput,z=`${H.name}${H.type.isNonNull?"":"?"}`,I="any";if(U)I=H.type.scalarTSType?`ScalarTypeMapWithCustom["${H.type.name.replaceAll("!","").replaceAll("[","").replaceAll("]","")}"]`:this.ScalarTypeMap().get(H.type.name.replaceAll("!","").replaceAll("[","").replaceAll("]",""))??"any";else if(O||W)I=this.originalTypeNameToTypescriptTypeName(H.type.name);return`${H.description?`/** ${H.description??`${z}`} */`:""}
2187
+ `;return this.collector.addEnumType(this.typeMeta,P),D}makeSelectionTypeInputValueForFieldWrapperType(D,F){let P="";if(F.isEnum)P=F.ofType.name.replaceAll("!","").replaceAll("[","").replaceAll("]","");else P=this.ScalarTypeMap().get(F.name.replaceAll("!","").replaceAll("[","").replaceAll("]",""))??(F.scalarTSType?`ScalarTypeMapWithCustom["${F.name.replaceAll("!","").replaceAll("[","").replaceAll("]","")}"]`:"any");if(F.isList)return`${Array.from({length:F.isList}).map((B)=>"Array<").join("")}${P}${Array.from({length:F.isList}).map((B)=>">").join("")}`;return P}makeSelectionTypeInputValueForField(D,F=[],P=!1){let B=()=>{let X=D.args.some((J)=>J.type.isNonNull),q=`${F.join()}${D.name.slice(0,1).toUpperCase()}${D.name.slice(1)}Args`;if(!this.collector.hasArgumentType(q)){let Y=`{ ${D.args.map((H)=>{let U=H.type.isScalar,W=H.type.isEnum,O=H.type.isInput,z=`${H.name}${H.type.isNonNull?"":"?"}`,I="any";if(U)I=H.type.scalarTSType?`ScalarTypeMapWithCustom["${H.type.name.replaceAll("!","").replaceAll("[","").replaceAll("]","")}"]`:(this.ScalarTypeMap().get(H.type.name.replaceAll("!","").replaceAll("[","").replaceAll("]",""))??"any")+(H.type.isList?Array.from({length:H.type.isList}).fill("[]").join(""):"");else if(O||W)I=this.originalTypeNameToTypescriptTypeName(H.type.name);return`${H.description?`/** ${H.description??`${z}`} */`:""}
2073
2188
  ${z}: ${I};`}).join(" ")} }`;this.collector.addArgumentType(q,`export type ${q} = ${Y};`)}return{argsTypeName:q,hasAtLeastOneNonNullArg:X}},Z=D.description?`/* ${D.description} */
2074
2189
  `:"";if(D.type.isScalar||D.type.isEnum){let X=this.makeSelectionTypeInputValueForFieldWrapperType(D.name,D.type);if(this.collector.addSelectionType(D.type,X),D.hasArgs){let{argsTypeName:q,hasAtLeastOneNonNullArg:J}=B();return`${Z}${D.name}: (args${J?"":"?"}: ${q}) => ${X};`}return`${Z}${D.name}${D.type.isNonNull?"":"?"}: ${X};`}else if(D.type.ofType){let X=new g0(D.type.ofType.name,this.collector,this.options);X.makeSelectionFunction();let q=X.originalTypeNameToTypescriptTypeName(X.originalFullTypeName);if(D.hasArgs){let{argsTypeName:J,hasAtLeastOneNonNullArg:Y}=B();return`${Z}${D.name}: (args${Y?"":"?"}: ${J} ) => ${q};`}if(P)return`${Z}${D.name}${D.type.isNonNull?"":"?"}: ${this.originalTypeNameToTypescriptTypeName(D.type.ofType.name)};`;return`${Z}${D.name}${D.type.isNonNull?"":"?"}: ${q};`}else throw console.error(D.type),Error(`Unknown type for field ${D.name}: ${D.type.name}`)}makeSelectionType(){if(this.typeMeta.isDirective)return"";if(this.typeMeta.isScalar||this.typeMeta.isEnum)return this.makeSelectionTypeInputValueForFieldWrapperType(this.typeName,this.typeMeta);let D=this.originalTypeNameToTypescriptTypeNameWithoutModifiers(this.originalFullTypeName);if(this.collector.hasSelectionType(this.typeMeta))return D;let F="";if(this.typeMeta.isUnion){let P=this.typeMeta.possibleTypes.map((B)=>this.originalTypeNameToTypescriptFriendlyName(B.name)).join(" | ");F=`
2075
2190
  export type ${D} = ${P};
@@ -2083,9 +2198,9 @@ export class SelectionWrapper<
2083
2198
  "${D.type.name.replaceAll("[","").replaceAll("]","").replaceAll("!","")}${D.type.isNonNull?"!":""}",
2084
2199
  ${D.type.isList??0},
2085
2200
  {},
2086
- this,
2201
+ that,
2087
2202
  undefined,
2088
- ${D.hasArgs?`args, ${P}Meta`:""})`}makeSelectionFunctionInputObjectValueForField(D,F){let P=()=>{let Z=`${F.join()}${D.name.slice(0,1).toUpperCase()}${D.name.slice(1)}Args`;if(!this.collector.hasArgumentMeta(Z)){let q=`{ ${D.args.map((J)=>{return`${J.name}: "${J.type.name}",`}).join(" ")} }`;this.collector.addArgumentMeta(Z,`export const ${Z}Meta = ${q} as const;`)}return{argsTypeName:Z}},B=D.type;if(B.isScalar||B.isEnum){let Z=this.makeSelectionFunctionInputObjectValueForFieldWrapper(D,F);if(D.hasArgs)P();return this.collector.addSelectionFunction(B,Z),`${D.name}: ${Z}`}else if(B.ofType){let Z=new g0(B.ofType.name,this.collector,this.options).makeSelectionFunction();if(D.hasArgs){let{argsTypeName:X}=P();return`${D.name}: (args: ${X}) => ${Z}.bind({ collector: this, fieldName: "${D.name}", args, argsMeta: ${X}Meta })`}return`${D.name}: ${Z}.bind({ collector: this, fieldName: "${D.name}" })`}else throw console.error(B),Error(`Unknown type for field ${D.name}: ${B.name}`)}makeDirective(){if(!this.typeMeta.isDirective)return"";let D=`_directive_${this.typeMeta.isDirective.name}`;if(this.collector.hasDirectiveFunction(this.typeMeta.isDirective))return D;let F=`${this.typeName}Args`;if(!this.collector.hasArgumentType(F)){let B=this.typeMeta.isDirective.args.map((Z)=>{let X=Z.type.isScalar,q=Z.type.isEnum,J=Z.type.isInput,Y=`${Z.name}${Z.type.isNonNull?"":"?"}`,H="any";if(X)H=Z.type.scalarTSType?`ScalarTypeMapWithCustom["${Z.type.name.replaceAll("!","").replaceAll("[","").replaceAll("]","")}"]`:this.ScalarTypeMap().get(Z.type.name.replaceAll("!","").replaceAll("[","").replaceAll("]",""))??"any";else if(J||q)H=this.originalTypeNameToTypescriptTypeName(Z.type.name);return`
2203
+ ${D.hasArgs?`args, ${P}Meta`:""})`}makeSelectionFunctionInputObjectValueForField(D,F){let P=()=>{let Z=`${F.join()}${D.name.slice(0,1).toUpperCase()}${D.name.slice(1)}Args`;if(!this.collector.hasArgumentMeta(Z)){let q=`{ ${D.args.map((J)=>{return`${J.name}: "${J.type.name}",`}).join(" ")} }`;this.collector.addArgumentMeta(Z,`export const ${Z}Meta = ${q} as const;`)}return{argsTypeName:Z}},B=D.type;if(B.isScalar||B.isEnum){let Z=this.makeSelectionFunctionInputObjectValueForFieldWrapper(D,F);if(D.hasArgs)P();return this.collector.addSelectionFunction(B,Z),`get ${D.name}() { return ${Z} }`}else if(B.ofType){let Z=new g0(B.ofType.name,this.collector,this.options).makeSelectionFunction();if(D.hasArgs){let{argsTypeName:X}=P();return`${D.name}: (args: ${X}) => ${Z}.bind({ collector: that, fieldName: "${D.name}", args, argsMeta: ${X}Meta })`}return`${D.name}: ${Z}.bind({ collector: that, fieldName: "${D.name}" }) as any`}else throw console.error(B),Error(`Unknown type for field ${D.name}: ${B.name}`)}makeDirective(){if(!this.typeMeta.isDirective)return"";let D=`_directive_${this.typeMeta.isDirective.name}`;if(this.collector.hasDirectiveFunction(this.typeMeta.isDirective))return D;let F=`${this.typeName}Args`;if(!this.collector.hasArgumentType(F)){let B=this.typeMeta.isDirective.args.map((Z)=>{let X=Z.type.isScalar,q=Z.type.isEnum,J=Z.type.isInput,Y=`${Z.name}${Z.type.isNonNull?"":"?"}`,H="any";if(X)H=Z.type.scalarTSType?`ScalarTypeMapWithCustom["${Z.type.name.replaceAll("!","").replaceAll("[","").replaceAll("]","")}"]`:(this.ScalarTypeMap().get(Z.type.name.replaceAll("!","").replaceAll("[","").replaceAll("]",""))??"any")+(Z.type.isList?Array.from({length:Z.type.isList}).fill("[]").join(""):"");else if(J||q)H=this.originalTypeNameToTypescriptTypeName(Z.type.name);return`
2089
2204
  /** ${Z.description??`${Y}`} */
2090
2205
  ${Y}: ${H};`}).join(" ");this.collector.addArgumentType(F,`export type ${F} = { ${B} };`)}if(!this.collector.hasArgumentMeta(F)){let Z=`{ ${this.typeMeta.isDirective.args.map((X)=>{return`${X.name}: "${X.type.name}",`}).join(" ")} }`;this.collector.addArgumentMeta(F,`export const ${F}Meta = ${Z} as const;`)}let P=`
2091
2206
  export const ${D} = (
@@ -2107,7 +2222,7 @@ export class SelectionWrapper<
2107
2222
  )`;let D=`${this.typeName}Selection`;if(this.collector.hasSelectionFunction(this.typeMeta))return D;else this.collector.addSelectionFunction(this.typeMeta,D);let F=this.typeMeta.fields.some((H)=>H.type.isScalar||H.type.isEnum),P=this.typeMeta.name===this.collector.QueryTypeName||this.typeMeta.name===this.collector.MutationTypeName||this.typeMeta.name===this.collector.SubscriptionTypeName,B=this.typeMeta.name===this.collector.SubscriptionTypeName,Z=this.originalTypeNameToTypescriptTypeName(this.originalFullTypeName),X="";if(this.typeMeta.isUnion)X=`
2108
2223
  $on: {
2109
2224
  ${this.typeMeta.possibleTypes.map((H)=>`${H.name}: ${this.originalTypeNameToTypescriptFriendlyName(H.name)}Selection.bind({
2110
- collector: this,
2225
+ collector: that,
2111
2226
  fieldName: "",
2112
2227
  onTypeFragment: "${H.name}",
2113
2228
  }),`).join(`
@@ -2116,27 +2231,28 @@ export class SelectionWrapper<
2116
2231
  `;else X=`
2117
2232
  $fragment: <F extends (this: any, ...args: any[]) => any>(f: F) =>
2118
2233
  f.bind({
2119
- collector: this,
2234
+ collector: that,
2120
2235
  fieldName: "",
2121
2236
  isFragment: f.name,
2122
2237
  }) as ((...args: ArgumentsTypeFromFragment<F>) => ReturnTypeFromFragment<F>),
2123
2238
  ${F?`
2124
2239
  $scalars: () =>
2125
2240
  selectScalars(
2126
- make${D}Input.bind(this)(),
2241
+ make${D}Input.bind(that)(),
2127
2242
  ) as SLWsFromSelection<
2128
2243
  ReturnType<typeof make${D}Input>
2129
2244
  >,
2130
2245
  `:""}
2131
2246
  $all: (opts?: any, collector = undefined) =>
2132
2247
  selectAll(
2133
- make${D}Input.bind(this)() as any,
2248
+ make${D}Input.bind(that)() as any,
2134
2249
  "${Z}",
2135
2250
  opts as any,
2136
2251
  collector
2137
2252
  ) as any
2138
2253
  `;let q=new Map,J=`
2139
2254
  export function make${D}Input(this: any) ${this.typeMeta.isUnion?"":`: ReturnTypeFrom${D}`} {
2255
+ const that = this;
2140
2256
  return {
2141
2257
  ${this.typeMeta.fields.map((H)=>[H,this.makeSelectionFunctionInputObjectValueForField(H,this.typeMeta.isInput?[]:[this.typeName])]).map(([H,U])=>{let W=`
2142
2258
  $lazy: (
@@ -2411,42 +2527,41 @@ export class SelectionWrapper<
2411
2527
 
2412
2528
  if (typeof fieldFn === "function") {
2413
2529
  const makeSubSelectionFn =
2414
- (
2415
- opFnArgs?: Exclude<
2416
- Parameters<Extract<typeof fieldFn, (args: any) => any>>[0],
2417
- (args: any) => any
2418
- >,
2419
- ) =>
2420
- (opFnSelectionCb: (selection: unknown) => unknown) => {
2421
- const fieldSLFN =
2422
- opFnArgs === undefined
2423
- ? fieldFn
2424
- : (
2425
- fieldFn as (
2426
- args: typeof opFnArgs,
2427
- ) => (s: typeof opFnSelectionCb) => unknown
2428
- )(opFnArgs);
2429
-
2430
- const fieldSlw = (fieldSLFN as Extract<typeof fieldSLFN, (args: any) => any>)(
2431
- opFnSelectionCb as any,
2432
- ) as unknown as SelectionWrapperImpl<
2433
- typeof field,
2434
- string,
2435
- number,
2436
- any,
2437
- typeof opFnArgs
2438
- >;
2530
+ (opFnArgs?: Exclude<Parameters<Extract<typeof fieldFn, (args: any) => any>>[0], (args: any) => any>) =>
2531
+ (opFnSelectionCb?: (selection: unknown) => unknown) => {
2532
+ let fieldSLFN:
2533
+ | ((s: typeof opFnSelectionCb) => SelectionWrapperImpl<typeof field, string, number, any, typeof opFnArgs>)
2534
+ | SelectionWrapperImpl<typeof field, string, number, any, typeof opFnArgs>;
2535
+ if (opFnArgs === undefined) {
2536
+ fieldSLFN = fieldFn as Extract<typeof fieldFn, () => SelectionWrapperImpl<typeof field, string, number, any, typeof opFnArgs>>;
2537
+ } else {
2538
+ fieldSLFN = (
2539
+ fieldFn as unknown as (
2540
+ args: typeof opFnArgs,
2541
+ ) =>
2542
+ | ((s: typeof opFnSelectionCb) => SelectionWrapperImpl<typeof field, string, number, any, typeof opFnArgs>)
2543
+ | SelectionWrapperImpl<typeof field, string, number, any, typeof opFnArgs>
2544
+ )(opFnArgs);
2545
+ }
2546
+
2547
+ let fieldSlw: SelectionWrapperImpl<typeof field, string, number, any, typeof opFnArgs>;
2548
+ if (typeof fieldSLFN === "function") {
2549
+ fieldSlw = (fieldSLFN as (s: typeof opFnSelectionCb) => SelectionWrapperImpl<typeof field, string, number, any, typeof opFnArgs>)(
2550
+ opFnSelectionCb,
2551
+ );
2552
+ } else {
2553
+ fieldSlw = fieldSLFN;
2554
+ }
2555
+
2439
2556
  const opSlw = new SelectionWrapper(
2440
2557
  undefined,
2441
2558
  undefined,
2442
2559
  undefined,
2443
2560
  { [field]: fieldSlw },
2444
- new OperationSelectionCollector(
2445
- operation + "Selection",
2446
- root,
2447
- ),
2561
+ new OperationSelectionCollector(operation + "Selection", root),
2448
2562
  root,
2449
2563
  );
2564
+ fieldSlw[ROOT_OP_COLLECTOR] = rootRef;
2450
2565
  fieldSlw[SLW_PARENT_SLW] = opSlw;
2451
2566
  opSlw[SLW_IS_ROOT_TYPE] = operation;
2452
2567
  opSlw[SLW_PARENT_COLLECTOR] = opSlw[SLW_COLLECTOR];
@@ -2476,8 +2591,23 @@ export class SelectionWrapper<
2476
2591
  const result = new Promise((resolve, reject) => {
2477
2592
  root.execute()
2478
2593
  .catch(reject)
2479
- .then(() => {
2480
- resolve((rootSlw as any)[field]);
2594
+ .then((_data) => {
2595
+ const d = _data[field];
2596
+
2597
+ if (Symbol.asyncIterator in d) {
2598
+ return resolve(fieldSlw as any);
2599
+ }
2600
+
2601
+ const slw = (rootSlw as any)[field] as any;
2602
+ if (typeof d === "object" && d && field in d) {
2603
+ const retval = d[field];
2604
+ if (retval === undefined || retval === null) {
2605
+ return resolve(retval);
2606
+ }
2607
+ const ret = typeof retval !== "object" ? slw : proxify(retval, slw);
2608
+ return resolve(ret);
2609
+ }
2610
+ return resolve(slw);
2481
2611
  });
2482
2612
  });
2483
2613
  if (String(_prop) === "then") {
@@ -2509,13 +2639,20 @@ export class SelectionWrapper<
2509
2639
  if (fieldFn.name.startsWith("bound ")) {
2510
2640
  return makeSubSelectionFn();
2511
2641
  }
2512
- return (
2513
- opFnArgs: Exclude<
2514
- Parameters<Extract<typeof fieldFn, (args: any) => any>>[0],
2515
- (args: any) => any
2516
- >,
2517
- ) => {
2518
- return makeSubSelectionFn(opFnArgs);
2642
+ return (opFnArgs: Exclude<Parameters<Extract<typeof fieldFn, (args: any) => any>>[0], (args: any) => any>) => {
2643
+ const inner = (
2644
+ fieldFn as unknown as (
2645
+ args: typeof opFnArgs,
2646
+ ) =>
2647
+ | ((s: unknown) => SelectionWrapperImpl<typeof field, string, number, any, typeof opFnArgs>)
2648
+ | SelectionWrapperImpl<typeof field, string, number, any, typeof opFnArgs>
2649
+ )(opFnArgs);
2650
+
2651
+ if (typeof inner === "function") {
2652
+ return makeSubSelectionFn(opFnArgs);
2653
+ }
2654
+
2655
+ return makeSubSelectionFn(opFnArgs)();
2519
2656
  };
2520
2657
  } else {
2521
2658
  const fieldSlw = fieldFn as SelectionWrapperImpl<any, any, any>;
@@ -2557,8 +2694,23 @@ export class SelectionWrapper<
2557
2694
  const result = new Promise((resolve, reject) => {
2558
2695
  root.execute()
2559
2696
  .catch(reject)
2560
- .then(() => {
2561
- resolve((rootSlw as any)[field]);
2697
+ .then((_data) => {
2698
+ const d = _data[field];
2699
+
2700
+ if (Symbol.asyncIterator in d) {
2701
+ return resolve(fieldSlw as any);
2702
+ }
2703
+
2704
+ const slw = (rootSlw as any)[field] as any;
2705
+ if (typeof d === "object" && d && field in d) {
2706
+ const retval = d[field];
2707
+ if (retval === undefined || retval === null) {
2708
+ return resolve(retval);
2709
+ }
2710
+ const ret = typeof retval !== "object" ? slw : proxify(retval, slw);
2711
+ return resolve(ret);
2712
+ }
2713
+ return resolve(slw);
2562
2714
  });
2563
2715
  });
2564
2716
  if (String(_prop) === "then") {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@samarium.sdk/new",
3
- "version": "0.25.2",
3
+ "version": "0.27.0",
4
4
  "main": "bin/samarium",
5
5
  "type": "module",
6
6
  "repository": {
@@ -44,7 +44,7 @@
44
44
  },
45
45
  "devDependencies": {
46
46
  "bun-types": "^1.2.19",
47
- "@samarium.sdk/make": "0.25.2"
47
+ "@samarium.sdk/make": "0.27.0"
48
48
  },
49
49
  "peerDependencies": {
50
50
  "typescript": "^5.0.0"