@osdk/cli 0.32.0-beta.2 → 0.32.0-beta.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +8 -0
- package/build/esm/{chunk-YOTB5E2E.js → chunk-5EG4W4EY.js} +7 -34
- package/build/esm/chunk-5EG4W4EY.js.map +1 -0
- package/build/esm/{chunk-4L3JS54F.js → chunk-FQRKVHAE.js} +2 -4
- package/build/esm/chunk-FQRKVHAE.js.map +1 -0
- package/build/esm/chunk-PZ5AY32C.js +9 -0
- package/build/esm/chunk-PZ5AY32C.js.map +1 -0
- package/build/esm/index.js +20 -226
- package/build/esm/index.js.map +1 -1
- package/build/esm/{siteDeployCommand-M5L2QJB3.js → siteDeployCommand-FGAA5AF6.js} +6 -13
- package/build/esm/siteDeployCommand-FGAA5AF6.js.map +1 -0
- package/build/esm/{versionDeleteCommand-5UDQWHW7.js → versionDeleteCommand-HQBNJZQO.js} +5 -9
- package/build/esm/versionDeleteCommand-HQBNJZQO.js.map +1 -0
- package/build/esm/{versionDeleteCommand-W4LWFTB7.js → versionDeleteCommand-POCHBGDL.js} +5 -9
- package/build/esm/versionDeleteCommand-POCHBGDL.js.map +1 -0
- package/build/esm/{versionGetCommand-LHHNHKGF.js → versionGetCommand-FVKH4K6S.js} +4 -8
- package/build/esm/versionGetCommand-FVKH4K6S.js.map +1 -0
- package/build/esm/{versionInfoCommand-U3QJ7CJR.js → versionInfoCommand-F44PTFBW.js} +4 -8
- package/build/esm/versionInfoCommand-F44PTFBW.js.map +1 -0
- package/build/esm/{versionListCommand-7EJ2J4JO.js → versionListCommand-SMJ6RCRM.js} +4 -8
- package/build/esm/versionListCommand-SMJ6RCRM.js.map +1 -0
- package/build/esm/{versionListCommand-VQ5TRLAK.js → versionListCommand-X5PFEG2U.js} +4 -8
- package/build/esm/versionListCommand-X5PFEG2U.js.map +1 -0
- package/build/esm/{versionSetCommand-LRLP7PHB.js → versionSetCommand-YGYI2W74.js} +4 -8
- package/build/esm/versionSetCommand-YGYI2W74.js.map +1 -0
- package/build/esm/{versionUnsetCommand-GYOKECVD.js → versionUnsetCommand-SUZPZFLN.js} +5 -9
- package/build/esm/versionUnsetCommand-SUZPZFLN.js.map +1 -0
- package/build/esm/{widgetSetDeployCommand-PWUXCOA7.js → widgetSetDeployCommand-42GOCEWP.js} +6 -9
- package/build/esm/widgetSetDeployCommand-42GOCEWP.js.map +1 -0
- package/package.json +8 -8
- package/build/esm/acorn-2YJLPGID.js +0 -4014
- package/build/esm/acorn-2YJLPGID.js.map +0 -1
- package/build/esm/angular-2UQQBORC.js +0 -3921
- package/build/esm/angular-2UQQBORC.js.map +0 -1
- package/build/esm/babel-BV4W3BOJ.js +0 -9588
- package/build/esm/babel-BV4W3BOJ.js.map +0 -1
- package/build/esm/chunk-4L3JS54F.js.map +0 -1
- package/build/esm/chunk-ALV6NI27.js +0 -127
- package/build/esm/chunk-ALV6NI27.js.map +0 -1
- package/build/esm/chunk-BL3NTXLM.js +0 -84
- package/build/esm/chunk-BL3NTXLM.js.map +0 -1
- package/build/esm/chunk-CINFOKVJ.js +0 -43
- package/build/esm/chunk-CINFOKVJ.js.map +0 -1
- package/build/esm/chunk-CKZAZPXC.js +0 -28
- package/build/esm/chunk-CKZAZPXC.js.map +0 -1
- package/build/esm/chunk-CMWYDM5Q.js +0 -332
- package/build/esm/chunk-CMWYDM5Q.js.map +0 -1
- package/build/esm/chunk-W7U4ETYH.js +0 -239
- package/build/esm/chunk-W7U4ETYH.js.map +0 -1
- package/build/esm/chunk-XF44FMSL.js +0 -221
- package/build/esm/chunk-XF44FMSL.js.map +0 -1
- package/build/esm/chunk-YOTB5E2E.js.map +0 -1
- package/build/esm/estree-PTS7QPRO.js +0 -6145
- package/build/esm/estree-PTS7QPRO.js.map +0 -1
- package/build/esm/find-up-GVGEKQPQ.js +0 -4
- package/build/esm/find-up-GVGEKQPQ.js.map +0 -1
- package/build/esm/flow-Y46VD55R.js +0 -27169
- package/build/esm/flow-Y46VD55R.js.map +0 -1
- package/build/esm/glimmer-SE4IEQF6.js +0 -6974
- package/build/esm/glimmer-SE4IEQF6.js.map +0 -1
- package/build/esm/graphql-QF7PMC3R.js +0 -1720
- package/build/esm/graphql-QF7PMC3R.js.map +0 -1
- package/build/esm/handleGenerate-JM5HIHXW.js +0 -19283
- package/build/esm/handleGenerate-JM5HIHXW.js.map +0 -1
- package/build/esm/html-EQKLXLBJ.js +0 -5810
- package/build/esm/html-EQKLXLBJ.js.map +0 -1
- package/build/esm/loginFlow-GP5ZJP3D.js +0 -4
- package/build/esm/loginFlow-GP5ZJP3D.js.map +0 -1
- package/build/esm/markdown-FZBHQ3B4.js +0 -6697
- package/build/esm/markdown-FZBHQ3B4.js.map +0 -1
- package/build/esm/meriyah-Q2DK6BAD.js +0 -4343
- package/build/esm/meriyah-Q2DK6BAD.js.map +0 -1
- package/build/esm/postcss-SR3FYBVU.js +0 -6281
- package/build/esm/postcss-SR3FYBVU.js.map +0 -1
- package/build/esm/siteDeployCommand-M5L2QJB3.js.map +0 -1
- package/build/esm/typescript-DEUJRDXE.js +0 -13078
- package/build/esm/typescript-DEUJRDXE.js.map +0 -1
- package/build/esm/versionDeleteCommand-5UDQWHW7.js.map +0 -1
- package/build/esm/versionDeleteCommand-W4LWFTB7.js.map +0 -1
- package/build/esm/versionGetCommand-LHHNHKGF.js.map +0 -1
- package/build/esm/versionInfoCommand-U3QJ7CJR.js.map +0 -1
- package/build/esm/versionListCommand-7EJ2J4JO.js.map +0 -1
- package/build/esm/versionListCommand-VQ5TRLAK.js.map +0 -1
- package/build/esm/versionSetCommand-LRLP7PHB.js.map +0 -1
- package/build/esm/versionUnsetCommand-GYOKECVD.js.map +0 -1
- package/build/esm/widgetSetDeployCommand-PWUXCOA7.js.map +0 -1
- package/build/esm/yaml-KQJSRZTS.js +0 -5822
- package/build/esm/yaml-KQJSRZTS.js.map +0 -1
- package/build/types/util/maybeUpdateJemmaCustomMetadata.test.d.ts +0 -1
- package/build/types/util/maybeUpdateJemmaCustomMetadata.test.d.ts.map +0 -1
- package/build/types/util/token.test.d.ts +0 -1
- package/build/types/util/token.test.d.ts.map +0 -1
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/consola/handlePromptCancel.ts"],"names":[],"mappings":";;;;AAAA,cAAA,EAAA;AAmBA,IAAM,YAAA,GAAe,MAAO,CAAA,GAAA,CAAI,QAAQ,CAAA;AACjC,SAAS,mBAAmB,cAAgB,EAAA;AACjD,EAAA,MAAM,OAAU,GAAA,OAAO,cAAmB,KAAA,SAAA,IAAa,CAAC,cAAA;AACxD,EAAA,MAAM,WAAW,cAAmB,KAAA,YAAA;AACpC,EAAA,IAAI,YAAY,OAAS,EAAA;AACvB,IAAA,OAAA,CAAQ,KAAK,qBAAqB,CAAA;AAClC,IAAA,OAAA,CAAQ,KAAK,CAAC,CAAA;AAAA;AAElB","file":"chunk-4L3JS54F.js","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 { consola } from \"consola\";\n\n// https://github.com/unjs/consola?tab=readme-ov-file#await-promptmessage--type-cancel-\nconst cancelSymbol = Symbol.for(\"cancel\");\nexport function handlePromptCancel(promptResponse) {\n const isFalse = typeof promptResponse === \"boolean\" && !promptResponse;\n const isSigInt = promptResponse === cancelSymbol;\n if (isSigInt || isFalse) {\n consola.fail(\"Operation cancelled\");\n process.exit(0);\n }\n}"]}
|
|
@@ -1,127 +0,0 @@
|
|
|
1
|
-
import { init_esm_shims } from './chunk-CINFOKVJ.js';
|
|
2
|
-
import consola from 'consola';
|
|
3
|
-
import { getRandomValues, subtle } from 'crypto';
|
|
4
|
-
import { createServer } from 'http';
|
|
5
|
-
import { join } from 'path/posix';
|
|
6
|
-
import { exit } from 'process';
|
|
7
|
-
import { parse } from 'url';
|
|
8
|
-
import open from 'open';
|
|
9
|
-
|
|
10
|
-
// ../cli.common/build/esm/public/loginFlow.js
|
|
11
|
-
init_esm_shims();
|
|
12
|
-
|
|
13
|
-
// ../cli.common/build/esm/commands/auth/login/loginFlow.js
|
|
14
|
-
init_esm_shims();
|
|
15
|
-
|
|
16
|
-
// ../cli.common/build/esm/commands/auth/login/token.js
|
|
17
|
-
init_esm_shims();
|
|
18
|
-
function isTokenErrorResponse(response) {
|
|
19
|
-
return response.error != null;
|
|
20
|
-
}
|
|
21
|
-
|
|
22
|
-
// ../cli.common/build/esm/commands/auth/login/loginFlow.js
|
|
23
|
-
var BROWSER_PROMPT_TIME_MS = 60 * 1e3;
|
|
24
|
-
async function invokeLoginFlow(args) {
|
|
25
|
-
consola.start(`Authenticating using application id: ${args.clientId}`);
|
|
26
|
-
const redirectUrl = "http://localhost:8080/auth/callback";
|
|
27
|
-
const port = parse(redirectUrl).port;
|
|
28
|
-
let resolve;
|
|
29
|
-
const authCode = new Promise((_res) => {
|
|
30
|
-
resolve = _res;
|
|
31
|
-
});
|
|
32
|
-
const server = createServer((req, res) => {
|
|
33
|
-
const query = parse(req.url, true).query;
|
|
34
|
-
res.end("Authenticated");
|
|
35
|
-
resolve(query["code"]);
|
|
36
|
-
});
|
|
37
|
-
server.on("error", (e) => {
|
|
38
|
-
if (e.code === "EADDRINUSE") {
|
|
39
|
-
consola.error(`Port ${port} is already in use, unable to perform authentication flow.`);
|
|
40
|
-
server.close();
|
|
41
|
-
exit(1);
|
|
42
|
-
}
|
|
43
|
-
});
|
|
44
|
-
server.listen(port);
|
|
45
|
-
const clientId = args.clientId;
|
|
46
|
-
const state = generateRandomString();
|
|
47
|
-
const codeVerifier = generateRandomString();
|
|
48
|
-
const codeChallenge = await generateCodeChallenge(codeVerifier);
|
|
49
|
-
const authorizeUrl = generateAuthorizeUrl(args.foundryUrl, clientId, state, redirectUrl, codeChallenge);
|
|
50
|
-
try {
|
|
51
|
-
await open(authorizeUrl);
|
|
52
|
-
} catch {
|
|
53
|
-
consola.warn(`Unable to open browser, please open this url in your browser to to authenticate: ${authorizeUrl}`);
|
|
54
|
-
}
|
|
55
|
-
const browserPrompt = setTimeout(() => {
|
|
56
|
-
consola.warn(`Still waiting for the authentication to complete. Please open a browser to ${authorizeUrl}`);
|
|
57
|
-
}, BROWSER_PROMPT_TIME_MS);
|
|
58
|
-
const code = await authCode;
|
|
59
|
-
server.close();
|
|
60
|
-
clearTimeout(browserPrompt);
|
|
61
|
-
const token = await getTokenWithCodeVerifier(clientId, redirectUrl, code, args.foundryUrl, codeVerifier);
|
|
62
|
-
if (isTokenErrorResponse(token)) {
|
|
63
|
-
consola.error("Unable to authenticate", token.error, token.error_description);
|
|
64
|
-
exit(1);
|
|
65
|
-
}
|
|
66
|
-
consola.success(`Successfully authenticated!`);
|
|
67
|
-
return token;
|
|
68
|
-
}
|
|
69
|
-
function generateRandomString(length = 128) {
|
|
70
|
-
const characters = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-._~";
|
|
71
|
-
const output = [];
|
|
72
|
-
const array = new Uint8Array(1);
|
|
73
|
-
const maxIndex = 256 - 256 % characters.length;
|
|
74
|
-
while (output.length < length) {
|
|
75
|
-
getRandomValues(array);
|
|
76
|
-
if (array[0] < maxIndex) {
|
|
77
|
-
output.push(characters[array[0] % characters.length]);
|
|
78
|
-
}
|
|
79
|
-
}
|
|
80
|
-
return output.join("");
|
|
81
|
-
}
|
|
82
|
-
async function generateCodeChallenge(codeVerifier) {
|
|
83
|
-
const data = new TextEncoder().encode(codeVerifier);
|
|
84
|
-
const digest = await subtle.digest("SHA-256", data);
|
|
85
|
-
const codeChallenge = btoa(String.fromCharCode(...new Uint8Array(digest))).replace(/\//g, "_").replace(/\+/g, "-").replace(/=/g, "");
|
|
86
|
-
return {
|
|
87
|
-
codeChallenge,
|
|
88
|
-
codeChallengeMethod: "S256"
|
|
89
|
-
};
|
|
90
|
-
}
|
|
91
|
-
function generateAuthorizeUrl(baseUrl, clientId, state, redirectUrl, codeChallenge) {
|
|
92
|
-
const queryParams = new URLSearchParams();
|
|
93
|
-
queryParams.append("client_id", clientId);
|
|
94
|
-
queryParams.append("response_type", "code");
|
|
95
|
-
queryParams.append("state", state);
|
|
96
|
-
queryParams.append("redirect_uri", redirectUrl);
|
|
97
|
-
queryParams.append("code_challenge", codeChallenge.codeChallenge);
|
|
98
|
-
queryParams.append("code_challenge_method", codeChallenge.codeChallengeMethod);
|
|
99
|
-
queryParams.append("scope", ["offline_access", "api:read-data", "api:use-ontologies-read"].join(" "));
|
|
100
|
-
return join(baseUrl, "multipass", "api", "oauth2", "authorize") + `?` + queryParams.toString();
|
|
101
|
-
}
|
|
102
|
-
async function getTokenWithCodeVerifier(clientId, redirectUrl, code, baseUrl, codeVerifier) {
|
|
103
|
-
const body = new URLSearchParams();
|
|
104
|
-
body.append("client_id", clientId);
|
|
105
|
-
body.append("grant_type", "authorization_code");
|
|
106
|
-
body.append("code", code);
|
|
107
|
-
body.append("redirect_uri", redirectUrl);
|
|
108
|
-
body.append("code_verifier", codeVerifier);
|
|
109
|
-
const tokenUrl = join(baseUrl, "multipass", "api", "oauth2", "token") + `?state=${codeVerifier}`;
|
|
110
|
-
try {
|
|
111
|
-
const response = await fetch(tokenUrl, {
|
|
112
|
-
body: body.toString(),
|
|
113
|
-
headers: {
|
|
114
|
-
"Content-Type": "application/x-www-form-urlencoded"
|
|
115
|
-
},
|
|
116
|
-
method: "POST"
|
|
117
|
-
});
|
|
118
|
-
const responseText = await response.json();
|
|
119
|
-
return responseText;
|
|
120
|
-
} catch (e) {
|
|
121
|
-
throw new Error(`Failed to get token: ${e?.cause?.toString() ?? e?.toString() ?? "Unknown error"}`);
|
|
122
|
-
}
|
|
123
|
-
}
|
|
124
|
-
|
|
125
|
-
export { invokeLoginFlow };
|
|
126
|
-
//# sourceMappingURL=chunk-ALV6NI27.js.map
|
|
127
|
-
//# sourceMappingURL=chunk-ALV6NI27.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../cli.common/build/esm/public/loginFlow.js","../../../cli.common/build/esm/commands/auth/login/loginFlow.js","../../../cli.common/build/esm/commands/auth/login/token.js"],"names":[],"mappings":";;;;;;;;;;AAAA,cAAA,EAAA;;;ACAA,cAAA,EAAA;;;ACAA,cAAA,EAAA;AAgBO,SAAS,qBAAqB,QAAU,EAAA;AAC7C,EAAA,OAAO,SAAS,KAAS,IAAA,IAAA;AAC3B;;;ADMA,IAAM,yBAAyB,EAAK,GAAA,GAAA;AACpC,eAAsB,gBAAgB,IAAM,EAAA;AAC1C,EAAA,OAAA,CAAQ,KAAM,CAAA,CAAA,qCAAA,EAAwC,IAAK,CAAA,QAAQ,CAAE,CAAA,CAAA;AACrE,EAAA,MAAM,WAAc,GAAA,qCAAA;AACpB,EAAM,MAAA,IAAA,GAAO,KAAM,CAAA,WAAW,CAAE,CAAA,IAAA;AAChC,EAAI,IAAA,OAAA;AACJ,EAAM,MAAA,QAAA,GAAW,IAAI,OAAA,CAAQ,CAAQ,IAAA,KAAA;AACnC,IAAU,OAAA,GAAA,IAAA;AAAA,GACX,CAAA;AACD,EAAA,MAAM,MAAS,GAAA,YAAA,CAAa,CAAC,GAAA,EAAK,GAAQ,KAAA;AACxC,IAAA,MAAM,KAAQ,GAAA,KAAA,CAAM,GAAI,CAAA,GAAA,EAAK,IAAI,CAAE,CAAA,KAAA;AACnC,IAAA,GAAA,CAAI,IAAI,eAAe,CAAA;AACvB,IAAQ,OAAA,CAAA,KAAA,CAAM,MAAM,CAAC,CAAA;AAAA,GACtB,CAAA;AACD,EAAO,MAAA,CAAA,EAAA,CAAG,SAAS,CAAK,CAAA,KAAA;AACtB,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,OAAA,EAAU,YAAY,CAAA,CAAA;AAC9F,EAAI,IAAA;AACF,IAAM,MAAA,QAAA,GAAW,MAAM,KAAA,CAAM,QAAU,EAAA;AAAA,MACrC,IAAA,EAAM,KAAK,QAAS,EAAA;AAAA,MACpB,OAAS,EAAA;AAAA,QACP,cAAgB,EAAA;AAAA,OAClB;AAAA,MACA,MAAQ,EAAA;AAAA,KACT,CAAA;AACD,IAAM,MAAA,YAAA,GAAe,MAAM,QAAA,CAAS,IAAK,EAAA;AACzC,IAAO,OAAA,YAAA;AAAA,WACA,CAAG,EAAA;AACV,IAAM,MAAA,IAAI,KAAM,CAAA,CAAA,qBAAA,EAAwB,CAAG,EAAA,KAAA,EAAO,QAAS,EAAA,IAAK,CAAG,EAAA,QAAA,EAAc,IAAA,eAAe,CAAE,CAAA,CAAA;AAAA;AAEtG","file":"chunk-ALV6NI27.js","sourcesContent":["/*\n * Copyright 2024 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 { invokeLoginFlow as default } from \"../commands/auth/login/loginFlow.js\";","/*\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 consola from \"consola\";\nimport { getRandomValues, subtle } from \"node:crypto\";\nimport { createServer } from \"node:http\";\nimport { join } from \"node:path/posix\";\nimport { exit } from \"node:process\";\nimport { parse } from \"node:url\";\nimport open from \"open\";\nimport { isTokenErrorResponse } from \"./token.js\";\nconst BROWSER_PROMPT_TIME_MS = 60 * 1000;\nexport async function invokeLoginFlow(args) {\n consola.start(`Authenticating using application id: ${args.clientId}`);\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.clientId;\n const state = generateRandomString();\n const codeVerifier = generateRandomString();\n const codeChallenge = await generateCodeChallenge(codeVerifier);\n const authorizeUrl = generateAuthorizeUrl(args.foundryUrl, 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\n // nag the user if we didn't get an auth token for a relatively long time\n const browserPrompt = setTimeout(() => {\n consola.warn(`Still waiting for the authentication to complete. Please open a browser to ${authorizeUrl}`);\n }, BROWSER_PROMPT_TIME_MS);\n const code = await authCode;\n server.close();\n clearTimeout(browserPrompt);\n const token = await getTokenWithCodeVerifier(clientId, redirectUrl, code, args.foundryUrl, 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 const output = [];\n const 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 codeChallenge = btoa(String.fromCharCode(...new Uint8Array(digest))).replace(/\\//g, \"_\").replace(/\\+/g, \"-\").replace(/=/g, \"\");\n return {\n codeChallenge,\n codeChallengeMethod: \"S256\"\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\", \"api:use-ontologies-read\"].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?.cause?.toString() ?? 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}"]}
|
|
@@ -1,84 +0,0 @@
|
|
|
1
|
-
import { init_esm_shims } from './chunk-CINFOKVJ.js';
|
|
2
|
-
import { consola } from 'consola';
|
|
3
|
-
import { colorize } from 'consola/utils';
|
|
4
|
-
import yargs from 'yargs';
|
|
5
|
-
import { hideBin } from 'yargs/helpers';
|
|
6
|
-
import { valid } from 'semver';
|
|
7
|
-
|
|
8
|
-
// ../cli.common/build/esm/ExitProcessError.js
|
|
9
|
-
init_esm_shims();
|
|
10
|
-
var ExitProcessError = class extends Error {
|
|
11
|
-
constructor(errorCode, msg, tip, originalError) {
|
|
12
|
-
super(msg);
|
|
13
|
-
this.errorCode = errorCode;
|
|
14
|
-
this.msg = msg;
|
|
15
|
-
this.tip = tip;
|
|
16
|
-
this.originalError = originalError;
|
|
17
|
-
}
|
|
18
|
-
};
|
|
19
|
-
|
|
20
|
-
// ../cli.common/build/esm/YargsCheckError.js
|
|
21
|
-
init_esm_shims();
|
|
22
|
-
var YargsCheckError = class extends Error {
|
|
23
|
-
constructor(msg) {
|
|
24
|
-
super(msg);
|
|
25
|
-
}
|
|
26
|
-
};
|
|
27
|
-
|
|
28
|
-
// ../cli.common/build/esm/index.js
|
|
29
|
-
init_esm_shims();
|
|
30
|
-
|
|
31
|
-
// ../cli.common/build/esm/getYargsBase.js
|
|
32
|
-
init_esm_shims();
|
|
33
|
-
|
|
34
|
-
// ../cli.common/build/esm/yargs/logLevelMiddleware.js
|
|
35
|
-
init_esm_shims();
|
|
36
|
-
var firstTime = true;
|
|
37
|
-
async function logLevelMiddleware(args) {
|
|
38
|
-
if (firstTime) {
|
|
39
|
-
firstTime = false;
|
|
40
|
-
consola.level = 3 + args.verbose;
|
|
41
|
-
if (consola.level > 3) {
|
|
42
|
-
consola.debug(`Verbose logging enabled (${consola.level === 4 ? "debug" : "trace"})
|
|
43
|
-
`);
|
|
44
|
-
}
|
|
45
|
-
}
|
|
46
|
-
}
|
|
47
|
-
|
|
48
|
-
// ../cli.common/build/esm/getYargsBase.js
|
|
49
|
-
function getYargsBase(args) {
|
|
50
|
-
return yargs(hideBin(args)).wrap(Math.min(150, yargs().terminalWidth())).env("OSDK").version(false).option("verbose", {
|
|
51
|
-
alias: "v",
|
|
52
|
-
type: "boolean",
|
|
53
|
-
description: "Enable verbose logging",
|
|
54
|
-
count: true
|
|
55
|
-
}).demandCommand().middleware(logLevelMiddleware, true).strict().fail(async (msg, err, argv) => {
|
|
56
|
-
if (err instanceof ExitProcessError) {
|
|
57
|
-
consola.error(err.message);
|
|
58
|
-
if (err.tip != null) {
|
|
59
|
-
consola.log(colorize("bold", `\u{1F4A1} Tip: ${err.tip}`));
|
|
60
|
-
consola.log("");
|
|
61
|
-
}
|
|
62
|
-
consola.debug(err.stack);
|
|
63
|
-
} else {
|
|
64
|
-
if (err && !(err instanceof YargsCheckError)) {
|
|
65
|
-
throw err;
|
|
66
|
-
} else {
|
|
67
|
-
argv.showHelp();
|
|
68
|
-
consola.log("");
|
|
69
|
-
consola.error(msg);
|
|
70
|
-
}
|
|
71
|
-
}
|
|
72
|
-
process.exit(1);
|
|
73
|
-
});
|
|
74
|
-
}
|
|
75
|
-
|
|
76
|
-
// ../cli.common/build/esm/util/isValidSemver.js
|
|
77
|
-
init_esm_shims();
|
|
78
|
-
function isValidSemver(semverString) {
|
|
79
|
-
return valid(semverString) != null;
|
|
80
|
-
}
|
|
81
|
-
|
|
82
|
-
export { ExitProcessError, YargsCheckError, getYargsBase, isValidSemver };
|
|
83
|
-
//# sourceMappingURL=chunk-BL3NTXLM.js.map
|
|
84
|
-
//# sourceMappingURL=chunk-BL3NTXLM.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../cli.common/build/esm/ExitProcessError.js","../../../cli.common/build/esm/YargsCheckError.js","../../../cli.common/build/esm/index.js","../../../cli.common/build/esm/getYargsBase.js","../../../cli.common/build/esm/yargs/logLevelMiddleware.js","../../../cli.common/build/esm/util/isValidSemver.js"],"names":["consola"],"mappings":";;;;;;;;AAAA,cAAA,EAAA;AAgBa,IAAA,gBAAA,GAAN,cAA+B,KAAM,CAAA;AAAA,EAC1C,WAAY,CAAA,SAAA,EAAW,GAAK,EAAA,GAAA,EAAK,aAAe,EAAA;AAC9C,IAAA,KAAA,CAAM,GAAG,CAAA;AACT,IAAA,IAAA,CAAK,SAAY,GAAA,SAAA;AACjB,IAAA,IAAA,CAAK,GAAM,GAAA,GAAA;AACX,IAAA,IAAA,CAAK,GAAM,GAAA,GAAA;AACX,IAAA,IAAA,CAAK,aAAgB,GAAA,aAAA;AAAA;AAEzB;;;ACxBA,cAAA,EAAA;AAgBa,IAAA,eAAA,GAAN,cAA8B,KAAM,CAAA;AAAA,EACzC,YAAY,GAAK,EAAA;AACf,IAAA,KAAA,CAAM,GAAG,CAAA;AAAA;AAEb;;;ACpBA,cAAA,EAAA;;;ACAA,cAAA,EAAA;;;ACAA,cAAA,EAAA;AAiBA,IAAI,SAAY,GAAA,IAAA;AAChB,eAAsB,mBAAmB,IAAM,EAAA;AAC7C,EAAA,IAAI,SAAW,EAAA;AACb,IAAY,SAAA,GAAA,KAAA;AACZ,IAAQ,OAAA,CAAA,KAAA,GAAQ,IAAI,IAAK,CAAA,OAAA;AACzB,IAAI,IAAA,OAAA,CAAQ,QAAQ,CAAG,EAAA;AACrB,MAAA,OAAA,CAAQ,MAAM,CAA4B,yBAAA,EAAA,OAAA,CAAQ,KAAU,KAAA,CAAA,GAAI,UAAU,OAAO,CAAA;AAAA,CAAK,CAAA;AAAA;AACxF;AAEJ;;;ADHO,SA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AAc,YAAc,EAAA;AAC1C,EAAO,OAAA,KAAA,CAAM,YAAY,CAAK,IAAA,IAAA;AAChC","file":"chunk-BL3NTXLM.js","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\nexport class ExitProcessError extends Error {\n constructor(errorCode, msg, tip, originalError) {\n super(msg);\n this.errorCode = errorCode;\n this.msg = msg;\n this.tip = tip;\n this.originalError = originalError;\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 class YargsCheckError extends Error {\n constructor(msg) {\n super(msg);\n }\n}","/*\n * Copyright 2024 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 { ExitProcessError } from \"./ExitProcessError.js\";\nexport { getYargsBase } from \"./getYargsBase.js\";\nexport { isValidSemver } from \"./util/isValidSemver.js\";\nexport { YargsCheckError } from \"./YargsCheckError.js\";","/*\n * Copyright 2024 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 { consola } from \"consola\";\nimport { colorize } from \"consola/utils\";\nimport yargs from \"yargs\";\nimport { hideBin } from \"yargs/helpers\";\nimport { ExitProcessError } from \"./ExitProcessError.js\";\nimport { logLevelMiddleware } from \"./yargs/logLevelMiddleware.js\";\nimport { YargsCheckError } from \"./YargsCheckError.js\";\nexport function getYargsBase(args) {\n return yargs(hideBin(args)).wrap(Math.min(150, yargs().terminalWidth())).env(\"OSDK\").version(false).option(\"verbose\", {\n alias: \"v\",\n type: \"boolean\",\n description: \"Enable verbose logging\",\n count: true\n }).demandCommand().middleware(logLevelMiddleware, true).strict().fail(async (msg, err, argv) => {\n if (err instanceof ExitProcessError) {\n consola.error(err.message);\n if (err.tip != null) {\n consola.log(colorize(\"bold\", `💡 Tip: ${err.tip}`));\n consola.log(\"\");\n }\n consola.debug(err.stack);\n } else {\n if (err && !(err instanceof YargsCheckError)) {\n throw err;\n } else {\n argv.showHelp();\n consola.log(\"\");\n consola.error(msg);\n }\n }\n process.exit(1);\n });\n}","/*\n * Copyright 2024 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 { consola } from \"consola\";\nlet firstTime = true;\nexport async function logLevelMiddleware(args) {\n if (firstTime) {\n firstTime = false;\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 }\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 { valid } from \"semver\";\nexport function isValidSemver(semverString) {\n return valid(semverString) != null;\n}"]}
|
|
@@ -1,43 +0,0 @@
|
|
|
1
|
-
import 'path';
|
|
2
|
-
import 'url';
|
|
3
|
-
|
|
4
|
-
var __create = Object.create;
|
|
5
|
-
var __defProp = Object.defineProperty;
|
|
6
|
-
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
7
|
-
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
8
|
-
var __getProtoOf = Object.getPrototypeOf;
|
|
9
|
-
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
10
|
-
var __esm = (fn, res) => function __init() {
|
|
11
|
-
return fn && (res = (0, fn[__getOwnPropNames(fn)[0]])(fn = 0)), res;
|
|
12
|
-
};
|
|
13
|
-
var __commonJS = (cb, mod) => function __require() {
|
|
14
|
-
return mod || (0, cb[__getOwnPropNames(cb)[0]])((mod = { exports: {} }).exports, mod), mod.exports;
|
|
15
|
-
};
|
|
16
|
-
var __export = (target, all) => {
|
|
17
|
-
for (var name in all)
|
|
18
|
-
__defProp(target, name, { get: all[name], enumerable: true });
|
|
19
|
-
};
|
|
20
|
-
var __copyProps = (to, from, except, desc) => {
|
|
21
|
-
if (from && typeof from === "object" || typeof from === "function") {
|
|
22
|
-
for (let key of __getOwnPropNames(from))
|
|
23
|
-
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
24
|
-
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
25
|
-
}
|
|
26
|
-
return to;
|
|
27
|
-
};
|
|
28
|
-
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
29
|
-
// If the importer is in node compatibility mode or this is not an ESM
|
|
30
|
-
// file that has been converted to a CommonJS file using a Babel-
|
|
31
|
-
// compatible transform (i.e. "__esModule" has not been set), then set
|
|
32
|
-
// "default" to the CommonJS "module.exports" for node compatibility.
|
|
33
|
-
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
|
34
|
-
mod
|
|
35
|
-
));
|
|
36
|
-
var init_esm_shims = __esm({
|
|
37
|
-
"../../node_modules/.pnpm/tsup@8.5.0_@microsoft+api-extractor@7.52.11_@types+node@18.19.124__@swc+core@1.7.39_jit_5812e3bb233f51687c0be44fc94bb79b/node_modules/tsup/assets/esm_shims.js"() {
|
|
38
|
-
}
|
|
39
|
-
});
|
|
40
|
-
|
|
41
|
-
export { __commonJS, __export, __toESM, init_esm_shims };
|
|
42
|
-
//# sourceMappingURL=chunk-CINFOKVJ.js.map
|
|
43
|
-
//# sourceMappingURL=chunk-CINFOKVJ.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../../node_modules/.pnpm/tsup@8.5.0_@microsoft+api-extractor@7.52.11_@types+node@18.19.124__@swc+core@1.7.39_jit_5812e3bb233f51687c0be44fc94bb79b/node_modules/tsup/assets/esm_shims.js"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,IAAA,cAAA,GAAA,KAAA,CAAA;AAAA,EAAA,yLAAA,GAAA;AAAA;AAAA,CAAA","file":"chunk-CINFOKVJ.js","sourcesContent":["// Shim globals in esm bundle\nimport path from 'node:path';\nimport { fileURLToPath } from 'node:url';\nconst getFilename = () => fileURLToPath(import.meta.url);\nconst getDirname = () => path.dirname(getFilename());\nexport const __dirname = /* @__PURE__ */getDirname();\nexport const __filename = /* @__PURE__ */getFilename();"]}
|
|
@@ -1,28 +0,0 @@
|
|
|
1
|
-
import { init_esm_shims } from './chunk-CINFOKVJ.js';
|
|
2
|
-
|
|
3
|
-
// ../widget.api/build/esm/manifest.js
|
|
4
|
-
init_esm_shims();
|
|
5
|
-
var MANIFEST_FILE_LOCATION = ".palantir/widgets.config.json";
|
|
6
|
-
|
|
7
|
-
// ../widget.api/build/esm/index.js
|
|
8
|
-
init_esm_shims();
|
|
9
|
-
|
|
10
|
-
// ../widget.api/build/esm/config.js
|
|
11
|
-
init_esm_shims();
|
|
12
|
-
|
|
13
|
-
// ../widget.api/build/esm/messages/hostMessages.js
|
|
14
|
-
init_esm_shims();
|
|
15
|
-
var HostMessage;
|
|
16
|
-
(function(_HostMessage) {
|
|
17
|
-
_HostMessage.Version = "1.0.0";
|
|
18
|
-
})(HostMessage || (HostMessage = {}));
|
|
19
|
-
|
|
20
|
-
// ../widget.api/build/esm/messages/widgetMessages.js
|
|
21
|
-
init_esm_shims();
|
|
22
|
-
|
|
23
|
-
// ../widget.api/build/esm/permissions.js
|
|
24
|
-
init_esm_shims();
|
|
25
|
-
|
|
26
|
-
export { MANIFEST_FILE_LOCATION };
|
|
27
|
-
//# sourceMappingURL=chunk-CKZAZPXC.js.map
|
|
28
|
-
//# sourceMappingURL=chunk-CKZAZPXC.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../widget.api/build/esm/manifest.js","../../../widget.api/build/esm/index.js","../../../widget.api/build/esm/config.js","../../../widget.api/build/esm/messages/hostMessages.js","../../../widget.api/build/esm/messages/widgetMessages.js","../../../widget.api/build/esm/permissions.js"],"names":[],"mappings":";;;AAAA,cAAA,EAAA;AAgBO,IAAM,sBAAyB,GAAA;;;AChBtC,cAAA,EAAA;;;ACAA,cAAA,EAAA;;;ACAA,cAAA,EAAA;AAgBO,IAAI,WAAA;AAAA,CACV,SAAU,YAAc,EAAA;AACvB,EAAA,YAAA,CAAa,OAAU,GAAA,OAAA;AACzB,CAAG,EAAA,WAAA,KAAgB,WAAc,GAAA,EAAG,CAAA,CAAA;;;ACnBpC,cAAA,EAAA;;;ACAA,cAAA,EAAA","file":"chunk-CKZAZPXC.js","sourcesContent":["/*\n * Copyright 2024 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 MANIFEST_FILE_LOCATION = \".palantir/widgets.config.json\";","/*\n * Copyright 2024 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 { defineConfig } from \"./config.js\";\nexport { MANIFEST_FILE_LOCATION } from \"./manifest.js\";\nexport { HostMessage, isHostParametersUpdatedMessage, visitHostMessage } from \"./messages/hostMessages.js\";\nexport { isWidgetEmitEventMessage, isWidgetReadyMessage, isWidgetResizeMessage, visitWidgetMessage } from \"./messages/widgetMessages.js\";\nexport { BrowserPermission } from \"./permissions.js\";","/*\n * Copyright 2024 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/**\n * Extracts the parameter ID strings as types from the given ParameterConfig.\n */\n\n/**\n * Extracts a map of parameter IDs to their async-wrapped value types from the given ParameterConfig.\n */\n\n/**\n * Extracts a map of parameter IDs to the raw parameter values from the given ParameterConfig.\n */\n\n/**\n * Extracts a list of strongly-typed parameter IDs from the given WidgetConfig for a given event ID.\n * If a parameter ID is referenced by an event but does not exist, its type will be never\n */\n\n/**\n * Extracts a map of event IDs to their raw parameter value types from the given WidgetConfig.\n */\n\nexport function defineConfig(c) {\n return c;\n}","/*\n * Copyright 2024 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// Interfaces and type guards for messages passed from the host Foundry UI to the widget\nexport let HostMessage;\n(function (_HostMessage) {\n _HostMessage.Version = \"1.0.0\";\n})(HostMessage || (HostMessage = {}));\nexport function isHostParametersUpdatedMessage(event) {\n return event.type === \"host.update-parameters\";\n}\n/**\n * Strongly typed visitor to handle every type of host message\n */\nexport function visitHostMessage(message, visitor) {\n const {\n type,\n payload\n } = message;\n const handler = visitor[type];\n if (handler) {\n // Typescript creates an & of the parameters instead of a union\n handler(payload);\n } else {\n visitor._unknown(type);\n }\n}","/*\n * Copyright 2024 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// Interfaces and type guards for messages passed from the widget to the host Foundry UI\nexport let WidgetMessage;\nexport function isWidgetReadyMessage(event) {\n return event.type === \"widget.ready\";\n}\nexport function isWidgetResizeMessage(event) {\n return event.type === \"widget.resize\";\n}\nexport function isWidgetEmitEventMessage(event) {\n return event.type === \"widget.emit-event\";\n}\nexport function visitWidgetMessage(message, visitor) {\n const {\n type,\n payload\n } = message;\n const handler = visitor[type];\n if (handler) {\n // Typescript creates an & of the parameters instead of a union\n handler(payload);\n } else {\n visitor._unknown(type);\n }\n}","/*\n * Copyright 2026 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/**\n * An additional browser permission that can be requested by a widget.\n */\nexport const BrowserPermission = {\n /** The permissions policy allow camera attribute value */\n CAMERA: \"camera\",\n /** The permissions policy allow microphone attribute value */\n MICROPHONE: \"microphone\",\n /** The permissions policy allow autoplay attribute value */\n AUTOPLAY: \"autoplay\",\n /** The sandbox allow-downloads attribute value */\n ALLOW_DOWNLOADS: \"allow-downloads\",\n /** The sandbox allow-forms attribute value */\n ALLOW_FORMS: \"allow-forms\",\n /** The sandbox allow-popups attribute value */\n ALLOW_POPUPS: \"allow-popups\"\n};"]}
|