@cognite/cli 1.3.4-alpha.selfsigned → 1.4.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,32 +1,4 @@
1
- import { CogniteClient } from '@cognite/sdk';
2
-
3
- type Deployment = {
4
- org: string;
5
- project: string;
6
- baseUrl: string;
7
- deployClientId: string;
8
- deploySecretName: string;
9
- published: boolean;
10
- /** Identity provider type. Defaults to "cdf" if not specified */
11
- idpType?: "cdf" | "entra_id";
12
- /** Tenant ID for Entra ID authentication. Required when idpType is "entra_id" */
13
- tenantId?: string;
14
- /**
15
- * OAuth scope for Entra ID authentication. When set, overrides the scope
16
- * that would otherwise be derived from baseUrl
17
- * (e.g. "https://<cluster>.cognitedata.com/.default").
18
- * Use this for non-standard CDF environments such as private-link deployments.
19
- */
20
- scope?: string;
21
- };
22
- type App = {
23
- externalId: string;
24
- name: string;
25
- description: string;
26
- versionTag: string;
27
- };
28
-
29
- declare const deploy: (deployment: Deployment, app: App, folder: string) => Promise<void>;
1
+ import { CogniteClient, ClientOptions } from '@cognite/sdk';
30
2
 
31
3
  /**
32
4
  * App Hosting HTTP API layer.
@@ -52,6 +24,18 @@ interface AppVersion {
52
24
  createdBy: string;
53
25
  appExternalId: string;
54
26
  }
27
+ declare const SIGNATURE_STATUSES: readonly ["VALID", "REVOKED", "EXPIRED", "SIGNED_BEFORE_KEY_ISSUED", "IAT_IN_FUTURE", "BUNDLE_TOO_OLD", "KEY_NOT_IN_REGISTRY"];
28
+ type SignatureStatus = (typeof SIGNATURE_STATUSES)[number];
29
+ declare const SIGNER_ROLES: readonly ["developer", "certifier"];
30
+ type SignerRole = (typeof SIGNER_ROLES)[number];
31
+ type StoredSignature = {
32
+ signerKid: string;
33
+ signerRole: SignerRole;
34
+ signatureIat: number;
35
+ receivedAt: number;
36
+ createdTime: number;
37
+ status: SignatureStatus;
38
+ };
55
39
 
56
40
  declare class AppHostingClient {
57
41
  private api;
@@ -63,10 +47,22 @@ declare class AppHostingClient {
63
47
  * success so the call is safe to repeat.
64
48
  */
65
49
  ensureApp(externalId: string, name: string, description: string): Promise<void>;
50
+ /**
51
+ * Submit verified compact-JWS signatures for a version uploaded earlier.
52
+ * No-op when `items` is empty so callers can wire it unconditionally.
53
+ * The backend accepts and stores well-formed tokens; tier-policy
54
+ * verification happens on the subsequent publish step.
55
+ */
56
+ submitSignatures(appExternalId: string, version: string, items: string[]): Promise<void>;
57
+ /** Fetch the stored signatures for a version. Returns [] when none stored. */
58
+ listSignatures(appExternalId: string, version: string): Promise<StoredSignature[]>;
66
59
  /** Transition a version from DRAFT to PUBLISHED. */
67
60
  publishVersion(appExternalId: string, version: string): Promise<void>;
68
61
  /** Publish the version and immediately set it as the ACTIVE alias. */
69
62
  publishAndActivate(appExternalId: string, version: string): Promise<void>;
63
+ getActiveVersion(appExternalId: string): Promise<AppVersion | null>;
64
+ /** Remove the ACTIVE alias from a version, taking it out of service without changing its lifecycle state. */
65
+ deactivateVersion(appExternalId: string, version: string): Promise<void>;
70
66
  /**
71
67
  * Set the ACTIVE alias on a version. Returns the version that was
72
68
  * previously active (if any) so callers can surface "Superseded X"
@@ -89,6 +85,42 @@ declare class AppHostingClient {
89
85
  deploy(appExternalId: string, name: string, description: string, versionTag: string, fileContent: Buffer, fileName: string, published?: boolean): Promise<void>;
90
86
  }
91
87
 
88
+ type Deployment = {
89
+ org: string;
90
+ project: string;
91
+ baseUrl: string;
92
+ deployClientId: string;
93
+ deploySecretName: string;
94
+ published: boolean;
95
+ /** Identity provider type. Defaults to "cdf" if not specified */
96
+ idpType?: 'cdf' | 'entra_id';
97
+ /** Tenant ID for Entra ID authentication. Required when idpType is "entra_id" */
98
+ tenantId?: string;
99
+ };
100
+ type App = {
101
+ externalId: string;
102
+ name: string;
103
+ description: string;
104
+ versionTag: string;
105
+ };
106
+
107
+ /**
108
+ * Package `dist/` into `<folder>/.cognite-bundles/<externalId>-<versionTag>.zip`
109
+ * and upload it via an already-authenticated `AppHostingClient`. Both deploy
110
+ * entry points (programmatic `deploy()` and the CLI's interactive path) reuse
111
+ * this so packaging/upload behaviour stays in one place.
112
+ *
113
+ * The bundle file is intentionally left on disk so the follow-on
114
+ * `cognite apps sign` + `cognite apps publish` flow can operate on the
115
+ * exact bytes the backend received.
116
+ */
117
+ declare function packageAndUpload(client: AppHostingApiClient, app: App, folder: string, published: boolean): Promise<void>;
118
+ /**
119
+ * Programmatic deploy used by CI scripts: resolves an SDK from the
120
+ * deployment's env-var credentials, then runs `packageAndUpload`.
121
+ */
122
+ declare const deploy: (deployment: Deployment, app: App, folder: string) => Promise<void>;
123
+
92
124
  /**
93
125
  * Application Packaging
94
126
  *
@@ -100,9 +132,13 @@ declare class ApplicationPackager {
100
132
  constructor(distDirectory?: string);
101
133
  validateBuildDirectory(): void;
102
134
  createZip(outputFilename?: string, verbose?: boolean): Promise<string>;
135
+ createSourceArchive(outputPath: string): Promise<string>;
136
+ private validateNoSensitiveFiles;
103
137
  }
104
138
 
105
- declare const getSdk: (deployment: Deployment, folder: string, env?: NodeJS.ProcessEnv) => Promise<CogniteClient>;
139
+ type Authenticatable = Pick<CogniteClient, 'authenticate'>;
140
+ declare function getSdk(deployment: Deployment, folder: string, env?: NodeJS.ProcessEnv): Promise<CogniteClient>;
141
+ declare function getSdk<C extends Authenticatable>(deployment: Deployment, folder: string, env: NodeJS.ProcessEnv, createClient: (opts: ClientOptions) => C): Promise<C>;
106
142
 
107
143
  /**
108
144
  * Get access token for deployment using the appropriate identity provider.
@@ -113,4 +149,37 @@ declare const getSdk: (deployment: Deployment, folder: string, env?: NodeJS.Proc
113
149
  */
114
150
  declare const getToken: (deployment: Deployment, env?: NodeJS.ProcessEnv) => Promise<string>;
115
151
 
116
- export { type App, AppHostingClient, ApplicationPackager, type Deployment, deploy, getSdk, getToken };
152
+ /**
153
+ * Sibling-file discovery for bundle signatures written by `cognite sign`.
154
+ *
155
+ * <bundle>.dev.sig — developer signature
156
+ * <bundle>.cert.sig — certifier counter-signature (`--as-certifier`)
157
+ *
158
+ * Tokens are passed verbatim to the App Hosting `/signatures` endpoint; the
159
+ * backend verifies them against its key registry and tier policy.
160
+ *
161
+ * Collaborators are injected via `deps` so tests can stub fs without `vi.mock`.
162
+ */
163
+ declare const SIGNATURE_SUFFIXES: readonly [".dev.sig", ".cert.sig"];
164
+ type DiscoverSignaturesDeps = {
165
+ existsSync?: (path: string) => boolean;
166
+ readFileSync?: (path: string, encoding: 'utf8') => string;
167
+ };
168
+ declare function discoverSignatures(bundlePath: string, deps?: DiscoverSignaturesDeps): string[];
169
+
170
+ /**
171
+ * Stable on-disk location for a packaged app bundle, keyed on app + version.
172
+ *
173
+ * `cognite apps deploy` writes the zip here and leaves it in place, so the
174
+ * subsequent `cognite apps sign` + `cognite apps publish` steps operate on
175
+ * the *exact bytes* that were uploaded — the bundle SHA in the signed
176
+ * payload matches what the backend has on hand.
177
+ *
178
+ * Lives under a single gitignored folder (`.cognite-bundles/`) so signed
179
+ * artefacts don't accidentally land in version control.
180
+ */
181
+ declare const BUNDLE_DIR = ".cognite-bundles";
182
+ declare function bundleFileName(externalId: string, versionTag: string): string;
183
+ declare function bundlePath(cwd: string, externalId: string, versionTag: string): string;
184
+
185
+ export { type App, AppHostingClient, ApplicationPackager, BUNDLE_DIR, type Deployment, SIGNATURE_SUFFIXES, bundleFileName, bundlePath, deploy, discoverSignatures, getSdk, getToken, packageAndUpload };
@@ -1 +1 @@
1
- import{a,b,c,d,e}from"../chunk-BXCPVUBR.js";export{a as AppHostingClient,b as ApplicationPackager,e as deploy,d as getSdk,c as getToken};
1
+ import{a,b,c,d,e,f,g,h,i,j,k}from"../chunk-Z7JAPCBW.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,2 +1,2 @@
1
- export { App, AppHostingClient, ApplicationPackager, Deployment, deploy, getSdk, getToken } from './deploy/index.js';
1
+ export { App, AppHostingClient, ApplicationPackager, BUNDLE_DIR, Deployment, SIGNATURE_SUFFIXES, bundleFileName, bundlePath, deploy, discoverSignatures, getSdk, getToken, packageAndUpload } from './deploy/index.js';
2
2
  import '@cognite/sdk';
package/dist/index.js CHANGED
@@ -1 +1 @@
1
- import{a as o,b as r,c as e,d as f,e as m}from"./chunk-BXCPVUBR.js";export{o as AppHostingClient,r as ApplicationPackager,m as deploy,f as getSdk,e as getToken};
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-Z7JAPCBW.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,8 +1,8 @@
1
1
  {
2
2
  "name": "@cognite/cli",
3
- "version": "1.3.4-alpha.selfsigned",
3
+ "version": "1.4.0",
4
4
  "description": "CLI for Cognite Data Fusion",
5
- "license": "Apache-2.0",
5
+ "license": "SEE LICENSE IN LICENSE.md",
6
6
  "author": "Cognite",
7
7
  "repository": {
8
8
  "type": "git",
@@ -34,6 +34,7 @@
34
34
  ],
35
35
  "scripts": {
36
36
  "build": "tsup",
37
+ "typecheck": "tsc --noEmit",
37
38
  "prepare": "tsup",
38
39
  "prepack": "pnpm run build",
39
40
  "prepublishOnly": "pnpm run build",
@@ -44,11 +45,12 @@
44
45
  "refresh-spec-kit": "bash scripts/refresh-spec-kit.sh"
45
46
  },
46
47
  "dependencies": {
47
- "@cognite/app-sdk": "^0.4.0",
48
+ "@cognite/app-sdk": "^0.5.1",
48
49
  "@cognite/sdk": "^10.10.0",
49
50
  "@sentry/node": "^10.51.0",
50
51
  "@zip.js/zip.js": "^2.7.0",
51
52
  "chalk": "^5.6.2",
53
+ "clipboardy": "5.3.1",
52
54
  "commander": "^14.0.3",
53
55
  "dotenv": "^17.4.2",
54
56
  "enquirer": "^2.4.1",
@@ -58,7 +60,6 @@
58
60
  "mixpanel": "^0.21.0",
59
61
  "open": "^10.1.0",
60
62
  "openid-client": "^6.8.3",
61
- "selfsigned": "^5.5.0",
62
63
  "semver": "^7.7.0",
63
64
  "skills": "^1.4.3",
64
65
  "valibot": "^1.3.1"
@@ -1,9 +0,0 @@
1
- var W=Object.defineProperty;var s=(e,t)=>W(e,"name",{value:t,configurable:!0});import Y from"fs";import gt from"path";var N="https://docs.cognite.com/cdf/access/";function m(e){return e!==null&&typeof e=="object"}s(m,"isRecord");function S(e){return e instanceof Error&&"status"in e&&typeof e.status=="number"}s(S,"isHttpError");function Z(e){switch(e){case 401:return`Your credentials are invalid or expired. Check your client ID and secret.
2
- See: ${N}`;case 403:return`You don't have the required CDF capabilities. Please contact your CDF admin.
3
- See: ${N}`;default:return}}s(Z,"httpStatusHint");function w(e){let t=e instanceof Error?e:new Error(String(e));if(!S(t))return null;let n=Z(t.status);return n?Object.assign(new Error(`${t.message}
4
- ${n}`),{cause:t}):null}s(w,"enrichedHttpError");function X(e){if(!m(e))return null;let t=e.missing;if(Array.isArray(t))return t;let n=e.data;if(m(n)){let r=n.error;if(m(r)&&Array.isArray(r.missing))return r.missing;if(Array.isArray(n.missing))return n.missing}return null}s(X,"findMissingArray");function Q(e,t){if(!S(e)||e.status!==400)return!1;let n=X(e);return n?n.some(r=>m(r)&&typeof r.externalId=="string"&&t.includes(r.externalId)):!1}s(Q,"isMissingExternalIdError");function v(e,t){return S(e)&&e.status===404||Q(e,t)}s(v,"isNotFoundError");var M=["DRAFT","PUBLISHED","DEPRECATED","ARCHIVED"],J=["ACTIVE","PREVIEW"],I=class I extends Error{constructor(t,n){super(`Version ${n} of app ${t} not found`),this.name="AppVersionNotFoundError",this.appExternalId=t,this.version=n}};s(I,"AppVersionNotFoundError");var C=I;function q(e,t){return e.includes(t)}s(q,"includesValue");function tt(e){return q(M,e)}s(tt,"isAppVersionLifecycleState");function et(e){return q(J,e)}s(et,"isAppVersionAlias");function nt(e){return typeof e.version=="string"&&tt(e.lifecycleState)&&typeof e.entrypoint=="string"&&typeof e.createdTime=="number"&&typeof e.createdBy=="string"&&typeof e.appExternalId=="string"&&(e.alias===void 0||et(e.alias))&&(e.comment===void 0||typeof e.comment=="string")}s(nt,"isAppVersion");function H(e){if(!m(e))throw new Error("Invalid version response: not an object");if(!nt(e))throw new Error("Invalid version response: missing or malformed fields");return e}s(H,"parseAppVersion");var T=class T{constructor(t){this.client=t}get appsBasePath(){return`/api/v1/projects/${encodeURIComponent(this.client.project)}/apphosting/apps`}async createApp(t,n,r){try{await this.client.post(this.appsBasePath,{data:{items:[{externalId:t,name:n,description:r}]}})}catch(o){throw w(o)??o}}async uploadVersion(t,n,r,o,i="index.html"){console.log(`\u{1F4E4} Uploading version ${n}...`);let c=new FormData;c.append("file",new Blob([new Uint8Array(r)]),o),c.append("version",n),c.append("entryPath",i);let l=encodeURIComponent(t),a=`${this.appsBasePath}/${l}/versions`,p=await this.client.authenticate(),g=`${this.client.getBaseUrl()}${a}`,u=new AbortController,G=setTimeout(()=>u.abort(),300*1e3),y;try{y=await fetch(g,{method:"POST",headers:{Authorization:`Bearer ${p}`},body:c,signal:u.signal})}catch(f){throw f instanceof Error&&f.name==="AbortError"?new Error("Upload timed out after 5 minutes"):f}finally{clearTimeout(G)}if(!y.ok){let f=await y.text(),k=f;try{let $=JSON.parse(f);if(m($)){let A=$.error;if(typeof A=="string")k=A;else if(m(A)){let E=A.message,F=A.code;k=typeof E=="string"?E:F!=null?`Unknown error (code: ${F})`:f}else{let E=$.message;k=typeof E=="string"?E:f}}}catch{}let j=y.headers.get("x-request-id"),K=j?` | X-Request-ID: ${j}`:"",B=Object.assign(new Error(`Upload failed: ${y.status} \u2014 ${k}${K}`),{status:y.status});throw w(B)??B}console.log(`\u2705 Version ${n} uploaded`)}async getVersion(t,n){let r=encodeURIComponent(t),o=encodeURIComponent(n),i=`${this.appsBasePath}/${r}/versions/${o}`;try{let c=await this.client.get(i);return H(c.data)}catch(c){throw v(c,[t,n])?new C(t,n):w(c)??c}}async getActiveVersion(t){let n=encodeURIComponent(t),r=`${this.appsBasePath}/${n}/active`;try{let o=await this.client.get(r);return H(o.data)}catch(o){if(v(o,[t]))return null;throw w(o)??o}}async updateVersions(t,n){let r=encodeURIComponent(t),o=`${this.appsBasePath}/${r}/versions/update`;try{await this.client.post(o,{data:{items:n}})}catch(i){throw w(i)??i}}};s(T,"AppHostingApi");var x=T;var b=class b{constructor(t){this.api=new x(t)}getVersion(t,n){return this.api.getVersion(t,n)}uploadVersion(t,n,r,o,i){return this.api.uploadVersion(t,n,r,o,i)}async ensureApp(t,n,r){console.log("\u{1F50D} Ensuring app exists...");try{await this.api.createApp(t,n,r),console.log(`\u2705 App '${t}' created`)}catch(o){if(S(o)&&o.status===409){console.log(`\u2705 App '${t}' already exists`);return}throw o}}async publishVersion(t,n){await this.api.updateVersions(t,[{version:n,update:{lifecycleState:{set:"PUBLISHED"}}}])}async publishAndActivate(t,n){console.log(`\u{1F680} Publishing and activating version ${n}...`),await this.api.updateVersions(t,[{version:n,update:{lifecycleState:{set:"PUBLISHED"},alias:{set:"ACTIVE"}}}]),console.log(`\u2705 Version ${n} is now PUBLISHED and ACTIVE`)}async activateVersion(t,n){let r=null;try{r=await this.api.getActiveVersion(t)}catch{r=null}let o=r&&r.version!==n?r.version:void 0;return await this.api.updateVersions(t,[{version:n,update:{alias:{set:"ACTIVE"}}}]),{supersededVersion:o}}async deploy(t,n,r,o,i,c,l=!1){console.log(`
5
- \u{1F680} Deploying application via App Hosting API...
6
- `);try{await this.ensureApp(t,n,r),await this.uploadVersion(t,o,i,c),l&&await this.publishAndActivate(t,o),console.log(`
7
- \u2705 Deployment successful!`)}catch(a){let p=a instanceof Error?a.message:String(a);throw Object.assign(new Error(`Deployment failed: ${p}`),{cause:a})}}};s(b,"AppHostingClient");var P=b;import h from"fs";import d from"path";import{parseAndValidateManifestConfig as rt}from"@cognite/app-sdk/vite";import{BlobReader as ot,Uint8ArrayWriter as st,ZipWriter as it}from"@zip.js/zip.js";var R="package.json",D="package-lock.json",z="manifest.json",_=".cognite",L=class L{constructor(t="dist"){this.distPath=d.isAbsolute(t)?t:d.join(process.cwd(),t),this.appRoot=d.dirname(this.distPath)}validateBuildDirectory(){if(!h.existsSync(this.distPath))throw new Error(`Build directory "${this.distPath}" not found. Run build first.`);let t=d.join(this.appRoot,R);if(!h.existsSync(t))throw new Error(`"${t}" not found. It is required for deployment.`);let n=d.join(this.appRoot,D);if(!h.existsSync(n))throw new Error(`"${n}" not found. It is required for deployment.`)}async createZip(t="app.zip",n=!1){this.validateBuildDirectory(),console.log("\u{1F4E6} Packaging application...");let r=new it(new st,{level:9}),o=s(async(a,p)=>{await r.add(p,new ot(await h.openAsBlob(a))),n&&console.log(` \u{1F4C4} ${p}`)},"addFile"),i=s(async a=>{let p=await h.promises.readdir(a,{withFileTypes:!0});for(let g of p){let u=d.join(a,g.name);g.isDirectory()?await i(u):await o(u,d.relative(this.distPath,u).replace(/\\/g,"/"))}},"addDir"),c;try{await i(this.distPath);let a=d.join(this.appRoot,R);await o(a,d.posix.join(_,R));let p=d.join(this.appRoot,z);if(h.existsSync(p)){let u=h.readFileSync(p,"utf-8");rt(u,p),await o(p,d.posix.join(_,z))}let g=d.join(this.appRoot,D);await o(g,d.posix.join(_,D)),c=await r.close()}catch(a){let p=a instanceof Error?a.message:String(a);throw new Error(`Failed to create zip: ${p}`)}await h.promises.writeFile(t,c);let l=(c.byteLength/1024/1024).toFixed(2);return console.log(`\u2705 App packaged: ${t} (${l} MB)`),t}};s(L,"ApplicationPackager");var V=L;import{CogniteClient as ut}from"@cognite/sdk";var at=s(()=>{let e=process.env.DEPLOYMENT_SECRETS;if(!e)return{};try{let t=JSON.parse(e),n={};for(let[r,o]of Object.entries(t))if(typeof o=="string"){let i=r.toLowerCase().replace(/_/g,"-");n[i]=o}return n}catch(t){return console.error("Error parsing DEPLOYMENT_SECRETS:",t),{}}},"loadSecretsFromEnv"),ct=s(e=>{let t;if(process.env.DEPLOYMENT_SECRET&&(t=process.env.DEPLOYMENT_SECRET),t||(t=at()[e]),t||(t=process.env[e]),!t)throw new Error(`Secret not found in environment: ${e}`);return t},"getSecretFromEnv"),pt=s(e=>{if(!e)return"";try{return new URL(e).hostname.replace(/\.cognitedata\.com$/,"")}catch{let t=e.replace(/^https?:\/\//,"");return t=t.split("/")[0],t=t.split(":")[0],t=t.replace(/\.cognitedata\.com$/,""),t}},"extractClusterFromUrl"),lt=s(async(e,t)=>{let n=`Basic ${btoa(`${e}:${t}`)}`,r=await fetch("https://auth.cognite.com/oauth2/token",{method:"POST",headers:{Authorization:n,"Content-Type":"application/x-www-form-urlencoded"},body:new URLSearchParams({grant_type:"client_credentials"})});if(!r.ok){let i=await r.text();throw new Error(`Failed to get token from CDF: ${r.status} ${r.statusText}
8
- ${i}`)}let o=await r.json();if(!o.access_token)throw new Error("No access token returned from CDF authentication");return o.access_token},"getTokenCdf"),dt=s(async(e,t,n,r,o)=>{let i;if(o)i=o;else{if(!r)throw new Error("Entra ID authentication requires 'baseUrl' to be set in deployment configuration");let p=pt(r);if(!p)throw new Error(`Entra ID authentication requires 'baseUrl' to be a valid CDF URL (e.g., https://cluster.cognitedata.com), got: ${r}`);i=`https://${p}.cognitedata.com/.default`}let c=`https://login.microsoftonline.com/${n}/oauth2/v2.0/token`,l=await fetch(c,{method:"POST",headers:{"Content-Type":"application/x-www-form-urlencoded"},body:new URLSearchParams({client_id:e,client_secret:t,scope:i,grant_type:"client_credentials"})});if(!l.ok){let p=await l.text();throw new Error(`Failed to get token from Entra ID: ${l.status} ${l.statusText}
9
- ${p}`)}let a=await l.json();if(!a.access_token)throw new Error("No access token returned from Entra ID authentication");return a.access_token},"getTokenEntra"),U=s(async(e,t=process.env)=>{if(t.COGNITE_TOKEN)return t.COGNITE_TOKEN;let{deployClientId:n,deploySecretName:r,idpType:o="cdf",tenantId:i,baseUrl:c,scope:l}=e,a=ct(r);if(o==="entra_id"){if(!i)throw new Error("Entra ID authentication requires 'tenantId' in deployment configuration");return dt(n,a,i,c,l)}return lt(n,a)},"getToken");var O=s(async(e,t,n=process.env)=>{let r=await U(e,n),o=n.COGNITE_BASE_URL??e.baseUrl,i=new ut({appId:t,project:e.project,baseUrl:o,oidcTokenProvider:s(async()=>r,"oidcTokenProvider")});return await i.authenticate(),i},"getSdk");var ft=s(async(e,t,n)=>{let r=await new V(`${n}/dist`).createZip("app.zip",!0);try{let{externalId:o,name:i,description:c,versionTag:l}=t,a=await O(e,n),p=new P(a),g=Y.readFileSync(r),u=gt.basename(r);await p.deploy(o,i,c,l,g,u,e.published)}finally{try{Y.unlinkSync(r)}catch{}}},"deploy");export{P as a,V as b,U as c,O as d,ft as e};