@tmdc-solutions/mcp-beta 0.1.2 → 0.1.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +3 -2
- package/dist/chunk-C6OYMNC3.cjs +0 -57
- package/dist/chunk-C6OYMNC3.cjs.map +0 -1
- package/dist/chunk-ZNGQUM2D.js +0 -57
- package/dist/chunk-ZNGQUM2D.js.map +0 -1
- package/dist/lens/index.cjs +0 -2
- package/dist/lens/index.cjs.map +0 -1
- package/dist/lens/index.d.cts +0 -92
- package/dist/lens/index.d.ts +0 -92
- package/dist/lens/index.js +0 -2
- package/dist/lens/index.js.map +0 -1
- package/dist/stdio.cjs.map +0 -1
- package/dist/stdio.d.cts +0 -1
- package/dist/stdio.d.ts +0 -1
- package/dist/stdio.js.map +0 -1
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@tmdc-solutions/mcp-beta",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.3",
|
|
4
4
|
"description": "for dataOS related tasks in local",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"sideEffects": false,
|
|
@@ -17,7 +17,8 @@
|
|
|
17
17
|
"test": "echo \"Error: no test specified\" && exit 1"
|
|
18
18
|
},
|
|
19
19
|
"files": [
|
|
20
|
-
"dist"
|
|
20
|
+
"dist/studio.cjs",
|
|
21
|
+
"dist/studio.cjs.map"
|
|
21
22
|
],
|
|
22
23
|
"bin": {
|
|
23
24
|
"mcp": "./dist/stdio.js"
|
package/dist/chunk-C6OYMNC3.cjs
DELETED
|
@@ -1,57 +0,0 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports, "__esModule", {value: true}); function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } function _optionalChain(ops) { let lastAccessLHS = undefined; let value = ops[0]; let i = 1; while (i < ops.length) { const op = ops[i]; const fn = ops[i + 1]; i += 2; if ((op === 'optionalAccess' || op === 'optionalCall') && value == null) { return undefined; } if (op === 'access' || op === 'optionalAccess') { lastAccessLHS = value; value = fn(value); } else if (op === 'call' || op === 'optionalCall') { value = fn((...args) => value.call(lastAccessLHS, ...args)); lastAccessLHS = undefined; } } return value; }var _https = require('https'); var _https2 = _interopRequireDefault(_https);var k=4;function x(e,r,a,m=!1,f=0){return new Promise((u,p)=>{let c=_https2.default.request(e,r,h=>{let o="";h.on("data",g=>o+=g),h.on("end",()=>{m&&f<k&&o.includes("Continue wait")?setTimeout(()=>{x(e,r,a,m,f+1).then(u).catch(p)},1e3):u({status:h.statusCode||500,data:o})})});c.on("error",p),a&&c.write(a),c.end()})}var _dotenv = require('dotenv');_dotenv.config.call(void 0, );var q="",T=process.env.SLUG||"bmx";function C(e,r=","){return Array.isArray(e)?e.filter(a=>a!=null).map(a=>typeof a=="string"?a:JSON.stringify(a)).join(r):""}function y(e){return e===!0||e==="true"||e===1||e==="1"}function L(e){return e==null?"":typeof e=="string"?e:typeof e=="number"||typeof e=="boolean"?String(e):JSON.stringify(e)}function i(e){let r=L(e);return r===""?r:r.includes("|")||r.includes(",")||r.includes('"')?`"${r.replace(/"/g,'"')}"`:r}function F(e){return Array.isArray(e)?e.map(r=>`"${L(r)}"`).join(","):""}function O(...e){for(let r of e)if(r!==void 0)return r}function U(e,r){let a=e.name||e.slug||r||"",m=e.fullyQualifiedName||a||r||"",f=e.description||"",u=_optionalChain([e, 'access', _2 => _2.owner, 'optionalAccess', _3 => _3.name])||_optionalChain([e, 'access', _4 => _4.owner, 'optionalAccess', _5 => _5.displayName])||C(e.authors||[],","),p=e.timeZones||e.timezones||[],c=Array.isArray(p)?p:typeof p=="string"?[p]:[],h=y(O(_optionalChain([e, 'access', _6 => _6.cache, 'optionalAccess', _7 => _7.enabled]),e.cache,_optionalChain([e, 'access', _8 => _8.runtime, 'optionalAccess', _9 => _9.cache, 'optionalAccess', _10 => _10.enabled]),_optionalChain([e, 'access', _11 => _11.runtime, 'optionalAccess', _12 => _12.cache]),e.isCacheEnabled)),o=[];o.push(`${m}(${m})`),f&&o.push(f),u&&o.push(u),c.length&&o.push(c.join(",")),o.push(`Cache: ${h}`),o.push("");let g=Array.isArray(e.views)?e.views:[],b=Array.isArray(e.tables)?e.tables:[];g.length===0&&b.length>0&&(g.push(...b.filter(s=>!s.sql)),b=b.filter(s=>s.sql));let d=(s,S,D)=>{let n=[],w=s.title||s.displayName||s.name||`item_${S}`,Y=s.name||s.table||s.view||w,P=s.description||_optionalChain([s, 'access', _13 => _13.meta, 'optionalAccess', _14 => _14.description])||"",j=y(O(s.isVisible,s.visible)),R=y(s.public),M=s.connectedComponent,A=s.refs||s.references,I=_optionalChain([s, 'access', _15 => _15.meta, 'optionalAccess', _16 => _16.title])||_optionalChain([s, 'access', _17 => _17.metric, 'optionalAccess', _18 => _18.title])||"",$=_optionalChain([s, 'access', _19 => _19.meta, 'optionalAccess', _20 => _20.tags])||s.tags,G=!!(_optionalChain([s, 'access', _21 => _21.meta, 'optionalAccess', _22 => _22.metric])||s.metric);if(n.push(`${S}. ${w}(${Y})`),P&&n.push(P),D==="view"){let t=["view"];G&&t.push("metric"),t.push(`visible: ${j}`),t.push(`public: ${R}`),n.push(t.join(", "))}else{let t=["table"];M!==void 0&&t.push(`connectedComponent: ${M}`),t.push(`visible: ${j}`),t.push(`public: ${R}`),n.push(t.join(", "))}if(I&&n.push(I),Array.isArray($)&&$.length&&n.push(F($)),A&&(Array.isArray(A)&&A.length||typeof A=="string")&&n.push(`refs: ${Array.isArray(A)?A.join(","):A}`),D==="table"&&s.sql&&(n.push("SQL:"),n.push("`"+String(s.sql).trim()+"`")),s.joins&&Array.isArray(s.joins)&&s.joins.length){n.push(""),n.push("Joins:");for(let t of s.joins)n.push(`${t.relationship} - ${t.name}`),n.push(" SQL: `"+L(t.sql).trim()+"`")}n.push(""),n.push("Dimentions"),D==="table"?n.push("name|title|description|type|sql|suggestFilterValues|isVisible|public|primaryKey|aliasMember|isGoverned|refs"):n.push("name|title|description|type|suggestFilterValues|isVisible|public|primaryKey|aliasMember|isGoverned|refs");let _=Array.isArray(s.dimensions)?s.dimensions:[];for(let t of _){let v=[i(t.name),i(t.title||t.displayName||""),i(t.description||""),i(t.type||t.dataType||"")];D==="table"&&v.push(i(t.sql||t.expression||"")),v.push(i(y(t.suggestFilterValues)),i(y(O(t.isVisible,t.visible))),i(y(t.public)),i(y(t.primaryKey)),i(t.aliasMember||(Array.isArray(t.aliasMembers)?t.aliasMembers.join(","):"")),i(y(t.isGoverned)),i(Array.isArray(t.refs)?t.refs.join(","):t.refs||"")),n.push(v.join("|"))}n.push(""),n.push("Measures"),n.push("name|title|description|cumulativeTotal|cumulative|type|aggType|isVisible|public|aliasMember|isGoverned|refs");let z=Array.isArray(s.measures)?s.measures:[];for(let t of z){let v=[i(t.name),i(t.title||t.displayName||""),i(t.description||""),i(y(t.cumulativeTotal)),i(y(t.cumulative)),i(t.type||t.dataType||""),i(t.aggType||t.aggregation||""),i(y(O(t.isVisible,t.visible))),i(y(t.public)),i(t.aliasMember||(Array.isArray(t.aliasMembers)?t.aliasMembers.join(","):"")),i(y(t.isGoverned)),i(Array.isArray(t.refs)?t.refs.join(","):t.refs||"")];n.push(v.join("|"))}return n},N=1;for(let s of g)o.push(...d(s,N++,"view")),o.push("");for(let s of b)o.push(...d(s,N++,"table")),o.push("");return o.join(`
|
|
2
|
-
`)}async function J({slug:e=T,apiKey:r,fqdn:a=q}){let m=`https://${a}/lens2/api/${e.replace("public.","public:")}/v2/meta`,f={method:"GET",headers:{Authorization:`Bearer ${r}`}},{status:u,data:p}=await x(m,f);if(u<200||u>=300)return{content:[{type:"text",text:`Error: API responded with ${u}`}],isError:!0};try{let c=JSON.parse(p);return{content:[{type:"text",text:U(c,e)}]}}catch (e2){return{content:[{type:"text",text:"Error: API Response is not a JSON"}],isError:!0}}}async function E({slug:e=T,payload:r,apiKey:a,fqdn:m=q}){let f=`https://${m}/lens2/api/${e.replace("public.","public:")}/v2/load`,u=JSON.stringify({query:r}),p={method:"POST",headers:{Authorization:`Bearer ${a}`,"Content-Type":"application/json","Content-Length":Buffer.byteLength(u)}},{status:c,data:h}=await x(f,p,u,!0);if(c<200||c>=300)return{content:[{type:"text",text:JSON.stringify({status:c,data:h})}],isError:!0};try{let o=JSON.parse(h);return{content:[{type:"text",text:JSON.stringify(o.data)}]}}catch(o){return console.log("Error parsing lens data response:",o,h),{content:[{type:"text",text:`Query may be still running. Try again one more time. ${o.message}`}],isError:!0}}}var _keyv = require('keyv'); var _keyv2 = _interopRequireDefault(_keyv);var _datefns = require('date-fns');var Z=new (0, _keyv2.default)({namespace:"list-lens",ttl:1e3*60*5});async function V({apiKey:e,fqdn:r=q}){let a=await Z.get(e);if(a)return a;let m=`https://${r}/dph/discover/api/msearch/query/v2`,f=JSON.stringify({queries:[{indexUid:"data_product_v2_search_index",q:"*",filter:["deleted='false'","tagList NOT IN ['DPTier.Source Aligned']"],offset:0,limit:1e3,attributesToRetrieve:["description","name","fullyQualifiedName","id","tagList","displayName","ports.lens.entityInfo.fullyQualifiedName","owner","purpose","updatedAt"]}]}),u={method:"POST",headers:{Authorization:`Bearer ${e}`,"Content-Type":"application/json","Content-Length":Buffer.byteLength(f)}},{status:p,data:c}=await x(m,u,f);if(p<200||p>=300)return{content:[{type:"text",text:`Error: API responded with ${p}`}],isError:!0};try{let o=JSON.parse(c).hits.filter(d=>_optionalChain([d, 'access', _23 => _23.ports, 'optionalAccess', _24 => _24.lens])),g=[],b=["Semantic model (lens) - fully qualified name","Data product name","Data product description","Purpose","DPDomain","DPUsecase","Owner","Updated At"];return o.forEach(d=>{let N=_optionalChain([d, 'access', _25 => _25.tagList, 'access', _26 => _26.find, 'call', _27 => _27(w=>w.startsWith("DPDomain.")), 'optionalAccess', _28 => _28.replace, 'call', _29 => _29("DPDomain.","")])||"N/A",s=_optionalChain([d, 'access', _30 => _30.tagList, 'access', _31 => _31.find, 'call', _32 => _32(w=>w.startsWith("DPUsecase.")), 'optionalAccess', _33 => _33.replace, 'call', _34 => _34("DPUsecase.","")])||"N/A",S=_optionalChain([d, 'access', _35 => _35.owner, 'optionalAccess', _36 => _36.displayName])||"N/A",D=d.updatedAt?_datefns.formatDistanceToNow.call(void 0, new Date(d.updatedAt),{addSuffix:!0}):"N/A",n=[d.ports.lens.entityInfo.fullyQualifiedName.replace("dataos.",""),d.displayName,d.description,d.purpose||"N/A",N,s,S,D];g.push(n.join("|"))}),{content:[{type:"text",text:`${b.join("|")}
|
|
3
|
-
`+g.join(`
|
|
4
|
-
`)}]}}catch (e3){return{content:[{type:"text",text:"Error: API Response is not a JSON"}],isError:!0}}}var _zod = require('zod');var H=`
|
|
5
|
-
Query data from a Lens by sending a "query" object.
|
|
6
|
-
|
|
7
|
-
Build the parameters as follows:
|
|
8
|
-
1) Pick measures (numeric metrics) and/or dimensions (grouping fields). At least one of the two must be provided.
|
|
9
|
-
2) Filters: While optional, they are strongly recommended for better relevance, performance, and correctness. Use them whenever the question implies a subset (time window, region, status, etc.). For numeric measures, use numeric values; for dates, use ISO strings (YYYY-MM-DD). If truly no filters are needed, omit the filters key entirely (do not send an empty array).
|
|
10
|
-
3) Choose a sensible limit (default 100). Use small limits (5/10/20) for top/bottom style questions; larger (500/1000) for comprehensive lists. Offset supports pagination.
|
|
11
|
-
|
|
12
|
-
Filter shape (very important):
|
|
13
|
-
- filters is an array of groups. Each group is an object with a single key: "and" or "or". The value is an array of filter clauses.
|
|
14
|
-
- Each clause is: { "member": string, "operator": one of the allowed operators, "values": array }
|
|
15
|
-
- For numeric measures, values must be numbers. For date operators like inDateRange, pass ["start", "end"] as YYYY-MM-DD.
|
|
16
|
-
|
|
17
|
-
Example query payload:
|
|
18
|
-
{
|
|
19
|
-
"measures": ["sales.totalRevenue"],
|
|
20
|
-
"dimensions": ["date.month"],
|
|
21
|
-
"filters": [
|
|
22
|
-
{ "and": [
|
|
23
|
-
{ "member": "date.month", "operator": "inDateRange", "values": ["2024-01-01", "2024-03-31"] },
|
|
24
|
-
{ "member": "sales.totalRevenue", "operator": "gte", "values": [1000] }
|
|
25
|
-
] }
|
|
26
|
-
],
|
|
27
|
-
"limit": 10,
|
|
28
|
-
"offset": 0
|
|
29
|
-
}
|
|
30
|
-
|
|
31
|
-
Example 2 (recommended use of filters): Top 10 customers by revenue in EMEA for 2024
|
|
32
|
-
{
|
|
33
|
-
"measures": ["sales.totalRevenue"],
|
|
34
|
-
"dimensions": ["customer.name", "customer.region"],
|
|
35
|
-
"filters": [
|
|
36
|
-
{ "and": [
|
|
37
|
-
{ "member": "customer.region", "operator": "equals", "values": ["EMEA"] },
|
|
38
|
-
{ "member": "date.date", "operator": "inDateRange", "values": ["2024-01-01", "2024-12-31"] }
|
|
39
|
-
] }
|
|
40
|
-
],
|
|
41
|
-
"limit": 10
|
|
42
|
-
}
|
|
43
|
-
|
|
44
|
-
Common analysis patterns
|
|
45
|
-
- Trend analysis: time dimensions + performance measures
|
|
46
|
-
- Comparative analysis: categorical dimensions + multiple measures
|
|
47
|
-
- Drill down: hierarchical dimensions (year/quarter/month)
|
|
48
|
-
- KPI: single measure with dimensional breakdowns
|
|
49
|
-
|
|
50
|
-
Strict rules
|
|
51
|
-
- Use only field names that exist in the schema
|
|
52
|
-
- Do not fabricate results if the query returns empty or errors
|
|
53
|
-
- Explore the schema before selecting fields (use the schema tool to copy exact field names)
|
|
54
|
-
|
|
55
|
-
Keywords: query, analytics, business intelligence, metrics, KPIs, lens, data, insights
|
|
56
|
-
`,Q= exports.e =_zod.z.object({measures:_zod.z.array(_zod.z.string({description:"Fully-qualified measure name from the schema (e.g., sales.totalRevenue). Provide numbers-based metrics only here."})).optional(),dimensions:_zod.z.array(_zod.z.string({description:"Fully-qualified dimension name from the schema (e.g., date.month, customer.region). Use for grouping or slicing results."})).optional(),filters:_zod.z.array(_zod.z.record(_zod.z.enum(["and","or"]),_zod.z.array(_zod.z.object({member:_zod.z.string(),operator:_zod.z.enum(["equals","notEquals","contains","notContains","startsWith","notStartsWith","endsWith","notEndsWith","gt","gte","lt","lte","inDateRange","notInDateRange","beforeDate","afterDate"]),values:_zod.z.array(_zod.z.string().date().or(_zod.z.number()).or(_zod.z.string()).or(_zod.z.boolean()).or(_zod.z.null()))}))),{description:"Optional but strongly recommended. Provide an array of groups. Each group is an object with a single key: 'and' or 'or', mapping to an array of filter clauses. Clause shape: { member, operator, values }. Use fully-qualified member names from the schema. For numeric measures, values must be numbers. For date ranges, pass [start, end] as 'YYYY-MM-DD'. Prefer including at least a time window or key categorical filter. Omit this key entirely if no filters are needed. Do not send an empty array."}).nonempty().optional(),limit:_zod.z.number({description:"Max rows to return. Integer. Default 100. Use small limits (5/10/20) for top/bottom questions; larger (500/1000) for comprehensive lists."}).int().default(100),offset:_zod.z.number({description:"Rows to skip for pagination. Integer. Default 0. Increase to fetch subsequent pages."}).int().default(0)}),Se= exports.f =({server:e,apiKey:r,fqdn:a,slug:m})=>{e.tool("query-lens-data",H,m?{query:Q}:{query:Q,slug:_zod.z.string({description:"Name of the lens (semantic model slug). Alphanumeric with hyphen(-)s allowed. Make sure slug string contains workspace notation. example: public.customer-360"})},async({slug:f,query:u})=>E({payload:u,slug:m||f,apiKey:r,fqdn:a}))};exports.a = J; exports.b = E; exports.c = V; exports.d = H; exports.e = Q; exports.f = Se;
|
|
57
|
-
//# sourceMappingURL=chunk-C6OYMNC3.cjs.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/lens/services/request.ts","../src/lens/services/constants.ts","../src/util/format.ts","../src/lens/services/normalize.ts","../src/lens/services/list.ts","../src/lens/tools/lens-data.ts"],"names":["MAX_RETRIES","httpsRequest","url","options","body","enableRetry","retryCount","resolve","reject","req","https","res","data","chunk","config","DATAOS_FQDN","SLUG","safeJoin","arr","sep","v","toBool","toStringVal","quoteCSV","value","s","joinTags","tags","t","firstDefined","vals","normalizeLensMeta","json","slug","name","fqn","description","owner","tz","timezones","cacheEnabled","lines","lensList"],"mappings":"AAAA,yvBAAkB,IAEZA,CAAAA,CAA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CAAAA,uBAAK,OAAA,+BAAS,OAAA,CACdA,CAAAA,CAAK,cACP,CACF,CAAA,CAEMS,CAAAA,CAAkB,CAAC,CAAA,CACzBA,CAAAA,CAAM,IAAA,CAAK,CAAA,EAAA;ACRSC;AA4GoC;ACrH/B;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAiFhB","file":"/Users/varnitha/tmdc/solutions-core/model-context-protocol/dist/chunk-C6OYMNC3.cjs","sourcesContent":["import https from \"https\";\n\nconst MAX_RETRIES = 4;\n\n// Helper function to make HTTPS requests\nexport function httpsRequest(\n url: string,\n options: https.RequestOptions,\n body?: string,\n enableRetry: boolean = false,\n retryCount = 0\n): Promise<{ status: number; data: any }> {\n return new Promise((resolve, reject) => {\n const req = https.request(url, options, (res) => {\n let data = \"\";\n res.on(\"data\", (chunk) => (data += chunk));\n res.on(\"end\", () => {\n\n if(enableRetry && retryCount < MAX_RETRIES && data.includes(\"Continue wait\")) {\n setTimeout(() => {\n httpsRequest(url, options, body, enableRetry, retryCount + 1)\n .then(resolve)\n .catch(reject);\n }, 1000); // Exponential backoff\n } else {\n resolve({ status: res.statusCode || 500, data });\n }\n });\n });\n req.on(\"error\", reject);\n if (body) req.write(body);\n req.end();\n });\n}\n\n","import { config } from \"dotenv\";\n\nconfig();\n\nexport const DATAOS_FQDN = \"\";\nexport const SLUG = process.env.SLUG || \"bmx\";\n\n","// Common lightweight formatting and coercion helpers for string output\n\nexport type AnyObj = Record<string, any>;\n\nexport function safeJoin(arr: any[], sep = \",\"): string {\n if (!Array.isArray(arr)) return \"\";\n return arr\n .filter((v) => v !== undefined && v !== null)\n .map((v) => (typeof v === \"string\" ? v : JSON.stringify(v)))\n .join(sep);\n}\n\nexport function toBool(v: any): boolean {\n // Consider true only for explicit truthy flags\n return v === true || v === \"true\" || v === 1 || v === \"1\";\n}\n\nexport function toStringVal(v: any): string {\n if (v === null || v === undefined) return \"\";\n if (typeof v === \"string\") return v;\n if (typeof v === \"number\" || typeof v === \"boolean\") return String(v);\n return JSON.stringify(v);\n}\n\nexport function quoteCSV(value: any): string {\n const s = toStringVal(value);\n if (s === \"\") return s;\n // If contains delimiters, wrap in quotes\n if (s.includes(\"|\") || s.includes(\",\") || s.includes(\"\\\"\")) {\n return `\"${s.replace(/\"/g, '\"')}\"`;\n }\n return s;\n}\n\nexport function joinTags(tags: any): string {\n if (!Array.isArray(tags)) return \"\";\n return tags.map((t) => `\"${toStringVal(t)}\"`).join(\",\");\n}\n\nexport function firstDefined<T>(...vals: T[]): T | undefined {\n for (const v of vals) if (v !== undefined) return v;\n}\n\n","import type { AnyObj } from \"../../util/format.js\";\nimport { safeJoin, toBool, toStringVal, quoteCSV, joinTags, firstDefined } from \"../../util/format.js\";\n\nexport function normalizeLensMeta(json: AnyObj, slug?: string): string {\n const name = (json.name || json.slug || slug || \"\") as string;\n const fqn = (json.fullyQualifiedName || name || slug || \"\") as string;\n const description = (json.description || \"\") as string;\n const owner = (json.owner?.name || json.owner?.displayName || safeJoin(json.authors || [], \",\")) as string;\n const tz = (json.timeZones || json.timezones || []) as any;\n const timezones: string[] = Array.isArray(tz) ? tz : (typeof tz === \"string\" ? [tz] : []);\n const cacheEnabled = toBool(\n firstDefined(\n json.cache?.enabled,\n json.cache,\n json.runtime?.cache?.enabled,\n json.runtime?.cache,\n json.isCacheEnabled,\n )\n );\n\n const lines: string[] = [];\n lines.push(`${fqn}(${fqn})`);\n if (description) lines.push(description);\n if (owner) lines.push(owner);\n if (timezones.length) lines.push(timezones.join(\",\"));\n lines.push(`Cache: ${cacheEnabled}`);\n lines.push(\"\");\n\n const views: AnyObj[] = Array.isArray(json.views) ? json.views : [];\n let tables: AnyObj[] = Array.isArray(json.tables) ? json.tables : [];\n\n // If there are no explicit views, infer non-sql items as views\n if (views.length === 0 && tables.length > 0) {\n views.push(...tables.filter((t) => !t.sql));\n tables = tables.filter((t) => t.sql);\n }\n\n const formatItem = (item: AnyObj, index: number, kind: \"view\" | \"table\"): string[] => {\n const out: string[] = [];\n const itemName = (item.title || item.displayName || item.name || `item_${index}`) as string;\n const itemId = (item.name || item.table || item.view || itemName) as string;\n const desc = (item.description || item.meta?.description || \"\") as string;\n const isVisible = toBool(firstDefined(item.isVisible, item.visible));\n const isPublic = toBool(item.public);\n const connectedComponent = item.connectedComponent;\n const refs = item.refs || item.references;\n const metricTitle = item.meta?.title || item.metric?.title || \"\";\n const tags = item.meta?.tags || item.tags;\n const isMetric = Boolean(item.meta?.metric || item.metric);\n\n out.push(`${index}. ${itemName}(${itemId})`);\n if (desc) out.push(desc);\n if (kind === \"view\") {\n const flags: string[] = [\"view\"];\n if (isMetric) flags.push(\"metric\");\n flags.push(`visible: ${isVisible}`);\n flags.push(`public: ${isPublic}`);\n out.push(flags.join(\", \"));\n } else {\n const flags: string[] = [\"table\"];\n if (connectedComponent !== undefined) flags.push(`connectedComponent: ${connectedComponent}`);\n flags.push(`visible: ${isVisible}`);\n flags.push(`public: ${isPublic}`);\n out.push(flags.join(\", \"));\n }\n if (metricTitle) out.push(metricTitle);\n if (Array.isArray(tags) && tags.length) out.push(joinTags(tags));\n if (refs && ((Array.isArray(refs) && refs.length) || typeof refs === \"string\")) {\n out.push(`refs: ${Array.isArray(refs) ? refs.join(\",\") : refs}`);\n }\n\n if (kind === \"table\" && item.sql) {\n out.push(\"SQL:\");\n out.push(\"`\" + String(item.sql).trim() + \"`\");\n }\n\n if(item.joins && Array.isArray(item.joins) && item.joins.length) {\n out.push(\"\");\n out.push(\"Joins:\");\n for(const j of item.joins) {\n out.push(`${j.relationship} - ${j.name}`)\n out.push(\" SQL: `\" + toStringVal(j.sql).trim() + \"`\");\n }\n }\n // Dimensions header\n out.push(\"\");\n out.push(\"Dimentions\");\n if (kind === \"table\") {\n out.push(\"name|title|description|type|sql|suggestFilterValues|isVisible|public|primaryKey|aliasMember|isGoverned|refs\");\n } else {\n out.push(\"name|title|description|type|suggestFilterValues|isVisible|public|primaryKey|aliasMember|isGoverned|refs\");\n }\n\n const dims: AnyObj[] = Array.isArray(item.dimensions) ? item.dimensions : [];\n for (const d of dims) {\n const row = [\n quoteCSV(d.name),\n quoteCSV(d.title || d.displayName || \"\"),\n quoteCSV(d.description || \"\"),\n quoteCSV(d.type || d.dataType || \"\"),\n ];\n if (kind === \"table\") row.push(quoteCSV(d.sql || d.expression || \"\"));\n row.push(\n quoteCSV(toBool(d.suggestFilterValues)),\n quoteCSV(toBool(firstDefined(d.isVisible, d.visible))),\n quoteCSV(toBool(d.public)),\n quoteCSV(toBool(d.primaryKey)),\n quoteCSV(d.aliasMember || (Array.isArray(d.aliasMembers) ? d.aliasMembers.join(\",\") : \"\")),\n quoteCSV(toBool(d.isGoverned)),\n quoteCSV(Array.isArray(d.refs) ? d.refs.join(\",\") : (d.refs || \"\"))\n );\n out.push(row.join(\"|\"));\n }\n\n // Measures header\n out.push(\"\");\n out.push(\"Measures\");\n out.push(\"name|title|description|cumulativeTotal|cumulative|type|aggType|isVisible|public|aliasMember|isGoverned|refs\");\n\n const meas: AnyObj[] = Array.isArray(item.measures) ? item.measures : [];\n for (const m of meas) {\n const row = [\n quoteCSV(m.name),\n quoteCSV(m.title || m.displayName || \"\"),\n quoteCSV(m.description || \"\"),\n quoteCSV(toBool(m.cumulativeTotal)),\n quoteCSV(toBool(m.cumulative)),\n quoteCSV(m.type || m.dataType || \"\"),\n quoteCSV(m.aggType || m.aggregation || \"\"),\n quoteCSV(toBool(firstDefined(m.isVisible, m.visible))),\n quoteCSV(toBool(m.public)),\n quoteCSV(m.aliasMember || (Array.isArray(m.aliasMembers) ? m.aliasMembers.join(\",\") : \"\")),\n quoteCSV(toBool(m.isGoverned)),\n quoteCSV(Array.isArray(m.refs) ? m.refs.join(\",\") : (m.refs || \"\"))\n ];\n out.push(row.join(\"|\"));\n }\n\n\n return out;\n };\n\n let index = 1;\n for (const v of views) {\n lines.push(...formatItem(v, index++, \"view\"));\n lines.push(\"\");\n }\n for (const t of tables) {\n lines.push(...formatItem(t, index++, \"table\"));\n lines.push(\"\");\n }\n\n return lines.join(\"\\n\");\n}\n\n","import https from \"https\";\nimport { httpsRequest } from \"./request.js\";\nimport { DATAOS_FQDN } from \"./constants.js\";\nimport Keyv from \"keyv\";\nimport { DataProductListResponse } from \"../../data-products/types/data-product-list.js\";\nimport { formatDistanceToNow } from \"date-fns\";\n\n\nexport const listLensCache = new Keyv({\n namespace: 'list-lens',\n ttl: 1000 * 60 * 5,\n})\n\nexport async function lensList({\n apiKey,\n fqdn = DATAOS_FQDN,\n}: {\n apiKey: string;\n fqdn?: string;\n}) {\n\n const cachedList = await listLensCache.get(apiKey);\n\n if (cachedList) {\n return cachedList;\n }\n\n const url = `https://${fqdn}/dph/discover/api/msearch/query/v2`;\n const body = JSON.stringify({\n \"queries\": [\n {\n \"indexUid\": \"data_product_v2_search_index\",\n \"q\": \"*\",\n \"filter\": [\n \"deleted='false'\",\n \"tagList NOT IN ['DPTier.Source Aligned']\"\n ],\n \"offset\": 0,\n \"limit\": 1000,\n \"attributesToRetrieve\": [\n \"description\",\n \"name\",\n \"fullyQualifiedName\",\n \"id\",\n \"tagList\",\n \"displayName\",\n \"ports.lens.entityInfo.fullyQualifiedName\",\n \"owner\",\n \"purpose\",\n \"updatedAt\"\n ]\n }\n ]\n });\n const options: https.RequestOptions = {\n method: \"POST\",\n headers: {\n Authorization: `Bearer ${apiKey}`,\n \"Content-Type\": \"application/json\",\n \"Content-Length\": Buffer.byteLength(body),\n },\n };\n\n const { status, data } = await httpsRequest(url, options, body);\n\n if (status < 200 || status >= 300) {\n return {\n content: [\n {\n type: \"text\" as const,\n text: `Error: API responded with ${status}`,\n },\n ],\n isError: true,\n };\n }\n\n try {\n const res: DataProductListResponse = JSON.parse(data);\n const result = res.hits.filter((item) => item.ports?.lens);\n\n\n\n const listItems = []\n const headers = [\n \"Semantic model (lens) - fully qualified name\",\n \"Data product name\",\n \"Data product description\",\n \"Purpose\",\n \"DPDomain\",\n \"DPUsecase\",\n \"Owner\",\n \"Updated At\"\n ]\n\n result.forEach((dp) => {\n const dpDomain = dp.tagList.find(tag => tag.startsWith(\"DPDomain.\"))?.replace(\"DPDomain.\", \"\") || \"N/A\";\n const dpUsecase = dp.tagList.find(tag => tag.startsWith(\"DPUsecase.\"))?.replace(\"DPUsecase.\", \"\") || \"N/A\";\n const ownerName = dp.owner?.displayName || \"N/A\";\n const updatedAt = dp['updatedAt'] ? \n formatDistanceToNow(new Date(dp['updatedAt']), { addSuffix: true }) : \n \"N/A\";\n\n const lineData = [\n dp.ports!.lens.entityInfo.fullyQualifiedName.replace(\"dataos.\", \"\"),\n dp.displayName,\n dp.description,\n dp.purpose || \"N/A\",\n dpDomain,\n dpUsecase,\n ownerName,\n updatedAt\n ]\n\n listItems.push(lineData.join(\"|\"));\n })\n \n return {\n content: [\n {\n type: \"text\" as const,\n text: `${headers.join(\"|\")}\\n` + listItems.join(\"\\n\"),\n },\n ],\n }\n \n } catch {\n return {\n content: [\n {\n type: \"text\",\n text: `Error: API Response is not a JSON`,\n },\n ],\n isError: true,\n };\n }\n}\n\n","import { z } from \"zod\";\nimport { lensData } from \"../service.js\";\nimport { InitParams } from \"../resources/schema.js\";\n\nexport const description = `\nQuery data from a Lens by sending a \"query\" object.\n\nBuild the parameters as follows:\n1) Pick measures (numeric metrics) and/or dimensions (grouping fields). At least one of the two must be provided.\n2) Filters: While optional, they are strongly recommended for better relevance, performance, and correctness. Use them whenever the question implies a subset (time window, region, status, etc.). For numeric measures, use numeric values; for dates, use ISO strings (YYYY-MM-DD). If truly no filters are needed, omit the filters key entirely (do not send an empty array).\n3) Choose a sensible limit (default 100). Use small limits (5/10/20) for top/bottom style questions; larger (500/1000) for comprehensive lists. Offset supports pagination.\n\nFilter shape (very important):\n- filters is an array of groups. Each group is an object with a single key: \"and\" or \"or\". The value is an array of filter clauses.\n- Each clause is: { \"member\": string, \"operator\": one of the allowed operators, \"values\": array }\n- For numeric measures, values must be numbers. For date operators like inDateRange, pass [\"start\", \"end\"] as YYYY-MM-DD.\n\nExample query payload:\n{\n \"measures\": [\"sales.totalRevenue\"],\n \"dimensions\": [\"date.month\"],\n \"filters\": [\n { \"and\": [\n { \"member\": \"date.month\", \"operator\": \"inDateRange\", \"values\": [\"2024-01-01\", \"2024-03-31\"] },\n { \"member\": \"sales.totalRevenue\", \"operator\": \"gte\", \"values\": [1000] }\n ] }\n ],\n \"limit\": 10,\n \"offset\": 0\n}\n\nExample 2 (recommended use of filters): Top 10 customers by revenue in EMEA for 2024\n{\n \"measures\": [\"sales.totalRevenue\"],\n \"dimensions\": [\"customer.name\", \"customer.region\"],\n \"filters\": [\n { \"and\": [\n { \"member\": \"customer.region\", \"operator\": \"equals\", \"values\": [\"EMEA\"] },\n { \"member\": \"date.date\", \"operator\": \"inDateRange\", \"values\": [\"2024-01-01\", \"2024-12-31\"] }\n ] }\n ],\n \"limit\": 10\n}\n\nCommon analysis patterns\n- Trend analysis: time dimensions + performance measures\n- Comparative analysis: categorical dimensions + multiple measures\n- Drill down: hierarchical dimensions (year/quarter/month)\n- KPI: single measure with dimensional breakdowns\n\nStrict rules\n- Use only field names that exist in the schema\n- Do not fabricate results if the query returns empty or errors\n- Explore the schema before selecting fields (use the schema tool to copy exact field names)\n\nKeywords: query, analytics, business intelligence, metrics, KPIs, lens, data, insights\n`;\n\nexport const querySchema = z.object({\n measures: z.array(\n z.string({ description: \"Fully-qualified measure name from the schema (e.g., sales.totalRevenue). Provide numbers-based metrics only here.\" })\n ).optional(),\n dimensions: z.array(\n z.string({ description: \"Fully-qualified dimension name from the schema (e.g., date.month, customer.region). Use for grouping or slicing results.\" })\n ).optional(),\n filters: z.array(\n z.record(\n z.enum([\"and\", \"or\"]),\n z.array(\n z.object({\n \"member\": z.string(),\n \"operator\": z.enum([\"equals\", \"notEquals\", \"contains\", \"notContains\", \"startsWith\", \"notStartsWith\", \"endsWith\", \"notEndsWith\", \"gt\", \"gte\", \"lt\", \"lte\", \"inDateRange\", \"notInDateRange\", \"beforeDate\", \"afterDate\"]),\n \"values\": z.array(\n z.string().date()\n .or(z.number())\n .or(z.string())\n .or(z.boolean())\n .or(z.null())\n )\n })\n )\n ),\n {\n description: \"Optional but strongly recommended. Provide an array of groups. Each group is an object with a single key: 'and' or 'or', mapping to an array of filter clauses. Clause shape: { member, operator, values }. Use fully-qualified member names from the schema. For numeric measures, values must be numbers. For date ranges, pass [start, end] as 'YYYY-MM-DD'. Prefer including at least a time window or key categorical filter. Omit this key entirely if no filters are needed. Do not send an empty array.\"\n }).nonempty().optional(),\n limit: z.number({ description: \"Max rows to return. Integer. Default 100. Use small limits (5/10/20) for top/bottom questions; larger (500/1000) for comprehensive lists.\" }).int().default(100),\n offset: z.number({\n description: \"Rows to skip for pagination. Integer. Default 0. Increase to fetch subsequent pages.\"\n }).int().default(0)\n})\n\n\nexport const initLensDataTool = ({\n server, apiKey, fqdn, slug: reqSlug\n}: InitParams) => {\n\n\n\n server.tool(\n \"query-lens-data\",\n description,\n ( reqSlug ? \n { query: querySchema } : \n {\n query: querySchema,\n slug: z.string({\n description: \"Name of the lens (semantic model slug). Alphanumeric with hyphen(-)s allowed. Make sure slug string contains workspace notation. example: public.customer-360\"\n })\n } \n ),\n async ({ slug, query: payload }): Promise<any> => lensData({ \n payload, \n slug: reqSlug || slug, \n apiKey, \n fqdn \n })\n )\n}\n"]}
|
package/dist/chunk-ZNGQUM2D.js
DELETED
|
@@ -1,57 +0,0 @@
|
|
|
1
|
-
import B from"https";var k=4;function x(e,r,a,m=!1,f=0){return new Promise((u,p)=>{let c=B.request(e,r,h=>{let o="";h.on("data",g=>o+=g),h.on("end",()=>{m&&f<k&&o.includes("Continue wait")?setTimeout(()=>{x(e,r,a,m,f+1).then(u).catch(p)},1e3):u({status:h.statusCode||500,data:o})})});c.on("error",p),a&&c.write(a),c.end()})}import{config as K}from"dotenv";K();var q="",T=process.env.SLUG||"bmx";function C(e,r=","){return Array.isArray(e)?e.filter(a=>a!=null).map(a=>typeof a=="string"?a:JSON.stringify(a)).join(r):""}function y(e){return e===!0||e==="true"||e===1||e==="1"}function L(e){return e==null?"":typeof e=="string"?e:typeof e=="number"||typeof e=="boolean"?String(e):JSON.stringify(e)}function i(e){let r=L(e);return r===""?r:r.includes("|")||r.includes(",")||r.includes('"')?`"${r.replace(/"/g,'"')}"`:r}function F(e){return Array.isArray(e)?e.map(r=>`"${L(r)}"`).join(","):""}function O(...e){for(let r of e)if(r!==void 0)return r}function U(e,r){let a=e.name||e.slug||r||"",m=e.fullyQualifiedName||a||r||"",f=e.description||"",u=e.owner?.name||e.owner?.displayName||C(e.authors||[],","),p=e.timeZones||e.timezones||[],c=Array.isArray(p)?p:typeof p=="string"?[p]:[],h=y(O(e.cache?.enabled,e.cache,e.runtime?.cache?.enabled,e.runtime?.cache,e.isCacheEnabled)),o=[];o.push(`${m}(${m})`),f&&o.push(f),u&&o.push(u),c.length&&o.push(c.join(",")),o.push(`Cache: ${h}`),o.push("");let g=Array.isArray(e.views)?e.views:[],b=Array.isArray(e.tables)?e.tables:[];g.length===0&&b.length>0&&(g.push(...b.filter(s=>!s.sql)),b=b.filter(s=>s.sql));let d=(s,S,D)=>{let n=[],w=s.title||s.displayName||s.name||`item_${S}`,Y=s.name||s.table||s.view||w,P=s.description||s.meta?.description||"",j=y(O(s.isVisible,s.visible)),R=y(s.public),M=s.connectedComponent,A=s.refs||s.references,I=s.meta?.title||s.metric?.title||"",$=s.meta?.tags||s.tags,G=!!(s.meta?.metric||s.metric);if(n.push(`${S}. ${w}(${Y})`),P&&n.push(P),D==="view"){let t=["view"];G&&t.push("metric"),t.push(`visible: ${j}`),t.push(`public: ${R}`),n.push(t.join(", "))}else{let t=["table"];M!==void 0&&t.push(`connectedComponent: ${M}`),t.push(`visible: ${j}`),t.push(`public: ${R}`),n.push(t.join(", "))}if(I&&n.push(I),Array.isArray($)&&$.length&&n.push(F($)),A&&(Array.isArray(A)&&A.length||typeof A=="string")&&n.push(`refs: ${Array.isArray(A)?A.join(","):A}`),D==="table"&&s.sql&&(n.push("SQL:"),n.push("`"+String(s.sql).trim()+"`")),s.joins&&Array.isArray(s.joins)&&s.joins.length){n.push(""),n.push("Joins:");for(let t of s.joins)n.push(`${t.relationship} - ${t.name}`),n.push(" SQL: `"+L(t.sql).trim()+"`")}n.push(""),n.push("Dimentions"),D==="table"?n.push("name|title|description|type|sql|suggestFilterValues|isVisible|public|primaryKey|aliasMember|isGoverned|refs"):n.push("name|title|description|type|suggestFilterValues|isVisible|public|primaryKey|aliasMember|isGoverned|refs");let _=Array.isArray(s.dimensions)?s.dimensions:[];for(let t of _){let v=[i(t.name),i(t.title||t.displayName||""),i(t.description||""),i(t.type||t.dataType||"")];D==="table"&&v.push(i(t.sql||t.expression||"")),v.push(i(y(t.suggestFilterValues)),i(y(O(t.isVisible,t.visible))),i(y(t.public)),i(y(t.primaryKey)),i(t.aliasMember||(Array.isArray(t.aliasMembers)?t.aliasMembers.join(","):"")),i(y(t.isGoverned)),i(Array.isArray(t.refs)?t.refs.join(","):t.refs||"")),n.push(v.join("|"))}n.push(""),n.push("Measures"),n.push("name|title|description|cumulativeTotal|cumulative|type|aggType|isVisible|public|aliasMember|isGoverned|refs");let z=Array.isArray(s.measures)?s.measures:[];for(let t of z){let v=[i(t.name),i(t.title||t.displayName||""),i(t.description||""),i(y(t.cumulativeTotal)),i(y(t.cumulative)),i(t.type||t.dataType||""),i(t.aggType||t.aggregation||""),i(y(O(t.isVisible,t.visible))),i(y(t.public)),i(t.aliasMember||(Array.isArray(t.aliasMembers)?t.aliasMembers.join(","):"")),i(y(t.isGoverned)),i(Array.isArray(t.refs)?t.refs.join(","):t.refs||"")];n.push(v.join("|"))}return n},N=1;for(let s of g)o.push(...d(s,N++,"view")),o.push("");for(let s of b)o.push(...d(s,N++,"table")),o.push("");return o.join(`
|
|
2
|
-
`)}async function J({slug:e=T,apiKey:r,fqdn:a=q}){let m=`https://${a}/lens2/api/${e.replace("public.","public:")}/v2/meta`,f={method:"GET",headers:{Authorization:`Bearer ${r}`}},{status:u,data:p}=await x(m,f);if(u<200||u>=300)return{content:[{type:"text",text:`Error: API responded with ${u}`}],isError:!0};try{let c=JSON.parse(p);return{content:[{type:"text",text:U(c,e)}]}}catch{return{content:[{type:"text",text:"Error: API Response is not a JSON"}],isError:!0}}}async function E({slug:e=T,payload:r,apiKey:a,fqdn:m=q}){let f=`https://${m}/lens2/api/${e.replace("public.","public:")}/v2/load`,u=JSON.stringify({query:r}),p={method:"POST",headers:{Authorization:`Bearer ${a}`,"Content-Type":"application/json","Content-Length":Buffer.byteLength(u)}},{status:c,data:h}=await x(f,p,u,!0);if(c<200||c>=300)return{content:[{type:"text",text:JSON.stringify({status:c,data:h})}],isError:!0};try{let o=JSON.parse(h);return{content:[{type:"text",text:JSON.stringify(o.data)}]}}catch(o){return console.log("Error parsing lens data response:",o,h),{content:[{type:"text",text:`Query may be still running. Try again one more time. ${o.message}`}],isError:!0}}}import W from"keyv";import{formatDistanceToNow as X}from"date-fns";var Z=new W({namespace:"list-lens",ttl:1e3*60*5});async function V({apiKey:e,fqdn:r=q}){let a=await Z.get(e);if(a)return a;let m=`https://${r}/dph/discover/api/msearch/query/v2`,f=JSON.stringify({queries:[{indexUid:"data_product_v2_search_index",q:"*",filter:["deleted='false'","tagList NOT IN ['DPTier.Source Aligned']"],offset:0,limit:1e3,attributesToRetrieve:["description","name","fullyQualifiedName","id","tagList","displayName","ports.lens.entityInfo.fullyQualifiedName","owner","purpose","updatedAt"]}]}),u={method:"POST",headers:{Authorization:`Bearer ${e}`,"Content-Type":"application/json","Content-Length":Buffer.byteLength(f)}},{status:p,data:c}=await x(m,u,f);if(p<200||p>=300)return{content:[{type:"text",text:`Error: API responded with ${p}`}],isError:!0};try{let o=JSON.parse(c).hits.filter(d=>d.ports?.lens),g=[],b=["Semantic model (lens) - fully qualified name","Data product name","Data product description","Purpose","DPDomain","DPUsecase","Owner","Updated At"];return o.forEach(d=>{let N=d.tagList.find(w=>w.startsWith("DPDomain."))?.replace("DPDomain.","")||"N/A",s=d.tagList.find(w=>w.startsWith("DPUsecase."))?.replace("DPUsecase.","")||"N/A",S=d.owner?.displayName||"N/A",D=d.updatedAt?X(new Date(d.updatedAt),{addSuffix:!0}):"N/A",n=[d.ports.lens.entityInfo.fullyQualifiedName.replace("dataos.",""),d.displayName,d.description,d.purpose||"N/A",N,s,S,D];g.push(n.join("|"))}),{content:[{type:"text",text:`${b.join("|")}
|
|
3
|
-
`+g.join(`
|
|
4
|
-
`)}]}}catch{return{content:[{type:"text",text:"Error: API Response is not a JSON"}],isError:!0}}}import{z as l}from"zod";var H=`
|
|
5
|
-
Query data from a Lens by sending a "query" object.
|
|
6
|
-
|
|
7
|
-
Build the parameters as follows:
|
|
8
|
-
1) Pick measures (numeric metrics) and/or dimensions (grouping fields). At least one of the two must be provided.
|
|
9
|
-
2) Filters: While optional, they are strongly recommended for better relevance, performance, and correctness. Use them whenever the question implies a subset (time window, region, status, etc.). For numeric measures, use numeric values; for dates, use ISO strings (YYYY-MM-DD). If truly no filters are needed, omit the filters key entirely (do not send an empty array).
|
|
10
|
-
3) Choose a sensible limit (default 100). Use small limits (5/10/20) for top/bottom style questions; larger (500/1000) for comprehensive lists. Offset supports pagination.
|
|
11
|
-
|
|
12
|
-
Filter shape (very important):
|
|
13
|
-
- filters is an array of groups. Each group is an object with a single key: "and" or "or". The value is an array of filter clauses.
|
|
14
|
-
- Each clause is: { "member": string, "operator": one of the allowed operators, "values": array }
|
|
15
|
-
- For numeric measures, values must be numbers. For date operators like inDateRange, pass ["start", "end"] as YYYY-MM-DD.
|
|
16
|
-
|
|
17
|
-
Example query payload:
|
|
18
|
-
{
|
|
19
|
-
"measures": ["sales.totalRevenue"],
|
|
20
|
-
"dimensions": ["date.month"],
|
|
21
|
-
"filters": [
|
|
22
|
-
{ "and": [
|
|
23
|
-
{ "member": "date.month", "operator": "inDateRange", "values": ["2024-01-01", "2024-03-31"] },
|
|
24
|
-
{ "member": "sales.totalRevenue", "operator": "gte", "values": [1000] }
|
|
25
|
-
] }
|
|
26
|
-
],
|
|
27
|
-
"limit": 10,
|
|
28
|
-
"offset": 0
|
|
29
|
-
}
|
|
30
|
-
|
|
31
|
-
Example 2 (recommended use of filters): Top 10 customers by revenue in EMEA for 2024
|
|
32
|
-
{
|
|
33
|
-
"measures": ["sales.totalRevenue"],
|
|
34
|
-
"dimensions": ["customer.name", "customer.region"],
|
|
35
|
-
"filters": [
|
|
36
|
-
{ "and": [
|
|
37
|
-
{ "member": "customer.region", "operator": "equals", "values": ["EMEA"] },
|
|
38
|
-
{ "member": "date.date", "operator": "inDateRange", "values": ["2024-01-01", "2024-12-31"] }
|
|
39
|
-
] }
|
|
40
|
-
],
|
|
41
|
-
"limit": 10
|
|
42
|
-
}
|
|
43
|
-
|
|
44
|
-
Common analysis patterns
|
|
45
|
-
- Trend analysis: time dimensions + performance measures
|
|
46
|
-
- Comparative analysis: categorical dimensions + multiple measures
|
|
47
|
-
- Drill down: hierarchical dimensions (year/quarter/month)
|
|
48
|
-
- KPI: single measure with dimensional breakdowns
|
|
49
|
-
|
|
50
|
-
Strict rules
|
|
51
|
-
- Use only field names that exist in the schema
|
|
52
|
-
- Do not fabricate results if the query returns empty or errors
|
|
53
|
-
- Explore the schema before selecting fields (use the schema tool to copy exact field names)
|
|
54
|
-
|
|
55
|
-
Keywords: query, analytics, business intelligence, metrics, KPIs, lens, data, insights
|
|
56
|
-
`,Q=l.object({measures:l.array(l.string({description:"Fully-qualified measure name from the schema (e.g., sales.totalRevenue). Provide numbers-based metrics only here."})).optional(),dimensions:l.array(l.string({description:"Fully-qualified dimension name from the schema (e.g., date.month, customer.region). Use for grouping or slicing results."})).optional(),filters:l.array(l.record(l.enum(["and","or"]),l.array(l.object({member:l.string(),operator:l.enum(["equals","notEquals","contains","notContains","startsWith","notStartsWith","endsWith","notEndsWith","gt","gte","lt","lte","inDateRange","notInDateRange","beforeDate","afterDate"]),values:l.array(l.string().date().or(l.number()).or(l.string()).or(l.boolean()).or(l.null()))}))),{description:"Optional but strongly recommended. Provide an array of groups. Each group is an object with a single key: 'and' or 'or', mapping to an array of filter clauses. Clause shape: { member, operator, values }. Use fully-qualified member names from the schema. For numeric measures, values must be numbers. For date ranges, pass [start, end] as 'YYYY-MM-DD'. Prefer including at least a time window or key categorical filter. Omit this key entirely if no filters are needed. Do not send an empty array."}).nonempty().optional(),limit:l.number({description:"Max rows to return. Integer. Default 100. Use small limits (5/10/20) for top/bottom questions; larger (500/1000) for comprehensive lists."}).int().default(100),offset:l.number({description:"Rows to skip for pagination. Integer. Default 0. Increase to fetch subsequent pages."}).int().default(0)}),Se=({server:e,apiKey:r,fqdn:a,slug:m})=>{e.tool("query-lens-data",H,m?{query:Q}:{query:Q,slug:l.string({description:"Name of the lens (semantic model slug). Alphanumeric with hyphen(-)s allowed. Make sure slug string contains workspace notation. example: public.customer-360"})},async({slug:f,query:u})=>E({payload:u,slug:m||f,apiKey:r,fqdn:a}))};export{J as a,E as b,V as c,H as d,Q as e,Se as f};
|
|
57
|
-
//# sourceMappingURL=chunk-ZNGQUM2D.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/lens/services/request.ts","../src/lens/services/constants.ts","../src/util/format.ts","../src/lens/services/normalize.ts","../src/lens/services/meta.ts","../src/lens/services/data.ts","../src/lens/services/list.ts","../src/lens/tools/lens-data.ts"],"sourcesContent":["import https from \"https\";\n\nconst MAX_RETRIES = 4;\n\n// Helper function to make HTTPS requests\nexport function httpsRequest(\n url: string,\n options: https.RequestOptions,\n body?: string,\n enableRetry: boolean = false,\n retryCount = 0\n): Promise<{ status: number; data: any }> {\n return new Promise((resolve, reject) => {\n const req = https.request(url, options, (res) => {\n let data = \"\";\n res.on(\"data\", (chunk) => (data += chunk));\n res.on(\"end\", () => {\n\n if(enableRetry && retryCount < MAX_RETRIES && data.includes(\"Continue wait\")) {\n setTimeout(() => {\n httpsRequest(url, options, body, enableRetry, retryCount + 1)\n .then(resolve)\n .catch(reject);\n }, 1000); // Exponential backoff\n } else {\n resolve({ status: res.statusCode || 500, data });\n }\n });\n });\n req.on(\"error\", reject);\n if (body) req.write(body);\n req.end();\n });\n}\n\n","import { config } from \"dotenv\";\n\nconfig();\n\nexport const DATAOS_FQDN = \"\";\nexport const SLUG = process.env.SLUG || \"bmx\";\n\n","// Common lightweight formatting and coercion helpers for string output\n\nexport type AnyObj = Record<string, any>;\n\nexport function safeJoin(arr: any[], sep = \",\"): string {\n if (!Array.isArray(arr)) return \"\";\n return arr\n .filter((v) => v !== undefined && v !== null)\n .map((v) => (typeof v === \"string\" ? v : JSON.stringify(v)))\n .join(sep);\n}\n\nexport function toBool(v: any): boolean {\n // Consider true only for explicit truthy flags\n return v === true || v === \"true\" || v === 1 || v === \"1\";\n}\n\nexport function toStringVal(v: any): string {\n if (v === null || v === undefined) return \"\";\n if (typeof v === \"string\") return v;\n if (typeof v === \"number\" || typeof v === \"boolean\") return String(v);\n return JSON.stringify(v);\n}\n\nexport function quoteCSV(value: any): string {\n const s = toStringVal(value);\n if (s === \"\") return s;\n // If contains delimiters, wrap in quotes\n if (s.includes(\"|\") || s.includes(\",\") || s.includes(\"\\\"\")) {\n return `\"${s.replace(/\"/g, '\"')}\"`;\n }\n return s;\n}\n\nexport function joinTags(tags: any): string {\n if (!Array.isArray(tags)) return \"\";\n return tags.map((t) => `\"${toStringVal(t)}\"`).join(\",\");\n}\n\nexport function firstDefined<T>(...vals: T[]): T | undefined {\n for (const v of vals) if (v !== undefined) return v;\n}\n\n","import type { AnyObj } from \"../../util/format.js\";\nimport { safeJoin, toBool, toStringVal, quoteCSV, joinTags, firstDefined } from \"../../util/format.js\";\n\nexport function normalizeLensMeta(json: AnyObj, slug?: string): string {\n const name = (json.name || json.slug || slug || \"\") as string;\n const fqn = (json.fullyQualifiedName || name || slug || \"\") as string;\n const description = (json.description || \"\") as string;\n const owner = (json.owner?.name || json.owner?.displayName || safeJoin(json.authors || [], \",\")) as string;\n const tz = (json.timeZones || json.timezones || []) as any;\n const timezones: string[] = Array.isArray(tz) ? tz : (typeof tz === \"string\" ? [tz] : []);\n const cacheEnabled = toBool(\n firstDefined(\n json.cache?.enabled,\n json.cache,\n json.runtime?.cache?.enabled,\n json.runtime?.cache,\n json.isCacheEnabled,\n )\n );\n\n const lines: string[] = [];\n lines.push(`${fqn}(${fqn})`);\n if (description) lines.push(description);\n if (owner) lines.push(owner);\n if (timezones.length) lines.push(timezones.join(\",\"));\n lines.push(`Cache: ${cacheEnabled}`);\n lines.push(\"\");\n\n const views: AnyObj[] = Array.isArray(json.views) ? json.views : [];\n let tables: AnyObj[] = Array.isArray(json.tables) ? json.tables : [];\n\n // If there are no explicit views, infer non-sql items as views\n if (views.length === 0 && tables.length > 0) {\n views.push(...tables.filter((t) => !t.sql));\n tables = tables.filter((t) => t.sql);\n }\n\n const formatItem = (item: AnyObj, index: number, kind: \"view\" | \"table\"): string[] => {\n const out: string[] = [];\n const itemName = (item.title || item.displayName || item.name || `item_${index}`) as string;\n const itemId = (item.name || item.table || item.view || itemName) as string;\n const desc = (item.description || item.meta?.description || \"\") as string;\n const isVisible = toBool(firstDefined(item.isVisible, item.visible));\n const isPublic = toBool(item.public);\n const connectedComponent = item.connectedComponent;\n const refs = item.refs || item.references;\n const metricTitle = item.meta?.title || item.metric?.title || \"\";\n const tags = item.meta?.tags || item.tags;\n const isMetric = Boolean(item.meta?.metric || item.metric);\n\n out.push(`${index}. ${itemName}(${itemId})`);\n if (desc) out.push(desc);\n if (kind === \"view\") {\n const flags: string[] = [\"view\"];\n if (isMetric) flags.push(\"metric\");\n flags.push(`visible: ${isVisible}`);\n flags.push(`public: ${isPublic}`);\n out.push(flags.join(\", \"));\n } else {\n const flags: string[] = [\"table\"];\n if (connectedComponent !== undefined) flags.push(`connectedComponent: ${connectedComponent}`);\n flags.push(`visible: ${isVisible}`);\n flags.push(`public: ${isPublic}`);\n out.push(flags.join(\", \"));\n }\n if (metricTitle) out.push(metricTitle);\n if (Array.isArray(tags) && tags.length) out.push(joinTags(tags));\n if (refs && ((Array.isArray(refs) && refs.length) || typeof refs === \"string\")) {\n out.push(`refs: ${Array.isArray(refs) ? refs.join(\",\") : refs}`);\n }\n\n if (kind === \"table\" && item.sql) {\n out.push(\"SQL:\");\n out.push(\"`\" + String(item.sql).trim() + \"`\");\n }\n\n if(item.joins && Array.isArray(item.joins) && item.joins.length) {\n out.push(\"\");\n out.push(\"Joins:\");\n for(const j of item.joins) {\n out.push(`${j.relationship} - ${j.name}`)\n out.push(\" SQL: `\" + toStringVal(j.sql).trim() + \"`\");\n }\n }\n // Dimensions header\n out.push(\"\");\n out.push(\"Dimentions\");\n if (kind === \"table\") {\n out.push(\"name|title|description|type|sql|suggestFilterValues|isVisible|public|primaryKey|aliasMember|isGoverned|refs\");\n } else {\n out.push(\"name|title|description|type|suggestFilterValues|isVisible|public|primaryKey|aliasMember|isGoverned|refs\");\n }\n\n const dims: AnyObj[] = Array.isArray(item.dimensions) ? item.dimensions : [];\n for (const d of dims) {\n const row = [\n quoteCSV(d.name),\n quoteCSV(d.title || d.displayName || \"\"),\n quoteCSV(d.description || \"\"),\n quoteCSV(d.type || d.dataType || \"\"),\n ];\n if (kind === \"table\") row.push(quoteCSV(d.sql || d.expression || \"\"));\n row.push(\n quoteCSV(toBool(d.suggestFilterValues)),\n quoteCSV(toBool(firstDefined(d.isVisible, d.visible))),\n quoteCSV(toBool(d.public)),\n quoteCSV(toBool(d.primaryKey)),\n quoteCSV(d.aliasMember || (Array.isArray(d.aliasMembers) ? d.aliasMembers.join(\",\") : \"\")),\n quoteCSV(toBool(d.isGoverned)),\n quoteCSV(Array.isArray(d.refs) ? d.refs.join(\",\") : (d.refs || \"\"))\n );\n out.push(row.join(\"|\"));\n }\n\n // Measures header\n out.push(\"\");\n out.push(\"Measures\");\n out.push(\"name|title|description|cumulativeTotal|cumulative|type|aggType|isVisible|public|aliasMember|isGoverned|refs\");\n\n const meas: AnyObj[] = Array.isArray(item.measures) ? item.measures : [];\n for (const m of meas) {\n const row = [\n quoteCSV(m.name),\n quoteCSV(m.title || m.displayName || \"\"),\n quoteCSV(m.description || \"\"),\n quoteCSV(toBool(m.cumulativeTotal)),\n quoteCSV(toBool(m.cumulative)),\n quoteCSV(m.type || m.dataType || \"\"),\n quoteCSV(m.aggType || m.aggregation || \"\"),\n quoteCSV(toBool(firstDefined(m.isVisible, m.visible))),\n quoteCSV(toBool(m.public)),\n quoteCSV(m.aliasMember || (Array.isArray(m.aliasMembers) ? m.aliasMembers.join(\",\") : \"\")),\n quoteCSV(toBool(m.isGoverned)),\n quoteCSV(Array.isArray(m.refs) ? m.refs.join(\",\") : (m.refs || \"\"))\n ];\n out.push(row.join(\"|\"));\n }\n\n\n return out;\n };\n\n let index = 1;\n for (const v of views) {\n lines.push(...formatItem(v, index++, \"view\"));\n lines.push(\"\");\n }\n for (const t of tables) {\n lines.push(...formatItem(t, index++, \"table\"));\n lines.push(\"\");\n }\n\n return lines.join(\"\\n\");\n}\n\n","import https from \"https\";\nimport { httpsRequest } from \"./request.js\";\nimport { DATAOS_FQDN, SLUG } from \"./constants.js\";\nimport type { LensOptions } from \"./types.js\";\nimport { normalizeLensMeta } from \"./normalize.js\";\n\nexport async function meta({ slug = SLUG, apiKey, fqdn = DATAOS_FQDN }: LensOptions) {\n const url = `https://${fqdn}/lens2/api/${slug.replace(\"public.\", \"public:\")}/v2/meta`;\n const options: https.RequestOptions = {\n method: \"GET\",\n headers: { Authorization: `Bearer ${apiKey}` },\n };\n\n const { status, data } = await httpsRequest(url, options);\n\n if (status < 200 || status >= 300) {\n return {\n content: [\n {\n type: \"text\",\n text: `Error: API responded with ${status}`,\n },\n ],\n isError: true,\n };\n }\n\n try {\n const json = JSON.parse(data);\n const text = normalizeLensMeta(json, slug);\n return {\n content: [\n {\n type: \"text\",\n text,\n },\n ],\n };\n } catch (e) {\n return {\n content: [\n {\n type: \"text\",\n text: `Error: API Response is not a JSON`,\n },\n ],\n isError: true,\n };\n }\n}\n","import https from \"https\";\nimport { httpsRequest } from \"./request.js\";\nimport { DATAOS_FQDN, SLUG } from \"./constants.js\";\nimport type { LensOptions } from \"./types.js\";\n\nexport async function lensData({\n slug = SLUG,\n payload,\n apiKey,\n fqdn = DATAOS_FQDN,\n}: LensOptions) {\n const url = `https://${fqdn}/lens2/api/${slug.replace(\"public.\", \"public:\")}/v2/load`;\n const body = JSON.stringify({ query: payload });\n const options: https.RequestOptions = {\n method: \"POST\",\n headers: {\n Authorization: `Bearer ${apiKey}`,\n \"Content-Type\": \"application/json\",\n \"Content-Length\": Buffer.byteLength(body),\n },\n };\n\n const { status, data } = await httpsRequest(url, options, body, true);\n\n if (status < 200 || status >= 300) {\n return {\n content: [\n {\n type: \"text\" as const,\n text: JSON.stringify({ status, data: data }),\n },\n ],\n isError: true,\n };\n }\n\n try {\n const result = JSON.parse(data);\n return {\n content: [\n {\n type: \"text\" as const,\n text: JSON.stringify(result.data),\n },\n ],\n };\n } catch(e) {\n console.log(\"Error parsing lens data response:\", e, data);\n return {\n content: [\n {\n type: \"text\" as const,\n text: `Query may be still running. Try again one more time. ${e.message}`,\n },\n ],\n isError: true,\n };\n }\n}\n\n","import https from \"https\";\nimport { httpsRequest } from \"./request.js\";\nimport { DATAOS_FQDN } from \"./constants.js\";\nimport Keyv from \"keyv\";\nimport { DataProductListResponse } from \"../../data-products/types/data-product-list.js\";\nimport { formatDistanceToNow } from \"date-fns\";\n\n\nexport const listLensCache = new Keyv({\n namespace: 'list-lens',\n ttl: 1000 * 60 * 5,\n})\n\nexport async function lensList({\n apiKey,\n fqdn = DATAOS_FQDN,\n}: {\n apiKey: string;\n fqdn?: string;\n}) {\n\n const cachedList = await listLensCache.get(apiKey);\n\n if (cachedList) {\n return cachedList;\n }\n\n const url = `https://${fqdn}/dph/discover/api/msearch/query/v2`;\n const body = JSON.stringify({\n \"queries\": [\n {\n \"indexUid\": \"data_product_v2_search_index\",\n \"q\": \"*\",\n \"filter\": [\n \"deleted='false'\",\n \"tagList NOT IN ['DPTier.Source Aligned']\"\n ],\n \"offset\": 0,\n \"limit\": 1000,\n \"attributesToRetrieve\": [\n \"description\",\n \"name\",\n \"fullyQualifiedName\",\n \"id\",\n \"tagList\",\n \"displayName\",\n \"ports.lens.entityInfo.fullyQualifiedName\",\n \"owner\",\n \"purpose\",\n \"updatedAt\"\n ]\n }\n ]\n });\n const options: https.RequestOptions = {\n method: \"POST\",\n headers: {\n Authorization: `Bearer ${apiKey}`,\n \"Content-Type\": \"application/json\",\n \"Content-Length\": Buffer.byteLength(body),\n },\n };\n\n const { status, data } = await httpsRequest(url, options, body);\n\n if (status < 200 || status >= 300) {\n return {\n content: [\n {\n type: \"text\" as const,\n text: `Error: API responded with ${status}`,\n },\n ],\n isError: true,\n };\n }\n\n try {\n const res: DataProductListResponse = JSON.parse(data);\n const result = res.hits.filter((item) => item.ports?.lens);\n\n\n\n const listItems = []\n const headers = [\n \"Semantic model (lens) - fully qualified name\",\n \"Data product name\",\n \"Data product description\",\n \"Purpose\",\n \"DPDomain\",\n \"DPUsecase\",\n \"Owner\",\n \"Updated At\"\n ]\n\n result.forEach((dp) => {\n const dpDomain = dp.tagList.find(tag => tag.startsWith(\"DPDomain.\"))?.replace(\"DPDomain.\", \"\") || \"N/A\";\n const dpUsecase = dp.tagList.find(tag => tag.startsWith(\"DPUsecase.\"))?.replace(\"DPUsecase.\", \"\") || \"N/A\";\n const ownerName = dp.owner?.displayName || \"N/A\";\n const updatedAt = dp['updatedAt'] ? \n formatDistanceToNow(new Date(dp['updatedAt']), { addSuffix: true }) : \n \"N/A\";\n\n const lineData = [\n dp.ports!.lens.entityInfo.fullyQualifiedName.replace(\"dataos.\", \"\"),\n dp.displayName,\n dp.description,\n dp.purpose || \"N/A\",\n dpDomain,\n dpUsecase,\n ownerName,\n updatedAt\n ]\n\n listItems.push(lineData.join(\"|\"));\n })\n \n return {\n content: [\n {\n type: \"text\" as const,\n text: `${headers.join(\"|\")}\\n` + listItems.join(\"\\n\"),\n },\n ],\n }\n \n } catch {\n return {\n content: [\n {\n type: \"text\",\n text: `Error: API Response is not a JSON`,\n },\n ],\n isError: true,\n };\n }\n}\n\n","import { z } from \"zod\";\nimport { lensData } from \"../service.js\";\nimport { InitParams } from \"../resources/schema.js\";\n\nexport const description = `\nQuery data from a Lens by sending a \"query\" object.\n\nBuild the parameters as follows:\n1) Pick measures (numeric metrics) and/or dimensions (grouping fields). At least one of the two must be provided.\n2) Filters: While optional, they are strongly recommended for better relevance, performance, and correctness. Use them whenever the question implies a subset (time window, region, status, etc.). For numeric measures, use numeric values; for dates, use ISO strings (YYYY-MM-DD). If truly no filters are needed, omit the filters key entirely (do not send an empty array).\n3) Choose a sensible limit (default 100). Use small limits (5/10/20) for top/bottom style questions; larger (500/1000) for comprehensive lists. Offset supports pagination.\n\nFilter shape (very important):\n- filters is an array of groups. Each group is an object with a single key: \"and\" or \"or\". The value is an array of filter clauses.\n- Each clause is: { \"member\": string, \"operator\": one of the allowed operators, \"values\": array }\n- For numeric measures, values must be numbers. For date operators like inDateRange, pass [\"start\", \"end\"] as YYYY-MM-DD.\n\nExample query payload:\n{\n \"measures\": [\"sales.totalRevenue\"],\n \"dimensions\": [\"date.month\"],\n \"filters\": [\n { \"and\": [\n { \"member\": \"date.month\", \"operator\": \"inDateRange\", \"values\": [\"2024-01-01\", \"2024-03-31\"] },\n { \"member\": \"sales.totalRevenue\", \"operator\": \"gte\", \"values\": [1000] }\n ] }\n ],\n \"limit\": 10,\n \"offset\": 0\n}\n\nExample 2 (recommended use of filters): Top 10 customers by revenue in EMEA for 2024\n{\n \"measures\": [\"sales.totalRevenue\"],\n \"dimensions\": [\"customer.name\", \"customer.region\"],\n \"filters\": [\n { \"and\": [\n { \"member\": \"customer.region\", \"operator\": \"equals\", \"values\": [\"EMEA\"] },\n { \"member\": \"date.date\", \"operator\": \"inDateRange\", \"values\": [\"2024-01-01\", \"2024-12-31\"] }\n ] }\n ],\n \"limit\": 10\n}\n\nCommon analysis patterns\n- Trend analysis: time dimensions + performance measures\n- Comparative analysis: categorical dimensions + multiple measures\n- Drill down: hierarchical dimensions (year/quarter/month)\n- KPI: single measure with dimensional breakdowns\n\nStrict rules\n- Use only field names that exist in the schema\n- Do not fabricate results if the query returns empty or errors\n- Explore the schema before selecting fields (use the schema tool to copy exact field names)\n\nKeywords: query, analytics, business intelligence, metrics, KPIs, lens, data, insights\n`;\n\nexport const querySchema = z.object({\n measures: z.array(\n z.string({ description: \"Fully-qualified measure name from the schema (e.g., sales.totalRevenue). Provide numbers-based metrics only here.\" })\n ).optional(),\n dimensions: z.array(\n z.string({ description: \"Fully-qualified dimension name from the schema (e.g., date.month, customer.region). Use for grouping or slicing results.\" })\n ).optional(),\n filters: z.array(\n z.record(\n z.enum([\"and\", \"or\"]),\n z.array(\n z.object({\n \"member\": z.string(),\n \"operator\": z.enum([\"equals\", \"notEquals\", \"contains\", \"notContains\", \"startsWith\", \"notStartsWith\", \"endsWith\", \"notEndsWith\", \"gt\", \"gte\", \"lt\", \"lte\", \"inDateRange\", \"notInDateRange\", \"beforeDate\", \"afterDate\"]),\n \"values\": z.array(\n z.string().date()\n .or(z.number())\n .or(z.string())\n .or(z.boolean())\n .or(z.null())\n )\n })\n )\n ),\n {\n description: \"Optional but strongly recommended. Provide an array of groups. Each group is an object with a single key: 'and' or 'or', mapping to an array of filter clauses. Clause shape: { member, operator, values }. Use fully-qualified member names from the schema. For numeric measures, values must be numbers. For date ranges, pass [start, end] as 'YYYY-MM-DD'. Prefer including at least a time window or key categorical filter. Omit this key entirely if no filters are needed. Do not send an empty array.\"\n }).nonempty().optional(),\n limit: z.number({ description: \"Max rows to return. Integer. Default 100. Use small limits (5/10/20) for top/bottom questions; larger (500/1000) for comprehensive lists.\" }).int().default(100),\n offset: z.number({\n description: \"Rows to skip for pagination. Integer. Default 0. Increase to fetch subsequent pages.\"\n }).int().default(0)\n})\n\n\nexport const initLensDataTool = ({\n server, apiKey, fqdn, slug: reqSlug\n}: InitParams) => {\n\n\n\n server.tool(\n \"query-lens-data\",\n description,\n ( reqSlug ? \n { query: querySchema } : \n {\n query: querySchema,\n slug: z.string({\n description: \"Name of the lens (semantic model slug). Alphanumeric with hyphen(-)s allowed. Make sure slug string contains workspace notation. example: public.customer-360\"\n })\n } \n ),\n async ({ slug, query: payload }): Promise<any> => lensData({ \n payload, \n slug: reqSlug || slug, \n apiKey, \n fqdn \n })\n )\n}\n"],"mappings":"AAAA,OAAOA,MAAW,QAElB,IAAMC,EAAc,EAGb,SAASC,EACdC,EACAC,EACAC,EACAC,EAAuB,GACvBC,EAAa,EAC2B,CACxC,OAAO,IAAI,QAAQ,CAACC,EAASC,IAAW,CACtC,IAAMC,EAAMV,EAAM,QAAQG,EAAKC,EAAUO,GAAQ,CAC/C,IAAIC,EAAO,GACXD,EAAI,GAAG,OAASE,GAAWD,GAAQC,CAAM,EACzCF,EAAI,GAAG,MAAO,IAAM,CAEfL,GAAeC,EAAaN,GAAeW,EAAK,SAAS,eAAe,EACzE,WAAW,IAAM,CACfV,EAAaC,EAAKC,EAASC,EAAMC,EAAaC,EAAa,CAAC,EACzD,KAAKC,CAAO,EACZ,MAAMC,CAAM,CACjB,EAAG,GAAI,EAEPD,EAAQ,CAAE,OAAQG,EAAI,YAAc,IAAK,KAAAC,CAAK,CAAC,CAEnD,CAAC,CACH,CAAC,EACDF,EAAI,GAAG,QAASD,CAAM,EAClBJ,GAAMK,EAAI,MAAML,CAAI,EACxBK,EAAI,IAAI,CACV,CAAC,CACH,CCjCA,OAAS,UAAAI,MAAc,SAEvBA,EAAO,EAEA,IAAMC,EAAc,GACdC,EAAO,QAAQ,IAAI,MAAQ,MCDjC,SAASC,EAASC,EAAYC,E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CAAC,MAAO,IAAI,CAAC,EACpBA,EAAE,MACAA,EAAE,OAAO,CACP,OAAUA,EAAE,OAAO,EACnB,SAAYA,EAAE,KAAK,CAAC,SAAU,YAAa,WAAY,cAAe,aAAc,gBAAiB,WAAY,cAAe,KAAM,MAAO,KAAM,MAAO,cAAe,iBAAkB,aAAc,WAAW,CAAC,EACrN,OAAUA,EAAE,MACVA,EAAE,OAAO,EAAE,KAAK,EACb,GAAGA,EAAE,OAAO,CAAC,EACb,GAAGA,EAAE,OAAO,CAAC,EACb,GAAGA,EAAE,QAAQ,CAAC,EACd,GAAGA,EAAE,KAAK,CAAC,CAChB,CACF,CAAC,CACH,CACF,EACF,CACE,YAAa,ifACf,CAAC,EAAE,SAAS,EAAE,SAAS,EACvB,MAAOA,EAAE,OAAO,CAAE,YAAa,2IAA4I,CAAC,EAAE,IAAI,EAAE,QAAQ,GAAG,EAC/L,OAAQA,EAAE,OAAO,CACf,YAAa,sFACf,CAAC,EAAE,IAAI,EAAE,QAAQ,CAAC,CACpB,CAAC,EAGYC,GAAmB,CAAC,CAC/B,OAAAC,EAAQ,OAAAC,EAAQ,KAAAC,EAAM,KAAMC,CAC9B,IAAkB,CAIhBH,EAAO,KACL,kBACAJ,EACEO,EACA,CAAE,MAAON,CAAY,EACrB,CACE,MAAOA,EACP,KAAMC,EAAE,OAAO,CACb,YAAa,+JACf,CAAC,CACH,EAEF,MAAO,CAAE,KAAAM,EAAM,MAAOC,CAAQ,IAAoBC,EAAS,CACzD,QAAAD,EACA,KAAMF,GAAWC,EACjB,OAAAH,EACA,KAAAC,CACF,CAAC,CACH,CACF","names":["https","MAX_RETRIES","httpsRequest","url","options","body","enableRetry","retryCount","resolve","reject","req","res","data","chunk","config","DATAOS_FQDN","SLUG","safeJoin","arr","sep","v","toBool","toStringVal","quoteCSV","value","s","joinTags","tags","t","firstDefined","vals","normalizeLensMeta","json","slug","name","fqn","description","owner","safeJoin","tz","timezones","cacheEnabled","toBool","firstDefined","lines","views","tables","t","formatItem","item","index","kind","out","itemName","itemId","desc","isVisible","isPublic","connectedComponent","refs","metricTitle","tags","isMetric","flags","joinTags","j","toStringVal","dims","d","row","quoteCSV","meas","m","v","meta","slug","SLUG","apiKey","fqdn","DATAOS_FQDN","url","options","status","data","httpsRequest","json","normalizeLensMeta","lensData","slug","SLUG","payload","apiKey","fqdn","DATAOS_FQDN","url","body","options","status","data","httpsRequest","result","e","Keyv","formatDistanceToNow","listLensCache","lensList","apiKey","fqdn","DATAOS_FQDN","cachedList","url","body","options","status","data","httpsRequest","result","item","listItems","headers","dp","dpDomain","tag","dpUsecase","ownerName","updatedAt","lineData","z","description","querySchema","z","initLensDataTool","server","apiKey","fqdn","reqSlug","slug","payload","lensData"]}
|
package/dist/lens/index.cjs
DELETED
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports, "__esModule", {value: true});var _chunkC6OYMNC3cjs = require('../chunk-C6OYMNC3.cjs');exports.executeSemanticQuery = _chunkC6OYMNC3cjs.b; exports.getSemanticModels = _chunkC6OYMNC3cjs.c; exports.getSemanticSchema = _chunkC6OYMNC3cjs.a; exports.semanticQueryDescription = _chunkC6OYMNC3cjs.d; exports.semanticQueryParams = _chunkC6OYMNC3cjs.e;
|
|
2
|
-
//# sourceMappingURL=index.cjs.map
|
package/dist/lens/index.cjs.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["/Users/varnitha/tmdc/solutions-core/model-context-protocol/dist/lens/index.cjs"],"names":[],"mappings":"AAAA,kIAAqE,gQAAuI","file":"/Users/varnitha/tmdc/solutions-core/model-context-protocol/dist/lens/index.cjs"}
|
package/dist/lens/index.d.cts
DELETED
|
@@ -1,92 +0,0 @@
|
|
|
1
|
-
import { z } from 'zod';
|
|
2
|
-
|
|
3
|
-
declare function lensList({ apiKey, fqdn, }: {
|
|
4
|
-
apiKey: string;
|
|
5
|
-
fqdn?: string;
|
|
6
|
-
}): Promise<any>;
|
|
7
|
-
|
|
8
|
-
type LensOptions = {
|
|
9
|
-
slug?: string;
|
|
10
|
-
payload: Record<string, any>;
|
|
11
|
-
apiKey?: string;
|
|
12
|
-
fqdn?: string;
|
|
13
|
-
};
|
|
14
|
-
|
|
15
|
-
declare function meta({ slug, apiKey, fqdn }: LensOptions): Promise<{
|
|
16
|
-
content: {
|
|
17
|
-
type: string;
|
|
18
|
-
text: string;
|
|
19
|
-
}[];
|
|
20
|
-
isError: boolean;
|
|
21
|
-
} | {
|
|
22
|
-
content: {
|
|
23
|
-
type: string;
|
|
24
|
-
text: string;
|
|
25
|
-
}[];
|
|
26
|
-
isError?: undefined;
|
|
27
|
-
}>;
|
|
28
|
-
|
|
29
|
-
declare function lensData({ slug, payload, apiKey, fqdn, }: LensOptions): Promise<{
|
|
30
|
-
content: {
|
|
31
|
-
type: "text";
|
|
32
|
-
text: string;
|
|
33
|
-
}[];
|
|
34
|
-
isError: boolean;
|
|
35
|
-
} | {
|
|
36
|
-
content: {
|
|
37
|
-
type: "text";
|
|
38
|
-
text: string;
|
|
39
|
-
}[];
|
|
40
|
-
isError?: undefined;
|
|
41
|
-
}>;
|
|
42
|
-
|
|
43
|
-
declare const description = "\nQuery data from a Lens by sending a \"query\" object.\n\nBuild the parameters as follows:\n1) Pick measures (numeric metrics) and/or dimensions (grouping fields). At least one of the two must be provided.\n2) Filters: While optional, they are strongly recommended for better relevance, performance, and correctness. Use them whenever the question implies a subset (time window, region, status, etc.). For numeric measures, use numeric values; for dates, use ISO strings (YYYY-MM-DD). If truly no filters are needed, omit the filters key entirely (do not send an empty array).\n3) Choose a sensible limit (default 100). Use small limits (5/10/20) for top/bottom style questions; larger (500/1000) for comprehensive lists. Offset supports pagination.\n\nFilter shape (very important):\n- filters is an array of groups. Each group is an object with a single key: \"and\" or \"or\". The value is an array of filter clauses.\n- Each clause is: { \"member\": string, \"operator\": one of the allowed operators, \"values\": array }\n- For numeric measures, values must be numbers. For date operators like inDateRange, pass [\"start\", \"end\"] as YYYY-MM-DD.\n\nExample query payload:\n{\n \"measures\": [\"sales.totalRevenue\"],\n \"dimensions\": [\"date.month\"],\n \"filters\": [\n { \"and\": [\n { \"member\": \"date.month\", \"operator\": \"inDateRange\", \"values\": [\"2024-01-01\", \"2024-03-31\"] },\n { \"member\": \"sales.totalRevenue\", \"operator\": \"gte\", \"values\": [1000] }\n ] }\n ],\n \"limit\": 10,\n \"offset\": 0\n}\n\nExample 2 (recommended use of filters): Top 10 customers by revenue in EMEA for 2024\n{\n \"measures\": [\"sales.totalRevenue\"],\n \"dimensions\": [\"customer.name\", \"customer.region\"],\n \"filters\": [\n { \"and\": [\n { \"member\": \"customer.region\", \"operator\": \"equals\", \"values\": [\"EMEA\"] },\n { \"member\": \"date.date\", \"operator\": \"inDateRange\", \"values\": [\"2024-01-01\", \"2024-12-31\"] }\n ] }\n ],\n \"limit\": 10\n}\n\nCommon analysis patterns\n- Trend analysis: time dimensions + performance measures\n- Comparative analysis: categorical dimensions + multiple measures\n- Drill down: hierarchical dimensions (year/quarter/month)\n- KPI: single measure with dimensional breakdowns\n\nStrict rules\n- Use only field names that exist in the schema\n- Do not fabricate results if the query returns empty or errors\n- Explore the schema before selecting fields (use the schema tool to copy exact field names)\n\nKeywords: query, analytics, business intelligence, metrics, KPIs, lens, data, insights\n";
|
|
44
|
-
declare const querySchema: z.ZodObject<{
|
|
45
|
-
measures: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
|
|
46
|
-
dimensions: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
|
|
47
|
-
filters: z.ZodOptional<z.ZodArray<z.ZodRecord<z.ZodEnum<["and", "or"]>, z.ZodArray<z.ZodObject<{
|
|
48
|
-
member: z.ZodString;
|
|
49
|
-
operator: z.ZodEnum<["equals", "notEquals", "contains", "notContains", "startsWith", "notStartsWith", "endsWith", "notEndsWith", "gt", "gte", "lt", "lte", "inDateRange", "notInDateRange", "beforeDate", "afterDate"]>;
|
|
50
|
-
values: z.ZodArray<z.ZodUnion<[z.ZodUnion<[z.ZodUnion<[z.ZodUnion<[z.ZodString, z.ZodNumber]>, z.ZodString]>, z.ZodBoolean]>, z.ZodNull]>, "many">;
|
|
51
|
-
}, "strip", z.ZodTypeAny, {
|
|
52
|
-
values?: (string | number | boolean)[];
|
|
53
|
-
operator?: "endsWith" | "startsWith" | "equals" | "notEquals" | "contains" | "notContains" | "notStartsWith" | "notEndsWith" | "gt" | "gte" | "lt" | "lte" | "inDateRange" | "notInDateRange" | "beforeDate" | "afterDate";
|
|
54
|
-
member?: string;
|
|
55
|
-
}, {
|
|
56
|
-
values?: (string | number | boolean)[];
|
|
57
|
-
operator?: "endsWith" | "startsWith" | "equals" | "notEquals" | "contains" | "notContains" | "notStartsWith" | "notEndsWith" | "gt" | "gte" | "lt" | "lte" | "inDateRange" | "notInDateRange" | "beforeDate" | "afterDate";
|
|
58
|
-
member?: string;
|
|
59
|
-
}>, "many">>, "atleastone">>;
|
|
60
|
-
limit: z.ZodDefault<z.ZodNumber>;
|
|
61
|
-
offset: z.ZodDefault<z.ZodNumber>;
|
|
62
|
-
}, "strip", z.ZodTypeAny, {
|
|
63
|
-
limit?: number;
|
|
64
|
-
dimensions?: string[];
|
|
65
|
-
measures?: string[];
|
|
66
|
-
filters?: [Partial<Record<"and" | "or", {
|
|
67
|
-
values?: (string | number | boolean)[];
|
|
68
|
-
operator?: "endsWith" | "startsWith" | "equals" | "notEquals" | "contains" | "notContains" | "notStartsWith" | "notEndsWith" | "gt" | "gte" | "lt" | "lte" | "inDateRange" | "notInDateRange" | "beforeDate" | "afterDate";
|
|
69
|
-
member?: string;
|
|
70
|
-
}[]>>, ...Partial<Record<"and" | "or", {
|
|
71
|
-
values?: (string | number | boolean)[];
|
|
72
|
-
operator?: "endsWith" | "startsWith" | "equals" | "notEquals" | "contains" | "notContains" | "notStartsWith" | "notEndsWith" | "gt" | "gte" | "lt" | "lte" | "inDateRange" | "notInDateRange" | "beforeDate" | "afterDate";
|
|
73
|
-
member?: string;
|
|
74
|
-
}[]>>[]];
|
|
75
|
-
offset?: number;
|
|
76
|
-
}, {
|
|
77
|
-
limit?: number;
|
|
78
|
-
dimensions?: string[];
|
|
79
|
-
measures?: string[];
|
|
80
|
-
filters?: [Partial<Record<"and" | "or", {
|
|
81
|
-
values?: (string | number | boolean)[];
|
|
82
|
-
operator?: "endsWith" | "startsWith" | "equals" | "notEquals" | "contains" | "notContains" | "notStartsWith" | "notEndsWith" | "gt" | "gte" | "lt" | "lte" | "inDateRange" | "notInDateRange" | "beforeDate" | "afterDate";
|
|
83
|
-
member?: string;
|
|
84
|
-
}[]>>, ...Partial<Record<"and" | "or", {
|
|
85
|
-
values?: (string | number | boolean)[];
|
|
86
|
-
operator?: "endsWith" | "startsWith" | "equals" | "notEquals" | "contains" | "notContains" | "notStartsWith" | "notEndsWith" | "gt" | "gte" | "lt" | "lte" | "inDateRange" | "notInDateRange" | "beforeDate" | "afterDate";
|
|
87
|
-
member?: string;
|
|
88
|
-
}[]>>[]];
|
|
89
|
-
offset?: number;
|
|
90
|
-
}>;
|
|
91
|
-
|
|
92
|
-
export { lensData as executeSemanticQuery, lensList as getSemanticModels, meta as getSemanticSchema, description as semanticQueryDescription, querySchema as semanticQueryParams };
|
package/dist/lens/index.d.ts
DELETED
|
@@ -1,92 +0,0 @@
|
|
|
1
|
-
import { z } from 'zod';
|
|
2
|
-
|
|
3
|
-
declare function lensList({ apiKey, fqdn, }: {
|
|
4
|
-
apiKey: string;
|
|
5
|
-
fqdn?: string;
|
|
6
|
-
}): Promise<any>;
|
|
7
|
-
|
|
8
|
-
type LensOptions = {
|
|
9
|
-
slug?: string;
|
|
10
|
-
payload: Record<string, any>;
|
|
11
|
-
apiKey?: string;
|
|
12
|
-
fqdn?: string;
|
|
13
|
-
};
|
|
14
|
-
|
|
15
|
-
declare function meta({ slug, apiKey, fqdn }: LensOptions): Promise<{
|
|
16
|
-
content: {
|
|
17
|
-
type: string;
|
|
18
|
-
text: string;
|
|
19
|
-
}[];
|
|
20
|
-
isError: boolean;
|
|
21
|
-
} | {
|
|
22
|
-
content: {
|
|
23
|
-
type: string;
|
|
24
|
-
text: string;
|
|
25
|
-
}[];
|
|
26
|
-
isError?: undefined;
|
|
27
|
-
}>;
|
|
28
|
-
|
|
29
|
-
declare function lensData({ slug, payload, apiKey, fqdn, }: LensOptions): Promise<{
|
|
30
|
-
content: {
|
|
31
|
-
type: "text";
|
|
32
|
-
text: string;
|
|
33
|
-
}[];
|
|
34
|
-
isError: boolean;
|
|
35
|
-
} | {
|
|
36
|
-
content: {
|
|
37
|
-
type: "text";
|
|
38
|
-
text: string;
|
|
39
|
-
}[];
|
|
40
|
-
isError?: undefined;
|
|
41
|
-
}>;
|
|
42
|
-
|
|
43
|
-
declare const description = "\nQuery data from a Lens by sending a \"query\" object.\n\nBuild the parameters as follows:\n1) Pick measures (numeric metrics) and/or dimensions (grouping fields). At least one of the two must be provided.\n2) Filters: While optional, they are strongly recommended for better relevance, performance, and correctness. Use them whenever the question implies a subset (time window, region, status, etc.). For numeric measures, use numeric values; for dates, use ISO strings (YYYY-MM-DD). If truly no filters are needed, omit the filters key entirely (do not send an empty array).\n3) Choose a sensible limit (default 100). Use small limits (5/10/20) for top/bottom style questions; larger (500/1000) for comprehensive lists. Offset supports pagination.\n\nFilter shape (very important):\n- filters is an array of groups. Each group is an object with a single key: \"and\" or \"or\". The value is an array of filter clauses.\n- Each clause is: { \"member\": string, \"operator\": one of the allowed operators, \"values\": array }\n- For numeric measures, values must be numbers. For date operators like inDateRange, pass [\"start\", \"end\"] as YYYY-MM-DD.\n\nExample query payload:\n{\n \"measures\": [\"sales.totalRevenue\"],\n \"dimensions\": [\"date.month\"],\n \"filters\": [\n { \"and\": [\n { \"member\": \"date.month\", \"operator\": \"inDateRange\", \"values\": [\"2024-01-01\", \"2024-03-31\"] },\n { \"member\": \"sales.totalRevenue\", \"operator\": \"gte\", \"values\": [1000] }\n ] }\n ],\n \"limit\": 10,\n \"offset\": 0\n}\n\nExample 2 (recommended use of filters): Top 10 customers by revenue in EMEA for 2024\n{\n \"measures\": [\"sales.totalRevenue\"],\n \"dimensions\": [\"customer.name\", \"customer.region\"],\n \"filters\": [\n { \"and\": [\n { \"member\": \"customer.region\", \"operator\": \"equals\", \"values\": [\"EMEA\"] },\n { \"member\": \"date.date\", \"operator\": \"inDateRange\", \"values\": [\"2024-01-01\", \"2024-12-31\"] }\n ] }\n ],\n \"limit\": 10\n}\n\nCommon analysis patterns\n- Trend analysis: time dimensions + performance measures\n- Comparative analysis: categorical dimensions + multiple measures\n- Drill down: hierarchical dimensions (year/quarter/month)\n- KPI: single measure with dimensional breakdowns\n\nStrict rules\n- Use only field names that exist in the schema\n- Do not fabricate results if the query returns empty or errors\n- Explore the schema before selecting fields (use the schema tool to copy exact field names)\n\nKeywords: query, analytics, business intelligence, metrics, KPIs, lens, data, insights\n";
|
|
44
|
-
declare const querySchema: z.ZodObject<{
|
|
45
|
-
measures: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
|
|
46
|
-
dimensions: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
|
|
47
|
-
filters: z.ZodOptional<z.ZodArray<z.ZodRecord<z.ZodEnum<["and", "or"]>, z.ZodArray<z.ZodObject<{
|
|
48
|
-
member: z.ZodString;
|
|
49
|
-
operator: z.ZodEnum<["equals", "notEquals", "contains", "notContains", "startsWith", "notStartsWith", "endsWith", "notEndsWith", "gt", "gte", "lt", "lte", "inDateRange", "notInDateRange", "beforeDate", "afterDate"]>;
|
|
50
|
-
values: z.ZodArray<z.ZodUnion<[z.ZodUnion<[z.ZodUnion<[z.ZodUnion<[z.ZodString, z.ZodNumber]>, z.ZodString]>, z.ZodBoolean]>, z.ZodNull]>, "many">;
|
|
51
|
-
}, "strip", z.ZodTypeAny, {
|
|
52
|
-
values?: (string | number | boolean)[];
|
|
53
|
-
operator?: "endsWith" | "startsWith" | "equals" | "notEquals" | "contains" | "notContains" | "notStartsWith" | "notEndsWith" | "gt" | "gte" | "lt" | "lte" | "inDateRange" | "notInDateRange" | "beforeDate" | "afterDate";
|
|
54
|
-
member?: string;
|
|
55
|
-
}, {
|
|
56
|
-
values?: (string | number | boolean)[];
|
|
57
|
-
operator?: "endsWith" | "startsWith" | "equals" | "notEquals" | "contains" | "notContains" | "notStartsWith" | "notEndsWith" | "gt" | "gte" | "lt" | "lte" | "inDateRange" | "notInDateRange" | "beforeDate" | "afterDate";
|
|
58
|
-
member?: string;
|
|
59
|
-
}>, "many">>, "atleastone">>;
|
|
60
|
-
limit: z.ZodDefault<z.ZodNumber>;
|
|
61
|
-
offset: z.ZodDefault<z.ZodNumber>;
|
|
62
|
-
}, "strip", z.ZodTypeAny, {
|
|
63
|
-
limit?: number;
|
|
64
|
-
dimensions?: string[];
|
|
65
|
-
measures?: string[];
|
|
66
|
-
filters?: [Partial<Record<"and" | "or", {
|
|
67
|
-
values?: (string | number | boolean)[];
|
|
68
|
-
operator?: "endsWith" | "startsWith" | "equals" | "notEquals" | "contains" | "notContains" | "notStartsWith" | "notEndsWith" | "gt" | "gte" | "lt" | "lte" | "inDateRange" | "notInDateRange" | "beforeDate" | "afterDate";
|
|
69
|
-
member?: string;
|
|
70
|
-
}[]>>, ...Partial<Record<"and" | "or", {
|
|
71
|
-
values?: (string | number | boolean)[];
|
|
72
|
-
operator?: "endsWith" | "startsWith" | "equals" | "notEquals" | "contains" | "notContains" | "notStartsWith" | "notEndsWith" | "gt" | "gte" | "lt" | "lte" | "inDateRange" | "notInDateRange" | "beforeDate" | "afterDate";
|
|
73
|
-
member?: string;
|
|
74
|
-
}[]>>[]];
|
|
75
|
-
offset?: number;
|
|
76
|
-
}, {
|
|
77
|
-
limit?: number;
|
|
78
|
-
dimensions?: string[];
|
|
79
|
-
measures?: string[];
|
|
80
|
-
filters?: [Partial<Record<"and" | "or", {
|
|
81
|
-
values?: (string | number | boolean)[];
|
|
82
|
-
operator?: "endsWith" | "startsWith" | "equals" | "notEquals" | "contains" | "notContains" | "notStartsWith" | "notEndsWith" | "gt" | "gte" | "lt" | "lte" | "inDateRange" | "notInDateRange" | "beforeDate" | "afterDate";
|
|
83
|
-
member?: string;
|
|
84
|
-
}[]>>, ...Partial<Record<"and" | "or", {
|
|
85
|
-
values?: (string | number | boolean)[];
|
|
86
|
-
operator?: "endsWith" | "startsWith" | "equals" | "notEquals" | "contains" | "notContains" | "notStartsWith" | "notEndsWith" | "gt" | "gte" | "lt" | "lte" | "inDateRange" | "notInDateRange" | "beforeDate" | "afterDate";
|
|
87
|
-
member?: string;
|
|
88
|
-
}[]>>[]];
|
|
89
|
-
offset?: number;
|
|
90
|
-
}>;
|
|
91
|
-
|
|
92
|
-
export { lensData as executeSemanticQuery, lensList as getSemanticModels, meta as getSemanticSchema, description as semanticQueryDescription, querySchema as semanticQueryParams };
|
package/dist/lens/index.js
DELETED
package/dist/lens/index.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":[],"sourcesContent":[],"mappings":"","names":[]}
|