@osdk/cli 0.5.0 → 0.7.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/build/js/{chunk-GTNZA5UY.mjs → chunk-CLAEREOL.mjs} +4 -2
- package/build/js/chunk-CLAEREOL.mjs.map +1 -0
- package/build/js/chunk-DQYIDDJN.cjs +17 -0
- package/build/js/chunk-DQYIDDJN.cjs.map +1 -0
- package/build/js/{chunk-XNYKWAIE.mjs → chunk-EZIJJWAA.mjs} +35 -16
- package/build/js/chunk-EZIJJWAA.mjs.map +1 -0
- package/build/js/chunk-GX2IOTA6.mjs +10 -0
- package/build/js/{chunk-N6K26UR4.mjs.map → chunk-GX2IOTA6.mjs.map} +1 -1
- package/build/js/{chunk-JFDXL5SV.mjs → chunk-HD6SVFKA.mjs} +5 -5
- package/build/js/chunk-HD6SVFKA.mjs.map +1 -0
- package/build/js/{chunk-HYF3CTKZ.cjs → chunk-HZ3XILMW.cjs} +4 -2
- package/build/js/chunk-HZ3XILMW.cjs.map +1 -0
- package/build/js/chunk-IV3QY3PZ.mjs +15 -0
- package/build/js/chunk-IV3QY3PZ.mjs.map +1 -0
- package/build/js/{chunk-D7QHLGEU.cjs → chunk-JFYC74FJ.cjs} +41 -22
- package/build/js/chunk-JFYC74FJ.cjs.map +1 -0
- package/build/js/{chunk-2DZBTS5E.cjs → chunk-TZGNA5WR.cjs} +5 -5
- package/build/js/chunk-TZGNA5WR.cjs.map +1 -0
- package/build/js/chunk-UE2TMWJL.cjs +12 -0
- package/build/js/{chunk-X2S4O5ZR.cjs.map → chunk-UE2TMWJL.cjs.map} +1 -1
- package/build/js/{handleGenerate-Q6EQWXFG.cjs → handleGenerate-GBN42PDO.cjs} +11 -11
- package/build/js/handleGenerate-GBN42PDO.cjs.map +1 -0
- package/build/js/{handleGenerate-ZUZV3IBI.mjs → handleGenerate-NQPMMKLX.mjs} +10 -10
- package/build/js/handleGenerate-NQPMMKLX.mjs.map +1 -0
- package/build/js/index.cjs +99 -55
- package/build/js/index.cjs.map +1 -1
- package/build/js/index.mjs +95 -51
- package/build/js/index.mjs.map +1 -1
- package/build/js/loginFlow-5ZAMXQKE.cjs +10 -0
- package/build/js/loginFlow-BWWZBM36.mjs +4 -0
- package/build/js/siteDeployCommand-7QTLGWZI.mjs +150 -0
- package/build/js/siteDeployCommand-7QTLGWZI.mjs.map +1 -0
- package/build/js/siteDeployCommand-HOXKQM56.cjs +176 -0
- package/build/js/siteDeployCommand-HOXKQM56.cjs.map +1 -0
- package/build/js/versionDeleteCommand-GDQEZLYA.cjs +38 -0
- package/build/js/versionDeleteCommand-GDQEZLYA.cjs.map +1 -0
- package/build/js/{versionDeleteCommand-6BJL5XLG.mjs → versionDeleteCommand-LQRGKTMH.mjs} +13 -3
- package/build/js/versionDeleteCommand-LQRGKTMH.mjs.map +1 -0
- package/build/js/{versionGetCommand-OR4RLOLM.mjs → versionGetCommand-NZAQX7U5.mjs} +3 -3
- package/build/js/{versionGetCommand-Y2VR2WKH.cjs → versionGetCommand-RU5LS3IG.cjs} +8 -8
- package/build/js/{versionListCommand-LPPGQCQF.mjs → versionListCommand-5N57YKEQ.mjs} +6 -4
- package/build/js/versionListCommand-5N57YKEQ.mjs.map +1 -0
- package/build/js/{versionListCommand-5KM5PFYL.cjs → versionListCommand-QYCTS6KU.cjs} +11 -9
- package/build/js/versionListCommand-QYCTS6KU.cjs.map +1 -0
- package/build/js/{versionSetCommand-VD3L5DOV.cjs → versionSetCommand-K4SDBPLB.cjs} +8 -8
- package/build/js/{versionSetCommand-LHOVVI6U.mjs → versionSetCommand-UWPAQ7NV.mjs} +3 -3
- package/build/js/versionUnsetCommand-INDJ26MO.cjs +36 -0
- package/build/js/versionUnsetCommand-INDJ26MO.cjs.map +1 -0
- package/build/js/{versionUnsetCommand-IJT4JWBN.mjs → versionUnsetCommand-PZRZPTPR.mjs} +13 -3
- package/build/js/versionUnsetCommand-PZRZPTPR.mjs.map +1 -0
- package/build/types/ExitProcessError.d.ts +3 -1
- package/build/types/commands/auth/CommonAuthArgs.d.ts +1 -1
- package/build/types/commands/auth/login/LoginArgs.d.ts +1 -1
- package/build/types/commands/site/deploy/SiteDeployArgs.d.ts +2 -1
- package/build/types/commands/site/deploy/siteDeployCommand.d.mts +8 -1
- package/build/types/commands/site/version/delete/VersionDeleteArgs.d.ts +5 -0
- package/build/types/commands/site/version/delete/index.d.ts +2 -2
- package/build/types/commands/site/version/delete/versionDeleteCommand.d.mts +2 -2
- package/build/types/commands/site/version/get/VersionGetArgs.d.ts +3 -0
- package/build/types/commands/site/version/get/index.d.ts +2 -1
- package/build/types/commands/site/version/get/versionGetCommand.d.mts +2 -2
- package/build/types/commands/site/version/list/VersionListArgs.d.ts +3 -0
- package/build/types/commands/site/version/list/index.d.ts +2 -1
- package/build/types/commands/site/version/list/versionListCommand.d.mts +2 -2
- package/build/types/commands/site/version/set/VersionSetArgs.d.ts +4 -0
- package/build/types/commands/site/version/set/index.d.ts +2 -2
- package/build/types/commands/site/version/set/versionSetCommand.d.mts +2 -2
- package/build/types/commands/site/version/unset/VersionUnsetArgs.d.ts +4 -0
- package/build/types/commands/site/version/unset/index.d.ts +2 -1
- package/build/types/commands/site/version/unset/versionUnsetCommand.d.mts +2 -2
- package/build/types/commands/typescript/generate/TypescriptGenerateArgs.d.ts +1 -1
- package/build/types/consola/handlePromptCancel.d.ts +1 -0
- package/build/types/net/UserAgent.d.ts +1 -0
- package/build/types/net/index.d.mts +1 -0
- package/build/types/util/config.d.ts +2 -2
- package/build/types/util/token.d.ts +2 -2
- package/changelog/0.6.0/pr-54.v2.yml +5 -0
- package/changelog/0.6.0/pr-56.v2.yml +5 -0
- package/changelog/0.6.0/pr-58.v2.yml +5 -0
- package/changelog/0.7.0/pr-50.v2.yml +5 -0
- package/changelog/0.7.0/pr-52.v2.yml +5 -0
- package/changelog/0.7.0/pr-55.v2.yml +5 -0
- package/changelog/0.7.0/pr-61.v2.yml +5 -0
- package/changelog/0.7.0/pr-63.v2.yml +5 -0
- package/package.json +9 -3
- package/build/js/chunk-2DZBTS5E.cjs.map +0 -1
- package/build/js/chunk-D7QHLGEU.cjs.map +0 -1
- package/build/js/chunk-GTNZA5UY.mjs.map +0 -1
- package/build/js/chunk-HYF3CTKZ.cjs.map +0 -1
- package/build/js/chunk-JFDXL5SV.mjs.map +0 -1
- package/build/js/chunk-N6K26UR4.mjs +0 -9
- package/build/js/chunk-X2S4O5ZR.cjs +0 -11
- package/build/js/chunk-XNYKWAIE.mjs.map +0 -1
- package/build/js/handleGenerate-Q6EQWXFG.cjs.map +0 -1
- package/build/js/handleGenerate-ZUZV3IBI.mjs.map +0 -1
- package/build/js/loginFlow-BZDDHHT5.cjs +0 -10
- package/build/js/loginFlow-KGLTXVZ6.mjs +0 -4
- package/build/js/siteDeployCommand-7GXJF5HF.mjs +0 -100
- package/build/js/siteDeployCommand-7GXJF5HF.mjs.map +0 -1
- package/build/js/siteDeployCommand-KUNL3GIW.cjs +0 -126
- package/build/js/siteDeployCommand-KUNL3GIW.cjs.map +0 -1
- package/build/js/versionDeleteCommand-6BJL5XLG.mjs.map +0 -1
- package/build/js/versionDeleteCommand-RLU7UUYD.cjs +0 -28
- package/build/js/versionDeleteCommand-RLU7UUYD.cjs.map +0 -1
- package/build/js/versionListCommand-5KM5PFYL.cjs.map +0 -1
- package/build/js/versionListCommand-LPPGQCQF.mjs.map +0 -1
- package/build/js/versionUnsetCommand-IJT4JWBN.mjs.map +0 -1
- package/build/js/versionUnsetCommand-XYBUQ6XB.cjs +0 -26
- package/build/js/versionUnsetCommand-XYBUQ6XB.cjs.map +0 -1
- package/build/types/commands/site/version/SiteVersionArgs.d.ts +0 -4
- /package/build/js/{loginFlow-BZDDHHT5.cjs.map → loginFlow-5ZAMXQKE.cjs.map} +0 -0
- /package/build/js/{loginFlow-KGLTXVZ6.mjs.map → loginFlow-BWWZBM36.mjs.map} +0 -0
- /package/build/js/{versionGetCommand-OR4RLOLM.mjs.map → versionGetCommand-NZAQX7U5.mjs.map} +0 -0
- /package/build/js/{versionGetCommand-Y2VR2WKH.cjs.map → versionGetCommand-RU5LS3IG.cjs.map} +0 -0
- /package/build/js/{versionSetCommand-LHOVVI6U.mjs.map → versionSetCommand-K4SDBPLB.cjs.map} +0 -0
- /package/build/js/{versionSetCommand-VD3L5DOV.cjs.map → versionSetCommand-UWPAQ7NV.mjs.map} +0 -0
|
@@ -1,11 +1,13 @@
|
|
|
1
1
|
// src/ExitProcessError.ts
|
|
2
2
|
var ExitProcessError = class extends Error {
|
|
3
|
-
constructor(errorCode, msg) {
|
|
3
|
+
constructor(errorCode, msg, tip) {
|
|
4
4
|
super(msg);
|
|
5
5
|
this.errorCode = errorCode;
|
|
6
|
+
this.msg = msg;
|
|
7
|
+
this.tip = tip;
|
|
6
8
|
}
|
|
7
9
|
};
|
|
8
10
|
|
|
9
11
|
export { ExitProcessError };
|
|
10
12
|
//# sourceMappingURL=out.js.map
|
|
11
|
-
//# sourceMappingURL=chunk-
|
|
13
|
+
//# sourceMappingURL=chunk-CLAEREOL.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../src/ExitProcessError.ts"],"names":[],"mappings":";AAgBO,IAAM,mBAAN,cAA+B,MAAM;AAAA,EAC1C,YAAY,WAAW,KAAK,KAAK;AAC/B,UAAM,GAAG;AACT,SAAK,YAAY;AACjB,SAAK,MAAM;AACX,SAAK,MAAM;AAAA,EACb;AACF","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) {\n super(msg);\n this.errorCode = errorCode;\n this.msg = msg;\n this.tip = tip;\n }\n}"]}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
var consola = require('consola');
|
|
4
|
+
|
|
5
|
+
// src/consola/handlePromptCancel.ts
|
|
6
|
+
function handlePromptCancel(promptResponse) {
|
|
7
|
+
const isFalse = typeof promptResponse === "boolean" && !promptResponse;
|
|
8
|
+
const isSigInt = typeof promptResponse === "symbol" && promptResponse.toString() === "Symbol(clack:cancel)";
|
|
9
|
+
if (isSigInt || isFalse) {
|
|
10
|
+
consola.consola.fail("Operation cancelled");
|
|
11
|
+
process.exit(0);
|
|
12
|
+
}
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
exports.handlePromptCancel = handlePromptCancel;
|
|
16
|
+
//# sourceMappingURL=out.js.map
|
|
17
|
+
//# sourceMappingURL=chunk-DQYIDDJN.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../src/consola/handlePromptCancel.ts"],"names":[],"mappings":";AAgBA,SAAS,eAAe;AACjB,SAAS,mBAAmB,gBAAgB;AACjD,QAAM,UAAU,OAAO,mBAAmB,aAAa,CAAC;AAExD,QAAM,WAAW,OAAO,mBAAmB,YAAY,eAAe,SAAS,MAAM;AACrF,MAAI,YAAY,SAAS;AACvB,YAAQ,KAAK,qBAAqB;AAClC,YAAQ,KAAK,CAAC;AAAA,EAChB;AACF","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\";\nexport function handlePromptCancel(promptResponse) {\n const isFalse = typeof promptResponse === \"boolean\" && !promptResponse;\n // https://github.com/unjs/consola/issues/251\n const isSigInt = typeof promptResponse === \"symbol\" && promptResponse.toString() === \"Symbol(clack:cancel)\";\n if (isSigInt || isFalse) {\n consola.fail(\"Operation cancelled\");\n process.exit(0);\n }\n}"]}
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import { ExitProcessError } from './chunk-
|
|
1
|
+
import { ExitProcessError } from './chunk-CLAEREOL.mjs';
|
|
2
2
|
import { __export } from './chunk-E2SEJZTC.mjs';
|
|
3
3
|
import { conjureFetch } from 'conjure-lite';
|
|
4
4
|
import { consola } from 'consola';
|
|
5
|
-
import { createFetchHeaderMutator } from '@osdk/shared.net';
|
|
5
|
+
import { createFetchHeaderMutator, createFetchOrThrow, PalantirApiError } from '@osdk/shared.net';
|
|
6
6
|
import { promises } from 'fs';
|
|
7
7
|
import path from 'path';
|
|
8
8
|
|
|
@@ -64,23 +64,42 @@ __export(SiteAssetArtifactsService_exports, {
|
|
|
64
64
|
fetchSiteVersions: () => fetchSiteVersions,
|
|
65
65
|
uploadZippedSiteAsset: () => uploadZippedSiteAsset
|
|
66
66
|
});
|
|
67
|
+
|
|
68
|
+
// src/net/UserAgent.ts
|
|
69
|
+
var USER_AGENT = `osdk-cli/${"0.7.0"}`;
|
|
70
|
+
|
|
71
|
+
// src/net/createFetch.mts
|
|
67
72
|
function createFetch(tokenProvider, fetchFn = fetch) {
|
|
68
|
-
return createFetchHeaderMutator(
|
|
73
|
+
return createFetchHeaderMutator(createRequestLoggingFetch(createErrorExitingFetch(createFetchOrThrow(fetchFn))), async (headers) => {
|
|
69
74
|
const token = await tokenProvider();
|
|
70
75
|
headers.set("Authorization", `Bearer ${token}`);
|
|
71
|
-
headers.set("Fetch-User-Agent",
|
|
76
|
+
headers.set("Fetch-User-Agent", USER_AGENT);
|
|
72
77
|
return headers;
|
|
73
78
|
});
|
|
74
79
|
}
|
|
75
|
-
function
|
|
76
|
-
return function
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
80
|
+
function createErrorExitingFetch(fetchFn = fetch) {
|
|
81
|
+
return function errorExitingFetch(input, init) {
|
|
82
|
+
return fetchFn(input, init).catch(handleFetchError);
|
|
83
|
+
};
|
|
84
|
+
}
|
|
85
|
+
function handleFetchError(e) {
|
|
86
|
+
if (!(e instanceof PalantirApiError)) {
|
|
87
|
+
throw new ExitProcessError(1, "Unexpected fetch error");
|
|
88
|
+
}
|
|
89
|
+
let tip;
|
|
90
|
+
if (e.statusCode === 401) {
|
|
91
|
+
tip = "Check your token is valid and has not expired or been disabled";
|
|
92
|
+
} else if (e.statusCode === 403) {
|
|
93
|
+
tip = "Check your token has the required scopes for this operation";
|
|
94
|
+
}
|
|
95
|
+
throw new ExitProcessError(1, e.message, tip);
|
|
96
|
+
}
|
|
97
|
+
function createRequestLoggingFetch(fetchFn = fetch) {
|
|
98
|
+
return function requestLoggingFetch(input, init) {
|
|
99
|
+
const requestLog = typeof input === "string" || input instanceof URL ? `${init?.method ?? "GET"}: ${input.toString().trim()}` : `${input.method ?? "GET"}: ${input.url.toString().trim()}`;
|
|
100
|
+
consola.trace(requestLog);
|
|
82
101
|
return fetchFn(input, init).then((a) => {
|
|
83
|
-
consola.
|
|
102
|
+
consola.trace(`FINISH ${requestLog}`);
|
|
84
103
|
return a;
|
|
85
104
|
});
|
|
86
105
|
};
|
|
@@ -180,13 +199,13 @@ __export(third_party_application_service_exports, {
|
|
|
180
199
|
var TOKEN_ENV_VARS = ["FOUNDRY_TOKEN", "FOUNDRY_SDK_AUTH_TOKEN"];
|
|
181
200
|
async function loadToken(token, tokenFile) {
|
|
182
201
|
if (token) {
|
|
183
|
-
consola.debug(`Using token from --token
|
|
202
|
+
consola.debug(`Using token from --token option`);
|
|
184
203
|
validate(token);
|
|
185
204
|
return token;
|
|
186
205
|
}
|
|
187
206
|
if (tokenFile) {
|
|
188
207
|
const loadedToken = await loadTokenFile(tokenFile);
|
|
189
|
-
consola.debug(`Using token from --tokenFile=${loadedToken.filePath}
|
|
208
|
+
consola.debug(`Using token from --tokenFile=${loadedToken.filePath} option`);
|
|
190
209
|
validate(loadedToken.token);
|
|
191
210
|
return loadedToken.token;
|
|
192
211
|
}
|
|
@@ -201,7 +220,7 @@ async function loadToken(token, tokenFile) {
|
|
|
201
220
|
return environmentToken;
|
|
202
221
|
}
|
|
203
222
|
}
|
|
204
|
-
throw new ExitProcessError(2, `No token found
|
|
223
|
+
throw new ExitProcessError(2, `No token found.`, `You can supply a --token or --token-file option, or set the ${TOKEN_ENV_VARS[0]} environment variable`);
|
|
205
224
|
}
|
|
206
225
|
async function loadTokenFile(filePath) {
|
|
207
226
|
let token;
|
|
@@ -230,4 +249,4 @@ function isJWT(token) {
|
|
|
230
249
|
|
|
231
250
|
export { ArtifactsSitesAdminV2Service_exports, artifacts_exports, createConjureContext, createInternalClientContext, loadToken, third_party_application_service_exports };
|
|
232
251
|
//# sourceMappingURL=out.js.map
|
|
233
|
-
//# sourceMappingURL=chunk-
|
|
252
|
+
//# sourceMappingURL=chunk-EZIJJWAA.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../src/generated/artifacts-sites/ArtifactsSitesAdminV2Service.ts","../../src/generated/artifacts-sites/ArtifactsSitesAdminV2Service/clearDeployedVersion.ts","../../src/generated/artifacts-sites/ArtifactsSitesAdminV2Service/getContentSecurityPolicyAdditions.ts","../../src/generated/artifacts-sites/ArtifactsSitesAdminV2Service/getDeployedVersion.ts","../../src/generated/artifacts-sites/ArtifactsSitesAdminV2Service/getRegisteredSiteDomains.ts","../../src/generated/artifacts-sites/ArtifactsSitesAdminV2Service/getRequestedSiteDomains.ts","../../src/generated/artifacts-sites/ArtifactsSitesAdminV2Service/previewContentSecurityPolicy.ts","../../src/generated/artifacts-sites/ArtifactsSitesAdminV2Service/putContentSecurityPolicyAdditions.ts","../../src/generated/artifacts-sites/ArtifactsSitesAdminV2Service/requestSiteDomainForRepository.ts","../../src/generated/artifacts-sites/ArtifactsSitesAdminV2Service/unregisterSiteDomain.ts","../../src/generated/artifacts-sites/ArtifactsSitesAdminV2Service/updateDeployedVersion.ts","../../src/net/artifacts/index.mts","../../src/net/artifacts/SiteAssetArtifactsService/index.mts","../../src/net/artifacts/SiteAssetArtifactsService/deleteSiteVersion.mts","../../src/net/createFetch.mts","../../src/net/UserAgent.ts","../../src/net/third-party-application-service/fetchWebsiteRepositoryRid.mts","../../src/net/artifacts/SiteAssetArtifactsService/getSiteAssetBaseUrl.mts","../../src/net/artifacts/SiteAssetArtifactsService/fetchSiteVersions.mts","../../src/net/artifacts/SiteAssetArtifactsService/uploadSiteVersion.mts","../../src/net/createConjureContext.mts","../../src/net/createInternalClientContext.mts","../../src/net/third-party-application-service/index.mts","../../src/util/token.ts"],"names":["conjureFetch","consola","fetch"],"mappings":";;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;;;ACgBA,SAAS,oBAAoB;AAQ7B,eAAsB,qBAAqB,KAAK,eAAe;AAC7D,SAAO,aAAa,KAAK,8BAA8B,aAAa,qBAAqB,QAAQ;AACnG;;;ACVA,SAAS,gBAAAA,qBAAoB;AAM7B,eAAsB,kCAAkC,KAAK,eAAe;AAC1E,SAAOA,cAAa,KAAK,8BAA8B,aAAa,kBAAkB,KAAK;AAC7F;;;ACRA,SAAS,gBAAAA,qBAAoB;AAM7B,eAAsB,mBAAmB,KAAK,eAAe;AAC3D,SAAOA,cAAa,KAAK,8BAA8B,aAAa,qBAAqB,KAAK;AAChG;;;ACRA,SAAS,gBAAAA,qBAAoB;AAO7B,eAAsB,yBAAyB,KAAK,eAAe;AACjE,SAAOA,cAAa,KAAK,8BAA8B,aAAa,uBAAuB,KAAK;AAClG;;;ACTA,SAAS,gBAAAA,qBAAoB;AAQ7B,eA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AAA,EACrB;AACA,aAAW,UAAU,gBAAgB;AACnC,UAAM,mBAAmB,QAAQ,IAAI,MAAM;AAC3C,QAAI,kBAAkB;AACpB,MAAAA,SAAQ,MAAM,oBAAoB,MAAM,uBAAuB;AAC/D,eAAS,gBAAgB;AACzB,UAAI,WAAW,0BAA0B;AACvC,QAAAA,SAAQ,KAAK,oGAAoG;AAAA,MACnH;AACA,aAAO;AAAA,IACT;AAAA,EACF;AACA,QAAM,IAAI,iBAAiB,GAAG,mBAAmB,+DAA+D,eAAe,CAAC,CAAC,uBAAuB;AAC1J;AAOA,eAAsB,cAAc,UAAU;AAC5C,MAAI;AACJ,MAAI;AACJ,MAAI;AACF,mBAAe,KAAK,QAAQ,QAAQ;AACpC,YAAQ,MAAM,WAAW,SAAS,cAAc,MAAM;AACtD,YAAQ,MAAM,KAAK;AAAA,EACrB,SAAS,OAAO;AACd,UAAM,IAAI,iBAAiB,GAAG,8BAA8B,QAAQ,MAAM,KAAK,EAAE;AAAA,EACnF;AACA,SAAO;AAAA,IACL,UAAU;AAAA,IACV;AAAA,EACF;AACF;AACO,SAAS,SAAS,OAAO;AAC9B,MAAI,CAAC,MAAM,KAAK,GAAG;AACjB,UAAM,IAAI,iBAAiB,GAAG,mCAAmC;AAAA,EACnE;AACF;AACA,SAAS,MAAM,OAAO;AAEpB,QAAM,aAAa;AACnB,SAAO,WAAW,KAAK,KAAK;AAC9B","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 { clearDeployedVersion } from \"./ArtifactsSitesAdminV2Service/clearDeployedVersion.js\";\nexport { getContentSecurityPolicyAdditions } from \"./ArtifactsSitesAdminV2Service/getContentSecurityPolicyAdditions.js\";\nexport { getDeployedVersion } from \"./ArtifactsSitesAdminV2Service/getDeployedVersion.js\";\nexport { getRegisteredSiteDomains } from \"./ArtifactsSitesAdminV2Service/getRegisteredSiteDomains.js\";\nexport { getRequestedSiteDomains } from \"./ArtifactsSitesAdminV2Service/getRequestedSiteDomains.js\";\nexport { previewContentSecurityPolicy } from \"./ArtifactsSitesAdminV2Service/previewContentSecurityPolicy.js\";\nexport { putContentSecurityPolicyAdditions } from \"./ArtifactsSitesAdminV2Service/putContentSecurityPolicyAdditions.js\";\nexport { requestSiteDomainForRepository } from \"./ArtifactsSitesAdminV2Service/requestSiteDomainForRepository.js\";\nexport { unregisterSiteDomain } from \"./ArtifactsSitesAdminV2Service/unregisterSiteDomain.js\";\nexport { updateDeployedVersion } from \"./ArtifactsSitesAdminV2Service/updateDeployedVersion.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 { conjureFetch } from \"conjure-lite\";\n\n/**\n * Clears the deployed version while leaving the associated domain, visiting the associated domain in this state\n * will return an error.\n *\n * artifacts:sites:write-deployment-info permission is needed on the repository rid to call this endpoint.\n */\nexport async function clearDeployedVersion(ctx, repositoryRid) {\n return conjureFetch(ctx, `/sites/v2/admin/repository/${repositoryRid}/deployed-version`, \"DELETE\");\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 { conjureFetch } from \"conjure-lite\";\n/**\n * Get the CSP additions configured for a repository.\n *\n * artifacts:sites:read-deployment-info permission is needed on the repository rid to call this endpoint.\n */\nexport async function getContentSecurityPolicyAdditions(ctx, repositoryRid) {\n return conjureFetch(ctx, `/sites/v2/admin/repository/${repositoryRid}/csp/additions`, \"GET\");\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 { conjureFetch } from \"conjure-lite\";\n/**\n * Get the deployed version that will be served for a given siteasset repository.\n *\n * artifacts:sites:read-deployment-info permission is needed on the repository rid to call this endpoint.\n */\nexport async function getDeployedVersion(ctx, repositoryRid) {\n return conjureFetch(ctx, `/sites/v2/admin/repository/${repositoryRid}/deployed-version`, \"GET\");\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 { conjureFetch } from \"conjure-lite\";\n/**\n * Get domains that have been successfully registered with the given repository. Visiting a successfully\n * registered domain should serve the registered repository assets.\n *\n * artifacts:sites:read-deployment-info permission is needed on the repository rid to call this endpoint.\n */\nexport async function getRegisteredSiteDomains(ctx, repositoryRid) {\n return conjureFetch(ctx, `/sites/v2/admin/repository/${repositoryRid}/domains/registered`, \"GET\");\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 { conjureFetch } from \"conjure-lite\";\n/**\n * Get domains that have been requested for a given repository. For control panel domains that require\n * an approval, this will also include pending requests. Closed/rejected requests will only be included as long\n * as their domain hasn't been re-requested for another repository.\n *\n * artifacts:sites:read-deployment-info permission is needed on the repository rid to call this endpoint.\n */\nexport async function getRequestedSiteDomains(ctx, repositoryRid) {\n return conjureFetch(ctx, `/sites/v2/admin/repository/${repositoryRid}/domains/requested`, \"GET\");\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 { conjureFetch } from \"conjure-lite\";\n/**\n * Preview what the CSP that will be served with the site looks like.\n *\n * artifacts:sites:read-deployment-info permission is needed on the repository rid to call this endpoint.\n */\nexport async function previewContentSecurityPolicy(ctx, repositoryRid, request) {\n return conjureFetch(ctx, `/sites/v2/admin/repository/${repositoryRid}/csp/preview`, \"POST\", request);\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 { conjureFetch } from \"conjure-lite\";\n/**\n * Set the CSP additions configured for a repository.\n *\n * artifacts:sites:write-deployment-info permission is needed on the repository rid to call this endpoint.\n */\nexport async function putContentSecurityPolicyAdditions(ctx, repositoryRid, contentSecurityPolicyAdditions) {\n return conjureFetch(ctx, `/sites/v2/admin/repository/${repositoryRid}/csp/additions`, \"PUT\", contentSecurityPolicyAdditions);\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 { conjureFetch } from \"conjure-lite\";\n/**\n * Requests the registration of a domain with the provided repository, this will result in an approvals task\n * getting created for approval by an admin.\n *\n * Once the task has been approved, visiting the domain will serve the deployed version, if any is deployed.\n *\n * artifacts:sites:manage-domains permission is needed on the repository rid to call this endpoint.\n */\nexport async function requestSiteDomainForRepository(ctx, repositoryRid, request) {\n return conjureFetch(ctx, `/sites/v2/admin/repository/${repositoryRid}/domains/submit-registration`, \"POST\", request);\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 { conjureFetch } from \"conjure-lite\";\n/**\n * Unregisters a domain from a repository, visiting the domain will no longer serve the repository assets.\n *\n * Depending on how the domain for the repository was setup, this might also result in deleting the domain\n * itself.\n *\n * artifacts:sites:manage-domains permission is needed on the repository rid to call this endpoint.\n */\nexport async function unregisterSiteDomain(ctx, repositoryRid, request) {\n return conjureFetch(ctx, `/sites/v2/admin/repository/${repositoryRid}/domains/unregister`, \"POST\", request);\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 { conjureFetch } from \"conjure-lite\";\n/**\n * Sets the asset version of the siteasset repository that will be served.\n *\n * artifacts:sites:write-deployment-info permission is needed on the repository rid to call this endpoint.\n */\nexport async function updateDeployedVersion(ctx, repositoryRid, version) {\n return conjureFetch(ctx, `/sites/v2/admin/repository/${repositoryRid}/deployed-version`, \"PUT\", version);\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 * as SiteAssetArtifactsService from \"./SiteAssetArtifactsService/index.mjs\";","/*\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 { deleteSiteVersion } from \"./deleteSiteVersion.mjs\";\nexport { fetchSiteVersions } from \"./fetchSiteVersions.mjs\";\nexport { uploadZippedSiteAsset } from \"./uploadSiteVersion.mjs\";","/*\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 { ExitProcessError } from \"../../../ExitProcessError.js\";\nimport { createFetch } from \"../../createFetch.mjs\";\nimport { fetchWebsiteRepositoryRid } from \"../../third-party-application-service/fetchWebsiteRepositoryRid.mjs\";\nimport { getSiteAssetBaseUrl } from \"./getSiteAssetBaseUrl.mjs\";\nexport async function deleteSiteVersion(ctx, request) {\n const repositoryRid = await fetchWebsiteRepositoryRid(ctx, request.application);\n const url = `${getSiteAssetBaseUrl(ctx.foundryUrl, repositoryRid)}/versions/${request.version}`;\n const fetch = createFetch(ctx.tokenProvider);\n const result = await fetch(url, {\n method: \"DELETE\"\n });\n if (result.status >= 200 && result.status < 300) {\n consola.debug(`${result.status} - Status Text: '${result.statusText}'`);\n return true;\n } else {\n throw new ExitProcessError(result.status, `Unexpected response code ${result.status} (${result.statusText})`);\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 { createFetchHeaderMutator, createFetchOrThrow, PalantirApiError } from \"@osdk/shared.net\";\nimport { consola } from \"consola\";\nimport { ExitProcessError } from \"../ExitProcessError.js\";\nimport { USER_AGENT } from \"./UserAgent.js\";\nexport function createFetch(tokenProvider, fetchFn = fetch) {\n return createFetchHeaderMutator(createRequestLoggingFetch(createErrorExitingFetch(createFetchOrThrow(fetchFn))), async headers => {\n const token = await tokenProvider();\n headers.set(\"Authorization\", `Bearer ${token}`);\n headers.set(\"Fetch-User-Agent\", USER_AGENT);\n return headers;\n });\n}\nfunction createErrorExitingFetch(fetchFn = fetch) {\n return function errorExitingFetch(input, init) {\n return fetchFn(input, init).catch(handleFetchError);\n };\n}\nfunction handleFetchError(e) {\n if (!(e instanceof PalantirApiError)) {\n throw new ExitProcessError(1, \"Unexpected fetch error\");\n }\n let tip;\n if (e.statusCode === 401) {\n tip = \"Check your token is valid and has not expired or been disabled\";\n } else if (e.statusCode === 403) {\n tip = \"Check your token has the required scopes for this operation\";\n }\n throw new ExitProcessError(1, e.message, tip);\n}\nfunction createRequestLoggingFetch(fetchFn = fetch) {\n return function requestLoggingFetch(input, init) {\n const requestLog = typeof input === \"string\" || input instanceof URL ? `${init?.method ?? \"GET\"}: ${input.toString().trim()}` : `${input.method ?? \"GET\"}: ${input.url.toString().trim()}`;\n consola.trace(requestLog);\n return fetchFn(input, init).then(a => {\n consola.trace(`FINISH ${requestLog}`);\n return a;\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 USER_AGENT = `osdk-cli/${process.env.PACKAGE_VERSION}`;","/*\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 { ExitProcessError } from \"../../ExitProcessError.js\";\nimport { createFetch } from \"../createFetch.mjs\";\nexport async function fetchWebsiteRepositoryRid(ctx, thirdPartyAppRid) {\n const fetch = createFetch(ctx.tokenProvider);\n const url = `\n ${ctx.foundryUrl}/third-party-application-service/api/application-websites/${thirdPartyAppRid}`;\n const result = await fetch(url);\n if (result.status >= 200 && result.status < 300) {\n const repositoryRid = await result.json();\n consola.debug(`Repository RID: ${repositoryRid}`);\n return repositoryRid;\n }\n throw new ExitProcessError(result.status, `Unexpected response code ${result.status} (${result.statusText})`);\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 getSiteAssetBaseUrl(foundryBaseUrl, repositoryRid) {\n return `${foundryBaseUrl}/artifacts/api/repositories/${repositoryRid}/contents/release/siteasset`;\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 { ExitProcessError } from \"../../../ExitProcessError.js\";\nimport { createFetch } from \"../../createFetch.mjs\";\nimport { fetchWebsiteRepositoryRid } from \"../../third-party-application-service/fetchWebsiteRepositoryRid.mjs\";\nimport { getSiteAssetBaseUrl } from \"./getSiteAssetBaseUrl.mjs\";\nexport async function fetchSiteVersions(ctx, thirdPartyAppRid) {\n const repositoryRid = await fetchWebsiteRepositoryRid(ctx, thirdPartyAppRid);\n const url = `${getSiteAssetBaseUrl(ctx.foundryUrl, repositoryRid)}/versions`;\n const fetch = createFetch(ctx.tokenProvider);\n const result = await fetch(url);\n if (result.status === 200) {\n const response = await result.json();\n return response.versions;\n } else {\n throw new ExitProcessError(result.status, `Unexpected response code ${result.status} (${result.statusText})`);\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 { consola } from \"consola\";\nimport { ExitProcessError } from \"../../../ExitProcessError.js\";\nimport { createFetch } from \"../../createFetch.mjs\";\nimport { fetchWebsiteRepositoryRid } from \"../../third-party-application-service/fetchWebsiteRepositoryRid.mjs\";\nimport { getSiteAssetBaseUrl } from \"./getSiteAssetBaseUrl.mjs\";\nexport async function uploadZippedSiteAsset(ctx, request) {\n const repositoryRid = await fetchWebsiteRepositoryRid(ctx, request.application);\n const url = `${getSiteAssetBaseUrl(ctx.foundryUrl, repositoryRid)}/versions/zip/${request.version}`;\n const fetch = createFetch(ctx.tokenProvider);\n const result = await fetch(url, {\n method: \"PUT\",\n body: request.zipFile,\n headers: {\n \"Content-Type\": \"application/octet-stream\"\n },\n duplex: \"half\" // Node hates me\n });\n if (result.status >= 200 && result.status < 300) {\n consola.debug(\"Status Text: \" + result.statusText);\n return true;\n } else if (result.status === 409) {\n throw new ExitProcessError(result.status, \"Version already exists\");\n } else {\n throw new ExitProcessError(result.status, `Unexpected response code ${result.status} (${result.statusText})`);\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 { createFetch } from \"./createFetch.mjs\";\nexport function createConjureContext(foundryUrl, servicePath, tokenProvider) {\n return {\n fetchFn: createFetch(tokenProvider),\n baseUrl: foundryUrl,\n servicePath\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 createInternalClientContext(foundryUrl, tokenProvider) {\n return {\n tokenProvider,\n foundryUrl\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 { fetchWebsiteRepositoryRid } from \"./fetchWebsiteRepositoryRid.mjs\";","/*\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 { promises as fsPromises } from \"node:fs\";\nimport path from \"node:path\";\nimport { ExitProcessError } from \"../ExitProcessError.js\";\nconst TOKEN_ENV_VARS = [\"FOUNDRY_TOKEN\", \"FOUNDRY_SDK_AUTH_TOKEN\"];\n\n/**\n * Loads a JWT Auth Token from an argument, a file, or environment variable returning the first found.\n * @param token The token as a string.\n * @param tokenFile The path to the token file.\n * @returns The token as a string.\n * @throws An error if no token is found.\n */\nexport async function loadToken(token, tokenFile) {\n if (token) {\n consola.debug(`Using token from --token option`);\n validate(token);\n return token;\n }\n if (tokenFile) {\n const loadedToken = await loadTokenFile(tokenFile);\n consola.debug(`Using token from --tokenFile=${loadedToken.filePath} option`);\n validate(loadedToken.token);\n return loadedToken.token;\n }\n for (const envVar of TOKEN_ENV_VARS) {\n const environmentToken = process.env[envVar];\n if (environmentToken) {\n consola.debug(`Using token from ${envVar} environment variable`);\n validate(environmentToken);\n if (envVar === \"FOUNDRY_SDK_AUTH_TOKEN\") {\n consola.warn(`Using FOUNDRY_SDK_AUTH_TOKEN environment variable is deprecated. Please use FOUNDRY_TOKEN instead.`);\n }\n return environmentToken;\n }\n }\n throw new ExitProcessError(2, `No token found.`, `You can supply a --token or --token-file option, or set the ${TOKEN_ENV_VARS[0]} environment variable`);\n}\n/**\n * Reads a JWT Auth Token from a file.\n * @param filePath The path to the token file.\n * @returns The token as a string.\n * @throws An error if the file cannot be read.\n */\nexport async function loadTokenFile(filePath) {\n let token;\n let resolvedPath;\n try {\n resolvedPath = path.resolve(filePath);\n token = await fsPromises.readFile(resolvedPath, \"utf8\");\n token = token.trim();\n } catch (error) {\n throw new ExitProcessError(2, `Unable to read token file \"${filePath}\": ${error}`);\n }\n return {\n filePath: resolvedPath,\n token\n };\n}\nexport function validate(token) {\n if (!isJWT(token)) {\n throw new ExitProcessError(2, `Token does not appear to be a JWT`);\n }\n}\nfunction isJWT(token) {\n // https://stackoverflow.com/a/65755789\n const jwtPattern = /^[A-Za-z0-9-_]+\\.[A-Za-z0-9-_]+\\.[A-Za-z0-9-_]*$/;\n return jwtPattern.test(token);\n}"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/util/isValidSemver.ts"],"names":[],"mappings":";
|
|
1
|
+
{"version":3,"sources":["../../src/util/isValidSemver.ts"],"names":[],"mappings":";AAgBA,SAAS,aAAa;AACf,SAAS,cAAc,cAAc;AAC1C,SAAO,MAAM,YAAY,KAAK;AAChC","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 { valid } from \"semver\";\nexport function isValidSemver(semverString) {\n return valid(semverString) != null;\n}"]}
|
|
@@ -16,7 +16,7 @@ function isTokenErrorResponse(response) {
|
|
|
16
16
|
// src/commands/auth/login/loginFlow.ts
|
|
17
17
|
var BROWSER_PROMPT_TIME_MS = 60 * 1e3;
|
|
18
18
|
async function invokeLoginFlow(args) {
|
|
19
|
-
consola.start(`Authenticating using application id: ${args.
|
|
19
|
+
consola.start(`Authenticating using application id: ${args.clientId}`);
|
|
20
20
|
const redirectUrl = "http://localhost:8080/auth/callback";
|
|
21
21
|
const port = parse(redirectUrl).port;
|
|
22
22
|
let resolve;
|
|
@@ -36,11 +36,11 @@ async function invokeLoginFlow(args) {
|
|
|
36
36
|
}
|
|
37
37
|
});
|
|
38
38
|
server.listen(port);
|
|
39
|
-
const clientId = args.
|
|
39
|
+
const clientId = args.clientId;
|
|
40
40
|
const state = generateRandomString();
|
|
41
41
|
const codeVerifier = generateRandomString();
|
|
42
42
|
const codeChallenge = await generateCodeChallenge(codeVerifier);
|
|
43
|
-
const authorizeUrl = generateAuthorizeUrl(args.
|
|
43
|
+
const authorizeUrl = generateAuthorizeUrl(args.foundryUrl, clientId, state, redirectUrl, codeChallenge);
|
|
44
44
|
try {
|
|
45
45
|
await open(authorizeUrl);
|
|
46
46
|
} catch {
|
|
@@ -52,7 +52,7 @@ async function invokeLoginFlow(args) {
|
|
|
52
52
|
const code = await authCode;
|
|
53
53
|
server.close();
|
|
54
54
|
clearTimeout(browserPrompt);
|
|
55
|
-
const token = await getTokenWithCodeVerifier(clientId, redirectUrl, code, args.
|
|
55
|
+
const token = await getTokenWithCodeVerifier(clientId, redirectUrl, code, args.foundryUrl, codeVerifier);
|
|
56
56
|
if (isTokenErrorResponse(token)) {
|
|
57
57
|
consola.error("Unable to authenticate", token.error, token.error_description);
|
|
58
58
|
exit(1);
|
|
@@ -119,4 +119,4 @@ async function getTokenWithCodeVerifier(clientId, redirectUrl, code, baseUrl, co
|
|
|
119
119
|
|
|
120
120
|
export { invokeLoginFlow };
|
|
121
121
|
//# sourceMappingURL=out.js.map
|
|
122
|
-
//# sourceMappingURL=chunk-
|
|
122
|
+
//# sourceMappingURL=chunk-HD6SVFKA.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../src/commands/auth/login/loginFlow.ts","../../src/commands/auth/login/token.ts"],"names":[],"mappings":";AAiBA,OAAO,aAAa;AACpB,SAAS,iBAAiB,cAAc;AACxC,SAAS,oBAAoB;AAC7B,OAAO,UAAU;AACjB,SAAS,YAAY;AACrB,SAAS,YAAY;AACrB,SAAS,aAAa;;;ACPf,SAAS,qBAAqB,UAAU;AAC7C,SAAO,SAAS,SAAS;AAC3B;;;ADOA,IAAM,yBAAyB,KAAK;AACpC,eAAO,gBAAuC,MAAM;AAClD,UAAQ,MAAM,wCAAwC,KAAK,QAAQ,EAAE;AACrE,QAAM,cAAc;AACpB,QAAM,OAAO,MAAM,WAAW,EAAE;AAChC,MAAI;AACJ,QAAM,WAAW,IAAI,QAAQ,UAAQ;AACnC,cAAU;AAAA,EACZ,CAAC;AACD,QAAM,SAAS,aAAa,CAAC,KAAK,QAAQ;AACxC,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AAW,MAAM,MAAM,UAAU;AAAA,MACrC,MAAM,KAAK,SAAS;AAAA,MACpB,SAAS;AAAA,QACP,gBAAgB;AAAA,MAClB;AAAA,MACA,QAAQ;AAAA,IACV,CAAC;AACD,UAAM,eAAe,MAAM,SAAS,KAAK;AACzC,WAAO;AAAA,EACT,SAAS,GAAG;AACV,UAAM,IAAI,MAAM,wBAAwB,GAAG,OAAO,SAAS,KAAK,GAAG,SAAS,KAAK,eAAe,EAAE;AAAA,EACpG;AACF","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\";\nconst BROWSER_PROMPT_TIME_MS = 60 * 1000;\nexport default 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 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?.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}"]}
|
|
@@ -2,12 +2,14 @@
|
|
|
2
2
|
|
|
3
3
|
// src/ExitProcessError.ts
|
|
4
4
|
var ExitProcessError = class extends Error {
|
|
5
|
-
constructor(errorCode, msg) {
|
|
5
|
+
constructor(errorCode, msg, tip) {
|
|
6
6
|
super(msg);
|
|
7
7
|
this.errorCode = errorCode;
|
|
8
|
+
this.msg = msg;
|
|
9
|
+
this.tip = tip;
|
|
8
10
|
}
|
|
9
11
|
};
|
|
10
12
|
|
|
11
13
|
exports.ExitProcessError = ExitProcessError;
|
|
12
14
|
//# sourceMappingURL=out.js.map
|
|
13
|
-
//# sourceMappingURL=chunk-
|
|
15
|
+
//# sourceMappingURL=chunk-HZ3XILMW.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../src/ExitProcessError.ts"],"names":[],"mappings":";AAgBO,IAAM,mBAAN,cAA+B,MAAM;AAAA,EAC1C,YAAY,WAAW,KAAK,KAAK;AAC/B,UAAM,GAAG;AACT,SAAK,YAAY;AACjB,SAAK,MAAM;AACX,SAAK,MAAM;AAAA,EACb;AACF","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) {\n super(msg);\n this.errorCode = errorCode;\n this.msg = msg;\n this.tip = tip;\n }\n}"]}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { consola } from 'consola';
|
|
2
|
+
|
|
3
|
+
// src/consola/handlePromptCancel.ts
|
|
4
|
+
function handlePromptCancel(promptResponse) {
|
|
5
|
+
const isFalse = typeof promptResponse === "boolean" && !promptResponse;
|
|
6
|
+
const isSigInt = typeof promptResponse === "symbol" && promptResponse.toString() === "Symbol(clack:cancel)";
|
|
7
|
+
if (isSigInt || isFalse) {
|
|
8
|
+
consola.fail("Operation cancelled");
|
|
9
|
+
process.exit(0);
|
|
10
|
+
}
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
export { handlePromptCancel };
|
|
14
|
+
//# sourceMappingURL=out.js.map
|
|
15
|
+
//# sourceMappingURL=chunk-IV3QY3PZ.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../src/consola/handlePromptCancel.ts"],"names":[],"mappings":";AAgBA,SAAS,eAAe;AACjB,SAAS,mBAAmB,gBAAgB;AACjD,QAAM,UAAU,OAAO,mBAAmB,aAAa,CAAC;AAExD,QAAM,WAAW,OAAO,mBAAmB,YAAY,eAAe,SAAS,MAAM;AACrF,MAAI,YAAY,SAAS;AACvB,YAAQ,KAAK,qBAAqB;AAClC,YAAQ,KAAK,CAAC;AAAA,EAChB;AACF","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\";\nexport function handlePromptCancel(promptResponse) {\n const isFalse = typeof promptResponse === \"boolean\" && !promptResponse;\n // https://github.com/unjs/consola/issues/251\n const isSigInt = typeof promptResponse === \"symbol\" && promptResponse.toString() === \"Symbol(clack:cancel)\";\n if (isSigInt || isFalse) {\n consola.fail(\"Operation cancelled\");\n process.exit(0);\n }\n}"]}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
var
|
|
3
|
+
var chunkHZ3XILMW_cjs = require('./chunk-HZ3XILMW.cjs');
|
|
4
4
|
var chunkHQDDGVB7_cjs = require('./chunk-HQDDGVB7.cjs');
|
|
5
5
|
var conjureLite = require('conjure-lite');
|
|
6
6
|
var consola = require('consola');
|
|
@@ -70,23 +70,42 @@ chunkHQDDGVB7_cjs.__export(SiteAssetArtifactsService_exports, {
|
|
|
70
70
|
fetchSiteVersions: () => fetchSiteVersions,
|
|
71
71
|
uploadZippedSiteAsset: () => uploadZippedSiteAsset
|
|
72
72
|
});
|
|
73
|
+
|
|
74
|
+
// src/net/UserAgent.ts
|
|
75
|
+
var USER_AGENT = `osdk-cli/${"0.7.0"}`;
|
|
76
|
+
|
|
77
|
+
// src/net/createFetch.mts
|
|
73
78
|
function createFetch(tokenProvider, fetchFn = fetch) {
|
|
74
|
-
return shared_net.createFetchHeaderMutator(
|
|
79
|
+
return shared_net.createFetchHeaderMutator(createRequestLoggingFetch(createErrorExitingFetch(shared_net.createFetchOrThrow(fetchFn))), async (headers) => {
|
|
75
80
|
const token = await tokenProvider();
|
|
76
81
|
headers.set("Authorization", `Bearer ${token}`);
|
|
77
|
-
headers.set("Fetch-User-Agent",
|
|
82
|
+
headers.set("Fetch-User-Agent", USER_AGENT);
|
|
78
83
|
return headers;
|
|
79
84
|
});
|
|
80
85
|
}
|
|
81
|
-
function
|
|
82
|
-
return function
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
86
|
+
function createErrorExitingFetch(fetchFn = fetch) {
|
|
87
|
+
return function errorExitingFetch(input, init) {
|
|
88
|
+
return fetchFn(input, init).catch(handleFetchError);
|
|
89
|
+
};
|
|
90
|
+
}
|
|
91
|
+
function handleFetchError(e) {
|
|
92
|
+
if (!(e instanceof shared_net.PalantirApiError)) {
|
|
93
|
+
throw new chunkHZ3XILMW_cjs.ExitProcessError(1, "Unexpected fetch error");
|
|
94
|
+
}
|
|
95
|
+
let tip;
|
|
96
|
+
if (e.statusCode === 401) {
|
|
97
|
+
tip = "Check your token is valid and has not expired or been disabled";
|
|
98
|
+
} else if (e.statusCode === 403) {
|
|
99
|
+
tip = "Check your token has the required scopes for this operation";
|
|
100
|
+
}
|
|
101
|
+
throw new chunkHZ3XILMW_cjs.ExitProcessError(1, e.message, tip);
|
|
102
|
+
}
|
|
103
|
+
function createRequestLoggingFetch(fetchFn = fetch) {
|
|
104
|
+
return function requestLoggingFetch(input, init) {
|
|
105
|
+
const requestLog = typeof input === "string" || input instanceof URL ? `${init?.method ?? "GET"}: ${input.toString().trim()}` : `${input.method ?? "GET"}: ${input.url.toString().trim()}`;
|
|
106
|
+
consola.consola.trace(requestLog);
|
|
88
107
|
return fetchFn(input, init).then((a) => {
|
|
89
|
-
consola.consola.
|
|
108
|
+
consola.consola.trace(`FINISH ${requestLog}`);
|
|
90
109
|
return a;
|
|
91
110
|
});
|
|
92
111
|
};
|
|
@@ -101,7 +120,7 @@ async function fetchWebsiteRepositoryRid(ctx, thirdPartyAppRid) {
|
|
|
101
120
|
consola.consola.debug(`Repository RID: ${repositoryRid}`);
|
|
102
121
|
return repositoryRid;
|
|
103
122
|
}
|
|
104
|
-
throw new
|
|
123
|
+
throw new chunkHZ3XILMW_cjs.ExitProcessError(result.status, `Unexpected response code ${result.status} (${result.statusText})`);
|
|
105
124
|
}
|
|
106
125
|
|
|
107
126
|
// src/net/artifacts/SiteAssetArtifactsService/getSiteAssetBaseUrl.mts
|
|
@@ -121,7 +140,7 @@ async function deleteSiteVersion(ctx, request) {
|
|
|
121
140
|
consola.consola.debug(`${result.status} - Status Text: '${result.statusText}'`);
|
|
122
141
|
return true;
|
|
123
142
|
} else {
|
|
124
|
-
throw new
|
|
143
|
+
throw new chunkHZ3XILMW_cjs.ExitProcessError(result.status, `Unexpected response code ${result.status} (${result.statusText})`);
|
|
125
144
|
}
|
|
126
145
|
}
|
|
127
146
|
|
|
@@ -135,7 +154,7 @@ async function fetchSiteVersions(ctx, thirdPartyAppRid) {
|
|
|
135
154
|
const response = await result.json();
|
|
136
155
|
return response.versions;
|
|
137
156
|
} else {
|
|
138
|
-
throw new
|
|
157
|
+
throw new chunkHZ3XILMW_cjs.ExitProcessError(result.status, `Unexpected response code ${result.status} (${result.statusText})`);
|
|
139
158
|
}
|
|
140
159
|
}
|
|
141
160
|
async function uploadZippedSiteAsset(ctx, request) {
|
|
@@ -155,9 +174,9 @@ async function uploadZippedSiteAsset(ctx, request) {
|
|
|
155
174
|
consola.consola.debug("Status Text: " + result.statusText);
|
|
156
175
|
return true;
|
|
157
176
|
} else if (result.status === 409) {
|
|
158
|
-
throw new
|
|
177
|
+
throw new chunkHZ3XILMW_cjs.ExitProcessError(result.status, "Version already exists");
|
|
159
178
|
} else {
|
|
160
|
-
throw new
|
|
179
|
+
throw new chunkHZ3XILMW_cjs.ExitProcessError(result.status, `Unexpected response code ${result.status} (${result.statusText})`);
|
|
161
180
|
}
|
|
162
181
|
}
|
|
163
182
|
|
|
@@ -186,13 +205,13 @@ chunkHQDDGVB7_cjs.__export(third_party_application_service_exports, {
|
|
|
186
205
|
var TOKEN_ENV_VARS = ["FOUNDRY_TOKEN", "FOUNDRY_SDK_AUTH_TOKEN"];
|
|
187
206
|
async function loadToken(token, tokenFile) {
|
|
188
207
|
if (token) {
|
|
189
|
-
consola.consola.debug(`Using token from --token
|
|
208
|
+
consola.consola.debug(`Using token from --token option`);
|
|
190
209
|
validate(token);
|
|
191
210
|
return token;
|
|
192
211
|
}
|
|
193
212
|
if (tokenFile) {
|
|
194
213
|
const loadedToken = await loadTokenFile(tokenFile);
|
|
195
|
-
consola.consola.debug(`Using token from --tokenFile=${loadedToken.filePath}
|
|
214
|
+
consola.consola.debug(`Using token from --tokenFile=${loadedToken.filePath} option`);
|
|
196
215
|
validate(loadedToken.token);
|
|
197
216
|
return loadedToken.token;
|
|
198
217
|
}
|
|
@@ -207,7 +226,7 @@ async function loadToken(token, tokenFile) {
|
|
|
207
226
|
return environmentToken;
|
|
208
227
|
}
|
|
209
228
|
}
|
|
210
|
-
throw new
|
|
229
|
+
throw new chunkHZ3XILMW_cjs.ExitProcessError(2, `No token found.`, `You can supply a --token or --token-file option, or set the ${TOKEN_ENV_VARS[0]} environment variable`);
|
|
211
230
|
}
|
|
212
231
|
async function loadTokenFile(filePath) {
|
|
213
232
|
let token;
|
|
@@ -217,7 +236,7 @@ async function loadTokenFile(filePath) {
|
|
|
217
236
|
token = await fs.promises.readFile(resolvedPath, "utf8");
|
|
218
237
|
token = token.trim();
|
|
219
238
|
} catch (error) {
|
|
220
|
-
throw new
|
|
239
|
+
throw new chunkHZ3XILMW_cjs.ExitProcessError(2, `Unable to read token file "${filePath}": ${error}`);
|
|
221
240
|
}
|
|
222
241
|
return {
|
|
223
242
|
filePath: resolvedPath,
|
|
@@ -226,7 +245,7 @@ async function loadTokenFile(filePath) {
|
|
|
226
245
|
}
|
|
227
246
|
function validate(token) {
|
|
228
247
|
if (!isJWT(token)) {
|
|
229
|
-
throw new
|
|
248
|
+
throw new chunkHZ3XILMW_cjs.ExitProcessError(2, `Token does not appear to be a JWT`);
|
|
230
249
|
}
|
|
231
250
|
}
|
|
232
251
|
function isJWT(token) {
|
|
@@ -241,4 +260,4 @@ exports.createInternalClientContext = createInternalClientContext;
|
|
|
241
260
|
exports.loadToken = loadToken;
|
|
242
261
|
exports.third_party_application_service_exports = third_party_application_service_exports;
|
|
243
262
|
//# sourceMappingURL=out.js.map
|
|
244
|
-
//# sourceMappingURL=chunk-
|
|
263
|
+
//# sourceMappingURL=chunk-JFYC74FJ.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../src/generated/artifacts-sites/ArtifactsSitesAdminV2Service.ts","../../src/generated/artifacts-sites/ArtifactsSitesAdminV2Service/clearDeployedVersion.ts","../../src/generated/artifacts-sites/ArtifactsSitesAdminV2Service/getContentSecurityPolicyAdditions.ts","../../src/generated/artifacts-sites/ArtifactsSitesAdminV2Service/getDeployedVersion.ts","../../src/generated/artifacts-sites/ArtifactsSitesAdminV2Service/getRegisteredSiteDomains.ts","../../src/generated/artifacts-sites/ArtifactsSitesAdminV2Service/getRequestedSiteDomains.ts","../../src/generated/artifacts-sites/ArtifactsSitesAdminV2Service/previewContentSecurityPolicy.ts","../../src/generated/artifacts-sites/ArtifactsSitesAdminV2Service/putContentSecurityPolicyAdditions.ts","../../src/generated/artifacts-sites/ArtifactsSitesAdminV2Service/requestSiteDomainForRepository.ts","../../src/generated/artifacts-sites/ArtifactsSitesAdminV2Service/unregisterSiteDomain.ts","../../src/generated/artifacts-sites/ArtifactsSitesAdminV2Service/updateDeployedVersion.ts","../../src/net/artifacts/index.mts","../../src/net/artifacts/SiteAssetArtifactsService/index.mts","../../src/net/artifacts/SiteAssetArtifactsService/deleteSiteVersion.mts","../../src/net/createFetch.mts","../../src/net/UserAgent.ts","../../src/net/third-party-application-service/fetchWebsiteRepositoryRid.mts","../../src/net/artifacts/SiteAssetArtifactsService/getSiteAssetBaseUrl.mts","../../src/net/artifacts/SiteAssetArtifactsService/fetchSiteVersions.mts","../../src/net/artifacts/SiteAssetArtifactsService/uploadSiteVersion.mts","../../src/net/createConjureContext.mts","../../src/net/createInternalClientContext.mts","../../src/net/third-party-application-service/index.mts","../../src/util/token.ts"],"names":["conjureFetch","consola","fetch"],"mappings":";;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;;;ACgBA,SAAS,oBAAoB;AAQ7B,eAAsB,qBAAqB,KAAK,eAAe;AAC7D,SAAO,aAAa,KAAK,8BAA8B,aAAa,qBAAqB,QAAQ;AACnG;;;ACVA,SAAS,gBAAAA,qBAAoB;AAM7B,eAAsB,kCAAkC,KAAK,eAAe;AAC1E,SAAOA,cAAa,KAAK,8BAA8B,aAAa,kBAAkB,KAAK;AAC7F;;;ACRA,SAAS,gBAAAA,qBAAoB;AAM7B,eAAsB,mBAAmB,KAAK,eAAe;AAC3D,SAAOA,cAAa,KAAK,8BAA8B,aAAa,qBAAqB,KAAK;AAChG;;;ACRA,SAAS,gBAAAA,qBAAoB;AAO7B,eAAsB,yBAAyB,KAAK,eAAe;AACjE,SAAOA,cAAa,KAAK,8BAA8B,aAAa,uBAAuB,KAAK;AAClG;;;ACTA,SAAS,gBAAAA,qBAAoB;AAQ7B,eAAsB,wBAAwB,KAA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AAW,UAAU,gBAAgB;AACnC,UAAM,mBAAmB,QAAQ,IAAI,MAAM;AAC3C,QAAI,kBAAkB;AACpB,MAAAA,SAAQ,MAAM,oBAAoB,MAAM,uBAAuB;AAC/D,eAAS,gBAAgB;AACzB,UAAI,WAAW,0BAA0B;AACvC,QAAAA,SAAQ,KAAK,oGAAoG;AAAA,MACnH;AACA,aAAO;AAAA,IACT;AAAA,EACF;AACA,QAAM,IAAI,iBAAiB,GAAG,mBAAmB,+DAA+D,eAAe,CAAC,CAAC,uBAAuB;AAC1J;AAOA,eAAsB,cAAc,UAAU;AAC5C,MAAI;AACJ,MAAI;AACJ,MAAI;AACF,mBAAe,KAAK,QAAQ,QAAQ;AACpC,YAAQ,MAAM,WAAW,SAAS,cAAc,MAAM;AACtD,YAAQ,MAAM,KAAK;AAAA,EACrB,SAAS,OAAO;AACd,UAAM,IAAI,iBAAiB,GAAG,8BAA8B,QAAQ,MAAM,KAAK,EAAE;AAAA,EACnF;AACA,SAAO;AAAA,IACL,UAAU;AAAA,IACV;AAAA,EACF;AACF;AACO,SAAS,SAAS,OAAO;AAC9B,MAAI,CAAC,MAAM,KAAK,GAAG;AACjB,UAAM,IAAI,iBAAiB,GAAG,mCAAmC;AAAA,EACnE;AACF;AACA,SAAS,MAAM,OAAO;AAEpB,QAAM,aAAa;AACnB,SAAO,WAAW,KAAK,KAAK;AAC9B","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 { clearDeployedVersion } from \"./ArtifactsSitesAdminV2Service/clearDeployedVersion.js\";\nexport { getContentSecurityPolicyAdditions } from \"./ArtifactsSitesAdminV2Service/getContentSecurityPolicyAdditions.js\";\nexport { getDeployedVersion } from \"./ArtifactsSitesAdminV2Service/getDeployedVersion.js\";\nexport { getRegisteredSiteDomains } from \"./ArtifactsSitesAdminV2Service/getRegisteredSiteDomains.js\";\nexport { getRequestedSiteDomains } from \"./ArtifactsSitesAdminV2Service/getRequestedSiteDomains.js\";\nexport { previewContentSecurityPolicy } from \"./ArtifactsSitesAdminV2Service/previewContentSecurityPolicy.js\";\nexport { putContentSecurityPolicyAdditions } from \"./ArtifactsSitesAdminV2Service/putContentSecurityPolicyAdditions.js\";\nexport { requestSiteDomainForRepository } from \"./ArtifactsSitesAdminV2Service/requestSiteDomainForRepository.js\";\nexport { unregisterSiteDomain } from \"./ArtifactsSitesAdminV2Service/unregisterSiteDomain.js\";\nexport { updateDeployedVersion } from \"./ArtifactsSitesAdminV2Service/updateDeployedVersion.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 { conjureFetch } from \"conjure-lite\";\n\n/**\n * Clears the deployed version while leaving the associated domain, visiting the associated domain in this state\n * will return an error.\n *\n * artifacts:sites:write-deployment-info permission is needed on the repository rid to call this endpoint.\n */\nexport async function clearDeployedVersion(ctx, repositoryRid) {\n return conjureFetch(ctx, `/sites/v2/admin/repository/${repositoryRid}/deployed-version`, \"DELETE\");\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 { conjureFetch } from \"conjure-lite\";\n/**\n * Get the CSP additions configured for a repository.\n *\n * artifacts:sites:read-deployment-info permission is needed on the repository rid to call this endpoint.\n */\nexport async function getContentSecurityPolicyAdditions(ctx, repositoryRid) {\n return conjureFetch(ctx, `/sites/v2/admin/repository/${repositoryRid}/csp/additions`, \"GET\");\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 { conjureFetch } from \"conjure-lite\";\n/**\n * Get the deployed version that will be served for a given siteasset repository.\n *\n * artifacts:sites:read-deployment-info permission is needed on the repository rid to call this endpoint.\n */\nexport async function getDeployedVersion(ctx, repositoryRid) {\n return conjureFetch(ctx, `/sites/v2/admin/repository/${repositoryRid}/deployed-version`, \"GET\");\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 { conjureFetch } from \"conjure-lite\";\n/**\n * Get domains that have been successfully registered with the given repository. Visiting a successfully\n * registered domain should serve the registered repository assets.\n *\n * artifacts:sites:read-deployment-info permission is needed on the repository rid to call this endpoint.\n */\nexport async function getRegisteredSiteDomains(ctx, repositoryRid) {\n return conjureFetch(ctx, `/sites/v2/admin/repository/${repositoryRid}/domains/registered`, \"GET\");\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 { conjureFetch } from \"conjure-lite\";\n/**\n * Get domains that have been requested for a given repository. For control panel domains that require\n * an approval, this will also include pending requests. Closed/rejected requests will only be included as long\n * as their domain hasn't been re-requested for another repository.\n *\n * artifacts:sites:read-deployment-info permission is needed on the repository rid to call this endpoint.\n */\nexport async function getRequestedSiteDomains(ctx, repositoryRid) {\n return conjureFetch(ctx, `/sites/v2/admin/repository/${repositoryRid}/domains/requested`, \"GET\");\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 { conjureFetch } from \"conjure-lite\";\n/**\n * Preview what the CSP that will be served with the site looks like.\n *\n * artifacts:sites:read-deployment-info permission is needed on the repository rid to call this endpoint.\n */\nexport async function previewContentSecurityPolicy(ctx, repositoryRid, request) {\n return conjureFetch(ctx, `/sites/v2/admin/repository/${repositoryRid}/csp/preview`, \"POST\", request);\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 { conjureFetch } from \"conjure-lite\";\n/**\n * Set the CSP additions configured for a repository.\n *\n * artifacts:sites:write-deployment-info permission is needed on the repository rid to call this endpoint.\n */\nexport async function putContentSecurityPolicyAdditions(ctx, repositoryRid, contentSecurityPolicyAdditions) {\n return conjureFetch(ctx, `/sites/v2/admin/repository/${repositoryRid}/csp/additions`, \"PUT\", contentSecurityPolicyAdditions);\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 { conjureFetch } from \"conjure-lite\";\n/**\n * Requests the registration of a domain with the provided repository, this will result in an approvals task\n * getting created for approval by an admin.\n *\n * Once the task has been approved, visiting the domain will serve the deployed version, if any is deployed.\n *\n * artifacts:sites:manage-domains permission is needed on the repository rid to call this endpoint.\n */\nexport async function requestSiteDomainForRepository(ctx, repositoryRid, request) {\n return conjureFetch(ctx, `/sites/v2/admin/repository/${repositoryRid}/domains/submit-registration`, \"POST\", request);\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 { conjureFetch } from \"conjure-lite\";\n/**\n * Unregisters a domain from a repository, visiting the domain will no longer serve the repository assets.\n *\n * Depending on how the domain for the repository was setup, this might also result in deleting the domain\n * itself.\n *\n * artifacts:sites:manage-domains permission is needed on the repository rid to call this endpoint.\n */\nexport async function unregisterSiteDomain(ctx, repositoryRid, request) {\n return conjureFetch(ctx, `/sites/v2/admin/repository/${repositoryRid}/domains/unregister`, \"POST\", request);\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 { conjureFetch } from \"conjure-lite\";\n/**\n * Sets the asset version of the siteasset repository that will be served.\n *\n * artifacts:sites:write-deployment-info permission is needed on the repository rid to call this endpoint.\n */\nexport async function updateDeployedVersion(ctx, repositoryRid, version) {\n return conjureFetch(ctx, `/sites/v2/admin/repository/${repositoryRid}/deployed-version`, \"PUT\", version);\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 * as SiteAssetArtifactsService from \"./SiteAssetArtifactsService/index.mjs\";","/*\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 { deleteSiteVersion } from \"./deleteSiteVersion.mjs\";\nexport { fetchSiteVersions } from \"./fetchSiteVersions.mjs\";\nexport { uploadZippedSiteAsset } from \"./uploadSiteVersion.mjs\";","/*\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 { ExitProcessError } from \"../../../ExitProcessError.js\";\nimport { createFetch } from \"../../createFetch.mjs\";\nimport { fetchWebsiteRepositoryRid } from \"../../third-party-application-service/fetchWebsiteRepositoryRid.mjs\";\nimport { getSiteAssetBaseUrl } from \"./getSiteAssetBaseUrl.mjs\";\nexport async function deleteSiteVersion(ctx, request) {\n const repositoryRid = await fetchWebsiteRepositoryRid(ctx, request.application);\n const url = `${getSiteAssetBaseUrl(ctx.foundryUrl, repositoryRid)}/versions/${request.version}`;\n const fetch = createFetch(ctx.tokenProvider);\n const result = await fetch(url, {\n method: \"DELETE\"\n });\n if (result.status >= 200 && result.status < 300) {\n consola.debug(`${result.status} - Status Text: '${result.statusText}'`);\n return true;\n } else {\n throw new ExitProcessError(result.status, `Unexpected response code ${result.status} (${result.statusText})`);\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 { createFetchHeaderMutator, createFetchOrThrow, PalantirApiError } from \"@osdk/shared.net\";\nimport { consola } from \"consola\";\nimport { ExitProcessError } from \"../ExitProcessError.js\";\nimport { USER_AGENT } from \"./UserAgent.js\";\nexport function createFetch(tokenProvider, fetchFn = fetch) {\n return createFetchHeaderMutator(createRequestLoggingFetch(createErrorExitingFetch(createFetchOrThrow(fetchFn))), async headers => {\n const token = await tokenProvider();\n headers.set(\"Authorization\", `Bearer ${token}`);\n headers.set(\"Fetch-User-Agent\", USER_AGENT);\n return headers;\n });\n}\nfunction createErrorExitingFetch(fetchFn = fetch) {\n return function errorExitingFetch(input, init) {\n return fetchFn(input, init).catch(handleFetchError);\n };\n}\nfunction handleFetchError(e) {\n if (!(e instanceof PalantirApiError)) {\n throw new ExitProcessError(1, \"Unexpected fetch error\");\n }\n let tip;\n if (e.statusCode === 401) {\n tip = \"Check your token is valid and has not expired or been disabled\";\n } else if (e.statusCode === 403) {\n tip = \"Check your token has the required scopes for this operation\";\n }\n throw new ExitProcessError(1, e.message, tip);\n}\nfunction createRequestLoggingFetch(fetchFn = fetch) {\n return function requestLoggingFetch(input, init) {\n const requestLog = typeof input === \"string\" || input instanceof URL ? `${init?.method ?? \"GET\"}: ${input.toString().trim()}` : `${input.method ?? \"GET\"}: ${input.url.toString().trim()}`;\n consola.trace(requestLog);\n return fetchFn(input, init).then(a => {\n consola.trace(`FINISH ${requestLog}`);\n return a;\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 USER_AGENT = `osdk-cli/${process.env.PACKAGE_VERSION}`;","/*\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 { ExitProcessError } from \"../../ExitProcessError.js\";\nimport { createFetch } from \"../createFetch.mjs\";\nexport async function fetchWebsiteRepositoryRid(ctx, thirdPartyAppRid) {\n const fetch = createFetch(ctx.tokenProvider);\n const url = `\n ${ctx.foundryUrl}/third-party-application-service/api/application-websites/${thirdPartyAppRid}`;\n const result = await fetch(url);\n if (result.status >= 200 && result.status < 300) {\n const repositoryRid = await result.json();\n consola.debug(`Repository RID: ${repositoryRid}`);\n return repositoryRid;\n }\n throw new ExitProcessError(result.status, `Unexpected response code ${result.status} (${result.statusText})`);\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 getSiteAssetBaseUrl(foundryBaseUrl, repositoryRid) {\n return `${foundryBaseUrl}/artifacts/api/repositories/${repositoryRid}/contents/release/siteasset`;\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 { ExitProcessError } from \"../../../ExitProcessError.js\";\nimport { createFetch } from \"../../createFetch.mjs\";\nimport { fetchWebsiteRepositoryRid } from \"../../third-party-application-service/fetchWebsiteRepositoryRid.mjs\";\nimport { getSiteAssetBaseUrl } from \"./getSiteAssetBaseUrl.mjs\";\nexport async function fetchSiteVersions(ctx, thirdPartyAppRid) {\n const repositoryRid = await fetchWebsiteRepositoryRid(ctx, thirdPartyAppRid);\n const url = `${getSiteAssetBaseUrl(ctx.foundryUrl, repositoryRid)}/versions`;\n const fetch = createFetch(ctx.tokenProvider);\n const result = await fetch(url);\n if (result.status === 200) {\n const response = await result.json();\n return response.versions;\n } else {\n throw new ExitProcessError(result.status, `Unexpected response code ${result.status} (${result.statusText})`);\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 { consola } from \"consola\";\nimport { ExitProcessError } from \"../../../ExitProcessError.js\";\nimport { createFetch } from \"../../createFetch.mjs\";\nimport { fetchWebsiteRepositoryRid } from \"../../third-party-application-service/fetchWebsiteRepositoryRid.mjs\";\nimport { getSiteAssetBaseUrl } from \"./getSiteAssetBaseUrl.mjs\";\nexport async function uploadZippedSiteAsset(ctx, request) {\n const repositoryRid = await fetchWebsiteRepositoryRid(ctx, request.application);\n const url = `${getSiteAssetBaseUrl(ctx.foundryUrl, repositoryRid)}/versions/zip/${request.version}`;\n const fetch = createFetch(ctx.tokenProvider);\n const result = await fetch(url, {\n method: \"PUT\",\n body: request.zipFile,\n headers: {\n \"Content-Type\": \"application/octet-stream\"\n },\n duplex: \"half\" // Node hates me\n });\n if (result.status >= 200 && result.status < 300) {\n consola.debug(\"Status Text: \" + result.statusText);\n return true;\n } else if (result.status === 409) {\n throw new ExitProcessError(result.status, \"Version already exists\");\n } else {\n throw new ExitProcessError(result.status, `Unexpected response code ${result.status} (${result.statusText})`);\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 { createFetch } from \"./createFetch.mjs\";\nexport function createConjureContext(foundryUrl, servicePath, tokenProvider) {\n return {\n fetchFn: createFetch(tokenProvider),\n baseUrl: foundryUrl,\n servicePath\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 createInternalClientContext(foundryUrl, tokenProvider) {\n return {\n tokenProvider,\n foundryUrl\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 { fetchWebsiteRepositoryRid } from \"./fetchWebsiteRepositoryRid.mjs\";","/*\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 { promises as fsPromises } from \"node:fs\";\nimport path from \"node:path\";\nimport { ExitProcessError } from \"../ExitProcessError.js\";\nconst TOKEN_ENV_VARS = [\"FOUNDRY_TOKEN\", \"FOUNDRY_SDK_AUTH_TOKEN\"];\n\n/**\n * Loads a JWT Auth Token from an argument, a file, or environment variable returning the first found.\n * @param token The token as a string.\n * @param tokenFile The path to the token file.\n * @returns The token as a string.\n * @throws An error if no token is found.\n */\nexport async function loadToken(token, tokenFile) {\n if (token) {\n consola.debug(`Using token from --token option`);\n validate(token);\n return token;\n }\n if (tokenFile) {\n const loadedToken = await loadTokenFile(tokenFile);\n consola.debug(`Using token from --tokenFile=${loadedToken.filePath} option`);\n validate(loadedToken.token);\n return loadedToken.token;\n }\n for (const envVar of TOKEN_ENV_VARS) {\n const environmentToken = process.env[envVar];\n if (environmentToken) {\n consola.debug(`Using token from ${envVar} environment variable`);\n validate(environmentToken);\n if (envVar === \"FOUNDRY_SDK_AUTH_TOKEN\") {\n consola.warn(`Using FOUNDRY_SDK_AUTH_TOKEN environment variable is deprecated. Please use FOUNDRY_TOKEN instead.`);\n }\n return environmentToken;\n }\n }\n throw new ExitProcessError(2, `No token found.`, `You can supply a --token or --token-file option, or set the ${TOKEN_ENV_VARS[0]} environment variable`);\n}\n/**\n * Reads a JWT Auth Token from a file.\n * @param filePath The path to the token file.\n * @returns The token as a string.\n * @throws An error if the file cannot be read.\n */\nexport async function loadTokenFile(filePath) {\n let token;\n let resolvedPath;\n try {\n resolvedPath = path.resolve(filePath);\n token = await fsPromises.readFile(resolvedPath, \"utf8\");\n token = token.trim();\n } catch (error) {\n throw new ExitProcessError(2, `Unable to read token file \"${filePath}\": ${error}`);\n }\n return {\n filePath: resolvedPath,\n token\n };\n}\nexport function validate(token) {\n if (!isJWT(token)) {\n throw new ExitProcessError(2, `Token does not appear to be a JWT`);\n }\n}\nfunction isJWT(token) {\n // https://stackoverflow.com/a/65755789\n const jwtPattern = /^[A-Za-z0-9-_]+\\.[A-Za-z0-9-_]+\\.[A-Za-z0-9-_]*$/;\n return jwtPattern.test(token);\n}"]}
|