@osdk/cli 0.0.16 → 0.0.17
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +10 -0
- package/build/js/chunk-2DZBTS5E.cjs +129 -0
- package/build/js/chunk-2DZBTS5E.cjs.map +1 -0
- package/build/js/chunk-CIVC2ZV3.mjs +175 -0
- package/build/js/chunk-CIVC2ZV3.mjs.map +1 -0
- package/build/js/chunk-E2SEJZTC.mjs +9 -0
- package/build/js/chunk-GTNZA5UY.mjs +11 -0
- package/build/js/chunk-GTNZA5UY.mjs.map +1 -0
- package/build/js/chunk-HQDDGVB7.cjs +11 -0
- package/build/js/chunk-HYF3CTKZ.cjs +13 -0
- package/build/js/chunk-HYF3CTKZ.cjs.map +1 -0
- package/build/js/chunk-JFDXL5SV.mjs +122 -0
- package/build/js/chunk-JFDXL5SV.mjs.map +1 -0
- package/build/js/chunk-VZM34PGO.cjs +180 -0
- package/build/js/chunk-VZM34PGO.cjs.map +1 -0
- package/build/js/handleGenerate-ER4YF43Z.mjs +89 -0
- package/build/js/handleGenerate-ER4YF43Z.mjs.map +1 -0
- package/build/js/handleGenerate-UTCLNZQO.cjs +111 -0
- package/build/js/handleGenerate-UTCLNZQO.cjs.map +1 -0
- package/build/js/handleSiteDeploy-7E5BNDQO.cjs +30 -0
- package/build/js/handleSiteDeploy-7E5BNDQO.cjs.map +1 -0
- package/build/js/handleSiteDeploy-ZFWLLEFU.mjs +28 -0
- package/build/js/handleSiteDeploy-ZFWLLEFU.mjs.map +1 -0
- package/build/js/index.cjs +290 -23
- package/build/js/index.cjs.map +1 -1
- package/build/js/index.mjs +273 -6
- package/build/js/index.mjs.map +1 -1
- package/build/js/loginFlow-BZDDHHT5.cjs +10 -0
- package/build/js/loginFlow-KGLTXVZ6.mjs +4 -0
- package/build/js/siteDeleteCommand-FIB7KBAY.mjs +13 -0
- package/build/js/siteDeleteCommand-FIB7KBAY.mjs.map +1 -0
- package/build/js/siteDeleteCommand-UGHBNEC4.cjs +15 -0
- package/build/js/siteDeleteCommand-UGHBNEC4.cjs.map +1 -0
- package/build/js/siteUploadCommand-5VEJTNOQ.mjs +33 -0
- package/build/js/siteUploadCommand-5VEJTNOQ.mjs.map +1 -0
- package/build/js/siteUploadCommand-OEM2U44I.cjs +58 -0
- package/build/js/siteUploadCommand-OEM2U44I.cjs.map +1 -0
- package/build/js/siteVersionsCommand-HP4IUW56.cjs +29 -0
- package/build/js/siteVersionsCommand-HP4IUW56.cjs.map +1 -0
- package/build/js/siteVersionsCommand-X666N6ZP.mjs +27 -0
- package/build/js/siteVersionsCommand-X666N6ZP.mjs.map +1 -0
- package/build/types/commands/typescript/generate/TypescriptGenerateArgs.d.ts +1 -0
- package/package.json +4 -4
- package/build/js/chunk-MGT3UGXW.mjs +0 -5
- package/build/js/chunk-MGT3UGXW.mjs.map +0 -1
- package/build/js/chunk-TSZWWATC.mjs +0 -12
- package/build/js/chunk-TSZWWATC.mjs.map +0 -1
- package/build/js/chunk-UOKM237I.cjs +0 -17
- package/build/js/chunk-UOKM237I.cjs.map +0 -1
- package/build/js/chunk-V4QJCMF6.cjs +0 -7
- package/build/js/chunk-V4QJCMF6.cjs.map +0 -1
- package/build/js/chunk-X6QW63OH.cjs +0 -7
- package/build/js/chunk-XIJ2ZQRX.mjs +0 -5
- package/build/js/chunk-YHQGXNMB.mjs +0 -13
- package/build/js/chunk-YHQGXNMB.mjs.map +0 -1
- package/build/js/chunk-Z6SJPM6K.cjs +0 -20
- package/build/js/chunk-Z6SJPM6K.cjs.map +0 -1
- package/build/js/handleGenerate-4RFQDCQF.mjs +0 -13
- package/build/js/handleGenerate-4RFQDCQF.mjs.map +0 -1
- package/build/js/handleGenerate-6FGD7TOT.cjs +0 -35
- package/build/js/handleGenerate-6FGD7TOT.cjs.map +0 -1
- package/build/js/handleSiteDeploy-257ZNTYA.cjs +0 -12
- package/build/js/handleSiteDeploy-257ZNTYA.cjs.map +0 -1
- package/build/js/handleSiteDeploy-QCMJWAYI.mjs +0 -10
- package/build/js/handleSiteDeploy-QCMJWAYI.mjs.map +0 -1
- package/build/js/loginFlow-JIH374QN.mjs +0 -4
- package/build/js/loginFlow-MPM6J3CY.cjs +0 -10
- package/build/js/siteDeleteCommand-NY5W7NE3.cjs +0 -12
- package/build/js/siteDeleteCommand-NY5W7NE3.cjs.map +0 -1
- package/build/js/siteDeleteCommand-ZKHKGVVF.mjs +0 -10
- package/build/js/siteDeleteCommand-ZKHKGVVF.mjs.map +0 -1
- package/build/js/siteUploadCommand-OHSOCUL6.cjs +0 -38
- package/build/js/siteUploadCommand-OHSOCUL6.cjs.map +0 -1
- package/build/js/siteUploadCommand-PZEJVKRE.mjs +0 -13
- package/build/js/siteUploadCommand-PZEJVKRE.mjs.map +0 -1
- package/build/js/siteVersionsCommand-IE5QH56U.cjs +0 -13
- package/build/js/siteVersionsCommand-IE5QH56U.cjs.map +0 -1
- package/build/js/siteVersionsCommand-NVJD5BDH.mjs +0 -11
- package/build/js/siteVersionsCommand-NVJD5BDH.mjs.map +0 -1
- /package/build/js/{chunk-X6QW63OH.cjs.map → chunk-E2SEJZTC.mjs.map} +0 -0
- /package/build/js/{chunk-XIJ2ZQRX.mjs.map → chunk-HQDDGVB7.cjs.map} +0 -0
- /package/build/js/{loginFlow-JIH374QN.mjs.map → loginFlow-BZDDHHT5.cjs.map} +0 -0
- /package/build/js/{loginFlow-MPM6J3CY.cjs.map → loginFlow-KGLTXVZ6.mjs.map} +0 -0
|
@@ -0,0 +1,180 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
var chunkHYF3CTKZ_cjs = require('./chunk-HYF3CTKZ.cjs');
|
|
4
|
+
var chunkHQDDGVB7_cjs = require('./chunk-HQDDGVB7.cjs');
|
|
5
|
+
var conjureLite = require('conjure-lite');
|
|
6
|
+
var consola = require('consola');
|
|
7
|
+
var shared_net = require('@osdk/shared.net');
|
|
8
|
+
|
|
9
|
+
// src/generated/artifacts-sites/ArtifactsSitesAdminV2Service.ts
|
|
10
|
+
var ArtifactsSitesAdminV2Service_exports = {};
|
|
11
|
+
chunkHQDDGVB7_cjs.__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 conjureLite.conjureFetch(ctx, `/sites/v2/admin/repository/${repositoryRid}/deployed-version`, "DELETE");
|
|
25
|
+
}
|
|
26
|
+
async function getContentSecurityPolicyAdditions(ctx, repositoryRid) {
|
|
27
|
+
return conjureLite.conjureFetch(ctx, `/sites/v2/admin/repository/${repositoryRid}/csp/additions`, "GET");
|
|
28
|
+
}
|
|
29
|
+
async function getDeployedVersion(ctx, repositoryRid) {
|
|
30
|
+
return conjureLite.conjureFetch(ctx, `/sites/v2/admin/repository/${repositoryRid}/deployed-version`, "GET");
|
|
31
|
+
}
|
|
32
|
+
async function getRegisteredSiteDomains(ctx, repositoryRid) {
|
|
33
|
+
return conjureLite.conjureFetch(ctx, `/sites/v2/admin/repository/${repositoryRid}/domains/registered`, "GET");
|
|
34
|
+
}
|
|
35
|
+
async function getRequestedSiteDomains(ctx, repositoryRid) {
|
|
36
|
+
return conjureLite.conjureFetch(ctx, `/sites/v2/admin/repository/${repositoryRid}/domains/requested`, "GET");
|
|
37
|
+
}
|
|
38
|
+
async function previewContentSecurityPolicy(ctx, repositoryRid, request) {
|
|
39
|
+
return conjureLite.conjureFetch(ctx, `/sites/v2/admin/repository/${repositoryRid}/csp/preview`, "POST", request);
|
|
40
|
+
}
|
|
41
|
+
async function putContentSecurityPolicyAdditions(ctx, repositoryRid, contentSecurityPolicyAdditions) {
|
|
42
|
+
return conjureLite.conjureFetch(ctx, `/sites/v2/admin/repository/${repositoryRid}/csp/additions`, "PUT", contentSecurityPolicyAdditions);
|
|
43
|
+
}
|
|
44
|
+
async function requestSiteDomainForRepository(ctx, repositoryRid, request) {
|
|
45
|
+
return conjureLite.conjureFetch(ctx, `/sites/v2/admin/repository/${repositoryRid}/domains/submit-registration`, "POST", request);
|
|
46
|
+
}
|
|
47
|
+
async function unregisterSiteDomain(ctx, repositoryRid, request) {
|
|
48
|
+
return conjureLite.conjureFetch(ctx, `/sites/v2/admin/repository/${repositoryRid}/domains/unregister`, "POST", request);
|
|
49
|
+
}
|
|
50
|
+
async function updateDeployedVersion(ctx, repositoryRid, version) {
|
|
51
|
+
return conjureLite.conjureFetch(ctx, `/sites/v2/admin/repository/${repositoryRid}/deployed-version`, "PUT", version);
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
// src/net/artifacts/index.mts
|
|
55
|
+
var artifacts_exports = {};
|
|
56
|
+
chunkHQDDGVB7_cjs.__export(artifacts_exports, {
|
|
57
|
+
SiteAssetArtifactsService: () => SiteAssetArtifactsService_exports
|
|
58
|
+
});
|
|
59
|
+
|
|
60
|
+
// src/net/artifacts/SiteAssetArtifactsService/index.mts
|
|
61
|
+
var SiteAssetArtifactsService_exports = {};
|
|
62
|
+
chunkHQDDGVB7_cjs.__export(SiteAssetArtifactsService_exports, {
|
|
63
|
+
deleteSiteVersion: () => deleteSiteVersion,
|
|
64
|
+
fetchSiteVersions: () => fetchSiteVersions,
|
|
65
|
+
uploadZippedSiteAsset: () => uploadZippedSiteAsset
|
|
66
|
+
});
|
|
67
|
+
function createFetch(tokenProvider, fetchFn = fetch) {
|
|
68
|
+
return shared_net.createFetchHeaderMutator(createDebugLoggingFetch(fetchFn), async (headers) => {
|
|
69
|
+
const token = await tokenProvider();
|
|
70
|
+
headers.set("Authorization", `Bearer ${token}`);
|
|
71
|
+
headers.set("Fetch-User-Agent", "");
|
|
72
|
+
return headers;
|
|
73
|
+
});
|
|
74
|
+
}
|
|
75
|
+
function createDebugLoggingFetch(fetchFn = fetch) {
|
|
76
|
+
return function debugLoggingFetch(input, init) {
|
|
77
|
+
if (typeof input === "string" || input instanceof URL) {
|
|
78
|
+
consola.consola.debug(`${init?.method ?? "GET"}: ${input.toString().trim()}`);
|
|
79
|
+
} else {
|
|
80
|
+
consola.consola.debug(`${input.method ?? "GET"}: ${input.url.toString().trim()}`);
|
|
81
|
+
}
|
|
82
|
+
return fetchFn(input, init).then((a) => {
|
|
83
|
+
consola.consola.debug("Finished fetch");
|
|
84
|
+
return a;
|
|
85
|
+
});
|
|
86
|
+
};
|
|
87
|
+
}
|
|
88
|
+
async function fetchWebsiteRepositoryRid(baseUrl, thirdPartyAppRid) {
|
|
89
|
+
const fetch2 = createFetch(() => process.env.FOUNDRY_SDK_AUTH_TOKEN);
|
|
90
|
+
const url = `
|
|
91
|
+
${baseUrl}/third-party-application-service/api/application-websites/${thirdPartyAppRid}`;
|
|
92
|
+
const result = await fetch2(url);
|
|
93
|
+
if (result.status >= 200 && result.status < 300) {
|
|
94
|
+
const repositoryRid = await result.json();
|
|
95
|
+
consola.consola.debug(`Repository RID: ${repositoryRid}`);
|
|
96
|
+
return repositoryRid;
|
|
97
|
+
}
|
|
98
|
+
throw new Error(`Unexpected response code ${result.status} (${result.statusText})`);
|
|
99
|
+
}
|
|
100
|
+
|
|
101
|
+
// src/net/artifacts/SiteAssetArtifactsService/getSiteAssetBaseUrl.mts
|
|
102
|
+
function getSiteAssetBaseUrl(foundryBaseUrl, repositoryRid) {
|
|
103
|
+
return `${foundryBaseUrl}/artifacts/api/repositories/${repositoryRid}/contents/release/siteasset`;
|
|
104
|
+
}
|
|
105
|
+
|
|
106
|
+
// src/net/artifacts/SiteAssetArtifactsService/deleteSiteVersion.mts
|
|
107
|
+
async function deleteSiteVersion(baseUrl, thirdPartyAppRid, version) {
|
|
108
|
+
const repositoryRid = await fetchWebsiteRepositoryRid(baseUrl, thirdPartyAppRid);
|
|
109
|
+
const url = `${getSiteAssetBaseUrl(baseUrl, repositoryRid)}/versions/${version}`;
|
|
110
|
+
const fetch2 = createFetch(() => process.env.FOUNDRY_SDK_AUTH_TOKEN);
|
|
111
|
+
const result = await fetch2(url, {
|
|
112
|
+
method: "DELETE"
|
|
113
|
+
});
|
|
114
|
+
if (result.status >= 200 && result.status < 300) {
|
|
115
|
+
consola.consola.level = consola.LogLevels.debug;
|
|
116
|
+
consola.consola.debug(`${result.status} - Status Text: '${result.statusText}'`);
|
|
117
|
+
return true;
|
|
118
|
+
} else {
|
|
119
|
+
throw new chunkHYF3CTKZ_cjs.ExitProcessError(result.status, `Unexpected response code ${result.status} (${result.statusText})`);
|
|
120
|
+
}
|
|
121
|
+
}
|
|
122
|
+
|
|
123
|
+
// src/net/artifacts/SiteAssetArtifactsService/fetchSiteVersions.mts
|
|
124
|
+
async function fetchSiteVersions(baseUrl, thirdPartyAppRid) {
|
|
125
|
+
const repositoryRid = await fetchWebsiteRepositoryRid(baseUrl, thirdPartyAppRid);
|
|
126
|
+
const url = `${getSiteAssetBaseUrl(baseUrl, repositoryRid)}/versions`;
|
|
127
|
+
const fetch2 = createFetch(() => process.env.FOUNDRY_SDK_AUTH_TOKEN);
|
|
128
|
+
const result = await fetch2(url);
|
|
129
|
+
if (result.status === 200) {
|
|
130
|
+
const response = await result.json();
|
|
131
|
+
return response.versions;
|
|
132
|
+
} else {
|
|
133
|
+
throw new Error(`Unexpected response code ${result.status} (${result.statusText})`);
|
|
134
|
+
}
|
|
135
|
+
}
|
|
136
|
+
async function uploadZippedSiteAsset(baseUrl, thirdPartyAppRid, version, zipFile) {
|
|
137
|
+
const repositoryRid = await fetchWebsiteRepositoryRid(baseUrl, thirdPartyAppRid);
|
|
138
|
+
const url = `${getSiteAssetBaseUrl(baseUrl, repositoryRid)}/versions/zip/${version}`;
|
|
139
|
+
const fetch2 = createFetch(() => process.env.FOUNDRY_SDK_AUTH_TOKEN);
|
|
140
|
+
const result = await fetch2(url, {
|
|
141
|
+
method: "PUT",
|
|
142
|
+
body: zipFile,
|
|
143
|
+
headers: {
|
|
144
|
+
"Content-Type": "application/octet-stream"
|
|
145
|
+
},
|
|
146
|
+
duplex: "half"
|
|
147
|
+
// Node hates me
|
|
148
|
+
});
|
|
149
|
+
if (result.status >= 200 && result.status < 300) {
|
|
150
|
+
consola.consola.level = consola.LogLevels.debug;
|
|
151
|
+
consola.consola.debug("Status Text: " + result.statusText);
|
|
152
|
+
return true;
|
|
153
|
+
} else if (result.status === 409) {
|
|
154
|
+
throw new chunkHYF3CTKZ_cjs.ExitProcessError(result.status, "Version already exists");
|
|
155
|
+
} else {
|
|
156
|
+
throw new chunkHYF3CTKZ_cjs.ExitProcessError(result.status, `Unexpected response code ${result.status} (${result.statusText})`);
|
|
157
|
+
}
|
|
158
|
+
}
|
|
159
|
+
|
|
160
|
+
// src/net/createConjureContext.mts
|
|
161
|
+
function createConjureContext(baseUrl, servicePath) {
|
|
162
|
+
return {
|
|
163
|
+
fetchFn: createFetch(() => process.env.FOUNDRY_SDK_AUTH_TOKEN),
|
|
164
|
+
baseUrl,
|
|
165
|
+
servicePath
|
|
166
|
+
};
|
|
167
|
+
}
|
|
168
|
+
|
|
169
|
+
// src/net/third-party-application-service/index.mts
|
|
170
|
+
var third_party_application_service_exports = {};
|
|
171
|
+
chunkHQDDGVB7_cjs.__export(third_party_application_service_exports, {
|
|
172
|
+
fetchWebsiteRepositoryRid: () => fetchWebsiteRepositoryRid
|
|
173
|
+
});
|
|
174
|
+
|
|
175
|
+
exports.ArtifactsSitesAdminV2Service_exports = ArtifactsSitesAdminV2Service_exports;
|
|
176
|
+
exports.artifacts_exports = artifacts_exports;
|
|
177
|
+
exports.createConjureContext = createConjureContext;
|
|
178
|
+
exports.third_party_application_service_exports = third_party_application_service_exports;
|
|
179
|
+
//# sourceMappingURL=out.js.map
|
|
180
|
+
//# sourceMappingURL=chunk-VZM34PGO.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../src/generated/artifacts-sites/ArtifactsSitesAdminV2Service.ts","../../src/generated/artifacts-sites/ArtifactsSitesAdminV2Service/clearDeployedVersion.ts","../../src/generated/artifacts-sites/ArtifactsSitesAdminV2Service/getContentSecurityPolicyAdditions.ts","../../src/generated/artifacts-sites/ArtifactsSitesAdminV2Service/getDeployedVersion.ts","../../src/generated/artifacts-sites/ArtifactsSitesAdminV2Service/getRegisteredSiteDomains.ts","../../src/generated/artifacts-sites/ArtifactsSitesAdminV2Service/getRequestedSiteDomains.ts","../../src/generated/artifacts-sites/ArtifactsSitesAdminV2Service/previewContentSecurityPolicy.ts","../../src/generated/artifacts-sites/ArtifactsSitesAdminV2Service/putContentSecurityPolicyAdditions.ts","../../src/generated/artifacts-sites/ArtifactsSitesAdminV2Service/requestSiteDomainForRepository.ts","../../src/generated/artifacts-sites/ArtifactsSitesAdminV2Service/unregisterSiteDomain.ts","../../src/generated/artifacts-sites/ArtifactsSitesAdminV2Service/updateDeployedVersion.ts","../../src/generated/artifacts-sites/ArtifactsSitesAdminService/deleteSiteDeployment.ts","../../src/generated/artifacts-sites/ArtifactsSitesAdminService/deploySite.ts","../../src/generated/artifacts-sites/ArtifactsSitesAdminService/getDeployedVersion.ts","../../src/generated/artifacts-sites/SitesDomainRegistryService/getRegisteredDomains.ts","../../src/net/artifacts/index.mts","../../src/net/artifacts/SiteAssetArtifactsService/index.mts","../../src/net/artifacts/SiteAssetArtifactsService/deleteSiteVersion.mts","../../src/net/createFetch.mts","../../src/net/third-party-application-service/fetchWebsiteRepositoryRid.mts","../../src/net/artifacts/SiteAssetArtifactsService/getSiteAssetBaseUrl.mts","../../src/net/artifacts/SiteAssetArtifactsService/fetchSiteVersions.mts","../../src/net/artifacts/SiteAssetArtifactsService/uploadSiteVersion.mts","../../src/net/createConjureContext.mts","../../src/net/third-party-application-service/index.mts"],"names":["conjureFetch","consola","fetch","LogLevels"],"mappings":";;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;;;ACgBA,SAAS,oBAAoB;AAQ7B,eAAsB,qBAAqB,KAAK,eAAe;AAC7D,SAAO,aAAa,KAAK,8BAA8B,aAAa,qBAAqB,QAAQ;AACnG;;;ACVA,SAAS,gBAAAA,qBAAoB;AAM7B,eAAsB,kCAAkC,KAAK,eAAe;AAC1E,SAAOA,cAAa,KAAK,8BAA8B,aAAa,kBAAkB,KAAK;AAC7F;;;ACRA,SAAS,gBAAAA,qBAAoB;AAM7B,eAAsB,mBAAmB,KAAK,eAAe;AAC3D,SAAOA,cAAa,KAAK,8BAA8B,aAAa,qBAAqB,KAAK;AAChG;;;ACRA,SAAS,gBAAAA,qBAAoB;AAO7B,eAAsB,yBAAyB,KAAK,eAAe;AACjE,SAAOA,cAAa,KAAK,8BAA8B,aAAa,uBAAuB,KAAK;AAClG;;;ACTA,SAAS,gBAAAA,qBAAoB;AAQ7B,eAAsB,wBAAwB,KAAK,eAAe;AAChE,SAAOA,cAAa,KAAK,8BAA8B,aAAa,sBAAsB,KAAK;AACjG;;;ACVA,SAAS,gBAAAA,qBAAoB;AAM7B,eAAsB,6BAA6B,KAAK,eAAe,SAAS;AAC9E,SAAOA,cAAa,KAAK,8BAA8B,aAAa,gBAAgB,QAAQ,OAAO;AACrG;;;ACRA,SAAS,gBAAAA,qBAAoB;AAM7B,eAAsB,kCAAkC,KAAK,eAAe,gCAAgC;AAC1G,SAAOA,cAAa,KAAK,8BAA8B,aAAa,kBAAkB,OAAO,8BAA8B;AAC7H;;;ACRA,SAAS,gBA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IACL,SAAS,YAAY,MAAM,QAAQ,IAAI,sBAAsB;AAAA,IAC7D;AAAA,IACA;AAAA,EACF;AACF;;;ACvBA;AAAA;AAAA;AAAA","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\nimport { conjureFetch } from \"conjure-lite\";\nexport async function deleteSiteDeployment(ctx, repositoryRid) {\n return conjureFetch(ctx, `/sites/admin/${repositoryRid}`, \"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\";\nexport async function deploySite(ctx, deploySiteRequest) {\n return conjureFetch(ctx, `/sites/admin/deploy`, \"POST\", deploySiteRequest);\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\";\nexport async function getDeployedVersion(ctx, repositoryRid) {\n return conjureFetch(ctx, `/sites/admin/${repositoryRid}/deployedVersion`, \"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/**\n * Get all registered domains regardless of whether they're in use or not.\n */\nexport async function getRegisteredDomains(ctx) {\n return conjureFetch(ctx, `/sites/configRegisteredDomains/list`, \"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\nexport * as SiteAssetArtifactsService from \"./SiteAssetArtifactsService/index.mjs\";","/*\n * Copyright 2023 Palantir Technologies, Inc. All rights reserved.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nexport { deleteSiteVersion } from \"./deleteSiteVersion.mjs\";\nexport { fetchSiteVersions } from \"./fetchSiteVersions.mjs\";\nexport { uploadZippedSiteAsset } from \"./uploadSiteVersion.mjs\";","/*\n * Copyright 2023 Palantir Technologies, Inc. All rights reserved.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport { consola, LogLevels } from \"consola\";\nimport { ExitProcessError } from \"../../../ExitProcessError.js\";\nimport { createFetch } from \"../../createFetch.mjs\";\nimport { fetchWebsiteRepositoryRid } from \"../../third-party-application-service/fetchWebsiteRepositoryRid.mjs\";\nimport { getSiteAssetBaseUrl } from \"./getSiteAssetBaseUrl.mjs\";\nexport async function deleteSiteVersion(baseUrl, thirdPartyAppRid, version) {\n const repositoryRid = await fetchWebsiteRepositoryRid(baseUrl, thirdPartyAppRid);\n const url = `${getSiteAssetBaseUrl(baseUrl, repositoryRid)}/versions/${version}`;\n const fetch = createFetch(() => process.env.FOUNDRY_SDK_AUTH_TOKEN);\n const result = await fetch(url, {\n method: \"DELETE\"\n });\n if (result.status >= 200 && result.status < 300) {\n consola.level = LogLevels.debug;\n consola.debug(`${result.status} - Status Text: '${result.statusText}'`);\n return true;\n } else {\n throw new ExitProcessError(result.status, `Unexpected response code ${result.status} (${result.statusText})`);\n }\n}","/*\n * Copyright 2023 Palantir Technologies, Inc. All rights reserved.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport { createFetchHeaderMutator } from \"@osdk/shared.net\";\nimport { consola } from \"consola\";\nexport function createFetch(tokenProvider, fetchFn = fetch) {\n return createFetchHeaderMutator(createDebugLoggingFetch(fetchFn), async headers => {\n const token = await tokenProvider();\n headers.set(\"Authorization\", `Bearer ${token}`);\n headers.set(\"Fetch-User-Agent\", \"\");\n return headers;\n });\n}\nfunction createDebugLoggingFetch(fetchFn = fetch) {\n return function debugLoggingFetch(input, init) {\n if (typeof input === \"string\" || input instanceof URL) {\n consola.debug(`${init?.method ?? \"GET\"}: ${input.toString().trim()}`);\n } else {\n consola.debug(`${input.method ?? \"GET\"}: ${input.url.toString().trim()}`);\n }\n return fetchFn(input, init).then(a => {\n consola.debug(\"Finished fetch\");\n return a;\n });\n };\n}","/*\n * Copyright 2023 Palantir Technologies, Inc. All rights reserved.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport { consola } from \"consola\";\nimport { createFetch } from \"../createFetch.mjs\";\nexport async function fetchWebsiteRepositoryRid(baseUrl, thirdPartyAppRid) {\n const fetch = createFetch(() => process.env.FOUNDRY_SDK_AUTH_TOKEN);\n const url = `\n ${baseUrl}/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 Error(`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 { createFetch } from \"../../createFetch.mjs\";\nimport { fetchWebsiteRepositoryRid } from \"../../third-party-application-service/fetchWebsiteRepositoryRid.mjs\";\nimport { getSiteAssetBaseUrl } from \"./getSiteAssetBaseUrl.mjs\";\nexport async function fetchSiteVersions(baseUrl, thirdPartyAppRid) {\n const repositoryRid = await fetchWebsiteRepositoryRid(baseUrl, thirdPartyAppRid);\n const url = `${getSiteAssetBaseUrl(baseUrl, repositoryRid)}/versions`;\n const fetch = createFetch(() => process.env.FOUNDRY_SDK_AUTH_TOKEN);\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 Error(`Unexpected response code ${result.status} (${result.statusText})`);\n }\n}","/*\n * Copyright 2023 Palantir Technologies, Inc. All rights reserved.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport { consola, LogLevels } from \"consola\";\nimport { ExitProcessError } from \"../../../ExitProcessError.js\";\nimport { createFetch } from \"../../createFetch.mjs\";\nimport { fetchWebsiteRepositoryRid } from \"../../third-party-application-service/fetchWebsiteRepositoryRid.mjs\";\nimport { getSiteAssetBaseUrl } from \"./getSiteAssetBaseUrl.mjs\";\nexport async function uploadZippedSiteAsset(baseUrl, thirdPartyAppRid, version, zipFile) {\n const repositoryRid = await fetchWebsiteRepositoryRid(baseUrl, thirdPartyAppRid);\n const url = `${getSiteAssetBaseUrl(baseUrl, repositoryRid)}/versions/zip/${version}`;\n const fetch = createFetch(() => process.env.FOUNDRY_SDK_AUTH_TOKEN);\n const result = await fetch(url, {\n method: \"PUT\",\n body: zipFile,\n headers: {\n \"Content-Type\": \"application/octet-stream\"\n },\n duplex: \"half\" // Node hates me\n });\n\n if (result.status >= 200 && result.status < 300) {\n consola.level = LogLevels.debug;\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(baseUrl, servicePath) {\n return {\n fetchFn: createFetch(() => process.env.FOUNDRY_SDK_AUTH_TOKEN),\n baseUrl,\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 { fetchWebsiteRepositoryRid } from \"./fetchWebsiteRepositoryRid.mjs\";"]}
|
|
@@ -0,0 +1,89 @@
|
|
|
1
|
+
import { invokeLoginFlow } from './chunk-JFDXL5SV.mjs';
|
|
2
|
+
import './chunk-E2SEJZTC.mjs';
|
|
3
|
+
import { listOntologiesV2, getOntologyFullMetadata } from '@osdk/gateway/requests';
|
|
4
|
+
import { generateClientSdkVersionTwoPointZero, generateClientSdkVersionOneDotOne } from '@osdk/generator';
|
|
5
|
+
import { createClientContext, createOpenApiRequest } from '@osdk/shared.net';
|
|
6
|
+
import { consola } from 'consola';
|
|
7
|
+
import * as fs from 'fs';
|
|
8
|
+
|
|
9
|
+
async function handleGenerate(args) {
|
|
10
|
+
let success = false;
|
|
11
|
+
if (args.ontologyPath) {
|
|
12
|
+
success = await generateFromLocalFile(args);
|
|
13
|
+
} else if (args.stack && args.clientId) {
|
|
14
|
+
success = await generateFromStack(args);
|
|
15
|
+
} else {
|
|
16
|
+
throw new Error("Must have specified ontologyPath or stack and clientId");
|
|
17
|
+
}
|
|
18
|
+
if (success) {
|
|
19
|
+
consola.info("OSDK Generated!");
|
|
20
|
+
}
|
|
21
|
+
}
|
|
22
|
+
async function generateFromLocalFile(args) {
|
|
23
|
+
if (!fs.existsSync(args.ontologyPath)) {
|
|
24
|
+
consola.error(`Ontology file does not exist: ${args.ontologyPath}`);
|
|
25
|
+
return false;
|
|
26
|
+
}
|
|
27
|
+
const ontology = JSON.parse(await fs.promises.readFile(args.ontologyPath, "utf-8"));
|
|
28
|
+
return await generateClientSdk(ontology, args);
|
|
29
|
+
}
|
|
30
|
+
async function generateFromStack(args) {
|
|
31
|
+
const {
|
|
32
|
+
stack,
|
|
33
|
+
clientId,
|
|
34
|
+
ontologyWritePath
|
|
35
|
+
} = args;
|
|
36
|
+
const token = await invokeLoginFlow({
|
|
37
|
+
applicationId: clientId,
|
|
38
|
+
baseUrl: stack,
|
|
39
|
+
verbose: 0
|
|
40
|
+
});
|
|
41
|
+
const {
|
|
42
|
+
fetch
|
|
43
|
+
} = createClientContext({
|
|
44
|
+
metadata: {
|
|
45
|
+
userAgent: "@osdk/cli/0.0.0 ()"
|
|
46
|
+
}
|
|
47
|
+
}, args.stack, () => token.access_token);
|
|
48
|
+
try {
|
|
49
|
+
const ontologies = await listOntologiesV2(createOpenApiRequest(stack, fetch));
|
|
50
|
+
if (ontologies.data.length !== 1) {
|
|
51
|
+
consola.error(`Could not look up ontology with these credentials. Found ${ontologies.data.length} ontologies.`);
|
|
52
|
+
return false;
|
|
53
|
+
}
|
|
54
|
+
const ontology = await getOntologyFullMetadata(createOpenApiRequest(stack, fetch), ontologies.data[0].apiName);
|
|
55
|
+
if (ontologyWritePath) {
|
|
56
|
+
fs.writeFileSync(ontologyWritePath, JSON.stringify(ontology, null, 2));
|
|
57
|
+
}
|
|
58
|
+
return await generateClientSdk(ontology, args);
|
|
59
|
+
} catch (e) {
|
|
60
|
+
consola.error("Failed to generate the ontology", e);
|
|
61
|
+
return false;
|
|
62
|
+
}
|
|
63
|
+
}
|
|
64
|
+
async function generateClientSdk(ontology, args) {
|
|
65
|
+
const minimalFs = {
|
|
66
|
+
writeFile: (path, contents) => {
|
|
67
|
+
return fs.promises.writeFile(path, contents, "utf-8");
|
|
68
|
+
},
|
|
69
|
+
mkdir: async (path, options) => {
|
|
70
|
+
await fs.promises.mkdir(path, options);
|
|
71
|
+
},
|
|
72
|
+
readdir: async (path) => fs.promises.readdir(path)
|
|
73
|
+
};
|
|
74
|
+
try {
|
|
75
|
+
if (args.beta) {
|
|
76
|
+
await generateClientSdkVersionTwoPointZero(ontology, minimalFs, args.outDir, args.packageType);
|
|
77
|
+
} else {
|
|
78
|
+
await generateClientSdkVersionOneDotOne(ontology, minimalFs, args.outDir, args.packageType);
|
|
79
|
+
}
|
|
80
|
+
} catch (e) {
|
|
81
|
+
consola.error("OSDK generation failed", e.message);
|
|
82
|
+
return false;
|
|
83
|
+
}
|
|
84
|
+
return true;
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
export { handleGenerate as default };
|
|
88
|
+
//# sourceMappingURL=out.js.map
|
|
89
|
+
//# sourceMappingURL=handleGenerate-ER4YF43Z.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../src/commands/typescript/generate/handleGenerate.mts"],"names":[],"mappings":";;;;;;AAgBA,SAAS,yBAAyB,wBAAwB;AAC1D,SAAS,mCAAmC,4CAA4C;AACxF,SAAS,qBAAqB,4BAA4B;AAC1D,SAAS,eAAe;AACxB,YAAY,QAAQ;AAEpB,eAAO,eAAsC,MAAM;AACjD,MAAI,UAAU;AACd,MAAI,KAAK,cAAc;AACrB,cAAU,MAAM,sBAAsB,IAAI;AAAA,EAC5C,WAAW,KAAK,SAAS,KAAK,UAAU;AACtC,cAAU,MAAM,kBAAkB,IAAI;AAAA,EACxC,OAAO;AACL,UAAM,IAAI,MAAM,wDAAwD;AAAA,EAC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aAAU,YAAS,UAAU,MAAM,UAAU,OAAO;AAAA,IACtD;AAAA,IACA,OAAO,OAAO,MAAM,YAAY;AAC9B,YAAS,YAAS,MAAM,MAAM,OAAO;AAAA,IACvC;AAAA,IACA,SAAS,OAAM,SAAW,YAAS,QAAQ,IAAI;AAAA,EACjD;AACA,MAAI;AACF,QAAI,KAAK,MAAM;AACb,YAAM,qCAAqC,UAAU,WAAW,KAAK,QAAQ,KAAK,WAAW;AAAA,IAC/F,OAAO;AACL,YAAM,kCAAkC,UAAU,WAAW,KAAK,QAAQ,KAAK,WAAW;AAAA,IAC5F;AAAA,EACF,SAAS,GAAG;AACV,YAAQ,MAAM,0BAA0B,EAAE,OAAO;AACjD,WAAO;AAAA,EACT;AACA,SAAO;AACT","sourcesContent":["/*\n * Copyright 2023 Palantir Technologies, Inc. All rights reserved.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport { getOntologyFullMetadata, listOntologiesV2 } from \"@osdk/gateway/requests\";\nimport { generateClientSdkVersionOneDotOne, generateClientSdkVersionTwoPointZero } from \"@osdk/generator\";\nimport { createClientContext, createOpenApiRequest } from \"@osdk/shared.net\";\nimport { consola } from \"consola\";\nimport * as fs from \"node:fs\";\nimport invokeLoginFlow from \"../../auth/login/loginFlow.js\";\nexport default async function handleGenerate(args) {\n let success = false;\n if (args.ontologyPath) {\n success = await generateFromLocalFile(args);\n } else if (args.stack && args.clientId) {\n success = await generateFromStack(args);\n } else {\n throw new Error(\"Must have specified ontologyPath or stack and clientId\");\n }\n if (success) {\n consola.info(\"OSDK Generated!\");\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 stack,\n clientId,\n ontologyWritePath\n } = args;\n const token = await invokeLoginFlow({\n applicationId: clientId,\n baseUrl: stack,\n verbose: 0\n });\n const {\n fetch\n } = createClientContext({\n metadata: {\n userAgent: \"@osdk/cli/0.0.0 ()\"\n }\n }, args.stack, () => token.access_token);\n try {\n const ontologies = await listOntologiesV2(createOpenApiRequest(stack, fetch));\n if (ontologies.data.length !== 1) {\n consola.error(`Could not look up ontology with these credentials. Found ${ontologies.data.length} ontologies.`);\n return false;\n }\n const ontology = await getOntologyFullMetadata(createOpenApiRequest(stack, 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 = {\n writeFile: (path, contents) => {\n return fs.promises.writeFile(path, contents, \"utf-8\");\n },\n mkdir: async (path, options) => {\n await fs.promises.mkdir(path, options);\n },\n readdir: async path => fs.promises.readdir(path)\n };\n try {\n if (args.beta) {\n await generateClientSdkVersionTwoPointZero(ontology, minimalFs, args.outDir, args.packageType);\n } else {\n await generateClientSdkVersionOneDotOne(ontology, minimalFs, args.outDir, args.packageType);\n }\n } catch (e) {\n consola.error(\"OSDK generation failed\", e.message);\n return false;\n }\n return true;\n}"]}
|
|
@@ -0,0 +1,111 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
var chunk2DZBTS5E_cjs = require('./chunk-2DZBTS5E.cjs');
|
|
4
|
+
require('./chunk-HQDDGVB7.cjs');
|
|
5
|
+
var requests = require('@osdk/gateway/requests');
|
|
6
|
+
var generator = require('@osdk/generator');
|
|
7
|
+
var shared_net = require('@osdk/shared.net');
|
|
8
|
+
var consola = require('consola');
|
|
9
|
+
var fs = require('fs');
|
|
10
|
+
|
|
11
|
+
function _interopNamespace(e) {
|
|
12
|
+
if (e && e.__esModule) return e;
|
|
13
|
+
var n = Object.create(null);
|
|
14
|
+
if (e) {
|
|
15
|
+
Object.keys(e).forEach(function (k) {
|
|
16
|
+
if (k !== 'default') {
|
|
17
|
+
var d = Object.getOwnPropertyDescriptor(e, k);
|
|
18
|
+
Object.defineProperty(n, k, d.get ? d : {
|
|
19
|
+
enumerable: true,
|
|
20
|
+
get: function () { return e[k]; }
|
|
21
|
+
});
|
|
22
|
+
}
|
|
23
|
+
});
|
|
24
|
+
}
|
|
25
|
+
n.default = e;
|
|
26
|
+
return Object.freeze(n);
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
var fs__namespace = /*#__PURE__*/_interopNamespace(fs);
|
|
30
|
+
|
|
31
|
+
async function handleGenerate(args) {
|
|
32
|
+
let success = false;
|
|
33
|
+
if (args.ontologyPath) {
|
|
34
|
+
success = await generateFromLocalFile(args);
|
|
35
|
+
} else if (args.stack && args.clientId) {
|
|
36
|
+
success = await generateFromStack(args);
|
|
37
|
+
} else {
|
|
38
|
+
throw new Error("Must have specified ontologyPath or stack and clientId");
|
|
39
|
+
}
|
|
40
|
+
if (success) {
|
|
41
|
+
consola.consola.info("OSDK Generated!");
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
async function generateFromLocalFile(args) {
|
|
45
|
+
if (!fs__namespace.existsSync(args.ontologyPath)) {
|
|
46
|
+
consola.consola.error(`Ontology file does not exist: ${args.ontologyPath}`);
|
|
47
|
+
return false;
|
|
48
|
+
}
|
|
49
|
+
const ontology = JSON.parse(await fs__namespace.promises.readFile(args.ontologyPath, "utf-8"));
|
|
50
|
+
return await generateClientSdk(ontology, args);
|
|
51
|
+
}
|
|
52
|
+
async function generateFromStack(args) {
|
|
53
|
+
const {
|
|
54
|
+
stack,
|
|
55
|
+
clientId,
|
|
56
|
+
ontologyWritePath
|
|
57
|
+
} = args;
|
|
58
|
+
const token = await chunk2DZBTS5E_cjs.invokeLoginFlow({
|
|
59
|
+
applicationId: clientId,
|
|
60
|
+
baseUrl: stack,
|
|
61
|
+
verbose: 0
|
|
62
|
+
});
|
|
63
|
+
const {
|
|
64
|
+
fetch
|
|
65
|
+
} = shared_net.createClientContext({
|
|
66
|
+
metadata: {
|
|
67
|
+
userAgent: "@osdk/cli/0.0.0 ()"
|
|
68
|
+
}
|
|
69
|
+
}, args.stack, () => token.access_token);
|
|
70
|
+
try {
|
|
71
|
+
const ontologies = await requests.listOntologiesV2(shared_net.createOpenApiRequest(stack, fetch));
|
|
72
|
+
if (ontologies.data.length !== 1) {
|
|
73
|
+
consola.consola.error(`Could not look up ontology with these credentials. Found ${ontologies.data.length} ontologies.`);
|
|
74
|
+
return false;
|
|
75
|
+
}
|
|
76
|
+
const ontology = await requests.getOntologyFullMetadata(shared_net.createOpenApiRequest(stack, fetch), ontologies.data[0].apiName);
|
|
77
|
+
if (ontologyWritePath) {
|
|
78
|
+
fs__namespace.writeFileSync(ontologyWritePath, JSON.stringify(ontology, null, 2));
|
|
79
|
+
}
|
|
80
|
+
return await generateClientSdk(ontology, args);
|
|
81
|
+
} catch (e) {
|
|
82
|
+
consola.consola.error("Failed to generate the ontology", e);
|
|
83
|
+
return false;
|
|
84
|
+
}
|
|
85
|
+
}
|
|
86
|
+
async function generateClientSdk(ontology, args) {
|
|
87
|
+
const minimalFs = {
|
|
88
|
+
writeFile: (path, contents) => {
|
|
89
|
+
return fs__namespace.promises.writeFile(path, contents, "utf-8");
|
|
90
|
+
},
|
|
91
|
+
mkdir: async (path, options) => {
|
|
92
|
+
await fs__namespace.promises.mkdir(path, options);
|
|
93
|
+
},
|
|
94
|
+
readdir: async (path) => fs__namespace.promises.readdir(path)
|
|
95
|
+
};
|
|
96
|
+
try {
|
|
97
|
+
if (args.beta) {
|
|
98
|
+
await generator.generateClientSdkVersionTwoPointZero(ontology, minimalFs, args.outDir, args.packageType);
|
|
99
|
+
} else {
|
|
100
|
+
await generator.generateClientSdkVersionOneDotOne(ontology, minimalFs, args.outDir, args.packageType);
|
|
101
|
+
}
|
|
102
|
+
} catch (e) {
|
|
103
|
+
consola.consola.error("OSDK generation failed", e.message);
|
|
104
|
+
return false;
|
|
105
|
+
}
|
|
106
|
+
return true;
|
|
107
|
+
}
|
|
108
|
+
|
|
109
|
+
module.exports = handleGenerate;
|
|
110
|
+
//# sourceMappingURL=out.js.map
|
|
111
|
+
//# sourceMappingURL=handleGenerate-UTCLNZQO.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../src/commands/typescript/generate/handleGenerate.mts"],"names":[],"mappings":";;;;;;AAgBA,SAAS,yBAAyB,wBAAwB;AAC1D,SAAS,mCAAmC,4CAA4C;AACxF,SAAS,qBAAqB,4BAA4B;AAC1D,SAAS,eAAe;AACxB,YAAY,QAAQ;AAEpB,eAAO,eAAsC,MAAM;AACjD,MAAI,UAAU;AACd,MAAI,KAAK,cAAc;AACrB,cAAU,MAAM,sBAAsB,IAAI;AAAA,EAC5C,WAAW,KAAK,SAAS,KAAK,UAAU;AACtC,cAAU,MAAM,kBAAkB,IAAI;AAAA,EACxC,OAAO;AACL,UAAM,IAAI,MAAM,wDAAwD;AAAA,EAC1E;AACA,MAAI,SAAS;AACX,YAAQ,KAAK,iBAAiB;AAAA,EAChC;AACF;AACA,eAAe,sBAAsB,MAAM;AACzC,MAAI,CAAI,cAAW,KAAK,YAAY,GAAG;AACrC,YAAQ,MAAM,iCAAiC,KAAK,YAAY,EAAE;AAClE,WAAO;AAAA,EACT;AACA,QAAM,WAAW,KAAK,MAAM,MAAS,YAAS,SAAS,KAAK,cAAc,OAAO,CAAC;AAClF,SAAO,MAAM,kBAAkB,UAAU,IAAI;AAC/C;AACA,eAAe,kBAAkB,MAAM;AACrC,QAAM;AAAA,IACJ;AAA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F;AAAA,EACF,SAAS,GAAG;AACV,YAAQ,MAAM,0BAA0B,EAAE,OAAO;AACjD,WAAO;AAAA,EACT;AACA,SAAO;AACT","sourcesContent":["/*\n * Copyright 2023 Palantir Technologies, Inc. All rights reserved.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport { getOntologyFullMetadata, listOntologiesV2 } from \"@osdk/gateway/requests\";\nimport { generateClientSdkVersionOneDotOne, generateClientSdkVersionTwoPointZero } from \"@osdk/generator\";\nimport { createClientContext, createOpenApiRequest } from \"@osdk/shared.net\";\nimport { consola } from \"consola\";\nimport * as fs from \"node:fs\";\nimport invokeLoginFlow from \"../../auth/login/loginFlow.js\";\nexport default async function handleGenerate(args) {\n let success = false;\n if (args.ontologyPath) {\n success = await generateFromLocalFile(args);\n } else if (args.stack && args.clientId) {\n success = await generateFromStack(args);\n } else {\n throw new Error(\"Must have specified ontologyPath or stack and clientId\");\n }\n if (success) {\n consola.info(\"OSDK Generated!\");\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 stack,\n clientId,\n ontologyWritePath\n } = args;\n const token = await invokeLoginFlow({\n applicationId: clientId,\n baseUrl: stack,\n verbose: 0\n });\n const {\n fetch\n } = createClientContext({\n metadata: {\n userAgent: \"@osdk/cli/0.0.0 ()\"\n }\n }, args.stack, () => token.access_token);\n try {\n const ontologies = await listOntologiesV2(createOpenApiRequest(stack, fetch));\n if (ontologies.data.length !== 1) {\n consola.error(`Could not look up ontology with these credentials. Found ${ontologies.data.length} ontologies.`);\n return false;\n }\n const ontology = await getOntologyFullMetadata(createOpenApiRequest(stack, 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 = {\n writeFile: (path, contents) => {\n return fs.promises.writeFile(path, contents, \"utf-8\");\n },\n mkdir: async (path, options) => {\n await fs.promises.mkdir(path, options);\n },\n readdir: async path => fs.promises.readdir(path)\n };\n try {\n if (args.beta) {\n await generateClientSdkVersionTwoPointZero(ontology, minimalFs, args.outDir, args.packageType);\n } else {\n await generateClientSdkVersionOneDotOne(ontology, minimalFs, args.outDir, args.packageType);\n }\n } catch (e) {\n consola.error(\"OSDK generation failed\", e.message);\n return false;\n }\n return true;\n}"]}
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
var chunkVZM34PGO_cjs = require('./chunk-VZM34PGO.cjs');
|
|
4
|
+
require('./chunk-HYF3CTKZ.cjs');
|
|
5
|
+
require('./chunk-HQDDGVB7.cjs');
|
|
6
|
+
var consola = require('consola');
|
|
7
|
+
|
|
8
|
+
async function handleSiteDeploy({
|
|
9
|
+
siteVersion: version,
|
|
10
|
+
appRid,
|
|
11
|
+
baseUrl,
|
|
12
|
+
clearVersion
|
|
13
|
+
}) {
|
|
14
|
+
const repositoryRid = await chunkVZM34PGO_cjs.third_party_application_service_exports.fetchWebsiteRepositoryRid(baseUrl, appRid);
|
|
15
|
+
const ctx = chunkVZM34PGO_cjs.createConjureContext(baseUrl, "/artifacts/api");
|
|
16
|
+
if (version) {
|
|
17
|
+
await chunkVZM34PGO_cjs.ArtifactsSitesAdminV2Service_exports.updateDeployedVersion(ctx, repositoryRid, {
|
|
18
|
+
siteVersion: {
|
|
19
|
+
version
|
|
20
|
+
}
|
|
21
|
+
});
|
|
22
|
+
} else if (clearVersion) {
|
|
23
|
+
await chunkVZM34PGO_cjs.ArtifactsSitesAdminV2Service_exports.clearDeployedVersion(ctx, repositoryRid);
|
|
24
|
+
}
|
|
25
|
+
consola.consola.success("Deploy successful");
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
module.exports = handleSiteDeploy;
|
|
29
|
+
//# sourceMappingURL=out.js.map
|
|
30
|
+
//# sourceMappingURL=handleSiteDeploy-7E5BNDQO.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../src/commands/site/deploy/handleSiteDeploy.mts"],"names":[],"mappings":";;;;;;;;;AAgBA,SAAS,eAAe;AAExB,eAAO,iBAAwC;AAAA,EAC7C,aAAa;AAAA,EACb;AAAA,EACA;AAAA,EACA;AACF,GAAG;AACD,QAAM,gBAAgB,MAAM,wCAA6B,0BAA0B,SAAS,MAAM;AAClG,QAAM,MAAM,qBAAqB,SAAS,gBAAgB;AAC1D,MAAI,SAAS;AACX,UAAM,qCAA6B,sBAAsB,KAAK,eAAe;AAAA,MAC3E,aAAa;AAAA,QACX;AAAA,MACF;AAAA,IACF,CAAC;AAAA,EACH,WAAW,cAAc;AACvB,UAAM,qCAA6B,qBAAqB,KAAK,aAAa;AAAA,EAC5E;AACA,UAAQ,QAAQ,mBAAmB;AACrC","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 { ArtifactsSitesAdminV2Service, createConjureContext, thirdPartyApplicationService } from \"#net\";\nexport default async function handleSiteDeploy({\n siteVersion: version,\n appRid,\n baseUrl,\n clearVersion\n}) {\n const repositoryRid = await thirdPartyApplicationService.fetchWebsiteRepositoryRid(baseUrl, appRid);\n const ctx = createConjureContext(baseUrl, \"/artifacts/api\");\n if (version) {\n await ArtifactsSitesAdminV2Service.updateDeployedVersion(ctx, repositoryRid, {\n siteVersion: {\n version\n }\n });\n } else if (clearVersion) {\n await ArtifactsSitesAdminV2Service.clearDeployedVersion(ctx, repositoryRid);\n }\n consola.success(\"Deploy successful\");\n}"]}
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import { third_party_application_service_exports, createConjureContext, ArtifactsSitesAdminV2Service_exports } from './chunk-CIVC2ZV3.mjs';
|
|
2
|
+
import './chunk-GTNZA5UY.mjs';
|
|
3
|
+
import './chunk-E2SEJZTC.mjs';
|
|
4
|
+
import { consola } from 'consola';
|
|
5
|
+
|
|
6
|
+
async function handleSiteDeploy({
|
|
7
|
+
siteVersion: version,
|
|
8
|
+
appRid,
|
|
9
|
+
baseUrl,
|
|
10
|
+
clearVersion
|
|
11
|
+
}) {
|
|
12
|
+
const repositoryRid = await third_party_application_service_exports.fetchWebsiteRepositoryRid(baseUrl, appRid);
|
|
13
|
+
const ctx = createConjureContext(baseUrl, "/artifacts/api");
|
|
14
|
+
if (version) {
|
|
15
|
+
await ArtifactsSitesAdminV2Service_exports.updateDeployedVersion(ctx, repositoryRid, {
|
|
16
|
+
siteVersion: {
|
|
17
|
+
version
|
|
18
|
+
}
|
|
19
|
+
});
|
|
20
|
+
} else if (clearVersion) {
|
|
21
|
+
await ArtifactsSitesAdminV2Service_exports.clearDeployedVersion(ctx, repositoryRid);
|
|
22
|
+
}
|
|
23
|
+
consola.success("Deploy successful");
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
export { handleSiteDeploy as default };
|
|
27
|
+
//# sourceMappingURL=out.js.map
|
|
28
|
+
//# sourceMappingURL=handleSiteDeploy-ZFWLLEFU.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../src/commands/site/deploy/handleSiteDeploy.mts"],"names":[],"mappings":";;;;;;;;;AAgBA,SAAS,eAAe;AAExB,eAAO,iBAAwC;AAAA,EAC7C,aAAa;AAAA,EACb;AAAA,EACA;AAAA,EACA;AACF,GAAG;AACD,QAAM,gBAAgB,MAAM,wCAA6B,0BAA0B,SAAS,MAAM;AAClG,QAAM,MAAM,qBAAqB,SAAS,gBAAgB;AAC1D,MAAI,SAAS;AACX,UAAM,qCAA6B,sBAAsB,KAAK,eAAe;AAAA,MAC3E,aAAa;AAAA,QACX;AAAA,MACF;AAAA,IACF,CAAC;AAAA,EACH,WAAW,cAAc;AACvB,UAAM,qCAA6B,qBAAqB,KAAK,aAAa;AAAA,EAC5E;AACA,UAAQ,QAAQ,mBAAmB;AACrC","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 { ArtifactsSitesAdminV2Service, createConjureContext, thirdPartyApplicationService } from \"#net\";\nexport default async function handleSiteDeploy({\n siteVersion: version,\n appRid,\n baseUrl,\n clearVersion\n}) {\n const repositoryRid = await thirdPartyApplicationService.fetchWebsiteRepositoryRid(baseUrl, appRid);\n const ctx = createConjureContext(baseUrl, \"/artifacts/api\");\n if (version) {\n await ArtifactsSitesAdminV2Service.updateDeployedVersion(ctx, repositoryRid, {\n siteVersion: {\n version\n }\n });\n } else if (clearVersion) {\n await ArtifactsSitesAdminV2Service.clearDeployedVersion(ctx, repositoryRid);\n }\n consola.success(\"Deploy successful\");\n}"]}
|