@cognite/cli 1.4.0-alpha.sdk-gen → 1.4.1
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/_templates/app/new/root/AGENTS.md.ejs.t +12 -60
- package/_templates/app/new/root/SPEC.md.ejs.t +15 -17
- package/_templates/app/new/root/package.json.ejs.t +3 -6
- package/dist/chunk-MXGPBSSS.js +13 -0
- package/dist/cli/cli.js +89 -187
- package/dist/deploy/index.js +1 -1
- package/dist/index.d.ts +0 -2
- package/dist/index.js +1 -1
- package/package.json +2 -12
- package/dist/chunk-EI7MMDWY.js +0 -1
- package/dist/chunk-FEYVYSNN.js +0 -1
- package/dist/chunk-VTE66IK5.js +0 -8
- package/dist/chunk-Z24V7VPI.js +0 -13
- package/dist/sdk-runtime/index.d.ts +0 -209
- package/dist/sdk-runtime/index.js +0 -1
- package/dist/skills-SV7BPHAZ.js +0 -1
package/dist/deploy/index.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{a,b,c,d,e,f,g,h,i,j,k}from"../chunk-
|
|
1
|
+
import{a,b,c,d,e,f,g,h,i,j,k}from"../chunk-MXGPBSSS.js";export{a as AppHostingClient,b as ApplicationPackager,c as BUNDLE_DIR,j as SIGNATURE_SUFFIXES,d as bundleFileName,e as bundlePath,i as deploy,k as discoverSignatures,g as getSdk,f as getToken,h as packageAndUpload};
|
package/dist/index.d.ts
CHANGED
|
@@ -1,4 +1,2 @@
|
|
|
1
1
|
export { App, AppHostingClient, ApplicationPackager, BUNDLE_DIR, Deployment, SIGNATURE_SUFFIXES, bundleFileName, bundlePath, deploy, discoverSignatures, getSdk, getToken, packageAndUpload } from './deploy/index.js';
|
|
2
|
-
export { DuneRuntime, ViewDefinition, ViewDefinitionProperty, createDuneRuntime, createDuneRuntimeFromViews } from './sdk-runtime/index.js';
|
|
3
2
|
import '@cognite/sdk';
|
|
4
|
-
import 'graphql';
|
package/dist/index.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{a as o,b as r,c as e,d as f,e as m,f as p,g as t,h as x,i as a,j as b,k as c}from"./chunk-
|
|
1
|
+
import{a as o,b as r,c as e,d as f,e as m,f as p,g as t,h as x,i as a,j as b,k as c}from"./chunk-MXGPBSSS.js";export{o as AppHostingClient,r as ApplicationPackager,e as BUNDLE_DIR,b as SIGNATURE_SUFFIXES,f as bundleFileName,m as bundlePath,a as deploy,c as discoverSignatures,t as getSdk,p as getToken,x as packageAndUpload};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@cognite/cli",
|
|
3
|
-
"version": "1.4.
|
|
3
|
+
"version": "1.4.1",
|
|
4
4
|
"description": "CLI for Cognite Data Fusion",
|
|
5
5
|
"license": "SEE LICENSE IN LICENSE.md",
|
|
6
6
|
"author": "Cognite",
|
|
@@ -22,11 +22,6 @@
|
|
|
22
22
|
"types": "./dist/deploy/index.d.ts",
|
|
23
23
|
"import": "./dist/deploy/index.js",
|
|
24
24
|
"default": "./dist/deploy/index.js"
|
|
25
|
-
},
|
|
26
|
-
"./sdk-runtime": {
|
|
27
|
-
"types": "./dist/sdk-runtime/index.d.ts",
|
|
28
|
-
"import": "./dist/sdk-runtime/index.js",
|
|
29
|
-
"default": "./dist/sdk-runtime/index.js"
|
|
30
25
|
}
|
|
31
26
|
},
|
|
32
27
|
"bin": {
|
|
@@ -52,10 +47,6 @@
|
|
|
52
47
|
"dependencies": {
|
|
53
48
|
"@cognite/app-sdk": "^0.5.1",
|
|
54
49
|
"@cognite/sdk": "^10.10.0",
|
|
55
|
-
"@graphql-codegen/cli": "^7.0.0",
|
|
56
|
-
"@graphql-codegen/typescript": "^6.0.1",
|
|
57
|
-
"@graphql-codegen/typescript-generic-sdk": "^5.0.1",
|
|
58
|
-
"@graphql-codegen/typescript-operations": "^6.0.2",
|
|
59
50
|
"@sentry/node": "^10.51.0",
|
|
60
51
|
"@zip.js/zip.js": "^2.7.0",
|
|
61
52
|
"chalk": "^5.6.2",
|
|
@@ -64,7 +55,6 @@
|
|
|
64
55
|
"dotenv": "^17.4.2",
|
|
65
56
|
"enquirer": "^2.4.1",
|
|
66
57
|
"execa": "^5.1.1",
|
|
67
|
-
"graphql": "^16.13.2",
|
|
68
58
|
"hygen": "^6.2.11",
|
|
69
59
|
"jose": "^6.2.2",
|
|
70
60
|
"mixpanel": "^0.21.0",
|
|
@@ -101,7 +91,7 @@
|
|
|
101
91
|
"react-dom": "^19.2.6",
|
|
102
92
|
"tsup": "^8.4.0",
|
|
103
93
|
"typescript": "^5.0.0",
|
|
104
|
-
"vitest": "
|
|
94
|
+
"vitest": "4.1.7"
|
|
105
95
|
},
|
|
106
96
|
"engines": {
|
|
107
97
|
"node": ">=20"
|
package/dist/chunk-EI7MMDWY.js
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
var c=Object.defineProperty;var d=(a,b)=>c(a,"name",{value:b,configurable:!0});export{d as a};
|
package/dist/chunk-FEYVYSNN.js
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{a as o}from"./chunk-EI7MMDWY.js";import{GraphQLSchema as rr,GraphQLObjectType as nr,GraphQLNonNull as R,GraphQLList as Q,GraphQLString as C,GraphQLInt as ir,GraphQLInputObjectType as We,printSchema as or}from"graphql";function O(e){return{space:e.space,externalId:e.externalId,version:e.version}}o(O,"toSharedViewId");function Rt(e){switch(e){case"text":return"String";case"boolean":return"Boolean";case"int32":case"int64":return"Int";case"float32":case"float64":return"Float";case"timestamp":return"DateTime";case"date":return"Date";case"json":return"JSON";case"timeseries":return"CogniteTimeSeriesReference";case"file":return"CogniteFileReference";case"sequence":return"CogniteSequenceReference";case"enum":return"String";default:return"String"}}o(Rt,"dmsTypeToGraphQL");function Ne(e){if(!("source"in e)){if(e.type?.type==="direct")return e.type.list?e.type.source?{kind:"directRelationList",targetView:O(e.type.source)}:{kind:"scalar",isList:!1,graphqlType:"JSON"}:e.type.source?{kind:"directRelation",targetView:O(e.type.source)}:{kind:"scalar",isList:!1,graphqlType:"JSON"};if(e.type?.type==="enum"){let t=e.type,n={};if(typeof t=="object"&&t!==null&&"values"in t){let i=t.values;if(typeof i=="object"&&i!==null)for(let[r,a]of Object.entries(i))n[r]={name:typeof a=="object"&&a!==null&&"name"in a?String(a.name):void 0}}return{kind:"enum",values:Object.keys(n),valueNames:Object.fromEntries(Object.entries(n).map(([i,r])=>[i,r.name??i]))}}return{kind:"scalar",isList:e.type!==void 0&&"list"in e.type&&e.type.list===!0,graphqlType:e.type?.type?Rt(e.type.type):"String"}}if("through"in e)return{kind:e.connectionType==="single_reverse_direct_relation"?"reverseDirect":"reverseList",sourceView:O(e.source),throughProperty:e.through.identifier};if(e.connectionType==="single_edge_connection"||e.connectionType==="multi_edge_connection"){let t=e.direction==="inwards"?"inwards":"outwards";return{kind:"edge",targetView:O(e.source),direction:t}}return{kind:"scalar"}}o(Ne,"parsePropertyDescriptor");var Ve=new Set(["String","Boolean","Int","Float","DateTime","Date"]);var It=new Set(["String","Int","Float","DateTime","Date"]);function Qe(e){return e.kind==="directRelation"||e.kind==="enum"?!0:e.kind!=="scalar"||e.isList===!0?!1:Ve.has(e.graphqlType??"String")}o(Qe,"isFilterableDescriptor");function Ae(e){return e.kind==="enum"?!0:e.kind!=="scalar"||e.isList===!0?!1:Ve.has(e.graphqlType??"String")}o(Ae,"isSortableDescriptor");function Fe(e){return e.kind==="directRelation"||e.kind==="enum"?!0:e.kind==="scalar"&&e.isList!==!0&&It.has(e.graphqlType??"")}o(Fe,"hasInOpDescriptor");function Pe(e){return e.kind==="scalar"&&e.isList===!0}o(Pe,"hasListOpsDescriptor");function qe(e,t,n){let i=e.property(t,n);return i?i.kind==="directRelation"?!1:i.kind==="directRelationList"?!0:i.kind==="scalar"&&i.graphqlType==="JSON":!0}o(qe,"isListThroughProperty");function $(e){return e.usedFor!=="edge"}o($,"isNodeOrAll");function D(e){return Object.entries(e.properties).map(([t,n])=>[t,Ne(n),n.description])}o(D,"parsedProperties");import{GraphQLObjectType as _e,GraphQLNonNull as F,GraphQLString as ae,GraphQLFloat as K,GraphQLList as Ct,GraphQLEnumType as Et}from"graphql";import{GraphQLScalarType as L,Kind as h}from"graphql";function j(e){switch(e.kind){case h.STRING:case h.BOOLEAN:return e.value;case h.INT:return parseInt(e.value,10);case h.FLOAT:return parseFloat(e.value);case h.OBJECT:{let t={};for(let n of e.fields)t[n.name.value]=j(n.value);return t}case h.LIST:return e.values.map(j);case h.NULL:return null;default:return null}}o(j,"parseLiteralJSON");var Tt=new L({name:"DateTime",serialize:o(e=>e,"serialize"),parseValue:o(e=>e,"parseValue"),parseLiteral:o(e=>e.kind===h.STRING?e.value:null,"parseLiteral")}),Dt=new L({name:"Date",serialize:o(e=>e,"serialize"),parseValue:o(e=>e,"parseValue"),parseLiteral:o(e=>e.kind===h.STRING?e.value:null,"parseLiteral")}),se=new L({name:"JSON",serialize:o(e=>e,"serialize"),parseValue:o(e=>e,"parseValue"),parseLiteral:j}),Lt=new L({name:"CogniteTimeSeriesReference",serialize:o(e=>e,"serialize"),parseValue:o(e=>e,"parseValue"),parseLiteral:o(e=>e.kind===h.STRING?e.value:null,"parseLiteral")}),kt=new L({name:"CogniteFileReference",serialize:o(e=>e,"serialize"),parseValue:o(e=>e,"parseValue"),parseLiteral:o(e=>e.kind===h.STRING?e.value:null,"parseLiteral")}),vt=new L({name:"CogniteSequenceReference",serialize:o(e=>e,"serialize"),parseValue:o(e=>e,"parseValue"),parseLiteral:o(e=>e.kind===h.STRING?e.value:null,"parseLiteral")}),B=new L({name:"ListLimit",description:"Limit for list/search queries (1\u20131000).",serialize:o(e=>e,"serialize"),parseValue:o(e=>e,"parseValue"),parseLiteral:o(e=>e.kind===h.INT?parseInt(e.value,10):null,"parseLiteral")}),bt=new L({name:"DirectRelationList",description:"A list of direct-relation node references ({ space, externalId }).",serialize:o(e=>e,"serialize"),parseValue:o(e=>e,"parseValue"),parseLiteral:j}),k={DateTime:Tt,Date:Dt,JSON:se,CogniteTimeSeriesReference:Lt,CogniteFileReference:kt,CogniteSequenceReference:vt,ListLimit:B,DirectRelationList:bt};var Nt=new Et({name:"AggregateFunction",values:{count:{value:"count"},avg:{value:"avg"},sum:{value:"sum"},min:{value:"min"},max:{value:"max"},histogram:{value:"histogram"}}}),Ge={function:{type:new F(Nt)},property:{type:ae},interval:{type:K}},Vt=new _e({name:"HistogramBucket",fields:{start:{type:new F(K)},count:{type:new F(K)}}}),Me=new _e({name:"AggregateResult",fields:{aggregate:{type:new F(ae)},property:{type:ae},value:{type:K},buckets:{type:new Ct(new F(Vt))},group:{type:se}}});import{GraphQLObjectType as pe,GraphQLNonNull as E,GraphQLList as Qt,GraphQLString as ce,GraphQLBoolean as At}from"graphql";var Ft=new pe({name:"PageInfo",fields:{endCursor:{type:ce},hasNextPage:{type:new E(At)}}}),U=new pe({name:"NodeReference",fields:{space:{type:new E(ce)},externalId:{type:new E(ce)}}});function H(e,t){return new pe({name:`${e}Connection`,fields:{items:{type:new E(new Qt(new E(t)))},pageInfo:{type:new E(Ft)}}})}o(H,"makeConnectionType");import{GraphQLInputObjectType as N,GraphQLList as S,GraphQLNonNull as Ke,GraphQLString as b,GraphQLBoolean as w,GraphQLFloat as jt,GraphQLInt as Bt}from"graphql";import{GraphQLObjectType as Pt,GraphQLNonNull as Oe,GraphQLList as qt,GraphQLString as z,GraphQLBoolean as _t,GraphQLInt as Gt,GraphQLFloat as Mt,GraphQLEnumType as Ot}from"graphql";function $e(e){return e==="String"?z:e==="Boolean"?_t:e==="Int"?Gt:e==="Float"?Mt:k[e]??z}o($e,"scalarForName");function je(e){return{typeRegistry:new Map,connectionRegistry:new Map,viewsByExtId:new Map(e.map(t=>[t.externalId,t])),enumRegistry:new Map,enumFilterRegistry:new Map}}o(je,"createTypeContext");function $t(e){let t=e.replace(/[^_A-Za-z0-9]/g,"_");return/^[0-9]/.test(t)&&(t=`_${t}`),t||"_UNKNOWN"}o($t,"sanitizeEnumValue");function le(e,t,n,i){let r=n.enumRegistry.get(e);if(r)return r;let a=new Ot({name:e,values:Object.fromEntries(t.map(s=>[$t(s),{value:s,description:i?.[s]}]))});return n.enumRegistry.set(e,a),a}o(le,"getOrCreateEnumType");function Be(e,t){return new Pt({name:e.externalId,description:e.description??e.name,fields:o(()=>{let n={space:{type:new Oe(z)},externalId:{type:new Oe(z)}};for(let[i,r,a]of D(e))if(r.kind==="scalar")r.isList?n[i]={type:new qt($e(r.graphqlType??"String")),description:a}:n[i]={type:$e(r.graphqlType??"String"),description:a};else if(r.kind==="enum"){let s=`${e.externalId}${i.charAt(0).toUpperCase()}${i.slice(1)}`;n[i]={type:le(s,r.values,t,r.valueNames),description:a}}else if(r.kind==="directRelation"){let s=t.typeRegistry.get(r.targetView.externalId)??U;n[i]={type:s,description:a}}else if(r.kind==="directRelationList")n[i]={type:k.DirectRelationList,description:a};else if(r.kind==="reverseList"||r.kind==="edge"){let s=r.kind==="reverseList"?r.sourceView.externalId:r.targetView.externalId,u=t.typeRegistry.get(s)??U,d=t.connectionRegistry.get(s);d||(d=H(s,u),t.connectionRegistry.set(s,d)),n[i]={type:d,description:a}}else if(r.kind==="reverseDirect"){let s=t.typeRegistry.get(r.sourceView.externalId)??U;n[i]={type:s,description:a}}return n},"fields")})}o(Be,"generateViewObjectType");function V(e,t,n){let i={isNull:{type:w},exists:{type:w},eq:{type:t}};return n.hasIn&&(i.in={type:new S(t)}),n.hasPrefix&&(i.prefix={type:b}),n.hasRange&&(i.gte={type:t},i.gt={type:t},i.lte={type:t},i.lt={type:t}),n.hasListOps&&(i.containsAny={type:new S(t)},i.containsAll={type:new S(t)},i.overlaps={type:new S(t)}),new N({name:e,fields:i})}o(V,"makeScalarFilter");var X=V("StringFilter",b,{hasIn:!0,hasPrefix:!0}),Kt=V("BooleanFilter",w,{}),Ut=V("IntFilter",Bt,{hasIn:!0,hasRange:!0}),Ht=V("FloatFilter",jt,{hasIn:!0,hasRange:!0}),zt=V("DateTimeFilter",k.DateTime,{hasIn:!0,hasRange:!0}),Xt=V("DateFilter",k.Date,{hasIn:!0,hasRange:!0}),Yt=new N({name:"StringListFilter",fields:{isNull:{type:w},exists:{type:w},containsAny:{type:new S(b)},containsAll:{type:new S(b)},overlaps:{type:new S(b)}}}),P=new N({name:"DirectRelationRef",fields:{space:{type:new Ke(b)},externalId:{type:new Ke(b)}}}),Jt=new N({name:"DirectRelationFilter",fields:{isNull:{type:w},exists:{type:w},eq:{type:P},in:{type:new S(P)}}});function Wt(e){switch(e){case"String":return X;case"Boolean":return Kt;case"Int":return Ut;case"Float":return Ht;case"DateTime":return zt;case"Date":return Xt;default:return X}}o(Wt,"scalarFilterForName");var Ue=["space","externalId"];function He(e,t,n){let i=t.get(e.externalId),r={};for(let s of Ue)r[s]={type:X};let a=new Set(Ue);for(let[s,u]of D(e)){if(a.has(s))continue;let d=Qe(u),c=Pe(u);if(!(!d&&!c))if(u.kind==="directRelation"){let p={isNull:{type:w},exists:{type:w},eq:{type:P},in:{type:new S(P)}};Fe(u)&&(p.in={type:new S(P)});let l=t.get(u.targetView.externalId);l&&(p.nested={type:l}),r[s]=l?{type:new N({name:`_${e.externalId}_${s}_Filter`,fields:p})}:{type:Jt}}else if(u.kind==="enum"){let p=`${e.externalId}${s.charAt(0).toUpperCase()}${s.slice(1)}`,l=le(p,u.values,n),f=n.enumFilterRegistry.get(p);f||(f=new N({name:`${p}Filter`,fields:{isNull:{type:w},exists:{type:w},eq:{type:l},in:{type:new S(l)}}}),n.enumFilterRegistry.set(p,f)),r[s]={type:f}}else if(c)r[s]={type:Yt};else{let p=u.kind==="scalar"?u.graphqlType??"String":"String",l=Wt(p);l&&(r[s]={type:l})}}return{...r,hasData:{type:w},matchAll:{type:w},_and:{type:new S(i)},_or:{type:new S(i)},_not:{type:i}}}o(He,"generateFilterFields");import{GraphQLEnumType as ze,GraphQLInputObjectType as Xe,GraphQLList as Zt,GraphQLNonNull as Y,GraphQLString as er,GraphQLBoolean as tr}from"graphql";var J=new ze({name:"SortDirection",values:{ASC:{value:"ascending"},DESC:{value:"descending"}}});function Ye(e){let t=[];for(let[i,r]of D(e))Ae(r)&&t.push(i);if(t.length===0)return null;let n=new ze({name:`${e.externalId}SortField`,values:Object.fromEntries(t.map(i=>[i,{value:i}]))});return new Xe({name:`${e.externalId}Sort`,fields:{field:{type:new Y(n)},direction:{type:new Y(J)},nullsFirst:{type:tr}}})}o(Ye,"generateSortInput");var Je=new Xe({name:"SearchSort",fields:{property:{type:new Y(new Zt(new Y(er)))},direction:{type:J}}});function Ze(e){let t=e.filter($),n=je(t);for(let p of t){let l=Be(p,n);n.typeRegistry.set(p.externalId,l)}let i=new Map;for(let p of t){let l=new We({name:`${p.externalId}Filter`,fields:o(()=>He(p,i,n),"fields")});i.set(p.externalId,l)}let r={};for(let p of t){let l=p.externalId,f=n.typeRegistry.get(l),m=n.connectionRegistry.get(l);m||(m=H(l,f),n.connectionRegistry.set(l,m));let g=i.get(l),y=Ye(p),x={limit:{type:B},cursor:{type:C},filter:{type:g}};y&&(x.sort={type:new Q(y)}),r[`query${l}`]={type:new R(m),args:x},r[`get${l}ById`]={type:f,args:{space:{type:new R(C)},externalId:{type:new R(C)}}},r[`count${l}`]={type:new R(ir),args:{filter:{type:g}}},r[`search${l}`]={type:new R(m),args:{query:{type:C},limit:{type:B},filter:{type:g},sort:{type:new Q(new R(Je))},properties:{type:new Q(new R(C))}}},r[`aggregate${l}`]={type:new R(new Q(new R(Me))),args:{filter:{type:g},aggregates:{type:new Q(new R(new We({name:`${l}AggregateRequest`,fields:Ge})))},groupBy:{type:new Q(new R(C))},query:{type:C}}}}let a=[];for(let[p,l]of n.typeRegistry)a.push({name:l.name,source:`typeRegistry[${p}]`});for(let[p,l]of n.connectionRegistry)a.push({name:l.name,source:`connectionRegistry[${p}]`});let s=new Map;for(let{name:p,source:l}of a)s.has(p)||s.set(p,[]),s.get(p).push(l);for(let[p,l]of s)l.length>1&&console.error(`[dune] duplicate type "${p}" from: ${l.join(", ")}`);let u=new rr({query:new nr({name:"Query",fields:r}),types:[J,...Object.values(k),...n.enumRegistry.values()]}),d=new Map;for(let p of t){let l=new Map;for(let[f,m]of D(p))l.set(f,m);d.set(p.externalId,{view:{space:p.space,externalId:p.externalId,version:p.version},properties:l})}let c={view(p){let l=d.get(p.externalId);if(!l)throw new Error(`SchemaKnowledge: no view for externalId "${p.externalId}"`);return l},property(p,l){return d.get(p.externalId)?.properties.get(l)}};return{schema:u,sdl:or(u),schemaKnowledge:c}}o(Ze,"buildSchema");async function et(e,t){let i=(await t.dataModels.retrieve([{space:e.space,externalId:e.dataModelExternalId,version:e.dataModelVersion}],{inlineViews:!1})).items[0];if(!i)throw new Error(`Data model ${e.space}/${e.dataModelExternalId}/${e.dataModelVersion} not found`);if(!i.views?.length)throw new Error(`Data model ${e.space}/${e.dataModelExternalId}/${e.dataModelVersion} has no views`);let r=i.views.map(s=>({space:s.space,externalId:s.externalId,version:s.version}));return(await t.views.retrieve(r,{includeInheritedProperties:!0})).items}o(et,"fetchViews");import{execute as sr,parse as Vn}from"graphql";function tt(e,t){return async(n,i)=>{let r=await sr({schema:e,document:n,variableValues:i,rootValue:t,fieldResolver:o((a,s,u,d)=>{let c=a[d.fieldName];return typeof c=="function"?c(a,s,u,d):c},"fieldResolver")});if(r.errors?.length)throw r.errors[0];return r.data}}o(tt,"createDuneRequester");import{CogniteError as Sr}from"@cognite/sdk";function rt(){return{initialBatchLimit:1e3,maxBatchLimit:5e3,searchLimit:1e3,inFilterChunkSize:100,previewLimit:3,nestedDetailLimit:5,enableRemoveNotConnected:!1,max408Retries:3,max429Retries:5,retryBaseDelayMs:500,maxConcurrentRequests:4,maxNestingDepth:2,maxTotalItems:1e4}}o(rt,"defaultPlannerConfig");var me=class me extends Error{constructor(t){super(t),this.name="PlannerValidationError"}};o(me,"PlannerValidationError");var T=me;function Z(e){return e.connections.size===0?0:1+Math.max(...[...e.connections.values()].map(t=>Z(t.select)))}o(Z,"selectionDepth");function yr(e,t,n){for(let i of t.scalars)if(i!=="*"&&!n.property(e,i))throw new T(`Property "${i}" does not exist on view ${e.externalId}/${e.version}`);for(let[i]of t.connections)if(!n.property(e,i))throw new T(`Connection "${i}" does not exist on view ${e.externalId}/${e.version}`)}o(yr,"validateSelection");function A(e){return{hasData:[e]}}o(A,"hasDataFilter");function ot(e,t){let n=A(t);return e?{and:[e,n]}:n}o(ot,"scopedFilter");function st(e,t,n,i,r){return{name:"0",kind:"root",view:e,filter:ot(t,e),sort:n&&n.length>0?n:void 0,select:i.length>0?i:["*"],limit:r,queryable:!0}}o(st,"makeRootStep");function at(e,t,n,i,r,a){return{name:e,from:t.name,kind:"directRelation",view:i,through:{view:t.view,property:n},direction:"outwards",filter:A(i),select:r.length>0?r:["*"],limit:a,queryable:!0,fieldName:n}}o(at,"makeDirectRelationStep");function ct(e,t,n,i,r,a,s){return{name:e,from:t.name,kind:"reverseDirect",view:i,through:{view:i,property:r},direction:"inwards",filter:A(i),select:a.length>0?a:["*"],limit:s,queryable:!0,fieldName:n}}o(ct,"makeReverseDirectStep");function pt(e,t,n,i,r,a,s,u){return{name:e,from:t.name,kind:"reverseList",view:i,through:{view:i,property:r},direction:"inwards",filter:A(i),select:a.length>0?a:["*"],limit:s,queryable:!u,fieldName:n}}o(pt,"makeReverseListStep");function lt(e,t,n,i,r,a,s,u){let d={name:e,from:n.name,kind:"edgeIntermediate",view:r,direction:a,filter:void 0,select:[],limit:u,limitEach:u,queryable:!0},c={name:t,from:e,kind:"edge",view:r,filter:A(r),select:s.length>0?s:["*"],limit:u,queryable:!0,fieldName:i,chainTo:a==="outwards"?"destination":"source"};return[d,c]}o(lt,"makeEdgeSteps");function W(e){return{type:"view",space:e.space,externalId:e.externalId,version:e.version}}o(W,"toRef");function nt(e,t){return e.length===0||e.includes("*")||e.includes(t)?e:[...e,t]}o(nt,"withThroughProperty");function hr(e,t){e.select.includes("*")||e.select.includes(t)||(e.select=[...e.select,t])}o(hr,"injectDirectRelationRef");function q(e,t,n,i,r,a){let s=0;for(let[u,d]of n.connections){let c=r.property(t,u);if(!c)continue;s++;let p=d.limit??i,l=d.select.scalars,f=d.select,m=`${e.name}_${s}`;if(c.kind==="directRelation"){hr(e,u);let g=W(c.targetView),y=at(m,e,u,g,l,p);a.push(y),q(y,g,f,i,r,a)}else if(c.kind==="reverseDirect"){let g=W(c.sourceView),y=nt(l,c.throughProperty),x=ct(m,e,u,g,c.throughProperty,y,p);a.push(x),q(x,g,f,i,r,a)}else if(c.kind==="reverseList"){let g=W(c.sourceView),y=nt(l,c.throughProperty),x=qe(r,c.sourceView,c.throughProperty),v=pt(m,e,u,g,c.throughProperty,y,p,x);a.push(v),q(v,g,f,i,r,a)}else if(c.kind==="edge"){let g=W(c.targetView),y=`${e.name}_${s}_e`,[x,v]=lt(y,m,e,u,g,c.direction,l,p);a.push(x,v),q(v,g,f,i,r,a)}}}o(q,"addConnectionSteps");function ee(e,t,n,i,r,a,s){a&&yr(e,t,a);let u=st(e,n,i,t.scalars,r),d=[u];return a&&q(u,e,t,s??r,a,d),d}o(ee,"buildSteps");function ge(e,t){let n=new Set,i=new Map(e.map(r=>[r.name,r]));for(let r of e){if(r.queryable)continue;let a=r.from;if(!a||a in t)continue;let s=i.get(a);s?.view&&(t[a]={sources:[{source:s.view,properties:["*"]}]},n.add(a))}return n}o(ge,"injectPhantomSelects");function wr(e){let t=e.property.view;return{property:[t.space,`${t.externalId}/${t.version}`,e.property.property],direction:e.direction,nullsFirst:e.nullsFirst??!1}}o(wr,"compileSortClause");function ye(e,t,n){let i={},r={};for(let c of e){if(!c.queryable)continue;if(c.kind==="edgeIntermediate"){let f={edges:{from:c.from,direction:c.direction,maxDistance:1},limit:Math.min(c.limit,n)};c.filter&&(f.edges.filter=c.filter),c.limitEach!=null&&(f.edges.limitEach=c.limitEach),i[c.name]=f,r[c.name]={sources:[]};continue}let p={filter:c.filter};c.from&&(p.from=c.from),c.chainTo?p.chainTo=c.chainTo:c.through?(p.through={view:c.through.view,identifier:c.through.property},p.direction=c.direction):c.direction&&(p.direction=c.direction);let l={limit:Math.min(c.limit,n),nodes:p};c.sort&&c.sort.length>0&&(l.sort=c.sort.map(wr)),i[c.name]=l,r[c.name]={sources:[{source:c.view,properties:c.select}]}}let a=ge(e,r),s={with:i,select:r},u={},d=!1;for(let c of e){if(!c.queryable||c.kind==="edgeIntermediate")continue;let p=t.get(c.name);p!=null&&(u[c.name]=p,d=!0)}return d&&(s.cursors=u),{query:s,tempSelectSteps:a}}o(ye,"compileQuery");function he(e,t){let n=[];for(let i=0;i<e.length;i+=t)n.push(e.slice(i,i+t));return n}o(he,"chunkArray");function xr(e){let t=e.through;return[t.view.space,`${t.view.externalId}/${t.view.version}`,t.property]}o(xr,"throughPropertyPath");function Rr(e,t){let n=e.filter,i={containsAny:{property:xr(e),values:t}};return n?{and:[n,i]}:i}o(Rr,"containsAnyParentFilter");var we=class we{constructor(t,n){this.dms=t;this.config=n}async run(t,n,i){let{response:r,tempSelectSteps:a,batchLimit:s}=await this.queryWithRetry(t,n,i),u={},d=new Map;for(let[c,p]of Object.entries(r.items))u[c]=p,d.set(c,r.nextCursor[c]??null);return await this.fetchReverseLists(t,u),{batch:u,nextCursors:d,tempSelectSteps:a,batchLimit:s}}async queryWithRetry(t,n,i){let r=i,a=0;for(;;){let{query:s,tempSelectSteps:u}=ye(t,n,r);try{return{response:await this.dms.query({with:s.with,select:s.select,cursors:s.cursors}),tempSelectSteps:u,batchLimit:r}}catch(d){if(d instanceof Sr&&d.status===408){if(a>=this.config.max408Retries)throw d;a++,r=Math.max(1,Math.floor(r/2))}else throw d}}}async fetchReverseLists(t,n){let i=t.filter(r=>!r.queryable&&r.from&&r.kind==="reverseList");for(let r of i){let a=n[r.from]??[];if(a.length===0){n[r.name]=[];continue}let s=a.map(c=>({space:c.space,externalId:c.externalId})),u=he(s,this.config.inFilterChunkSize),d=await Promise.all(u.map(async c=>{let p=[],l;do{let f={limit:r.limit,nodes:{filter:Rr(r,c)}},m=await this.dms.query({with:{[r.name]:f},select:{[r.name]:{sources:[{source:r.view,properties:r.select}]}},...l?{cursors:{[r.name]:l}}:{}});p.push(...m.items[r.name]??[]),l=m.nextCursor?.[r.name]??void 0}while(l);return p}));n[r.name]=d.flat()}}async fetchQueryableConnections(t,n){let i=t.filter(r=>r.queryable&&r.from&&(r.kind==="directRelation"||r.kind==="reverseDirect"));for(let r of i){let a=n[r.from]??[];if(a.length===0){n[r.name]=[];continue}if(r.kind==="directRelation"){let s=r.through,u=`${s.view.externalId}/${s.view.version}`,d=[],c=new Set;for(let f of a){let m=f.properties?.[s.view.space]?.[u]?.[s.property];if(m&&typeof m=="object"&&"space"in m&&"externalId"in m&&typeof m.space=="string"&&typeof m.externalId=="string"){let g=`${m.space}:${m.externalId}`;c.has(g)||(c.add(g),d.push({space:m.space,externalId:m.externalId}))}}if(d.length===0){n[r.name]=[];continue}let p=he(d,this.config.inFilterChunkSize),l=[];for(let f of p){let m=await this.dms.retrieve({items:f.map(g=>({instanceType:"node",...g})),sources:[{source:r.view}]});l.push(...m.items)}n[r.name]=l}else{let s=a.map(l=>({space:l.space,externalId:l.externalId})),u=r.through,d=[u.view.space,`${u.view.externalId}/${u.view.version}`,u.property],c=he(s,this.config.inFilterChunkSize),p=[];for(let l of c){let f=r.limit-p.length;if(f<=0)break;let m=await this.dms.search({view:r.view,filter:{in:{property:d,values:l}},limit:f});p.push(...m.items)}n[r.name]=p}}}async fetchEdgeConnections(t,n){let i=t.filter(r=>r.kind==="edgeIntermediate"&&r.from);for(let r of i){let a=n[r.from]??[],s=t.find(m=>m.kind==="edge"&&m.from===r.name);if(!s)continue;if(a.length===0){n[r.name]=[],n[s.name]=[];continue}let u=`${r.from}__edge_root`,d=a.map(m=>m.externalId),c={nodes:{filter:{in:{property:["node","externalId"],values:d}}},limit:a.length},p={edges:{from:u,direction:r.direction,maxDistance:1},limit:r.limit};r.filter&&(p.edges.filter=r.filter),r.limitEach!=null&&(p.edges.limitEach=r.limitEach);let l={nodes:{from:r.name,chainTo:s.chainTo},limit:s.limit};s.filter&&(l.nodes.filter=s.filter);let f=await this.dms.query({with:{[u]:c,[r.name]:p,[s.name]:l},select:{[u]:{sources:[]},[r.name]:{sources:[]},[s.name]:{sources:[{source:s.view,properties:s.select}]}}});n[r.name]=f.items[r.name]??[],n[s.name]=f.items[s.name]??[]}}};o(we,"QueryExecutor");var _=we;var Ir={endCursor:null,hasNextPage:!1};function ut(e){return{items:e,pageInfo:Ir}}o(ut,"wrapConnection");function Se(e){if(!e||typeof e!="object"||!("space"in e)||!("externalId"in e))return!1;let{space:t,externalId:n}=e;return typeof t=="string"&&typeof n=="string"}o(Se,"isDmsRef");function Tr(e,t){if(Se(e))return e;if(typeof e!="object"||e===null||!("externalId"in e))return;let{externalId:n}=e;if(typeof n!="string")return;let i="space"in e&&typeof e.space=="string"?e.space:t;return i?{space:i,externalId:n}:void 0}o(Tr,"resolveParentRef");function Dr(e,t,n){if(Se(e)){t(e);return}if(Array.isArray(e))for(let i of e){let r=Tr(i,n);r&&t(r)}}o(Dr,"forEachParentRef");function dt(e,t){let n=`${t.externalId}/${t.version}`;return{...e.properties?.[t.space]?.[n]??{},space:e.space,externalId:e.externalId}}o(dt,"extractViewProperties");function te(e,t,n,i){if(t.length===0)return;let r=[...n.values()].filter(s=>s.from===e.name&&s.fieldName),a=[...n.values()].filter(s=>s.kind==="edge"&&s.fieldName&&s.from!=null&&n.get(s.from)?.from===e.name);for(let s of[...r,...a]){let u=(i[s.name]??[]).map(d=>dt(d,s.view));if(s.kind==="directRelation"){let d=new Map;for(let c of u)d.set(`${c.space}:${c.externalId}`,c);for(let c of t){let p=c[s.fieldName];c[s.fieldName]=Se(p)?d.get(`${p.space}:${p.externalId}`)??null:null}te(s,u,n,i)}else if(s.kind==="reverseDirect"||s.kind==="reverseList"){let d=s.through.property,c=new Map;for(let p of t)c.set(`${p.space}:${p.externalId}`,[]);for(let p of u){let l=p[d];l!=null?Dr(l,f=>{c.get(`${f.space}:${f.externalId}`)?.push(p)},p.space):t.length===1&&c.get(`${t[0].space}:${t[0].externalId}`)?.push(p)}for(let p of t){let l=c.get(`${p.space}:${p.externalId}`)??[];p[s.fieldName]=s.kind==="reverseList"?ut(l):l}te(s,u,n,i)}else if(s.kind==="edge"){let d=i[s.from]??[],c=new Map;for(let l of d){if(l.instanceType!=="edge")continue;let{startNode:f,endNode:m}=l;if(!f||!m)continue;let g=s.chainTo==="destination"?f:m,y=s.chainTo==="destination"?m:f,x=`${g.space}:${g.externalId}`,v=`${y.space}:${y.externalId}`,Ee=c.get(x)??[];Ee.push(v),c.set(x,Ee)}let p=new Map;for(let l of u)p.set(`${l.space}:${l.externalId}`,l);for(let l of t){let f=`${l.space}:${l.externalId}`,g=(c.get(f)??[]).map(y=>p.get(y)).filter(y=>y!==void 0);l[s.fieldName]=ut(g)}te(s,u,n,i)}}}o(te,"nestChildrenForStep");function Lr(e,t,n){let i=e.find(a=>!a.from);if(!i)return n;let r=new Map(e.map(a=>[a.name,a]));return te(i,n,r,t),n}o(Lr,"nestChildren");function re(e,t){let n=e.find(r=>!r.from);if(!n)return[];let i=(t[n.name]??[]).map(r=>dt(r,n.view));return Lr(e,t,i)}o(re,"unpack");function xe(e,t){for(let n of e)delete t[n]}o(xe,"stripTempSelects");function Re(e){let t={};for(let[n,i]of e)i!=null&&(t[n]=i);return Object.keys(t).length===0?null:btoa(JSON.stringify(t))}o(Re,"encodeCursors");function Ie(e){if(!e)return new Map;try{let t=JSON.parse(atob(e));return new Map(Object.entries(t))}catch{throw new T("Invalid pagination cursor \u2014 the value is malformed or has been modified by the client.")}}o(Ie,"decodeCursors");import{CogniteError as kr}from"@cognite/sdk";function ft(){return{max429Retries:5,retryBaseDelayMs:500,maxConcurrentRequests:4}}o(ft,"defaultRetryConfig");function vr(e){return new Promise(t=>setTimeout(t,e))}o(vr,"sleep");var De=class De{constructor(t){this.queue=[];this.count=t}acquire(){return this.count>0?(this.count--,Promise.resolve()):new Promise(t=>this.queue.push(t))}release(){let t=this.queue.shift();t?t():this.count++}};o(De,"Semaphore");var Te=De,Le=class Le{constructor(t,n=ft()){this.inner=t;this.config=n;this.semaphore=new Te(n.maxConcurrentRequests)}query(t){return this.withRetry(()=>this.inner.query(t))}search(t){return this.withRetry(()=>this.inner.search(t))}aggregate(t){return this.withRetry(()=>this.inner.aggregate(t))}retrieve(t){return this.withRetry(()=>this.inner.retrieve(t))}sync(t){return this.withRetry(()=>this.inner.sync(t))}upsert(t){return this.inner.upsert(t)}delete(t){return this.inner.delete(t)}inspect(t){return this.inner.inspect(t)}async withRetry(t){let n=0;for(;;){await this.semaphore.acquire();let i=!1;try{return await t()}catch(r){if(r instanceof kr&&r.status===429){if(n>=this.config.max429Retries)throw r;n++,this.semaphore.release(),i=!0,await vr(this.config.retryBaseDelayMs*2**(n-1))}else throw r}finally{i||this.semaphore.release()}}}};o(Le,"RetryingDmsClient");var G=Le;var ke=class ke{get schemaKnowledge(){return this.schema}constructor(t,n,i){this.schema=n,this.config={...rt(),...i},this.dms=new G(t,{max429Retries:this.config.max429Retries,retryBaseDelayMs:this.config.retryBaseDelayMs,maxConcurrentRequests:this.config.maxConcurrentRequests}),this.executor=new _(this.dms,{max408Retries:this.config.max408Retries,inFilterChunkSize:this.config.inFilterChunkSize})}async query(t){let n=Z(t.select);if(n>this.config.maxNestingDepth)throw new T(`Query nesting depth ${n} exceeds maximum ${this.config.maxNestingDepth}. Reduce connection depth or raise maxNestingDepth in config.`);let i=t.limit??this.config.initialBatchLimit,r=ee(t.view,t.select,t.filter,t.sort,i,this.schema,this.config.previewLimit),a=Ie(t.cursor),s={steps:r,tempSelectSteps:new Set,cursors:new Map(a),batchLimit:Math.min(this.config.initialBatchLimit,this.config.maxBatchLimit)},{batch:u,nextCursors:d,tempSelectSteps:c}=await this.executor.run(r,s.cursors,s.batchLimit);xe(c,u);let p=re(r,u),l=r[0],f=d.get(l.name)??null,m=Re(d),g=f!=null;return{items:p,pageInfo:{endCursor:m,hasNextPage:g}}}async queryAll(t,n){let i=n??this.config.maxTotalItems,r=[],a,s=!0;for(;s;){let u=await this.query({...t,cursor:a});if(r.push(...u.items),s=u.pageInfo.hasNextPage,a=u.pageInfo.endCursor??void 0,r.length>=i){if(n===void 0&&s)throw new T(`listAll reached the hard ceiling of ${i} items. Pass an explicit maxTotal to acknowledge this or raise maxTotalItems in config.`);break}}return r}async search(t){let n=t.limit??this.config.searchLimit,i=await this.dms.search({view:t.view,query:t.query,filter:t.filter,sort:t.sort,limit:n,properties:t.properties}),r=ee(t.view,t.select,void 0,void 0,n,this.schema,this.config.previewLimit),a={0:i.items};return await this.executor.fetchReverseLists(r,a),await this.executor.fetchQueryableConnections(r,a),await this.executor.fetchEdgeConnections(r,a),{items:re(r,a),pageInfo:{endCursor:null,hasNextPage:!1}}}async getByIds(t,n){if(t.length===0)return[];let i=await this.dms.retrieve({items:t.map(a=>({instanceType:"node",space:a.space,externalId:a.externalId})),sources:[{source:n}]}),r=`${n.externalId}/${n.version}`;return i.items.map(a=>({...a.properties?.[n.space]?.[r]??{},space:a.space,externalId:a.externalId}))}async count(t){let i=(await this.dms.aggregate({view:t.view,filter:t.filter,aggregates:[{count:{property:"externalId"}}]})).items[0]?.aggregates[0];return(i?.aggregate!=="histogram"?i?.value:void 0)??0}async aggregate(t){return{items:(await this.dms.aggregate({view:t.view,filter:t.filter,aggregates:t.aggregates,groupBy:t.groupBy,query:t.query})).items}}async*queryPages(t){let n,i=!0;for(;i;){let r=await this.query({...t,cursor:n});yield r,i=r.pageInfo.hasNextPage,n=r.pageInfo.endCursor??void 0}}};o(ke,"QueryRunner");var M=ke;function ve(e){return e!==null&&typeof e=="object"&&!Array.isArray(e)}o(ve,"isRecord");function ne(e){return typeof e=="string"||typeof e=="number"}o(ne,"isScalar");var br={space:["node","space"],externalId:["node","externalId"]};function Cr(e,t){return br[t]??[e.space,`${e.externalId}/${e.version}`,t]}o(Cr,"propRef");var Er={exists:o((e,t)=>typeof t!="boolean"?void 0:t?{exists:{property:e}}:{not:{exists:{property:e}}},"exists"),eq:o((e,t)=>({equals:{property:e,value:t}}),"eq"),in:o((e,t)=>Array.isArray(t)?{in:{property:e,values:t}}:void 0,"in"),isNull:o((e,t)=>typeof t!="boolean"?void 0:t?{not:{exists:{property:e}}}:{exists:{property:e}},"isNull"),prefix:o((e,t)=>typeof t=="string"?{prefix:{property:e,value:t}}:void 0,"prefix"),gte:o((e,t)=>ne(t)?{range:{property:e,gte:t}}:void 0,"gte"),gt:o((e,t)=>ne(t)?{range:{property:e,gt:t}}:void 0,"gt"),lte:o((e,t)=>ne(t)?{range:{property:e,lte:t}}:void 0,"lte"),lt:o((e,t)=>ne(t)?{range:{property:e,lt:t}}:void 0,"lt"),containsAny:o((e,t)=>Array.isArray(t)?{containsAny:{property:e,values:t}}:void 0,"containsAny"),containsAll:o((e,t)=>Array.isArray(t)?{containsAll:{property:e,values:t}}:void 0,"containsAll"),overlaps:o((e,t)=>Array.isArray(t)?{containsAny:{property:e,values:t}}:void 0,"overlaps")};function Nr(e,t,n,i){let r=Cr(n,e),a=Object.entries(t).flatMap(([s,u])=>{if(u==null)return[];if(s==="nested"&&i&&ve(u)){let c=i.property(n,e);if(c?.kind==="directRelation"){let p={type:"view",...c.targetView},l=I(u,p,i);if(l)return[{nested:{scope:[n.space,`${n.externalId}/${n.version}`,e],filter:l}}]}return[]}let d=Er[s]?.(r,u);return d?[d]:[]});if(a.length!==0)return a.length===1?a[0]:{and:a}}o(Nr,"translatePropertyFilter");function Vr(e){if(e.length!==0)return e.length===1?e[0]:{and:e}}o(Vr,"collapse");function I(e,t,n){if(!ve(e))return;let i=Object.entries(e).flatMap(([r,a])=>{if(a==null)return[];if(r==="_not"){let s=I(a,t,n);return s?[{not:s}]:[]}if(r==="hasData"&&typeof a=="boolean"&&a)return[{hasData:[{type:"view",space:t.space,externalId:t.externalId,version:t.version}]}];if(r==="matchAll"&&typeof a=="boolean"&&a)return[{matchAll:{}}];if((r==="_and"||r==="_or")&&Array.isArray(a)){let s=a.flatMap(u=>{let d=I(u,t,n);return d?[d]:[]});return s.length>0?[r==="_and"?{and:s}:{or:s}]:[]}if(ve(a)){let s=Nr(r,a,t,n);return s?[s]:[]}return[]});return Vr(i)}o(I,"buildFilter");function Qr(e){switch(e.function){case"avg":return{avg:{property:e.property}};case"sum":return{sum:{property:e.property}};case"min":return{min:{property:e.property}};case"max":return{max:{property:e.property}};case"histogram":return{histogram:{property:e.property,interval:e.interval}};default:return{count:{property:e.property??"externalId"}}}}o(Qr,"toAggregationDefinition");function mt(e,t){return o(async function(i,r){let{items:a}=await t.aggregate({view:e,filter:I(r.filter,e,t.schemaKnowledge),aggregates:(r.aggregates??[{function:"count"}]).map(Qr),groupBy:r.groupBy,query:r.query});return a.flatMap(s=>s.aggregates.map(u=>{if(u.aggregate==="histogram"){let{aggregate:l,property:f,buckets:m}=u;return{aggregate:l,property:f,value:null,buckets:m,group:s.group??null}}let{aggregate:d,property:c,value:p}=u;return{aggregate:d,property:c,value:p,buckets:null,group:s.group??null}}))},"aggregateResolver")}o(mt,"makeAggregateResolver");function gt(e,t){return o(async function(i,r){let a=I(r.filter,e,t.schemaKnowledge);return t.count({view:e,filter:a})},"countResolver")}o(gt,"makeCountResolver");import{Kind as be,isObjectType as Ar,getNamedType as Fr}from"graphql";function ie(e,t){let n=[];for(let i of e.selections)if(i.kind===be.FIELD)n.push(i);else if(i.kind===be.INLINE_FRAGMENT&&i.selectionSet)n.push(...ie(i.selectionSet,t));else if(i.kind===be.FRAGMENT_SPREAD){let r=t[i.name.value];r&&n.push(...ie(r.selectionSet,t))}return n}o(ie,"collectFields");var Pr=new Set(["space","externalId"]);function yt(e,t,n){let i=[],r=new Map;for(let a of ie(e,n.fragments)){let s=a.name.value;if(s==="__typename"||Pr.has(s))continue;if(!a.selectionSet){i.push(s);continue}let u=n.schema.getType(t);if(Ar(u)){let d=u.getFields()[s];if(d){let c=Fr(d.type).name,p=yt(a.selectionSet,c,n);r.set(s,{select:p});continue}}i.push(s)}return{scalars:i,connections:r}}o(yt,"buildTree");function Ce(e,t,n){return e?yt(e,t,n):{scalars:[],connections:new Map}}o(Ce,"buildSelectionTree");function oe(e,t){let n=e.fieldNodes[0]?.selectionSet;if(!n)return{scalars:[],connections:new Map};let i=ie(n,e.fragments).find(r=>r.name.value==="items");return Ce(i?.selectionSet,t,e)}o(oe,"buildSelectionTreeFromListInfo");function ht(e,t,n){return o(async function(r,a,s,u){let{space:d,externalId:c}=a,p=Ce(u.fieldNodes[0]?.selectionSet,t,u),l={and:[{equals:{property:["node","space"],value:d}},{equals:{property:["node","externalId"],value:c}}]},{items:f}=await n.query({view:e,select:p,filter:l,limit:1});return f[0]??null},"getByIdResolver")}o(ht,"makeGetByIdResolver");function wt(e,t,n){return o(async function(r,a,s,u){let d=oe(u,t),c=I(a.filter,e,n.schemaKnowledge),p=qr(a.sort,e);return n.query({view:e,select:d,filter:c,sort:p,cursor:a.cursor,limit:a.limit})},"queryResolver")}o(wt,"makeQueryResolver");function qr(e,t){if(!(!e||e.length===0))return e.map(n=>({property:{view:t,property:n.field},direction:n.direction??"ascending",nullsFirst:n.nullsFirst}))}o(qr,"parseSortArg");function St(e,t,n){return o(async function(r,a,s,u){let d=oe(u,t),c={view:e,query:a.query,limit:a.limit,filter:I(a.filter,e,n.schemaKnowledge),sort:a.sort,select:d,properties:a.properties},{items:p,pageInfo:l}=await n.search(c);return{items:p,pageInfo:l}},"searchResolver")}o(St,"makeSearchResolver");function _r(e,t){let n={};for(let i of e.filter($)){let r={type:"view",space:i.space,externalId:i.externalId,version:i.version},a=i.externalId;n[`query${a}`]=wt(r,a,t),n[`get${a}ById`]=ht(r,a,t),n[`count${a}`]=gt(r,t),n[`search${a}`]=St(r,a,t),n[`aggregate${a}`]=mt(r,t)}return n}o(_r,"buildRootValue");async function Gr(e,t){let n=await et(e,t);return xt(n,t)}o(Gr,"createDuneRuntime");function xt(e,t){let{schema:n,schemaKnowledge:i}=Ze(e),r=new M(t.instances,i),a=_r(e,r),s=tt(n,a);return{schema:n,rootValue:a,runner:r,requester:s}}o(xt,"createDuneRuntimeFromViews");export{Gr as a,xt as b};
|
package/dist/chunk-VTE66IK5.js
DELETED
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
var c=Object.defineProperty;var s=(l,i)=>c(l,"name",{value:i,configurable:!0});import{execFileSync as a}from"child_process";import{createRequire as p}from"module";import{InvalidArgumentError as u}from"commander";var t="https://github.com/cognitedata/builder-skills/tree/data-modeling-runtime-sdk-alpha",e=["claude-code","cursor"],o=e.flatMap(l=>["-a",l]),d=p(import.meta.url).resolve("skills/bin/cli.mjs");function n(l,i={}){a(process.execPath,[d,...l],{stdio:"inherit",cwd:process.cwd(),...i})}s(n,"execSkillsCli");function y(){return["add",t,...o,"--skill","*","-y"]}s(y,"pullAllArgs");function m(l){let i=/^[\w.-]+\/[\w.-]+$/.test(l),r=/^https:\/\/github\.com\/[\w.-]+\/[\w.-]+(\/tree\/[^\s]+)?$/.test(l);if(!i&&!r)throw new u("Expected owner/repo or GitHub URL with optional branch (e.g., cognitedata/builder-skills or https://github.com/cognitedata/builder-skills/tree/alpha)");return l}s(m,"validateSource");function g(l){let i=["add",l.source,...o];return l.skill?i.push("--skill",l.skill):l.interactive||i.push("--skill","*","-y"),l.global&&i.push("--global"),i}s(g,"buildPullArgs");function k(l){console.log(`\u{1F504} Pulling skills from ${l.source}...`),n(g(l)),console.log(`
|
|
2
|
-
\u2705 Skills pulled successfully`)}s(k,"handlePull");function S(l){let i=l.command("skills").summary("Manage AI agent skills for your app").description(`Manage AI agent skills for your app.
|
|
3
|
-
Supports: ${e.join(", ")}`).addHelpText("after",`
|
|
4
|
-
Examples:
|
|
5
|
-
npx @cognite/cli apps skills pull Pull all skills
|
|
6
|
-
npx @cognite/cli apps skills pull --skill create-client-tool Pull a specific skill
|
|
7
|
-
npx @cognite/cli apps skills pull --source https://github.com/cognitedata/builder-skills/tree/alpha Pull from a specific branch
|
|
8
|
-
npx @cognite/cli apps skills list List installed skills`);return i.command("pull").description("Pull all skills into your project").option("--source <owner/repo|url>","Skills repository \u2014 owner/repo shorthand or full GitHub URL (supports /tree/<branch>)",m,t).option("--skill <name>","Pull a specific skill by name").option("-i, --interactive","Interactively select which skills to install",!1).option("--global","Install skills globally",!1).action(k),i.command("list").description("List installed skills").action(()=>{n(["list"])}),i}s(S,"registerSkillsCommand");export{s as a,n as b,y as c,g as d,S as e};
|
package/dist/chunk-Z24V7VPI.js
DELETED
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
import{a}from"./chunk-EI7MMDWY.js";import{mkdir as Pt,readFile as xt}from"fs/promises";import{basename as It,dirname as kt}from"path";var z="https://docs.cognite.com/cdf/access/";function d(n){return n!==null&&typeof n=="object"}a(d,"isRecord");function w(n){return n instanceof Error&&"status"in n&&typeof n.status=="number"}a(w,"isHttpError");function et(n){switch(n){case 401:return`Your credentials are invalid or expired. Check your client ID and secret.
|
|
2
|
-
See: ${z}`;case 403:return`You don't have the required CDF capabilities. Please contact your CDF admin.
|
|
3
|
-
See: ${z}`;default:return}}a(et,"httpStatusHint");function h(n){let t=n instanceof Error?n:new Error(String(n));if(!w(t))return null;let e=et(t.status);return e?Object.assign(new Error(`${t.message}
|
|
4
|
-
${e}`),{cause:t}):null}a(h,"enrichedHttpError");function nt(n){if(!d(n))return null;let t=n.missing;if(Array.isArray(t))return t;let e=n.data;if(d(e)){let r=e.error;if(d(r)&&Array.isArray(r.missing))return r.missing;if(Array.isArray(e.missing))return e.missing}return null}a(nt,"findMissingArray");function rt(n,t){if(!w(n)||n.status!==400)return!1;let e=nt(n);return e?e.some(r=>d(r)&&typeof r.externalId=="string"&&t.includes(r.externalId)):!1}a(rt,"isMissingExternalIdError");function b(n,t){return w(n)&&n.status===404||rt(n,t)}a(b,"isNotFoundError");var J=["DRAFT","PUBLISHED","DEPRECATED","ARCHIVED"],Y=["ACTIVE","PREVIEW"],T=class T extends Error{constructor(t,e){super(`Version ${e} of app ${t} not found`),this.name="AppVersionNotFoundError",this.appExternalId=t,this.version=e}};a(T,"AppVersionNotFoundError");var I=T;function k(n,t){return n.includes(t)}a(k,"includesValue");function it(n){return k(J,n)}a(it,"isAppVersionLifecycleState");function ot(n){return k(Y,n)}a(ot,"isAppVersionAlias");function st(n){return typeof n.version=="string"&&it(n.lifecycleState)&&typeof n.entrypoint=="string"&&typeof n.createdTime=="number"&&typeof n.createdBy=="string"&&typeof n.appExternalId=="string"&&(n.alias===void 0||ot(n.alias))&&(n.comment===void 0||typeof n.comment=="string")}a(st,"isAppVersion");function G(n){if(!d(n))throw new Error("Invalid version response: not an object");if(!st(n))throw new Error("Invalid version response: missing or malformed fields");return n}a(G,"parseAppVersion");var V=class V{constructor(t){this.client=t}get appsBasePath(){return`/api/v1/projects/${encodeURIComponent(this.client.project)}/apphosting/apps`}async createApp(t,e,r){try{await this.client.post(this.appsBasePath,{data:{items:[{externalId:t,name:e,description:r}]}})}catch(i){throw h(i)??i}}async uploadVersion(t,e,r,i,s="index.html"){console.log(`\u{1F4E4} Uploading version ${e}...`);let o=new FormData;o.append("file",new Blob([new Uint8Array(r)]),i),o.append("version",e),o.append("entryPath",s);let p=encodeURIComponent(t),c=`${this.appsBasePath}/${p}/versions`,l=await this.client.authenticate(),y=`${this.client.getBaseUrl()}${c}`,f=new AbortController,Q=setTimeout(()=>f.abort(),300*1e3),S;try{S=await fetch(y,{method:"POST",headers:{Authorization:`Bearer ${l}`},body:o,signal:f.signal})}catch(m){throw m instanceof Error&&m.name==="AbortError"?new Error("Upload timed out after 5 minutes"):m}finally{clearTimeout(Q)}if(!S.ok){let m=await S.text(),x=m;try{let R=JSON.parse(m);if(d(R)){let E=R.error;if(typeof E=="string")x=E;else if(d(E)){let A=E.message,M=E.code;x=typeof A=="string"?A:M!=null?`Unknown error (code: ${M})`:m}else{let A=R.message;x=typeof A=="string"?A:m}}}catch{}let j=S.headers.get("x-request-id"),tt=j?` | X-Request-ID: ${j}`:"",H=Object.assign(new Error(`Upload failed: ${S.status} \u2014 ${x}${tt}`),{status:S.status});throw h(H)??H}console.log(`\u2705 Version ${e} uploaded`)}async getVersion(t,e){let r=encodeURIComponent(t),i=encodeURIComponent(e),s=`${this.appsBasePath}/${r}/versions/${i}`;try{let o=await this.client.get(s);return G(o.data)}catch(o){throw b(o,[t,e])?new I(t,e):h(o)??o}}async getActiveVersion(t){let e=encodeURIComponent(t),r=`${this.appsBasePath}/${e}/active`;try{let i=await this.client.get(r);return G(i.data)}catch(i){if(b(i,[t]))return null;throw h(i)??i}}async updateVersions(t,e){let r=encodeURIComponent(t),i=`${this.appsBasePath}/${r}/versions/update`;try{await this.client.post(i,{data:{items:e}})}catch(s){throw h(s)??s}}async submitSignatures(t,e,r){let i=encodeURIComponent(t),s=encodeURIComponent(e),o=`${this.appsBasePath}/${i}/versions/${s}/signatures`;try{await this.client.post(o,{data:{items:r}})}catch(p){throw h(p)??p}}async listSignatures(t,e){let r=encodeURIComponent(t),i=encodeURIComponent(e),s=`${this.appsBasePath}/${r}/versions/${i}/signatures/list`;try{let o=await this.client.post(s,{data:{}});return pt(o.data)}catch(o){throw h(o)??o}}};a(V,"AppHostingApi");var C=V,at=["VALID","REVOKED","EXPIRED","SIGNED_BEFORE_KEY_ISSUED","IAT_IN_FUTURE","BUNDLE_TOO_OLD","KEY_NOT_IN_REGISTRY"],ct=["developer","certifier"];function pt(n){if(!d(n))throw new Error("Invalid signatures response: expected an object with an items array");let{items:t}=n;if(!Array.isArray(t))throw new Error("Invalid signatures response: items property is missing or not an array");return t.flatMap(e=>{let r=lt(e);return r?[r]:[]})}a(pt,"parseStoredSignatures");function lt(n){if(!d(n))return null;let{signerKid:t,signerRole:e,signatureIat:r,receivedAt:i,createdTime:s,status:o}=n;return typeof t!="string"||t===""||!k(ct,e)||typeof r!="number"||typeof i!="number"||typeof s!="number"||!k(at,o)?null:{signerKid:t,signerRole:e,signatureIat:r,receivedAt:i,createdTime:s,status:o}}a(lt,"parseStoredSignature");var D=class D{constructor(t){this.api=new C(t)}getVersion(t,e){return this.api.getVersion(t,e)}uploadVersion(t,e,r,i,s){return this.api.uploadVersion(t,e,r,i,s)}async ensureApp(t,e,r){console.log("\u{1F50D} Ensuring app exists...");try{await this.api.createApp(t,e,r),console.log(`\u2705 App '${t}' created`)}catch(i){if(w(i)&&i.status===409){console.log(`\u2705 App '${t}' already exists`);return}throw i}}async submitSignatures(t,e,r){r.length!==0&&(console.log(`\u{1F50F} Submitting ${r.length} signature${r.length===1?"":"s"} for version ${e}...`),await this.api.submitSignatures(t,e,r),console.log("\u2705 Signatures stored"))}listSignatures(t,e){return this.api.listSignatures(t,e)}async publishVersion(t,e){await this.api.updateVersions(t,[{version:e,update:{lifecycleState:{set:"PUBLISHED"}}}])}async publishAndActivate(t,e){console.log(`\u{1F680} Publishing and activating version ${e}...`),await this.api.updateVersions(t,[{version:e,update:{lifecycleState:{set:"PUBLISHED"},alias:{set:"ACTIVE"}}}]),console.log(`\u2705 Version ${e} is now PUBLISHED and ACTIVE`)}getActiveVersion(t){return this.api.getActiveVersion(t)}async deactivateVersion(t,e){await this.api.updateVersions(t,[{version:e,update:{alias:{setNull:!0}}}])}async activateVersion(t,e){let r=null;try{r=await this.api.getActiveVersion(t)}catch{r=null}let i=r&&r.version!==e?r.version:void 0;return await this.api.updateVersions(t,[{version:e,update:{alias:{set:"ACTIVE"}}}]),{supersededVersion:i}}async deploy(t,e,r,i,s,o,p=!1){console.log(`
|
|
5
|
-
\u{1F680} Deploying application via App Hosting API...
|
|
6
|
-
`);try{await this.ensureApp(t,e,r),await this.uploadVersion(t,i,s,o),p&&await this.publishAndActivate(t,i),console.log(`
|
|
7
|
-
\u2705 Deployment successful!`)}catch(c){let l=c instanceof Error?c.message:String(c);throw Object.assign(new Error(`Deployment failed: ${l}`),{cause:c})}}};a(D,"AppHostingClient");var v=D;import{execFileSync as $}from"child_process";import g from"fs";import u from"path";import{parseAndValidateManifestConfig as ut}from"@cognite/app-sdk/vite";import{BlobReader as dt,Uint8ArrayWriter as gt,ZipWriter as ft}from"@zip.js/zip.js";var _="package.json",U="package-lock.json",q="manifest.json",N=".cognite",mt=[/^\.env(\..+)?$/i,/^\.secrets?$/i,/^\.token/i,/^\.cognite/i,/\.(key|pem|p12|pfx|jks|crt)$/i],F=class F{constructor(t="dist"){this.distPath=u.isAbsolute(t)?t:u.join(process.cwd(),t),this.appRoot=u.dirname(this.distPath)}validateBuildDirectory(){if(!g.existsSync(this.distPath))throw new Error(`Build directory "${this.distPath}" not found. Run build first.`);let t=u.join(this.appRoot,_);if(!g.existsSync(t))throw new Error(`"${t}" not found. It is required for deployment.`);let e=u.join(this.appRoot,U);if(!g.existsSync(e))throw new Error(`"${e}" not found. It is required for deployment.`)}async createZip(t="app.zip",e=!1){this.validateBuildDirectory(),console.log("\u{1F4E6} Packaging application...");let r=new ft(new gt,{level:9}),i=a(async(c,l)=>{await r.add(l,new dt(await g.openAsBlob(c))),e&&console.log(` \u{1F4C4} ${l}`)},"addFile"),s=a(async c=>{let l=await g.promises.readdir(c,{withFileTypes:!0});for(let y of l){let f=u.join(c,y.name);y.isDirectory()?await s(f):await i(f,u.relative(this.distPath,f).replace(/\\/g,"/"))}},"addDir"),o;try{await s(this.distPath);let c=u.join(this.appRoot,_);await i(c,u.posix.join(N,_));let l=u.join(this.appRoot,q);if(g.existsSync(l)){let f=g.readFileSync(l,"utf-8");ut(f,l),await i(l,u.posix.join(N,q))}let y=u.join(this.appRoot,U);await i(y,u.posix.join(N,U)),o=await r.close()}catch(c){let l=c instanceof Error?c.message:String(c);throw new Error(`Failed to create zip: ${l}`)}await g.promises.writeFile(t,o);let p=(o.byteLength/1024/1024).toFixed(2);return console.log(`\u2705 App packaged: ${t} (${p} MB)`),t}async createSourceArchive(t){console.log("\u{1F4E6} Packaging source for review...");let e;try{e=$("git",["-C",this.appRoot,"rev-parse","--show-toplevel"],{encoding:"utf-8",stdio:["pipe","pipe","pipe"]}).trim()}catch(c){throw c instanceof Error&&"code"in c&&c.code==="ENOENT"?new Error("git not found. Install git and ensure it is in your PATH."):new Error("Source packaging requires a git repository. Run `git init` first.")}let r=$("git",["-C",this.appRoot,"rev-parse","--show-prefix"],{encoding:"utf-8",stdio:["pipe","pipe","pipe"]}).trim(),i=r?r.replace(/\/$/,""):".",s=i==="."?"HEAD":`HEAD:${i}`;this.validateNoSensitiveFiles(e,s);try{$("git",["-C",e,"archive","--format=zip",`--output=${t}`,s])}catch(c){let l=c instanceof Error?c.message:String(c);throw new Error(`Failed to create source archive: ${l}`)}let p=(g.statSync(t).size/1024/1024).toFixed(2);return console.log(`\u2705 Source packaged: ${u.basename(t)} (${p} MB)`),t}validateNoSensitiveFiles(t,e){let r=$("git",["-C",t,"ls-tree","-r","--name-only",e],{encoding:"utf-8",stdio:["pipe","pipe","pipe"]}).trim().split(`
|
|
8
|
-
`).filter(Boolean),i=a(o=>o.split("/").some(p=>mt.some(c=>c.test(p))),"isSensitive"),s=r.filter(i);if(s.length>0)throw new Error(`Source archive would include sensitive files \u2014 remove them from git tracking first:
|
|
9
|
-
`+s.map(o=>` ${o}`).join(`
|
|
10
|
-
`)+`
|
|
11
|
-
Hint: git rm --cached <file>`)}};a(F,"ApplicationPackager");var P=F;import ht from"path";var K=".cognite-bundles";function W(n,t){return`${n}-${t}.zip`}a(W,"bundleFileName");function O(n,t,e){return ht.join(n,K,W(t,e))}a(O,"bundlePath");import{CogniteClient as vt}from"@cognite/sdk";var yt=a(()=>{let n=process.env.DEPLOYMENT_SECRETS;if(!n)return{};try{let t=JSON.parse(n),e={};for(let[r,i]of Object.entries(t))if(typeof i=="string"){let s=r.toLowerCase().replace(/_/g,"-");e[s]=i}return e}catch(t){return console.error("Error parsing DEPLOYMENT_SECRETS:",t),{}}},"loadSecretsFromEnv"),St=a(n=>{let t;if(process.env.DEPLOYMENT_SECRET&&(t=process.env.DEPLOYMENT_SECRET),t||(t=yt()[n]),t||(t=process.env[n]),!t)throw new Error(`Secret not found in environment: ${n}`);return t},"getSecretFromEnv"),Et=a(n=>{if(!n)return"";try{return new URL(n).hostname.replace(/\.cognitedata\.com$/,"")}catch{let t=n.replace(/^https?:\/\//,"");return t=t.split("/")[0],t=t.split(":")[0],t=t.replace(/\.cognitedata\.com$/,""),t}},"extractClusterFromUrl"),At=a(async(n,t)=>{let e=`Basic ${btoa(`${n}:${t}`)}`,r=await fetch("https://auth.cognite.com/oauth2/token",{method:"POST",headers:{Authorization:e,"Content-Type":"application/x-www-form-urlencoded"},body:new URLSearchParams({grant_type:"client_credentials"})});if(!r.ok){let s=await r.text();throw new Error(`Failed to get token from CDF: ${r.status} ${r.statusText}
|
|
12
|
-
${s}`)}let i=await r.json();if(!i.access_token)throw new Error("No access token returned from CDF authentication");return i.access_token},"getTokenCdf"),wt=a(async(n,t,e,r)=>{if(!r)throw new Error("Entra ID authentication requires 'baseUrl' to be set in deployment configuration");let i=Et(r);if(!i)throw new Error(`Entra ID authentication requires 'baseUrl' to be a valid CDF URL (e.g., https://cluster.cognitedata.com), got: ${r}`);let s=`https://login.microsoftonline.com/${e}/oauth2/v2.0/token`,o=`https://${i}.cognitedata.com/.default`,p=await fetch(s,{method:"POST",headers:{"Content-Type":"application/x-www-form-urlencoded"},body:new URLSearchParams({client_id:n,client_secret:t,scope:o,grant_type:"client_credentials"})});if(!p.ok){let l=await p.text();throw new Error(`Failed to get token from Entra ID: ${p.status} ${p.statusText}
|
|
13
|
-
${l}`)}let c=await p.json();if(!c.access_token)throw new Error("No access token returned from Entra ID authentication");return c.access_token},"getTokenEntra"),L=a(async(n,t=process.env)=>{if(t.COGNITE_TOKEN)return t.COGNITE_TOKEN;let{deployClientId:e,deploySecretName:r,idpType:i="cdf",tenantId:s,baseUrl:o}=n,p=St(r);if(i==="entra_id"){if(!s)throw new Error("Entra ID authentication requires 'tenantId' in deployment configuration");return wt(e,p,s,o)}return At(e,p)},"getToken");async function B(n,t,e=process.env,r){let i=await L(n,e),s=e.COGNITE_BASE_URL??n.baseUrl,o=(r??(p=>new vt(p)))({appId:t,project:n.project,baseUrl:s,oidcTokenProvider:a(async()=>i,"oidcTokenProvider")});return await o.authenticate(),o}a(B,"getSdk");async function X(n,t,e,r){let{externalId:i,name:s,description:o,versionTag:p}=t,c=O(e,i,p);await Pt(kt(c),{recursive:!0}),await new P(`${e}/dist`).createZip(c,!0);let l=await xt(c);await new v(n).deploy(i,s,o,p,l,It(c),r)}a(X,"packageAndUpload");var Ct=a(async(n,t,e)=>{let r=await B(n,e);await X(r,t,e,n.published)},"deploy");import{existsSync as $t,readFileSync as Rt}from"fs";var Z=[".dev.sig",".cert.sig"];function bt(n,t={}){let e=t.existsSync??$t,r=t.readFileSync??((s,o)=>Rt(s,o)),i=[];for(let s of Z){let o=`${n}${s}`;if(!e(o))continue;let p=r(o,"utf8").trim();p.length>0&&i.push(p)}return i}a(bt,"discoverSignatures");export{v as a,P as b,K as c,W as d,O as e,L as f,B as g,X as h,Ct as i,Z as j,bt as k};
|
|
@@ -1,209 +0,0 @@
|
|
|
1
|
-
import { ViewDefinition as ViewDefinition$1, ViewDefinitionProperty as ViewDefinitionProperty$1, ViewReference, FilterDefinition, SearchSort, AggregationDefinition, AggregatedResultItem, InstancesAPI, CogniteClient } from '@cognite/sdk';
|
|
2
|
-
import { DocumentNode, GraphQLSchema } from 'graphql';
|
|
3
|
-
|
|
4
|
-
interface GenerateSdkConfig {
|
|
5
|
-
name: string;
|
|
6
|
-
space: string;
|
|
7
|
-
dataModelExternalId: string;
|
|
8
|
-
dataModelVersion: string;
|
|
9
|
-
}
|
|
10
|
-
|
|
11
|
-
interface SharedViewId {
|
|
12
|
-
space: string;
|
|
13
|
-
externalId: string;
|
|
14
|
-
version: string;
|
|
15
|
-
}
|
|
16
|
-
type PropertyDescriptor = {
|
|
17
|
-
kind: 'scalar';
|
|
18
|
-
isList?: boolean;
|
|
19
|
-
graphqlType?: string;
|
|
20
|
-
} | {
|
|
21
|
-
kind: 'enum';
|
|
22
|
-
values: string[];
|
|
23
|
-
valueNames: Record<string, string>;
|
|
24
|
-
} | {
|
|
25
|
-
kind: 'directRelation';
|
|
26
|
-
targetView: SharedViewId;
|
|
27
|
-
} | {
|
|
28
|
-
kind: 'directRelationList';
|
|
29
|
-
targetView: SharedViewId;
|
|
30
|
-
} | {
|
|
31
|
-
kind: 'reverseDirect';
|
|
32
|
-
sourceView: SharedViewId;
|
|
33
|
-
throughProperty: string;
|
|
34
|
-
} | {
|
|
35
|
-
kind: 'reverseList';
|
|
36
|
-
sourceView: SharedViewId;
|
|
37
|
-
throughProperty: string;
|
|
38
|
-
} | {
|
|
39
|
-
kind: 'edge';
|
|
40
|
-
targetView: SharedViewId;
|
|
41
|
-
direction: 'outwards' | 'inwards';
|
|
42
|
-
};
|
|
43
|
-
interface SchemaView {
|
|
44
|
-
view: SharedViewId;
|
|
45
|
-
properties: Map<string, PropertyDescriptor>;
|
|
46
|
-
}
|
|
47
|
-
interface SchemaKnowledge {
|
|
48
|
-
view(ref: SharedViewId): SchemaView;
|
|
49
|
-
property(ref: SharedViewId, prop: string): PropertyDescriptor | undefined;
|
|
50
|
-
}
|
|
51
|
-
|
|
52
|
-
type ViewDefinitionProperty = ViewDefinitionProperty$1 & {
|
|
53
|
-
constraintState?: Record<string, unknown>;
|
|
54
|
-
};
|
|
55
|
-
type ViewDefinition = Omit<ViewDefinition$1, 'properties'> & {
|
|
56
|
-
properties: Record<string, ViewDefinitionProperty>;
|
|
57
|
-
};
|
|
58
|
-
|
|
59
|
-
/**
|
|
60
|
-
* Matches the Requester type emitted by @graphql-codegen/typescript-generic-sdk,
|
|
61
|
-
* so the return of createDuneRequester can be passed directly to getSdk().
|
|
62
|
-
*/
|
|
63
|
-
type DuneRequester = <TData, TVariables>(doc: DocumentNode, variables?: TVariables) => Promise<TData>;
|
|
64
|
-
|
|
65
|
-
interface PropertyRef {
|
|
66
|
-
view: ViewReference;
|
|
67
|
-
property: string;
|
|
68
|
-
}
|
|
69
|
-
interface ConnectionSelection {
|
|
70
|
-
limit?: number;
|
|
71
|
-
select: SelectionTree;
|
|
72
|
-
}
|
|
73
|
-
interface SelectionTree {
|
|
74
|
-
scalars: string[];
|
|
75
|
-
connections: Map<string, ConnectionSelection>;
|
|
76
|
-
}
|
|
77
|
-
interface SortClause {
|
|
78
|
-
property: PropertyRef;
|
|
79
|
-
direction: 'ascending' | 'descending';
|
|
80
|
-
/** When true, nulls sort before non-nulls. Defaults to false. */
|
|
81
|
-
nullsFirst?: boolean;
|
|
82
|
-
}
|
|
83
|
-
/** Pre-translated DMS logical filter (output of translateFilter in resolver layer). */
|
|
84
|
-
type LogicalFilter = FilterDefinition;
|
|
85
|
-
interface QueryInput {
|
|
86
|
-
view: ViewReference;
|
|
87
|
-
filter?: LogicalFilter;
|
|
88
|
-
sort?: SortClause[];
|
|
89
|
-
select: SelectionTree;
|
|
90
|
-
/** Page size. Defaults to INITIAL_BATCH_LIMIT if omitted. */
|
|
91
|
-
limit?: number;
|
|
92
|
-
/** Opaque cursor from a previous ListResult.pageInfo.endCursor. */
|
|
93
|
-
cursor?: string;
|
|
94
|
-
}
|
|
95
|
-
interface ListResult<T = Record<string, unknown>> {
|
|
96
|
-
items: T[];
|
|
97
|
-
pageInfo: {
|
|
98
|
-
endCursor: string | null;
|
|
99
|
-
hasNextPage: boolean;
|
|
100
|
-
};
|
|
101
|
-
}
|
|
102
|
-
|
|
103
|
-
interface SearchInput {
|
|
104
|
-
view: ViewReference;
|
|
105
|
-
/** Full-text search term. */
|
|
106
|
-
query?: string;
|
|
107
|
-
filter?: LogicalFilter;
|
|
108
|
-
sort?: SearchSort[];
|
|
109
|
-
select: SelectionTree;
|
|
110
|
-
/** Max items to return. Defaults to searchLimit config. */
|
|
111
|
-
limit?: number;
|
|
112
|
-
/** Restrict search to specific property names within the view. */
|
|
113
|
-
properties?: string[];
|
|
114
|
-
}
|
|
115
|
-
|
|
116
|
-
interface AggregateInput {
|
|
117
|
-
view: ViewReference;
|
|
118
|
-
filter?: LogicalFilter;
|
|
119
|
-
aggregates: AggregationDefinition[];
|
|
120
|
-
groupBy?: string[];
|
|
121
|
-
/** Optional full-text query to scope which instances are aggregated. */
|
|
122
|
-
query?: string;
|
|
123
|
-
}
|
|
124
|
-
interface AggregateOutput {
|
|
125
|
-
items: AggregatedResultItem[];
|
|
126
|
-
}
|
|
127
|
-
|
|
128
|
-
type DmsClient = Pick<InstancesAPI, 'query' | 'search' | 'aggregate' | 'retrieve' | 'upsert' | 'delete' | 'sync' | 'inspect'>;
|
|
129
|
-
interface PlannerConfig {
|
|
130
|
-
initialBatchLimit: number;
|
|
131
|
-
maxBatchLimit: number;
|
|
132
|
-
searchLimit: number;
|
|
133
|
-
inFilterChunkSize: number;
|
|
134
|
-
previewLimit: number;
|
|
135
|
-
nestedDetailLimit: number;
|
|
136
|
-
enableRemoveNotConnected: boolean;
|
|
137
|
-
max408Retries: number;
|
|
138
|
-
max429Retries: number;
|
|
139
|
-
retryBaseDelayMs: number;
|
|
140
|
-
maxConcurrentRequests: number;
|
|
141
|
-
/** Maximum SelectionTree nesting depth. Throws PlannerValidationError if exceeded. */
|
|
142
|
-
maxNestingDepth: number;
|
|
143
|
-
/** Hard ceiling for listAll without an explicit maxTotal. Throws rather than silently truncating. */
|
|
144
|
-
maxTotalItems: number;
|
|
145
|
-
}
|
|
146
|
-
|
|
147
|
-
declare class QueryRunner {
|
|
148
|
-
private readonly dms;
|
|
149
|
-
private readonly schema;
|
|
150
|
-
private readonly config;
|
|
151
|
-
private readonly executor;
|
|
152
|
-
get schemaKnowledge(): SchemaKnowledge | undefined;
|
|
153
|
-
constructor(dms: DmsClient, schema?: SchemaKnowledge, config?: Partial<PlannerConfig>);
|
|
154
|
-
query<T = Record<string, unknown>>(input: QueryInput): Promise<ListResult<T>>;
|
|
155
|
-
/**
|
|
156
|
-
* Collects all pages until exhaustion. `input.limit` is the page size.
|
|
157
|
-
* `maxTotal` sets an explicit ceiling — without it, throws at `config.maxTotalItems`
|
|
158
|
-
* to prevent unbounded fetches.
|
|
159
|
-
*/
|
|
160
|
-
queryAll<T = Record<string, unknown>>(input: Omit<QueryInput, 'cursor'>, maxTotal?: number): Promise<T[]>;
|
|
161
|
-
/**
|
|
162
|
-
* Full-text or filter-based search returning a single (non-paginated) result set.
|
|
163
|
-
* Use for top-level discovery; DMS search has eventual consistency — do not use
|
|
164
|
-
* for writes-then-reads or where strong consistency is required.
|
|
165
|
-
*/
|
|
166
|
-
search<T = Record<string, unknown>>(input: SearchInput): Promise<ListResult<T>>;
|
|
167
|
-
/**
|
|
168
|
-
* Fetches specific nodes by space+externalId. Returns an empty array when ids is empty.
|
|
169
|
-
* Extracts view-scoped properties before returning, matching the shape of list results.
|
|
170
|
-
*/
|
|
171
|
-
getByIds<T = Record<string, unknown>>(ids: Array<{
|
|
172
|
-
space: string;
|
|
173
|
-
externalId: string;
|
|
174
|
-
}>, view: ViewReference): Promise<T[]>;
|
|
175
|
-
/**
|
|
176
|
-
* Returns the total count of instances matching the filter.
|
|
177
|
-
* Wraps the filter with hasData so only instances with data in the view are counted.
|
|
178
|
-
*/
|
|
179
|
-
count(input: {
|
|
180
|
-
view: ViewReference;
|
|
181
|
-
filter?: LogicalFilter;
|
|
182
|
-
}): Promise<number>;
|
|
183
|
-
aggregate(input: AggregateInput): Promise<AggregateOutput>;
|
|
184
|
-
/**
|
|
185
|
-
* Async generator — yields one ListResult<T> per page.
|
|
186
|
-
* Lets callers stream results or stop early without fetching remaining pages.
|
|
187
|
-
*/
|
|
188
|
-
queryPages<T = Record<string, unknown>>(input: Omit<QueryInput, 'cursor'>): AsyncGenerator<ListResult<T>>;
|
|
189
|
-
}
|
|
190
|
-
|
|
191
|
-
interface DuneRuntime {
|
|
192
|
-
schema: GraphQLSchema;
|
|
193
|
-
rootValue: Record<string, unknown>;
|
|
194
|
-
runner: QueryRunner;
|
|
195
|
-
/** Pass directly to the generated getSdk() function. */
|
|
196
|
-
requester: DuneRequester;
|
|
197
|
-
}
|
|
198
|
-
/**
|
|
199
|
-
* Builds the full runtime from a data model config. Fetches views from CDF,
|
|
200
|
-
* builds the GraphQL schema, wires resolvers, and returns a ready requester.
|
|
201
|
-
*/
|
|
202
|
-
declare function createDuneRuntime(config: GenerateSdkConfig, client: CogniteClient): Promise<DuneRuntime>;
|
|
203
|
-
/**
|
|
204
|
-
* Builds the runtime directly from an array of ViewDefinition objects — skips the
|
|
205
|
-
* data model lookup. Useful when you already have views from sdk.views.list().
|
|
206
|
-
*/
|
|
207
|
-
declare function createDuneRuntimeFromViews(views: ViewDefinition[], client: CogniteClient): DuneRuntime;
|
|
208
|
-
|
|
209
|
-
export { type DuneRuntime, type ViewDefinition, type ViewDefinitionProperty, createDuneRuntime, createDuneRuntimeFromViews };
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{a,b}from"../chunk-FEYVYSNN.js";import"../chunk-EI7MMDWY.js";export{a as createDuneRuntime,b as createDuneRuntimeFromViews};
|
package/dist/skills-SV7BPHAZ.js
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{b as a,c as b,d as c,e as d}from"./chunk-VTE66IK5.js";export{c as buildPullArgs,a as execSkillsCli,b as pullAllArgs,d as registerSkillsCommand};
|