@osdk/cli 0.3.0 → 0.5.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-OOW63BC4.cjs → chunk-D7QHLGEU.cjs} +88 -24
- package/build/js/chunk-D7QHLGEU.cjs.map +1 -0
- package/build/js/chunk-N6K26UR4.mjs +9 -0
- package/build/js/chunk-N6K26UR4.mjs.map +1 -0
- package/build/js/chunk-X2S4O5ZR.cjs +11 -0
- package/build/js/chunk-X2S4O5ZR.cjs.map +1 -0
- package/build/js/{chunk-SQHFJOHN.mjs → chunk-XNYKWAIE.mjs} +84 -26
- package/build/js/chunk-XNYKWAIE.mjs.map +1 -0
- package/build/js/{handleGenerate-FCY2LRSZ.cjs → handleGenerate-Q6EQWXFG.cjs} +2 -2
- package/build/js/{handleGenerate-K6X2HG4V.mjs → handleGenerate-ZUZV3IBI.mjs} +2 -2
- package/build/js/index.cjs +322 -91
- package/build/js/index.cjs.map +1 -1
- package/build/js/index.mjs +319 -88
- package/build/js/index.mjs.map +1 -1
- package/build/js/siteDeployCommand-7GXJF5HF.mjs +100 -0
- package/build/js/siteDeployCommand-7GXJF5HF.mjs.map +1 -0
- package/build/js/siteDeployCommand-KUNL3GIW.cjs +126 -0
- package/build/js/siteDeployCommand-KUNL3GIW.cjs.map +1 -0
- package/build/js/versionDeleteCommand-6BJL5XLG.mjs +26 -0
- package/build/js/versionDeleteCommand-6BJL5XLG.mjs.map +1 -0
- package/build/js/versionDeleteCommand-RLU7UUYD.cjs +28 -0
- package/build/js/versionDeleteCommand-RLU7UUYD.cjs.map +1 -0
- package/build/js/versionGetCommand-OR4RLOLM.mjs +28 -0
- package/build/js/versionGetCommand-OR4RLOLM.mjs.map +1 -0
- package/build/js/versionGetCommand-Y2VR2WKH.cjs +30 -0
- package/build/js/versionGetCommand-Y2VR2WKH.cjs.map +1 -0
- package/build/js/versionListCommand-5KM5PFYL.cjs +34 -0
- package/build/js/versionListCommand-5KM5PFYL.cjs.map +1 -0
- package/build/js/versionListCommand-LPPGQCQF.mjs +32 -0
- package/build/js/versionListCommand-LPPGQCQF.mjs.map +1 -0
- package/build/js/versionSetCommand-LHOVVI6U.mjs +31 -0
- package/build/js/versionSetCommand-LHOVVI6U.mjs.map +1 -0
- package/build/js/versionSetCommand-VD3L5DOV.cjs +33 -0
- package/build/js/versionSetCommand-VD3L5DOV.cjs.map +1 -0
- package/build/js/versionUnsetCommand-IJT4JWBN.mjs +24 -0
- package/build/js/versionUnsetCommand-IJT4JWBN.mjs.map +1 -0
- package/build/js/versionUnsetCommand-XYBUQ6XB.cjs +26 -0
- package/build/js/versionUnsetCommand-XYBUQ6XB.cjs.map +1 -0
- package/build/types/YargsCheckError.d.ts +3 -0
- package/build/types/commands/site/CommonSiteArgs.d.ts +4 -2
- package/build/types/commands/site/deploy/SiteDeployArgs.d.ts +5 -2
- package/build/types/commands/site/deploy/index.d.ts +1 -1
- package/build/types/commands/site/deploy/logDeployCommandConfigFileOverride.d.ts +4 -0
- package/build/types/commands/site/deploy/siteDeployCommand.d.mts +2 -0
- package/build/types/commands/site/index.d.ts +3 -3
- package/build/types/commands/site/logSiteCommandConfigFileOverride.d.ts +4 -0
- package/build/types/commands/site/version/SiteVersionArgs.d.ts +4 -0
- package/build/types/commands/site/version/delete/index.d.ts +5 -0
- package/build/types/commands/site/version/delete/versionDeleteCommand.d.mts +2 -0
- package/build/types/commands/site/version/get/index.d.ts +4 -0
- package/build/types/commands/site/version/get/versionGetCommand.d.mts +2 -0
- package/build/types/commands/site/{versions → version}/index.d.ts +1 -1
- package/build/types/commands/site/version/list/index.d.ts +4 -0
- package/build/types/commands/site/version/list/versionListCommand.d.mts +2 -0
- package/build/types/commands/site/version/set/index.d.ts +5 -0
- package/build/types/commands/site/version/set/versionSetCommand.d.mts +2 -0
- package/build/types/commands/site/version/unset/index.d.ts +4 -0
- package/build/types/commands/site/version/unset/versionUnsetCommand.d.mts +2 -0
- package/build/types/net/artifacts/SiteAssetArtifactsService/DeleteSiteVersionRequest.d.mts +5 -0
- package/build/types/net/artifacts/SiteAssetArtifactsService/UploadZippedSiteAssetRequest.d.mts +6 -0
- package/build/types/net/artifacts/SiteAssetArtifactsService/deleteSiteVersion.d.mts +3 -2
- package/build/types/net/artifacts/SiteAssetArtifactsService/fetchSiteVersions.d.mts +2 -1
- package/build/types/net/artifacts/SiteAssetArtifactsService/uploadSiteVersion.d.mts +3 -2
- package/build/types/net/createConjureContext.d.mts +1 -1
- package/build/types/net/createInternalClientContext.d.mts +2 -0
- package/build/types/net/index.d.mts +1 -0
- package/build/types/net/internalClientContext.d.mts +4 -0
- package/build/types/net/third-party-application-service/fetchWebsiteRepositoryRid.d.mts +2 -1
- package/build/types/util/autoVersion.d.ts +8 -0
- package/build/types/util/autoVersion.test.d.ts +1 -0
- package/build/types/util/config.d.ts +25 -0
- package/build/types/util/config.test.d.ts +1 -0
- package/build/types/util/configLoader.d.ts +3 -0
- package/build/types/util/isValidSemver.test.d.ts +1 -0
- package/build/types/util/token.d.ts +21 -0
- package/build/types/util/token.test.d.ts +1 -0
- package/build/types/yargs/logConfigFileMiddleware.d.ts +1 -0
- package/changelog/0.3.0/pr-20.v2.yml +5 -0
- package/changelog/0.4.0/pr-15.v2.yml +5 -0
- package/changelog/0.4.0/pr-17.v2.yml +5 -0
- package/changelog/0.4.0/pr-35.v2.yml +5 -0
- package/changelog/0.4.0/pr-41.v2.yml +5 -0
- package/changelog/0.4.0/pr-42.v2.yml +5 -0
- package/changelog/0.5.0/pr-47.v2.yml +5 -0
- package/changelog/0.5.0/pr-49.v2.yml +5 -0
- package/changelog/0.5.0/pr-51.v2.yml +5 -0
- package/changelog/@unreleased/.gitkeep +0 -0
- package/package.json +7 -4
- package/build/js/chunk-OOW63BC4.cjs.map +0 -1
- package/build/js/chunk-SQHFJOHN.mjs.map +0 -1
- package/build/js/handleSiteDeploy-5C2FGADK.cjs +0 -30
- package/build/js/handleSiteDeploy-5C2FGADK.cjs.map +0 -1
- package/build/js/handleSiteDeploy-HHXON5YE.mjs +0 -28
- package/build/js/handleSiteDeploy-HHXON5YE.mjs.map +0 -1
- package/build/js/siteDeleteCommand-47GMSHFS.mjs +0 -13
- package/build/js/siteDeleteCommand-47GMSHFS.mjs.map +0 -1
- package/build/js/siteDeleteCommand-7YTHDD4P.cjs +0 -15
- package/build/js/siteDeleteCommand-7YTHDD4P.cjs.map +0 -1
- package/build/js/siteUploadCommand-HBZYJ4ZP.cjs +0 -58
- package/build/js/siteUploadCommand-HBZYJ4ZP.cjs.map +0 -1
- package/build/js/siteUploadCommand-S2HTCGZK.mjs +0 -33
- package/build/js/siteUploadCommand-S2HTCGZK.mjs.map +0 -1
- package/build/js/siteVersionsCommand-GU3HKEGQ.cjs +0 -29
- package/build/js/siteVersionsCommand-GU3HKEGQ.cjs.map +0 -1
- package/build/js/siteVersionsCommand-X5MO726Z.mjs +0 -27
- package/build/js/siteVersionsCommand-X5MO726Z.mjs.map +0 -1
- package/build/types/commands/site/delete/DeleteArgs.d.ts +0 -4
- package/build/types/commands/site/delete/index.d.ts +0 -5
- package/build/types/commands/site/delete/siteDeleteCommand.d.mts +0 -2
- package/build/types/commands/site/deploy/handleSiteDeploy.d.mts +0 -2
- package/build/types/commands/site/upload/UploadArgs.d.ts +0 -5
- package/build/types/commands/site/upload/index.d.ts +0 -5
- package/build/types/commands/site/upload/siteUploadCommand.d.mts +0 -2
- package/build/types/commands/site/versions/siteVersionsCommand.d.mts +0 -2
- /package/{CHANGELOG.md → CHANGELOG_OLD.md} +0 -0
- /package/build/js/{handleGenerate-FCY2LRSZ.cjs.map → handleGenerate-Q6EQWXFG.cjs.map} +0 -0
- /package/build/js/{handleGenerate-K6X2HG4V.mjs.map → handleGenerate-ZUZV3IBI.mjs.map} +0 -0
package/build/js/index.mjs
CHANGED
|
@@ -1,7 +1,10 @@
|
|
|
1
|
+
import { isValidSemver } from './chunk-N6K26UR4.mjs';
|
|
1
2
|
import { ExitProcessError } from './chunk-GTNZA5UY.mjs';
|
|
2
3
|
import './chunk-E2SEJZTC.mjs';
|
|
4
|
+
import { consola } from 'consola';
|
|
3
5
|
import yargs from 'yargs';
|
|
4
6
|
import { hideBin } from 'yargs/helpers';
|
|
7
|
+
import { promises } from 'fs';
|
|
5
8
|
|
|
6
9
|
// src/commands/auth/login/index.ts
|
|
7
10
|
var command = {
|
|
@@ -14,8 +17,8 @@ var command = {
|
|
|
14
17
|
});
|
|
15
18
|
},
|
|
16
19
|
handler: async (args) => {
|
|
17
|
-
const
|
|
18
|
-
await
|
|
20
|
+
const command11 = await import('./loginFlow-KGLTXVZ6.mjs');
|
|
21
|
+
await command11.default(args);
|
|
19
22
|
}
|
|
20
23
|
};
|
|
21
24
|
var login_default = command;
|
|
@@ -36,118 +39,325 @@ var site = {
|
|
|
36
39
|
}
|
|
37
40
|
};
|
|
38
41
|
var auth_default = site;
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
builder: (argv) => {
|
|
45
|
-
return argv.option("siteVersion", {
|
|
46
|
-
type: "string",
|
|
47
|
-
demandOption: true
|
|
48
|
-
}).option("dir", {
|
|
42
|
+
var CONFIG_FILE_NAMES = ["foundry.config.json"];
|
|
43
|
+
var CONFIG_FILE_SCHEMA = {
|
|
44
|
+
type: "object",
|
|
45
|
+
properties: {
|
|
46
|
+
foundryUrl: {
|
|
49
47
|
type: "string"
|
|
50
|
-
}
|
|
48
|
+
},
|
|
49
|
+
site: {
|
|
50
|
+
type: "object",
|
|
51
|
+
properties: {
|
|
52
|
+
application: {
|
|
53
|
+
type: "string"
|
|
54
|
+
},
|
|
55
|
+
directory: {
|
|
56
|
+
type: "string"
|
|
57
|
+
},
|
|
58
|
+
autoVersion: {
|
|
59
|
+
type: "object",
|
|
60
|
+
nullable: true,
|
|
61
|
+
oneOf: [{
|
|
62
|
+
properties: {
|
|
63
|
+
"type": {
|
|
64
|
+
const: "git-describe",
|
|
65
|
+
type: "string"
|
|
66
|
+
},
|
|
67
|
+
"tagPrefix": {
|
|
68
|
+
type: "string",
|
|
69
|
+
nullable: true
|
|
70
|
+
}
|
|
71
|
+
}
|
|
72
|
+
}],
|
|
73
|
+
required: ["type"]
|
|
74
|
+
}
|
|
75
|
+
},
|
|
76
|
+
required: ["application", "directory"]
|
|
77
|
+
}
|
|
51
78
|
},
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
79
|
+
required: ["foundryUrl", "site"],
|
|
80
|
+
additionalProperties: false
|
|
81
|
+
};
|
|
82
|
+
async function loadFoundryConfig() {
|
|
83
|
+
const ajvModule = await import('ajv');
|
|
84
|
+
const Ajv = ajvModule.default.default;
|
|
85
|
+
const ajv = new Ajv({
|
|
86
|
+
allErrors: true
|
|
87
|
+
});
|
|
88
|
+
const validate = ajv.compile(CONFIG_FILE_SCHEMA);
|
|
89
|
+
const {
|
|
90
|
+
findUp
|
|
91
|
+
} = await import('find-up');
|
|
92
|
+
const configFilePath = await findUp(CONFIG_FILE_NAMES);
|
|
93
|
+
if (configFilePath) {
|
|
94
|
+
let foundryConfig;
|
|
95
|
+
try {
|
|
96
|
+
const fileContent = await promises.readFile(configFilePath, "utf-8");
|
|
97
|
+
foundryConfig = JSON.parse(fileContent);
|
|
98
|
+
} catch {
|
|
99
|
+
throw new ExitProcessError(2, `Couldn't read or parse config file ${configFilePath}`);
|
|
100
|
+
}
|
|
101
|
+
if (!validate(foundryConfig)) {
|
|
102
|
+
throw new ExitProcessError(2, `The configuration file does not match the expected schema: ${ajv.errorsText(validate.errors)}`);
|
|
103
|
+
}
|
|
104
|
+
return {
|
|
105
|
+
foundryConfig,
|
|
106
|
+
configFilePath
|
|
107
|
+
};
|
|
108
|
+
}
|
|
109
|
+
return void 0;
|
|
110
|
+
}
|
|
111
|
+
|
|
112
|
+
// src/util/configLoader.ts
|
|
113
|
+
var configPromise = void 0;
|
|
114
|
+
function getConfig() {
|
|
115
|
+
if (configPromise == null) {
|
|
116
|
+
configPromise = loadFoundryConfig();
|
|
117
|
+
}
|
|
118
|
+
return configPromise;
|
|
119
|
+
}
|
|
120
|
+
var configLoader_default = getConfig;
|
|
121
|
+
|
|
122
|
+
// src/YargsCheckError.ts
|
|
123
|
+
var YargsCheckError = class extends Error {
|
|
124
|
+
constructor(msg) {
|
|
125
|
+
super(msg);
|
|
55
126
|
}
|
|
56
127
|
};
|
|
57
|
-
|
|
128
|
+
async function logDeployCommandConfigFileOverride(args, config) {
|
|
129
|
+
if (config?.autoVersion != null && args.autoVersion !== config?.autoVersion.type) {
|
|
130
|
+
consola.debug(`Overriding "autoVersion" from config file with ${args.autoVersion}`);
|
|
131
|
+
}
|
|
132
|
+
if (config?.directory != null && args.directory !== config?.directory) {
|
|
133
|
+
consola.debug(`Overriding "directory" from config file with ${args.directory}`);
|
|
134
|
+
}
|
|
135
|
+
if (config?.autoVersion?.tagPrefix != null && args.gitTagPrefix != null && args.gitTagPrefix !== config?.autoVersion.tagPrefix) {
|
|
136
|
+
consola.debug(`Overriding "gitTagPrefix" from config file with ${args.gitTagPrefix}`);
|
|
137
|
+
}
|
|
138
|
+
}
|
|
58
139
|
|
|
59
140
|
// src/commands/site/deploy/index.ts
|
|
60
|
-
var
|
|
141
|
+
var command2 = {
|
|
61
142
|
command: "deploy",
|
|
62
143
|
describe: "Deploy an uploaded version",
|
|
63
|
-
builder: (argv) => {
|
|
144
|
+
builder: async (argv) => {
|
|
145
|
+
const config = await configLoader_default();
|
|
146
|
+
const siteConfig = config?.foundryConfig.site;
|
|
147
|
+
const directory = siteConfig?.directory;
|
|
148
|
+
const autoVersion = siteConfig?.autoVersion;
|
|
149
|
+
const gitTagPrefix = autoVersion?.tagPrefix;
|
|
64
150
|
return argv.options({
|
|
65
|
-
|
|
151
|
+
directory: {
|
|
66
152
|
type: "string",
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
153
|
+
description: "Directory to deploy",
|
|
154
|
+
...directory ? {
|
|
155
|
+
default: directory
|
|
156
|
+
} : {
|
|
157
|
+
demandOption: true
|
|
158
|
+
}
|
|
70
159
|
},
|
|
71
|
-
|
|
72
|
-
alias: "clearVersion",
|
|
73
|
-
description: "Causes the site to no longer be deployed",
|
|
160
|
+
uploadOnly: {
|
|
74
161
|
type: "boolean",
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
162
|
+
description: "Upload the directory but do not deploy it",
|
|
163
|
+
default: false
|
|
164
|
+
},
|
|
165
|
+
version: {
|
|
166
|
+
type: "string",
|
|
167
|
+
description: "Version to deploy",
|
|
168
|
+
...autoVersion == null ? {
|
|
169
|
+
conflicts: "autoVersion"
|
|
170
|
+
} : {}
|
|
171
|
+
},
|
|
172
|
+
autoVersion: {
|
|
173
|
+
type: "string",
|
|
174
|
+
description: "Enables autoversioning. Can be set to 'git-describe' to use git describe to determine the version.",
|
|
175
|
+
...autoVersion != null ? {
|
|
176
|
+
default: autoVersion.type
|
|
177
|
+
} : {
|
|
178
|
+
conflicts: "version"
|
|
179
|
+
}
|
|
180
|
+
},
|
|
181
|
+
gitTagPrefix: {
|
|
182
|
+
type: "string",
|
|
183
|
+
description: "Prefix to match git tags against when --autoVersion=git-describe is used. If not provided, a default prefix 'v' is used.",
|
|
184
|
+
...gitTagPrefix ? {
|
|
185
|
+
default: gitTagPrefix
|
|
186
|
+
} : {}
|
|
187
|
+
}
|
|
188
|
+
}).group(["autoVersion", "gitTagPrefix"], "Autoversion Arguments").group(["version", "directory", "uploadOnly"], "Common Arguments").check((args) => {
|
|
189
|
+
if (autoVersion == null && args.autoVersion == null && args.version == null) {
|
|
190
|
+
throw new YargsCheckError("One of --version or --autoVersion must be specified");
|
|
78
191
|
}
|
|
79
|
-
|
|
192
|
+
const autoVersionType = args.autoVersion ?? autoVersion;
|
|
193
|
+
if (autoVersionType !== "git-describe") {
|
|
194
|
+
throw new YargsCheckError(`Only 'git-describe' is supported for autoVersion`);
|
|
195
|
+
}
|
|
196
|
+
const gitTagPrefixValue = args.gitTagPrefix ?? gitTagPrefix;
|
|
197
|
+
if (gitTagPrefixValue != null && autoVersionType !== "git-describe") {
|
|
198
|
+
throw new YargsCheckError(`--gitTagPrefix is only supported when --autoVersion=git-describe`);
|
|
199
|
+
}
|
|
200
|
+
return true;
|
|
201
|
+
}).middleware((args) => logDeployCommandConfigFileOverride(args, siteConfig));
|
|
80
202
|
},
|
|
81
203
|
handler: async (args) => {
|
|
82
|
-
const
|
|
83
|
-
await
|
|
204
|
+
const command11 = await import('./siteDeployCommand-7GXJF5HF.mjs');
|
|
205
|
+
await command11.default(args);
|
|
84
206
|
}
|
|
85
207
|
};
|
|
86
|
-
var deploy_default =
|
|
208
|
+
var deploy_default = command2;
|
|
209
|
+
async function logSiteCommandConfigFileOverride(args, config) {
|
|
210
|
+
if (config?.site.application != null && args.application !== config.site.application) {
|
|
211
|
+
consola.debug(`Overriding "application" from config file with ${args.application}`);
|
|
212
|
+
}
|
|
213
|
+
if (config?.foundryUrl != null && args.foundryUrl !== config.foundryUrl) {
|
|
214
|
+
consola.debug(`Overriding "foundryUrl" from config file with ${args.foundryUrl}`);
|
|
215
|
+
}
|
|
216
|
+
}
|
|
87
217
|
|
|
88
|
-
// src/commands/site/
|
|
89
|
-
var
|
|
90
|
-
command: "
|
|
91
|
-
describe: "
|
|
218
|
+
// src/commands/site/version/delete/index.ts
|
|
219
|
+
var command3 = {
|
|
220
|
+
command: "delete <version>",
|
|
221
|
+
describe: "Delete the specified site version.",
|
|
92
222
|
builder: (argv) => {
|
|
93
|
-
return argv.
|
|
223
|
+
return argv.positional("version", {
|
|
94
224
|
type: "string",
|
|
95
|
-
demandOption: true
|
|
96
|
-
|
|
97
|
-
type: "string"
|
|
225
|
+
demandOption: true,
|
|
226
|
+
description: "Version to set as live"
|
|
98
227
|
});
|
|
99
228
|
},
|
|
100
229
|
handler: async (args) => {
|
|
101
|
-
const
|
|
102
|
-
await
|
|
230
|
+
const command11 = await import('./versionDeleteCommand-6BJL5XLG.mjs');
|
|
231
|
+
await command11.default(args);
|
|
103
232
|
}
|
|
104
233
|
};
|
|
105
|
-
var
|
|
234
|
+
var delete_default = command3;
|
|
106
235
|
|
|
107
|
-
// src/commands/site/
|
|
236
|
+
// src/commands/site/version/get/index.ts
|
|
237
|
+
var command4 = {
|
|
238
|
+
command: "get",
|
|
239
|
+
describe: "Get the currently set live site version",
|
|
240
|
+
builder: (argv) => {
|
|
241
|
+
return argv;
|
|
242
|
+
},
|
|
243
|
+
handler: async (args) => {
|
|
244
|
+
const command11 = await import('./versionGetCommand-OR4RLOLM.mjs');
|
|
245
|
+
await command11.default(args);
|
|
246
|
+
}
|
|
247
|
+
};
|
|
248
|
+
var get_default = command4;
|
|
249
|
+
|
|
250
|
+
// src/commands/site/version/list/index.ts
|
|
108
251
|
var command5 = {
|
|
109
|
-
command: "
|
|
252
|
+
command: "list",
|
|
110
253
|
describe: "List application versions",
|
|
111
254
|
builder: (argv) => {
|
|
112
255
|
return argv;
|
|
113
256
|
},
|
|
114
257
|
handler: async (args) => {
|
|
115
|
-
const
|
|
116
|
-
await
|
|
258
|
+
const command11 = await import('./versionListCommand-LPPGQCQF.mjs');
|
|
259
|
+
await command11.default(args);
|
|
260
|
+
}
|
|
261
|
+
};
|
|
262
|
+
var list_default = command5;
|
|
263
|
+
|
|
264
|
+
// src/commands/site/version/set/index.ts
|
|
265
|
+
var command6 = {
|
|
266
|
+
command: "set <version>",
|
|
267
|
+
describe: "Set the live site version",
|
|
268
|
+
builder: (argv) => {
|
|
269
|
+
return argv.positional("version", {
|
|
270
|
+
type: "string",
|
|
271
|
+
demandOption: true,
|
|
272
|
+
description: "Version to set as live"
|
|
273
|
+
});
|
|
274
|
+
},
|
|
275
|
+
handler: async (args) => {
|
|
276
|
+
const command11 = await import('./versionSetCommand-LHOVVI6U.mjs');
|
|
277
|
+
await command11.default(args);
|
|
278
|
+
}
|
|
279
|
+
};
|
|
280
|
+
var set_default = command6;
|
|
281
|
+
|
|
282
|
+
// src/commands/site/version/unset/index.ts
|
|
283
|
+
var command7 = {
|
|
284
|
+
command: "unset",
|
|
285
|
+
describe: "Clear the currently set live site version.",
|
|
286
|
+
builder: (argv) => {
|
|
287
|
+
return argv;
|
|
288
|
+
},
|
|
289
|
+
handler: async (args) => {
|
|
290
|
+
const command11 = await import('./versionUnsetCommand-IJT4JWBN.mjs');
|
|
291
|
+
await command11.default(args);
|
|
292
|
+
}
|
|
293
|
+
};
|
|
294
|
+
var unset_default = command7;
|
|
295
|
+
|
|
296
|
+
// src/commands/site/version/index.ts
|
|
297
|
+
var command8 = {
|
|
298
|
+
command: "version",
|
|
299
|
+
describe: "Manage application version",
|
|
300
|
+
builder: (argv) => {
|
|
301
|
+
return argv.command(list_default).command(set_default).command(unset_default).command(delete_default).command(get_default).demandCommand();
|
|
302
|
+
},
|
|
303
|
+
handler: async (args) => {
|
|
117
304
|
}
|
|
118
305
|
};
|
|
119
|
-
var
|
|
306
|
+
var version_default = command8;
|
|
120
307
|
|
|
121
308
|
// src/commands/site/index.ts
|
|
122
|
-
var
|
|
309
|
+
var command9 = {
|
|
123
310
|
command: "site",
|
|
124
311
|
describe: "Manage your site",
|
|
125
|
-
builder: (argv) => {
|
|
312
|
+
builder: async (argv) => {
|
|
313
|
+
const config = await configLoader_default();
|
|
314
|
+
const application = config?.foundryConfig.site.application;
|
|
315
|
+
const foundryUrl = config?.foundryConfig.foundryUrl;
|
|
126
316
|
return argv.options({
|
|
127
|
-
|
|
317
|
+
application: {
|
|
128
318
|
type: "string",
|
|
129
|
-
|
|
130
|
-
|
|
319
|
+
coerce: (application2) => application2,
|
|
320
|
+
...application ? {
|
|
321
|
+
default: application
|
|
322
|
+
} : {
|
|
323
|
+
demandOption: true
|
|
324
|
+
},
|
|
325
|
+
description: "Application RID"
|
|
131
326
|
},
|
|
132
|
-
|
|
327
|
+
foundryUrl: {
|
|
328
|
+
coerce: (foundryUrl2) => foundryUrl2.replace(/\/$/, ""),
|
|
133
329
|
type: "string",
|
|
134
|
-
|
|
330
|
+
...foundryUrl ? {
|
|
331
|
+
default: foundryUrl
|
|
332
|
+
} : {
|
|
333
|
+
demandOption: true
|
|
334
|
+
},
|
|
335
|
+
description: "Foundry Stack URL with Protocol (e.g. https://example.palantirfoundry.com)"
|
|
336
|
+
},
|
|
337
|
+
token: {
|
|
338
|
+
type: "string",
|
|
339
|
+
conflicts: "tokenFile",
|
|
340
|
+
description: "Foundry API Token"
|
|
341
|
+
},
|
|
342
|
+
tokenFile: {
|
|
343
|
+
type: "string",
|
|
344
|
+
conflicts: "token",
|
|
345
|
+
description: "Path to a file containing your Foundry API Token"
|
|
346
|
+
}
|
|
347
|
+
}).group(["application", "foundryUrl", "token", "tokenFile"], "Common Arguments").command(version_default).command(deploy_default).check((args) => {
|
|
348
|
+
if (!args.foundryUrl.startsWith("https://")) {
|
|
349
|
+
throw new YargsCheckError("foundryUrl must start with https://");
|
|
135
350
|
}
|
|
136
|
-
|
|
351
|
+
return true;
|
|
352
|
+
}).middleware((args) => logSiteCommandConfigFileOverride(args, config?.foundryConfig)).demandCommand();
|
|
137
353
|
},
|
|
138
354
|
handler: async (args) => {
|
|
139
355
|
}
|
|
140
356
|
};
|
|
141
|
-
var site_default =
|
|
142
|
-
|
|
143
|
-
// src/util/isValidSemver.ts
|
|
144
|
-
var semver = /^(0|[1-9]\d*)\.(0|[1-9]\d*)\.(0|[1-9]\d*)(?:-((?:0|[1-9]\d*|\d*[a-zA-Z-][0-9a-zA-Z-]*)(?:\.(?:0|[1-9]\d*|\d*[a-zA-Z-][0-9a-zA-Z-]*))*))?(?:\+([0-9a-zA-Z-]+(?:\.[0-9a-zA-Z-]+)*))?$/;
|
|
145
|
-
function isValidSemver(semverString) {
|
|
146
|
-
return semver.test(semverString);
|
|
147
|
-
}
|
|
357
|
+
var site_default = command9;
|
|
148
358
|
|
|
149
359
|
// src/commands/typescript/generate/generate.ts
|
|
150
|
-
var
|
|
360
|
+
var command10 = {
|
|
151
361
|
command: "generate",
|
|
152
362
|
describe: "Generate typescript from ontology",
|
|
153
363
|
builder: (argv) => {
|
|
@@ -197,25 +407,25 @@ var command6 = {
|
|
|
197
407
|
description: "Version of the generated code, or 'dev'",
|
|
198
408
|
demandOption: true
|
|
199
409
|
}
|
|
200
|
-
}).group(["ontologyPath", "outDir", "version"], "Generate from a local file").group(["stack", "clientId", "outDir", "ontologyWritePath", "version"], "OR Generate from a stack").check((
|
|
201
|
-
if (!
|
|
410
|
+
}).group(["ontologyPath", "outDir", "version"], "Generate from a local file").group(["stack", "clientId", "outDir", "ontologyWritePath", "version"], "OR Generate from a stack").check((args) => {
|
|
411
|
+
if (!args.ontologyPath && !args.stack) {
|
|
202
412
|
throw new Error("Error: Must specify either ontologyPath or stack and clientId");
|
|
203
413
|
}
|
|
204
|
-
if (
|
|
414
|
+
if (args.version !== "dev" && !isValidSemver(args.version)) {
|
|
205
415
|
throw new Error("Error: Version must be 'dev' or a valid semver version");
|
|
206
416
|
}
|
|
207
417
|
return true;
|
|
208
418
|
});
|
|
209
419
|
},
|
|
210
420
|
handler: async (args) => {
|
|
211
|
-
const
|
|
212
|
-
await
|
|
421
|
+
const command11 = await import('./handleGenerate-ZUZV3IBI.mjs');
|
|
422
|
+
await command11.default(args);
|
|
213
423
|
}
|
|
214
424
|
};
|
|
215
|
-
var generate_default =
|
|
425
|
+
var generate_default = command10;
|
|
216
426
|
|
|
217
427
|
// src/commands/typescript/index.ts
|
|
218
|
-
var
|
|
428
|
+
var site2 = {
|
|
219
429
|
command: "typescript",
|
|
220
430
|
describe: "Manage code",
|
|
221
431
|
builder: (argv) => {
|
|
@@ -224,46 +434,67 @@ var site3 = {
|
|
|
224
434
|
handler: async (args) => {
|
|
225
435
|
}
|
|
226
436
|
};
|
|
227
|
-
var typescript_default =
|
|
228
|
-
|
|
229
|
-
// src/yargs/logVersionMiddleware.ts
|
|
437
|
+
var typescript_default = site2;
|
|
230
438
|
var firstTime = true;
|
|
231
|
-
async function
|
|
439
|
+
async function logConfigFileMiddleware() {
|
|
232
440
|
if (firstTime) {
|
|
233
|
-
|
|
234
|
-
const
|
|
235
|
-
|
|
441
|
+
firstTime = false;
|
|
442
|
+
const config = configLoader_default();
|
|
443
|
+
const configFilePath = (await config)?.configFilePath;
|
|
444
|
+
if (configFilePath) {
|
|
445
|
+
consola.debug(`Using configuration from file: "${configFilePath}"`);
|
|
446
|
+
}
|
|
447
|
+
}
|
|
448
|
+
}
|
|
449
|
+
var firstTime2 = true;
|
|
450
|
+
async function logVersionMiddleware(args) {
|
|
451
|
+
if (firstTime2) {
|
|
452
|
+
firstTime2 = false;
|
|
453
|
+
consola.info(`Palantir OSDK CLI ${"0.5.0"}`);
|
|
236
454
|
consola.level = 3 + args.verbose;
|
|
237
455
|
if (consola.level > 3) {
|
|
238
456
|
consola.debug(`Verbose logging enabled (${consola.level === 4 ? "debug" : "trace"})`);
|
|
239
457
|
}
|
|
240
|
-
|
|
241
|
-
firstTime = false;
|
|
458
|
+
consola.log("");
|
|
242
459
|
}
|
|
243
460
|
}
|
|
244
461
|
|
|
245
462
|
// src/cli.ts
|
|
246
463
|
async function cli(args = process.argv) {
|
|
247
|
-
const base = yargs(hideBin(args)).env("OSDK").version(false).option("verbose", {
|
|
464
|
+
const base = yargs(hideBin(args)).wrap(Math.min(150, yargs().terminalWidth())).env("OSDK").version(false).option("verbose", {
|
|
248
465
|
alias: "v",
|
|
249
466
|
type: "boolean",
|
|
250
467
|
description: "Enable verbose logging",
|
|
251
468
|
count: true
|
|
252
|
-
}).demandCommand().middleware(logVersionMiddleware, true).strict().command({
|
|
469
|
+
}).demandCommand().middleware(logVersionMiddleware, true).middleware(logConfigFileMiddleware).strict().command({
|
|
253
470
|
command: "unstable",
|
|
254
471
|
aliases: ["experimental"],
|
|
472
|
+
describe: "Unstable commands",
|
|
255
473
|
builder: async (argv) => {
|
|
256
474
|
return argv.command(site_default).command(typescript_default).command(auth_default).demandCommand();
|
|
257
475
|
},
|
|
258
476
|
handler: (_args) => {
|
|
259
477
|
}
|
|
478
|
+
}).fail(async (msg, err, argv) => {
|
|
479
|
+
if (err instanceof ExitProcessError) {
|
|
480
|
+
consola.error(err.message);
|
|
481
|
+
consola.debug(err.stack);
|
|
482
|
+
} else {
|
|
483
|
+
if (err && err instanceof YargsCheckError === false) {
|
|
484
|
+
throw err;
|
|
485
|
+
} else {
|
|
486
|
+
argv.showHelp();
|
|
487
|
+
consola.log("");
|
|
488
|
+
consola.error(msg);
|
|
489
|
+
}
|
|
490
|
+
}
|
|
491
|
+
process.exit(1);
|
|
260
492
|
});
|
|
261
493
|
try {
|
|
262
|
-
return base.parseAsync();
|
|
263
|
-
} catch (
|
|
264
|
-
if (
|
|
265
|
-
|
|
266
|
-
Consola.consola.error(e.message);
|
|
494
|
+
return await base.parseAsync();
|
|
495
|
+
} catch (err) {
|
|
496
|
+
if (err instanceof ExitProcessError) {
|
|
497
|
+
consola.error(err);
|
|
267
498
|
}
|
|
268
499
|
}
|
|
269
500
|
}
|