@osdk/cli 0.16.0 → 0.17.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-2A2YEODO.mjs +199 -0
- package/build/js/chunk-2A2YEODO.mjs.map +1 -0
- package/build/js/{chunk-AX5HH3ZN.cjs → chunk-467BAS7X.cjs} +3 -2
- package/build/js/chunk-467BAS7X.cjs.map +1 -0
- package/build/js/{chunk-MTJA6DOB.mjs → chunk-CWMSASIM.mjs} +3 -2
- package/build/js/chunk-CWMSASIM.mjs.map +1 -0
- package/build/js/chunk-QVFWI7JV.cjs +207 -0
- package/build/js/chunk-QVFWI7JV.cjs.map +1 -0
- package/build/js/{handleGenerate-XC5RBDDW-T333WMC4.mjs → handleGenerate-KBPDPEH4-O63ZWRM6.mjs} +20 -99
- package/build/js/handleGenerate-KBPDPEH4-O63ZWRM6.mjs.map +1 -0
- package/build/js/{handleGenerate-XC5RBDDW-DL73JJG6.cjs → handleGenerate-KBPDPEH4-OC7WKH2B.cjs} +21 -100
- package/build/js/handleGenerate-KBPDPEH4-OC7WKH2B.cjs.map +1 -0
- package/build/js/index.cjs +25 -25
- package/build/js/index.cjs.map +1 -1
- package/build/js/index.mjs +9 -9
- package/build/js/index.mjs.map +1 -1
- package/build/js/{siteDeployCommand-FTCDKKU4.cjs → siteDeployCommand-GM26T5YL.cjs} +22 -36
- package/build/js/siteDeployCommand-GM26T5YL.cjs.map +1 -0
- package/build/js/{siteDeployCommand-WHR7PIJE.mjs → siteDeployCommand-LXWAUCZQ.mjs} +13 -27
- package/build/js/siteDeployCommand-LXWAUCZQ.mjs.map +1 -0
- package/build/js/{versionDeleteCommand-KQCJ7CHQ.cjs → versionDeleteCommand-S4M6DRHC.cjs} +6 -9
- package/build/js/versionDeleteCommand-S4M6DRHC.cjs.map +1 -0
- package/build/js/{versionDeleteCommand-YFVUCYVQ.mjs → versionDeleteCommand-ZVUTRBQE.mjs} +4 -7
- package/build/js/versionDeleteCommand-ZVUTRBQE.mjs.map +1 -0
- package/build/js/versionGetCommand-C2BMDIVV.cjs +28 -0
- package/build/js/versionGetCommand-C2BMDIVV.cjs.map +1 -0
- package/build/js/versionGetCommand-N7F75WO5.mjs +26 -0
- package/build/js/versionGetCommand-N7F75WO5.mjs.map +1 -0
- package/build/js/versionListCommand-2SNJI2N2.mjs +32 -0
- package/build/js/versionListCommand-2SNJI2N2.mjs.map +1 -0
- package/build/js/versionListCommand-FR7G6D7I.cjs +34 -0
- package/build/js/versionListCommand-FR7G6D7I.cjs.map +1 -0
- package/build/js/versionSetCommand-73LHJBP5.cjs +29 -0
- package/build/js/versionSetCommand-73LHJBP5.cjs.map +1 -0
- package/build/js/{versionSetCommand-BD3O7OAX.mjs → versionSetCommand-GRRGFGPP.mjs} +5 -9
- package/build/js/versionSetCommand-GRRGFGPP.mjs.map +1 -0
- package/build/js/{versionUnsetCommand-BZ2SAFEM.cjs → versionUnsetCommand-3MUKQRD5.cjs} +6 -8
- package/build/js/versionUnsetCommand-3MUKQRD5.cjs.map +1 -0
- package/build/js/{versionUnsetCommand-W7ACW5O3.mjs → versionUnsetCommand-PZF5G4WC.mjs} +4 -6
- package/build/js/versionUnsetCommand-PZF5G4WC.mjs.map +1 -0
- package/build/types/commands/site/deploy/siteDeployCommand.d.mts.map +1 -1
- package/build/types/commands/site/version/delete/versionDeleteCommand.d.mts.map +1 -1
- package/build/types/commands/site/version/get/versionGetCommand.d.mts.map +1 -1
- package/build/types/commands/site/version/list/versionListCommand.d.mts.map +1 -1
- package/build/types/commands/site/version/set/versionSetCommand.d.mts.map +1 -1
- package/build/types/commands/site/version/unset/versionUnsetCommand.d.mts.map +1 -1
- package/build/types/net/index.d.mts +1 -5
- package/build/types/net/index.d.mts.map +1 -1
- package/build/types/net/third-party-applications/ListWebsiteVersionsResponse.d.mts +6 -0
- package/build/types/net/third-party-applications/ListWebsiteVersionsResponse.d.mts.map +1 -0
- package/build/types/net/third-party-applications/UpdateWebsiteDeploymentRequest.d.mts +4 -0
- package/build/types/net/third-party-applications/UpdateWebsiteDeploymentRequest.d.mts.map +1 -0
- package/build/types/net/third-party-applications/WebsiteDeployment.d.mts +5 -0
- package/build/types/net/third-party-applications/WebsiteDeployment.d.mts.map +1 -0
- package/build/types/net/third-party-applications/WebsiteVersion.d.mts +4 -0
- package/build/types/net/third-party-applications/WebsiteVersion.d.mts.map +1 -0
- package/build/types/net/third-party-applications/deleteWebsiteDeployment.d.mts +4 -0
- package/build/types/net/third-party-applications/deleteWebsiteDeployment.d.mts.map +1 -0
- package/build/types/net/third-party-applications/deleteWebsiteVersion.d.mts +4 -0
- package/build/types/net/third-party-applications/deleteWebsiteVersion.d.mts.map +1 -0
- package/build/types/net/third-party-applications/getWebsiteDeployment.d.mts +5 -0
- package/build/types/net/third-party-applications/getWebsiteDeployment.d.mts.map +1 -0
- package/build/types/net/third-party-applications/index.d.mts +11 -0
- package/build/types/net/third-party-applications/index.d.mts.map +1 -0
- package/build/types/net/third-party-applications/listWebsiteVersions.d.mts +5 -0
- package/build/types/net/third-party-applications/listWebsiteVersions.d.mts.map +1 -0
- package/build/types/net/third-party-applications/updateWebsiteDeployment.d.mts +6 -0
- package/build/types/net/third-party-applications/updateWebsiteDeployment.d.mts.map +1 -0
- package/build/types/net/third-party-applications/uploadWebsiteVersion.d.mts +5 -0
- package/build/types/net/third-party-applications/uploadWebsiteVersion.d.mts.map +1 -0
- package/changelog/0.17.0/pr-166.v2.yml +5 -0
- package/package.json +1 -1
- package/build/js/chunk-2KJDB4YP.cjs +0 -267
- package/build/js/chunk-2KJDB4YP.cjs.map +0 -1
- package/build/js/chunk-AX5HH3ZN.cjs.map +0 -1
- package/build/js/chunk-JTZ7GUB4.mjs +0 -256
- package/build/js/chunk-JTZ7GUB4.mjs.map +0 -1
- package/build/js/chunk-MTJA6DOB.mjs.map +0 -1
- package/build/js/handleGenerate-XC5RBDDW-DL73JJG6.cjs.map +0 -1
- package/build/js/handleGenerate-XC5RBDDW-T333WMC4.mjs.map +0 -1
- package/build/js/siteDeployCommand-FTCDKKU4.cjs.map +0 -1
- package/build/js/siteDeployCommand-WHR7PIJE.mjs.map +0 -1
- package/build/js/versionDeleteCommand-KQCJ7CHQ.cjs.map +0 -1
- package/build/js/versionDeleteCommand-YFVUCYVQ.mjs.map +0 -1
- package/build/js/versionGetCommand-45C2JZC4.cjs +0 -30
- package/build/js/versionGetCommand-45C2JZC4.cjs.map +0 -1
- package/build/js/versionGetCommand-AKPCEBQZ.mjs +0 -28
- package/build/js/versionGetCommand-AKPCEBQZ.mjs.map +0 -1
- package/build/js/versionListCommand-4TM6YYNJ.cjs +0 -36
- package/build/js/versionListCommand-4TM6YYNJ.cjs.map +0 -1
- package/build/js/versionListCommand-6OVL7FF2.mjs +0 -34
- package/build/js/versionListCommand-6OVL7FF2.mjs.map +0 -1
- package/build/js/versionSetCommand-BD3O7OAX.mjs.map +0 -1
- package/build/js/versionSetCommand-FIWT6CFW.cjs +0 -33
- package/build/js/versionSetCommand-FIWT6CFW.cjs.map +0 -1
- package/build/js/versionUnsetCommand-BZ2SAFEM.cjs.map +0 -1
- package/build/js/versionUnsetCommand-W7ACW5O3.mjs.map +0 -1
- package/build/types/generated/artifacts-sites/ArtifactsSitesAdminV2Service/clearDeployedVersion.d.ts +0 -9
- package/build/types/generated/artifacts-sites/ArtifactsSitesAdminV2Service/clearDeployedVersion.d.ts.map +0 -1
- package/build/types/generated/artifacts-sites/ArtifactsSitesAdminV2Service/getContentSecurityPolicyAdditions.d.ts +0 -9
- package/build/types/generated/artifacts-sites/ArtifactsSitesAdminV2Service/getContentSecurityPolicyAdditions.d.ts.map +0 -1
- package/build/types/generated/artifacts-sites/ArtifactsSitesAdminV2Service/getDeployedVersion.d.ts +0 -9
- package/build/types/generated/artifacts-sites/ArtifactsSitesAdminV2Service/getDeployedVersion.d.ts.map +0 -1
- package/build/types/generated/artifacts-sites/ArtifactsSitesAdminV2Service/getRegisteredSiteDomains.d.ts +0 -10
- package/build/types/generated/artifacts-sites/ArtifactsSitesAdminV2Service/getRegisteredSiteDomains.d.ts.map +0 -1
- package/build/types/generated/artifacts-sites/ArtifactsSitesAdminV2Service/getRequestedSiteDomains.d.ts +0 -11
- package/build/types/generated/artifacts-sites/ArtifactsSitesAdminV2Service/getRequestedSiteDomains.d.ts.map +0 -1
- package/build/types/generated/artifacts-sites/ArtifactsSitesAdminV2Service/previewContentSecurityPolicy.d.ts +0 -10
- package/build/types/generated/artifacts-sites/ArtifactsSitesAdminV2Service/previewContentSecurityPolicy.d.ts.map +0 -1
- package/build/types/generated/artifacts-sites/ArtifactsSitesAdminV2Service/putContentSecurityPolicyAdditions.d.ts +0 -9
- package/build/types/generated/artifacts-sites/ArtifactsSitesAdminV2Service/putContentSecurityPolicyAdditions.d.ts.map +0 -1
- package/build/types/generated/artifacts-sites/ArtifactsSitesAdminV2Service/requestSiteDomainForRepository.d.ts +0 -13
- package/build/types/generated/artifacts-sites/ArtifactsSitesAdminV2Service/requestSiteDomainForRepository.d.ts.map +0 -1
- package/build/types/generated/artifacts-sites/ArtifactsSitesAdminV2Service/unregisterSiteDomain.d.ts +0 -12
- package/build/types/generated/artifacts-sites/ArtifactsSitesAdminV2Service/unregisterSiteDomain.d.ts.map +0 -1
- package/build/types/generated/artifacts-sites/ArtifactsSitesAdminV2Service/updateDeployedVersion.d.ts +0 -9
- package/build/types/generated/artifacts-sites/ArtifactsSitesAdminV2Service/updateDeployedVersion.d.ts.map +0 -1
- package/build/types/generated/artifacts-sites/ArtifactsSitesAdminV2Service.d.ts +0 -11
- package/build/types/generated/artifacts-sites/ArtifactsSitesAdminV2Service.d.ts.map +0 -1
- package/build/types/generated/artifacts-sites/ContentSecurityPolicyAdditions.d.ts +0 -6
- package/build/types/generated/artifacts-sites/ContentSecurityPolicyAdditions.d.ts.map +0 -1
- package/build/types/generated/artifacts-sites/ContentSecurityPolicyDirectiveName.d.ts +0 -2
- package/build/types/generated/artifacts-sites/ContentSecurityPolicyDirectiveName.d.ts.map +0 -1
- package/build/types/generated/artifacts-sites/ContentSecurityPolicyDirectiveValue.d.ts +0 -2
- package/build/types/generated/artifacts-sites/ContentSecurityPolicyDirectiveValue.d.ts.map +0 -1
- package/build/types/generated/artifacts-sites/ContentSecurityPolicyHeaderValue.d.ts +0 -2
- package/build/types/generated/artifacts-sites/ContentSecurityPolicyHeaderValue.d.ts.map +0 -1
- package/build/types/generated/artifacts-sites/ControlPanelManagedDomainInfo.d.ts +0 -13
- package/build/types/generated/artifacts-sites/ControlPanelManagedDomainInfo.d.ts.map +0 -1
- package/build/types/generated/artifacts-sites/DomainName.d.ts +0 -4
- package/build/types/generated/artifacts-sites/DomainName.d.ts.map +0 -1
- package/build/types/generated/artifacts-sites/PreviewContentSecurityPolicyRequest.d.ts +0 -5
- package/build/types/generated/artifacts-sites/PreviewContentSecurityPolicyRequest.d.ts.map +0 -1
- package/build/types/generated/artifacts-sites/SiteDomainInfo.d.ts +0 -7
- package/build/types/generated/artifacts-sites/SiteDomainInfo.d.ts.map +0 -1
- package/build/types/generated/artifacts-sites/SiteDomainRegistrationRequestRid.d.ts +0 -2
- package/build/types/generated/artifacts-sites/SiteDomainRegistrationRequestRid.d.ts.map +0 -1
- package/build/types/generated/artifacts-sites/SiteVersion.d.ts +0 -4
- package/build/types/generated/artifacts-sites/SiteVersion.d.ts.map +0 -1
- package/build/types/generated/artifacts-sites/SubmitDomainRegistrationRequest.d.ts +0 -8
- package/build/types/generated/artifacts-sites/SubmitDomainRegistrationRequest.d.ts.map +0 -1
- package/build/types/generated/artifacts-sites/UnregisterDomainRequest.d.ts +0 -5
- package/build/types/generated/artifacts-sites/UnregisterDomainRequest.d.ts.map +0 -1
- package/build/types/generated/artifacts-sites/UpdateDeployedVersionRequest.d.ts +0 -5
- package/build/types/generated/artifacts-sites/UpdateDeployedVersionRequest.d.ts.map +0 -1
- package/build/types/generated/artifacts-sites/index.d.ts +0 -15
- package/build/types/generated/artifacts-sites/index.d.ts.map +0 -1
- package/build/types/net/RepositoryRid.d.ts +0 -2
- package/build/types/net/RepositoryRid.d.ts.map +0 -1
- package/build/types/net/artifacts/SiteAssetArtifactsService/DeleteSiteVersionRequest.d.mts +0 -6
- package/build/types/net/artifacts/SiteAssetArtifactsService/DeleteSiteVersionRequest.d.mts.map +0 -1
- package/build/types/net/artifacts/SiteAssetArtifactsService/SiteAssetVersions.d.mts +0 -4
- package/build/types/net/artifacts/SiteAssetArtifactsService/SiteAssetVersions.d.mts.map +0 -1
- package/build/types/net/artifacts/SiteAssetArtifactsService/UploadZippedSiteAssetRequest.d.mts +0 -7
- package/build/types/net/artifacts/SiteAssetArtifactsService/UploadZippedSiteAssetRequest.d.mts.map +0 -1
- package/build/types/net/artifacts/SiteAssetArtifactsService/deleteSiteVersion.d.mts +0 -4
- package/build/types/net/artifacts/SiteAssetArtifactsService/deleteSiteVersion.d.mts.map +0 -1
- package/build/types/net/artifacts/SiteAssetArtifactsService/fetchSiteVersions.d.mts +0 -4
- package/build/types/net/artifacts/SiteAssetArtifactsService/fetchSiteVersions.d.mts.map +0 -1
- package/build/types/net/artifacts/SiteAssetArtifactsService/getSiteAssetBaseUrl.d.mts +0 -2
- package/build/types/net/artifacts/SiteAssetArtifactsService/getSiteAssetBaseUrl.d.mts.map +0 -1
- package/build/types/net/artifacts/SiteAssetArtifactsService/index.d.mts +0 -5
- package/build/types/net/artifacts/SiteAssetArtifactsService/index.d.mts.map +0 -1
- package/build/types/net/artifacts/SiteAssetArtifactsService/uploadSiteVersion.d.mts +0 -4
- package/build/types/net/artifacts/SiteAssetArtifactsService/uploadSiteVersion.d.mts.map +0 -1
- package/build/types/net/artifacts/index.d.mts +0 -2
- package/build/types/net/artifacts/index.d.mts.map +0 -1
- package/build/types/net/createConjureContext.d.mts +0 -3
- package/build/types/net/createConjureContext.d.mts.map +0 -1
- package/build/types/net/third-party-application-service/fetchWebsiteRepositoryRid.d.mts +0 -5
- package/build/types/net/third-party-application-service/fetchWebsiteRepositoryRid.d.mts.map +0 -1
- package/build/types/net/third-party-application-service/index.d.mts +0 -2
- package/build/types/net/third-party-application-service/index.d.mts.map +0 -1
|
@@ -1,256 +0,0 @@
|
|
|
1
|
-
import { ExitProcessError } from './chunk-MTJA6DOB.mjs';
|
|
2
|
-
import { __export } from './chunk-E2SEJZTC.mjs';
|
|
3
|
-
import { conjureFetch } from 'conjure-lite';
|
|
4
|
-
import { consola } from 'consola';
|
|
5
|
-
import { createFetchHeaderMutator, createFetchOrThrow, PalantirApiError } from '@osdk/shared.net';
|
|
6
|
-
import { promises } from 'fs';
|
|
7
|
-
import path from 'path';
|
|
8
|
-
|
|
9
|
-
// src/generated/artifacts-sites/ArtifactsSitesAdminV2Service.ts
|
|
10
|
-
var ArtifactsSitesAdminV2Service_exports = {};
|
|
11
|
-
__export(ArtifactsSitesAdminV2Service_exports, {
|
|
12
|
-
clearDeployedVersion: () => clearDeployedVersion,
|
|
13
|
-
getContentSecurityPolicyAdditions: () => getContentSecurityPolicyAdditions,
|
|
14
|
-
getDeployedVersion: () => getDeployedVersion,
|
|
15
|
-
getRegisteredSiteDomains: () => getRegisteredSiteDomains,
|
|
16
|
-
getRequestedSiteDomains: () => getRequestedSiteDomains,
|
|
17
|
-
previewContentSecurityPolicy: () => previewContentSecurityPolicy,
|
|
18
|
-
putContentSecurityPolicyAdditions: () => putContentSecurityPolicyAdditions,
|
|
19
|
-
requestSiteDomainForRepository: () => requestSiteDomainForRepository,
|
|
20
|
-
unregisterSiteDomain: () => unregisterSiteDomain,
|
|
21
|
-
updateDeployedVersion: () => updateDeployedVersion
|
|
22
|
-
});
|
|
23
|
-
async function clearDeployedVersion(ctx, repositoryRid) {
|
|
24
|
-
return conjureFetch(ctx, `/sites/v2/admin/repository/${repositoryRid}/deployed-version`, "DELETE");
|
|
25
|
-
}
|
|
26
|
-
async function getContentSecurityPolicyAdditions(ctx, repositoryRid) {
|
|
27
|
-
return conjureFetch(ctx, `/sites/v2/admin/repository/${repositoryRid}/csp/additions`, "GET");
|
|
28
|
-
}
|
|
29
|
-
async function getDeployedVersion(ctx, repositoryRid) {
|
|
30
|
-
return conjureFetch(ctx, `/sites/v2/admin/repository/${repositoryRid}/deployed-version`, "GET");
|
|
31
|
-
}
|
|
32
|
-
async function getRegisteredSiteDomains(ctx, repositoryRid) {
|
|
33
|
-
return conjureFetch(ctx, `/sites/v2/admin/repository/${repositoryRid}/domains/registered`, "GET");
|
|
34
|
-
}
|
|
35
|
-
async function getRequestedSiteDomains(ctx, repositoryRid) {
|
|
36
|
-
return conjureFetch(ctx, `/sites/v2/admin/repository/${repositoryRid}/domains/requested`, "GET");
|
|
37
|
-
}
|
|
38
|
-
async function previewContentSecurityPolicy(ctx, repositoryRid, request) {
|
|
39
|
-
return conjureFetch(ctx, `/sites/v2/admin/repository/${repositoryRid}/csp/preview`, "POST", request);
|
|
40
|
-
}
|
|
41
|
-
async function putContentSecurityPolicyAdditions(ctx, repositoryRid, contentSecurityPolicyAdditions) {
|
|
42
|
-
return conjureFetch(ctx, `/sites/v2/admin/repository/${repositoryRid}/csp/additions`, "PUT", contentSecurityPolicyAdditions);
|
|
43
|
-
}
|
|
44
|
-
async function requestSiteDomainForRepository(ctx, repositoryRid, request) {
|
|
45
|
-
return conjureFetch(ctx, `/sites/v2/admin/repository/${repositoryRid}/domains/submit-registration`, "POST", request);
|
|
46
|
-
}
|
|
47
|
-
async function unregisterSiteDomain(ctx, repositoryRid, request) {
|
|
48
|
-
return conjureFetch(ctx, `/sites/v2/admin/repository/${repositoryRid}/domains/unregister`, "POST", request);
|
|
49
|
-
}
|
|
50
|
-
async function updateDeployedVersion(ctx, repositoryRid, version) {
|
|
51
|
-
return conjureFetch(ctx, `/sites/v2/admin/repository/${repositoryRid}/deployed-version`, "PUT", version);
|
|
52
|
-
}
|
|
53
|
-
|
|
54
|
-
// src/net/artifacts/index.mts
|
|
55
|
-
var artifacts_exports = {};
|
|
56
|
-
__export(artifacts_exports, {
|
|
57
|
-
SiteAssetArtifactsService: () => SiteAssetArtifactsService_exports
|
|
58
|
-
});
|
|
59
|
-
|
|
60
|
-
// src/net/artifacts/SiteAssetArtifactsService/index.mts
|
|
61
|
-
var SiteAssetArtifactsService_exports = {};
|
|
62
|
-
__export(SiteAssetArtifactsService_exports, {
|
|
63
|
-
deleteSiteVersion: () => deleteSiteVersion,
|
|
64
|
-
fetchSiteVersions: () => fetchSiteVersions,
|
|
65
|
-
uploadZippedSiteAsset: () => uploadZippedSiteAsset
|
|
66
|
-
});
|
|
67
|
-
|
|
68
|
-
// src/net/UserAgent.ts
|
|
69
|
-
var USER_AGENT = `osdk-cli/${"0.16.0"}`;
|
|
70
|
-
|
|
71
|
-
// src/net/createFetch.mts
|
|
72
|
-
function createFetch(tokenProvider, fetchFn = fetch) {
|
|
73
|
-
return createFetchHeaderMutator(createRequestLoggingFetch(createErrorExitingFetch(createFetchOrThrow(fetchFn))), async (headers) => {
|
|
74
|
-
const token = await tokenProvider();
|
|
75
|
-
headers.set("Authorization", `Bearer ${token}`);
|
|
76
|
-
headers.set("Fetch-User-Agent", USER_AGENT);
|
|
77
|
-
return headers;
|
|
78
|
-
});
|
|
79
|
-
}
|
|
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
|
-
let message = e.message;
|
|
96
|
-
if (e.errorName === "Artifacts:ArtifactAlreadyExists") {
|
|
97
|
-
message = "Version already exists";
|
|
98
|
-
}
|
|
99
|
-
throw new ExitProcessError(1, message, tip);
|
|
100
|
-
}
|
|
101
|
-
function createRequestLoggingFetch(fetchFn = fetch) {
|
|
102
|
-
return function requestLoggingFetch(input, init) {
|
|
103
|
-
const requestLog = typeof input === "string" || input instanceof URL ? `${init?.method ?? "GET"}: ${input.toString().trim()}` : `${input.method ?? "GET"}: ${input.url.toString().trim()}`;
|
|
104
|
-
consola.trace(requestLog);
|
|
105
|
-
return fetchFn(input, init).then((a) => {
|
|
106
|
-
consola.trace(`FINISH ${requestLog}`);
|
|
107
|
-
return a;
|
|
108
|
-
});
|
|
109
|
-
};
|
|
110
|
-
}
|
|
111
|
-
async function fetchWebsiteRepositoryRid(ctx, thirdPartyAppRid) {
|
|
112
|
-
const fetch2 = createFetch(ctx.tokenProvider);
|
|
113
|
-
const url = `
|
|
114
|
-
${ctx.foundryUrl}/third-party-application-service/api/application-websites/${thirdPartyAppRid}`;
|
|
115
|
-
const result = await fetch2(url);
|
|
116
|
-
if (result.status >= 200 && result.status < 300) {
|
|
117
|
-
const repositoryRid = await result.json();
|
|
118
|
-
consola.debug(`Repository RID: ${repositoryRid}`);
|
|
119
|
-
return repositoryRid;
|
|
120
|
-
}
|
|
121
|
-
throw new ExitProcessError(result.status, `Unexpected response code ${result.status} (${result.statusText})`);
|
|
122
|
-
}
|
|
123
|
-
|
|
124
|
-
// src/net/artifacts/SiteAssetArtifactsService/getSiteAssetBaseUrl.mts
|
|
125
|
-
function getSiteAssetBaseUrl(foundryBaseUrl, repositoryRid) {
|
|
126
|
-
return `${foundryBaseUrl}/artifacts/api/repositories/${repositoryRid}/contents/release/siteasset`;
|
|
127
|
-
}
|
|
128
|
-
|
|
129
|
-
// src/net/artifacts/SiteAssetArtifactsService/deleteSiteVersion.mts
|
|
130
|
-
async function deleteSiteVersion(ctx, request) {
|
|
131
|
-
const repositoryRid = await fetchWebsiteRepositoryRid(ctx, request.application);
|
|
132
|
-
const url = `${getSiteAssetBaseUrl(ctx.foundryUrl, repositoryRid)}/versions/${request.version}`;
|
|
133
|
-
const fetch2 = createFetch(ctx.tokenProvider);
|
|
134
|
-
const result = await fetch2(url, {
|
|
135
|
-
method: "DELETE"
|
|
136
|
-
});
|
|
137
|
-
if (result.status >= 200 && result.status < 300) {
|
|
138
|
-
consola.debug(`${result.status} - Status Text: '${result.statusText}'`);
|
|
139
|
-
return true;
|
|
140
|
-
} else {
|
|
141
|
-
throw new ExitProcessError(result.status, `Unexpected response code ${result.status} (${result.statusText})`);
|
|
142
|
-
}
|
|
143
|
-
}
|
|
144
|
-
|
|
145
|
-
// src/net/artifacts/SiteAssetArtifactsService/fetchSiteVersions.mts
|
|
146
|
-
async function fetchSiteVersions(ctx, thirdPartyAppRid) {
|
|
147
|
-
const repositoryRid = await fetchWebsiteRepositoryRid(ctx, thirdPartyAppRid);
|
|
148
|
-
const url = `${getSiteAssetBaseUrl(ctx.foundryUrl, repositoryRid)}/versions`;
|
|
149
|
-
const fetch2 = createFetch(ctx.tokenProvider);
|
|
150
|
-
const result = await fetch2(url);
|
|
151
|
-
if (result.status === 200) {
|
|
152
|
-
const response = await result.json();
|
|
153
|
-
return response.versions;
|
|
154
|
-
} else {
|
|
155
|
-
throw new ExitProcessError(result.status, `Unexpected response code ${result.status} (${result.statusText})`);
|
|
156
|
-
}
|
|
157
|
-
}
|
|
158
|
-
async function uploadZippedSiteAsset(ctx, request) {
|
|
159
|
-
const repositoryRid = await fetchWebsiteRepositoryRid(ctx, request.application);
|
|
160
|
-
const url = `${getSiteAssetBaseUrl(ctx.foundryUrl, repositoryRid)}/versions/zip/${request.version}`;
|
|
161
|
-
const fetch2 = createFetch(ctx.tokenProvider);
|
|
162
|
-
const result = await fetch2(url, {
|
|
163
|
-
method: "PUT",
|
|
164
|
-
body: request.zipFile,
|
|
165
|
-
headers: {
|
|
166
|
-
"Content-Type": "application/octet-stream"
|
|
167
|
-
},
|
|
168
|
-
duplex: "half"
|
|
169
|
-
// Node hates me
|
|
170
|
-
});
|
|
171
|
-
if (result.status >= 200 && result.status < 300) {
|
|
172
|
-
consola.debug("Status Text: " + result.statusText);
|
|
173
|
-
return true;
|
|
174
|
-
} else if (result.status === 409) {
|
|
175
|
-
throw new ExitProcessError(result.status, "Version already exists");
|
|
176
|
-
} else {
|
|
177
|
-
throw new ExitProcessError(result.status, `Unexpected response code ${result.status} (${result.statusText})`);
|
|
178
|
-
}
|
|
179
|
-
}
|
|
180
|
-
|
|
181
|
-
// src/net/createConjureContext.mts
|
|
182
|
-
function createConjureContext(foundryUrl, servicePath, tokenProvider) {
|
|
183
|
-
return {
|
|
184
|
-
fetchFn: createFetch(tokenProvider),
|
|
185
|
-
baseUrl: foundryUrl,
|
|
186
|
-
servicePath
|
|
187
|
-
};
|
|
188
|
-
}
|
|
189
|
-
|
|
190
|
-
// src/net/createInternalClientContext.mts
|
|
191
|
-
function createInternalClientContext(foundryUrl, tokenProvider) {
|
|
192
|
-
return {
|
|
193
|
-
tokenProvider,
|
|
194
|
-
foundryUrl
|
|
195
|
-
};
|
|
196
|
-
}
|
|
197
|
-
|
|
198
|
-
// src/net/third-party-application-service/index.mts
|
|
199
|
-
var third_party_application_service_exports = {};
|
|
200
|
-
__export(third_party_application_service_exports, {
|
|
201
|
-
fetchWebsiteRepositoryRid: () => fetchWebsiteRepositoryRid
|
|
202
|
-
});
|
|
203
|
-
var TOKEN_ENV_VARS = ["FOUNDRY_TOKEN", "FOUNDRY_SDK_AUTH_TOKEN"];
|
|
204
|
-
async function loadToken(token, tokenFile) {
|
|
205
|
-
if (token) {
|
|
206
|
-
consola.debug(`Using token from --token option`);
|
|
207
|
-
validate(token);
|
|
208
|
-
return token;
|
|
209
|
-
}
|
|
210
|
-
if (tokenFile) {
|
|
211
|
-
const loadedToken = await loadTokenFile(tokenFile);
|
|
212
|
-
consola.debug(`Using token from --tokenFile=${loadedToken.filePath} option`);
|
|
213
|
-
validate(loadedToken.token);
|
|
214
|
-
return loadedToken.token;
|
|
215
|
-
}
|
|
216
|
-
for (const envVar of TOKEN_ENV_VARS) {
|
|
217
|
-
const environmentToken = process.env[envVar];
|
|
218
|
-
if (environmentToken) {
|
|
219
|
-
consola.debug(`Using token from ${envVar} environment variable`);
|
|
220
|
-
validate(environmentToken);
|
|
221
|
-
if (envVar === "FOUNDRY_SDK_AUTH_TOKEN") {
|
|
222
|
-
consola.warn(`Using FOUNDRY_SDK_AUTH_TOKEN environment variable is deprecated. Please use FOUNDRY_TOKEN instead.`);
|
|
223
|
-
}
|
|
224
|
-
return environmentToken;
|
|
225
|
-
}
|
|
226
|
-
}
|
|
227
|
-
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`);
|
|
228
|
-
}
|
|
229
|
-
async function loadTokenFile(filePath) {
|
|
230
|
-
let token;
|
|
231
|
-
let resolvedPath;
|
|
232
|
-
try {
|
|
233
|
-
resolvedPath = path.resolve(filePath);
|
|
234
|
-
token = await promises.readFile(resolvedPath, "utf8");
|
|
235
|
-
token = token.trim();
|
|
236
|
-
} catch (error) {
|
|
237
|
-
throw new ExitProcessError(2, `Unable to read token file "${filePath}": ${error}`);
|
|
238
|
-
}
|
|
239
|
-
return {
|
|
240
|
-
filePath: resolvedPath,
|
|
241
|
-
token
|
|
242
|
-
};
|
|
243
|
-
}
|
|
244
|
-
function validate(token) {
|
|
245
|
-
if (!isJWT(token)) {
|
|
246
|
-
throw new ExitProcessError(2, `Token does not appear to be a JWT`);
|
|
247
|
-
}
|
|
248
|
-
}
|
|
249
|
-
function isJWT(token) {
|
|
250
|
-
const jwtPattern = /^[A-Za-z0-9-_]+\.[A-Za-z0-9-_]+\.[A-Za-z0-9-_]*$/;
|
|
251
|
-
return jwtPattern.test(token);
|
|
252
|
-
}
|
|
253
|
-
|
|
254
|
-
export { ArtifactsSitesAdminV2Service_exports, artifacts_exports, createConjureContext, createInternalClientContext, loadToken, third_party_application_service_exports };
|
|
255
|
-
//# sourceMappingURL=out.js.map
|
|
256
|
-
//# sourceMappingURL=chunk-JTZ7GUB4.mjs.map
|
|
@@ -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/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,qB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V;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 { ExitProcessError } from \"@osdk/cli.common\";\nimport { consola } from \"consola\";\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 { ExitProcessError } from \"@osdk/cli.common\";\nimport { createFetchHeaderMutator, createFetchOrThrow, PalantirApiError } from \"@osdk/shared.net\";\nimport { consola } from \"consola\";\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 let message = e.message;\n if (e.errorName === \"Artifacts:ArtifactAlreadyExists\") {\n message = \"Version already exists\";\n }\n throw new ExitProcessError(1, 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 { ExitProcessError } from \"@osdk/cli.common\";\nimport { consola } from \"consola\";\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 \"@osdk/cli.common\";\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 { ExitProcessError } from \"@osdk/cli.common\";\nimport { consola } from \"consola\";\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 { ExitProcessError } from \"@osdk/cli.common\";\nimport { consola } from \"consola\";\nimport { promises as fsPromises } from \"node:fs\";\nimport path from \"node:path\";\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 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../cli.common/build/js/index.mjs"],"names":[],"mappings":";AAAA,SAAS,eAAe;AACxB,SAAS,gBAAgB;AACzB,OAAO,WAAW;AAClB,SAAS,eAAe;AACxB,SAAS,aAAa;AAGtB,IAAI,mBAAmB,cAAc,MAAM;AAAA,EACzC,YAAY,WAAW,KAAK,KAAK;AAC/B,UAAM,GAAG;AACT,SAAK,YAAY;AACjB,SAAK,MAAM;AACX,SAAK,MAAM;AAAA,EACb;AACF;AACA,IAAI,YAAY;AAChB,eAAe,mBAAmB,MAAM;AACtC,MAAI,WAAW;AACb,gBAAY;AACZ,YAAQ,QAAQ,IAAI,KAAK;AACzB,QAAI,QAAQ,QAAQ,GAAG;AACrB,cAAQ,MAAM,4BAA4B,QAAQ,UAAU,IAAI,UAAU,OAAO;AAAA,CACtF;AAAA,IACG;AAAA,EACF;AACF;AAGA,IAAI,kBAAkB,cAAc,MAAM;AAAA,EACxC,YAAY,KAAK;AACf,UAAM,GAAG;AAAA,EACX;AACF;AAGA,SAAS,aAAa,MAAM;AAC1B,SAAO,MAAM,QAAQ,IAAI,CAAC,EAAE,KAAK,KAAK,IAAI,KAAK,MAAM,EAAE,cAAc,CAAC,CAAC,EAAE,IAAI,MAAM,EAAE,QAAQ,KAAK,EAAE,OAAO,WAAW;AAAA,IACpH,OAAO;AAAA,IACP,MAAM;AAAA,IACN,aAAa;AAAA,IACb,OAAO;AAAA,EACT,CAAC,EAAE,cAAc,EAAE,WAAW,oBAAoB,IAAI,EAAE,OAAO,EAAE,KAAK,OAAO,KAAK,KAAK,SAAS;AAC9F,QAAI,eAAe,kBAAkB;AACnC,cAAQ,MAAM,IAAI,OAAO;AACzB,UAAI,IAAI,OAAO,MAAM;AACnB,gBAAQ,IAAI,SAAS,QAAQ,kBAAkB,IAAI,GAAG,EAAE,CAAC;AACzD,gBAAQ,IAAI,EAAE;AAAA,MAChB;AACA,cAAQ,MAAM,IAAI,KAAK;AAAA,IACzB,OAAO;AACL,UAAI,OAAO,eAAe,oBAAoB,OAAO;AACnD,cAAM;AAAA,MACR,OAAO;AACL,aAAK,SAAS;AACd,gBAAQ,IAAI,EAAE;AACd,gBAAQ,MAAM,GAAG;AAAA,MACnB;AAAA,IACF;AACA,YAAQ,KAAK,CAAC;AAAA,EAChB,CAAC;AACH;AACA,SAAS,cAAc,cAAc;AACnC,SAAO,MAAM,YAAY,KAAK;AAChC","sourcesContent":["import { consola } from 'consola';\nimport { colorize } from 'consola/utils';\nimport yargs from 'yargs';\nimport { hideBin } from 'yargs/helpers';\nimport { valid } from 'semver';\n\n// src/ExitProcessError.ts\nvar ExitProcessError = class extends Error {\n constructor(errorCode, msg, tip) {\n super(msg);\n this.errorCode = errorCode;\n this.msg = msg;\n this.tip = tip;\n }\n};\nvar firstTime = true;\nasync function logLevelMiddleware(args) {\n if (firstTime) {\n firstTime = false;\n consola.level = 3 + args.verbose;\n if (consola.level > 3) {\n consola.debug(`Verbose logging enabled (${consola.level === 4 ? \"debug\" : \"trace\"})\n`);\n }\n }\n}\n\n// src/YargsCheckError.ts\nvar YargsCheckError = class extends Error {\n constructor(msg) {\n super(msg);\n }\n};\n\n// src/getYargsBase.ts\nfunction getYargsBase(args) {\n return yargs(hideBin(args)).wrap(Math.min(150, yargs().terminalWidth())).env(\"OSDK\").version(false).option(\"verbose\", {\n alias: \"v\",\n type: \"boolean\",\n description: \"Enable verbose logging\",\n count: true\n }).demandCommand().middleware(logLevelMiddleware, true).strict().fail(async (msg, err, argv) => {\n if (err instanceof ExitProcessError) {\n consola.error(err.message);\n if (err.tip != null) {\n consola.log(colorize(\"bold\", `\\u{1F4A1} Tip: ${err.tip}`));\n consola.log(\"\");\n }\n consola.debug(err.stack);\n } else {\n if (err && err instanceof YargsCheckError === false) {\n throw err;\n } else {\n argv.showHelp();\n consola.log(\"\");\n consola.error(msg);\n }\n }\n process.exit(1);\n });\n}\nfunction isValidSemver(semverString) {\n return valid(semverString) != null;\n}\nexport { ExitProcessError, YargsCheckError, getYargsBase, isValidSemver };"]}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../cli.cmd.typescript/build/js/handleGenerate-XC5RBDDW.mjs"],"names":[],"mappings":";;;;;;;;;;AAEA,SAAS,kBAAkB,+BAA+B;AAC1D,SAAS,sCAAsC,yCAAyC;AACxF,SAAS,qBAAqB,4BAA4B;AAC1D,SAAS,eAAe;AACxB,SAAS,cAAc;AACvB,YAAY,QAAQ;AACpB,YAAY,UAAU;AACtB,SAAS,qBAAqB;AAG9B,IAAI,aAAa,YAAY,OAAO;AACpC,eAAe,eAAe,MAAM;AAClC,MAAI,UAAU;AACd,MAAI,KAAK,cAAc;AACrB,cAAU,MAAM,sBAAsB,IAAI;AAAA,EAC5C,WAAW,KAAK,cAAc,KAAK,UAAU;AAC3C,cAAU,MAAM,kBAAkB,IAAI;AAAA,EACxC,OAAO;AACL,UAAM,IAAI,gBAAgB,wDAAwD;AAAA,EACpF;AACA,MAAI,SAAS;AACX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KAAK;AAAA,EACnD;AACF;AACA,eAAe,UAAU,UAAU,MAAM;AACvC,UAAQ,KAAK,WAAW,QAAQ,EAAE;AAClC,UAAQ,MAAM,WAAW,QAAQ,cAAc,IAAI;AACnD,SAAO,MAAS,YAAS,UAAU,UAAU,KAAK,UAAU,MAAM,QAAQ,CAAC,IAAI,IAAI;AACrF","sourcesContent":["import { YargsCheckError, ExitProcessError } from '@osdk/cli.common';\nimport invokeLoginFlow from '@osdk/cli.common/loginFlow';\nimport { listOntologiesV2, getOntologyFullMetadata } from '@osdk/gateway/requests';\nimport { generateClientSdkVersionTwoPointZero, generateClientSdkVersionOneDotOne } from '@osdk/generator';\nimport { createClientContext, createOpenApiRequest } from '@osdk/shared.net';\nimport { consola } from 'consola';\nimport { findUp } from 'find-up';\nimport * as fs from 'fs';\nimport * as path from 'path';\nimport { fileURLToPath } from 'url';\n\n// src/generate/handleGenerate.mts\nvar USER_AGENT = `osdk-cli/${\"0.0.0\"}`;\nasync function handleGenerate(args) {\n let success = false;\n if (args.ontologyPath) {\n success = await generateFromLocalFile(args);\n } else if (args.foundryUrl && args.clientId) {\n success = await generateFromStack(args);\n } else {\n throw new YargsCheckError(\"Must have specified ontologyPath or stack and clientId\");\n }\n if (success) {\n consola.info(\"OSDK Generated!\");\n } else {\n throw new ExitProcessError(1, \"Failed to generate the TypeScript SDK\");\n }\n}\nasync function generateFromLocalFile(args) {\n if (!fs.existsSync(args.ontologyPath)) {\n consola.error(`Ontology file does not exist: ${args.ontologyPath}`);\n return false;\n }\n const ontology = JSON.parse(await fs.promises.readFile(args.ontologyPath, \"utf-8\"));\n return await generateClientSdk(ontology, args);\n}\nasync function generateFromStack(args) {\n const {\n foundryUrl,\n clientId,\n ontologyWritePath\n } = args;\n const token = await invokeLoginFlow({\n clientId,\n foundryUrl,\n verbose: 0\n });\n const {\n fetch\n } = createClientContext({\n metadata: {\n userAgent: USER_AGENT\n }\n }, args.foundryUrl, () => token.access_token, USER_AGENT);\n try {\n const ontologies = await listOntologiesV2(createOpenApiRequest(foundryUrl, fetch));\n if (args.ontologyRid) {\n ontologies.data = ontologies.data.filter(o => o.rid === args.ontologyRid);\n }\n if (ontologies.data.length !== 1) {\n consola.error(`Could not look up ontology with these credentials. Found ${ontologies.data.length} ontologies.`);\n return false;\n }\n const ontology = await getOntologyFullMetadata(createOpenApiRequest(foundryUrl, fetch), ontologies.data[0].apiName);\n if (ontologyWritePath) {\n fs.writeFileSync(ontologyWritePath, JSON.stringify(ontology, null, 2));\n }\n return await generateClientSdk(ontology, args);\n } catch (e) {\n consola.error(\"Failed to generate the ontology\", e);\n return false;\n }\n}\nasync function generateClientSdk(ontology, args) {\n const minimalFs = createNormalFs();\n try {\n if (args.clean) {\n consola.info(\"Cleaning output directory\", args.outDir);\n await fs.promises.rm(args.outDir, {\n recursive: true,\n force: true\n });\n }\n if (!args.asPackage) {\n await generateSourceFiles(args, ontology, createNormalFs());\n return true;\n }\n const packageName = args.packageName;\n if (!packageName) throw new Error(\"Package name is require\");\n const version = args.version;\n for (const packageType of [\"module\", \"commonjs\"]) {\n const outDir = path.join(args.outDir, \"dist\", packageType);\n await generateSourceFiles({\n ...args,\n outDir,\n packageType\n }, ontology, minimalFs);\n await fs.promises.mkdir(outDir, {\n recursive: true\n });\n await writeJson(path.join(outDir, \"package.json\"), {\n type: packageType\n });\n await writeJson(path.join(outDir, `tsconfig.json`), {\n compilerOptions: getTsCompilerOptions(packageType)\n });\n }\n await writeJson(path.join(args.outDir, \"package.json\"), await getPackageJsonContents(packageName, version, args.beta ? 2 : 1));\n await fs.promises.mkdir(path.join(args.outDir, \"ontology\"), {\n recursive: true\n });\n await fs.promises.writeFile(path.join(args.outDir, \"ontology/objects.js\"), `module.exports = require(\"../../dist/module/ontology/objects\")`);\n await fs.promises.writeFile(path.join(args.outDir, \"ontology/objects.d.ts\"), `export * from \"../dist/module/ontology/objects\"`);\n return true;\n } catch (e) {\n consola.error(\"OSDK generation failed\", e.message, e.stack);\n return false;\n }\n}\nfunction getTsCompilerOptions(packageType) {\n const commonTsconfig = {\n importHelpers: true,\n declaration: true,\n isolatedModules: true,\n esModuleInterop: true,\n forceConsistentCasingInFileNames: true,\n strict: true,\n skipLibCheck: true\n };\n const compilerOptions = packageType === \"commonjs\" ? {\n ...commonTsconfig,\n module: \"commonjs\",\n target: \"es2018\"\n } : {\n ...commonTsconfig,\n module: \"NodeNext\",\n target: \"ES2020\"\n };\n return compilerOptions;\n}\nasync function getPackageJsonContents(name, version, sdkVersion) {\n const ourPackageJsonPath = await getOurPackageJsonPath();\n const ourPackageJson = JSON.parse(await fs.promises.readFile(ourPackageJsonPath, \"utf-8\"));\n const esmPrefix = \"./dist/module\";\n const commonjsPrefix = \"./dist/commonjs\";\n return {\n name,\n version,\n main: `${commonjsPrefix}/index.js`,\n module: `${esmPrefix}/index.js`,\n exports: {\n \".\": {\n import: `${esmPrefix}/index.js`,\n require: `${commonjsPrefix}/index.js`\n },\n \"./ontology/objects\": {\n import: `${esmPrefix}/ontology/objects${sdkVersion === 2 ? \"\" : \"/index\"}.js`,\n require: `${commonjsPrefix}/ontology/objects${sdkVersion === 2 ? \"\" : \"/index\"}.js`\n }\n },\n scripts: {\n prepack: `tsc -p ${esmPrefix}/tsconfig.json && tsc -p ${commonjsPrefix}/tsconfig.json`,\n check: \"npm exec attw $(npm pack)\"\n },\n devDependencies: {\n \"typescript\": ourPackageJson.devDependencies.typescript,\n \"tslib\": ourPackageJson.dependencies.tslib,\n \"@arethetypeswrong/cli\": ourPackageJson.dependencies[\"@arethetypeswrong/cli\"],\n \"@osdk/api\": `^${\"1.6.0\"}`,\n ...(sdkVersion === 2 ? {\n \"@osdk/client\": `^${\"0.15.0\"}`\n } : {\n \"@osdk/legacy-client\": `^${\"2.1.0\"}`\n })\n },\n peerDependencies: {\n \"@osdk/api\": `^${\"1.6.0\"}`,\n ...(sdkVersion === 2 ? {\n \"@osdk/client\": `^${\"0.15.0\"}`\n } : {\n \"@osdk/legacy-client\": `^${\"2.1.0\"}`\n })\n },\n files: [\"**/*.js\", \"**/*.d.ts\", \"dist/**/package.json\"]\n };\n}\nvar cachedOurPackageJsonPath;\nasync function getOurPackageJsonPath() {\n if (cachedOurPackageJsonPath) return cachedOurPackageJsonPath;\n const __dir = path.dirname(fileURLToPath(import.meta.url));\n const ourPackageJsonPath = await findUp(\"package.json\", {\n cwd: __dir\n });\n if (!ourPackageJsonPath) {\n throw new Error(\"Could not find our package.json\");\n }\n return cachedOurPackageJsonPath = ourPackageJsonPath;\n}\nasync function generateSourceFiles(args, ontology, fs2) {\n await (args.beta ? generateClientSdkVersionTwoPointZero : generateClientSdkVersionOneDotOne)(ontology, getUserAgent(args.version), fs2, args.outDir, args.packageType);\n}\nfunction getUserAgent(version) {\n if (version === \"dev\") {\n return \"typescript-sdk/dev osdk-cli/dev\";\n } else {\n return `typescript-sdk/${version} ${USER_AGENT}`;\n }\n}\nfunction createNormalFs() {\n return {\n writeFile: (path2, contents) => {\n return fs.promises.writeFile(path2, contents, \"utf-8\");\n },\n mkdir: async (path2, options) => {\n await fs.promises.mkdir(path2, options);\n },\n readdir: async path2 => fs.promises.readdir(path2)\n };\n}\nasync function writeJson(filePath, body) {\n consola.info(`Writing ${filePath}`);\n consola.debug(`Writing ${filePath} with body`, body);\n return await fs.promises.writeFile(filePath, JSON.stringify(body, void 0, 2) + \"\\n\");\n}\nexport { getPackageJsonContents, handleGenerate };"]}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../cli.cmd.typescript/build/js/handleGenerate-XC5RBDDW.mjs"],"names":[],"mappings":";;;;;;;;;;AAEA,SAAS,kBAAkB,+BAA+B;AAC1D,SAAS,sCAAsC,yCAAyC;AACxF,SAAS,qBAAqB,4BAA4B;AAC1D,SAAS,eAAe;AACxB,SAAS,cAAc;AACvB,YAAY,QAAQ;AACpB,YAAY,UAAU;AACtB,SAAS,qBAAqB;AAG9B,IAAI,aAAa,YAAY,OAAO;AACpC,eAAe,eAAe,MAAM;AACl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B;AACxB,SAAO;AAAA,IACL,WAAW,CAAC,OAAO,aAAa;AAC9B,aAAU,YAAS,UAAU,OAAO,UAAU,OAAO;AAAA,IACvD;AAAA,IACA,OAAO,OAAO,OAAO,YAAY;AAC/B,YAAS,YAAS,MAAM,OAAO,OAAO;AAAA,IACxC;AAAA,IACA,SAAS,OAAM,UAAY,YAAS,QAAQ,KAAK;AAAA,EACnD;AACF;AACA,eAAe,UAAU,UAAU,MAAM;AACvC,UAAQ,KAAK,WAAW,QAAQ,EAAE;AAClC,UAAQ,MAAM,WAAW,QAAQ,cAAc,IAAI;AACnD,SAAO,MAAS,YAAS,UAAU,UAAU,KAAK,UAAU,MAAM,QAAQ,CAAC,IAAI,IAAI;AACrF","sourcesContent":["import { YargsCheckError, ExitProcessError } from '@osdk/cli.common';\nimport invokeLoginFlow from '@osdk/cli.common/loginFlow';\nimport { listOntologiesV2, getOntologyFullMetadata } from '@osdk/gateway/requests';\nimport { generateClientSdkVersionTwoPointZero, generateClientSdkVersionOneDotOne } from '@osdk/generator';\nimport { createClientContext, createOpenApiRequest } from '@osdk/shared.net';\nimport { consola } from 'consola';\nimport { findUp } from 'find-up';\nimport * as fs from 'fs';\nimport * as path from 'path';\nimport { fileURLToPath } from 'url';\n\n// src/generate/handleGenerate.mts\nvar USER_AGENT = `osdk-cli/${\"0.0.0\"}`;\nasync function handleGenerate(args) {\n let success = false;\n if (args.ontologyPath) {\n success = await generateFromLocalFile(args);\n } else if (args.foundryUrl && args.clientId) {\n success = await generateFromStack(args);\n } else {\n throw new YargsCheckError(\"Must have specified ontologyPath or stack and clientId\");\n }\n if (success) {\n consola.info(\"OSDK Generated!\");\n } else {\n throw new ExitProcessError(1, \"Failed to generate the TypeScript SDK\");\n }\n}\nasync function generateFromLocalFile(args) {\n if (!fs.existsSync(args.ontologyPath)) {\n consola.error(`Ontology file does not exist: ${args.ontologyPath}`);\n return false;\n }\n const ontology = JSON.parse(await fs.promises.readFile(args.ontologyPath, \"utf-8\"));\n return await generateClientSdk(ontology, args);\n}\nasync function generateFromStack(args) {\n const {\n foundryUrl,\n clientId,\n ontologyWritePath\n } = args;\n const token = await invokeLoginFlow({\n clientId,\n foundryUrl,\n verbose: 0\n });\n const {\n fetch\n } = createClientContext({\n metadata: {\n userAgent: USER_AGENT\n }\n }, args.foundryUrl, () => token.access_token, USER_AGENT);\n try {\n const ontologies = await listOntologiesV2(createOpenApiRequest(foundryUrl, fetch));\n if (args.ontologyRid) {\n ontologies.data = ontologies.data.filter(o => o.rid === args.ontologyRid);\n }\n if (ontologies.data.length !== 1) {\n consola.error(`Could not look up ontology with these credentials. Found ${ontologies.data.length} ontologies.`);\n return false;\n }\n const ontology = await getOntologyFullMetadata(createOpenApiRequest(foundryUrl, fetch), ontologies.data[0].apiName);\n if (ontologyWritePath) {\n fs.writeFileSync(ontologyWritePath, JSON.stringify(ontology, null, 2));\n }\n return await generateClientSdk(ontology, args);\n } catch (e) {\n consola.error(\"Failed to generate the ontology\", e);\n return false;\n }\n}\nasync function generateClientSdk(ontology, args) {\n const minimalFs = createNormalFs();\n try {\n if (args.clean) {\n consola.info(\"Cleaning output directory\", args.outDir);\n await fs.promises.rm(args.outDir, {\n recursive: true,\n force: true\n });\n }\n if (!args.asPackage) {\n await generateSourceFiles(args, ontology, createNormalFs());\n return true;\n }\n const packageName = args.packageName;\n if (!packageName) throw new Error(\"Package name is require\");\n const version = args.version;\n for (const packageType of [\"module\", \"commonjs\"]) {\n const outDir = path.join(args.outDir, \"dist\", packageType);\n await generateSourceFiles({\n ...args,\n outDir,\n packageType\n }, ontology, minimalFs);\n await fs.promises.mkdir(outDir, {\n recursive: true\n });\n await writeJson(path.join(outDir, \"package.json\"), {\n type: packageType\n });\n await writeJson(path.join(outDir, `tsconfig.json`), {\n compilerOptions: getTsCompilerOptions(packageType)\n });\n }\n await writeJson(path.join(args.outDir, \"package.json\"), await getPackageJsonContents(packageName, version, args.beta ? 2 : 1));\n await fs.promises.mkdir(path.join(args.outDir, \"ontology\"), {\n recursive: true\n });\n await fs.promises.writeFile(path.join(args.outDir, \"ontology/objects.js\"), `module.exports = require(\"../../dist/module/ontology/objects\")`);\n await fs.promises.writeFile(path.join(args.outDir, \"ontology/objects.d.ts\"), `export * from \"../dist/module/ontology/objects\"`);\n return true;\n } catch (e) {\n consola.error(\"OSDK generation failed\", e.message, e.stack);\n return false;\n }\n}\nfunction getTsCompilerOptions(packageType) {\n const commonTsconfig = {\n importHelpers: true,\n declaration: true,\n isolatedModules: true,\n esModuleInterop: true,\n forceConsistentCasingInFileNames: true,\n strict: true,\n skipLibCheck: true\n };\n const compilerOptions = packageType === \"commonjs\" ? {\n ...commonTsconfig,\n module: \"commonjs\",\n target: \"es2018\"\n } : {\n ...commonTsconfig,\n module: \"NodeNext\",\n target: \"ES2020\"\n };\n return compilerOptions;\n}\nasync function getPackageJsonContents(name, version, sdkVersion) {\n const ourPackageJsonPath = await getOurPackageJsonPath();\n const ourPackageJson = JSON.parse(await fs.promises.readFile(ourPackageJsonPath, \"utf-8\"));\n const esmPrefix = \"./dist/module\";\n const commonjsPrefix = \"./dist/commonjs\";\n return {\n name,\n version,\n main: `${commonjsPrefix}/index.js`,\n module: `${esmPrefix}/index.js`,\n exports: {\n \".\": {\n import: `${esmPrefix}/index.js`,\n require: `${commonjsPrefix}/index.js`\n },\n \"./ontology/objects\": {\n import: `${esmPrefix}/ontology/objects${sdkVersion === 2 ? \"\" : \"/index\"}.js`,\n require: `${commonjsPrefix}/ontology/objects${sdkVersion === 2 ? \"\" : \"/index\"}.js`\n }\n },\n scripts: {\n prepack: `tsc -p ${esmPrefix}/tsconfig.json && tsc -p ${commonjsPrefix}/tsconfig.json`,\n check: \"npm exec attw $(npm pack)\"\n },\n devDependencies: {\n \"typescript\": ourPackageJson.devDependencies.typescript,\n \"tslib\": ourPackageJson.dependencies.tslib,\n \"@arethetypeswrong/cli\": ourPackageJson.dependencies[\"@arethetypeswrong/cli\"],\n \"@osdk/api\": `^${\"1.6.0\"}`,\n ...(sdkVersion === 2 ? {\n \"@osdk/client\": `^${\"0.15.0\"}`\n } : {\n \"@osdk/legacy-client\": `^${\"2.1.0\"}`\n })\n },\n peerDependencies: {\n \"@osdk/api\": `^${\"1.6.0\"}`,\n ...(sdkVersion === 2 ? {\n \"@osdk/client\": `^${\"0.15.0\"}`\n } : {\n \"@osdk/legacy-client\": `^${\"2.1.0\"}`\n })\n },\n files: [\"**/*.js\", \"**/*.d.ts\", \"dist/**/package.json\"]\n };\n}\nvar cachedOurPackageJsonPath;\nasync function getOurPackageJsonPath() {\n if (cachedOurPackageJsonPath) return cachedOurPackageJsonPath;\n const __dir = path.dirname(fileURLToPath(import.meta.url));\n const ourPackageJsonPath = await findUp(\"package.json\", {\n cwd: __dir\n });\n if (!ourPackageJsonPath) {\n throw new Error(\"Could not find our package.json\");\n }\n return cachedOurPackageJsonPath = ourPackageJsonPath;\n}\nasync function generateSourceFiles(args, ontology, fs2) {\n await (args.beta ? generateClientSdkVersionTwoPointZero : generateClientSdkVersionOneDotOne)(ontology, getUserAgent(args.version), fs2, args.outDir, args.packageType);\n}\nfunction getUserAgent(version) {\n if (version === \"dev\") {\n return \"typescript-sdk/dev osdk-cli/dev\";\n } else {\n return `typescript-sdk/${version} ${USER_AGENT}`;\n }\n}\nfunction createNormalFs() {\n return {\n writeFile: (path2, contents) => {\n return fs.promises.writeFile(path2, contents, \"utf-8\");\n },\n mkdir: async (path2, options) => {\n await fs.promises.mkdir(path2, options);\n },\n readdir: async path2 => fs.promises.readdir(path2)\n };\n}\nasync function writeJson(filePath, body) {\n consola.info(`Writing ${filePath}`);\n consola.debug(`Writing ${filePath} with body`, body);\n return await fs.promises.writeFile(filePath, JSON.stringify(body, void 0, 2) + \"\\n\");\n}\nexport { getPackageJsonContents, handleGenerate };"]}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/commands/site/deploy/siteDeployCommand.mts","../../src/util/autoVersion.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;AA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\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 { artifacts, ArtifactsSitesAdminV2Service, createConjureContext, createInternalClientContext, thirdPartyApplicationService } from \"#net\";\nimport { ExitProcessError } from \"@osdk/cli.common\";\nimport archiver from \"archiver\";\nimport { colorize } from \"consola/utils\";\nimport * as fs from \"node:fs\";\nimport path from \"node:path\";\nimport { Readable } from \"node:stream\";\nimport { autoVersion as findAutoVersion } from \"../../../util/autoVersion.js\";\nimport { loadToken } from \"../../../util/token.js\";\nexport default async function siteDeployCommand({\n selectedVersion,\n application,\n foundryUrl,\n uploadOnly,\n directory,\n token,\n tokenFile\n}) {\n const loadedToken = await loadToken(token, tokenFile);\n const tokenProvider = () => loadedToken;\n const clientCtx = createInternalClientContext(foundryUrl, tokenProvider);\n const ctx = createConjureContext(foundryUrl, \"/artifacts/api\", tokenProvider);\n let siteVersion;\n if (typeof selectedVersion === \"string\") {\n siteVersion = selectedVersion;\n } else {\n siteVersion = await findAutoVersion(selectedVersion.tagPrefix);\n consola.info(`Auto version inferred next version to be: ${siteVersion}`);\n }\n consola.debug(`Using directory for site files: \"${path.resolve(directory)}`);\n const stat = await fs.promises.stat(directory);\n if (!stat.isDirectory()) {\n throw new ExitProcessError(2, \"Specified path exists but is not a directory\");\n }\n consola.start(\"Zipping site files\");\n const archive = archiver(\"zip\").directory(directory, false);\n logArchiveStats(archive);\n consola.start(\"Uploading site files\");\n await Promise.all([artifacts.SiteAssetArtifactsService.uploadZippedSiteAsset(clientCtx, {\n application,\n version: siteVersion,\n zipFile: Readable.toWeb(archive) // This cast is because the dom fetch doesnt align type wise with streams\n }), archive.finalize()]);\n consola.success(\"Upload complete\");\n const repositoryRid = await thirdPartyApplicationService.fetchWebsiteRepositoryRid(clientCtx, application);\n const registeredSiteDomains = await ArtifactsSitesAdminV2Service.getRegisteredSiteDomains(ctx, repositoryRid);\n const domain = getFirstSiteDomain(registeredSiteDomains);\n if (!uploadOnly) {\n await ArtifactsSitesAdminV2Service.updateDeployedVersion(ctx, repositoryRid, {\n siteVersion: {\n version: siteVersion\n }\n });\n consola.success(`Deployed ${siteVersion} successfully`);\n if (domain != null) {\n logSiteLink(\"View live site:\", `https://${domain}`);\n }\n } else {\n consola.debug(\"Upload only mode enabled, skipping deployment\");\n if (domain != null) {\n logSiteLink(\"Preview link:\", `https://${domain}/.system/preview?previewVersion=${siteVersion}`);\n }\n }\n}\nfunction logArchiveStats(archive) {\n let archiveStats = {\n fileCount: 0,\n bytes: 0\n };\n archive.on(\"progress\", progress => {\n archiveStats = {\n fileCount: progress.entries.total,\n bytes: progress.fs.totalBytes\n };\n });\n archive.on(\"finish\", () => {\n consola.debug(`Zipped ${archiveStats.fileCount} files and ${archiveStats.bytes} bytes`);\n });\n}\nfunction logSiteLink(title, link) {\n consola.box({\n message: `${title}\\n\\n${colorize(\"green\", link)}`,\n style: {\n padding: 2,\n borderColor: \"green\",\n borderStyle: \"rounded\"\n }\n });\n}\nfunction getFirstSiteDomain(domains) {\n if (domains.length === 0) {\n consola.warn(\"No registered domains for site found\");\n return undefined;\n }\n switch (domains[0].type) {\n case \"controlPanelManaged\":\n return domains[0].controlPanelManaged.siteDomain.domain;\n default:\n const _ = domains[0].type;\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 { ExitProcessError, isValidSemver } from \"@osdk/cli.common\";\nimport { exec } from \"node:child_process\";\nimport { promisify } from \"node:util\";\n\n/**\n * Gets the version string using git describe. If the @param tagPrefix is empty, git describe will return the\n * latest tag (without any filtering) and if the tag starts with \"v\", it will be removed.\n * @param tagPrefix The prefix to use for matching against tags. Defaults to an empty string.\n * @returns A promise that resolves to the version string.\n * @throws An error if the version string is not SemVer compliant or if the version cannot be determined.\n */\nexport async function autoVersion(tagPrefix = \"\") {\n const [matchPrefix, prefixRegex] = tagPrefix !== \"\" ? [tagPrefix, new RegExp(`^${tagPrefix}`)] : [undefined, new RegExp(`^v?`)];\n const gitVersion = await gitDescribe(matchPrefix);\n const version = gitVersion.trim().replace(prefixRegex, \"\");\n if (!isValidSemver(version)) {\n throw new ExitProcessError(2, `The version string ${version} is not SemVer compliant.`);\n }\n return version;\n}\nasync function gitDescribe(matchPrefix) {\n let gitVersion;\n try {\n const execAsync = promisify(exec);\n const {\n stdout\n } = await execAsync(`git describe --tags --first-parent --dirty${matchPrefix != null ? ` --match=\"${matchPrefix}*\"` : \"\"}`, {\n encoding: \"utf8\"\n });\n gitVersion = stdout;\n } catch (error) {\n if (error instanceof Error) {\n const errorMessage = error.message.toLowerCase();\n if (errorMessage.includes(\"not recognized\") || errorMessage.includes(\"command not found\") || errorMessage.includes(\"no such file or directory\")) {\n throw new ExitProcessError(2, \"Unable to determine auto version using git-describe as git is not installed or found in the PATH.\", `You can set up git and try again or supply a --version option to set the version manually`);\n }\n if (errorMessage.includes(\"fatal: not a git repository\")) {\n throw new ExitProcessError(2, `Unable to determine auto version using git-describe as the current directory is not a git repository.`, `You can run the command in a git repository and try again or supply a --version option to set the version manually`);\n }\n if (errorMessage.includes(\"fatal: no names found, cannot describe anything.\")) {\n throw new ExitProcessError(2, `Unable to determine auto version using git-describe as no matching tags were found.`, `You can create a tag matching the configured tag prefix and try again or supply a --version option to set the version manually`);\n }\n }\n throw new ExitProcessError(2, `Unable to determine auto version using git-describe: ${error}.`, `You can supply a --version option to set the version manually`);\n }\n return gitVersion;\n}"]}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/commands/site/deploy/siteDeployCommand.mts","../../src/util/autoVersion.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;AAgBA,SAAS,eAAe;AAGxB,OAAO,cAAc;AACrB,SAAS,gBAAgB;AACzB,YAAY,QAAQ;AACpB,OAAO,UAAU;AACjB,SAAS,gBAAgB;;;ACNzB,SAAS,YAAY;AACrB,SAAS,iBAAiB;AAS1B,eAAsB,YAAY,YAAY,IAAI;AAChD,QAAM,CAAC,aAAa,WAAW,IAAI,cAAc,KAAK,CAAC,WAAW,IAAI,OAAO,IAAI,SAAS,EAAE,CAAC,IAAI,CAAC,QAAW,IAAI,OAAO,KAAK,CAAC;AAC9H,QAAM,aAAa,MAAM,YAAY,WAAW;AAChD,QAAM,UAAU,WAAW,KAAK,EAAE,QAAQ,aAAa,EAAE;AACzD,MAAI,CAAC,cAAc,OAAO,GAAG;AAC3B,UAAM,IAAI,iBAAiB,GAAG,sBAAsB,OAAO,2BAA2B;AAAA,EACxF;AACA,SAAO;AACT;AACA,eAAe,YAAY,aAAa;AACtC,MAAI;AACJ,MAAI;AACF,UAAM,YAAY,UAAU,IAAI;AAChC,UAAM;AAAA,MACJ;AAAA,IACF,IAAI,MAAM,UAAU,6CAA6C,eAAe,OAAO,aAAa,WAAW,OAAO,EAAE,IAAI;AAAA,MAC1H,UAAU;AAAA,IACZ,CAAC;AACD,iBAAa;AAAA,EACf,SAAS,OAAO;AACd,QAAI,iBAAiB,OAAO;AAC1B,YAAM,eAAe,MAAM,QAAQ,YAAY;AAC/C,UAAI,aAAa,SAAS,gBAAgB,KAAK,aAAa,SAAS,mBAAmB,KAAK,aAAa,SAAS,2BAA2B,GAAG;AAC/I,cAAM,IAAI,iBAAiB,GAAG,qG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K,sCAAsC;AACnD,WAAO;AAAA,EACT;AACA,UAAQ,QAAQ,CAAC,EAAE,MAAM;AAAA,IACvB,KAAK;AACH,aAAO,QAAQ,CAAC,EAAE,oBAAoB,WAAW;AAAA,IACnD;AACE,YAAM,IAAI,QAAQ,CAAC,EAAE;AAAA,EACzB;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\";\nimport { artifacts, ArtifactsSitesAdminV2Service, createConjureContext, createInternalClientContext, thirdPartyApplicationService } from \"#net\";\nimport { ExitProcessError } from \"@osdk/cli.common\";\nimport archiver from \"archiver\";\nimport { colorize } from \"consola/utils\";\nimport * as fs from \"node:fs\";\nimport path from \"node:path\";\nimport { Readable } from \"node:stream\";\nimport { autoVersion as findAutoVersion } from \"../../../util/autoVersion.js\";\nimport { loadToken } from \"../../../util/token.js\";\nexport default async function siteDeployCommand({\n selectedVersion,\n application,\n foundryUrl,\n uploadOnly,\n directory,\n token,\n tokenFile\n}) {\n const loadedToken = await loadToken(token, tokenFile);\n const tokenProvider = () => loadedToken;\n const clientCtx = createInternalClientContext(foundryUrl, tokenProvider);\n const ctx = createConjureContext(foundryUrl, \"/artifacts/api\", tokenProvider);\n let siteVersion;\n if (typeof selectedVersion === \"string\") {\n siteVersion = selectedVersion;\n } else {\n siteVersion = await findAutoVersion(selectedVersion.tagPrefix);\n consola.info(`Auto version inferred next version to be: ${siteVersion}`);\n }\n consola.debug(`Using directory for site files: \"${path.resolve(directory)}`);\n const stat = await fs.promises.stat(directory);\n if (!stat.isDirectory()) {\n throw new ExitProcessError(2, \"Specified path exists but is not a directory\");\n }\n consola.start(\"Zipping site files\");\n const archive = archiver(\"zip\").directory(directory, false);\n logArchiveStats(archive);\n consola.start(\"Uploading site files\");\n await Promise.all([artifacts.SiteAssetArtifactsService.uploadZippedSiteAsset(clientCtx, {\n application,\n version: siteVersion,\n zipFile: Readable.toWeb(archive) // This cast is because the dom fetch doesnt align type wise with streams\n }), archive.finalize()]);\n consola.success(\"Upload complete\");\n const repositoryRid = await thirdPartyApplicationService.fetchWebsiteRepositoryRid(clientCtx, application);\n const registeredSiteDomains = await ArtifactsSitesAdminV2Service.getRegisteredSiteDomains(ctx, repositoryRid);\n const domain = getFirstSiteDomain(registeredSiteDomains);\n if (!uploadOnly) {\n await ArtifactsSitesAdminV2Service.updateDeployedVersion(ctx, repositoryRid, {\n siteVersion: {\n version: siteVersion\n }\n });\n consola.success(`Deployed ${siteVersion} successfully`);\n if (domain != null) {\n logSiteLink(\"View live site:\", `https://${domain}`);\n }\n } else {\n consola.debug(\"Upload only mode enabled, skipping deployment\");\n if (domain != null) {\n logSiteLink(\"Preview link:\", `https://${domain}/.system/preview?previewVersion=${siteVersion}`);\n }\n }\n}\nfunction logArchiveStats(archive) {\n let archiveStats = {\n fileCount: 0,\n bytes: 0\n };\n archive.on(\"progress\", progress => {\n archiveStats = {\n fileCount: progress.entries.total,\n bytes: progress.fs.totalBytes\n };\n });\n archive.on(\"finish\", () => {\n consola.debug(`Zipped ${archiveStats.fileCount} files and ${archiveStats.bytes} bytes`);\n });\n}\nfunction logSiteLink(title, link) {\n consola.box({\n message: `${title}\\n\\n${colorize(\"green\", link)}`,\n style: {\n padding: 2,\n borderColor: \"green\",\n borderStyle: \"rounded\"\n }\n });\n}\nfunction getFirstSiteDomain(domains) {\n if (domains.length === 0) {\n consola.warn(\"No registered domains for site found\");\n return undefined;\n }\n switch (domains[0].type) {\n case \"controlPanelManaged\":\n return domains[0].controlPanelManaged.siteDomain.domain;\n default:\n const _ = domains[0].type;\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 { ExitProcessError, isValidSemver } from \"@osdk/cli.common\";\nimport { exec } from \"node:child_process\";\nimport { promisify } from \"node:util\";\n\n/**\n * Gets the version string using git describe. If the @param tagPrefix is empty, git describe will return the\n * latest tag (without any filtering) and if the tag starts with \"v\", it will be removed.\n * @param tagPrefix The prefix to use for matching against tags. Defaults to an empty string.\n * @returns A promise that resolves to the version string.\n * @throws An error if the version string is not SemVer compliant or if the version cannot be determined.\n */\nexport async function autoVersion(tagPrefix = \"\") {\n const [matchPrefix, prefixRegex] = tagPrefix !== \"\" ? [tagPrefix, new RegExp(`^${tagPrefix}`)] : [undefined, new RegExp(`^v?`)];\n const gitVersion = await gitDescribe(matchPrefix);\n const version = gitVersion.trim().replace(prefixRegex, \"\");\n if (!isValidSemver(version)) {\n throw new ExitProcessError(2, `The version string ${version} is not SemVer compliant.`);\n }\n return version;\n}\nasync function gitDescribe(matchPrefix) {\n let gitVersion;\n try {\n const execAsync = promisify(exec);\n const {\n stdout\n } = await execAsync(`git describe --tags --first-parent --dirty${matchPrefix != null ? ` --match=\"${matchPrefix}*\"` : \"\"}`, {\n encoding: \"utf8\"\n });\n gitVersion = stdout;\n } catch (error) {\n if (error instanceof Error) {\n const errorMessage = error.message.toLowerCase();\n if (errorMessage.includes(\"not recognized\") || errorMessage.includes(\"command not found\") || errorMessage.includes(\"no such file or directory\")) {\n throw new ExitProcessError(2, \"Unable to determine auto version using git-describe as git is not installed or found in the PATH.\", `You can set up git and try again or supply a --version option to set the version manually`);\n }\n if (errorMessage.includes(\"fatal: not a git repository\")) {\n throw new ExitProcessError(2, `Unable to determine auto version using git-describe as the current directory is not a git repository.`, `You can run the command in a git repository and try again or supply a --version option to set the version manually`);\n }\n if (errorMessage.includes(\"fatal: no names found, cannot describe anything.\")) {\n throw new ExitProcessError(2, `Unable to determine auto version using git-describe as no matching tags were found.`, `You can create a tag matching the configured tag prefix and try again or supply a --version option to set the version manually`);\n }\n }\n throw new ExitProcessError(2, `Unable to determine auto version using git-describe: ${error}.`, `You can supply a --version option to set the version manually`);\n }\n return gitVersion;\n}"]}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/commands/site/version/delete/versionDeleteCommand.mts"],"names":[],"mappings":";;;;;;;;;;;;AAiBA,SAAS,eAAe;AACxB,SAAS,gBAAgB;AAGzB,eAAO,qBAA4C;AAAA,EACjD;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AACF,GAAG;AACD,MAAI,CAAC,KAAK;AACR,UAAM,YAAY,MAAM,QAAQ,OAAO,+CAA+C,OAAO;AAAA,EAAM,SAAS,QAAQ,+BAA+B,CAAC,IAAI;AAAA,MACtJ,MAAM;AAAA,IACR,CAAC;AACD,uBAAmB,SAAS;AAAA,EAC9B;AACA,UAAQ,MAAM,oBAAoB,OAAO,EAAE;AAC3C,QAAM,cAAc,MAAM,UAAU,OAAO,SAAS;AACpD,QAAM,gBAAgB,MAAM;AAC5B,QAAM,YAAY,4BAA4B,YAAY,aAAa;AACvE,QAAM,kBAAU,0BAA0B,kBAAkB,WAAW;AAAA,IACrE;AAAA,IACA;AAAA,EACF,CAAC;AACD,UAAQ,QAAQ,mBAAmB,OAAO,EAAE;AAC9C","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, createInternalClientContext } from \"#net\";\nimport { consola } from \"consola\";\nimport { colorize } from \"consola/utils\";\nimport { handlePromptCancel } from \"../../../../consola/handlePromptCancel.js\";\nimport { loadToken } from \"../../../../util/token.js\";\nexport default async function versionDeleteCommand({\n version,\n yes,\n application,\n foundryUrl,\n token,\n tokenFile\n}) {\n if (!yes) {\n const confirmed = await consola.prompt(`Are you sure you want to delete the version ${version}?\\n${colorize(\"bold\", \"This action cannot be undone.\")}`, {\n type: \"confirm\"\n });\n handlePromptCancel(confirmed);\n }\n consola.start(`Deleting version ${version}`);\n const loadedToken = await loadToken(token, tokenFile);\n const tokenProvider = () => loadedToken;\n const clientCtx = createInternalClientContext(foundryUrl, tokenProvider);\n await artifacts.SiteAssetArtifactsService.deleteSiteVersion(clientCtx, {\n application,\n version\n });\n consola.success(`Deleted version ${version}`);\n}"]}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/commands/site/version/delete/versionDeleteCommand.mts"],"names":[],"mappings":";;;;;;;;;;;;AAiBA,SAAS,eAAe;AACxB,SAAS,gBAAgB;AAGzB,eAAO,qBAA4C;AAAA,EACjD;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AACF,GAAG;AACD,MAAI,CAAC,KAAK;AACR,UAAM,YAAY,MAAM,QAAQ,OAAO,+CAA+C,OAAO;AAAA,EAAM,SAAS,QAAQ,+BAA+B,CAAC,IAAI;AAAA,MACtJ,MAAM;AAAA,IACR,CAAC;AACD,uBAAmB,SAAS;AAAA,EAC9B;AACA,UAAQ,MAAM,oBAAoB,OAAO,EAAE;AAC3C,QAAM,cAAc,MAAM,UAAU,OAAO,SAAS;AACpD,QAAM,gBAAgB,MAAM;AAC5B,QAAM,YAAY,4BAA4B,YAAY,aAAa;AACvE,QAAM,kBAAU,0BAA0B,kBAAkB,WAAW;AAAA,IACrE;AAAA,IACA;AAAA,EACF,CAAC;AACD,UAAQ,QAAQ,mBAAmB,OAAO,EAAE;AAC9C","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, createInternalClientContext } from \"#net\";\nimport { consola } from \"consola\";\nimport { colorize } from \"consola/utils\";\nimport { handlePromptCancel } from \"../../../../consola/handlePromptCancel.js\";\nimport { loadToken } from \"../../../../util/token.js\";\nexport default async function versionDeleteCommand({\n version,\n yes,\n application,\n foundryUrl,\n token,\n tokenFile\n}) {\n if (!yes) {\n const confirmed = await consola.prompt(`Are you sure you want to delete the version ${version}?\\n${colorize(\"bold\", \"This action cannot be undone.\")}`, {\n type: \"confirm\"\n });\n handlePromptCancel(confirmed);\n }\n consola.start(`Deleting version ${version}`);\n const loadedToken = await loadToken(token, tokenFile);\n const tokenProvider = () => loadedToken;\n const clientCtx = createInternalClientContext(foundryUrl, tokenProvider);\n await artifacts.SiteAssetArtifactsService.deleteSiteVersion(clientCtx, {\n application,\n version\n });\n consola.success(`Deleted version ${version}`);\n}"]}
|
|
@@ -1,30 +0,0 @@
|
|
|
1
|
-
'use strict';
|
|
2
|
-
|
|
3
|
-
var chunk2KJDB4YP_cjs = require('./chunk-2KJDB4YP.cjs');
|
|
4
|
-
require('./chunk-AX5HH3ZN.cjs');
|
|
5
|
-
require('./chunk-HQDDGVB7.cjs');
|
|
6
|
-
var consola = require('consola');
|
|
7
|
-
|
|
8
|
-
async function versionGetCommand({
|
|
9
|
-
foundryUrl,
|
|
10
|
-
application,
|
|
11
|
-
token,
|
|
12
|
-
tokenFile
|
|
13
|
-
}) {
|
|
14
|
-
const loadedToken = await chunk2KJDB4YP_cjs.loadToken(token, tokenFile);
|
|
15
|
-
const tokenProvider = () => loadedToken;
|
|
16
|
-
const clientCtx = chunk2KJDB4YP_cjs.createInternalClientContext(foundryUrl, tokenProvider);
|
|
17
|
-
consola.consola.start("Getting live version");
|
|
18
|
-
const repositoryRid = await chunk2KJDB4YP_cjs.third_party_application_service_exports.fetchWebsiteRepositoryRid(clientCtx, application);
|
|
19
|
-
const ctx = chunk2KJDB4YP_cjs.createConjureContext(foundryUrl, "/artifacts/api", tokenProvider);
|
|
20
|
-
const deployedVersion = await chunk2KJDB4YP_cjs.ArtifactsSitesAdminV2Service_exports.getDeployedVersion(ctx, repositoryRid);
|
|
21
|
-
if (!deployedVersion) {
|
|
22
|
-
consola.consola.info("No live site version set");
|
|
23
|
-
} else {
|
|
24
|
-
consola.consola.success(`Live site version is ${deployedVersion.version}`);
|
|
25
|
-
}
|
|
26
|
-
}
|
|
27
|
-
|
|
28
|
-
module.exports = versionGetCommand;
|
|
29
|
-
//# sourceMappingURL=out.js.map
|
|
30
|
-
//# sourceMappingURL=versionGetCommand-45C2JZC4.cjs.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/commands/site/version/get/versionGetCommand.mts"],"names":[],"mappings":";;;;;;;;;;;AAiBA,SAAS,eAAe;AAExB,eAAO,kBAAyC;AAAA,EAC9C;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,sBAAsB;AACpC,QAAM,gBAAgB,MAAM,wCAA6B,0BAA0B,WAAW,WAAW;AACzG,QAAM,MAAM,qBAAqB,YAAY,kBAAkB,aAAa;AAC5E,QAAM,kBAAkB,MAAM,qCAA6B,mBAAmB,KAAK,aAAa;AAChG,MAAI,CAAC,iBAAiB;AACpB,YAAQ,KAAK,0BAA0B;AAAA,EACzC,OAAO;AACL,YAAQ,QAAQ,wBAAwB,gBAAgB,OAAO,EAAE;AAAA,EACnE;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 { ArtifactsSitesAdminV2Service, createConjureContext, createInternalClientContext, thirdPartyApplicationService } from \"#net\";\nimport { consola } from \"consola\";\nimport { loadToken } from \"../../../../util/token.js\";\nexport default async function versionGetCommand({\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(\"Getting live version\");\n const repositoryRid = await thirdPartyApplicationService.fetchWebsiteRepositoryRid(clientCtx, application);\n const ctx = createConjureContext(foundryUrl, \"/artifacts/api\", tokenProvider);\n const deployedVersion = await ArtifactsSitesAdminV2Service.getDeployedVersion(ctx, repositoryRid);\n if (!deployedVersion) {\n consola.info(\"No live site version set\");\n } else {\n consola.success(`Live site version is ${deployedVersion.version}`);\n }\n}"]}
|
|
@@ -1,28 +0,0 @@
|
|
|
1
|
-
import { loadToken, createInternalClientContext, third_party_application_service_exports, createConjureContext, ArtifactsSitesAdminV2Service_exports } from './chunk-JTZ7GUB4.mjs';
|
|
2
|
-
import './chunk-MTJA6DOB.mjs';
|
|
3
|
-
import './chunk-E2SEJZTC.mjs';
|
|
4
|
-
import { consola } from 'consola';
|
|
5
|
-
|
|
6
|
-
async function versionGetCommand({
|
|
7
|
-
foundryUrl,
|
|
8
|
-
application,
|
|
9
|
-
token,
|
|
10
|
-
tokenFile
|
|
11
|
-
}) {
|
|
12
|
-
const loadedToken = await loadToken(token, tokenFile);
|
|
13
|
-
const tokenProvider = () => loadedToken;
|
|
14
|
-
const clientCtx = createInternalClientContext(foundryUrl, tokenProvider);
|
|
15
|
-
consola.start("Getting live version");
|
|
16
|
-
const repositoryRid = await third_party_application_service_exports.fetchWebsiteRepositoryRid(clientCtx, application);
|
|
17
|
-
const ctx = createConjureContext(foundryUrl, "/artifacts/api", tokenProvider);
|
|
18
|
-
const deployedVersion = await ArtifactsSitesAdminV2Service_exports.getDeployedVersion(ctx, repositoryRid);
|
|
19
|
-
if (!deployedVersion) {
|
|
20
|
-
consola.info("No live site version set");
|
|
21
|
-
} else {
|
|
22
|
-
consola.success(`Live site version is ${deployedVersion.version}`);
|
|
23
|
-
}
|
|
24
|
-
}
|
|
25
|
-
|
|
26
|
-
export { versionGetCommand as default };
|
|
27
|
-
//# sourceMappingURL=out.js.map
|
|
28
|
-
//# sourceMappingURL=versionGetCommand-AKPCEBQZ.mjs.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/commands/site/version/get/versionGetCommand.mts"],"names":[],"mappings":";;;;;;;;;;;AAiBA,SAAS,eAAe;AAExB,eAAO,kBAAyC;AAAA,EAC9C;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,sBAAsB;AACpC,QAAM,gBAAgB,MAAM,wCAA6B,0BAA0B,WAAW,WAAW;AACzG,QAAM,MAAM,qBAAqB,YAAY,kBAAkB,aAAa;AAC5E,QAAM,kBAAkB,MAAM,qCAA6B,mBAAmB,KAAK,aAAa;AAChG,MAAI,CAAC,iBAAiB;AACpB,YAAQ,KAAK,0BAA0B;AAAA,EACzC,OAAO;AACL,YAAQ,QAAQ,wBAAwB,gBAAgB,OAAO,EAAE;AAAA,EACnE;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 { ArtifactsSitesAdminV2Service, createConjureContext, createInternalClientContext, thirdPartyApplicationService } from \"#net\";\nimport { consola } from \"consola\";\nimport { loadToken } from \"../../../../util/token.js\";\nexport default async function versionGetCommand({\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(\"Getting live version\");\n const repositoryRid = await thirdPartyApplicationService.fetchWebsiteRepositoryRid(clientCtx, application);\n const ctx = createConjureContext(foundryUrl, \"/artifacts/api\", tokenProvider);\n const deployedVersion = await ArtifactsSitesAdminV2Service.getDeployedVersion(ctx, repositoryRid);\n if (!deployedVersion) {\n consola.info(\"No live site version set\");\n } else {\n consola.success(`Live site version is ${deployedVersion.version}`);\n }\n}"]}
|
|
@@ -1,36 +0,0 @@
|
|
|
1
|
-
'use strict';
|
|
2
|
-
|
|
3
|
-
var chunk2KJDB4YP_cjs = require('./chunk-2KJDB4YP.cjs');
|
|
4
|
-
require('./chunk-AX5HH3ZN.cjs');
|
|
5
|
-
require('./chunk-HQDDGVB7.cjs');
|
|
6
|
-
var consola = require('consola');
|
|
7
|
-
var utils = require('consola/utils');
|
|
8
|
-
|
|
9
|
-
async function versionListCommand({
|
|
10
|
-
foundryUrl,
|
|
11
|
-
application,
|
|
12
|
-
token,
|
|
13
|
-
tokenFile
|
|
14
|
-
}) {
|
|
15
|
-
const loadedToken = await chunk2KJDB4YP_cjs.loadToken(token, tokenFile);
|
|
16
|
-
const tokenProvider = () => loadedToken;
|
|
17
|
-
const clientCtx = chunk2KJDB4YP_cjs.createInternalClientContext(foundryUrl, tokenProvider);
|
|
18
|
-
consola.consola.start("Fetching versions & deployed version");
|
|
19
|
-
const repositoryRid = await chunk2KJDB4YP_cjs.third_party_application_service_exports.fetchWebsiteRepositoryRid(clientCtx, application);
|
|
20
|
-
const ctx = chunk2KJDB4YP_cjs.createConjureContext(foundryUrl, "/artifacts/api", tokenProvider);
|
|
21
|
-
const [versions, deployedVersion] = await Promise.all([chunk2KJDB4YP_cjs.artifacts_exports.SiteAssetArtifactsService.fetchSiteVersions(clientCtx, application), chunk2KJDB4YP_cjs.ArtifactsSitesAdminV2Service_exports.getDeployedVersion(ctx, repositoryRid)]);
|
|
22
|
-
if (versions.length === 0) {
|
|
23
|
-
consola.consola.info("No site versions found");
|
|
24
|
-
return;
|
|
25
|
-
}
|
|
26
|
-
consola.consola.success("Found versions:");
|
|
27
|
-
const semver = await import('semver');
|
|
28
|
-
const sortedVersions = semver.rsort(versions.filter((v) => semver.valid(v)));
|
|
29
|
-
for (const version of sortedVersions) {
|
|
30
|
-
consola.consola.log(` - ${version}${deployedVersion && version === deployedVersion.version ? utils.colorize("green", ` (deployed)`) : ""}`);
|
|
31
|
-
}
|
|
32
|
-
}
|
|
33
|
-
|
|
34
|
-
module.exports = versionListCommand;
|
|
35
|
-
//# sourceMappingURL=out.js.map
|
|
36
|
-
//# sourceMappingURL=versionListCommand-4TM6YYNJ.cjs.map
|