fern-api 0.16.22 → 0.16.24
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/bundle.cjs +71 -11
- package/package.json +1 -1
package/bundle.cjs
CHANGED
|
@@ -733501,6 +733501,9 @@ function getLanguageFromGeneratorName(generatorName) {
|
|
|
733501
733501
|
// pnp:/home/circleci/project/packages/cli/config-management/generators-configuration/lib/loadGeneratorsConfiguration.js
|
|
733502
733502
|
async function loadRawGeneratorsConfiguration({ absolutePathToWorkspace, context }) {
|
|
733503
733503
|
const filepath = getPathToGeneratorsConfiguration({ absolutePathToWorkspace });
|
|
733504
|
+
if (!await doesPathExist(filepath)) {
|
|
733505
|
+
return void 0;
|
|
733506
|
+
}
|
|
733504
733507
|
const contentsStr = await (0, import_promises8.readFile)(filepath);
|
|
733505
733508
|
const contentsParsed = js_yaml_default.load(contentsStr.toString());
|
|
733506
733509
|
return validateSchema({
|
|
@@ -733512,6 +733515,9 @@ async function loadRawGeneratorsConfiguration({ absolutePathToWorkspace, context
|
|
|
733512
733515
|
}
|
|
733513
733516
|
async function loadGeneratorsConfiguration({ absolutePathToWorkspace, context }) {
|
|
733514
733517
|
const rawGeneratorsConfiguration = await loadRawGeneratorsConfiguration({ absolutePathToWorkspace, context });
|
|
733518
|
+
if (rawGeneratorsConfiguration == null) {
|
|
733519
|
+
return void 0;
|
|
733520
|
+
}
|
|
733515
733521
|
return convertGeneratorsConfiguration({
|
|
733516
733522
|
absolutePathToGeneratorsConfiguration: getPathToGeneratorsConfiguration({ absolutePathToWorkspace }),
|
|
733517
733523
|
rawGeneratorsConfiguration
|
|
@@ -736945,7 +736951,7 @@ var AccessTokenPosthogManager = class {
|
|
|
736945
736951
|
properties: {
|
|
736946
736952
|
...event,
|
|
736947
736953
|
...event.properties,
|
|
736948
|
-
version: "0.16.
|
|
736954
|
+
version: "0.16.24",
|
|
736949
736955
|
usingAccessToken: true
|
|
736950
736956
|
}
|
|
736951
736957
|
});
|
|
@@ -737007,7 +737013,7 @@ var UserPosthogManager = class {
|
|
|
737007
737013
|
distinctId: this.userId ?? await this.getPersistedDistinctId(),
|
|
737008
737014
|
event: "CLI",
|
|
737009
737015
|
properties: {
|
|
737010
|
-
version: "0.16.
|
|
737016
|
+
version: "0.16.24",
|
|
737011
737017
|
...event,
|
|
737012
737018
|
...event.properties
|
|
737013
737019
|
}
|
|
@@ -749753,6 +749759,22 @@ function getQueryParameterTypeReference({ schema: schema2, context, fileContaini
|
|
|
749753
749759
|
allowMultiple: true
|
|
749754
749760
|
};
|
|
749755
749761
|
} else if (resolvedSchema.type === "oneOf" && resolvedSchema.oneOf.type === "undisciminated") {
|
|
749762
|
+
const literalValues = [];
|
|
749763
|
+
for (const [_4, schema3] of Object.entries(resolvedSchema.oneOf.schemas)) {
|
|
749764
|
+
if (schema3.type === "literal" && schema3.value.type === "string") {
|
|
749765
|
+
literalValues.push(schema3.value.string);
|
|
749766
|
+
}
|
|
749767
|
+
}
|
|
749768
|
+
if (literalValues.length > 0) {
|
|
749769
|
+
context.builder.addType(fileContainingReference, {
|
|
749770
|
+
name: schema2.generatedName,
|
|
749771
|
+
schema: { enum: literalValues }
|
|
749772
|
+
});
|
|
749773
|
+
return {
|
|
749774
|
+
value: schema2.generatedName,
|
|
749775
|
+
allowMultiple: false
|
|
749776
|
+
};
|
|
749777
|
+
}
|
|
749756
749778
|
for (const [_4, schema3] of Object.entries(resolvedSchema.oneOf.schemas)) {
|
|
749757
749779
|
return getQueryParameterTypeReference({
|
|
749758
749780
|
schema: schema3,
|
|
@@ -749796,6 +749818,22 @@ function getQueryParameterTypeReference({ schema: schema2, context, fileContaini
|
|
|
749796
749818
|
allowMultiple: true
|
|
749797
749819
|
};
|
|
749798
749820
|
} else if (schema2.value.type === "oneOf" && schema2.value.oneOf.type === "undisciminated") {
|
|
749821
|
+
const literalValues = [];
|
|
749822
|
+
for (const [_4, oneOfSchema] of Object.entries(schema2.value.oneOf.schemas)) {
|
|
749823
|
+
if (oneOfSchema.type === "literal" && oneOfSchema.value.type === "string") {
|
|
749824
|
+
literalValues.push(oneOfSchema.value.string);
|
|
749825
|
+
}
|
|
749826
|
+
}
|
|
749827
|
+
if (literalValues.length > 0) {
|
|
749828
|
+
context.builder.addType(fileContainingReference, {
|
|
749829
|
+
name: schema2.value.oneOf.generatedName,
|
|
749830
|
+
schema: { enum: literalValues }
|
|
749831
|
+
});
|
|
749832
|
+
return {
|
|
749833
|
+
value: `optional<${schema2.value.oneOf.generatedName}>`,
|
|
749834
|
+
allowMultiple: false
|
|
749835
|
+
};
|
|
749836
|
+
}
|
|
749799
749837
|
for (const [_4, oneOfSchema] of Object.entries(schema2.value.oneOf.schemas)) {
|
|
749800
749838
|
return getQueryParameterTypeReference({
|
|
749801
749839
|
schema: import_finalIr3.Schema.optional({ value: oneOfSchema, description: void 0, groupName: void 0 }),
|
|
@@ -751643,8 +751681,20 @@ function getAllProperties2({ schema: schema2, context, breadcrumbs }) {
|
|
|
751643
751681
|
var import_parseIr9 = __toESM(require_parseIr());
|
|
751644
751682
|
function convertUndiscriminatedOneOf({ nameOverride, generatedName, breadcrumbs, description, wrapAsNullable, context, subtypes, groupName }) {
|
|
751645
751683
|
const subtypePrefixes = getUniqueSubTypeNames({ schemas: subtypes });
|
|
751646
|
-
const convertedSubtypes = subtypes.
|
|
751647
|
-
|
|
751684
|
+
const convertedSubtypes = subtypes.flatMap((schema2, index2) => {
|
|
751685
|
+
if (!isReferenceObject(schema2) && schema2.enum != null) {
|
|
751686
|
+
return schema2.enum.map((enumValue) => {
|
|
751687
|
+
return import_parseIr9.SchemaWithExample.literal({
|
|
751688
|
+
value: {
|
|
751689
|
+
type: "string",
|
|
751690
|
+
string: enumValue
|
|
751691
|
+
},
|
|
751692
|
+
groupName: void 0,
|
|
751693
|
+
description: void 0
|
|
751694
|
+
});
|
|
751695
|
+
});
|
|
751696
|
+
}
|
|
751697
|
+
return [convertSchema(schema2, false, context, [...breadcrumbs, subtypePrefixes[index2] ?? `${index2}`])];
|
|
751648
751698
|
});
|
|
751649
751699
|
const uniqueSubtypes = [];
|
|
751650
751700
|
for (let i2 = 0; i2 < convertedSubtypes.length; ++i2) {
|
|
@@ -754715,12 +754765,16 @@ function validateStructureOfYamlFiles({ files, absolutePathToDefinition }) {
|
|
|
754715
754765
|
|
|
754716
754766
|
// pnp:/home/circleci/project/packages/cli/workspace-loader/lib/loadAPIWorkspace.js
|
|
754717
754767
|
async function loadAPIWorkspace({ absolutePathToWorkspace, context, cliVersion, workspaceName }) {
|
|
754718
|
-
|
|
754768
|
+
let generatorsConfiguration = void 0;
|
|
754769
|
+
try {
|
|
754770
|
+
generatorsConfiguration = await loadGeneratorsConfiguration({ absolutePathToWorkspace, context });
|
|
754771
|
+
} catch (err) {
|
|
754772
|
+
}
|
|
754719
754773
|
const absolutePathToOpenAPIFolder = join(absolutePathToWorkspace, RelativeFilePath.of(OPENAPI_DIRECTORY));
|
|
754720
754774
|
const openApiDirectoryExists = await doesPathExist(absolutePathToOpenAPIFolder);
|
|
754721
754775
|
const absolutePathToAsyncAPIFolder = join(absolutePathToWorkspace, RelativeFilePath.of(ASYNCAPI_DIRECTORY));
|
|
754722
754776
|
const asyncApiDirectoryExists = await doesPathExist(absolutePathToAsyncAPIFolder);
|
|
754723
|
-
if (generatorsConfiguration.absolutePathToOpenAPI != null) {
|
|
754777
|
+
if ((generatorsConfiguration == null ? void 0 : generatorsConfiguration.absolutePathToOpenAPI) != null) {
|
|
754724
754778
|
const absolutePathToAsyncAPI = generatorsConfiguration.absolutePathToAsyncAPI != null ? await getValidAbsolutePathToAsyncAPI(context, generatorsConfiguration.absolutePathToAsyncAPI) : void 0;
|
|
754725
754779
|
const absolutePathToOpenAPI = await getValidAbsolutePathToOpenAPI(context, generatorsConfiguration.absolutePathToOpenAPI);
|
|
754726
754780
|
return {
|
|
@@ -761566,10 +761620,10 @@ var CliContext = class {
|
|
|
761566
761620
|
return "fern-api";
|
|
761567
761621
|
}
|
|
761568
761622
|
getPackageVersion() {
|
|
761569
|
-
if ("0.16.
|
|
761623
|
+
if ("0.16.24" == null) {
|
|
761570
761624
|
this.logger.error("CLI_VERSION is not defined");
|
|
761571
761625
|
}
|
|
761572
|
-
return "0.16.
|
|
761626
|
+
return "0.16.24";
|
|
761573
761627
|
}
|
|
761574
761628
|
getCliName() {
|
|
761575
761629
|
if ("fern" == null) {
|
|
@@ -761889,13 +761943,14 @@ async function addGeneratorToWorkspaces({
|
|
|
761889
761943
|
await Promise.all(
|
|
761890
761944
|
apiWorkspaces.map(async (workspace) => {
|
|
761891
761945
|
await cliContext.runTaskForWorkspace(workspace, async (context) => {
|
|
761946
|
+
var _a2;
|
|
761892
761947
|
const generatorsConfiguration = await loadRawGeneratorsConfiguration({
|
|
761893
761948
|
absolutePathToWorkspace: workspace.absoluteFilepath,
|
|
761894
761949
|
context
|
|
761895
|
-
});
|
|
761950
|
+
}) ?? {};
|
|
761896
761951
|
const newConfiguration = addGenerator({ generatorName, generatorsConfiguration, groupName, context });
|
|
761897
761952
|
await (0, import_promises28.writeFile)(
|
|
761898
|
-
workspace.generatorsConfiguration.absolutePathToConfiguration,
|
|
761953
|
+
((_a2 = workspace.generatorsConfiguration) == null ? void 0 : _a2.absolutePathToConfiguration) ?? getPathToGeneratorsConfiguration({ absolutePathToWorkspace: workspace.absoluteFilepath }),
|
|
761899
761954
|
js_yaml_default.dump(newConfiguration)
|
|
761900
761955
|
);
|
|
761901
761956
|
context.logger.info(source_default.green(`Added ${generatorName} generator`));
|
|
@@ -777024,6 +777079,10 @@ async function generateWorkspace({
|
|
|
777024
777079
|
useLocalDocker,
|
|
777025
777080
|
keepDocker
|
|
777026
777081
|
}) {
|
|
777082
|
+
if (workspace.generatorsConfiguration == null) {
|
|
777083
|
+
context.logger.warn("This workspaces has no generators.yml");
|
|
777084
|
+
return;
|
|
777085
|
+
}
|
|
777027
777086
|
if (workspace.generatorsConfiguration.groups.length === 0) {
|
|
777028
777087
|
context.logger.warn(`This workspaces has no groups specified in ${GENERATORS_CONFIGURATION_FILENAME}`);
|
|
777029
777088
|
return;
|
|
@@ -777089,10 +777148,11 @@ async function generateAPIWorkspaces({
|
|
|
777089
777148
|
command: "fern generate",
|
|
777090
777149
|
properties: {
|
|
777091
777150
|
workspaces: project.apiWorkspaces.map((workspace) => {
|
|
777151
|
+
var _a2;
|
|
777092
777152
|
return {
|
|
777093
777153
|
name: workspace.name,
|
|
777094
777154
|
group: groupName,
|
|
777095
|
-
generators: workspace.generatorsConfiguration.groups.filter((group) => groupName == null ? true : group.groupName === groupName).map((group) => {
|
|
777155
|
+
generators: (_a2 = workspace.generatorsConfiguration) == null ? void 0 : _a2.groups.filter((group) => groupName == null ? true : group.groupName === groupName).map((group) => {
|
|
777096
777156
|
return group.generators.map((generator) => {
|
|
777097
777157
|
return {
|
|
777098
777158
|
name: generator.name,
|