@osdk/foundry-sdk-generator 1.3.2 → 1.3.3

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 CHANGED
@@ -1,5 +1,15 @@
1
1
  # @osdk/foundry-sdk-generator
2
2
 
3
+ ## 1.3.3
4
+
5
+ ### Patch Changes
6
+
7
+ - ef2018e: Fixed an edge case where generation caused compile errors
8
+ - bf5d49e: --beta now loads from the beta package
9
+ - Updated dependencies [ef2018e]
10
+ - @osdk/generator@1.13.2
11
+ - @osdk/legacy-client@2.5.1
12
+
3
13
  ## 1.3.2
4
14
 
5
15
  ### Patch Changes
@@ -1,3 +1,4 @@
1
+ import consola from 'consola';
1
2
  import yargs from 'yargs';
2
3
  import { hideBin } from 'yargs/helpers';
3
4
  import { exit } from 'process';
@@ -557,7 +558,7 @@ function isValidSemver(semverString) {
557
558
  }
558
559
 
559
560
  // src/utils/UserAgent.ts
560
- var USER_AGENT = `typescript-sdk-generator/${"1.3.2"}`;
561
+ var USER_AGENT = `typescript-sdk-generator/${"1.3.3"}`;
561
562
  async function createRollupBuild(absolutePackagePath, packageName) {
562
563
  const inputPath = `${absolutePackagePath}/${packageName}/index.js`;
563
564
  const {
@@ -1139,7 +1140,7 @@ var betaDependencies = {
1139
1140
  };
1140
1141
  async function generatePackage(ontology, options) {
1141
1142
  const {
1142
- consola
1143
+ consola: consola2
1143
1144
  } = await import('consola');
1144
1145
  const packagePath = join(options.outputDir, options.packageName);
1145
1146
  const resolvedDependencies = await Promise.all(Object.keys(options.beta ? betaDependencies : dependencies).map(async (dependency) => {
@@ -1171,7 +1172,7 @@ async function generatePackage(ontology, options) {
1171
1172
  const compilerOutput = compileInMemory(inMemoryFileSystem, {
1172
1173
  esm: options.beta
1173
1174
  });
1174
- compilerOutput.diagnostics.forEach((d) => consola.error(`Error compiling file`, d.file?.fileName, d.messageText));
1175
+ compilerOutput.diagnostics.forEach((d) => consola2.error(`Error compiling file`, d.file?.fileName, d.messageText));
1175
1176
  await mkdir(join(packagePath, "dist", "bundle"), {
1176
1177
  recursive: true
1177
1178
  });
@@ -1187,10 +1188,10 @@ async function generatePackage(ontology, options) {
1187
1188
  try {
1188
1189
  bundleDts = await bundleDependencies(options.beta ? [] : [join(nodeModulesPath, "@osdk", "legacy-client"), join(nodeModulesPath, "@osdk", "api"), join(nodeModulesPath, "@osdk", "gateway")], options.packageName, compilerOutput.files, options.beta ? void 0 : `internal/@osdk/legacy-client/index.ts`);
1189
1190
  } catch (e) {
1190
- consola.error("Failed bundling DTS", e);
1191
+ consola2.error("Failed bundling DTS", e);
1191
1192
  }
1192
1193
  } else {
1193
- consola.error("Could not find node_modules directory, skipping DTS bundling");
1194
+ consola2.error("Could not find node_modules directory, skipping DTS bundling");
1194
1195
  }
1195
1196
  await Promise.all([...Object.entries(compilerOutput.files).map(async ([path2, contents]) => {
1196
1197
  await writeFile(path2, contents, {
@@ -1209,7 +1210,7 @@ async function generatePackage(ontology, options) {
1209
1210
  try {
1210
1211
  await generateBundles(absolutePackagePath, options.packageName);
1211
1212
  } catch (e) {
1212
- consola.error(e);
1213
+ consola2.error(e);
1213
1214
  }
1214
1215
  }
1215
1216
  async function getDependencyVersion(dependency) {
@@ -1314,22 +1315,17 @@ var GeneratePackageCommand = class {
1314
1315
  description: `Experimental features that can be modified or removed at any time. Example Usage: --experimentalFeatures realtimeUpdates`,
1315
1316
  default: void 0,
1316
1317
  defaultDescription: `By default, no arguments will not enable any experimental features.`
1317
- }).options("beta", {
1318
- boolean: true,
1319
- demandOption: false,
1320
- hidden: true,
1321
- default: false
1322
1318
  }).strict();
1323
1319
  }
1324
1320
  handler = async (args) => {
1325
1321
  const {
1326
- consola
1322
+ consola: consola2
1327
1323
  } = await import('consola');
1328
- consola.start(`Generating OSDK: ${args.packageName} at version: ${args.packageVersion}`);
1324
+ consola2.start(`Generating OSDK: ${args.packageName} at version: ${args.packageVersion}`);
1329
1325
  const ontologyRid = args.ontology;
1330
1326
  const ontologyMetadataResolver = new OntologyMetadataResolver(args.authToken, args.foundryHostname);
1331
1327
  if (!isValidSemver(args.packageVersion)) {
1332
- consola.error(new Error(`Invalid argument provided for packageVersion: ${args.packageVersion}, expected valid semver`));
1328
+ consola2.error(new Error(`Invalid argument provided for packageVersion: ${args.packageVersion}, expected valid semver`));
1333
1329
  exit(1);
1334
1330
  }
1335
1331
  const timeStart = Date.now();
@@ -1342,9 +1338,9 @@ var GeneratePackageCommand = class {
1342
1338
  });
1343
1339
  if (wireOntologyDefinition.isErr()) {
1344
1340
  wireOntologyDefinition.error.forEach((err) => {
1345
- consola.error(err);
1341
+ consola2.error(err);
1346
1342
  });
1347
- consola.error("Failed generating package");
1343
+ consola2.error("Failed generating package");
1348
1344
  exit(1);
1349
1345
  }
1350
1346
  await generatePackage(wireOntologyDefinition.value, {
@@ -1354,18 +1350,30 @@ var GeneratePackageCommand = class {
1354
1350
  beta: !!args.beta
1355
1351
  });
1356
1352
  const elapsedTime = Date.now() - timeStart;
1357
- consola.success(`Finished generating package in ${(elapsedTime / 1e3).toFixed(2)}s`);
1353
+ consola2.success(`Finished generating package in ${(elapsedTime / 1e3).toFixed(2)}s`);
1358
1354
  return;
1359
1355
  };
1360
1356
  };
1361
1357
 
1362
1358
  // src/cli/foundrySdkGeneratorCli.ts
1363
1359
  async function cli(args = process.argv) {
1364
- const base = yargs(hideBin(args)).command(new GeneratePackageCommand()).demandCommand().recommendCommands().strict().showHelpOnFail(true).help().version(process.env.npm_package_version);
1360
+ function createBase() {
1361
+ return yargs(hideBin(args)).command(new GeneratePackageCommand()).demandCommand().recommendCommands().strict().showHelpOnFail(true).help().version(process.env.npm_package_version);
1362
+ }
1365
1363
  try {
1366
- return base.parseAsync();
1364
+ return createBase().parseAsync(hideBin(args), {}, async (err, argv, output) => {
1365
+ if (argv.beta) {
1366
+ consola.warn("Beta flag is set, this feature may not be stable");
1367
+ const {
1368
+ cli: cli2
1369
+ } = await import('@osdk/main-foundry-sdk-generator');
1370
+ await cli2(args);
1371
+ } else {
1372
+ await createBase().parseAsync(hideBin(args));
1373
+ }
1374
+ });
1367
1375
  } catch (e) {
1368
- console.log(e);
1376
+ consola.error(e);
1369
1377
  }
1370
1378
  }
1371
1379