fern-api 0.39.18 → 0.39.19
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 +63 -28
- package/package.json +1 -1
package/bundle.cjs
CHANGED
|
@@ -1192625,7 +1192625,7 @@ var AccessTokenPosthogManager = class {
|
|
|
1192625
1192625
|
properties: {
|
|
1192626
1192626
|
...event,
|
|
1192627
1192627
|
...event.properties,
|
|
1192628
|
-
version: "0.39.
|
|
1192628
|
+
version: "0.39.19",
|
|
1192629
1192629
|
usingAccessToken: true
|
|
1192630
1192630
|
}
|
|
1192631
1192631
|
});
|
|
@@ -1192687,7 +1192687,7 @@ var UserPosthogManager = class {
|
|
|
1192687
1192687
|
distinctId: this.userId ?? await this.getPersistedDistinctId(),
|
|
1192688
1192688
|
event: "CLI",
|
|
1192689
1192689
|
properties: {
|
|
1192690
|
-
version: "0.39.
|
|
1192690
|
+
version: "0.39.19",
|
|
1192691
1192691
|
...event,
|
|
1192692
1192692
|
...event.properties
|
|
1192693
1192693
|
}
|
|
@@ -1197750,10 +1197750,10 @@ var CliContext = class {
|
|
|
1197750
1197750
|
return "fern-api";
|
|
1197751
1197751
|
}
|
|
1197752
1197752
|
getPackageVersion() {
|
|
1197753
|
-
if ("0.39.
|
|
1197753
|
+
if ("0.39.19" == null) {
|
|
1197754
1197754
|
this.logger.error("CLI_VERSION is not defined");
|
|
1197755
1197755
|
}
|
|
1197756
|
-
return "0.39.
|
|
1197756
|
+
return "0.39.19";
|
|
1197757
1197757
|
}
|
|
1197758
1197758
|
getCliName() {
|
|
1197759
1197759
|
if ("fern" == null) {
|
|
@@ -1215933,17 +1215933,27 @@ var ExampleTypeFactory = class {
|
|
|
1215933
1215933
|
const fullExample = getFullExampleAsObject(example);
|
|
1215934
1215934
|
const exampleDiscriminant = fullExample == null ? void 0 : fullExample[schema2.value.discriminantProperty];
|
|
1215935
1215935
|
const exampleUnionVariantSchema = schema2.value.schemas[exampleDiscriminant];
|
|
1215936
|
-
const
|
|
1215937
|
-
|
|
1215938
|
-
|
|
1215939
|
-
|
|
1215940
|
-
|
|
1215941
|
-
|
|
1215942
|
-
|
|
1215943
|
-
|
|
1215944
|
-
|
|
1215945
|
-
|
|
1215946
|
-
|
|
1215936
|
+
const unionVariants = [];
|
|
1215937
|
+
const schemaFromExample = this.getDiscriminatedUnionVariantSchema(schema2.value, fullExample);
|
|
1215938
|
+
if (schemaFromExample != null) {
|
|
1215939
|
+
unionVariants.push(schemaFromExample);
|
|
1215940
|
+
}
|
|
1215941
|
+
unionVariants.push(...Object.entries(schema2.value.schemas));
|
|
1215942
|
+
for (const unionVariant of unionVariants) {
|
|
1215943
|
+
if (exampleDiscriminant != null && exampleUnionVariantSchema != null && exampleUnionVariantSchema.type === "object") {
|
|
1215944
|
+
allProperties = this.getAllProperties(exampleUnionVariantSchema);
|
|
1215945
|
+
requiredProperties = this.getAllRequiredProperties(exampleUnionVariantSchema);
|
|
1215946
|
+
result[schema2.value.discriminantProperty] = FullExample.primitive(PrimitiveExample.string(exampleDiscriminant));
|
|
1215947
|
+
break;
|
|
1215948
|
+
} else {
|
|
1215949
|
+
const objectSchema = this.getObjectSchema(unionVariant[1]);
|
|
1215950
|
+
if (objectSchema == null) {
|
|
1215951
|
+
continue;
|
|
1215952
|
+
}
|
|
1215953
|
+
allProperties = this.getAllProperties(objectSchema);
|
|
1215954
|
+
requiredProperties = this.getAllRequiredProperties(objectSchema);
|
|
1215955
|
+
result[schema2.value.discriminantProperty] = FullExample.primitive(PrimitiveExample.string(unionVariant[0]));
|
|
1215956
|
+
}
|
|
1215947
1215957
|
}
|
|
1215948
1215958
|
for (const commonProperty of schema2.value.commonProperties) {
|
|
1215949
1215959
|
allProperties[commonProperty.key] = commonProperty.schema;
|
|
@@ -1216169,6 +1216179,18 @@ var ExampleTypeFactory = class {
|
|
|
1216169
1216179
|
assertNever(schema2);
|
|
1216170
1216180
|
}
|
|
1216171
1216181
|
}
|
|
1216182
|
+
getObjectSchema(schema2) {
|
|
1216183
|
+
if (schema2.type === "object") {
|
|
1216184
|
+
return schema2;
|
|
1216185
|
+
}
|
|
1216186
|
+
if (schema2.type === "reference") {
|
|
1216187
|
+
const referenceDeclaration = this.schemas[schema2.schema];
|
|
1216188
|
+
if (referenceDeclaration != null) {
|
|
1216189
|
+
return this.getObjectSchema(referenceDeclaration);
|
|
1216190
|
+
}
|
|
1216191
|
+
}
|
|
1216192
|
+
return void 0;
|
|
1216193
|
+
}
|
|
1216172
1216194
|
getDiscriminatedUnionVariantSchema(schema2, fullExample) {
|
|
1216173
1216195
|
const discriminantValue = fullExample == null ? void 0 : fullExample[schema2.discriminantProperty];
|
|
1216174
1216196
|
if (discriminantValue == null || typeof discriminantValue !== "string") {
|
|
@@ -1249672,7 +1249694,7 @@ async function getPreviewDocsDefinition({ domain: domain2, project, context }) {
|
|
|
1249672
1249694
|
throw new Error("No docs workspace found in project");
|
|
1249673
1249695
|
}
|
|
1249674
1249696
|
const fernWorkspaces = await Promise.all(apiWorkspaces.map(async (workspace) => await workspace.toFernWorkspace({ context }, { enableUniqueErrorsPerEndpoint: true, detectGlobalHeaders: false })));
|
|
1249675
|
-
const apiCollector = new ReferencedAPICollector();
|
|
1249697
|
+
const apiCollector = new ReferencedAPICollector(context);
|
|
1249676
1249698
|
const filesV2 = {};
|
|
1249677
1249699
|
const resolver2 = new DocsDefinitionResolver(domain2, docsWorkspace, fernWorkspaces, context, void 0, async (files) => files.map((file) => {
|
|
1249678
1249700
|
const fileId = v4();
|
|
@@ -1249704,20 +1249726,33 @@ async function getPreviewDocsDefinition({ domain: domain2, project, context }) {
|
|
|
1249704
1249726
|
};
|
|
1249705
1249727
|
}
|
|
1249706
1249728
|
var ReferencedAPICollector = class {
|
|
1249729
|
+
context;
|
|
1249707
1249730
|
apis = {};
|
|
1249731
|
+
constructor(context) {
|
|
1249732
|
+
this.context = context;
|
|
1249733
|
+
}
|
|
1249708
1249734
|
addReferencedAPI({ ir, snippetsConfig }) {
|
|
1249709
|
-
|
|
1249710
|
-
|
|
1249711
|
-
|
|
1249712
|
-
|
|
1249713
|
-
|
|
1249714
|
-
|
|
1249715
|
-
|
|
1249716
|
-
|
|
1249717
|
-
|
|
1249718
|
-
|
|
1249719
|
-
|
|
1249720
|
-
|
|
1249735
|
+
try {
|
|
1249736
|
+
const id = v4();
|
|
1249737
|
+
const apiDefinition = convertIrToFdrApi({ ir, snippetsConfig });
|
|
1249738
|
+
const dbApiDefinition = convertAPIDefinitionToDb(apiDefinition, id, new SDKSnippetHolder({
|
|
1249739
|
+
snippetsConfigWithSdkId: {},
|
|
1249740
|
+
snippetsBySdkId: {},
|
|
1249741
|
+
snippetTemplatesByEndpoint: {},
|
|
1249742
|
+
snippetTemplatesByEndpointId: {},
|
|
1249743
|
+
snippetsBySdkIdAndEndpointId: {}
|
|
1249744
|
+
}));
|
|
1249745
|
+
const readApiDefinition = convertDbAPIDefinitionToRead(dbApiDefinition);
|
|
1249746
|
+
this.apis[id] = readApiDefinition;
|
|
1249747
|
+
return id;
|
|
1249748
|
+
} catch (e) {
|
|
1249749
|
+
const err = e;
|
|
1249750
|
+
this.context.logger.error(`Failed to read referenced API: ${err == null ? void 0 : err.message}`);
|
|
1249751
|
+
if (err.stack != null) {
|
|
1249752
|
+
this.context.logger.error(err == null ? void 0 : err.stack);
|
|
1249753
|
+
}
|
|
1249754
|
+
throw e;
|
|
1249755
|
+
}
|
|
1249721
1249756
|
}
|
|
1249722
1249757
|
getAPIsForDefinition() {
|
|
1249723
1249758
|
return this.apis;
|