@osdk/cli 0.6.0 → 0.8.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-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-XNYKWAIE.mjs → chunk-M5JTX7RC.mjs} +35 -16
- package/build/js/chunk-M5JTX7RC.mjs.map +1 -0
- package/build/js/{chunk-D7QHLGEU.cjs → chunk-NJJ5VSTS.cjs} +41 -22
- package/build/js/chunk-NJJ5VSTS.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-FHM4MFPH.cjs → handleGenerate-EGYMVXVW.cjs} +11 -11
- package/build/js/handleGenerate-EGYMVXVW.cjs.map +1 -0
- package/build/js/{handleGenerate-7QGFIWKO.mjs → handleGenerate-OBJOC2XY.mjs} +10 -10
- package/build/js/handleGenerate-OBJOC2XY.mjs.map +1 -0
- package/build/js/index.cjs +68 -33
- package/build/js/index.cjs.map +1 -1
- package/build/js/index.mjs +64 -29
- 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-QKPJEL4X.cjs → siteDeployCommand-5DBNGRT3.cjs} +45 -28
- package/build/js/siteDeployCommand-5DBNGRT3.cjs.map +1 -0
- package/build/js/{siteDeployCommand-4S2UQKJP.mjs → siteDeployCommand-D62CVVEY.mjs} +38 -21
- package/build/js/siteDeployCommand-D62CVVEY.mjs.map +1 -0
- package/build/js/{versionDeleteCommand-DGB5NTFM.mjs → versionDeleteCommand-F255OTHE.mjs} +3 -3
- package/build/js/{versionDeleteCommand-S7AXTY46.cjs → versionDeleteCommand-SKJ7OBNI.cjs} +6 -6
- package/build/js/{versionGetCommand-Y2VR2WKH.cjs → versionGetCommand-LVE7IZL3.cjs} +8 -8
- package/build/js/{versionGetCommand-OR4RLOLM.mjs → versionGetCommand-VHIOZCA7.mjs} +3 -3
- package/build/js/{versionListCommand-5KM5PFYL.cjs → versionListCommand-JNYLJ45G.cjs} +11 -9
- package/build/js/versionListCommand-JNYLJ45G.cjs.map +1 -0
- package/build/js/{versionListCommand-LPPGQCQF.mjs → versionListCommand-W4A2FA43.mjs} +6 -4
- package/build/js/versionListCommand-W4A2FA43.mjs.map +1 -0
- package/build/js/{versionSetCommand-LHOVVI6U.mjs → versionSetCommand-JLILKOKN.mjs} +3 -3
- package/build/js/{versionSetCommand-VD3L5DOV.cjs → versionSetCommand-PLKTCPWX.cjs} +8 -8
- package/build/js/{versionUnsetCommand-V3ZVCGSI.cjs → versionUnsetCommand-PGU2S3WS.cjs} +8 -8
- package/build/js/{versionUnsetCommand-ISMMMWWZ.mjs → versionUnsetCommand-Q6YWVVAI.mjs} +3 -3
- 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/typescript/generate/TypescriptGenerateArgs.d.ts +1 -1
- package/build/types/net/UserAgent.d.ts +1 -0
- package/build/types/util/config.d.ts +2 -2
- package/build/types/util/token.d.ts +2 -2
- 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-7QGFIWKO.mjs.map +0 -1
- package/build/js/handleGenerate-FHM4MFPH.cjs.map +0 -1
- package/build/js/loginFlow-BZDDHHT5.cjs +0 -10
- package/build/js/loginFlow-KGLTXVZ6.mjs +0 -4
- package/build/js/siteDeployCommand-4S2UQKJP.mjs.map +0 -1
- package/build/js/siteDeployCommand-QKPJEL4X.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/{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/{versionDeleteCommand-DGB5NTFM.mjs.map → versionDeleteCommand-F255OTHE.mjs.map} +0 -0
- /package/build/js/{versionDeleteCommand-S7AXTY46.cjs.map → versionDeleteCommand-SKJ7OBNI.cjs.map} +0 -0
- /package/build/js/{versionGetCommand-OR4RLOLM.mjs.map → versionGetCommand-LVE7IZL3.cjs.map} +0 -0
- /package/build/js/{versionGetCommand-Y2VR2WKH.cjs.map → versionGetCommand-VHIOZCA7.mjs.map} +0 -0
- /package/build/js/{versionSetCommand-LHOVVI6U.mjs.map → versionSetCommand-JLILKOKN.mjs.map} +0 -0
- /package/build/js/{versionSetCommand-VD3L5DOV.cjs.map → versionSetCommand-PLKTCPWX.cjs.map} +0 -0
- /package/build/js/{versionUnsetCommand-ISMMMWWZ.mjs.map → versionUnsetCommand-PGU2S3WS.cjs.map} +0 -0
- /package/build/js/{versionUnsetCommand-V3ZVCGSI.cjs.map → versionUnsetCommand-Q6YWVVAI.mjs.map} +0 -0
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { loadToken, createInternalClientContext, third_party_application_service_exports, createConjureContext, ArtifactsSitesAdminV2Service_exports } from './chunk-
|
|
2
|
-
import './chunk-
|
|
1
|
+
import { loadToken, createInternalClientContext, third_party_application_service_exports, createConjureContext, ArtifactsSitesAdminV2Service_exports } from './chunk-M5JTX7RC.mjs';
|
|
2
|
+
import './chunk-CLAEREOL.mjs';
|
|
3
3
|
import './chunk-E2SEJZTC.mjs';
|
|
4
4
|
import { consola } from 'consola';
|
|
5
5
|
|
|
@@ -25,4 +25,4 @@ async function versionGetCommand({
|
|
|
25
25
|
|
|
26
26
|
export { versionGetCommand as default };
|
|
27
27
|
//# sourceMappingURL=out.js.map
|
|
28
|
-
//# sourceMappingURL=versionGetCommand-
|
|
28
|
+
//# sourceMappingURL=versionGetCommand-VHIOZCA7.mjs.map
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
var
|
|
4
|
-
require('./chunk-
|
|
3
|
+
var chunkNJJ5VSTS_cjs = require('./chunk-NJJ5VSTS.cjs');
|
|
4
|
+
require('./chunk-HZ3XILMW.cjs');
|
|
5
5
|
require('./chunk-HQDDGVB7.cjs');
|
|
6
6
|
var consola = require('consola');
|
|
7
7
|
var utils = require('consola/utils');
|
|
@@ -12,23 +12,25 @@ async function versionListCommand({
|
|
|
12
12
|
token,
|
|
13
13
|
tokenFile
|
|
14
14
|
}) {
|
|
15
|
-
const loadedToken = await
|
|
15
|
+
const loadedToken = await chunkNJJ5VSTS_cjs.loadToken(token, tokenFile);
|
|
16
16
|
const tokenProvider = () => loadedToken;
|
|
17
|
-
const clientCtx =
|
|
17
|
+
const clientCtx = chunkNJJ5VSTS_cjs.createInternalClientContext(foundryUrl, tokenProvider);
|
|
18
18
|
consola.consola.start("Fetching versions & deployed version");
|
|
19
|
-
const repositoryRid = await
|
|
20
|
-
const ctx =
|
|
21
|
-
const [versions, deployedVersion] = await Promise.all([
|
|
19
|
+
const repositoryRid = await chunkNJJ5VSTS_cjs.third_party_application_service_exports.fetchWebsiteRepositoryRid(clientCtx, application);
|
|
20
|
+
const ctx = chunkNJJ5VSTS_cjs.createConjureContext(foundryUrl, "/artifacts/api", tokenProvider);
|
|
21
|
+
const [versions, deployedVersion] = await Promise.all([chunkNJJ5VSTS_cjs.artifacts_exports.SiteAssetArtifactsService.fetchSiteVersions(clientCtx, application), chunkNJJ5VSTS_cjs.ArtifactsSitesAdminV2Service_exports.getDeployedVersion(ctx, repositoryRid)]);
|
|
22
22
|
if (versions.length === 0) {
|
|
23
23
|
consola.consola.warn("Successfully connected to server, but no versions were found.");
|
|
24
24
|
return;
|
|
25
25
|
}
|
|
26
26
|
consola.consola.success("Found versions:");
|
|
27
|
-
|
|
27
|
+
const semver = await import('semver');
|
|
28
|
+
const sortedVersions = semver.rsort(versions.filter((v) => semver.valid(v)));
|
|
29
|
+
for (const version of sortedVersions) {
|
|
28
30
|
consola.consola.log(` - ${version}${deployedVersion && version === deployedVersion.version ? utils.colorize("green", ` (deployed)`) : ""}`);
|
|
29
31
|
}
|
|
30
32
|
}
|
|
31
33
|
|
|
32
34
|
module.exports = versionListCommand;
|
|
33
35
|
//# sourceMappingURL=out.js.map
|
|
34
|
-
//# sourceMappingURL=versionListCommand-
|
|
36
|
+
//# sourceMappingURL=versionListCommand-JNYLJ45G.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../src/commands/site/version/list/versionListCommand.mts"],"names":[],"mappings":";;;;;;;;;;;;AAiBA,SAAS,eAAe;AACxB,SAAS,gBAAgB;AAEzB,eAAO,mBAA0C;AAAA,EAC/C;AAAA,EACA;AAAA,EACA;AAAA,EACA;AACF,GAAG;AACD,QAAM,cAAc,MAAM,UAAU,OAAO,SAAS;AACpD,QAAM,gBAAgB,MAAM;AAC5B,QAAM,YAAY,4BAA4B,YAAY,aAAa;AACvE,UAAQ,MAAM,sCAAsC;AACpD,QAAM,gBAAgB,MAAM,wCAA6B,0BAA0B,WAAW,WAAW;AACzG,QAAM,MAAM,qBAAqB,YAAY,kBAAkB,aAAa;AAC5E,QAAM,CAAC,UAAU,eAAe,IAAI,MAAM,QAAQ,IAAI,CAAC,kBAAU,0BAA0B,kBAAkB,WAAW,WAAW,GAAG,qCAA6B,mBAAmB,KAAK,aAAa,CAAC,CAAC;AAC1M,MAAI,SAAS,WAAW,GAAG;AACzB,YAAQ,KAAK,+DAA+D;AAC5E;AAAA,EACF;AACA,UAAQ,QAAQ,iBAAiB;AACjC,QAAM,SAAS,MAAM,OAAO,QAAQ;AACpC,QAAM,iBAAiB,OAAO,MAAM,SAAS,OAAO,OAAK,OAAO,MAAM,CAAC,CAAC,CAAC;AACzE,aAAW,WAAW,gBAAgB;AACpC,YAAQ,IAAI,SAAS,OAAO,GAAG,mBAAmB,YAAY,gBAAgB,UAAU,SAAS,SAAS,aAAa,IAAI,EAAE,EAAE;AAAA,EACjI;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 { artifacts, ArtifactsSitesAdminV2Service, createConjureContext, createInternalClientContext, thirdPartyApplicationService } from \"#net\";\nimport { consola } from \"consola\";\nimport { colorize } from \"consola/utils\";\nimport { loadToken } from \"../../../../util/token.js\";\nexport default async function versionListCommand({\n foundryUrl,\n application,\n token,\n tokenFile\n}) {\n const loadedToken = await loadToken(token, tokenFile);\n const tokenProvider = () => loadedToken;\n const clientCtx = createInternalClientContext(foundryUrl, tokenProvider);\n consola.start(\"Fetching versions & deployed version\");\n const repositoryRid = await thirdPartyApplicationService.fetchWebsiteRepositoryRid(clientCtx, application);\n const ctx = createConjureContext(foundryUrl, \"/artifacts/api\", tokenProvider);\n const [versions, deployedVersion] = await Promise.all([artifacts.SiteAssetArtifactsService.fetchSiteVersions(clientCtx, application), ArtifactsSitesAdminV2Service.getDeployedVersion(ctx, repositoryRid)]);\n if (versions.length === 0) {\n consola.warn(\"Successfully connected to server, but no versions were found.\");\n return;\n }\n consola.success(\"Found versions:\");\n const semver = await import(\"semver\");\n const sortedVersions = semver.rsort(versions.filter(v => semver.valid(v)));\n for (const version of sortedVersions) {\n consola.log(` - ${version}${deployedVersion && version === deployedVersion.version ? colorize(\"green\", ` (deployed)`) : \"\"}`);\n }\n}"]}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { loadToken, createInternalClientContext, third_party_application_service_exports, createConjureContext, artifacts_exports, ArtifactsSitesAdminV2Service_exports } from './chunk-
|
|
2
|
-
import './chunk-
|
|
1
|
+
import { loadToken, createInternalClientContext, third_party_application_service_exports, createConjureContext, artifacts_exports, ArtifactsSitesAdminV2Service_exports } from './chunk-M5JTX7RC.mjs';
|
|
2
|
+
import './chunk-CLAEREOL.mjs';
|
|
3
3
|
import './chunk-E2SEJZTC.mjs';
|
|
4
4
|
import { consola } from 'consola';
|
|
5
5
|
import { colorize } from 'consola/utils';
|
|
@@ -22,11 +22,13 @@ async function versionListCommand({
|
|
|
22
22
|
return;
|
|
23
23
|
}
|
|
24
24
|
consola.success("Found versions:");
|
|
25
|
-
|
|
25
|
+
const semver = await import('semver');
|
|
26
|
+
const sortedVersions = semver.rsort(versions.filter((v) => semver.valid(v)));
|
|
27
|
+
for (const version of sortedVersions) {
|
|
26
28
|
consola.log(` - ${version}${deployedVersion && version === deployedVersion.version ? colorize("green", ` (deployed)`) : ""}`);
|
|
27
29
|
}
|
|
28
30
|
}
|
|
29
31
|
|
|
30
32
|
export { versionListCommand as default };
|
|
31
33
|
//# sourceMappingURL=out.js.map
|
|
32
|
-
//# sourceMappingURL=versionListCommand-
|
|
34
|
+
//# sourceMappingURL=versionListCommand-W4A2FA43.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../src/commands/site/version/list/versionListCommand.mts"],"names":[],"mappings":";;;;;;;;;;;;AAiBA,SAAS,eAAe;AACxB,SAAS,gBAAgB;AAEzB,eAAO,mBAA0C;AAAA,EAC/C;AAAA,EACA;AAAA,EACA;AAAA,EACA;AACF,GAAG;AACD,QAAM,cAAc,MAAM,UAAU,OAAO,SAAS;AACpD,QAAM,gBAAgB,MAAM;AAC5B,QAAM,YAAY,4BAA4B,YAAY,aAAa;AACvE,UAAQ,MAAM,sCAAsC;AACpD,QAAM,gBAAgB,MAAM,wCAA6B,0BAA0B,WAAW,WAAW;AACzG,QAAM,MAAM,qBAAqB,YAAY,kBAAkB,aAAa;AAC5E,QAAM,CAAC,UAAU,eAAe,IAAI,MAAM,QAAQ,IAAI,CAAC,kBAAU,0BAA0B,kBAAkB,WAAW,WAAW,GAAG,qCAA6B,mBAAmB,KAAK,aAAa,CAAC,CAAC;AAC1M,MAAI,SAAS,WAAW,GAAG;AACzB,YAAQ,KAAK,+DAA+D;AAC5E;AAAA,EACF;AACA,UAAQ,QAAQ,iBAAiB;AACjC,QAAM,SAAS,MAAM,OAAO,QAAQ;AACpC,QAAM,iBAAiB,OAAO,MAAM,SAAS,OAAO,OAAK,OAAO,MAAM,CAAC,CAAC,CAAC;AACzE,aAAW,WAAW,gBAAgB;AACpC,YAAQ,IAAI,SAAS,OAAO,GAAG,mBAAmB,YAAY,gBAAgB,UAAU,SAAS,SAAS,aAAa,IAAI,EAAE,EAAE;AAAA,EACjI;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 { artifacts, ArtifactsSitesAdminV2Service, createConjureContext, createInternalClientContext, thirdPartyApplicationService } from \"#net\";\nimport { consola } from \"consola\";\nimport { colorize } from \"consola/utils\";\nimport { loadToken } from \"../../../../util/token.js\";\nexport default async function versionListCommand({\n foundryUrl,\n application,\n token,\n tokenFile\n}) {\n const loadedToken = await loadToken(token, tokenFile);\n const tokenProvider = () => loadedToken;\n const clientCtx = createInternalClientContext(foundryUrl, tokenProvider);\n consola.start(\"Fetching versions & deployed version\");\n const repositoryRid = await thirdPartyApplicationService.fetchWebsiteRepositoryRid(clientCtx, application);\n const ctx = createConjureContext(foundryUrl, \"/artifacts/api\", tokenProvider);\n const [versions, deployedVersion] = await Promise.all([artifacts.SiteAssetArtifactsService.fetchSiteVersions(clientCtx, application), ArtifactsSitesAdminV2Service.getDeployedVersion(ctx, repositoryRid)]);\n if (versions.length === 0) {\n consola.warn(\"Successfully connected to server, but no versions were found.\");\n return;\n }\n consola.success(\"Found versions:\");\n const semver = await import(\"semver\");\n const sortedVersions = semver.rsort(versions.filter(v => semver.valid(v)));\n for (const version of sortedVersions) {\n consola.log(` - ${version}${deployedVersion && version === deployedVersion.version ? colorize(\"green\", ` (deployed)`) : \"\"}`);\n }\n}"]}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { loadToken, createInternalClientContext, third_party_application_service_exports, createConjureContext, ArtifactsSitesAdminV2Service_exports } from './chunk-
|
|
2
|
-
import './chunk-
|
|
1
|
+
import { loadToken, createInternalClientContext, third_party_application_service_exports, createConjureContext, ArtifactsSitesAdminV2Service_exports } from './chunk-M5JTX7RC.mjs';
|
|
2
|
+
import './chunk-CLAEREOL.mjs';
|
|
3
3
|
import './chunk-E2SEJZTC.mjs';
|
|
4
4
|
import { consola } from 'consola';
|
|
5
5
|
|
|
@@ -28,4 +28,4 @@ async function versionSetCommand({
|
|
|
28
28
|
|
|
29
29
|
export { versionSetCommand as default };
|
|
30
30
|
//# sourceMappingURL=out.js.map
|
|
31
|
-
//# sourceMappingURL=versionSetCommand-
|
|
31
|
+
//# sourceMappingURL=versionSetCommand-JLILKOKN.mjs.map
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
var
|
|
4
|
-
require('./chunk-
|
|
3
|
+
var chunkNJJ5VSTS_cjs = require('./chunk-NJJ5VSTS.cjs');
|
|
4
|
+
require('./chunk-HZ3XILMW.cjs');
|
|
5
5
|
require('./chunk-HQDDGVB7.cjs');
|
|
6
6
|
var consola = require('consola');
|
|
7
7
|
|
|
@@ -13,13 +13,13 @@ async function versionSetCommand({
|
|
|
13
13
|
tokenFile
|
|
14
14
|
}) {
|
|
15
15
|
consola.consola.start(`Setting live version`);
|
|
16
|
-
const loadedToken = await
|
|
16
|
+
const loadedToken = await chunkNJJ5VSTS_cjs.loadToken(token, tokenFile);
|
|
17
17
|
const tokenProvider = () => loadedToken;
|
|
18
|
-
const clientCtx =
|
|
19
|
-
const repositoryRid = await
|
|
20
|
-
const ctx =
|
|
18
|
+
const clientCtx = chunkNJJ5VSTS_cjs.createInternalClientContext(foundryUrl, tokenProvider);
|
|
19
|
+
const repositoryRid = await chunkNJJ5VSTS_cjs.third_party_application_service_exports.fetchWebsiteRepositoryRid(clientCtx, application);
|
|
20
|
+
const ctx = chunkNJJ5VSTS_cjs.createConjureContext(foundryUrl, "/artifacts/api", tokenProvider);
|
|
21
21
|
if (version) {
|
|
22
|
-
await
|
|
22
|
+
await chunkNJJ5VSTS_cjs.ArtifactsSitesAdminV2Service_exports.updateDeployedVersion(ctx, repositoryRid, {
|
|
23
23
|
siteVersion: {
|
|
24
24
|
version
|
|
25
25
|
}
|
|
@@ -30,4 +30,4 @@ async function versionSetCommand({
|
|
|
30
30
|
|
|
31
31
|
module.exports = versionSetCommand;
|
|
32
32
|
//# sourceMappingURL=out.js.map
|
|
33
|
-
//# sourceMappingURL=versionSetCommand-
|
|
33
|
+
//# sourceMappingURL=versionSetCommand-PLKTCPWX.cjs.map
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
3
|
var chunkDQYIDDJN_cjs = require('./chunk-DQYIDDJN.cjs');
|
|
4
|
-
var
|
|
5
|
-
require('./chunk-
|
|
4
|
+
var chunkNJJ5VSTS_cjs = require('./chunk-NJJ5VSTS.cjs');
|
|
5
|
+
require('./chunk-HZ3XILMW.cjs');
|
|
6
6
|
require('./chunk-HQDDGVB7.cjs');
|
|
7
7
|
var consola = require('consola');
|
|
8
8
|
var utils = require('consola/utils');
|
|
@@ -21,16 +21,16 @@ ${utils.colorize("bold", "Your site will no longer be accessible until a new liv
|
|
|
21
21
|
});
|
|
22
22
|
chunkDQYIDDJN_cjs.handlePromptCancel(confirmed);
|
|
23
23
|
}
|
|
24
|
-
const loadedToken = await
|
|
24
|
+
const loadedToken = await chunkNJJ5VSTS_cjs.loadToken(token, tokenFile);
|
|
25
25
|
const tokenProvider = () => loadedToken;
|
|
26
|
-
const clientCtx =
|
|
26
|
+
const clientCtx = chunkNJJ5VSTS_cjs.createInternalClientContext(foundryUrl, tokenProvider);
|
|
27
27
|
consola.consola.start("Clearing live site version");
|
|
28
|
-
const repositoryRid = await
|
|
29
|
-
const ctx =
|
|
30
|
-
await
|
|
28
|
+
const repositoryRid = await chunkNJJ5VSTS_cjs.third_party_application_service_exports.fetchWebsiteRepositoryRid(clientCtx, application);
|
|
29
|
+
const ctx = chunkNJJ5VSTS_cjs.createConjureContext(foundryUrl, "/artifacts/api", tokenProvider);
|
|
30
|
+
await chunkNJJ5VSTS_cjs.ArtifactsSitesAdminV2Service_exports.clearDeployedVersion(ctx, repositoryRid);
|
|
31
31
|
consola.consola.success("Cleared live site version");
|
|
32
32
|
}
|
|
33
33
|
|
|
34
34
|
module.exports = versionUnsetCommand;
|
|
35
35
|
//# sourceMappingURL=out.js.map
|
|
36
|
-
//# sourceMappingURL=versionUnsetCommand-
|
|
36
|
+
//# sourceMappingURL=versionUnsetCommand-PGU2S3WS.cjs.map
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { handlePromptCancel } from './chunk-IV3QY3PZ.mjs';
|
|
2
|
-
import { loadToken, createInternalClientContext, third_party_application_service_exports, createConjureContext, ArtifactsSitesAdminV2Service_exports } from './chunk-
|
|
3
|
-
import './chunk-
|
|
2
|
+
import { loadToken, createInternalClientContext, third_party_application_service_exports, createConjureContext, ArtifactsSitesAdminV2Service_exports } from './chunk-M5JTX7RC.mjs';
|
|
3
|
+
import './chunk-CLAEREOL.mjs';
|
|
4
4
|
import './chunk-E2SEJZTC.mjs';
|
|
5
5
|
import { consola } from 'consola';
|
|
6
6
|
import { colorize } from 'consola/utils';
|
|
@@ -31,4 +31,4 @@ ${colorize("bold", "Your site will no longer be accessible until a new live site
|
|
|
31
31
|
|
|
32
32
|
export { versionUnsetCommand as default };
|
|
33
33
|
//# sourceMappingURL=out.js.map
|
|
34
|
-
//# sourceMappingURL=versionUnsetCommand-
|
|
34
|
+
//# sourceMappingURL=versionUnsetCommand-Q6YWVVAI.mjs.map
|
|
@@ -1,4 +1,6 @@
|
|
|
1
1
|
export declare class ExitProcessError extends Error {
|
|
2
2
|
readonly errorCode: number;
|
|
3
|
-
|
|
3
|
+
readonly msg?: string | undefined;
|
|
4
|
+
readonly tip?: string | undefined;
|
|
5
|
+
constructor(errorCode: number, msg?: string | undefined, tip?: string | undefined);
|
|
4
6
|
}
|
|
@@ -1,8 +1,9 @@
|
|
|
1
|
+
import type { AutoVersionConfigType } from "../../../util/config.js";
|
|
1
2
|
import type { CommonSiteArgs } from "../CommonSiteArgs.js";
|
|
2
3
|
export interface SiteDeployArgs extends CommonSiteArgs {
|
|
3
4
|
version?: string;
|
|
4
5
|
directory: string;
|
|
5
6
|
uploadOnly: boolean;
|
|
6
|
-
autoVersion?:
|
|
7
|
+
autoVersion?: AutoVersionConfigType;
|
|
7
8
|
gitTagPrefix?: string;
|
|
8
9
|
}
|
|
@@ -1,2 +1,9 @@
|
|
|
1
|
+
import type { AutoVersionConfig } from "../../../util/config.js";
|
|
1
2
|
import type { SiteDeployArgs } from "./SiteDeployArgs.js";
|
|
2
|
-
|
|
3
|
+
interface SiteDeployInternalArgs extends Omit<SiteDeployArgs, "version" | "autoVersion"> {
|
|
4
|
+
selectedVersion: string | AutoVersionConfig;
|
|
5
|
+
directory: string;
|
|
6
|
+
uploadOnly: boolean;
|
|
7
|
+
}
|
|
8
|
+
export default function siteDeployCommand({ selectedVersion, application, foundryUrl, uploadOnly, directory, token, tokenFile, }: SiteDeployInternalArgs): Promise<void>;
|
|
9
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const USER_AGENT: string;
|
|
@@ -2,7 +2,8 @@ export interface GitDescribeAutoVersionConfig {
|
|
|
2
2
|
type: "git-describe";
|
|
3
3
|
tagPrefix?: string;
|
|
4
4
|
}
|
|
5
|
-
type AutoVersionConfig = GitDescribeAutoVersionConfig;
|
|
5
|
+
export type AutoVersionConfig = GitDescribeAutoVersionConfig;
|
|
6
|
+
export type AutoVersionConfigType = AutoVersionConfig["type"];
|
|
6
7
|
export interface SiteConfig {
|
|
7
8
|
application: string;
|
|
8
9
|
directory: string;
|
|
@@ -22,4 +23,3 @@ export interface LoadedFoundryConfig {
|
|
|
22
23
|
* @throws Will throw an error if the configuration file is found but cannot be read or parsed.
|
|
23
24
|
*/
|
|
24
25
|
export declare function loadFoundryConfig(): Promise<LoadedFoundryConfig | undefined>;
|
|
25
|
-
export {};
|
|
@@ -11,10 +11,10 @@ interface LoadedToken {
|
|
|
11
11
|
token: string;
|
|
12
12
|
}
|
|
13
13
|
/**
|
|
14
|
-
*
|
|
14
|
+
* Reads a JWT Auth Token from a file.
|
|
15
15
|
* @param filePath The path to the token file.
|
|
16
16
|
* @returns The token as a string.
|
|
17
|
-
* @throws An error if the file cannot be read
|
|
17
|
+
* @throws An error if the file cannot be read.
|
|
18
18
|
*/
|
|
19
19
|
export declare function loadTokenFile(filePath: string): Promise<LoadedToken>;
|
|
20
20
|
export declare function validate(token: string): void;
|
package/package.json
CHANGED
|
@@ -1,9 +1,13 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@osdk/cli",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.8.0",
|
|
4
4
|
"description": "",
|
|
5
5
|
"access": "public",
|
|
6
6
|
"license": "Apache-2.0",
|
|
7
|
+
"repository": {
|
|
8
|
+
"type": "git",
|
|
9
|
+
"url": "https://github.com/palantir/osdk-ts.git"
|
|
10
|
+
},
|
|
7
11
|
"exports": {
|
|
8
12
|
".": {
|
|
9
13
|
"types": "./build/types/index.d.ts",
|
|
@@ -23,16 +27,18 @@
|
|
|
23
27
|
"consola": "^3.2.3",
|
|
24
28
|
"find-up": "^6.3.0",
|
|
25
29
|
"open": "^9.1.0",
|
|
30
|
+
"semver": "^7.6.0",
|
|
26
31
|
"yargs": "^17.7.2",
|
|
27
32
|
"@osdk/api": "1.1.1",
|
|
33
|
+
"@osdk/gateway": "1.1.1",
|
|
28
34
|
"@osdk/generator": "1.3.0",
|
|
29
|
-
"@osdk/shared.net": "1.
|
|
30
|
-
"@osdk/gateway": "1.1.1"
|
|
35
|
+
"@osdk/shared.net": "1.3.0"
|
|
31
36
|
},
|
|
32
37
|
"devDependencies": {
|
|
33
38
|
"@types/archiver": "^6.0.0",
|
|
34
39
|
"@types/ngeohash": "^0.6.4",
|
|
35
40
|
"@types/node": "^18.0.0",
|
|
41
|
+
"@types/semver": "^7.5.7",
|
|
36
42
|
"@types/yargs": "^17.0.29",
|
|
37
43
|
"ts-expect": "^1.3.0",
|
|
38
44
|
"typescript": "^5.2.2"
|
|
@@ -1 +0,0 @@
|
|
|
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,aAAa,EAAE;AAC1E,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,UAAM,QAAQ,MAAM,IAAI,KAAK,IAAI,EAAE;AACnC,QAAI,IAAI,eAAe;AACvB,YAAQ,MAAM,MAAM,CAAC;AAAA,EACvB,CAAC;AACD,SAAO,GAAG,SAAS,OAAK;AACtB,QAAI,EAAE,SAAS,cAAc;AAC3B,cAAQ,MAAM,QAAQ,IAAI,4DAA4D;AACtF,aAAO,MAAM;AACb,WAAK,CAAC;AAAA,IACR;AAAA,EACF,CAAC;AACD,SAAO,OAAO,IAAI;AAClB,Q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ourcesContent":["/*\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.applicationId}`);\n const redirectUrl = \"http://localhost:8080/auth/callback\";\n const port = parse(redirectUrl).port;\n let resolve;\n const authCode = new Promise(_res => {\n resolve = _res;\n });\n const server = createServer((req, res) => {\n const query = parse(req.url, true).query;\n res.end(\"Authenticated\");\n resolve(query[\"code\"]);\n });\n server.on(\"error\", e => {\n if (e.code === \"EADDRINUSE\") {\n consola.error(`Port ${port} is already in use, unable to perform authentication flow.`);\n server.close();\n exit(1);\n }\n });\n server.listen(port);\n const clientId = args.applicationId;\n const state = generateRandomString();\n const codeVerifier = generateRandomString();\n const codeChallenge = await generateCodeChallenge(codeVerifier);\n const authorizeUrl = generateAuthorizeUrl(args.baseUrl, clientId, state, redirectUrl, codeChallenge);\n try {\n await open(authorizeUrl);\n } catch {\n consola.warn(`Unable to open browser, please open this url in your browser to to authenticate: ${authorizeUrl}`);\n }\n\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.baseUrl, codeVerifier);\n if (isTokenErrorResponse(token)) {\n consola.error(\"Unable to authenticate\", token.error, token.error_description);\n exit(1);\n }\n consola.success(`Successfully authenticated!`);\n return token;\n}\nfunction generateRandomString(length = 128) {\n const characters = \"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-._~\";\n let output = [];\n let array = new Uint8Array(1);\n const maxIndex = 256 - 256 % characters.length;\n while (output.length < length) {\n getRandomValues(array);\n if (array[0] < maxIndex) {\n output.push(characters[array[0] % characters.length]);\n }\n }\n return output.join(\"\");\n}\nasync function generateCodeChallenge(codeVerifier) {\n const data = new TextEncoder().encode(codeVerifier);\n const digest = await subtle.digest(\"SHA-256\", data);\n const codeChallengeMethod = \"S256\";\n const codeChallenge = btoa(String.fromCharCode(...new Uint8Array(digest))).replace(/\\//g, \"_\").replace(/\\+/g, \"-\").replace(/=/g, \"\");\n return {\n codeChallenge,\n codeChallengeMethod\n };\n}\nfunction generateAuthorizeUrl(baseUrl, clientId, state, redirectUrl, codeChallenge) {\n const queryParams = new URLSearchParams();\n queryParams.append(\"client_id\", clientId);\n queryParams.append(\"response_type\", \"code\");\n queryParams.append(\"state\", state);\n queryParams.append(\"redirect_uri\", redirectUrl);\n queryParams.append(\"code_challenge\", codeChallenge.codeChallenge);\n queryParams.append(\"code_challenge_method\", codeChallenge.codeChallengeMethod);\n queryParams.append(\"scope\", [\"offline_access\", \"api:read-data\"].join(\" \"));\n return join(baseUrl, \"multipass\", \"api\", \"oauth2\", \"authorize\") + `?` + queryParams.toString();\n}\nasync function getTokenWithCodeVerifier(clientId, redirectUrl, code, baseUrl, codeVerifier) {\n const body = new URLSearchParams();\n body.append(\"client_id\", clientId);\n body.append(\"grant_type\", \"authorization_code\");\n body.append(\"code\", code);\n body.append(\"redirect_uri\", redirectUrl);\n body.append(\"code_verifier\", codeVerifier);\n const tokenUrl = join(baseUrl, \"multipass\", \"api\", \"oauth2\", \"token\") + `?state=${codeVerifier}`;\n try {\n const response = await fetch(tokenUrl, {\n body: body.toString(),\n headers: {\n \"Content-Type\": \"application/x-www-form-urlencoded\"\n },\n method: \"POST\"\n });\n const responseText = await response.json();\n return responseText;\n } catch (e) {\n throw new Error(`Failed to get token: ${e?.cause?.toString() ?? e?.toString() ?? \"Unknown error\"}`);\n }\n}","/*\n * Copyright 2023 Palantir Technologies, Inc. All rights reserved.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nexport function isTokenErrorResponse(response) {\n return response.error != null;\n}"]}
|
|
@@ -1 +0,0 @@
|
|
|
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/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,KAAK,eAAe;AAChE,SAAOA,cAAa,KAAK,8BAA8B,aAAa,sBAAsB,KAAK;AACjG;;;ACVA,SAAS,gBAAAA,qBAAoB;AAM7B,eAAsB,6BAA6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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 } from \"@osdk/shared.net\";\nimport { consola } from \"consola\";\nexport function createFetch(tokenProvider, fetchFn = fetch) {\n return createFetchHeaderMutator(createDebugLoggingFetch(fetchFn), async headers => {\n const token = await tokenProvider();\n headers.set(\"Authorization\", `Bearer ${token}`);\n headers.set(\"Fetch-User-Agent\", \"\");\n return headers;\n });\n}\nfunction createDebugLoggingFetch(fetchFn = fetch) {\n return function debugLoggingFetch(input, init) {\n if (typeof input === \"string\" || input instanceof URL) {\n consola.debug(`${init?.method ?? \"GET\"}: ${input.toString().trim()}`);\n } else {\n consola.debug(`${input.method ?? \"GET\"}: ${input.url.toString().trim()}`);\n }\n return fetchFn(input, init).then(a => {\n consola.debug(\"Finished fetch\");\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\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 argument`);\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} argument`);\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. Please supply a --token argument, a --token-file argument or set the ${TOKEN_ENV_VARS[0]} environment variable.`);\n}\n/**\n * Synchronously 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 or if the file does not contain a valid JWT.\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 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/ExitProcessError.ts"],"names":[],"mappings":";AAgBO,IAAM,mBAAN,cAA+B,MAAM;AAAA,EAC1C,YAAY,WAAW,KAAK;AAC1B,UAAM,GAAG;AACT,SAAK,YAAY;AAAA,EACnB;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) {\n super(msg);\n this.errorCode = errorCode;\n }\n}"]}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/ExitProcessError.ts"],"names":[],"mappings":";AAgBO,IAAM,mBAAN,cAA+B,MAAM;AAAA,EAC1C,YAAY,WAAW,KAAK;AAC1B,UAAM,GAAG;AACT,SAAK,YAAY;AAAA,EACnB;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) {\n super(msg);\n this.errorCode = errorCode;\n }\n}"]}
|
|
@@ -1 +0,0 @@
|
|
|
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;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AM,YAAY,SAAS;AAC/F;AACA,eAAe,yBAAyB,UAAU,aAAa,MAAM,SAAS,cAAc;AAC1F,QAAM,OAAO,IAAI,gBAAgB;AACjC,OAAK,OAAO,aAAa,QAAQ;AACjC,OAAK,OAAO,cAAc,oBAAoB;AAC9C,OAAK,OAAO,QAAQ,IAAI;AACxB,OAAK,OAAO,gBAAgB,WAAW;AACvC,OAAK,OAAO,iBAAiB,YAAY;AACzC,QAAM,WAAW,KAAK,SAAS,aAAa,OAAO,UAAU,OAAO,IAAI,UAAU,YAAY;AAC9F,MAAI;AACF,UAAM,WAAW,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.applicationId}`);\n const redirectUrl = \"http://localhost:8080/auth/callback\";\n const port = parse(redirectUrl).port;\n let resolve;\n const authCode = new Promise(_res => {\n resolve = _res;\n });\n const server = createServer((req, res) => {\n const query = parse(req.url, true).query;\n res.end(\"Authenticated\");\n resolve(query[\"code\"]);\n });\n server.on(\"error\", e => {\n if (e.code === \"EADDRINUSE\") {\n consola.error(`Port ${port} is already in use, unable to perform authentication flow.`);\n server.close();\n exit(1);\n }\n });\n server.listen(port);\n const clientId = args.applicationId;\n const state = generateRandomString();\n const codeVerifier = generateRandomString();\n const codeChallenge = await generateCodeChallenge(codeVerifier);\n const authorizeUrl = generateAuthorizeUrl(args.baseUrl, clientId, state, redirectUrl, codeChallenge);\n try {\n await open(authorizeUrl);\n } catch {\n consola.warn(`Unable to open browser, please open this url in your browser to to authenticate: ${authorizeUrl}`);\n }\n\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.baseUrl, codeVerifier);\n if (isTokenErrorResponse(token)) {\n consola.error(\"Unable to authenticate\", token.error, token.error_description);\n exit(1);\n }\n consola.success(`Successfully authenticated!`);\n return token;\n}\nfunction generateRandomString(length = 128) {\n const characters = \"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-._~\";\n let output = [];\n let array = new Uint8Array(1);\n const maxIndex = 256 - 256 % characters.length;\n while (output.length < length) {\n getRandomValues(array);\n if (array[0] < maxIndex) {\n output.push(characters[array[0] % characters.length]);\n }\n }\n return output.join(\"\");\n}\nasync function generateCodeChallenge(codeVerifier) {\n const data = new TextEncoder().encode(codeVerifier);\n const digest = await subtle.digest(\"SHA-256\", data);\n const codeChallengeMethod = \"S256\";\n const codeChallenge = btoa(String.fromCharCode(...new Uint8Array(digest))).replace(/\\//g, \"_\").replace(/\\+/g, \"-\").replace(/=/g, \"\");\n return {\n codeChallenge,\n codeChallengeMethod\n };\n}\nfunction generateAuthorizeUrl(baseUrl, clientId, state, redirectUrl, codeChallenge) {\n const queryParams = new URLSearchParams();\n queryParams.append(\"client_id\", clientId);\n queryParams.append(\"response_type\", \"code\");\n queryParams.append(\"state\", state);\n queryParams.append(\"redirect_uri\", redirectUrl);\n queryParams.append(\"code_challenge\", codeChallenge.codeChallenge);\n queryParams.append(\"code_challenge_method\", codeChallenge.codeChallengeMethod);\n queryParams.append(\"scope\", [\"offline_access\", \"api:read-data\"].join(\" \"));\n return join(baseUrl, \"multipass\", \"api\", \"oauth2\", \"authorize\") + `?` + queryParams.toString();\n}\nasync function getTokenWithCodeVerifier(clientId, redirectUrl, code, baseUrl, codeVerifier) {\n const body = new URLSearchParams();\n body.append(\"client_id\", clientId);\n body.append(\"grant_type\", \"authorization_code\");\n body.append(\"code\", code);\n body.append(\"redirect_uri\", redirectUrl);\n body.append(\"code_verifier\", codeVerifier);\n const tokenUrl = join(baseUrl, \"multipass\", \"api\", \"oauth2\", \"token\") + `?state=${codeVerifier}`;\n try {\n const response = await fetch(tokenUrl, {\n body: body.toString(),\n headers: {\n \"Content-Type\": \"application/x-www-form-urlencoded\"\n },\n method: \"POST\"\n });\n const responseText = await response.json();\n return responseText;\n } catch (e) {\n throw new Error(`Failed to get token: ${e?.cause?.toString() ?? e?.toString() ?? \"Unknown error\"}`);\n }\n}","/*\n * Copyright 2023 Palantir Technologies, Inc. All rights reserved.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nexport function isTokenErrorResponse(response) {\n return response.error != null;\n}"]}
|
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
// src/util/isValidSemver.ts
|
|
2
|
-
var semver = /^(0|[1-9]\d*)\.(0|[1-9]\d*)\.(0|[1-9]\d*)(?:-((?:0|[1-9]\d*|\d*[a-zA-Z-][0-9a-zA-Z-]*)(?:\.(?:0|[1-9]\d*|\d*[a-zA-Z-][0-9a-zA-Z-]*))*))?(?:\+([0-9a-zA-Z-]+(?:\.[0-9a-zA-Z-]+)*))?$/;
|
|
3
|
-
function isValidSemver(semverString) {
|
|
4
|
-
return semver.test(semverString);
|
|
5
|
-
}
|
|
6
|
-
|
|
7
|
-
export { isValidSemver };
|
|
8
|
-
//# sourceMappingURL=out.js.map
|
|
9
|
-
//# sourceMappingURL=chunk-N6K26UR4.mjs.map
|
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
'use strict';
|
|
2
|
-
|
|
3
|
-
// src/util/isValidSemver.ts
|
|
4
|
-
var semver = /^(0|[1-9]\d*)\.(0|[1-9]\d*)\.(0|[1-9]\d*)(?:-((?:0|[1-9]\d*|\d*[a-zA-Z-][0-9a-zA-Z-]*)(?:\.(?:0|[1-9]\d*|\d*[a-zA-Z-][0-9a-zA-Z-]*))*))?(?:\+([0-9a-zA-Z-]+(?:\.[0-9a-zA-Z-]+)*))?$/;
|
|
5
|
-
function isValidSemver(semverString) {
|
|
6
|
-
return semver.test(semverString);
|
|
7
|
-
}
|
|
8
|
-
|
|
9
|
-
exports.isValidSemver = isValidSemver;
|
|
10
|
-
//# sourceMappingURL=out.js.map
|
|
11
|
-
//# sourceMappingURL=chunk-X2S4O5ZR.cjs.map
|