fig-tree-evaluator 3.0.0-preview.2 → 3.0.0-preview.4
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/build/chunks/shared.js +1 -1
- package/build/format/index.d.ts +7 -2
- package/build/format/index.js +1 -1
- package/build/index.d.ts +16 -11
- package/build/index.js +1 -1
- package/build/migrate/index.d.ts +1 -1
- package/build/migrate/index.js +1 -1
- package/package.json +1 -1
package/build/chunks/shared.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
const e={unknownOperator:"unknown-operator",typeCheck:"type-check",operatorFailure:"operator-failure",timeout:"timeout",requestTimeout:"request-timeout",aborted:"aborted",unknownNodeKey:"unknown-node-key",unresolvedVar:"unresolved-var",unrecognizedIdentifier:"unrecognized-identifier",depthCeiling:"depth-ceiling",nonFiniteResult:"non-finite-result",escapedHandle:"escaped-handle",emptyAggregate:"empty-aggregate",malformedNode:"malformed-node",unknownFragment:"unknown-fragment",positionalArity:"positional-arity",invalidVars:"invalid-vars",invalidReference:"invalid-reference",uselessModifier:"useless-modifier",unreferencedVar:"unreferenced-var",missingRequired:"missing-required",unresolvedParam:"unresolved-param",unresolvedBinding:"unresolved-binding",deadBinding:"dead-binding",invalidAs:"invalid-as",maxDepthExceeded:"max-depth",maxNodesExceeded:"max-nodes",returnsMismatch:"returns-mismatch",operatorValidate:"operator-validate",missingDataPath:"missing-data-path",shadowedVar:"shadowed-var",varCycle:"var-cycle",bareVars:"bare-vars",fragmentCycle:"fragment-cycle",unboundToken:"unbound-token",unusedSubstitution:"unused-substitution",tokenRenumber:"token-renumber",inertReferenceToken:"inert-reference-token",invalidDefinition:"invalid-definition",invalidName:"invalid-name",reservedName:"reserved-name",invalidNullPolicy:"invalid-null-policy",duplicateOperator:"duplicate-operator",invalidOptions:"invalid-options"},
|
|
1
|
+
const e={unknownOperator:"unknown-operator",typeCheck:"type-check",operatorFailure:"operator-failure",timeout:"timeout",requestTimeout:"request-timeout",aborted:"aborted",unknownNodeKey:"unknown-node-key",unresolvedVar:"unresolved-var",unrecognizedIdentifier:"unrecognized-identifier",depthCeiling:"depth-ceiling",nonFiniteResult:"non-finite-result",escapedHandle:"escaped-handle",emptyAggregate:"empty-aggregate",malformedNode:"malformed-node",unknownFragment:"unknown-fragment",positionalArity:"positional-arity",invalidVars:"invalid-vars",invalidReference:"invalid-reference",uselessModifier:"useless-modifier",unreferencedVar:"unreferenced-var",missingRequired:"missing-required",unresolvedParam:"unresolved-param",unresolvedBinding:"unresolved-binding",deadBinding:"dead-binding",invalidAs:"invalid-as",maxDepthExceeded:"max-depth",maxNodesExceeded:"max-nodes",returnsMismatch:"returns-mismatch",operatorValidate:"operator-validate",missingDataPath:"missing-data-path",shadowedVar:"shadowed-var",varCycle:"var-cycle",bareVars:"bare-vars",fragmentCycle:"fragment-cycle",unboundToken:"unbound-token",unusedSubstitution:"unused-substitution",tokenRenumber:"token-renumber",inertReferenceToken:"inert-reference-token",invalidDefinition:"invalid-definition",invalidName:"invalid-name",reservedName:"reserved-name",invalidNullPolicy:"invalid-null-policy",duplicateOperator:"duplicate-operator",invalidOptions:"invalid-options"},n=Symbol("figtree.path.wildcard"),t=e=>"string"==typeof e||"number"==typeof e||e===n,r={found:!1,value:void 0},a=e=>{const n=[];let t="",r=!1,a=0;const s=()=>{r&&(n.push(t),t="",r=!1)};for(;a<e.length;){const o=e[a];if("."!==o){if("["===o){s();const{segment:t,next:r}=i(e,a);n.push(t),a=r;continue}t+=o,r=!0,a++}else s(),a++}return s(),n},i=(e,t)=>{let r=t+1;if(r>=e.length)throw s(e,'unterminated "["');const a=e[r];if("*"===a){if("]"!==e[r+1])throw s(e,'expected "]" after "[*"');return{segment:n,next:r+2}}if('"'===a||"'"===a){const n=a;r++;let t="";for(;r<e.length;){const a=e[r];if("\\"===a){const n=e[r+1];if(void 0===n)throw s(e,"trailing escape in quoted key");t+=n,r+=2;continue}if(a===n){if("]"!==e[r+1])throw s(e,'expected "]" after quoted key');return{segment:t,next:r+2}}t+=a,r++}throw s(e,"unterminated quoted key")}let i="";for(;r<e.length&&e[r]>="0"&&e[r]<="9";)i+=e[r],r++;if(i.length>0&&"]"===e[r])return{segment:Number(i),next:r+1};throw s(e,'expected a number, "*", or a quoted key inside "[…]"')},s=(e,n)=>new Error(`Invalid path "${e}": ${n}`),o=(e,n)=>l(e,(e=>Array.isArray(e)?e.slice():a(e))(n),0),l=(e,t,a)=>{if(a>=t.length)return{found:!0,value:e};const i=t[a];if(i===n){if(!Array.isArray(e))return r;const n=a+1;if(n>=t.length)return{found:!0,value:e};return{found:!0,value:e.map(e=>{const r=l(e,t,n);return r.found?r.value:null})}}const s=d(e,i);return s.found?l(s.value,t,a+1):r},d=(e,n)=>{if(null===e||"object"!=typeof e)return r;if(Array.isArray(e)){const t="number"==typeof n?n:u(n);return void 0===t||t<0||t>=e.length?r:{found:!0,value:e[t]}}const t=String(n);return Object.prototype.propertyIsEnumerable.call(e,t)?{found:!0,value:e[t]}:r},u=e=>/^\d+$/.test(e)?Number(e):void 0,c=e=>e.map(e=>"string"==typeof e?u(e)??e:e),m={data:"data",d:"data",vars:"vars",v:"vars",params:"params",p:"params",element:"element",e:"element",index:"index",i:"index"},f=e=>{if(!e.startsWith("$"))return null;const n=/^\$([^.[]*)/.exec(e)[1];return{token:n,rest:e.slice(1+n.length)}},p=e=>""===e?[]:a(e.startsWith(".")?e.slice(1):e),h=e=>`${e}Index`,g=(e,n)=>{for(const t of n){if(e===t)return"element";if(e===h(t))return"index"}return null},v=(n,t)=>{const r=f(n);if(null===r)return{kind:"plain"};const{token:a,rest:i}=r,s=m[a];if(void 0===s){const e=void 0===t?.bindings?null:g(a,t.bindings);return null===e?{kind:"unrecognized"}:y(a,i,e)}if(""===i)return"vars"===s?{kind:"invalid",namespace:s,code:e.bareVars,reason:"'$vars' must name a var — there is no whole-scope value"}:{kind:"reference",namespace:s,segments:[],drill:i};if("index"===s)return{kind:"invalid",namespace:s,reason:"'$index' is bare-only — it cannot be drilled"};try{return{kind:"reference",namespace:s,segments:p(i),drill:i}}catch(e){return{kind:"invalid",namespace:s,reason:e.message}}},y=(e,n,t)=>{if("index"===t)return""!==n?{kind:"invalid",namespace:t,reason:"the index binding is bare-only — it cannot be drilled"}:{kind:"reference",namespace:t,segments:[],drill:n,binding:e};try{return{kind:"reference",namespace:t,segments:p(n),drill:n,binding:e}}catch(e){return{kind:"invalid",namespace:t,reason:e.message}}},b=e=>e.map((e,t)=>"number"==typeof e?`[${e}]`:e===n?"[*]":$(e,0===t)).join(""),k=/[.[\]"\\]/,$=(e,n)=>""===e||k.test(e)?`["${e.replace(/[\\"]/g,e=>`\\${e}`)}"]`:n?e:`.${e}`,x=/^[A-Za-z_$][\w$]*(?:\.[A-Za-z_$][\w$]*)*$/,w=e=>x.test(e),A=(e,n)=>{const t=b(n);return""===t?`$${e}`:t.startsWith("[")?`$${e}${t}`:`$${e}.${t}`},P=e=>A("data",e),j=()=>{},D=e=>"object"==typeof e&&null!==e&&"function"==typeof e.then,N=e=>"object"==typeof e&&null!==e&&!Array.isArray(e),S=e=>{if("object"!=typeof e||null===e||Array.isArray(e))return!1;const n=Object.getPrototypeOf(e);return n===Object.prototype||null===n},q=(e,n)=>{if(e===n)return 0;const t=e.length+1,r=n.length+1;let a=Array.from({length:r},(e,n)=>n);for(let i=1;i<t;i++){const t=[i];for(let s=1;s<r;s++){const r=a[s-1]+(e[i-1]===n[s-1]?0:1);t.push(Math.min(a[s]+1,t[s-1]+1,r))}a=t}return a[r-1]},O=(e,n)=>{let t,r=3;for(const a of n){const n=q(e,a);n<r&&(t=a,r=n)}return t},W=e=>{let n=2166136261;for(let t=0;t<e.length;t++)n^=e.charCodeAt(t),n=Math.imul(n,16777619)>>>0;return n.toString(16).padStart(8,"0")},C=e=>{let n;return()=>(void 0===n&&(n=(async()=>e())()),n)},E=/*#__PURE__*/new Set(["fallback","noCache","vars","//"]),V=500,z={kind:"operator"},R={kind:"fragment"},F={kind:"plain"},I=e=>({kind:"malformed",message:e}),M=(e,n)=>{const t="operator"in e,r="fragment"in e,a=[];for(const t in e)t.startsWith("$")&&n(t.slice(1))&&a.push(t);return t&&r?I("'operator' and 'fragment' may not share a node"):(t||r)&&a.length>0?I(`a canonical '${t?"operator":"fragment"}' key may not sit beside the shorthand key '${a[0]}'`):t?z:r?R:a.length>=2?I(`one node, one invocation: found ${a.map(e=>`'${e}'`).join(" and ")}`):1===a.length?{kind:"shorthand",key:a[0]}:F},T=(e,n)=>{if(!S(e))return!1;if("operator"in e||"fragment"in e)return!0;for(const t in e)if(t.startsWith("$")&&n(t.slice(1)))return!0;return!1},B=(e,n)=>{const t=e.positionalParams;if(void 0===t)return null;const r=e.restParam,a=null===r?t.length:t.length-1;return n>a&&null===r?null:{bound:Math.min(n,a),restAt:null!==r&&n>=a?a:null}},Z=e=>{const n=e.positionalParams?.[0];return void 0===n?null:n.startsWith("...")?e.restParam:n},_=["path","default"],G=/*#__PURE__*/new Set(["operator","fragment","parameters","fallback","noCache","vars","//"]),H=/*#__PURE__*/new Set([...G,"data","params","element","index","d","v","p","e","i","literal"]),J=e=>"string"!=typeof e?{ok:!1,reason:"a name must be a string"}:""===e?{ok:!1,reason:"a name must be non-empty"}:e.startsWith("$")?{ok:!1,reason:"a name may not start with '$'"}:/[.[\]]/.test(e)?{ok:!1,reason:"a name may not contain '.', '[' or ']'"}:{ok:!0};class K extends Error{code;path;holePath;operator;fragment;fragmentPath;errorData;related;cause;issues;trace;constructor(e){super(e.message),this.name="FigTreeError",this.code=e.code,this.path=e.path,void 0!==e.holePath&&(this.holePath=e.holePath),void 0!==e.operator&&(this.operator=e.operator),void 0!==e.fragment&&(this.fragment=e.fragment),void 0!==e.fragmentPath&&(this.fragmentPath=e.fragmentPath),void 0!==e.errorData&&(this.errorData=e.errorData),void 0!==e.related&&(this.related=e.related),void 0!==e.cause&&(this.cause=e.cause),void 0!==e.issues&&(this.issues=e.issues),void 0!==e.trace&&(this.trace=e.trace)}prettyPrint(){const e=this.operator?` (operator: ${this.operator})`:"",n=this.path.length>0?` at ${Q(this.path)}`:"",t=`${this.code}${e}${n}`,r=this.errorData&&Object.keys(this.errorData).length>0?`\n${JSON.stringify(this.errorData,null,2)}`:"";return`${t}\n${this.message}${r}`}}const L=e=>e instanceof K,Q=e=>e.map((e,n)=>"number"==typeof e?`[${e}]`:0===n?e:`.${e}`).join(""),U=e=>"object"==typeof e&&null!==e&&!Array.isArray(e)&&"literal"in e,X=(e,n)=>{const t=Y(e),r=Y(n);return!(!t.any&&!r.any)||(void 0!==t.literals&&void 0!==r.literals?t.literals.some(e=>r.literals.includes(e)):void 0!==t.literals?t.literals.some(e=>ee(e,r.basics)):void 0!==r.literals?r.literals.some(e=>ee(e,t.basics)):t.basics.some(e=>r.basics.includes(e)||"integer"===e&&r.basics.includes("number")||"number"===e&&r.basics.includes("integer")))},Y=e=>{if(U(e))return{any:!1,basics:[],literals:e.literal};const n="string"==typeof e?[e]:e;return{any:n.includes("any"),basics:n}},ee=(e,n)=>"string"==typeof e?n.includes("string"):"boolean"==typeof e?n.includes("boolean"):n.includes("number")||Number.isInteger(e)&&n.includes("integer");export{W as A,A as B,V as D,e as E,K as F,_ as G,G as R,E as S,n as W,T as a,f as b,M as c,b as d,a as e,N as f,U as g,J as h,S as i,w as j,c as k,g as l,t as m,O as n,h as o,B as p,o as q,v as r,Z as s,X as t,H as u,j as v,L as w,C as x,D as y,P as z};
|
package/build/format/index.d.ts
CHANGED
|
@@ -46,6 +46,7 @@ interface PositionalLayout {
|
|
|
46
46
|
restAt: number | null;
|
|
47
47
|
}
|
|
48
48
|
declare const positionalLayout: (shape: PositionalShape, length: number) => PositionalLayout | null;
|
|
49
|
+
declare const singlePositionalTarget: (shape: PositionalShape) => string | null;
|
|
49
50
|
|
|
50
51
|
declare const WILDCARD: unique symbol;
|
|
51
52
|
type Wildcard = typeof WILDCARD;
|
|
@@ -64,6 +65,7 @@ type ReferenceRecognition = {
|
|
|
64
65
|
namespace: ReferenceNamespace;
|
|
65
66
|
segments: PathSegment[];
|
|
66
67
|
drill: string;
|
|
68
|
+
binding?: string;
|
|
67
69
|
} | {
|
|
68
70
|
kind: 'invalid';
|
|
69
71
|
namespace: ReferenceNamespace;
|
|
@@ -74,7 +76,10 @@ type ReferenceRecognition = {
|
|
|
74
76
|
} | {
|
|
75
77
|
kind: 'plain';
|
|
76
78
|
};
|
|
77
|
-
|
|
79
|
+
interface ReferenceScope {
|
|
80
|
+
bindings?: readonly string[];
|
|
81
|
+
}
|
|
82
|
+
declare const recognizeReference: (value: string, scope?: ReferenceScope) => ReferenceRecognition;
|
|
78
83
|
|
|
79
84
|
declare const typesIntersect: (a: ExpectedType, b: ExpectedType) => boolean;
|
|
80
85
|
|
|
@@ -83,4 +88,4 @@ declare const toShorthand: (expression: unknown, fig: Registry, options?: Shorth
|
|
|
83
88
|
declare const toGet: (reference: unknown, options?: NameOptions) => Record<string, unknown> | null;
|
|
84
89
|
declare const toReference: (node: unknown, options?: NameOptions) => string | null;
|
|
85
90
|
|
|
86
|
-
export { classifyObject, positionalLayout, recognizeReference, toCanonical, toGet, toReference, toShorthand, typesIntersect };
|
|
91
|
+
export { classifyObject, positionalLayout, recognizeReference, singlePositionalTarget, toCanonical, toGet, toReference, toShorthand, typesIntersect };
|
package/build/format/index.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{c as e,E as r,p as n,S as a,i as s,a as o,R as i,s as l,r as u,b as f,d as c,W as p,G as m,e as d,F as h,D as k}from"../chunks/shared.js";export{t as typesIntersect}from"../chunks/shared.js";const g=e=>{const r=new Map;for(const{name:t,alias:n,positionalParams:a,restParam:s}of e.getOperators()){const e={name:t,alias:n,positionalParams:a,restParam:s};r.set(t,e),void 0!==n&&r.set(n,e)}const t=new Set(e.getFragments().map(({name:e})=>e));return{operators:r,fragments:t,recognizes:e=>"literal"===e||r.has(e)||t.has(e)}},v=(e,r)=>{const t=n(e,r.length);if(null===t)return null;const a=e.positionalParams,s=[];for(let e=0;e<t.bound;e++)s.push([a[e],r[e]]);return null!==t.restAt&&s.push([e.restParam,0===t.restAt?r:r.slice(t.restAt)]),s},y=/*#__PURE__*/new Set(["fallback","useCache","vars"]),$=(e,t,n)=>{const a=e.operator;if("string"!=typeof a)return n(r.malformedNode,"the 'operator' value must be a literal string");if("literal"===a)return w(e,n);const s=t.operators.get(a);if(void 0===s)return n(r.unknownOperator,`'${a}' names no registered operator`);const o=[],i=[];for(const t in e){const a=e[t];if(void 0!==a)if("operator"===t)o.push({kind:"invocation"});else if("//"===t||y.has(t))o.push({kind:"keep",key:t,value:a});else{if("parameters"===t)return n(r.malformedNode,"'parameters' is reserved and unused on operator nodes");o.push({kind:"param",name:t,value:a}),i.push([t,a])}}return{kind:"operator",operator:s,spelling:a,slots:o,params:i,fromPayload:!1}},w=(e,t)=>{if(!("value"in e))return t(r.malformedNode,"'literal' requires its content in 'value'");const n=[];for(const a in e){const s=e[a];if("operator"===a)n.push({kind:"invocation"});else if("value"===a)n.push({kind:"param",name:"value",value:s});else{if(void 0===s)continue;if("//"!==a&&!y.has(a))return t(r.unknownNodeKey,`'${a}' is not a key of 'literal' — content goes in 'value'`);n.push({kind:"keep",key:a,value:s})}}return{kind:"literal",content:e.value,slots:n,fromPayload:!1}},P=(e,t,n)=>{const a=e.fragment;if("string"!=typeof a)return n(r.malformedNode,"the 'fragment' value must be a literal string");if(!t.fragments.has(a))return n(r.unknownFragment,`'${a}' names no registered fragment`);const s=[];for(const a in e){const o=e[a];if(void 0!==o)if("fragment"===a)s.push({kind:"invocation"});else if("parameters"===a)A(o,t,n),s.push({kind:"param",name:a,value:o});else{if("//"!==a&&"fallback"!==a&&"vars"!==a)return"useCache"===a?n(r.malformedNode,"'useCache' is not available on fragment calls — caching stays operator-level"):n(r.unknownNodeKey,`'${a}' is not a key of a fragment call — arguments live only in 'parameters'`);s.push({kind:"keep",key:a,value:o})}}return{kind:"fragment",name:a,slots:s,parameters:e.parameters,fromPayload:!1}},A=(e,t,n)=>{s(e)||o(e,t.recognizes)||"string"==typeof e&&"reference"===u(e).kind||n(r.malformedNode,"a fragment's 'parameters' must be a named-arguments object or a node computing one")},N=(e,t,n,o)=>{const i=t.slice(1),l="literal"===i,u=!l&&n.fragments.has(i),f=[];for(const n in e){const s=e[n];if(n!==t){if(!a.has(n)||u&&"useCache"===n)return o(r.malformedNode,`'${n}' may not sit beside the shorthand key '${t}' — reserved modifiers only`);void 0!==s&&f.push({kind:"keep",key:n,value:s})}else f.push({kind:"invocation"})}const c=e[t];if(l)return{kind:"literal",content:c,slots:f,fromPayload:!0};if(u)return s(c)?{kind:"fragment",name:i,slots:f,parameters:c,fromPayload:!0}:o(r.malformedNode,`fragments have no single-value or positional form — '${t}' takes a named-arguments object`);const p=n.operators.get(i);return{kind:"operator",operator:p,spelling:i,slots:f,params:b(p,c,n,o),fromPayload:!0}},b=(e,t,n,a)=>{const u=()=>a(r.positionalArity,`'${e.name}' takes no positional arguments — use the named form`);if(Array.isArray(t)){const n=v(e,t);if(null!==n)return n;if(void 0===e.positionalParams)return u();const s=e.positionalParams;return a(r.positionalArity,`'${e.name}' takes at most ${s.length} positional argument${1===s.length?"":"s"} (${s.join(", ")}), got ${t.length}`)}if(s(t)&&!o(t,n.recognizes)){const n=[];for(const s in t){const o=t[s];if(void 0!==o){if("//"!==s&&i.has(s))return a(r.unknownNodeKey,`'${s}' is not a parameter of '${e.name}'`);n.push([s,o])}}return n}const f=l(e);return null===f?u():[[f,t]]},j={positionalParams:m,restParam:null},z=/*#__PURE__*/new Set(["path","from","default"]),W={data:"d",vars:"v",params:"p",element:"e",index:"i"},x=(e,r,t)=>"canonical"===t?r:"alias"===t?W[r]:e,C=(e,r)=>{if("preserve"===r)return e;const t=u(e);if("reference"!==t.kind)return e;const{token:n,rest:a}=f(e);return`$${x(n,t.namespace,r)}${a}`},M=e=>e.startsWith(".")?e.slice(1):e,S=(e,r)=>{if("string"!=typeof e)return null;const t=u(e);if("reference"!==t.kind)return null;const{namespace:n}=t,{token:a,rest:s}=f(e),o=`$${x(a,n,r)}`;switch(n){case"data":return{operator:"get",path:M(s)};case"element":return{operator:"get",path:M(s),from:o};case"vars":case"params":{if(0===t.segments.length)return{operator:"get",path:"",from:o};const e=(e=>{if(e.startsWith(".")){let r=1;for(;r<e.length&&"."!==e[r]&&"["!==e[r];)r++;return r>1?r:null}const r=e[1];if("["!==e[0]||'"'!==r&&"'"!==r)return null;for(let t=2;t<e.length;t++)if("\\"===e[t])t++;else if(e[t]===r)return"]"===e[t+1]?t+2:null;return null})(s);return null===e?null:{operator:"get",path:M(s.slice(e)),from:`${o}${s.slice(0,e)}`}}default:return null}},F=(e,r)=>{if(e.has("default"))return null;const t=(e=>{if("string"==typeof e){if(e.startsWith("$"))return null;try{return d(e)}catch{return null}}if(!Array.isArray(e))return null;for(const r of e)if(!("string"==typeof r&&!r.startsWith("$")||"number"==typeof r&&Number.isInteger(r)&&r>=0))return null;return e})(e.get("path"));if(null===t)return null;const n=c(t);let a;const s=e.get("from");if(void 0===s)a="canonical"===r?"$data":"$d";else{if("string"!=typeof s)return null;const e=u(s);if("reference"!==e.kind||"index"===e.namespace)return null;if(""!==n&&e.segments.includes(p))return null;a=C(s,r).replace(/\.$/,"")}return""===n?a:n.startsWith("[")?`${a}${n}`:`${a}.${n}`},K=e=>{const r=[];for(let t=e;null!==t;t=t.parent)r.push(t.key);return r.reverse()};class O{lookup;writer;path=null;depth=0;constructor(e,r){this.lookup=e,this.writer=r}fail=(e,r)=>{throw new h({code:e,message:r,path:K(this.path)})};child(e,r){return this.within(r,()=>this.value(e))}within(e,r){const{path:t,depth:n}=this;this.path={parent:t,key:e},this.depth=n+1;const a=r();return this.path=t,this.depth=n,a}value(t){if(this.depth>k&&this.fail(r.depthCeiling,`the expression nests deeper than the engine's ceiling of ${k} levels`),"string"==typeof t)return this.writer.string(t);if(Array.isArray(t))return t.map((e,r)=>this.child(e,r));if(!s(t))return t;const n=((t,n,a)=>{const s=e(t,n.recognizes);switch(s.kind){case"malformed":return a(r.malformedNode,s.message);case"plain":return s;case"operator":return $(t,n,a);case"fragment":return P(t,n,a);case"shorthand":return N(t,s.key,n,a)}})(t,this.lookup,this.fail);switch(n.kind){case"plain":return this.entries(t,!0);case"operator":return this.writer.operator(n,this);case"fragment":return this.writer.fragment(n,this);case"literal":return this.writer.literal(n,this)}}keep({key:e,value:r}){return"fallback"===e?this.child(r,e):"vars"===e?this.vars(r):r}parameters(e){return!s(e)||o(e,this.lookup.recognizes)?this.child(e,"parameters"):this.within("parameters",()=>this.entries(e,!1))}entries(e,r){const t={};for(const n in e){const a=e[n];t[n]="//"===n?a:r&&"vars"===n?this.vars(a):this.child(a,n)}return t}vars(e){return s(e)?this.within("vars",()=>this.entries(e,!1)):e}}const E=(e,r)=>"canonical"===r?e.operator.name:"alias"===r?e.operator.alias??e.operator.name:e.spelling,G=e=>Array.isArray(e)?e:[e],I=(e,r)=>[...G(e),...G(r)],R=e=>e.params.find(([e])=>"//"===e)?.[1],q=e=>e.slots.some(e=>"keep"===e.kind&&"//"===e.key),D={kind:"named"},B=(e,r)=>!(Array.isArray(e)||s(e)&&!o(e,r.recognizes)),H=(e={})=>{const r=e.operatorNames??"preserve",t=e.referenceNames??"preserve",n="named"===e.arguments,a=e.getAsReference??!0;return{operator:(e,s)=>{const o=e.params.map(([e,r])=>[e,"//"===e?r:s.child(r,e)]),i=o.filter(([e])=>"//"!==e);if(a&&"get"===e.operator.name){const r=e.slots.some(e=>"keep"===e.kind&&"//"!==e.key)?null:F(new Map(i),t);if(null!==r)return r}const l=n?D:((e,r,t)=>{const n=e.positionalParams;if(void 0===n||0===r.length)return D;const a=e.restParam,s=null===a?n:n.slice(0,-1),o=new Map(r);for(const e of o.keys())if(e!==a&&!s.includes(e))return D;let i=0;for(;i<s.length&&o.has(s[i]);)i++;for(let e=i;e<s.length;e++)if(o.has(s[e]))return D;const l=null!==a&&o.has(a);if(null!==a&&l!==(i===s.length))return D;const u=s.slice(0,i).map(e=>o.get(e));if(l){const e=o.get(a);return Array.isArray(e)?{kind:"array",value:[...u,...e]}:0===s.length&&B(e,t)?{kind:"single",value:e}:D}return 1===i&&B(u[0],t)?{kind:"single",value:u[0]}:{kind:"array",value:u}})(e.operator,i,s.lookup),u="named"===l.kind?void 0:R(e),f=void 0!==u&&q(e),c={};for(const t of e.slots)"invocation"===t.kind?(void 0===u||f||(c["//"]=u),c[`$${E(e,r)}`]="named"===l.kind?Object.fromEntries(o):l.value):"keep"===t.kind&&(c[t.key]="//"===t.key&&f?I(t.value,u):s.keep(t));return c},fragment:(e,r)=>{const t=void 0===e.parameters?{}:r.parameters(e.parameters),n="string"==typeof t,a={};for(const s of e.slots)"invocation"===s.kind?n?(a.fragment=e.name,e.fromPayload&&(a.parameters=t)):a[`$${e.name}`]=t:"param"===s.kind?n&&(a.parameters=t):a[s.key]=r.keep(s);return a},literal:(e,r)=>{const t={};for(const n of e.slots)"invocation"===n.kind?t.$literal=e.content:"keep"===n.kind&&(t[n.key]=r.keep(n));return t},string:e=>C(e,t)}},J=(e,r,t)=>new O(g(r),((e={})=>{const r=e.operatorNames??"preserve",t=e.referenceNames??"preserve",n=e.referencesAsGet??!1;return{operator:(e,t)=>{const n={},a=e.fromPayload?R(e):void 0,s=void 0!==a&&q(e);for(const o of e.slots)if("invocation"===o.kind){if(void 0===a||s||(n["//"]=a),n.operator=E(e,r),e.fromPayload)for(const[r,a]of e.params)"//"!==r&&(n[r]=t.child(a,r))}else"param"===o.kind?n[o.name]=t.child(o.value,o.name):"//"===o.key&&s?n["//"]=I(o.value,a):n[o.key]=t.keep(o);return n},fragment:(e,r)=>{const t={};for(const n of e.slots)"invocation"===n.kind?(t.fragment=e.name,e.fromPayload&&(t.parameters=r.parameters(e.parameters))):"param"===n.kind?t.parameters=r.parameters(n.value):t[n.key]=r.keep(n);return t},literal:(e,r)=>{const t={};for(const n of e.slots)"invocation"===n.kind?(t.operator="literal",e.fromPayload&&(t.value=e.content)):"param"===n.kind?t.value=e.content:t[n.key]=r.keep(n);return t},string:e=>{if(n){const r=S(e,t);if(null!==r)return r}return C(e,t)}}})(t)).value(e),L=(e,r,t)=>new O(g(r),H(t)).value(e),Q=(e,r)=>S(e,r?.referenceNames??"preserve"),T=(e,r)=>{const t=(e=>{if(!s(e))return null;const r=new Map;if("operator"in e){if("get"!==e.operator)return null;for(const t in e){const n=e[t];if("operator"!==t&&"//"!==t&&void 0!==n){if(!z.has(t))return null;r.set(t,n)}}return r}for(const r in e)if("$get"!==r&&"//"!==r)return null;if(!("$get"in e))return null;const t=e.$get;if(Array.isArray(t)){const e=v(j,t);if(null===e)return null;for(const[t,n]of e)r.set(t,n);return r}if(s(t)){for(const e in t){const n=t[e];if("//"!==e&&void 0!==n){if(!z.has(e))return null;r.set(e,n)}}return r}return r.set(l(j),t),r})(e);return null===t?null:F(t,r?.referenceNames??"preserve")};export{e as classifyObject,n as positionalLayout,u as recognizeReference,J as toCanonical,Q as toGet,T as toReference,L as toShorthand};
|
|
1
|
+
import{c as e,E as r,p as n,S as a,i as s,a as o,R as i,s as l,r as u,b as f,G as c,d as p,W as m,e as d,F as h,D as k}from"../chunks/shared.js";export{t as typesIntersect}from"../chunks/shared.js";const g=e=>{const r=new Map;for(const{name:t,alias:n,positionalParams:a,restParam:s}of e.getOperators()){const e={name:t,alias:n,positionalParams:a,restParam:s};r.set(t,e),void 0!==n&&r.set(n,e)}const t=new Set(e.getFragments().map(({name:e})=>e));return{operators:r,fragments:t,recognizes:e=>"literal"===e||r.has(e)||t.has(e)}},v=(e,r)=>{const t=n(e,r.length);if(null===t)return null;const a=e.positionalParams,s=[];for(let e=0;e<t.bound;e++)s.push([a[e],r[e]]);return null!==t.restAt&&s.push([e.restParam,0===t.restAt?r:r.slice(t.restAt)]),s},y=/*#__PURE__*/new Set(["fallback","noCache","vars"]),$="'noCache' takes only the literal true — it is settled before the subtree runs",w=(e,t,n)=>{const a=e.operator;if("string"!=typeof a)return n(r.malformedNode,"the 'operator' value must be a literal string");if("literal"===a)return P(e,n);const s=t.operators.get(a);if(void 0===s)return n(r.unknownOperator,`'${a}' names no registered operator`);const o=[],i=[];for(const t in e){const a=e[t];if(void 0!==a)if("operator"===t)o.push({kind:"invocation"});else{if("noCache"===t&&!0!==a)return n(r.malformedNode,$);if("//"===t||y.has(t))o.push({kind:"keep",key:t,value:a});else{if("parameters"===t)return n(r.malformedNode,"'parameters' is reserved and unused on operator nodes");o.push({kind:"param",name:t,value:a}),i.push([t,a])}}}return{kind:"operator",operator:s,spelling:a,slots:o,params:i,fromPayload:!1}},P=(e,t)=>{if(!("value"in e))return t(r.malformedNode,"'literal' requires its content in 'value'");const n=[];for(const a in e){const s=e[a];if("operator"===a)n.push({kind:"invocation"});else if("value"===a)n.push({kind:"param",name:"value",value:s});else{if(void 0===s)continue;if("//"!==a&&!y.has(a))return t(r.unknownNodeKey,`'${a}' is not a key of 'literal' — content goes in 'value'`);n.push({kind:"keep",key:a,value:s})}}return{kind:"literal",content:e.value,slots:n,fromPayload:!1}},A=(e,t,n)=>{const a=e.fragment;if("string"!=typeof a)return n(r.malformedNode,"the 'fragment' value must be a literal string");if(!t.fragments.has(a))return n(r.unknownFragment,`'${a}' names no registered fragment`);const s=[];for(const a in e){const o=e[a];if(void 0!==o)if("fragment"===a)s.push({kind:"invocation"});else if("parameters"===a)N(o,t,n),s.push({kind:"param",name:a,value:o});else{if("noCache"===a&&!0!==o)return n(r.malformedNode,$);if("//"!==a&&!y.has(a))return n(r.unknownNodeKey,`'${a}' is not a key of a fragment call — arguments live only in 'parameters'`);s.push({kind:"keep",key:a,value:o})}}return{kind:"fragment",name:a,slots:s,parameters:e.parameters,fromPayload:!1}},N=(e,t,n)=>{s(e)||o(e,t.recognizes)||"string"==typeof e&&"reference"===u(e).kind||n(r.malformedNode,"a fragment's 'parameters' must be a named-arguments object or a node computing one")},b=(e,t,n,o)=>{const i=t.slice(1),l="literal"===i,u=!l&&n.fragments.has(i),f=[];for(const n in e){const s=e[n];if(n!==t){if(!a.has(n))return o(r.malformedNode,`'${n}' may not sit beside the shorthand key '${t}' — reserved modifiers only`);if("noCache"===n&&!0!==s&&!l)return o(r.malformedNode,$);void 0!==s&&f.push({kind:"keep",key:n,value:s})}else f.push({kind:"invocation"})}const c=e[t];if(l)return{kind:"literal",content:c,slots:f,fromPayload:!0};if(u)return s(c)?{kind:"fragment",name:i,slots:f,parameters:c,fromPayload:!0}:o(r.malformedNode,`fragments have no single-value or positional form — '${t}' takes a named-arguments object`);const p=n.operators.get(i);return{kind:"operator",operator:p,spelling:i,slots:f,params:j(p,c,n,o),fromPayload:!0}},j=(e,t,n,a)=>{const u=()=>a(r.positionalArity,`'${e.name}' takes no positional arguments — use the named form`);if(Array.isArray(t)){const n=v(e,t);if(null!==n)return n;if(void 0===e.positionalParams)return u();const s=e.positionalParams;return a(r.positionalArity,`'${e.name}' takes at most ${s.length} positional argument${1===s.length?"":"s"} (${s.join(", ")}), got ${t.length}`)}if(s(t)&&!o(t,n.recognizes)){const n=[];for(const s in t){const o=t[s];if(void 0!==o){if("//"!==s&&i.has(s))return a(r.unknownNodeKey,`'${s}' is not a parameter of '${e.name}'`);n.push([s,o])}}return n}const f=l(e);return null===f?u():[[f,t]]},z={positionalParams:c,restParam:null},C=/*#__PURE__*/new Set(["path","from","default"]),W={data:"d",vars:"v",params:"p",element:"e",index:"i"},x=(e,r,t)=>"canonical"===t?r:"alias"===t?W[r]:e,M=(e,r)=>{if("preserve"===r)return e;const t=u(e);if("reference"!==t.kind)return e;const{token:n,rest:a}=f(e);return`$${x(n,t.namespace,r)}${a}`},S=e=>e.startsWith(".")?e.slice(1):e,F=(e,r)=>{if("string"!=typeof e)return null;const t=u(e);if("reference"!==t.kind)return null;const{namespace:n}=t,{token:a,rest:s}=f(e),o=`$${x(a,n,r)}`;switch(n){case"data":return{operator:"get",path:S(s)};case"element":return{operator:"get",path:S(s),from:o};case"vars":case"params":{if(0===t.segments.length)return{operator:"get",path:"",from:o};const e=(e=>{if(e.startsWith(".")){let r=1;for(;r<e.length&&"."!==e[r]&&"["!==e[r];)r++;return r>1?r:null}const r=e[1];if("["!==e[0]||'"'!==r&&"'"!==r)return null;for(let t=2;t<e.length;t++)if("\\"===e[t])t++;else if(e[t]===r)return"]"===e[t+1]?t+2:null;return null})(s);return null===e?null:{operator:"get",path:S(s.slice(e)),from:`${o}${s.slice(0,e)}`}}default:return null}},K=(e,r)=>{if(e.has("default"))return null;const t=(e=>{if("string"==typeof e){if(e.startsWith("$"))return null;try{return d(e)}catch{return null}}if(!Array.isArray(e))return null;for(const r of e)if(!("string"==typeof r&&!r.startsWith("$")||"number"==typeof r&&Number.isInteger(r)&&r>=0))return null;return e})(e.get("path"));if(null===t)return null;const n=p(t);let a;const s=e.get("from");if(void 0===s)a="canonical"===r?"$data":"$d";else{if("string"!=typeof s)return null;const e=u(s);if("reference"!==e.kind||"index"===e.namespace)return null;if(""!==n&&e.segments.includes(m))return null;a=M(s,r).replace(/\.$/,"")}return""===n?a:n.startsWith("[")?`${a}${n}`:`${a}.${n}`},O=e=>{const r=[];for(let t=e;null!==t;t=t.parent)r.push(t.key);return r.reverse()};class E{lookup;writer;path=null;depth=0;constructor(e,r){this.lookup=e,this.writer=r}fail=(e,r)=>{throw new h({code:e,message:r,path:O(this.path)})};child(e,r){return this.within(r,()=>this.value(e))}within(e,r){const{path:t,depth:n}=this;this.path={parent:t,key:e},this.depth=n+1;const a=r();return this.path=t,this.depth=n,a}value(t){if(this.depth>k&&this.fail(r.depthCeiling,`the expression nests deeper than the engine's ceiling of ${k} levels`),"string"==typeof t)return this.writer.string(t);if(Array.isArray(t))return t.map((e,r)=>this.child(e,r));if(!s(t))return t;const n=((t,n,a)=>{const s=e(t,n.recognizes);switch(s.kind){case"malformed":return a(r.malformedNode,s.message);case"plain":return s;case"operator":return w(t,n,a);case"fragment":return A(t,n,a);case"shorthand":return b(t,s.key,n,a)}})(t,this.lookup,this.fail);switch(n.kind){case"plain":return this.entries(t,!0);case"operator":return this.writer.operator(n,this);case"fragment":return this.writer.fragment(n,this);case"literal":return this.writer.literal(n,this)}}keep({key:e,value:r}){return"fallback"===e?this.child(r,e):"vars"===e?this.vars(r):r}parameters(e){return!s(e)||o(e,this.lookup.recognizes)?this.child(e,"parameters"):this.within("parameters",()=>this.entries(e,!1))}entries(e,r){const t={};for(const n in e){const a=e[n];t[n]="//"===n?a:r&&"vars"===n?this.vars(a):this.child(a,n)}return t}vars(e){return s(e)?this.within("vars",()=>this.entries(e,!1)):e}}const G=(e,r)=>"canonical"===r?e.operator.name:"alias"===r?e.operator.alias??e.operator.name:e.spelling,I=e=>Array.isArray(e)?e:[e],R=(e,r)=>[...I(e),...I(r)],q=e=>e.params.find(([e])=>"//"===e)?.[1],D=e=>e.slots.some(e=>"keep"===e.kind&&"//"===e.key),B={kind:"named"},H=(e,r)=>!(Array.isArray(e)||s(e)&&!o(e,r.recognizes)),J=(e={})=>{const r=e.operatorNames??"preserve",t=e.referenceNames??"preserve",n="named"===e.arguments,a=e.getAsReference??!0;return{operator:(e,s)=>{const o=e.params.map(([e,r])=>[e,"//"===e?r:s.child(r,e)]),i=o.filter(([e])=>"//"!==e);if(a&&"get"===e.operator.name){const r=e.slots.some(e=>"keep"===e.kind&&"//"!==e.key)?null:K(new Map(i),t);if(null!==r)return r}const l=n?B:((e,r,t)=>{const n=e.positionalParams;if(void 0===n||0===r.length)return B;const a=e.restParam,s=null===a?n:n.slice(0,-1),o=new Map(r);for(const e of o.keys())if(e!==a&&!s.includes(e))return B;let i=0;for(;i<s.length&&o.has(s[i]);)i++;for(let e=i;e<s.length;e++)if(o.has(s[e]))return B;const l=null!==a&&o.has(a);if(null!==a&&l!==(i===s.length))return B;const u=s.slice(0,i).map(e=>o.get(e));if(l){const e=o.get(a);return Array.isArray(e)?{kind:"array",value:[...u,...e]}:0===s.length&&H(e,t)?{kind:"single",value:e}:B}return 1===i&&H(u[0],t)?{kind:"single",value:u[0]}:{kind:"array",value:u}})(e.operator,i,s.lookup),u="named"===l.kind?void 0:q(e),f=void 0!==u&&D(e),c={};for(const t of e.slots)"invocation"===t.kind?(void 0===u||f||(c["//"]=u),c[`$${G(e,r)}`]="named"===l.kind?Object.fromEntries(o):l.value):"keep"===t.kind&&(c[t.key]="//"===t.key&&f?R(t.value,u):s.keep(t));return c},fragment:(e,r)=>{const t=void 0===e.parameters?{}:r.parameters(e.parameters),n="string"==typeof t,a={};for(const s of e.slots)"invocation"===s.kind?n?(a.fragment=e.name,e.fromPayload&&(a.parameters=t)):a[`$${e.name}`]=t:"param"===s.kind?n&&(a.parameters=t):a[s.key]=r.keep(s);return a},literal:(e,r)=>{const t={};for(const n of e.slots)"invocation"===n.kind?t.$literal=e.content:"keep"===n.kind&&(t[n.key]=r.keep(n));return t},string:e=>M(e,t)}},L=(e,r,t)=>new E(g(r),((e={})=>{const r=e.operatorNames??"preserve",t=e.referenceNames??"preserve",n=e.referencesAsGet??!1;return{operator:(e,t)=>{const n={},a=e.fromPayload?q(e):void 0,s=void 0!==a&&D(e);for(const o of e.slots)if("invocation"===o.kind){if(void 0===a||s||(n["//"]=a),n.operator=G(e,r),e.fromPayload)for(const[r,a]of e.params)"//"!==r&&(n[r]=t.child(a,r))}else"param"===o.kind?n[o.name]=t.child(o.value,o.name):"//"===o.key&&s?n["//"]=R(o.value,a):n[o.key]=t.keep(o);return n},fragment:(e,r)=>{const t={};for(const n of e.slots)"invocation"===n.kind?(t.fragment=e.name,e.fromPayload&&(t.parameters=r.parameters(e.parameters))):"param"===n.kind?t.parameters=r.parameters(n.value):t[n.key]=r.keep(n);return t},literal:(e,r)=>{const t={};for(const n of e.slots)"invocation"===n.kind?(t.operator="literal",e.fromPayload&&(t.value=e.content)):"param"===n.kind?t.value=e.content:t[n.key]=r.keep(n);return t},string:e=>{if(n){const r=F(e,t);if(null!==r)return r}return M(e,t)}}})(t)).value(e),Q=(e,r,t)=>new E(g(r),J(t)).value(e),T=(e,r)=>F(e,r?.referenceNames??"preserve"),U=(e,r)=>{const t=(e=>{if(!s(e))return null;const r=new Map;if("operator"in e){if("get"!==e.operator)return null;for(const t in e){const n=e[t];if("operator"!==t&&"//"!==t&&void 0!==n){if(!C.has(t))return null;r.set(t,n)}}return r}for(const r in e)if("$get"!==r&&"//"!==r)return null;if(!("$get"in e))return null;const t=e.$get;if(Array.isArray(t)){const e=v(z,t);if(null===e)return null;for(const[t,n]of e)r.set(t,n);return r}if(s(t)){for(const e in t){const n=t[e];if("//"!==e&&void 0!==n){if(!C.has(e))return null;r.set(e,n)}}return r}return r.set(l(z),t),r})(e);return null===t?null:K(t,r?.referenceNames??"preserve")};export{e as classifyObject,n as positionalLayout,u as recognizeReference,l as singlePositionalTarget,L as toCanonical,T as toGet,U as toReference,Q as toShorthand};
|
package/build/index.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
declare const version = "3.0.0-preview.
|
|
1
|
+
declare const version = "3.0.0-preview.4";
|
|
2
2
|
|
|
3
3
|
interface HttpRequest {
|
|
4
4
|
url: string;
|
|
@@ -339,8 +339,7 @@ interface OperatorDefinition<P extends ParameterDeclarations = ParameterDeclarat
|
|
|
339
339
|
parameters: P;
|
|
340
340
|
positionalParams?: readonly string[];
|
|
341
341
|
timeoutParam?: string;
|
|
342
|
-
|
|
343
|
-
cache?: 'auto' | 'manual';
|
|
342
|
+
cache?: true;
|
|
344
343
|
validate?: OperatorValidate;
|
|
345
344
|
evaluate: (params: ResolvedParams<P>, context: OperatorContext) => unknown;
|
|
346
345
|
returns?: ExpectedType;
|
|
@@ -373,8 +372,7 @@ interface ValidatedOperatorDefinition {
|
|
|
373
372
|
resolution: ResolutionPlan;
|
|
374
373
|
deliversLazily: boolean;
|
|
375
374
|
timeoutParam: string | null;
|
|
376
|
-
|
|
377
|
-
cache: 'auto' | 'manual';
|
|
375
|
+
cache: boolean;
|
|
378
376
|
fingerprint: string;
|
|
379
377
|
validate?: OperatorValidate;
|
|
380
378
|
evaluate: OperatorEvaluate;
|
|
@@ -414,6 +412,7 @@ type ReferenceRecognition = {
|
|
|
414
412
|
namespace: ReferenceNamespace;
|
|
415
413
|
segments: PathSegment[];
|
|
416
414
|
drill: string;
|
|
415
|
+
binding?: string;
|
|
417
416
|
} | {
|
|
418
417
|
kind: 'invalid';
|
|
419
418
|
namespace: ReferenceNamespace;
|
|
@@ -424,6 +423,9 @@ type ReferenceRecognition = {
|
|
|
424
423
|
} | {
|
|
425
424
|
kind: 'plain';
|
|
426
425
|
};
|
|
426
|
+
interface ReferenceScope {
|
|
427
|
+
bindings?: readonly string[];
|
|
428
|
+
}
|
|
427
429
|
|
|
428
430
|
type ObjectClass = {
|
|
429
431
|
kind: 'operator';
|
|
@@ -478,6 +480,8 @@ interface FigTreeOptions {
|
|
|
478
480
|
operators?: (ValidatedOperatorDefinition | ValidatedOperatorDefinition[])[];
|
|
479
481
|
operatorDefaults?: {
|
|
480
482
|
[operator: string]: {
|
|
483
|
+
noCache?: true;
|
|
484
|
+
fallback?: unknown;
|
|
481
485
|
[param: string]: unknown;
|
|
482
486
|
};
|
|
483
487
|
};
|
|
@@ -494,7 +498,6 @@ interface FigTreeOptions {
|
|
|
494
498
|
maxNodes?: number;
|
|
495
499
|
timeout?: number;
|
|
496
500
|
signal?: AbortSignal;
|
|
497
|
-
useCache?: boolean;
|
|
498
501
|
cache?: {
|
|
499
502
|
store?: CacheStore;
|
|
500
503
|
maxSize?: number;
|
|
@@ -531,7 +534,7 @@ interface ParameterInfo extends ValidatedParameter {
|
|
|
531
534
|
interface OperatorInfo extends Omit<ValidatedOperatorDefinition, typeof VALIDATED_OPERATOR | 'evaluate' | 'validate' | 'deliversLazily' | 'resolution' | 'fingerprint' | 'parameters'> {
|
|
532
535
|
parameters: Record<string, ParameterInfo>;
|
|
533
536
|
hasValidate: boolean;
|
|
534
|
-
|
|
537
|
+
instanceNoCache?: true;
|
|
535
538
|
instanceFallback?: unknown;
|
|
536
539
|
}
|
|
537
540
|
interface FragmentInfo {
|
|
@@ -542,12 +545,13 @@ interface FragmentInfo {
|
|
|
542
545
|
returns: ExpectedType;
|
|
543
546
|
warnings: Issue[];
|
|
544
547
|
dependencies: Dependencies;
|
|
548
|
+
caches: boolean;
|
|
545
549
|
}
|
|
546
550
|
|
|
547
551
|
declare class FigTree<InstanceOpts extends FigTreeOptions = NoOptions> {
|
|
548
552
|
private state;
|
|
549
553
|
private readonly results;
|
|
550
|
-
readonly version = "3.0.0-preview.
|
|
554
|
+
readonly version = "3.0.0-preview.4";
|
|
551
555
|
constructor(options?: InstanceOpts);
|
|
552
556
|
updateOptions(options?: FigTreeOptions): void;
|
|
553
557
|
clearCache(): void;
|
|
@@ -684,7 +688,7 @@ type InspectNode = {
|
|
|
684
688
|
params: NodeMap;
|
|
685
689
|
fallback?: InspectNode;
|
|
686
690
|
timeoutFallback?: Json;
|
|
687
|
-
|
|
691
|
+
noCache?: true;
|
|
688
692
|
instanceDefaults?: string[];
|
|
689
693
|
} | {
|
|
690
694
|
kind: 'fragmentCall';
|
|
@@ -695,6 +699,7 @@ type InspectNode = {
|
|
|
695
699
|
parameters?: NodeMap | InspectNode;
|
|
696
700
|
fallback?: InspectNode;
|
|
697
701
|
timeoutFallback?: Json;
|
|
702
|
+
noCache?: true;
|
|
698
703
|
} | {
|
|
699
704
|
kind: 'skeleton';
|
|
700
705
|
vars?: NodeMap;
|
|
@@ -771,7 +776,7 @@ type TypeSeeds = {
|
|
|
771
776
|
};
|
|
772
777
|
|
|
773
778
|
interface MigrationIssue {
|
|
774
|
-
code: 'split-trailing-empty' | 'remainder-sign' | 'template-numbering' | 'named-token-source' | 'response-collapse' | 'computed-delimiter' | 'computed-branches' | 'graphql-relative-url' | 'output-type' | 'missing-data-fallback' | 'unprefixed-parameter' | 'instance-case-insensitive' | 'values-cut' | 'fallback-converted' | 'malformed-entry' | 'unreachable-branches' | 'overridden-value' | 'discarded-expression' | 'fragment-shorthand-payload' | 'shadowed-argument' | 'unknown-argument' | '
|
|
779
|
+
code: 'split-trailing-empty' | 'remainder-sign' | 'template-numbering' | 'named-token-source' | 'response-collapse' | 'computed-delimiter' | 'computed-branches' | 'graphql-relative-url' | 'output-type' | 'missing-data-fallback' | 'unprefixed-parameter' | 'cache-opt-in' | 'instance-case-insensitive' | 'values-cut' | 'fallback-converted' | 'malformed-entry' | 'unreachable-branches' | 'overridden-value' | 'discarded-expression' | 'fragment-shorthand-payload' | 'shadowed-argument' | 'unknown-argument' | 'name-renamed' | 'unknown-parameter-type' | 'default-outside-type' | 'unused-output-type' | 'deciding-value' | 'drilled-substitution-token' | 'number-mapping' | 'template-escape' | 'computed-dollar-template' | 'custom-function-call' | 'computed-function-name' | 'computed-arguments' | 'body-override' | 'computed-fragment-name' | 'replaced-output-type' | 'computed-children' | 'unknown-operator' | 'unconvertible-input';
|
|
775
780
|
tag: 'non-convertible' | 'intentional-semantic-change' | 'lossy-default';
|
|
776
781
|
path: (string | number)[];
|
|
777
782
|
message: string;
|
|
@@ -819,4 +824,4 @@ interface ShorthandOptions extends NameOptions {
|
|
|
819
824
|
}
|
|
820
825
|
|
|
821
826
|
export { ARRAY, AxiosClient, CompiledExpression, ErrorCodes, EvaluationData, FetchClient, FigTree, FigTreeError, OBJECT, OPERATOR_CATEGORIES, OperatorFailure, PostgresConnection, SQLiteConnection, WILDCARD, compareValues, coreOperators, deepEqual, defineOperator, httpOperators, inspect, isFigTreeError, isOperatorFailure, isTruthy, parsePath, renderText, resolvePath, sqlOperators, version };
|
|
822
|
-
export type { AxiosErrorLike, AxiosLike, BasicType, CacheStore, CacheTraceEvent, CallOptions, CanonicalOptions, CategoryHintMap, CategoryHints, CompiledNullPolicy, ConditionalNullPolicy, Constraints, Dependencies, EvaluationMode, EvaluationOptions, EvaluationResult, ExpectedType, FetchLike, FetchResponseLike, FigTreeErrorCode, FigTreeErrorInit, FigTreeOptions, FragmentDefinition, FragmentHints, FragmentInfo, FragmentMigrationResult, FragmentParameter, FragmentParameterDeclaration, HttpClient, HttpRequest, InspectDependencies, InspectIssue, InspectNode, InspectReport, Issue, KeyOverwriteTraceEvent, KnownTraceEvent, LazyValue, LiteralType, Merge, MigrationIssue, MigrationResult, NameOptions, NoOptions, NullPolicy, NullPolicyValue, ObjectClass, OnlyCallOptions, OperatorCategory, OperatorContext, OperatorDefinition, OperatorEvaluate, OperatorFailureInit, OperatorHintMap, OperatorHints, OperatorInfo, OperatorValidate, ParamValue, ParameterDeclaration, ParameterDeclarations, ParameterInfo, PathSegment, PerElement, PgClientLike, PositionalLayout, PositionalShape, QueryTraceEvent, ReferenceNamespace, ReferenceRecognition, Registry, RenderTraceEvent, RequestTraceEvent, ResolveResult, ResolvedParams, ResultShape, Settlement, SettlementStream, Severity, ShieldedFallbackTraceEvent, ShorthandOptions, Spelling, SqlConnection, SqlRequest, SqliteDatabaseLike, TraceEvent, TraceKind, TraceNode, TraceStatus, TypeCheckResult, TypeDeclaration, TypeOf, TypeSeeds, V2Options, ValidateFinding, ValidateHelpers, ValidatedOperatorDefinition, ValidatedParameter, ValidationResult, Wildcard };
|
|
827
|
+
export type { AxiosErrorLike, AxiosLike, BasicType, CacheStore, CacheTraceEvent, CallOptions, CanonicalOptions, CategoryHintMap, CategoryHints, CompiledNullPolicy, ConditionalNullPolicy, Constraints, Dependencies, EvaluationMode, EvaluationOptions, EvaluationResult, ExpectedType, FetchLike, FetchResponseLike, FigTreeErrorCode, FigTreeErrorInit, FigTreeOptions, FragmentDefinition, FragmentHints, FragmentInfo, FragmentMigrationResult, FragmentParameter, FragmentParameterDeclaration, HttpClient, HttpRequest, InspectDependencies, InspectIssue, InspectNode, InspectReport, Issue, KeyOverwriteTraceEvent, KnownTraceEvent, LazyValue, LiteralType, Merge, MigrationIssue, MigrationResult, NameOptions, NoOptions, NullPolicy, NullPolicyValue, ObjectClass, OnlyCallOptions, OperatorCategory, OperatorContext, OperatorDefinition, OperatorEvaluate, OperatorFailureInit, OperatorHintMap, OperatorHints, OperatorInfo, OperatorValidate, ParamValue, ParameterDeclaration, ParameterDeclarations, ParameterInfo, PathSegment, PerElement, PgClientLike, PositionalLayout, PositionalShape, QueryTraceEvent, ReferenceNamespace, ReferenceRecognition, ReferenceScope, Registry, RenderTraceEvent, RequestTraceEvent, ResolveResult, ResolvedParams, ResultShape, Settlement, SettlementStream, Severity, ShieldedFallbackTraceEvent, ShorthandOptions, Spelling, SqlConnection, SqlRequest, SqliteDatabaseLike, TraceEvent, TraceKind, TraceNode, TraceStatus, TypeCheckResult, TypeDeclaration, TypeOf, TypeSeeds, V2Options, ValidateFinding, ValidateHelpers, ValidatedOperatorDefinition, ValidatedParameter, ValidationResult, Wildcard };
|