@osdk/maker-experimental 0.89.0 → 0.90.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/CHANGELOG.md +6 -0
- package/build/browser/cli/main.js +14 -1
- package/build/browser/cli/main.js.map +1 -1
- package/build/browser/cli/writeOntologyBuildMetadata.js +43 -0
- package/build/browser/cli/writeOntologyBuildMetadata.js.map +1 -0
- package/build/cjs/index.cjs +90 -56
- package/build/cjs/index.cjs.map +1 -1
- package/build/esm/cli/main.js +14 -1
- package/build/esm/cli/main.js.map +1 -1
- package/build/esm/cli/writeOntologyBuildMetadata.js +43 -0
- package/build/esm/cli/writeOntologyBuildMetadata.js.map +1 -0
- package/build/types/cli/main.d.ts.map +1 -1
- package/build/types/cli/writeOntologyBuildMetadata.d.ts +9 -0
- package/build/types/cli/writeOntologyBuildMetadata.d.ts.map +1 -0
- package/package.json +6 -6
package/build/cjs/index.cjs
CHANGED
|
@@ -3,8 +3,8 @@
|
|
|
3
3
|
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
4
|
|
|
5
5
|
var chunkY53H6FV7_cjs = require('./chunk-Y53H6FV7.cjs');
|
|
6
|
-
var
|
|
7
|
-
var
|
|
6
|
+
var fs8 = require('fs');
|
|
7
|
+
var path7 = require('path');
|
|
8
8
|
var url = require('url');
|
|
9
9
|
var generatorConverters_ontologyir = require('@osdk/generator-converters.ontologyir');
|
|
10
10
|
var generatorConverters_preview = require('@osdk/generator-converters.preview');
|
|
@@ -14,7 +14,8 @@ var invariant7 = require('tiny-invariant');
|
|
|
14
14
|
var yargs = require('yargs');
|
|
15
15
|
var helpers = require('yargs/helpers');
|
|
16
16
|
var makerImport = require('@osdk/maker-import');
|
|
17
|
-
var
|
|
17
|
+
var fs7 = require('fs/promises');
|
|
18
|
+
var crypto = require('crypto');
|
|
18
19
|
|
|
19
20
|
function _interopDefault (e) { return e && e.__esModule ? e : { default: e }; }
|
|
20
21
|
|
|
@@ -36,12 +37,12 @@ function _interopNamespace(e) {
|
|
|
36
37
|
return Object.freeze(n);
|
|
37
38
|
}
|
|
38
39
|
|
|
39
|
-
var
|
|
40
|
-
var
|
|
40
|
+
var fs8__namespace = /*#__PURE__*/_interopNamespace(fs8);
|
|
41
|
+
var path7__namespace = /*#__PURE__*/_interopNamespace(path7);
|
|
41
42
|
var consola__default = /*#__PURE__*/_interopDefault(consola);
|
|
42
43
|
var invariant7__default = /*#__PURE__*/_interopDefault(invariant7);
|
|
43
44
|
var yargs__default = /*#__PURE__*/_interopDefault(yargs);
|
|
44
|
-
var
|
|
45
|
+
var fs7__namespace = /*#__PURE__*/_interopNamespace(fs7);
|
|
45
46
|
|
|
46
47
|
// src/conversion/toMarketplace/collectInterfaceDefinitions.ts
|
|
47
48
|
function collectInterfaceDefinitions(interfaces) {
|
|
@@ -6812,11 +6813,11 @@ function generateFolderBlockResults(folderDefinitions, buildDir, randomnessKey)
|
|
|
6812
6813
|
idToInputGroupId: {},
|
|
6813
6814
|
outputToLocationInput: Object.fromEntries(Array.from(folderLocations.outputToLocationInput, ([output, input]) => [chunkY53H6FV7_cjs.toBlockShapeId(output, randomnessKey), input]))
|
|
6814
6815
|
};
|
|
6815
|
-
const blockDataDirectory =
|
|
6816
|
-
await
|
|
6816
|
+
const blockDataDirectory = path7__namespace.resolve(buildDir, folder.blockIdentifier);
|
|
6817
|
+
await fs7__namespace.mkdir(blockDataDirectory, {
|
|
6817
6818
|
recursive: true
|
|
6818
6819
|
});
|
|
6819
|
-
await
|
|
6820
|
+
await fs7__namespace.writeFile(path7__namespace.join(blockDataDirectory, "VERSION"), JSON.stringify("v1"));
|
|
6820
6821
|
return {
|
|
6821
6822
|
block_identifier: folder.blockIdentifier,
|
|
6822
6823
|
block_data_directory: blockDataDirectory,
|
|
@@ -6869,7 +6870,7 @@ async function defineOntologyV2(ns, body, outputDir, dependencyFile, functionsIr
|
|
|
6869
6870
|
const folderDefinitions = resolveFolderDefinitions(maker.getFolderDefinitions(), ontologyDefinition);
|
|
6870
6871
|
let functionsIr;
|
|
6871
6872
|
if (functionsIrFile) {
|
|
6872
|
-
functionsIr = JSON.parse(
|
|
6873
|
+
functionsIr = JSON.parse(fs8__namespace.readFileSync(functionsIrFile, "utf-8"));
|
|
6873
6874
|
}
|
|
6874
6875
|
const ridGenerator = new chunkY53H6FV7_cjs.OntologyRidGeneratorImpl(importedTypes, randomnessKey);
|
|
6875
6876
|
const ontologyIr = convertOntologyDefinition(ontologyDefinition, ridGenerator, functionsIr, randomnessKey, packagingOptions.targetEnvironment === "EDGE");
|
|
@@ -7288,8 +7289,8 @@ async function generateBackingDatasetBlock(datasetName, blockIdentifier, dirSuff
|
|
|
7288
7289
|
idToInputGroupId: {},
|
|
7289
7290
|
outputToLocationInput: Object.fromEntries(Array.from(folderLocations.outputToLocationInput, ([output, input]) => [chunkY53H6FV7_cjs.toBlockShapeId(output, randomnessKey), input]))
|
|
7290
7291
|
};
|
|
7291
|
-
const dsBlockDataDir =
|
|
7292
|
-
await
|
|
7292
|
+
const dsBlockDataDir = path7__namespace.join(buildDir, `temp_block_data_${dirSuffix}`);
|
|
7293
|
+
await fs8__namespace.promises.mkdir(dsBlockDataDir, {
|
|
7293
7294
|
recursive: true
|
|
7294
7295
|
});
|
|
7295
7296
|
const schemaJson = {
|
|
@@ -7301,7 +7302,7 @@ async function generateBackingDatasetBlock(datasetName, blockIdentifier, dirSuff
|
|
|
7301
7302
|
options: {}
|
|
7302
7303
|
}
|
|
7303
7304
|
};
|
|
7304
|
-
await
|
|
7305
|
+
await fs8__namespace.promises.writeFile(path7__namespace.join(dsBlockDataDir, "schema.json"), JSON.stringify(schemaJson, null, 2));
|
|
7305
7306
|
const blockDataJson = {
|
|
7306
7307
|
type: "v1",
|
|
7307
7308
|
v1: {
|
|
@@ -7310,10 +7311,10 @@ async function generateBackingDatasetBlock(datasetName, blockIdentifier, dirSuff
|
|
|
7310
7311
|
includeData: false
|
|
7311
7312
|
}
|
|
7312
7313
|
};
|
|
7313
|
-
await
|
|
7314
|
-
await
|
|
7314
|
+
await fs8__namespace.promises.writeFile(path7__namespace.join(dsBlockDataDir, "block-data.json"), JSON.stringify(blockDataJson, null, 2));
|
|
7315
|
+
await fs8__namespace.promises.writeFile(path7__namespace.join(dsBlockDataDir, "VERSION"), '"1"');
|
|
7315
7316
|
const emptyZip = Buffer.from([80, 75, 5, 6, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0]);
|
|
7316
|
-
await
|
|
7317
|
+
await fs8__namespace.promises.writeFile(path7__namespace.join(dsBlockDataDir, "files.zip"), emptyZip);
|
|
7317
7318
|
return {
|
|
7318
7319
|
block_identifier: blockIdentifier,
|
|
7319
7320
|
block_data_directory: dsBlockDataDir,
|
|
@@ -7378,15 +7379,15 @@ async function generateBackingMediaSetBlockResult(mediaSetName, buildDir, random
|
|
|
7378
7379
|
const outputBlockShapeId = chunkY53H6FV7_cjs.toBlockShapeId(outputReadableId, randomnessKey);
|
|
7379
7380
|
const compassBlockShapeId = chunkY53H6FV7_cjs.toBlockShapeId(compassReadableId, randomnessKey);
|
|
7380
7381
|
const mediaSetTemplateId = chunkY53H6FV7_cjs.toBlockShapeId(`media-set-template-${mediaSetName}`, randomnessKey);
|
|
7381
|
-
const blockDataDirectory =
|
|
7382
|
-
await
|
|
7382
|
+
const blockDataDirectory = path7__namespace.join(buildDir, `temp_block_data_${chunkY53H6FV7_cjs.toBlockShapeId(blockIdentifier, randomnessKey)}`);
|
|
7383
|
+
await fs8__namespace.promises.rm(blockDataDirectory, {
|
|
7383
7384
|
force: true,
|
|
7384
7385
|
recursive: true
|
|
7385
7386
|
});
|
|
7386
|
-
await
|
|
7387
|
+
await fs8__namespace.promises.mkdir(blockDataDirectory, {
|
|
7387
7388
|
recursive: true
|
|
7388
7389
|
});
|
|
7389
|
-
await Promise.all([
|
|
7390
|
+
await Promise.all([fs8__namespace.promises.writeFile(path7__namespace.join(blockDataDirectory, "metadata.json"), JSON.stringify(createMediaSetBlockData(mediaSetTemplateId), null, 2)), fs8__namespace.promises.writeFile(path7__namespace.join(blockDataDirectory, "VERSION"), '"1"')]);
|
|
7390
7391
|
const about = createLocalizedAbout5(blockIdentifier);
|
|
7391
7392
|
const inputs = {
|
|
7392
7393
|
[compassReadableId]: {
|
|
@@ -7606,12 +7607,12 @@ async function generateDirectDatasourceBlockResult(objectType, buildDir, randomn
|
|
|
7606
7607
|
};
|
|
7607
7608
|
const idToBlockShapeId = Object.fromEntries(Object.keys(outputs).map((readableId) => [readableId, chunkY53H6FV7_cjs.toBlockShapeId(readableId, randomnessKey)]));
|
|
7608
7609
|
idToBlockShapeId[DIRECT_SOURCE_INTERNAL_SHAPE_ID] = producedDatasourceBlockShapeId;
|
|
7609
|
-
const blockDataDirectory =
|
|
7610
|
-
await
|
|
7610
|
+
const blockDataDirectory = path7__namespace.join(buildDir, `temp_direct_datasource_${objectType.objectType.id}`);
|
|
7611
|
+
await fs8__namespace.promises.mkdir(blockDataDirectory, {
|
|
7611
7612
|
recursive: true
|
|
7612
7613
|
});
|
|
7613
|
-
await
|
|
7614
|
-
await
|
|
7614
|
+
await fs8__namespace.promises.writeFile(path7__namespace.join(blockDataDirectory, "block-data.json"), JSON.stringify(blockData, null, 2));
|
|
7615
|
+
await fs8__namespace.promises.writeFile(path7__namespace.join(blockDataDirectory, "VERSION"), JSON.stringify("1.0"));
|
|
7615
7616
|
return {
|
|
7616
7617
|
block_identifier: `direct-datasource-${objectType.objectType.rid}`,
|
|
7617
7618
|
block_data_directory: blockDataDirectory,
|
|
@@ -7638,13 +7639,13 @@ async function generateValueTypeBlockResults(valueTypeBlocks, buildDir, randomne
|
|
|
7638
7639
|
dependencies: rawDependencies
|
|
7639
7640
|
} of valueTypeBlocks) {
|
|
7640
7641
|
const blockIdentifier = "value-type-" + entry.metadata.apiName;
|
|
7641
|
-
const outputDir =
|
|
7642
|
-
if (!
|
|
7643
|
-
await
|
|
7642
|
+
const outputDir = path7__namespace.join(buildDir, blockIdentifier);
|
|
7643
|
+
if (!fs8__namespace.existsSync(outputDir)) {
|
|
7644
|
+
await fs8__namespace.promises.mkdir(outputDir, {
|
|
7644
7645
|
recursive: true
|
|
7645
7646
|
});
|
|
7646
7647
|
}
|
|
7647
|
-
await
|
|
7648
|
+
await fs8__namespace.promises.writeFile(path7__namespace.join(outputDir, "value-types.json"), JSON.stringify(entry, null, 2));
|
|
7648
7649
|
const outputs = buildOutputShapes(entry);
|
|
7649
7650
|
const idToBlockShapeId = Object.fromEntries(Array.from(outputs.keys(), (readableId) => [readableId, chunkY53H6FV7_cjs.toBlockShapeId(readableId, randomnessKey)]));
|
|
7650
7651
|
const dependencies = buildDependencies(rawDependencies, producedValueTypes, randomnessKey);
|
|
@@ -7793,32 +7794,55 @@ function getValueTypeInternalMappings(producedValueTypes, inputShapes) {
|
|
|
7793
7794
|
}
|
|
7794
7795
|
return mappings;
|
|
7795
7796
|
}
|
|
7797
|
+
async function writeOntologyBuildMetadata(output, ontologyIr) {
|
|
7798
|
+
const snapshot = {
|
|
7799
|
+
schemaVersion: 1,
|
|
7800
|
+
importedOntology: ontologyIr.importedOntology,
|
|
7801
|
+
transitiveImportedOntology: ontologyIr.transitiveImportedOntology,
|
|
7802
|
+
importedValueTypes: ontologyIr.importedValueTypes
|
|
7803
|
+
};
|
|
7804
|
+
const contents = JSON.stringify(snapshot, null, 2);
|
|
7805
|
+
await fs7__namespace.mkdir(path7__namespace.dirname(output), {
|
|
7806
|
+
recursive: true
|
|
7807
|
+
});
|
|
7808
|
+
const temporaryFile = `${output}.${crypto.randomUUID()}.tmp`;
|
|
7809
|
+
try {
|
|
7810
|
+
await fs7__namespace.writeFile(temporaryFile, contents, {
|
|
7811
|
+
flag: "wx"
|
|
7812
|
+
});
|
|
7813
|
+
await fs7__namespace.rename(temporaryFile, output);
|
|
7814
|
+
} finally {
|
|
7815
|
+
await fs7__namespace.rm(temporaryFile, {
|
|
7816
|
+
force: true
|
|
7817
|
+
});
|
|
7818
|
+
}
|
|
7819
|
+
}
|
|
7796
7820
|
|
|
7797
7821
|
// src/cli/main.ts
|
|
7798
7822
|
var apiNamespaceRegex = /^[a-z0-9-]+(\.[a-z0-9-]+)*\.$/u;
|
|
7799
7823
|
var uuidRegex = /^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/u;
|
|
7800
7824
|
async function main(args = process.argv) {
|
|
7801
7825
|
consola.consola.log("Generating BlockGeneratorResult for ontology...");
|
|
7802
|
-
const commandLineOpts = await yargs__default.default(helpers.hideBin(args)).version("0.
|
|
7826
|
+
const commandLineOpts = await yargs__default.default(helpers.hideBin(args)).version("0.90.0").wrap(Math.min(150, yargs__default.default().terminalWidth())).strict().help().options({
|
|
7803
7827
|
input: {
|
|
7804
7828
|
alias: "i",
|
|
7805
7829
|
describe: "Input file",
|
|
7806
7830
|
type: "string",
|
|
7807
7831
|
default: ".ontology/ontology.ts",
|
|
7808
|
-
coerce:
|
|
7832
|
+
coerce: path7__namespace.resolve
|
|
7809
7833
|
},
|
|
7810
7834
|
output: {
|
|
7811
7835
|
alias: "o",
|
|
7812
7836
|
describe: "Output file for ontology BlockGeneratorResult JSON",
|
|
7813
7837
|
type: "string",
|
|
7814
7838
|
default: "build/block_generator_result.json",
|
|
7815
|
-
coerce:
|
|
7839
|
+
coerce: path7__namespace.resolve
|
|
7816
7840
|
},
|
|
7817
7841
|
valueTypesOutput: {
|
|
7818
7842
|
describe: "Output file for value types BlockGeneratorResult JSON",
|
|
7819
7843
|
type: "string",
|
|
7820
7844
|
default: "build/value_types_block_generator_result.json",
|
|
7821
|
-
coerce:
|
|
7845
|
+
coerce: path7__namespace.resolve
|
|
7822
7846
|
},
|
|
7823
7847
|
apiNamespace: {
|
|
7824
7848
|
describe: "Api name prefix for namespaced ontology types",
|
|
@@ -7835,31 +7859,31 @@ async function main(args = process.argv) {
|
|
|
7835
7859
|
describe: "Directory for build files",
|
|
7836
7860
|
type: "string",
|
|
7837
7861
|
default: "build/",
|
|
7838
|
-
coerce:
|
|
7862
|
+
coerce: path7__namespace.resolve
|
|
7839
7863
|
},
|
|
7840
7864
|
codegenDir: {
|
|
7841
7865
|
alias: "c",
|
|
7842
7866
|
describe: "Output directory for generated TypeScript files (defaults to the parent of the input file's directory)",
|
|
7843
7867
|
type: "string",
|
|
7844
|
-
coerce:
|
|
7868
|
+
coerce: path7__namespace.resolve
|
|
7845
7869
|
},
|
|
7846
7870
|
temporaryBlockDataFile: {
|
|
7847
7871
|
alias: "f",
|
|
7848
7872
|
describe: "Path to a previously generated block data file. Supplying this field indicates that function backed actions should be generated",
|
|
7849
7873
|
type: "string",
|
|
7850
|
-
coerce:
|
|
7874
|
+
coerce: path7__namespace.resolve
|
|
7851
7875
|
},
|
|
7852
7876
|
functionsDir: {
|
|
7853
7877
|
type: "string",
|
|
7854
|
-
coerce:
|
|
7878
|
+
coerce: path7__namespace.resolve
|
|
7855
7879
|
},
|
|
7856
7880
|
nodeModulesDir: {
|
|
7857
7881
|
type: "string",
|
|
7858
|
-
coerce:
|
|
7882
|
+
coerce: path7__namespace.resolve
|
|
7859
7883
|
},
|
|
7860
7884
|
functionsIrOutputFile: {
|
|
7861
7885
|
type: "string",
|
|
7862
|
-
coerce:
|
|
7886
|
+
coerce: path7__namespace.resolve
|
|
7863
7887
|
},
|
|
7864
7888
|
randomnessKey: {
|
|
7865
7889
|
describe: "Value used to assure uniqueness of entities",
|
|
@@ -7868,13 +7892,19 @@ async function main(args = process.argv) {
|
|
|
7868
7892
|
"import-json": {
|
|
7869
7893
|
describe: "Path to imported ontology metadata produced by 'foundry import ontology'",
|
|
7870
7894
|
type: "string",
|
|
7871
|
-
coerce:
|
|
7895
|
+
coerce: path7__namespace.resolve
|
|
7896
|
+
},
|
|
7897
|
+
importedBlockDataOutput: {
|
|
7898
|
+
describe: "Output file for a versioned snapshot of native imported ontology build metadata",
|
|
7899
|
+
type: "string",
|
|
7900
|
+
coerce: path7__namespace.resolve,
|
|
7901
|
+
requiresArg: true
|
|
7872
7902
|
},
|
|
7873
7903
|
lockfile: {
|
|
7874
7904
|
describe: `Ontology schema lockfile path (default: ${maker.DEFAULT_ONTOLOGY_SCHEMA_LOCKFILE_NAME} beside --input)`,
|
|
7875
7905
|
type: "string",
|
|
7876
7906
|
// No `default`: it depends on --input, which `coerce` cannot see. Resolved after parsing.
|
|
7877
|
-
coerce:
|
|
7907
|
+
coerce: path7__namespace.resolve
|
|
7878
7908
|
},
|
|
7879
7909
|
writeLocks: {
|
|
7880
7910
|
describe: "Update the ontology schema lockfile instead of failing when it is out of date",
|
|
@@ -7914,12 +7944,12 @@ async function main(args = process.argv) {
|
|
|
7914
7944
|
if (commandLineOpts.randomnessKey !== void 0) {
|
|
7915
7945
|
!uuidRegex.test(commandLineOpts.randomnessKey) ? process.env.NODE_ENV !== "production" ? invariant7__default.default(false, "Supplied randomness key is not a uuid and shouldn't be used as a uniqueness guarantee") : invariant7__default.default(false) : void 0;
|
|
7916
7946
|
}
|
|
7917
|
-
const lockfilePath = commandLineOpts.lockfile ??
|
|
7918
|
-
const externalImportedMetadata = commandLineOpts.importJson &&
|
|
7947
|
+
const lockfilePath = commandLineOpts.lockfile ?? path7__namespace.join(path7__namespace.dirname(commandLineOpts.input), maker.DEFAULT_ONTOLOGY_SCHEMA_LOCKFILE_NAME);
|
|
7948
|
+
const externalImportedMetadata = commandLineOpts.importJson && fs8__namespace.existsSync(commandLineOpts.importJson) ? JSON.parse(await fs8__namespace.promises.readFile(commandLineOpts.importJson, "utf-8")) : void 0;
|
|
7919
7949
|
let functionsIrFile;
|
|
7920
7950
|
if (commandLineOpts.temporaryBlockDataFile) {
|
|
7921
7951
|
consola.consola.info(`Loading temporary block data from ${commandLineOpts.temporaryBlockDataFile}`);
|
|
7922
|
-
const fileContent = await
|
|
7952
|
+
const fileContent = await fs8__namespace.promises.readFile(commandLineOpts.temporaryBlockDataFile, "utf-8");
|
|
7923
7953
|
let blockDataJson;
|
|
7924
7954
|
try {
|
|
7925
7955
|
blockDataJson = JSON.parse(fileContent);
|
|
@@ -7933,10 +7963,10 @@ async function main(args = process.argv) {
|
|
|
7933
7963
|
functionsIrFile = commandLineOpts.functionsIrOutputFile;
|
|
7934
7964
|
consola.consola.info(`Discovered functions during block data generation at ${commandLineOpts.functionsIrOutputFile}`);
|
|
7935
7965
|
}
|
|
7936
|
-
const codegenDir = commandLineOpts.codegenDir ??
|
|
7937
|
-
const dependencyFile =
|
|
7938
|
-
if (!
|
|
7939
|
-
await
|
|
7966
|
+
const codegenDir = commandLineOpts.codegenDir ?? path7__namespace.dirname(path7__namespace.dirname(commandLineOpts.input));
|
|
7967
|
+
const dependencyFile = path7__namespace.join(commandLineOpts.buildDir, "dependencies.json");
|
|
7968
|
+
if (!fs8__namespace.existsSync(dependencyFile)) {
|
|
7969
|
+
await fs8__namespace.promises.mkdir(commandLineOpts.buildDir, {
|
|
7940
7970
|
recursive: true
|
|
7941
7971
|
});
|
|
7942
7972
|
}
|
|
@@ -7973,22 +8003,22 @@ async function main(args = process.argv) {
|
|
|
7973
8003
|
assumeYes: commandLineOpts.yes ?? false
|
|
7974
8004
|
})
|
|
7975
8005
|
);
|
|
7976
|
-
const blockDataDir =
|
|
7977
|
-
if (!
|
|
7978
|
-
await
|
|
8006
|
+
const blockDataDir = path7__namespace.join(commandLineOpts.buildDir, "temp_block_data");
|
|
8007
|
+
if (!fs8__namespace.existsSync(blockDataDir)) {
|
|
8008
|
+
await fs8__namespace.promises.mkdir(blockDataDir, {
|
|
7979
8009
|
recursive: true
|
|
7980
8010
|
});
|
|
7981
8011
|
}
|
|
7982
|
-
const ontologyJsonPath =
|
|
8012
|
+
const ontologyJsonPath = path7__namespace.join(blockDataDir, "ontology.json");
|
|
7983
8013
|
const ontologyJson = JSON.stringify(ontologyIr.ontology, null, 2);
|
|
7984
|
-
await
|
|
8014
|
+
await fs8__namespace.promises.writeFile(ontologyJsonPath, ontologyJson);
|
|
7985
8015
|
consola.consola.info(`Wrote ontology.json to ${ontologyJsonPath}`);
|
|
7986
8016
|
const importedMetadata = generatorConverters_ontologyir.OntologyBlockDataToFullMetadataConverter.getFullMetadataFromBlockData(ontologyIr.importedOntology, void 0, ontologyIr.transitiveImportedOntology);
|
|
7987
8017
|
const directlyImportedInterfaceTypes = Object.values(ontologyIr.importedOntology.interfaceTypes).map(({
|
|
7988
8018
|
interfaceType
|
|
7989
8019
|
}) => interfaceType.apiName);
|
|
7990
|
-
const importedMetadataPath =
|
|
7991
|
-
await
|
|
8020
|
+
const importedMetadataPath = path7__namespace.join(commandLineOpts.buildDir, "oac-imported-metadata.json");
|
|
8021
|
+
await fs8__namespace.promises.writeFile(importedMetadataPath, JSON.stringify({
|
|
7992
8022
|
...importedMetadata,
|
|
7993
8023
|
directlyImportedInterfaceTypes
|
|
7994
8024
|
}, null, 2));
|
|
@@ -8097,14 +8127,18 @@ async function main(args = process.argv) {
|
|
|
8097
8127
|
block_type: "ONTOLOGY"
|
|
8098
8128
|
};
|
|
8099
8129
|
const blockGeneratorResultJson = JSON.stringify([blockGeneratorResult, ...folderResults, ...directDatasourceGeneratorResults, ...backingDsGeneratorResults, ...backingDsLinkGeneratorResults, ...backingMediaSetGeneratorResults, ...valueTypeResults], null, 2);
|
|
8100
|
-
await
|
|
8130
|
+
await fs8__namespace.promises.writeFile(commandLineOpts.output, blockGeneratorResultJson);
|
|
8101
8131
|
consola.consola.success(`BlockGeneratorResult written to ${commandLineOpts.output}`);
|
|
8102
8132
|
consola.consola.info(`Block data directory: ${blockDataDir}`);
|
|
8103
8133
|
if (valueTypeResults.length > 0) {
|
|
8104
8134
|
const valueTypeResultsJson = JSON.stringify(valueTypeResults, null, 2);
|
|
8105
|
-
await
|
|
8135
|
+
await fs8__namespace.promises.writeFile(commandLineOpts.valueTypesOutput, valueTypeResultsJson);
|
|
8106
8136
|
consola.consola.success(`Value type BlockGeneratorResult written to ${commandLineOpts.valueTypesOutput}`);
|
|
8107
8137
|
}
|
|
8138
|
+
if (commandLineOpts.importedBlockDataOutput !== void 0) {
|
|
8139
|
+
await writeOntologyBuildMetadata(commandLineOpts.importedBlockDataOutput, ontologyIr);
|
|
8140
|
+
consola.consola.success(`Ontology build metadata written to ${commandLineOpts.importedBlockDataOutput}`);
|
|
8141
|
+
}
|
|
8108
8142
|
}
|
|
8109
8143
|
function logLevelFor(verbosity) {
|
|
8110
8144
|
if (verbosity === 0) return consola.LogLevels.info;
|