@osdk/cli 0.0.15 → 0.0.16

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/CHANGELOG.md CHANGED
@@ -1,5 +1,16 @@
1
1
  # @osdk/cli
2
2
 
3
+ ## 0.0.16
4
+
5
+ ### Patch Changes
6
+
7
+ - b07ff14: CLI can now request ontology data directly from the backend
8
+ - Updated dependencies [b07ff14]
9
+ - @osdk/shared.net@1.0.1
10
+ - @osdk/generator@1.0.1
11
+ - @osdk/gateway@1.0.1
12
+ - @osdk/api@1.0.1
13
+
3
14
  ## 0.0.15
4
15
 
5
16
  ### Patch Changes
@@ -0,0 +1,13 @@
1
+ import s from 'consola';
2
+ import { getRandomValues, subtle } from 'crypto';
3
+ import { createServer } from 'http';
4
+ import x from 'open';
5
+ import { join } from 'path/posix';
6
+ import { exit } from 'process';
7
+ import { parse } from 'url';
8
+
9
+ function h(t){return t.error!=null}async function T(t){s.start(`Authenticating using application id: ${t.applicationId}`);let o="http://localhost:8080/auth/callback",n=parse(o).port,r,a=new Promise(c=>{r=c;}),e=createServer((c,_)=>{let S=parse(c.url,!0).query;_.end("Authenticated"),r(S.code);});e.on("error",c=>{c.code==="EADDRINUSE"&&(s.error(`Port ${n} is already in use, unable to perform authentication flow.`),e.close(),exit(1));}),e.listen(n);let p=t.applicationId,i=g(),d=g(),y=await A(d),u=R(t.baseUrl,p,i,o,y);try{await x(u);}catch{s.warn(`Unable to open browser, please open this url in your browser to to authenticate: ${u}`);}let U=await a;e.close();let l=await E(p,o,U,t.baseUrl,d);return h(l)&&(s.error("Unable to authenticate",l.error,l.error_description),exit(1)),s.success("Successfully authenticated!"),l}function g(t=128){let o="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-._~",n=[],r=new Uint8Array(1),a=256-256%o.length;for(;n.length<t;)getRandomValues(r),r[0]<a&&n.push(o[r[0]%o.length]);return n.join("")}async function A(t){let o=new TextEncoder().encode(t),n=await subtle.digest("SHA-256",o),r="S256";return {codeChallenge:btoa(String.fromCharCode(...new Uint8Array(n))).replace(/\//g,"_").replace(/\+/g,"-").replace(/=/g,""),codeChallengeMethod:r}}function R(t,o,n,r,a){let e=new URLSearchParams;return e.append("client_id",o),e.append("response_type","code"),e.append("state",n),e.append("redirect_uri",r),e.append("code_challenge",a.codeChallenge),e.append("code_challenge_method",a.codeChallengeMethod),e.append("scope",["offline_access","api:read-data"].join(" ")),join(t,"multipass","api","oauth2","authorize")+"?"+e.toString()}async function E(t,o,n,r,a){let e=new URLSearchParams;e.append("client_id",t),e.append("grant_type","authorization_code"),e.append("code",n),e.append("redirect_uri",o),e.append("code_verifier",a);let p=join(r,"multipass","api","oauth2","token")+`?state=${a}`;try{return await(await fetch(p,{body:e.toString(),headers:{"Content-Type":"application/x-www-form-urlencoded"},method:"POST"})).json()}catch(i){throw new Error(`Failed to get token: ${i?i.toString():"Unknown error"}`)}}
10
+
11
+ export { T as a };
12
+ //# sourceMappingURL=out.js.map
13
+ //# sourceMappingURL=chunk-YHQGXNMB.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../src/commands/auth/login/loginFlow.ts","../../src/commands/auth/login/token.ts"],"names":["consola","getRandomValues","subtle","createServer","open","join","exit","parse","isTokenErrorResponse","response","invokeLoginFlow","args","redirectUrl","port","resolve","authCode","_res","server","req","res","query","e","clientId","state","generateRandomString","codeVerifier","codeChallenge","generateCodeChallenge","authorizeUrl","generateAuthorizeUrl","code","token","getTokenWithCodeVerifier","length","characters","output","array","maxIndex","data","digest","codeChallengeMethod","baseUrl","queryParams","body","tokenUrl"],"mappings":"AAiBA,OAAOA,MAAa,UACpB,OAAS,mBAAAC,EAAiB,UAAAC,MAAc,SACxC,OAAS,gBAAAC,MAAoB,OAC7B,OAAOC,MAAU,OACjB,OAAS,QAAAC,MAAY,aACrB,OAAS,QAAAC,MAAY,UACrB,OAAS,SAAAC,MAAa,MCPf,SAASC,EAAqBC,EA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ACzC,IAAMmB,EAAWvC,EAAKoC,EAAS,YAAa,MAAO,SAAU,OAAO,EAAI,UAAUhB,CAAY,GAC9F,GAAI,CASF,OADqB,MAPJ,MAAM,MAAMmB,EAAU,CACrC,KAAMD,EAAK,SAAS,EACpB,QAAS,CACP,eAAgB,mCAClB,EACA,OAAQ,MACV,CAAC,GACmC,KAAK,CAE3C,OAAStB,EAAG,CACV,MAAM,IAAI,MAAM,wBAAwBA,EAAIA,EAAE,SAAS,EAAI,eAAe,EAAE,CAC9E,CACF","sourcesContent":["/*\n * Copyright 2023 Palantir Technologies, Inc. All rights reserved.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\n// eslint-disable-next-line import/no-named-as-default\nimport consola from \"consola\";\nimport { getRandomValues, subtle } from \"crypto\";\nimport { createServer } from \"http\";\nimport open from \"open\";\nimport { join } from \"path/posix\";\nimport { exit } from \"process\";\nimport { parse } from \"url\";\nimport { isTokenErrorResponse } from \"./token.js\";\nexport default async function invokeLoginFlow(args) {\n consola.start(`Authenticating using application id: ${args.applicationId}`);\n const redirectUrl = \"http://localhost:8080/auth/callback\";\n const port = parse(redirectUrl).port;\n let resolve;\n const authCode = new Promise(_res => {\n resolve = _res;\n });\n const server = createServer((req, res) => {\n const query = parse(req.url, true).query;\n res.end(\"Authenticated\");\n resolve(query[\"code\"]);\n });\n server.on(\"error\", e => {\n if (e.code === \"EADDRINUSE\") {\n consola.error(`Port ${port} is already in use, unable to perform authentication flow.`);\n server.close();\n exit(1);\n }\n });\n server.listen(port);\n const clientId = args.applicationId;\n const state = generateRandomString();\n const codeVerifier = generateRandomString();\n const codeChallenge = await generateCodeChallenge(codeVerifier);\n const authorizeUrl = generateAuthorizeUrl(args.baseUrl, clientId, state, redirectUrl, codeChallenge);\n try {\n await open(authorizeUrl);\n } catch {\n consola.warn(`Unable to open browser, please open this url in your browser to to authenticate: ${authorizeUrl}`);\n }\n const code = await authCode;\n server.close();\n const token = await getTokenWithCodeVerifier(clientId, redirectUrl, code, args.baseUrl, codeVerifier);\n if (isTokenErrorResponse(token)) {\n consola.error(\"Unable to authenticate\", token.error, token.error_description);\n exit(1);\n }\n consola.success(`Successfully authenticated!`);\n return token;\n}\nfunction generateRandomString(length = 128) {\n const characters = \"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-._~\";\n let output = [];\n let array = new Uint8Array(1);\n const maxIndex = 256 - 256 % characters.length;\n while (output.length < length) {\n getRandomValues(array);\n if (array[0] < maxIndex) {\n output.push(characters[array[0] % characters.length]);\n }\n }\n return output.join(\"\");\n}\nasync function generateCodeChallenge(codeVerifier) {\n const data = new TextEncoder().encode(codeVerifier);\n const digest = await subtle.digest(\"SHA-256\", data);\n const codeChallengeMethod = \"S256\";\n const codeChallenge = btoa(String.fromCharCode(...new Uint8Array(digest))).replace(/\\//g, \"_\").replace(/\\+/g, \"-\").replace(/=/g, \"\");\n return {\n codeChallenge,\n codeChallengeMethod\n };\n}\nfunction generateAuthorizeUrl(baseUrl, clientId, state, redirectUrl, codeChallenge) {\n const queryParams = new URLSearchParams();\n queryParams.append(\"client_id\", clientId);\n queryParams.append(\"response_type\", \"code\");\n queryParams.append(\"state\", state);\n queryParams.append(\"redirect_uri\", redirectUrl);\n queryParams.append(\"code_challenge\", codeChallenge.codeChallenge);\n queryParams.append(\"code_challenge_method\", codeChallenge.codeChallengeMethod);\n queryParams.append(\"scope\", [\"offline_access\", \"api:read-data\"].join(\" \"));\n return join(baseUrl, \"multipass\", \"api\", \"oauth2\", \"authorize\") + `?` + queryParams.toString();\n}\nasync function getTokenWithCodeVerifier(clientId, redirectUrl, code, baseUrl, codeVerifier) {\n const body = new URLSearchParams();\n body.append(\"client_id\", clientId);\n body.append(\"grant_type\", \"authorization_code\");\n body.append(\"code\", code);\n body.append(\"redirect_uri\", redirectUrl);\n body.append(\"code_verifier\", codeVerifier);\n const tokenUrl = join(baseUrl, \"multipass\", \"api\", \"oauth2\", \"token\") + `?state=${codeVerifier}`;\n try {\n const response = await fetch(tokenUrl, {\n body: body.toString(),\n headers: {\n \"Content-Type\": \"application/x-www-form-urlencoded\"\n },\n method: \"POST\"\n });\n const responseText = await response.json();\n return responseText;\n } catch (e) {\n throw new Error(`Failed to get token: ${e ? e.toString() : \"Unknown error\"}`);\n }\n}","/*\n * Copyright 2023 Palantir Technologies, Inc. All rights reserved.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nexport function isTokenErrorResponse(response) {\n return response.error != null;\n}"]}
@@ -0,0 +1,20 @@
1
+ 'use strict';
2
+
3
+ var s = require('consola');
4
+ var crypto = require('crypto');
5
+ var http = require('http');
6
+ var x = require('open');
7
+ var posix = require('path/posix');
8
+ var process = require('process');
9
+ var url = require('url');
10
+
11
+ function _interopDefault (e) { return e && e.__esModule ? e : { default: e }; }
12
+
13
+ var s__default = /*#__PURE__*/_interopDefault(s);
14
+ var x__default = /*#__PURE__*/_interopDefault(x);
15
+
16
+ function h(t){return t.error!=null}async function T(t){s__default.default.start(`Authenticating using application id: ${t.applicationId}`);let o="http://localhost:8080/auth/callback",n=url.parse(o).port,r,a=new Promise(c=>{r=c;}),e=http.createServer((c,_)=>{let S=url.parse(c.url,!0).query;_.end("Authenticated"),r(S.code);});e.on("error",c=>{c.code==="EADDRINUSE"&&(s__default.default.error(`Port ${n} is already in use, unable to perform authentication flow.`),e.close(),process.exit(1));}),e.listen(n);let p=t.applicationId,i=g(),d=g(),y=await A(d),u=R(t.baseUrl,p,i,o,y);try{await x__default.default(u);}catch{s__default.default.warn(`Unable to open browser, please open this url in your browser to to authenticate: ${u}`);}let U=await a;e.close();let l=await E(p,o,U,t.baseUrl,d);return h(l)&&(s__default.default.error("Unable to authenticate",l.error,l.error_description),process.exit(1)),s__default.default.success("Successfully authenticated!"),l}function g(t=128){let o="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-._~",n=[],r=new Uint8Array(1),a=256-256%o.length;for(;n.length<t;)crypto.getRandomValues(r),r[0]<a&&n.push(o[r[0]%o.length]);return n.join("")}async function A(t){let o=new TextEncoder().encode(t),n=await crypto.subtle.digest("SHA-256",o),r="S256";return {codeChallenge:btoa(String.fromCharCode(...new Uint8Array(n))).replace(/\//g,"_").replace(/\+/g,"-").replace(/=/g,""),codeChallengeMethod:r}}function R(t,o,n,r,a){let e=new URLSearchParams;return e.append("client_id",o),e.append("response_type","code"),e.append("state",n),e.append("redirect_uri",r),e.append("code_challenge",a.codeChallenge),e.append("code_challenge_method",a.codeChallengeMethod),e.append("scope",["offline_access","api:read-data"].join(" ")),posix.join(t,"multipass","api","oauth2","authorize")+"?"+e.toString()}async function E(t,o,n,r,a){let e=new URLSearchParams;e.append("client_id",t),e.append("grant_type","authorization_code"),e.append("code",n),e.append("redirect_uri",o),e.append("code_verifier",a);let p=posix.join(r,"multipass","api","oauth2","token")+`?state=${a}`;try{return await(await fetch(p,{body:e.toString(),headers:{"Content-Type":"application/x-www-form-urlencoded"},method:"POST"})).json()}catch(i){throw new Error(`Failed to get token: ${i?i.toString():"Unknown error"}`)}}
17
+
18
+ exports.a = T;
19
+ //# sourceMappingURL=out.js.map
20
+ //# sourceMappingURL=chunk-Z6SJPM6K.cjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../src/commands/auth/login/loginFlow.ts","../../src/commands/auth/login/token.ts"],"names":["consola","getRandomValues","subtle","createServer","open","join","exit","parse","isTokenErrorResponse","response","invokeLoginFlow","args","redirectUrl","port","resolve","authCode","_res","server","req","res","query","e","clientId","state","generateRandomString","codeVerifier","codeChallenge","generateCodeChallenge","authorizeUrl","generateAuthorizeUrl","code","token","getTokenWithCodeVerifier","length","characters","output","array","maxIndex","data","digest","codeChallengeMethod","baseUrl","queryParams","body","tokenUrl"],"mappings":"AAiBA,OAAOA,MAAa,UACpB,OAAS,mBAAAC,EAAiB,UAAAC,MAAc,SACxC,OAAS,gBAAAC,MAAoB,OAC7B,OAAOC,MAAU,OACjB,OAAS,QAAAC,MAAY,aACrB,OAAS,QAAAC,MAAY,UACrB,OAAS,SAAAC,MAAa,MCPf,SAASC,EAAqBC,EAAU,CAC7C,OAAOA,EAAS,OAAS,IAC3B,CDOA,eAAOC,EAAuCC,EAAM,CAClDX,EAAQ,MAAM,wCAAwCW,EAAK,aAAa,EAAE,EAC1E,IAAMC,EAAc,sCACdC,EAAON,EAAMK,CAAW,EAAE,KAC5BE,EACEC,EAAW,IAAI,QAAQC,GAAQ,CACnCF,EAAUE,CACZ,CAAC,EACKC,EAASd,EAAa,CAACe,EAAKC,IAAQ,CACxC,IAAMC,EAAQb,EAAMW,EAAI,IAAK,EAAI,EAAE,MACnCC,EAAI,IAAI,eAAe,EACvBL,EAAQM,EAAM,IAAO,CACvB,CAAC,EACDH,EAAO,GAAG,QAASI,GAAK,CAClBA,EAAE,OAAS,eACbrB,EAAQ,MAAM,QAAQa,CAAI,4DAA4D,EACtFI,EAAO,MAAM,EACbX,EAAK,CAAC,EAEV,CAAC,EACDW,EAAO,OAAOJ,CAAI,EAClB,IAAMS,EAAWX,EAAK,cAChBY,EAAQC,EAAqB,EAC7BC,EAAeD,EAAqB,EACpCE,EAAgB,MAAMC,EAAsBF,CAAY,EACxDG,EAAeC,EAAqBlB,EAAK,QAASW,EAAUC,EAAOX,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AO,eAAgB9B,CAAW,EAC9C8B,EAAY,OAAO,iBAAkBhB,EAAc,aAAa,EAChEgB,EAAY,OAAO,wBAAyBhB,EAAc,mBAAmB,EAC7EgB,EAAY,OAAO,QAAS,CAAC,iBAAkB,eAAe,EAAE,KAAK,GAAG,CAAC,EAClErC,EAAKoC,EAAS,YAAa,MAAO,SAAU,WAAW,EAAI,IAAMC,EAAY,SAAS,CAC/F,CACA,eAAeV,EAAyBV,EAAUV,EAAakB,EAAMW,EAAShB,EAAc,CAC1F,IAAMkB,EAAO,IAAI,gBACjBA,EAAK,OAAO,YAAarB,CAAQ,EACjCqB,EAAK,OAAO,aAAc,oBAAoB,EAC9CA,EAAK,OAAO,OAAQb,CAAI,EACxBa,EAAK,OAAO,eAAgB/B,CAAW,EACvC+B,EAAK,OAAO,gBAAiBlB,CAAY,EACzC,IAAMmB,EAAWvC,EAAKoC,EAAS,YAAa,MAAO,SAAU,OAAO,EAAI,UAAUhB,CAAY,GAC9F,GAAI,CASF,OADqB,MAPJ,MAAM,MAAMmB,EAAU,CACrC,KAAMD,EAAK,SAAS,EACpB,QAAS,CACP,eAAgB,mCAClB,EACA,OAAQ,MACV,CAAC,GACmC,KAAK,CAE3C,OAAStB,EAAG,CACV,MAAM,IAAI,MAAM,wBAAwBA,EAAIA,EAAE,SAAS,EAAI,eAAe,EAAE,CAC9E,CACF","sourcesContent":["/*\n * Copyright 2023 Palantir Technologies, Inc. All rights reserved.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\n// eslint-disable-next-line import/no-named-as-default\nimport consola from \"consola\";\nimport { getRandomValues, subtle } from \"crypto\";\nimport { createServer } from \"http\";\nimport open from \"open\";\nimport { join } from \"path/posix\";\nimport { exit } from \"process\";\nimport { parse } from \"url\";\nimport { isTokenErrorResponse } from \"./token.js\";\nexport default async function invokeLoginFlow(args) {\n consola.start(`Authenticating using application id: ${args.applicationId}`);\n const redirectUrl = \"http://localhost:8080/auth/callback\";\n const port = parse(redirectUrl).port;\n let resolve;\n const authCode = new Promise(_res => {\n resolve = _res;\n });\n const server = createServer((req, res) => {\n const query = parse(req.url, true).query;\n res.end(\"Authenticated\");\n resolve(query[\"code\"]);\n });\n server.on(\"error\", e => {\n if (e.code === \"EADDRINUSE\") {\n consola.error(`Port ${port} is already in use, unable to perform authentication flow.`);\n server.close();\n exit(1);\n }\n });\n server.listen(port);\n const clientId = args.applicationId;\n const state = generateRandomString();\n const codeVerifier = generateRandomString();\n const codeChallenge = await generateCodeChallenge(codeVerifier);\n const authorizeUrl = generateAuthorizeUrl(args.baseUrl, clientId, state, redirectUrl, codeChallenge);\n try {\n await open(authorizeUrl);\n } catch {\n consola.warn(`Unable to open browser, please open this url in your browser to to authenticate: ${authorizeUrl}`);\n }\n const code = await authCode;\n server.close();\n const token = await getTokenWithCodeVerifier(clientId, redirectUrl, code, args.baseUrl, codeVerifier);\n if (isTokenErrorResponse(token)) {\n consola.error(\"Unable to authenticate\", token.error, token.error_description);\n exit(1);\n }\n consola.success(`Successfully authenticated!`);\n return token;\n}\nfunction generateRandomString(length = 128) {\n const characters = \"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-._~\";\n let output = [];\n let array = new Uint8Array(1);\n const maxIndex = 256 - 256 % characters.length;\n while (output.length < length) {\n getRandomValues(array);\n if (array[0] < maxIndex) {\n output.push(characters[array[0] % characters.length]);\n }\n }\n return output.join(\"\");\n}\nasync function generateCodeChallenge(codeVerifier) {\n const data = new TextEncoder().encode(codeVerifier);\n const digest = await subtle.digest(\"SHA-256\", data);\n const codeChallengeMethod = \"S256\";\n const codeChallenge = btoa(String.fromCharCode(...new Uint8Array(digest))).replace(/\\//g, \"_\").replace(/\\+/g, \"-\").replace(/=/g, \"\");\n return {\n codeChallenge,\n codeChallengeMethod\n };\n}\nfunction generateAuthorizeUrl(baseUrl, clientId, state, redirectUrl, codeChallenge) {\n const queryParams = new URLSearchParams();\n queryParams.append(\"client_id\", clientId);\n queryParams.append(\"response_type\", \"code\");\n queryParams.append(\"state\", state);\n queryParams.append(\"redirect_uri\", redirectUrl);\n queryParams.append(\"code_challenge\", codeChallenge.codeChallenge);\n queryParams.append(\"code_challenge_method\", codeChallenge.codeChallengeMethod);\n queryParams.append(\"scope\", [\"offline_access\", \"api:read-data\"].join(\" \"));\n return join(baseUrl, \"multipass\", \"api\", \"oauth2\", \"authorize\") + `?` + queryParams.toString();\n}\nasync function getTokenWithCodeVerifier(clientId, redirectUrl, code, baseUrl, codeVerifier) {\n const body = new URLSearchParams();\n body.append(\"client_id\", clientId);\n body.append(\"grant_type\", \"authorization_code\");\n body.append(\"code\", code);\n body.append(\"redirect_uri\", redirectUrl);\n body.append(\"code_verifier\", codeVerifier);\n const tokenUrl = join(baseUrl, \"multipass\", \"api\", \"oauth2\", \"token\") + `?state=${codeVerifier}`;\n try {\n const response = await fetch(tokenUrl, {\n body: body.toString(),\n headers: {\n \"Content-Type\": \"application/x-www-form-urlencoded\"\n },\n method: \"POST\"\n });\n const responseText = await response.json();\n return responseText;\n } catch (e) {\n throw new Error(`Failed to get token: ${e ? e.toString() : \"Unknown error\"}`);\n }\n}","/*\n * Copyright 2023 Palantir Technologies, Inc. All rights reserved.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nexport function isTokenErrorResponse(response) {\n return response.error != null;\n}"]}
@@ -0,0 +1,13 @@
1
+ import { a as a$1 } from './chunk-YHQGXNMB.mjs';
2
+ import './chunk-XIJ2ZQRX.mjs';
3
+ import { listOntologiesV2, getOntologyFullMetadata } from '@osdk/gateway/requests';
4
+ import { generateClientSdkVersionTwoPointZero, generateClientSdkVersionOneDotOne } from '@osdk/generator';
5
+ import { createClientContext, createOpenApiRequest } from '@osdk/shared.net';
6
+ import { consola } from 'consola';
7
+ import * as a from 'fs';
8
+
9
+ async function y(t){if(t.ontologyPath)await h(t);else if(t.stack&&t.clientId)await F(t);else throw new Error("Must have specified ontologyPath or stack and clientId");consola.info("OSDK Generated!");}async function h(t){let e=JSON.parse(await a.promises.readFile(t.ontologyPath,"utf-8"));await d(e,t);}async function F(t){let{stack:e,clientId:o}=t,i=await a$1({applicationId:o,baseUrl:e,verbose:0}),{fetch:l}=createClientContext({metadata:{userAgent:"@osdk/cli/0.0.0 ()"}},t.stack,()=>i.access_token);try{let n=await listOntologiesV2(createOpenApiRequest(e,l));n.data.length!==1&&consola.error(`Could not look up ontology with these credentials. Found ${n.data.length} ontologies.`);let f=await getOntologyFullMetadata(createOpenApiRequest(e,l),n.data[0].apiName);await d(f,t);}catch(n){consola.error("Failed to download the ontology",n);}}async function d(t,e){e.beta?await generateClientSdkVersionTwoPointZero(t,{writeFile:(o,i)=>a.promises.writeFile(o,i,"utf-8"),mkdir:async(o,i)=>{await a.promises.mkdir(o,i);}},e.outDir,e.packageType):await generateClientSdkVersionOneDotOne(t,{writeFile:(o,i)=>a.promises.writeFile(o,i,"utf-8"),mkdir:async(o,i)=>{await a.promises.mkdir(o,i);}},e.outDir,e.packageType);}
10
+
11
+ export { y as default };
12
+ //# sourceMappingURL=out.js.map
13
+ //# sourceMappingURL=handleGenerate-4RFQDCQF.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../src/commands/typescript/generate/handleGenerate.mts"],"names":["getOntologyFullMetadata","listOntologiesV2","generateClientSdkVersionOneDotOne","generateClientSdkVersionTwoPointZero","createClientContext","createOpenApiRequest","consola","fs","handleGenerate","args","generateFromLocalFile","generateFromStack","ontology","generateClientSdk","stack","clientId","token","invokeLoginFlow","fetch","ontologies","e","path","contents","options"],"mappings":"sEAgBA,OAAS,2BAAAA,EAAyB,oBAAAC,MAAwB,yBAC1D,OAAS,qCAAAC,EAAmC,wCAAAC,MAA4C,kBACxF,OAAS,uBAAAC,EAAqB,wBAAAC,MAA4B,mBAC1D,OAAS,WAAAC,MAAe,UACxB,UAAYC,MAAQ,KAEpB,eAAOC,EAAsCC,EAAM,CACjD,GAAIA,EAAK,aACP,MAAMC,EAAsBD,CAAI,UACvBA,EAAK,OAASA,EAAK,SAC5B,MAAME,EAAkBF,CAAI,MAE5B,OAAM,IAAI,MAAM,wDAAwD,EAE1EH,EAAQ,KAAK,iBAAiB,CAChC,CACA,eAAeI,EAAsBD,EAAM,CACzC,IAAMG,EAAW,KAAK,MAAM,MAAS,WAAS,SAASH,EAAK,aAAc,OAAO,CAAC,EAClF,MAAMI,EAAkBD,EAAUH,CAAI,CACxC,CACA,eAAeE,EAAkBF,EAAM,CACrC,GAAM,CACJ,MAAAK,EACA,SAAAC,CACF,EAAIN,EACEO,EAAQ,MAAMC,EAAgB,CAClC,cAAeF,EACf,QAASD,EACT,QAAS,CACX,CAAC,EACK,CACJ,MAAAI,CACF,EAAId,EAAoB,CACtB,SAAU,CACR,UAAW,oBACb,CACF,EAAGK,EAAK,MAAO,IAAMO,EAAM,YAAY,EACvC,GAAI,CACF,IAAMG,EAAa,MAAMlB,EAAiBI,EAAqBS,EAAOI,CAAK,CAAC,EACxEC,EAAW,KAAK,SAAW,GAC7Bb,EAAQ,MAAM,4DAA4Da,EAAW,KAAK,MAAM,cAAc,EAEhH,IAAMP,EAAW,MAAMZ,EAAwBK,EAAqBS,EAAOI,CAAK,EAAGC,EAAW,KAAK,CAAC,EAAE,OAAO,EAC7G,MAAMN,EAAkBD,EAAUH,CAAI,CACxC,OAASW,EAAG,CACVd,EAAQ,MAAM,kCAAmCc,CAAC,CACpD,CACF,CACA,eAAeP,EAAkBD,EAAUH,EAAM,CAC3CA,EAAK,KACP,MAAMN,EAAqCS,EAAU,CACnD,UAAW,CAACS,EAAMC,IACN,WAAS,UAAUD,EAAMC,EAAU,OAAO,EAEtD,MAAO,MAAOD,EAAME,IAAY,CAC9B,MAAS,WAAS,MAAMF,EAAME,CAAO,CACvC,CACF,EAAGd,EAAK,OAAQA,EAAK,WAAW,EAEhC,MAAMP,EAAkCU,EAAU,CAChD,UAAW,CAACS,EAAMC,IACN,WAAS,UAAUD,EAAMC,EAAU,OAAO,EAEtD,MAAO,MAAOD,EAAME,IAAY,CAC9B,MAAS,WAAS,MAAMF,EAAME,CAAO,CACvC,CACF,EAAGd,EAAK,OAAQA,EAAK,WAAW,CAEpC","sourcesContent":["/*\n * Copyright 2023 Palantir Technologies, Inc. All rights reserved.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport { getOntologyFullMetadata, listOntologiesV2 } from \"@osdk/gateway/requests\";\nimport { generateClientSdkVersionOneDotOne, generateClientSdkVersionTwoPointZero } from \"@osdk/generator\";\nimport { createClientContext, createOpenApiRequest } from \"@osdk/shared.net\";\nimport { consola } from \"consola\";\nimport * as fs from \"node:fs\";\nimport invokeLoginFlow from \"../../auth/login/loginFlow.js\";\nexport default async function handleGenerate(args) {\n if (args.ontologyPath) {\n await generateFromLocalFile(args);\n } else if (args.stack && args.clientId) {\n await generateFromStack(args);\n } else {\n throw new Error(\"Must have specified ontologyPath or stack and clientId\");\n }\n consola.info(\"OSDK Generated!\");\n}\nasync function generateFromLocalFile(args) {\n const ontology = JSON.parse(await fs.promises.readFile(args.ontologyPath, \"utf-8\"));\n await generateClientSdk(ontology, args);\n}\nasync function generateFromStack(args) {\n const {\n stack,\n clientId\n } = args;\n const token = await invokeLoginFlow({\n applicationId: clientId,\n baseUrl: stack,\n verbose: 0\n });\n const {\n fetch\n } = createClientContext({\n metadata: {\n userAgent: \"@osdk/cli/0.0.0 ()\"\n }\n }, args.stack, () => token.access_token);\n try {\n const ontologies = await listOntologiesV2(createOpenApiRequest(stack, fetch));\n if (ontologies.data.length !== 1) {\n consola.error(`Could not look up ontology with these credentials. Found ${ontologies.data.length} ontologies.`);\n }\n const ontology = await getOntologyFullMetadata(createOpenApiRequest(stack, fetch), ontologies.data[0].apiName);\n await generateClientSdk(ontology, args);\n } catch (e) {\n consola.error(\"Failed to download the ontology\", e);\n }\n}\nasync function generateClientSdk(ontology, args) {\n if (args.beta) {\n await generateClientSdkVersionTwoPointZero(ontology, {\n writeFile: (path, contents) => {\n return fs.promises.writeFile(path, contents, \"utf-8\");\n },\n mkdir: async (path, options) => {\n await fs.promises.mkdir(path, options);\n }\n }, args.outDir, args.packageType);\n } else {\n await generateClientSdkVersionOneDotOne(ontology, {\n writeFile: (path, contents) => {\n return fs.promises.writeFile(path, contents, \"utf-8\");\n },\n mkdir: async (path, options) => {\n await fs.promises.mkdir(path, options);\n }\n }, args.outDir, args.packageType);\n }\n}"]}
@@ -0,0 +1,35 @@
1
+ 'use strict';
2
+
3
+ var chunkZ6SJPM6K_cjs = require('./chunk-Z6SJPM6K.cjs');
4
+ require('./chunk-X6QW63OH.cjs');
5
+ var requests = require('@osdk/gateway/requests');
6
+ var generator = require('@osdk/generator');
7
+ var shared_net = require('@osdk/shared.net');
8
+ var consola = require('consola');
9
+ var a = require('fs');
10
+
11
+ function _interopNamespace(e) {
12
+ if (e && e.__esModule) return e;
13
+ var n = Object.create(null);
14
+ if (e) {
15
+ Object.keys(e).forEach(function (k) {
16
+ if (k !== 'default') {
17
+ var d = Object.getOwnPropertyDescriptor(e, k);
18
+ Object.defineProperty(n, k, d.get ? d : {
19
+ enumerable: true,
20
+ get: function () { return e[k]; }
21
+ });
22
+ }
23
+ });
24
+ }
25
+ n.default = e;
26
+ return Object.freeze(n);
27
+ }
28
+
29
+ var a__namespace = /*#__PURE__*/_interopNamespace(a);
30
+
31
+ async function y(t){if(t.ontologyPath)await h(t);else if(t.stack&&t.clientId)await F(t);else throw new Error("Must have specified ontologyPath or stack and clientId");consola.consola.info("OSDK Generated!");}async function h(t){let e=JSON.parse(await a__namespace.promises.readFile(t.ontologyPath,"utf-8"));await d(e,t);}async function F(t){let{stack:e,clientId:o}=t,i=await chunkZ6SJPM6K_cjs.a({applicationId:o,baseUrl:e,verbose:0}),{fetch:l}=shared_net.createClientContext({metadata:{userAgent:"@osdk/cli/0.0.0 ()"}},t.stack,()=>i.access_token);try{let n=await requests.listOntologiesV2(shared_net.createOpenApiRequest(e,l));n.data.length!==1&&consola.consola.error(`Could not look up ontology with these credentials. Found ${n.data.length} ontologies.`);let f=await requests.getOntologyFullMetadata(shared_net.createOpenApiRequest(e,l),n.data[0].apiName);await d(f,t);}catch(n){consola.consola.error("Failed to download the ontology",n);}}async function d(t,e){e.beta?await generator.generateClientSdkVersionTwoPointZero(t,{writeFile:(o,i)=>a__namespace.promises.writeFile(o,i,"utf-8"),mkdir:async(o,i)=>{await a__namespace.promises.mkdir(o,i);}},e.outDir,e.packageType):await generator.generateClientSdkVersionOneDotOne(t,{writeFile:(o,i)=>a__namespace.promises.writeFile(o,i,"utf-8"),mkdir:async(o,i)=>{await a__namespace.promises.mkdir(o,i);}},e.outDir,e.packageType);}
32
+
33
+ module.exports = y;
34
+ //# sourceMappingURL=out.js.map
35
+ //# sourceMappingURL=handleGenerate-6FGD7TOT.cjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../src/commands/typescript/generate/handleGenerate.mts"],"names":["getOntologyFullMetadata","listOntologiesV2","generateClientSdkVersionOneDotOne","generateClientSdkVersionTwoPointZero","createClientContext","createOpenApiRequest","consola","fs","handleGenerate","args","generateFromLocalFile","generateFromStack","ontology","generateClientSdk","stack","clientId","token","invokeLoginFlow","fetch","ontologies","e","path","contents","options"],"mappings":"sEAgBA,OAAS,2BAAAA,EAAyB,oBAAAC,MAAwB,yBAC1D,OAAS,qCAAAC,EAAmC,wCAAAC,MAA4C,kBACxF,OAAS,uBAAAC,EAAqB,wBAAAC,MAA4B,mBAC1D,OAAS,WAAAC,MAAe,UACxB,UAAYC,MAAQ,KAEpB,eAAOC,EAAsCC,EAAM,CACjD,GAAIA,EAAK,aACP,MAAMC,EAAsBD,CAAI,UACvBA,EAAK,OAASA,EAAK,SAC5B,MAAME,EAAkBF,CAAI,MAE5B,OAAM,IAAI,MAAM,wDAAwD,EAE1EH,EAAQ,KAAK,iBAAiB,CAChC,CACA,eAAeI,EAAsBD,EAAM,CACzC,IAAMG,EAAW,KAAK,MAAM,MAAS,WAAS,SAASH,EAAK,aAAc,OAAO,CAAC,EAClF,MAAMI,EAAkBD,EAAUH,CAAI,CACxC,CACA,eAAeE,EAAkBF,EAAM,CACrC,GAAM,CACJ,MAAAK,EACA,SAAAC,CACF,EAAIN,EACEO,EAAQ,MAAMC,EAAgB,CAClC,cAAeF,EACf,QAASD,EACT,QAAS,CACX,CAAC,EACK,CACJ,MAAAI,CACF,EAAId,EAAoB,CACtB,SAAU,CACR,UAAW,oBACb,CACF,EAAGK,EAAK,MAAO,IAAMO,EAAM,YAAY,EACvC,GAAI,CACF,IAAMG,EAAa,MAAMlB,EAAiBI,EAAqBS,EAAOI,CAAK,CAAC,EACxEC,EAAW,KAAK,SAAW,GAC7Bb,EAAQ,MAAM,4DAA4Da,EAAW,KAAK,MAAM,cAAc,EAEhH,IAAMP,EAAW,MAAMZ,EAAwBK,EAAqBS,EAAOI,CAAK,EAAGC,EAAW,KAAK,CAAC,EAAE,OAAO,EAC7G,MAAMN,EAAkBD,EAAUH,CAAI,CACxC,OAASW,EAAG,CACVd,EAAQ,MAAM,kCAAmCc,CAAC,CACpD,CACF,CACA,eAAeP,EAAkBD,EAAUH,EAAM,CAC3CA,EAAK,KACP,MAAMN,EAAqCS,EAAU,CACnD,UAAW,CAACS,EAAMC,IACN,WAAS,UAAUD,EAAMC,EAAU,OAAO,EAEtD,MAAO,MAAOD,EAAME,IAAY,CAC9B,MAAS,WAAS,MAAMF,EAAME,CAAO,CACvC,CACF,EAAGd,EAAK,OAAQA,EAAK,WAAW,EAEhC,MAAMP,EAAkCU,EAAU,CAChD,UAAW,CAACS,EAAMC,IACN,WAAS,UAAUD,EAAMC,EAAU,OAAO,EAEtD,MAAO,MAAOD,EAAME,IAAY,CAC9B,MAAS,WAAS,MAAMF,EAAME,CAAO,CACvC,CACF,EAAGd,EAAK,OAAQA,EAAK,WAAW,CAEpC","sourcesContent":["/*\n * Copyright 2023 Palantir Technologies, Inc. All rights reserved.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport { getOntologyFullMetadata, listOntologiesV2 } from \"@osdk/gateway/requests\";\nimport { generateClientSdkVersionOneDotOne, generateClientSdkVersionTwoPointZero } from \"@osdk/generator\";\nimport { createClientContext, createOpenApiRequest } from \"@osdk/shared.net\";\nimport { consola } from \"consola\";\nimport * as fs from \"node:fs\";\nimport invokeLoginFlow from \"../../auth/login/loginFlow.js\";\nexport default async function handleGenerate(args) {\n if (args.ontologyPath) {\n await generateFromLocalFile(args);\n } else if (args.stack && args.clientId) {\n await generateFromStack(args);\n } else {\n throw new Error(\"Must have specified ontologyPath or stack and clientId\");\n }\n consola.info(\"OSDK Generated!\");\n}\nasync function generateFromLocalFile(args) {\n const ontology = JSON.parse(await fs.promises.readFile(args.ontologyPath, \"utf-8\"));\n await generateClientSdk(ontology, args);\n}\nasync function generateFromStack(args) {\n const {\n stack,\n clientId\n } = args;\n const token = await invokeLoginFlow({\n applicationId: clientId,\n baseUrl: stack,\n verbose: 0\n });\n const {\n fetch\n } = createClientContext({\n metadata: {\n userAgent: \"@osdk/cli/0.0.0 ()\"\n }\n }, args.stack, () => token.access_token);\n try {\n const ontologies = await listOntologiesV2(createOpenApiRequest(stack, fetch));\n if (ontologies.data.length !== 1) {\n consola.error(`Could not look up ontology with these credentials. Found ${ontologies.data.length} ontologies.`);\n }\n const ontology = await getOntologyFullMetadata(createOpenApiRequest(stack, fetch), ontologies.data[0].apiName);\n await generateClientSdk(ontology, args);\n } catch (e) {\n consola.error(\"Failed to download the ontology\", e);\n }\n}\nasync function generateClientSdk(ontology, args) {\n if (args.beta) {\n await generateClientSdkVersionTwoPointZero(ontology, {\n writeFile: (path, contents) => {\n return fs.promises.writeFile(path, contents, \"utf-8\");\n },\n mkdir: async (path, options) => {\n await fs.promises.mkdir(path, options);\n }\n }, args.outDir, args.packageType);\n } else {\n await generateClientSdkVersionOneDotOne(ontology, {\n writeFile: (path, contents) => {\n return fs.promises.writeFile(path, contents, \"utf-8\");\n },\n mkdir: async (path, options) => {\n await fs.promises.mkdir(path, options);\n }\n }, args.outDir, args.packageType);\n }\n}"]}
@@ -2,9 +2,9 @@
2
2
 
3
3
  var chunkV4QJCMF6_cjs = require('./chunk-V4QJCMF6.cjs');
4
4
  require('./chunk-X6QW63OH.cjs');
5
- var V = require('yargs');
5
+ var D = require('yargs');
6
6
  var helpers = require('yargs/helpers');
7
- var p = require('fs');
7
+ var u = require('fs');
8
8
 
9
9
  var _documentCurrentScript = typeof document !== 'undefined' ? document.currentScript : null;
10
10
  function _interopDefault (e) { return e && e.__esModule ? e : { default: e }; }
@@ -27,11 +27,11 @@ function _interopNamespace(e) {
27
27
  return Object.freeze(n);
28
28
  }
29
29
 
30
- var V__default = /*#__PURE__*/_interopDefault(V);
31
- var p__namespace = /*#__PURE__*/_interopNamespace(p);
30
+ var D__default = /*#__PURE__*/_interopDefault(D);
31
+ var u__namespace = /*#__PURE__*/_interopNamespace(u);
32
32
 
33
- var g={command:"delete",describe:"Delete an uploaded version",builder:e=>e.option("siteVersion",{type:"string",demandOption:!0}).option("dir",{type:"string"}),handler:async e=>{await(await import('./siteDeleteCommand-NY5W7NE3.cjs')).default(e);}},r=g;var y={command:"deploy",describe:"Deploy an uploaded version",builder:e=>e.options({siteVersion:{type:"string",conflicts:"clearVersion"},undeploy:{alias:"clearVersion",description:"Causes the site to no longer be deployed",type:"boolean",conflicts:"siteVersion"}}).group(["siteVersion","clearVersion"],"Version To Deploy (requires one of)"),handler:async e=>{await(await import('./handleSiteDeploy-257ZNTYA.cjs')).default(e);}},a=y;var b={command:"upload",describe:"Upload an application version",builder:e=>e.option("siteVersion",{type:"string",demandOption:!0}).option("dir",{type:"string"}),handler:async e=>{await(await import('./siteUploadCommand-OHSOCUL6.cjs')).default(e);}},i=b;var w={command:"versions",describe:"List application versions",builder:e=>e,handler:async e=>{await(await import('./siteVersionsCommand-IE5QH56U.cjs')).default(e);}},s=w;var v={command:"site",describe:"Manage your site",builder:e=>e.options({appRid:{type:"string",demandOption:!0,coerce:n=>n},baseUrl:{type:"string",demandOption:!0}}).group(["appRid","baseUrl"],"Common Arguments").command(s).command(i).command(r).command(a).demandCommand(),handler:async e=>{}},d=v;var h={command:"generate",describe:"Generate typescript from ontology",builder:e=>e.options({outDir:{type:"string",description:"Where to place the generated files",demandOption:!0},ontologyPath:{description:"path to the ontology wire json",type:"string",demandOption:!0},beta:{type:"boolean",description:"Should generate beta sdk",demandOption:!1},packageType:{default:"commonjs",choices:["commonjs","module"]}}).group(["outDir","ontologyPath"],"Version To Deploy (requires one of)"),handler:async e=>{await(await import('./handleGenerate-XM72AL6J.cjs')).default(e);}},m=h;var x={command:"typescript",describe:"Manage code",builder:e=>e.command(m).demandCommand(),handler:async e=>{}},c=x;async function l(){let{findUp:e}=await import('find-up'),n=await e("package.json",{cwd:(typeof document === 'undefined' ? require('u' + 'rl').pathToFileURL(__filename).href : (_documentCurrentScript && _documentCurrentScript.src || new URL('out.js', document.baseURI).href))});if(!n)return "(unknown version. No package.json found)";let o=JSON.parse(await p__namespace.promises.readFile(n,"utf-8"));return o.version?`v${o.version}`:"(unknown version. No version in package.json found)"}var u=!0;async function f(e){if(u){let o=(await import('consola')).consola;o.info(`Palantir OSDK CLI ${await l()}`),o.level=3+e.verbose,o.level>3&&o.debug(`Verbose logging enabled (${o.level===4?"debug":"trace"})`),console.log(),u=!1;}}async function k(e=process.argv){let n=V__default.default(helpers.hideBin(e)).env("OSDK").version(!1).option("verbose",{alias:"v",type:"boolean",description:"Enable verbose logging",count:!0}).demandCommand().middleware(f,!0).strict().command({command:"unstable",aliases:["experimental"],builder:async o=>o.command(d).command(c).demandCommand(),handler:o=>{}});try{return n.parseAsync()}catch(o){o instanceof chunkV4QJCMF6_cjs.a&&(await import('consola')).consola.error(o.message);}}
33
+ var b={command:"login",describe:"Authenticate with an application ID",builder:e=>e.option("applicationId",{type:"string",demandOption:!0}),handler:async e=>{await(await import('./loginFlow-MPM6J3CY.cjs')).default(e);}},a=b;var h={command:"auth",describe:"Manage your session",builder:e=>e.options({baseUrl:{type:"string",demandOption:!0}}).command(a).demandCommand(),handler:async e=>{}},r=h;var w={command:"delete",describe:"Delete an uploaded version",builder:e=>e.option("siteVersion",{type:"string",demandOption:!0}).option("dir",{type:"string"}),handler:async e=>{await(await import('./siteDeleteCommand-NY5W7NE3.cjs')).default(e);}},i=w;var v={command:"deploy",describe:"Deploy an uploaded version",builder:e=>e.options({siteVersion:{type:"string",conflicts:"clearVersion"},undeploy:{alias:"clearVersion",description:"Causes the site to no longer be deployed",type:"boolean",conflicts:"siteVersion"}}).group(["siteVersion","clearVersion"],"Version To Deploy (requires one of)"),handler:async e=>{await(await import('./handleSiteDeploy-257ZNTYA.cjs')).default(e);}},s=v;var x={command:"upload",describe:"Upload an application version",builder:e=>e.option("siteVersion",{type:"string",demandOption:!0}).option("dir",{type:"string"}),handler:async e=>{await(await import('./siteUploadCommand-OHSOCUL6.cjs')).default(e);}},d=x;var k={command:"versions",describe:"List application versions",builder:e=>e,handler:async e=>{await(await import('./siteVersionsCommand-IE5QH56U.cjs')).default(e);}},c=k;var O={command:"site",describe:"Manage your site",builder:e=>e.options({appRid:{type:"string",demandOption:!0,coerce:o=>o},baseUrl:{type:"string",demandOption:!0}}).group(["appRid","baseUrl"],"Common Arguments").command(c).command(d).command(i).command(s).demandCommand(),handler:async e=>{}},m=O;var C={command:"generate",describe:"Generate typescript from ontology",builder:e=>e.options({outDir:{type:"string",description:"Where to place the generated files",demandOption:!0},ontologyPath:{description:"path to the ontology wire json",type:"string",demandOption:!1,conflicts:["stack","clientId"]},stack:{description:"the URL to the stack that contains the ontology",type:"string",demandOption:!1,conflicts:"ontologyPath",implies:"clientId"},clientId:{description:"the application's client id",type:"string",demandOption:!1,conflicts:"ontologyPath",implies:"stack"},beta:{type:"boolean",description:"Should generate beta sdk",demandOption:!1},packageType:{default:"commonjs",choices:["commonjs","module"]}}).group(["ontologyPath","outDir"],"Generate from a local file").group(["stack","clientId","outDir"],"OR Generate from a stack").check(o=>{if(o.ontologyPath||o.stack)return !0;throw new Error("Error: Must specify either ontologyPath or stack and clientId")}),handler:async e=>{await(await import('./handleGenerate-6FGD7TOT.cjs')).default(e);}},l=C;var V={command:"typescript",describe:"Manage code",builder:e=>e.command(l).demandCommand(),handler:async e=>{}},p=V;async function f(){let{findUp:e}=await import('find-up'),o=await e("package.json",{cwd:(typeof document === 'undefined' ? require('u' + 'rl').pathToFileURL(__filename).href : (_documentCurrentScript && _documentCurrentScript.src || new URL('out.js', document.baseURI).href))});if(!o)return "(unknown version. No package.json found)";let t=JSON.parse(await u__namespace.promises.readFile(o,"utf-8"));return t.version?`v${t.version}`:"(unknown version. No version in package.json found)"}var g=!0;async function y(e){if(g){let t=(await import('consola')).consola;t.info(`Palantir OSDK CLI ${await f()}`),t.level=3+e.verbose,t.level>3&&t.debug(`Verbose logging enabled (${t.level===4?"debug":"trace"})`),console.log(),g=!1;}}async function I(e=process.argv){let o=D__default.default(helpers.hideBin(e)).env("OSDK").version(!1).option("verbose",{alias:"v",type:"boolean",description:"Enable verbose logging",count:!0}).demandCommand().middleware(y,!0).strict().command({command:"unstable",aliases:["experimental"],builder:async t=>t.command(m).command(p).command(r).demandCommand(),handler:t=>{}});try{return o.parseAsync()}catch(t){t instanceof chunkV4QJCMF6_cjs.a&&(await import('consola')).consola.error(t.message);}}
34
34
 
35
- exports.cli = k;
35
+ exports.cli = I;
36
36
  //# sourceMappingURL=out.js.map
37
37
  //# sourceMappingURL=index.cjs.map
@@ -1 +1 @@
1
- {"version":3,"sources":["../../src/cli.ts","../../src/commands/site/delete/index.ts","../../src/commands/site/deploy/index.ts","../../src/commands/site/upload/index.ts","../../src/commands/site/versions/index.ts","../../src/commands/site/index.ts","../../src/commands/typescript/generate/generate.ts","../../src/commands/typescript/index.ts","../../src/readCliVersionFromPackageJson.ts","../../src/yargs/logVersionMiddleware.ts"],"names":["yargs","hideBin","command","argv","args","delete_default","deploy_default","upload_default","versions_default","site","a","site_default","generate_default","typescript_default","fs","readCliVersionFromPackageJson","findUp","result","packageJson","firstTime","logVersionMiddleware","consola","cli","base","_args","e","ExitProcessError"],"mappings":"sEAgBA,OAAOA,MAAW,QAClB,OAAS,WAAAC,MAAe,gBCDjB,IAAMC,EAAU,CACrB,QAAS,SACT,SAAU,6BACV,QAASC,GACAA,EAAK,OAAO,cAAe,CAChC,KAAM,SACN,aAAc,EAChB,CAAC,EAAE,OAAO,MAAO,CACf,KAAM,QACR,CAAC,EAEH,QAAS,MAAMC,GAAQ,CAErB,MADgB,KAAM,QAAO,kCAAyB,GACxC,QAAQA,CAAI,CAC5B,CACF,EACOC,EAAQH,EChBR,IAAMA,EAAU,CACrB,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,QAAQ,EAAK,EAAE,OAAO,UAAW,CAC7E,MAAO,IACP,KAAM,UACN,YAAa,yBACb,MAAO,EACT,CAAC,EAAE,cAAc,EAAE,WAAWgB,EAAsB,EAAI,EAAE,OAAO,EAAE,QAAQ,CACzE,QAAS,WACT,QAAS,CAAC,cAAc,EACxB,QAAS,MAAMjB,GACNA,EAAK,QAAQQ,CAAI,EAAE,QAAQE,CAAU,EAAE,cAAc,EAE9D,QAASW,GAAS,CAAC,CACrB,CAAC,EACD,GAAI,CACF,OAAOD,EAAK,WAAW,CACzB,OAASE,EAAG,CACNA,aAAaC,IACC,KAAM,QAAO,SAAS,GAC9B,QAAQ,MAAMD,EAAE,OAAO,CAEnC,CACF","sourcesContent":["/*\n * Copyright 2023 Palantir Technologies, Inc. All rights reserved.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport yargs from \"yargs\";\nimport { hideBin } from \"yargs/helpers\";\nimport site from \"./commands/site/index.js\";\nimport typescript from \"./commands/typescript/index.js\";\nimport { ExitProcessError } from \"./ExitProcessError.js\";\nimport { logVersionMiddleware } from \"./yargs/logVersionMiddleware.js\";\nexport async function cli(args = process.argv) {\n const base = yargs(hideBin(args)).env(\"OSDK\").version(false).option(\"verbose\", {\n alias: \"v\",\n type: \"boolean\",\n description: \"Enable verbose logging\",\n count: true\n }).demandCommand().middleware(logVersionMiddleware, true).strict().command({\n command: \"unstable\",\n aliases: [\"experimental\"],\n builder: async argv => {\n return argv.command(site).command(typescript).demandCommand();\n },\n handler: _args => {}\n });\n try {\n return base.parseAsync();\n } catch (e) {\n if (e instanceof ExitProcessError) {\n const Consola = await import(\"consola\");\n Consola.consola.error(e.message);\n }\n }\n}","/*\n * Copyright 2023 Palantir Technologies, Inc. All rights reserved.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nexport const command = {\n command: \"delete\",\n describe: \"Delete an uploaded version\",\n builder: argv => {\n return argv.option(\"siteVersion\", {\n type: \"string\",\n demandOption: true\n }).option(\"dir\", {\n type: \"string\"\n });\n },\n handler: async args => {\n const command = await import(\"./siteDeleteCommand.mjs\");\n await command.default(args);\n }\n};\nexport default command;","/*\n * Copyright 2023 Palantir Technologies, Inc. All rights reserved.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nexport const command = {\n command: \"deploy\",\n describe: \"Deploy an uploaded version\",\n builder: argv => {\n return argv.options({\n \"siteVersion\": {\n type: \"string\",\n conflicts: \"clearVersion\"\n // group: \"Deploy Version\",\n // implies: { \"clearVersion\": \"false\" },\n },\n\n undeploy: {\n alias: \"clearVersion\",\n description: \"Causes the site to no longer be deployed\",\n type: \"boolean\",\n conflicts: \"siteVersion\"\n // group: \"Deploy Version\",\n // implies: { \"siteVersion\": \"\" },\n }\n }).group([\"siteVersion\", \"clearVersion\"], \"Version To Deploy (requires one of)\");\n\n // .check((args) => {\n // if (\n // (args.siteVersion && args.clearVersion)\n // || (!args.siteVersion && args.clearVersion == undefined)\n // ) {\n // // consola.error(\"Only one of --siteVersion or --clearVersion may be provided\");\n // throw new Error(\n // \"Only one of --siteVersion or --clearVersion may be provided\",\n // );\n // }\n // });\n },\n\n handler: async args => {\n const command = await import(\"./handleSiteDeploy.mjs\");\n await command.default(args);\n }\n};\nexport default command;","/*\n * Copyright 2023 Palantir Technologies, Inc. All rights reserved.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nexport const command = {\n command: \"upload\",\n describe: \"Upload an application version\",\n builder: argv => {\n return argv.option(\"siteVersion\", {\n type: \"string\",\n demandOption: true\n }).option(\"dir\", {\n type: \"string\"\n });\n },\n handler: async args => {\n const command = await import(\"./siteUploadCommand.mjs\");\n await command.default(args);\n }\n};\nexport default command;","/*\n * Copyright 2023 Palantir Technologies, Inc. All rights reserved.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nexport const command = {\n command: \"versions\",\n describe: \"List application versions\",\n builder: argv => {\n return argv;\n },\n handler: async args => {\n const command = await import(\"./siteVersionsCommand.mjs\");\n await command.default(args);\n }\n};\nexport default command;","/*\n * Copyright 2023 Palantir Technologies, Inc. All rights reserved.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport siteDelete from \"./delete/index.js\";\nimport siteDeploy from \"./deploy/index.js\";\nimport upload from \"./upload/index.js\";\nimport versions from \"./versions/index.js\";\nconst site = {\n command: \"site\",\n describe: \"Manage your site\",\n builder: argv => {\n return argv.options({\n appRid: {\n type: \"string\",\n demandOption: true,\n coerce: a => a\n },\n baseUrl: {\n type: \"string\",\n demandOption: true\n }\n }).group([\"appRid\", \"baseUrl\"], \"Common Arguments\").command(versions).command(upload).command(siteDelete).command(siteDeploy).demandCommand();\n },\n handler: async args => {}\n};\nexport default site;","/*\n * Copyright 2023 Palantir Technologies, Inc. All rights reserved.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nexport const command = {\n command: \"generate\",\n describe: \"Generate typescript from ontology\",\n builder: argv => {\n return argv.options({\n \"outDir\": {\n type: \"string\",\n description: \"Where to place the generated files\",\n demandOption: true\n },\n ontologyPath: {\n description: \"path to the ontology wire json\",\n type: \"string\",\n demandOption: true\n },\n beta: {\n type: \"boolean\",\n description: \"Should generate beta sdk\",\n demandOption: false\n },\n packageType: {\n default: \"commonjs\",\n choices: [\"commonjs\", \"module\"]\n }\n }).group([\"outDir\", \"ontologyPath\"], \"Version To Deploy (requires one of)\");\n },\n handler: async args => {\n const command = await import(\"./handleGenerate.mjs\");\n await command.default(args);\n }\n};\nexport default command;","/*\n * Copyright 2023 Palantir Technologies, Inc. All rights reserved.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport generate from \"./generate/generate.js\";\nconst site = {\n command: \"typescript\",\n describe: \"Manage code\",\n builder: argv => {\n return argv.command(generate).demandCommand();\n },\n handler: async args => {}\n};\nexport default site;","/*\n * Copyright 2023 Palantir Technologies, Inc. All rights reserved.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport * as fs from \"node:fs\";\nexport async function readCliVersionFromPackageJson() {\n const {\n findUp\n } = await import(\"find-up\");\n const result = await findUp(\"package.json\", {\n cwd: import.meta.url\n });\n if (!result) {\n return \"(unknown version. No package.json found)\";\n }\n const packageJson = JSON.parse(await fs.promises.readFile(result, \"utf-8\"));\n if (packageJson.version) {\n return `v${packageJson.version}`;\n } else {\n return \"(unknown version. No version in package.json found)\";\n }\n}","/*\n * Copyright 2023 Palantir Technologies, Inc. All rights reserved.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport { readCliVersionFromPackageJson } from \"../readCliVersionFromPackageJson.js\";\nlet firstTime = true;\nexport async function logVersionMiddleware(args) {\n if (firstTime) {\n const Consola = await import(\"consola\");\n // This will be called before any command is executed\n const consola = Consola.consola;\n consola.info(`Palantir OSDK CLI ${await readCliVersionFromPackageJson()}`);\n consola.level = 3 + args.verbose; // so 1 -v is debug logs and -vv is trace\n if (consola.level > 3) {\n consola.debug(`Verbose logging enabled (${consola.level === 4 ? \"debug\" : \"trace\"})`);\n }\n\n // eslint-disable-next-line no-console\n console.log(); // Not consola. Just want a blank line\n firstTime = false;\n }\n}"]}
1
+ {"version":3,"sources":["../../src/cli.ts","../../src/commands/auth/login/index.ts","../../src/commands/auth/index.ts","../../src/commands/site/delete/index.ts","../../src/commands/site/deploy/index.ts","../../src/commands/site/upload/index.ts","../../src/commands/site/versions/index.ts","../../src/commands/site/index.ts","../../src/commands/typescript/generate/generate.ts","../../src/commands/typescript/index.ts","../../src/readCliVersionFromPackageJson.ts","../../src/yargs/logVersionMiddleware.ts"],"names":["yargs","hideBin","command","argv","args","login_default","site","auth_default","delete_default","deploy_default","upload_default","versions_default","a","site_default","generate_default","typescript_default","fs","readCliVersionFromPackageJson","findUp","result","packageJson","firstTime","logVersionMiddleware","consola","cli","base","_args","e","ExitProcessError"],"mappings":"sEAgBA,OAAOA,MAAW,QAClB,OAAS,WAAAC,MAAe,gBCDjB,IAAMC,EAAU,CACrB,QAAS,QACT,SAAU,sCACV,QAASC,GACAA,EAAK,OAAO,gBAAiB,CAClC,KAAM,SACN,aAAc,EAChB,CAAC,EAEH,QAAS,MAAMC,GAAQ,CAErB,MADgB,KAAM,QAAO,0BAAgB,GAC/B,QAAQA,CAAI,CAC5B,CACF,EACOC,EAAQH,ECbf,IAAMI,EAAO,CACX,QAAS,OACT,SAAU,sBACV,QAASH,GACAA,EAAK,QAAQ,CAClB,QAA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Technologies, Inc. All rights reserved.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport yargs from \"yargs\";\nimport { hideBin } from \"yargs/helpers\";\nimport auth from \"./commands/auth/index.js\";\nimport site from \"./commands/site/index.js\";\nimport typescript from \"./commands/typescript/index.js\";\nimport { ExitProcessError } from \"./ExitProcessError.js\";\nimport { logVersionMiddleware } from \"./yargs/logVersionMiddleware.js\";\nexport async function cli(args = process.argv) {\n const base = yargs(hideBin(args)).env(\"OSDK\").version(false).option(\"verbose\", {\n alias: \"v\",\n type: \"boolean\",\n description: \"Enable verbose logging\",\n count: true\n }).demandCommand().middleware(logVersionMiddleware, true).strict().command({\n command: \"unstable\",\n aliases: [\"experimental\"],\n builder: async argv => {\n return argv.command(site).command(typescript).command(auth).demandCommand();\n },\n handler: _args => {}\n });\n try {\n return base.parseAsync();\n } catch (e) {\n if (e instanceof ExitProcessError) {\n const Consola = await import(\"consola\");\n Consola.consola.error(e.message);\n }\n }\n}","/*\n * Copyright 2023 Palantir Technologies, Inc. All rights reserved.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nexport const command = {\n command: \"login\",\n describe: \"Authenticate with an application ID\",\n builder: argv => {\n return argv.option(\"applicationId\", {\n type: \"string\",\n demandOption: true\n });\n },\n handler: async args => {\n const command = await import(\"./loginFlow.js\");\n await command.default(args);\n }\n};\nexport default command;","/*\n * Copyright 2023 Palantir Technologies, Inc. All rights reserved.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport login from \"./login/index.js\";\nconst site = {\n command: \"auth\",\n describe: \"Manage your session\",\n builder: argv => {\n return argv.options({\n baseUrl: {\n type: \"string\",\n demandOption: true\n }\n }).command(login).demandCommand();\n },\n handler: async args => {}\n};\nexport default site;","/*\n * Copyright 2023 Palantir Technologies, Inc. All rights reserved.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nexport const command = {\n command: \"delete\",\n describe: \"Delete an uploaded version\",\n builder: argv => {\n return argv.option(\"siteVersion\", {\n type: \"string\",\n demandOption: true\n }).option(\"dir\", {\n type: \"string\"\n });\n },\n handler: async args => {\n const command = await import(\"./siteDeleteCommand.mjs\");\n await command.default(args);\n }\n};\nexport default command;","/*\n * Copyright 2023 Palantir Technologies, Inc. All rights reserved.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nexport const command = {\n command: \"deploy\",\n describe: \"Deploy an uploaded version\",\n builder: argv => {\n return argv.options({\n \"siteVersion\": {\n type: \"string\",\n conflicts: \"clearVersion\"\n // group: \"Deploy Version\",\n // implies: { \"clearVersion\": \"false\" },\n },\n\n undeploy: {\n alias: \"clearVersion\",\n description: \"Causes the site to no longer be deployed\",\n type: \"boolean\",\n conflicts: \"siteVersion\"\n // group: \"Deploy Version\",\n // implies: { \"siteVersion\": \"\" },\n }\n }).group([\"siteVersion\", \"clearVersion\"], \"Version To Deploy (requires one of)\");\n\n // .check((args) => {\n // if (\n // (args.siteVersion && args.clearVersion)\n // || (!args.siteVersion && args.clearVersion == undefined)\n // ) {\n // // consola.error(\"Only one of --siteVersion or --clearVersion may be provided\");\n // throw new Error(\n // \"Only one of --siteVersion or --clearVersion may be provided\",\n // );\n // }\n // });\n },\n\n handler: async args => {\n const command = await import(\"./handleSiteDeploy.mjs\");\n await command.default(args);\n }\n};\nexport default command;","/*\n * Copyright 2023 Palantir Technologies, Inc. All rights reserved.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nexport const command = {\n command: \"upload\",\n describe: \"Upload an application version\",\n builder: argv => {\n return argv.option(\"siteVersion\", {\n type: \"string\",\n demandOption: true\n }).option(\"dir\", {\n type: \"string\"\n });\n },\n handler: async args => {\n const command = await import(\"./siteUploadCommand.mjs\");\n await command.default(args);\n }\n};\nexport default command;","/*\n * Copyright 2023 Palantir Technologies, Inc. All rights reserved.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nexport const command = {\n command: \"versions\",\n describe: \"List application versions\",\n builder: argv => {\n return argv;\n },\n handler: async args => {\n const command = await import(\"./siteVersionsCommand.mjs\");\n await command.default(args);\n }\n};\nexport default command;","/*\n * Copyright 2023 Palantir Technologies, Inc. All rights reserved.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport siteDelete from \"./delete/index.js\";\nimport siteDeploy from \"./deploy/index.js\";\nimport upload from \"./upload/index.js\";\nimport versions from \"./versions/index.js\";\nconst site = {\n command: \"site\",\n describe: \"Manage your site\",\n builder: argv => {\n return argv.options({\n appRid: {\n type: \"string\",\n demandOption: true,\n coerce: a => a\n },\n baseUrl: {\n type: \"string\",\n demandOption: true\n }\n }).group([\"appRid\", \"baseUrl\"], \"Common Arguments\").command(versions).command(upload).command(siteDelete).command(siteDeploy).demandCommand();\n },\n handler: async args => {}\n};\nexport default site;","/*\n * Copyright 2023 Palantir Technologies, Inc. All rights reserved.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nexport const command = {\n command: \"generate\",\n describe: \"Generate typescript from ontology\",\n builder: argv => {\n return argv.options({\n \"outDir\": {\n type: \"string\",\n description: \"Where to place the generated files\",\n demandOption: true\n },\n ontologyPath: {\n description: \"path to the ontology wire json\",\n type: \"string\",\n demandOption: false,\n conflicts: [\"stack\", \"clientId\"]\n },\n stack: {\n description: \"the URL to the stack that contains the ontology\",\n type: \"string\",\n demandOption: false,\n conflicts: \"ontologyPath\",\n implies: \"clientId\"\n },\n clientId: {\n description: \"the application's client id\",\n type: \"string\",\n demandOption: false,\n conflicts: \"ontologyPath\",\n implies: \"stack\"\n },\n beta: {\n type: \"boolean\",\n description: \"Should generate beta sdk\",\n demandOption: false\n },\n packageType: {\n default: \"commonjs\",\n choices: [\"commonjs\", \"module\"]\n }\n }).group([\"ontologyPath\", \"outDir\"], \"Generate from a local file\").group([\"stack\", \"clientId\", \"outDir\"], \"OR Generate from a stack\").check(argv => {\n if (argv.ontologyPath || argv.stack) {\n return true;\n } else {\n throw new Error(\"Error: Must specify either ontologyPath or stack and clientId\");\n }\n });\n },\n handler: async args => {\n const command = await import(\"./handleGenerate.mjs\");\n await command.default(args);\n }\n};\nexport default command;","/*\n * Copyright 2023 Palantir Technologies, Inc. All rights reserved.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport generate from \"./generate/generate.js\";\nconst site = {\n command: \"typescript\",\n describe: \"Manage code\",\n builder: argv => {\n return argv.command(generate).demandCommand();\n },\n handler: async args => {}\n};\nexport default site;","/*\n * Copyright 2023 Palantir Technologies, Inc. All rights reserved.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport * as fs from \"node:fs\";\nexport async function readCliVersionFromPackageJson() {\n const {\n findUp\n } = await import(\"find-up\");\n const result = await findUp(\"package.json\", {\n cwd: import.meta.url\n });\n if (!result) {\n return \"(unknown version. No package.json found)\";\n }\n const packageJson = JSON.parse(await fs.promises.readFile(result, \"utf-8\"));\n if (packageJson.version) {\n return `v${packageJson.version}`;\n } else {\n return \"(unknown version. No version in package.json found)\";\n }\n}","/*\n * Copyright 2023 Palantir Technologies, Inc. All rights reserved.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport { readCliVersionFromPackageJson } from \"../readCliVersionFromPackageJson.js\";\nlet firstTime = true;\nexport async function logVersionMiddleware(args) {\n if (firstTime) {\n const Consola = await import(\"consola\");\n // This will be called before any command is executed\n const consola = Consola.consola;\n consola.info(`Palantir OSDK CLI ${await readCliVersionFromPackageJson()}`);\n consola.level = 3 + args.verbose; // so 1 -v is debug logs and -vv is trace\n if (consola.level > 3) {\n consola.debug(`Verbose logging enabled (${consola.level === 4 ? \"debug\" : \"trace\"})`);\n }\n\n // eslint-disable-next-line no-console\n console.log(); // Not consola. Just want a blank line\n firstTime = false;\n }\n}"]}
@@ -1,11 +1,11 @@
1
1
  import { a as a$1 } from './chunk-MGT3UGXW.mjs';
2
2
  import './chunk-XIJ2ZQRX.mjs';
3
- import V from 'yargs';
3
+ import D from 'yargs';
4
4
  import { hideBin } from 'yargs/helpers';
5
- import * as p from 'fs';
5
+ import * as u from 'fs';
6
6
 
7
- var g={command:"delete",describe:"Delete an uploaded version",builder:e=>e.option("siteVersion",{type:"string",demandOption:!0}).option("dir",{type:"string"}),handler:async e=>{await(await import('./siteDeleteCommand-ZKHKGVVF.mjs')).default(e);}},r=g;var y={command:"deploy",describe:"Deploy an uploaded version",builder:e=>e.options({siteVersion:{type:"string",conflicts:"clearVersion"},undeploy:{alias:"clearVersion",description:"Causes the site to no longer be deployed",type:"boolean",conflicts:"siteVersion"}}).group(["siteVersion","clearVersion"],"Version To Deploy (requires one of)"),handler:async e=>{await(await import('./handleSiteDeploy-QCMJWAYI.mjs')).default(e);}},a=y;var b={command:"upload",describe:"Upload an application version",builder:e=>e.option("siteVersion",{type:"string",demandOption:!0}).option("dir",{type:"string"}),handler:async e=>{await(await import('./siteUploadCommand-PZEJVKRE.mjs')).default(e);}},i=b;var w={command:"versions",describe:"List application versions",builder:e=>e,handler:async e=>{await(await import('./siteVersionsCommand-NVJD5BDH.mjs')).default(e);}},s=w;var v={command:"site",describe:"Manage your site",builder:e=>e.options({appRid:{type:"string",demandOption:!0,coerce:n=>n},baseUrl:{type:"string",demandOption:!0}}).group(["appRid","baseUrl"],"Common Arguments").command(s).command(i).command(r).command(a).demandCommand(),handler:async e=>{}},d=v;var h={command:"generate",describe:"Generate typescript from ontology",builder:e=>e.options({outDir:{type:"string",description:"Where to place the generated files",demandOption:!0},ontologyPath:{description:"path to the ontology wire json",type:"string",demandOption:!0},beta:{type:"boolean",description:"Should generate beta sdk",demandOption:!1},packageType:{default:"commonjs",choices:["commonjs","module"]}}).group(["outDir","ontologyPath"],"Version To Deploy (requires one of)"),handler:async e=>{await(await import('./handleGenerate-ZHO53G62.mjs')).default(e);}},m=h;var x={command:"typescript",describe:"Manage code",builder:e=>e.command(m).demandCommand(),handler:async e=>{}},c=x;async function l(){let{findUp:e}=await import('find-up'),n=await e("package.json",{cwd:import.meta.url});if(!n)return "(unknown version. No package.json found)";let o=JSON.parse(await p.promises.readFile(n,"utf-8"));return o.version?`v${o.version}`:"(unknown version. No version in package.json found)"}var u=!0;async function f(e){if(u){let o=(await import('consola')).consola;o.info(`Palantir OSDK CLI ${await l()}`),o.level=3+e.verbose,o.level>3&&o.debug(`Verbose logging enabled (${o.level===4?"debug":"trace"})`),console.log(),u=!1;}}async function k(e=process.argv){let n=V(hideBin(e)).env("OSDK").version(!1).option("verbose",{alias:"v",type:"boolean",description:"Enable verbose logging",count:!0}).demandCommand().middleware(f,!0).strict().command({command:"unstable",aliases:["experimental"],builder:async o=>o.command(d).command(c).demandCommand(),handler:o=>{}});try{return n.parseAsync()}catch(o){o instanceof a$1&&(await import('consola')).consola.error(o.message);}}
7
+ var b={command:"login",describe:"Authenticate with an application ID",builder:e=>e.option("applicationId",{type:"string",demandOption:!0}),handler:async e=>{await(await import('./loginFlow-JIH374QN.mjs')).default(e);}},a=b;var h={command:"auth",describe:"Manage your session",builder:e=>e.options({baseUrl:{type:"string",demandOption:!0}}).command(a).demandCommand(),handler:async e=>{}},r=h;var w={command:"delete",describe:"Delete an uploaded version",builder:e=>e.option("siteVersion",{type:"string",demandOption:!0}).option("dir",{type:"string"}),handler:async e=>{await(await import('./siteDeleteCommand-ZKHKGVVF.mjs')).default(e);}},i=w;var v={command:"deploy",describe:"Deploy an uploaded version",builder:e=>e.options({siteVersion:{type:"string",conflicts:"clearVersion"},undeploy:{alias:"clearVersion",description:"Causes the site to no longer be deployed",type:"boolean",conflicts:"siteVersion"}}).group(["siteVersion","clearVersion"],"Version To Deploy (requires one of)"),handler:async e=>{await(await import('./handleSiteDeploy-QCMJWAYI.mjs')).default(e);}},s=v;var x={command:"upload",describe:"Upload an application version",builder:e=>e.option("siteVersion",{type:"string",demandOption:!0}).option("dir",{type:"string"}),handler:async e=>{await(await import('./siteUploadCommand-PZEJVKRE.mjs')).default(e);}},d=x;var k={command:"versions",describe:"List application versions",builder:e=>e,handler:async e=>{await(await import('./siteVersionsCommand-NVJD5BDH.mjs')).default(e);}},c=k;var O={command:"site",describe:"Manage your site",builder:e=>e.options({appRid:{type:"string",demandOption:!0,coerce:o=>o},baseUrl:{type:"string",demandOption:!0}}).group(["appRid","baseUrl"],"Common Arguments").command(c).command(d).command(i).command(s).demandCommand(),handler:async e=>{}},m=O;var C={command:"generate",describe:"Generate typescript from ontology",builder:e=>e.options({outDir:{type:"string",description:"Where to place the generated files",demandOption:!0},ontologyPath:{description:"path to the ontology wire json",type:"string",demandOption:!1,conflicts:["stack","clientId"]},stack:{description:"the URL to the stack that contains the ontology",type:"string",demandOption:!1,conflicts:"ontologyPath",implies:"clientId"},clientId:{description:"the application's client id",type:"string",demandOption:!1,conflicts:"ontologyPath",implies:"stack"},beta:{type:"boolean",description:"Should generate beta sdk",demandOption:!1},packageType:{default:"commonjs",choices:["commonjs","module"]}}).group(["ontologyPath","outDir"],"Generate from a local file").group(["stack","clientId","outDir"],"OR Generate from a stack").check(o=>{if(o.ontologyPath||o.stack)return !0;throw new Error("Error: Must specify either ontologyPath or stack and clientId")}),handler:async e=>{await(await import('./handleGenerate-4RFQDCQF.mjs')).default(e);}},l=C;var V={command:"typescript",describe:"Manage code",builder:e=>e.command(l).demandCommand(),handler:async e=>{}},p=V;async function f(){let{findUp:e}=await import('find-up'),o=await e("package.json",{cwd:import.meta.url});if(!o)return "(unknown version. No package.json found)";let t=JSON.parse(await u.promises.readFile(o,"utf-8"));return t.version?`v${t.version}`:"(unknown version. No version in package.json found)"}var g=!0;async function y(e){if(g){let t=(await import('consola')).consola;t.info(`Palantir OSDK CLI ${await f()}`),t.level=3+e.verbose,t.level>3&&t.debug(`Verbose logging enabled (${t.level===4?"debug":"trace"})`),console.log(),g=!1;}}async function I(e=process.argv){let o=D(hideBin(e)).env("OSDK").version(!1).option("verbose",{alias:"v",type:"boolean",description:"Enable verbose logging",count:!0}).demandCommand().middleware(y,!0).strict().command({command:"unstable",aliases:["experimental"],builder:async t=>t.command(m).command(p).command(r).demandCommand(),handler:t=>{}});try{return o.parseAsync()}catch(t){t instanceof a$1&&(await import('consola')).consola.error(t.message);}}
8
8
 
9
- export { k as cli };
9
+ export { I as cli };
10
10
  //# sourceMappingURL=out.js.map
11
11
  //# sourceMappingURL=index.mjs.map
@@ -1 +1 @@
1
- {"version":3,"sources":["../../src/cli.ts","../../src/commands/site/delete/index.ts","../../src/commands/site/deploy/index.ts","../../src/commands/site/upload/index.ts","../../src/commands/site/versions/index.ts","../../src/commands/site/index.ts","../../src/commands/typescript/generate/generate.ts","../../src/commands/typescript/index.ts","../../src/readCliVersionFromPackageJson.ts","../../src/yargs/logVersionMiddleware.ts"],"names":["yargs","hideBin","command","argv","args","delete_default","deploy_default","upload_default","versions_default","site","a","site_default","generate_default","typescript_default","fs","readCliVersionFromPackageJson","findUp","result","packageJson","firstTime","logVersionMiddleware","consola","cli","base","_args","e","ExitProcessError"],"mappings":"sEAgBA,OAAOA,MAAW,QAClB,OAAS,WAAAC,MAAe,gBCDjB,IAAMC,EAAU,CACrB,QAAS,SACT,SAAU,6BACV,QAASC,GACAA,EAAK,OAAO,cAAe,CAChC,KAAM,SACN,aAAc,EAChB,CAAC,EAAE,OAAO,MAAO,CACf,KAAM,QACR,CAAC,EAEH,QAAS,MAAMC,GAAQ,CAErB,MADgB,KAAM,QAAO,kCAAyB,GACxC,QAAQA,CAAI,CAC5B,CACF,EACOC,EAAQH,EChBR,IAAMA,EAAU,CACrB,QAAS,SACT,SAAU,6BACV,QAASC,GACAA,EAAK,QAAQ,CAClB,YAAe,CACb,KAAM,SACN,UAAW,cAGb,EAEA,SAAU,CACR,MAAO,eACP,YAAa,2CACb,KAAM,UACN,UAAW,aAGb,CACF,CAAC,EAAE,MAAM,CAAC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CAAC,cAAc,EACxB,QAAS,MAAMjB,GACNA,EAAK,QAAQQ,CAAI,EAAE,QAAQE,CAAU,EAAE,cAAc,EAE9D,QAASW,GAAS,CAAC,CACrB,CAAC,EACD,GAAI,CACF,OAAOD,EAAK,WAAW,CACzB,OAASE,EAAG,CACNA,aAAaC,IACC,KAAM,QAAO,SAAS,GAC9B,QAAQ,MAAMD,EAAE,OAAO,CAEnC,CACF","sourcesContent":["/*\n * Copyright 2023 Palantir Technologies, Inc. All rights reserved.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport yargs from \"yargs\";\nimport { hideBin } from \"yargs/helpers\";\nimport site from \"./commands/site/index.js\";\nimport typescript from \"./commands/typescript/index.js\";\nimport { ExitProcessError } from \"./ExitProcessError.js\";\nimport { logVersionMiddleware } from \"./yargs/logVersionMiddleware.js\";\nexport async function cli(args = process.argv) {\n const base = yargs(hideBin(args)).env(\"OSDK\").version(false).option(\"verbose\", {\n alias: \"v\",\n type: \"boolean\",\n description: \"Enable verbose logging\",\n count: true\n }).demandCommand().middleware(logVersionMiddleware, true).strict().command({\n command: \"unstable\",\n aliases: [\"experimental\"],\n builder: async argv => {\n return argv.command(site).command(typescript).demandCommand();\n },\n handler: _args => {}\n });\n try {\n return base.parseAsync();\n } catch (e) {\n if (e instanceof ExitProcessError) {\n const Consola = await import(\"consola\");\n Consola.consola.error(e.message);\n }\n }\n}","/*\n * Copyright 2023 Palantir Technologies, Inc. All rights reserved.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nexport const command = {\n command: \"delete\",\n describe: \"Delete an uploaded version\",\n builder: argv => {\n return argv.option(\"siteVersion\", {\n type: \"string\",\n demandOption: true\n }).option(\"dir\", {\n type: \"string\"\n });\n },\n handler: async args => {\n const command = await import(\"./siteDeleteCommand.mjs\");\n await command.default(args);\n }\n};\nexport default command;","/*\n * Copyright 2023 Palantir Technologies, Inc. All rights reserved.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nexport const command = {\n command: \"deploy\",\n describe: \"Deploy an uploaded version\",\n builder: argv => {\n return argv.options({\n \"siteVersion\": {\n type: \"string\",\n conflicts: \"clearVersion\"\n // group: \"Deploy Version\",\n // implies: { \"clearVersion\": \"false\" },\n },\n\n undeploy: {\n alias: \"clearVersion\",\n description: \"Causes the site to no longer be deployed\",\n type: \"boolean\",\n conflicts: \"siteVersion\"\n // group: \"Deploy Version\",\n // implies: { \"siteVersion\": \"\" },\n }\n }).group([\"siteVersion\", \"clearVersion\"], \"Version To Deploy (requires one of)\");\n\n // .check((args) => {\n // if (\n // (args.siteVersion && args.clearVersion)\n // || (!args.siteVersion && args.clearVersion == undefined)\n // ) {\n // // consola.error(\"Only one of --siteVersion or --clearVersion may be provided\");\n // throw new Error(\n // \"Only one of --siteVersion or --clearVersion may be provided\",\n // );\n // }\n // });\n },\n\n handler: async args => {\n const command = await import(\"./handleSiteDeploy.mjs\");\n await command.default(args);\n }\n};\nexport default command;","/*\n * Copyright 2023 Palantir Technologies, Inc. All rights reserved.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nexport const command = {\n command: \"upload\",\n describe: \"Upload an application version\",\n builder: argv => {\n return argv.option(\"siteVersion\", {\n type: \"string\",\n demandOption: true\n }).option(\"dir\", {\n type: \"string\"\n });\n },\n handler: async args => {\n const command = await import(\"./siteUploadCommand.mjs\");\n await command.default(args);\n }\n};\nexport default command;","/*\n * Copyright 2023 Palantir Technologies, Inc. All rights reserved.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nexport const command = {\n command: \"versions\",\n describe: \"List application versions\",\n builder: argv => {\n return argv;\n },\n handler: async args => {\n const command = await import(\"./siteVersionsCommand.mjs\");\n await command.default(args);\n }\n};\nexport default command;","/*\n * Copyright 2023 Palantir Technologies, Inc. All rights reserved.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport siteDelete from \"./delete/index.js\";\nimport siteDeploy from \"./deploy/index.js\";\nimport upload from \"./upload/index.js\";\nimport versions from \"./versions/index.js\";\nconst site = {\n command: \"site\",\n describe: \"Manage your site\",\n builder: argv => {\n return argv.options({\n appRid: {\n type: \"string\",\n demandOption: true,\n coerce: a => a\n },\n baseUrl: {\n type: \"string\",\n demandOption: true\n }\n }).group([\"appRid\", \"baseUrl\"], \"Common Arguments\").command(versions).command(upload).command(siteDelete).command(siteDeploy).demandCommand();\n },\n handler: async args => {}\n};\nexport default site;","/*\n * Copyright 2023 Palantir Technologies, Inc. All rights reserved.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nexport const command = {\n command: \"generate\",\n describe: \"Generate typescript from ontology\",\n builder: argv => {\n return argv.options({\n \"outDir\": {\n type: \"string\",\n description: \"Where to place the generated files\",\n demandOption: true\n },\n ontologyPath: {\n description: \"path to the ontology wire json\",\n type: \"string\",\n demandOption: true\n },\n beta: {\n type: \"boolean\",\n description: \"Should generate beta sdk\",\n demandOption: false\n },\n packageType: {\n default: \"commonjs\",\n choices: [\"commonjs\", \"module\"]\n }\n }).group([\"outDir\", \"ontologyPath\"], \"Version To Deploy (requires one of)\");\n },\n handler: async args => {\n const command = await import(\"./handleGenerate.mjs\");\n await command.default(args);\n }\n};\nexport default command;","/*\n * Copyright 2023 Palantir Technologies, Inc. All rights reserved.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport generate from \"./generate/generate.js\";\nconst site = {\n command: \"typescript\",\n describe: \"Manage code\",\n builder: argv => {\n return argv.command(generate).demandCommand();\n },\n handler: async args => {}\n};\nexport default site;","/*\n * Copyright 2023 Palantir Technologies, Inc. All rights reserved.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport * as fs from \"node:fs\";\nexport async function readCliVersionFromPackageJson() {\n const {\n findUp\n } = await import(\"find-up\");\n const result = await findUp(\"package.json\", {\n cwd: import.meta.url\n });\n if (!result) {\n return \"(unknown version. No package.json found)\";\n }\n const packageJson = JSON.parse(await fs.promises.readFile(result, \"utf-8\"));\n if (packageJson.version) {\n return `v${packageJson.version}`;\n } else {\n return \"(unknown version. No version in package.json found)\";\n }\n}","/*\n * Copyright 2023 Palantir Technologies, Inc. All rights reserved.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport { readCliVersionFromPackageJson } from \"../readCliVersionFromPackageJson.js\";\nlet firstTime = true;\nexport async function logVersionMiddleware(args) {\n if (firstTime) {\n const Consola = await import(\"consola\");\n // This will be called before any command is executed\n const consola = Consola.consola;\n consola.info(`Palantir OSDK CLI ${await readCliVersionFromPackageJson()}`);\n consola.level = 3 + args.verbose; // so 1 -v is debug logs and -vv is trace\n if (consola.level > 3) {\n consola.debug(`Verbose logging enabled (${consola.level === 4 ? \"debug\" : \"trace\"})`);\n }\n\n // eslint-disable-next-line no-console\n console.log(); // Not consola. Just want a blank line\n firstTime = false;\n }\n}"]}
1
+ {"version":3,"sources":["../../src/cli.ts","../../src/commands/auth/login/index.ts","../../src/commands/auth/index.ts","../../src/commands/site/delete/index.ts","../../src/commands/site/deploy/index.ts","../../src/commands/site/upload/index.ts","../../src/commands/site/versions/index.ts","../../src/commands/site/index.ts","../../src/commands/typescript/generate/generate.ts","../../src/commands/typescript/index.ts","../../src/readCliVersionFromPackageJson.ts","../../src/yargs/logVersionMiddleware.ts"],"names":["yargs","hideBin","command","argv","args","login_default","site","auth_default","delete_default","deploy_default","upload_default","versions_default","a","site_default","generate_default","typescript_default","fs","readCliVersionFromPackageJson","findUp","result","packageJson","firstTime","logVersionMiddleware","consola","cli","base","_args","e","ExitProcessError"],"mappings":"sEAgBA,OAAOA,MAAW,QAClB,OAAS,WAAAC,MAAe,gBCDjB,IAAMC,EAAU,CACrB,QAAS,QACT,SAAU,sCACV,QAASC,GACAA,EAAK,OAAO,gBAAiB,CAClC,KAAM,SACN,aAAc,EAChB,CAAC,EAEH,QAAS,MAAMC,GAAQ,CAErB,MADgB,KAAM,QAAO,0BAAgB,GAC/B,QAAQA,CAAI,CAC5B,CACF,EACOC,EAAQH,ECbf,IAAMI,EAAO,CACX,QAAS,OACT,SAAU,sBACV,QAASH,GACAA,EAAK,QAAQ,CAClB,QAAS,CACP,KAAM,SACN,aAAc,EAChB,CACF,CAAC,EAAE,QAAQE,CAAK,EAAE,cAAc,EAElC,QAAS,MAAMD,GAAQ,CAAC,CAC1B,EACOG,EAAQD,ECdR,IAAMJ,EAAU,CACrB,QAAS,SACT,SAAU,6BACV,QAAS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EAAc,KAAK,MAAM,MAAS,WAAS,SAASD,EAAQ,OAAO,CAAC,EAC1E,OAAIC,EAAY,QACP,IAAIA,EAAY,OAAO,GAEvB,qDAEX,CChBA,IAAIC,EAAY,GAChB,eAAsBC,EAAqBlB,EAAM,CAC/C,GAAIiB,EAAW,CAGb,IAAME,GAFU,KAAM,QAAO,SAAS,GAEd,QACxBA,EAAQ,KAAK,qBAAqB,MAAMN,EAA8B,CAAC,EAAE,EACzEM,EAAQ,MAAQ,EAAInB,EAAK,QACrBmB,EAAQ,MAAQ,GAClBA,EAAQ,MAAM,4BAA4BA,EAAQ,QAAU,EAAI,QAAU,OAAO,GAAG,EAItF,QAAQ,IAAI,EACZF,EAAY,EACd,CACF,CXVA,eAAsBG,EAAIpB,EAAO,QAAQ,KAAM,CAC7C,IAAMqB,EAAOzB,EAAMC,EAAQG,CAAI,CAAC,EAAE,IAAI,MAAM,EAAE,QAAQ,EAAK,EAAE,OAAO,UAAW,CAC7E,MAAO,IACP,KAAM,UACN,YAAa,yBACb,MAAO,EACT,CAAC,EAAE,cAAc,EAAE,WAAWkB,EAAsB,EAAI,EAAE,OAAO,EAAE,QAAQ,CACzE,QAAS,WACT,QAAS,CAAC,cAAc,EACxB,QAAS,MAAMnB,GACNA,EAAK,QAAQU,CAAI,EAAE,QAAQE,CAAU,EAAE,QAAQR,CAAI,EAAE,cAAc,EAE5E,QAASmB,GAAS,CAAC,CACrB,CAAC,EACD,GAAI,CACF,OAAOD,EAAK,WAAW,CACzB,OAASE,EAAG,CACNA,aAAaC,IACC,KAAM,QAAO,SAAS,GAC9B,QAAQ,MAAMD,EAAE,OAAO,CAEnC,CACF","sourcesContent":["/*\n * Copyright 2023 Palantir Technologies, Inc. All rights reserved.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport yargs from \"yargs\";\nimport { hideBin } from \"yargs/helpers\";\nimport auth from \"./commands/auth/index.js\";\nimport site from \"./commands/site/index.js\";\nimport typescript from \"./commands/typescript/index.js\";\nimport { ExitProcessError } from \"./ExitProcessError.js\";\nimport { logVersionMiddleware } from \"./yargs/logVersionMiddleware.js\";\nexport async function cli(args = process.argv) {\n const base = yargs(hideBin(args)).env(\"OSDK\").version(false).option(\"verbose\", {\n alias: \"v\",\n type: \"boolean\",\n description: \"Enable verbose logging\",\n count: true\n }).demandCommand().middleware(logVersionMiddleware, true).strict().command({\n command: \"unstable\",\n aliases: [\"experimental\"],\n builder: async argv => {\n return argv.command(site).command(typescript).command(auth).demandCommand();\n },\n handler: _args => {}\n });\n try {\n return base.parseAsync();\n } catch (e) {\n if (e instanceof ExitProcessError) {\n const Consola = await import(\"consola\");\n Consola.consola.error(e.message);\n }\n }\n}","/*\n * Copyright 2023 Palantir Technologies, Inc. All rights reserved.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nexport const command = {\n command: \"login\",\n describe: \"Authenticate with an application ID\",\n builder: argv => {\n return argv.option(\"applicationId\", {\n type: \"string\",\n demandOption: true\n });\n },\n handler: async args => {\n const command = await import(\"./loginFlow.js\");\n await command.default(args);\n }\n};\nexport default command;","/*\n * Copyright 2023 Palantir Technologies, Inc. All rights reserved.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport login from \"./login/index.js\";\nconst site = {\n command: \"auth\",\n describe: \"Manage your session\",\n builder: argv => {\n return argv.options({\n baseUrl: {\n type: \"string\",\n demandOption: true\n }\n }).command(login).demandCommand();\n },\n handler: async args => {}\n};\nexport default site;","/*\n * Copyright 2023 Palantir Technologies, Inc. All rights reserved.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nexport const command = {\n command: \"delete\",\n describe: \"Delete an uploaded version\",\n builder: argv => {\n return argv.option(\"siteVersion\", {\n type: \"string\",\n demandOption: true\n }).option(\"dir\", {\n type: \"string\"\n });\n },\n handler: async args => {\n const command = await import(\"./siteDeleteCommand.mjs\");\n await command.default(args);\n }\n};\nexport default command;","/*\n * Copyright 2023 Palantir Technologies, Inc. All rights reserved.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nexport const command = {\n command: \"deploy\",\n describe: \"Deploy an uploaded version\",\n builder: argv => {\n return argv.options({\n \"siteVersion\": {\n type: \"string\",\n conflicts: \"clearVersion\"\n // group: \"Deploy Version\",\n // implies: { \"clearVersion\": \"false\" },\n },\n\n undeploy: {\n alias: \"clearVersion\",\n description: \"Causes the site to no longer be deployed\",\n type: \"boolean\",\n conflicts: \"siteVersion\"\n // group: \"Deploy Version\",\n // implies: { \"siteVersion\": \"\" },\n }\n }).group([\"siteVersion\", \"clearVersion\"], \"Version To Deploy (requires one of)\");\n\n // .check((args) => {\n // if (\n // (args.siteVersion && args.clearVersion)\n // || (!args.siteVersion && args.clearVersion == undefined)\n // ) {\n // // consola.error(\"Only one of --siteVersion or --clearVersion may be provided\");\n // throw new Error(\n // \"Only one of --siteVersion or --clearVersion may be provided\",\n // );\n // }\n // });\n },\n\n handler: async args => {\n const command = await import(\"./handleSiteDeploy.mjs\");\n await command.default(args);\n }\n};\nexport default command;","/*\n * Copyright 2023 Palantir Technologies, Inc. All rights reserved.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nexport const command = {\n command: \"upload\",\n describe: \"Upload an application version\",\n builder: argv => {\n return argv.option(\"siteVersion\", {\n type: \"string\",\n demandOption: true\n }).option(\"dir\", {\n type: \"string\"\n });\n },\n handler: async args => {\n const command = await import(\"./siteUploadCommand.mjs\");\n await command.default(args);\n }\n};\nexport default command;","/*\n * Copyright 2023 Palantir Technologies, Inc. All rights reserved.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nexport const command = {\n command: \"versions\",\n describe: \"List application versions\",\n builder: argv => {\n return argv;\n },\n handler: async args => {\n const command = await import(\"./siteVersionsCommand.mjs\");\n await command.default(args);\n }\n};\nexport default command;","/*\n * Copyright 2023 Palantir Technologies, Inc. All rights reserved.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport siteDelete from \"./delete/index.js\";\nimport siteDeploy from \"./deploy/index.js\";\nimport upload from \"./upload/index.js\";\nimport versions from \"./versions/index.js\";\nconst site = {\n command: \"site\",\n describe: \"Manage your site\",\n builder: argv => {\n return argv.options({\n appRid: {\n type: \"string\",\n demandOption: true,\n coerce: a => a\n },\n baseUrl: {\n type: \"string\",\n demandOption: true\n }\n }).group([\"appRid\", \"baseUrl\"], \"Common Arguments\").command(versions).command(upload).command(siteDelete).command(siteDeploy).demandCommand();\n },\n handler: async args => {}\n};\nexport default site;","/*\n * Copyright 2023 Palantir Technologies, Inc. All rights reserved.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nexport const command = {\n command: \"generate\",\n describe: \"Generate typescript from ontology\",\n builder: argv => {\n return argv.options({\n \"outDir\": {\n type: \"string\",\n description: \"Where to place the generated files\",\n demandOption: true\n },\n ontologyPath: {\n description: \"path to the ontology wire json\",\n type: \"string\",\n demandOption: false,\n conflicts: [\"stack\", \"clientId\"]\n },\n stack: {\n description: \"the URL to the stack that contains the ontology\",\n type: \"string\",\n demandOption: false,\n conflicts: \"ontologyPath\",\n implies: \"clientId\"\n },\n clientId: {\n description: \"the application's client id\",\n type: \"string\",\n demandOption: false,\n conflicts: \"ontologyPath\",\n implies: \"stack\"\n },\n beta: {\n type: \"boolean\",\n description: \"Should generate beta sdk\",\n demandOption: false\n },\n packageType: {\n default: \"commonjs\",\n choices: [\"commonjs\", \"module\"]\n }\n }).group([\"ontologyPath\", \"outDir\"], \"Generate from a local file\").group([\"stack\", \"clientId\", \"outDir\"], \"OR Generate from a stack\").check(argv => {\n if (argv.ontologyPath || argv.stack) {\n return true;\n } else {\n throw new Error(\"Error: Must specify either ontologyPath or stack and clientId\");\n }\n });\n },\n handler: async args => {\n const command = await import(\"./handleGenerate.mjs\");\n await command.default(args);\n }\n};\nexport default command;","/*\n * Copyright 2023 Palantir Technologies, Inc. All rights reserved.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport generate from \"./generate/generate.js\";\nconst site = {\n command: \"typescript\",\n describe: \"Manage code\",\n builder: argv => {\n return argv.command(generate).demandCommand();\n },\n handler: async args => {}\n};\nexport default site;","/*\n * Copyright 2023 Palantir Technologies, Inc. All rights reserved.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport * as fs from \"node:fs\";\nexport async function readCliVersionFromPackageJson() {\n const {\n findUp\n } = await import(\"find-up\");\n const result = await findUp(\"package.json\", {\n cwd: import.meta.url\n });\n if (!result) {\n return \"(unknown version. No package.json found)\";\n }\n const packageJson = JSON.parse(await fs.promises.readFile(result, \"utf-8\"));\n if (packageJson.version) {\n return `v${packageJson.version}`;\n } else {\n return \"(unknown version. No version in package.json found)\";\n }\n}","/*\n * Copyright 2023 Palantir Technologies, Inc. All rights reserved.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport { readCliVersionFromPackageJson } from \"../readCliVersionFromPackageJson.js\";\nlet firstTime = true;\nexport async function logVersionMiddleware(args) {\n if (firstTime) {\n const Consola = await import(\"consola\");\n // This will be called before any command is executed\n const consola = Consola.consola;\n consola.info(`Palantir OSDK CLI ${await readCliVersionFromPackageJson()}`);\n consola.level = 3 + args.verbose; // so 1 -v is debug logs and -vv is trace\n if (consola.level > 3) {\n consola.debug(`Verbose logging enabled (${consola.level === 4 ? \"debug\" : \"trace\"})`);\n }\n\n // eslint-disable-next-line no-console\n console.log(); // Not consola. Just want a blank line\n firstTime = false;\n }\n}"]}
@@ -0,0 +1,4 @@
1
+ export { a as default } from './chunk-YHQGXNMB.mjs';
2
+ import './chunk-XIJ2ZQRX.mjs';
3
+ //# sourceMappingURL=out.js.map
4
+ //# sourceMappingURL=loginFlow-JIH374QN.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":[],"names":[],"mappings":""}
@@ -0,0 +1,10 @@
1
+ 'use strict';
2
+
3
+ var chunkZ6SJPM6K_cjs = require('./chunk-Z6SJPM6K.cjs');
4
+ require('./chunk-X6QW63OH.cjs');
5
+
6
+
7
+
8
+ module.exports = chunkZ6SJPM6K_cjs.a;
9
+ //# sourceMappingURL=out.js.map
10
+ //# sourceMappingURL=loginFlow-MPM6J3CY.cjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":[],"names":[],"mappings":""}
@@ -0,0 +1,4 @@
1
+ import type { CliCommonArgs } from "../../CliCommonArgs.js";
2
+ export interface CommonAuthArgs extends CliCommonArgs {
3
+ baseUrl: string;
4
+ }
@@ -0,0 +1,5 @@
1
+ import type * as yargs from "yargs";
2
+ import type { CliCommonArgs } from "../../CliCommonArgs.js";
3
+ import type { CommonAuthArgs } from "./CommonAuthArgs.js";
4
+ declare const site: yargs.CommandModule<CliCommonArgs, CommonAuthArgs>;
5
+ export default site;
@@ -0,0 +1,4 @@
1
+ import type { CommonAuthArgs } from "../CommonAuthArgs.js";
2
+ export interface LoginArgs extends CommonAuthArgs {
3
+ applicationId: string;
4
+ }
@@ -0,0 +1,5 @@
1
+ import type { CommandModule } from "yargs";
2
+ import type { CommonAuthArgs } from "../CommonAuthArgs.js";
3
+ import type { LoginArgs } from "./LoginArgs.js";
4
+ export declare const command: CommandModule<CommonAuthArgs, LoginArgs>;
5
+ export default command;
@@ -0,0 +1,2 @@
1
+ import type { LoginArgs } from "./LoginArgs.js";
2
+ export default function invokeLoginFlow(args: LoginArgs): Promise<import("./token.js").TokenSuccessResponse>;
@@ -0,0 +1,12 @@
1
+ export interface TokenSuccessResponse {
2
+ access_token: string;
3
+ token_type: string;
4
+ refresh_token: string;
5
+ expires_in: number;
6
+ }
7
+ export interface TokenErrorResponse {
8
+ error: string;
9
+ error_description: string;
10
+ }
11
+ export type TokenResponse = TokenErrorResponse | TokenSuccessResponse;
12
+ export declare function isTokenErrorResponse(response: TokenSuccessResponse | TokenErrorResponse): response is TokenErrorResponse;
@@ -1,6 +1,8 @@
1
1
  export interface TypescriptGenerateArgs {
2
2
  outDir: string;
3
- ontologyPath: string;
3
+ ontologyPath?: string;
4
+ stack?: string;
5
+ clientId?: string;
4
6
  beta?: boolean;
5
7
  packageType: "commonjs" | "module";
6
8
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@osdk/cli",
3
- "version": "0.0.15",
3
+ "version": "0.0.16",
4
4
  "description": "",
5
5
  "access": "public",
6
6
  "license": "Apache-2.0",
@@ -21,10 +21,12 @@
21
21
  "conjure-lite": "0.3.1",
22
22
  "consola": "^3.2.3",
23
23
  "find-up": "^6.3.0",
24
+ "open": "^9.1.0",
24
25
  "yargs": "^17.7.2",
25
- "@osdk/api": "1.0.0",
26
- "@osdk/generator": "1.0.0",
27
- "@osdk/shared.net": "1.0.0"
26
+ "@osdk/api": "1.0.1",
27
+ "@osdk/gateway": "1.0.1",
28
+ "@osdk/generator": "1.0.1",
29
+ "@osdk/shared.net": "1.0.1"
28
30
  },
29
31
  "devDependencies": {
30
32
  "@types/archiver": "^6.0.0",
@@ -1,32 +0,0 @@
1
- 'use strict';
2
-
3
- require('./chunk-X6QW63OH.cjs');
4
- var generator = require('@osdk/generator');
5
- var consola = require('consola');
6
- var o = require('fs');
7
-
8
- function _interopNamespace(e) {
9
- if (e && e.__esModule) return e;
10
- var n = Object.create(null);
11
- if (e) {
12
- Object.keys(e).forEach(function (k) {
13
- if (k !== 'default') {
14
- var d = Object.getOwnPropertyDescriptor(e, k);
15
- Object.defineProperty(n, k, d.get ? d : {
16
- enumerable: true,
17
- get: function () { return e[k]; }
18
- });
19
- }
20
- });
21
- }
22
- n.default = e;
23
- return Object.freeze(n);
24
- }
25
-
26
- var o__namespace = /*#__PURE__*/_interopNamespace(o);
27
-
28
- async function f(t){let r=JSON.parse(await o__namespace.promises.readFile(t.ontologyPath,"utf-8"));t.beta?await generator.generateClientSdkVersionTwoPointZero(r,{writeFile:(e,i)=>o__namespace.promises.writeFile(e,i,"utf-8"),mkdir:async(e,i)=>{await o__namespace.promises.mkdir(e,i);}},t.outDir,t.packageType):await generator.generateClientSdkVersionOneDotOne(r,{writeFile:(e,i)=>o__namespace.promises.writeFile(e,i,"utf-8"),mkdir:async(e,i)=>{await o__namespace.promises.mkdir(e,i);}},t.outDir,t.packageType),consola.consola.info("OSDK Generated!");}
29
-
30
- module.exports = f;
31
- //# sourceMappingURL=out.js.map
32
- //# sourceMappingURL=handleGenerate-XM72AL6J.cjs.map
@@ -1 +0,0 @@
1
- {"version":3,"sources":["../../src/commands/typescript/generate/handleGenerate.mts"],"names":["generateClientSdkVersionOneDotOne","generateClientSdkVersionTwoPointZero","consola","fs","handleGenerate","args","ontology","path","contents","options"],"mappings":"6BAgBA,OAAS,qCAAAA,EAAmC,wCAAAC,MAA4C,kBACxF,OAAS,WAAAC,MAAe,UACxB,UAAYC,MAAQ,KACpB,eAAOC,EAAsCC,EAAM,CACjD,IAAMC,EAAW,KAAK,MAAM,MAAS,WAAS,SAASD,EAAK,aAAc,OAAO,CAAC,EAC9EA,EAAK,KACP,MAAMJ,EAAqCK,EAAU,CACnD,UAAW,CAACC,EAAMC,IACN,WAAS,UAAUD,EAAMC,EAAU,OAAO,EAEtD,MAAO,MAAOD,EAAME,IAAY,CAC9B,MAAS,WAAS,MAAMF,EAAME,CAAO,CACvC,CACF,EAAGJ,EAAK,OAAQA,EAAK,WAAW,EAEhC,MAAML,EAAkCM,EAAU,CAChD,UAAW,CAACC,EAAMC,IACN,WAAS,UAAUD,EAAMC,EAAU,OAAO,EAEtD,MAAO,MAAOD,EAAME,IAAY,CAC9B,MAAS,WAAS,MAAMF,EAAME,CAAO,CACvC,CACF,EAAGJ,EAAK,OAAQA,EAAK,WAAW,EAElCH,EAAQ,KAAK,iBAAiB,CAChC","sourcesContent":["/*\n * Copyright 2023 Palantir Technologies, Inc. All rights reserved.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport { generateClientSdkVersionOneDotOne, generateClientSdkVersionTwoPointZero } from \"@osdk/generator\";\nimport { consola } from \"consola\";\nimport * as fs from \"node:fs\";\nexport default async function handleGenerate(args) {\n const ontology = JSON.parse(await fs.promises.readFile(args.ontologyPath, \"utf-8\"));\n if (args.beta) {\n await generateClientSdkVersionTwoPointZero(ontology, {\n writeFile: (path, contents) => {\n return fs.promises.writeFile(path, contents, \"utf-8\");\n },\n mkdir: async (path, options) => {\n await fs.promises.mkdir(path, options);\n }\n }, args.outDir, args.packageType);\n } else {\n await generateClientSdkVersionOneDotOne(ontology, {\n writeFile: (path, contents) => {\n return fs.promises.writeFile(path, contents, \"utf-8\");\n },\n mkdir: async (path, options) => {\n await fs.promises.mkdir(path, options);\n }\n }, args.outDir, args.packageType);\n }\n consola.info(\"OSDK Generated!\");\n}"]}
@@ -1,10 +0,0 @@
1
- import './chunk-XIJ2ZQRX.mjs';
2
- import { generateClientSdkVersionTwoPointZero, generateClientSdkVersionOneDotOne } from '@osdk/generator';
3
- import { consola } from 'consola';
4
- import * as o from 'fs';
5
-
6
- async function f(t){let r=JSON.parse(await o.promises.readFile(t.ontologyPath,"utf-8"));t.beta?await generateClientSdkVersionTwoPointZero(r,{writeFile:(e,i)=>o.promises.writeFile(e,i,"utf-8"),mkdir:async(e,i)=>{await o.promises.mkdir(e,i);}},t.outDir,t.packageType):await generateClientSdkVersionOneDotOne(r,{writeFile:(e,i)=>o.promises.writeFile(e,i,"utf-8"),mkdir:async(e,i)=>{await o.promises.mkdir(e,i);}},t.outDir,t.packageType),consola.info("OSDK Generated!");}
7
-
8
- export { f as default };
9
- //# sourceMappingURL=out.js.map
10
- //# sourceMappingURL=handleGenerate-ZHO53G62.mjs.map
@@ -1 +0,0 @@
1
- {"version":3,"sources":["../../src/commands/typescript/generate/handleGenerate.mts"],"names":["generateClientSdkVersionOneDotOne","generateClientSdkVersionTwoPointZero","consola","fs","handleGenerate","args","ontology","path","contents","options"],"mappings":"6BAgBA,OAAS,qCAAAA,EAAmC,wCAAAC,MAA4C,kBACxF,OAAS,WAAAC,MAAe,UACxB,UAAYC,MAAQ,KACpB,eAAOC,EAAsCC,EAAM,CACjD,IAAMC,EAAW,KAAK,MAAM,MAAS,WAAS,SAASD,EAAK,aAAc,OAAO,CAAC,EAC9EA,EAAK,KACP,MAAMJ,EAAqCK,EAAU,CACnD,UAAW,CAACC,EAAMC,IACN,WAAS,UAAUD,EAAMC,EAAU,OAAO,EAEtD,MAAO,MAAOD,EAAME,IAAY,CAC9B,MAAS,WAAS,MAAMF,EAAME,CAAO,CACvC,CACF,EAAGJ,EAAK,OAAQA,EAAK,WAAW,EAEhC,MAAML,EAAkCM,EAAU,CAChD,UAAW,CAACC,EAAMC,IACN,WAAS,UAAUD,EAAMC,EAAU,OAAO,EAEtD,MAAO,MAAOD,EAAME,IAAY,CAC9B,MAAS,WAAS,MAAMF,EAAME,CAAO,CACvC,CACF,EAAGJ,EAAK,OAAQA,EAAK,WAAW,EAElCH,EAAQ,KAAK,iBAAiB,CAChC","sourcesContent":["/*\n * Copyright 2023 Palantir Technologies, Inc. All rights reserved.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport { generateClientSdkVersionOneDotOne, generateClientSdkVersionTwoPointZero } from \"@osdk/generator\";\nimport { consola } from \"consola\";\nimport * as fs from \"node:fs\";\nexport default async function handleGenerate(args) {\n const ontology = JSON.parse(await fs.promises.readFile(args.ontologyPath, \"utf-8\"));\n if (args.beta) {\n await generateClientSdkVersionTwoPointZero(ontology, {\n writeFile: (path, contents) => {\n return fs.promises.writeFile(path, contents, \"utf-8\");\n },\n mkdir: async (path, options) => {\n await fs.promises.mkdir(path, options);\n }\n }, args.outDir, args.packageType);\n } else {\n await generateClientSdkVersionOneDotOne(ontology, {\n writeFile: (path, contents) => {\n return fs.promises.writeFile(path, contents, \"utf-8\");\n },\n mkdir: async (path, options) => {\n await fs.promises.mkdir(path, options);\n }\n }, args.outDir, args.packageType);\n }\n consola.info(\"OSDK Generated!\");\n}"]}