fern-api 0.19.18 → 0.19.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 +147 -33
- package/package.json +1 -1
package/bundle.cjs
CHANGED
|
@@ -832299,7 +832299,7 @@ var AccessTokenPosthogManager = class {
|
|
|
832299
832299
|
properties: {
|
|
832300
832300
|
...event,
|
|
832301
832301
|
...event.properties,
|
|
832302
|
-
version: "0.19.
|
|
832302
|
+
version: "0.19.19",
|
|
832303
832303
|
usingAccessToken: true
|
|
832304
832304
|
}
|
|
832305
832305
|
});
|
|
@@ -832361,7 +832361,7 @@ var UserPosthogManager = class {
|
|
|
832361
832361
|
distinctId: this.userId ?? await this.getPersistedDistinctId(),
|
|
832362
832362
|
event: "CLI",
|
|
832363
832363
|
properties: {
|
|
832364
|
-
version: "0.19.
|
|
832364
|
+
version: "0.19.19",
|
|
832365
832365
|
...event,
|
|
832366
832366
|
...event.properties
|
|
832367
832367
|
}
|
|
@@ -846024,6 +846024,115 @@ function isObjectEqual(a2, b2) {
|
|
|
846024
846024
|
});
|
|
846025
846025
|
}
|
|
846026
846026
|
|
|
846027
|
+
// pnp:/home/circleci/project/packages/cli/openapi-parser/lib/schema/utils/getBreadcrumbsFromReference.js
|
|
846028
|
+
var STARTS_WITH_COMPONENTS_SCHEMAS = {
|
|
846029
|
+
isApplicable: (refUnderProcessing) => refUnderProcessing[0] === "#" && refUnderProcessing[1] === "components" && refUnderProcessing[2] === "schemas",
|
|
846030
|
+
applyStrategy: (refUnderProcessing) => {
|
|
846031
|
+
const newBreadcrumbs = [refUnderProcessing[3] ?? ""];
|
|
846032
|
+
return {
|
|
846033
|
+
refUnderProcessing: refUnderProcessing.slice(4),
|
|
846034
|
+
newBreadcrumbs
|
|
846035
|
+
};
|
|
846036
|
+
}
|
|
846037
|
+
};
|
|
846038
|
+
var STARTS_WITH_COMPONENTS_RESPONSES = {
|
|
846039
|
+
isApplicable: (breadcrumbs) => breadcrumbs[0] === "#" && breadcrumbs[1] === "components" && breadcrumbs[2] === "responses",
|
|
846040
|
+
applyStrategy: (refUnderProcessing) => {
|
|
846041
|
+
const newBreadcrumbs = [refUnderProcessing[3] ?? ""];
|
|
846042
|
+
refUnderProcessing = refUnderProcessing.slice(4);
|
|
846043
|
+
return {
|
|
846044
|
+
refUnderProcessing: refUnderProcessing.slice(4),
|
|
846045
|
+
newBreadcrumbs
|
|
846046
|
+
};
|
|
846047
|
+
}
|
|
846048
|
+
};
|
|
846049
|
+
var STARTS_WITH_COMPONENTS_PARAMETERS = {
|
|
846050
|
+
isApplicable: (refUnderProcessing) => refUnderProcessing[0] === "#" && refUnderProcessing[1] === "components" && refUnderProcessing[2] === "parameters",
|
|
846051
|
+
applyStrategy: (refUnderProcessing) => {
|
|
846052
|
+
const newBreadcrumbs = [refUnderProcessing[3] ?? ""];
|
|
846053
|
+
refUnderProcessing = refUnderProcessing.slice(4);
|
|
846054
|
+
if (refUnderProcessing[0] === "schema") {
|
|
846055
|
+
refUnderProcessing = refUnderProcessing.slice(1);
|
|
846056
|
+
}
|
|
846057
|
+
return {
|
|
846058
|
+
refUnderProcessing,
|
|
846059
|
+
newBreadcrumbs
|
|
846060
|
+
};
|
|
846061
|
+
}
|
|
846062
|
+
};
|
|
846063
|
+
var EXTRACT_PROPERTY = {
|
|
846064
|
+
isApplicable: (refUnderProcessing) => refUnderProcessing[0] === "properties",
|
|
846065
|
+
applyStrategy: (refUnderProcessing) => {
|
|
846066
|
+
const newBreadcrumbs = [refUnderProcessing[1] ?? ""];
|
|
846067
|
+
return {
|
|
846068
|
+
refUnderProcessing: refUnderProcessing.slice(2),
|
|
846069
|
+
newBreadcrumbs
|
|
846070
|
+
};
|
|
846071
|
+
}
|
|
846072
|
+
};
|
|
846073
|
+
var REMOVE_ITEMS_KEYWORD = {
|
|
846074
|
+
isApplicable: (refUnderProcessing) => refUnderProcessing[0] === "items",
|
|
846075
|
+
applyStrategy: (refUnderProcessing) => {
|
|
846076
|
+
return {
|
|
846077
|
+
refUnderProcessing: refUnderProcessing.slice(1),
|
|
846078
|
+
newBreadcrumbs: []
|
|
846079
|
+
};
|
|
846080
|
+
}
|
|
846081
|
+
};
|
|
846082
|
+
var REMOVE_ALL_OF_KEYWORD = {
|
|
846083
|
+
isApplicable: (refUnderProcessing) => refUnderProcessing[0] === "allOf",
|
|
846084
|
+
applyStrategy: (refUnderProcessing) => {
|
|
846085
|
+
return {
|
|
846086
|
+
refUnderProcessing: refUnderProcessing.slice(1),
|
|
846087
|
+
newBreadcrumbs: []
|
|
846088
|
+
};
|
|
846089
|
+
}
|
|
846090
|
+
};
|
|
846091
|
+
var REMOVE_ANY_OF_KEYWORD = {
|
|
846092
|
+
isApplicable: (refUnderProcessing) => refUnderProcessing[0] === "anyOf",
|
|
846093
|
+
applyStrategy: (refUnderProcessing) => {
|
|
846094
|
+
return {
|
|
846095
|
+
refUnderProcessing: refUnderProcessing.slice(1),
|
|
846096
|
+
newBreadcrumbs: []
|
|
846097
|
+
};
|
|
846098
|
+
}
|
|
846099
|
+
};
|
|
846100
|
+
var REMOVE_ONE_OF_KEYWORD = {
|
|
846101
|
+
isApplicable: (refUnderProcessing) => refUnderProcessing[0] === "oneOf",
|
|
846102
|
+
applyStrategy: (refUnderProcessing) => {
|
|
846103
|
+
return {
|
|
846104
|
+
refUnderProcessing: refUnderProcessing.slice(1),
|
|
846105
|
+
newBreadcrumbs: []
|
|
846106
|
+
};
|
|
846107
|
+
}
|
|
846108
|
+
};
|
|
846109
|
+
function getBreadcrumbsFromReference(reference) {
|
|
846110
|
+
let refUnderProcessing = reference.split("/").map((breadcrumb) => breadcrumb.replace(/~1/g, "/"));
|
|
846111
|
+
let breadcrumbs = [];
|
|
846112
|
+
const strategies = [
|
|
846113
|
+
STARTS_WITH_COMPONENTS_SCHEMAS,
|
|
846114
|
+
STARTS_WITH_COMPONENTS_RESPONSES,
|
|
846115
|
+
STARTS_WITH_COMPONENTS_PARAMETERS,
|
|
846116
|
+
EXTRACT_PROPERTY,
|
|
846117
|
+
REMOVE_ITEMS_KEYWORD,
|
|
846118
|
+
REMOVE_ALL_OF_KEYWORD,
|
|
846119
|
+
REMOVE_ANY_OF_KEYWORD,
|
|
846120
|
+
REMOVE_ONE_OF_KEYWORD
|
|
846121
|
+
];
|
|
846122
|
+
let previousRefUnderProcessing;
|
|
846123
|
+
do {
|
|
846124
|
+
previousRefUnderProcessing = refUnderProcessing;
|
|
846125
|
+
for (const strategy of strategies) {
|
|
846126
|
+
if (strategy.isApplicable(refUnderProcessing)) {
|
|
846127
|
+
const { refUnderProcessing: newRefUnderProcessing, newBreadcrumbs } = strategy.applyStrategy(refUnderProcessing);
|
|
846128
|
+
refUnderProcessing = newRefUnderProcessing;
|
|
846129
|
+
breadcrumbs = [...breadcrumbs, ...newBreadcrumbs];
|
|
846130
|
+
}
|
|
846131
|
+
}
|
|
846132
|
+
} while (refUnderProcessing.join("") !== previousRefUnderProcessing.join(""));
|
|
846133
|
+
return breadcrumbs;
|
|
846134
|
+
}
|
|
846135
|
+
|
|
846027
846136
|
// pnp:/home/circleci/project/packages/cli/openapi-parser/lib/schema/convertObject.js
|
|
846028
846137
|
function convertObject({ nameOverride, generatedName, breadcrumbs, properties, description, required, wrapAsNullable, allOf, context, propertiesToExclude, groupName, fullExamples }) {
|
|
846029
846138
|
const allRequired = [...required ?? []];
|
|
@@ -846061,6 +846170,9 @@ function convertObject({ nameOverride, generatedName, breadcrumbs, properties, d
|
|
|
846061
846170
|
continue;
|
|
846062
846171
|
}
|
|
846063
846172
|
const schemaId = getSchemaIdFromReference(allOfElement);
|
|
846173
|
+
if (schemaId == null) {
|
|
846174
|
+
continue;
|
|
846175
|
+
}
|
|
846064
846176
|
parents.push({
|
|
846065
846177
|
schemaId,
|
|
846066
846178
|
convertedSchema: convertToReferencedSchema(allOfElement, [schemaId]),
|
|
@@ -846191,7 +846303,7 @@ function wrapObject({ nameOverride, generatedName, wrapAsNullable, properties, d
|
|
|
846191
846303
|
}
|
|
846192
846304
|
function getAllProperties({ schema: schema2, context, breadcrumbs }) {
|
|
846193
846305
|
let properties = {};
|
|
846194
|
-
const [resolvedSchema, resolvedBreadCrumbs] = isReferenceObject(schema2) ? [context.resolveSchemaReference(schema2),
|
|
846306
|
+
const [resolvedSchema, resolvedBreadCrumbs] = isReferenceObject(schema2) ? [context.resolveSchemaReference(schema2), getBreadcrumbsFromReference(schema2.$ref)] : [schema2, breadcrumbs];
|
|
846195
846307
|
for (const allOfElement of resolvedSchema.allOf ?? []) {
|
|
846196
846308
|
properties = {
|
|
846197
846309
|
...properties,
|
|
@@ -846370,12 +846482,16 @@ function getExamplesString(schema2) {
|
|
|
846370
846482
|
var SCHEMA_REFERENCE_PREFIX = "#/components/schemas/";
|
|
846371
846483
|
function convertSchema(schema2, wrapAsNullable, context, breadcrumbs, referencedAsRequest = false, propertiesToExclude = /* @__PURE__ */ new Set()) {
|
|
846372
846484
|
if (isReferenceObject(schema2)) {
|
|
846373
|
-
|
|
846374
|
-
|
|
846375
|
-
|
|
846376
|
-
|
|
846485
|
+
const schemaId = getSchemaIdFromReference(schema2);
|
|
846486
|
+
if (schemaId != null) {
|
|
846487
|
+
if (!referencedAsRequest) {
|
|
846488
|
+
context.markSchemaAsReferencedByNonRequest(schemaId);
|
|
846489
|
+
} else {
|
|
846490
|
+
context.markSchemaAsReferencedByRequest(schemaId);
|
|
846491
|
+
}
|
|
846492
|
+
return convertReferenceObject(schema2, wrapAsNullable, context, breadcrumbs);
|
|
846377
846493
|
}
|
|
846378
|
-
return
|
|
846494
|
+
return convertSchemaObject(context.resolveSchemaReference(schema2), wrapAsNullable, context, getBreadcrumbsFromReference(schema2.$ref), propertiesToExclude, referencedAsRequest);
|
|
846379
846495
|
} else {
|
|
846380
846496
|
return convertSchemaObject(schema2, wrapAsNullable, context, breadcrumbs, propertiesToExclude, referencedAsRequest);
|
|
846381
846497
|
}
|
|
@@ -846837,7 +846953,7 @@ function convertSchemaObject(schema2, wrapAsNullable, context, breadcrumbs, prop
|
|
|
846837
846953
|
}
|
|
846838
846954
|
function getSchemaIdFromReference(ref2) {
|
|
846839
846955
|
if (!ref2.$ref.startsWith(SCHEMA_REFERENCE_PREFIX)) {
|
|
846840
|
-
|
|
846956
|
+
return void 0;
|
|
846841
846957
|
}
|
|
846842
846958
|
return ref2.$ref.replace(SCHEMA_REFERENCE_PREFIX, "");
|
|
846843
846959
|
}
|
|
@@ -846845,10 +846961,14 @@ function convertToReferencedSchema(schema2, breadcrumbs) {
|
|
|
846845
846961
|
const nameOverride = getExtension(schema2, FernOpenAPIExtension.TYPE_NAME);
|
|
846846
846962
|
const generatedName = getGeneratedTypeName(breadcrumbs);
|
|
846847
846963
|
const description = schema2.description;
|
|
846964
|
+
const schemaId = getSchemaIdFromReference(schema2);
|
|
846965
|
+
if (schemaId == null) {
|
|
846966
|
+
throw new Error(`Invalid schema reference ${JSON.stringify(schema2)}`);
|
|
846967
|
+
}
|
|
846848
846968
|
return Schema2.reference({
|
|
846849
846969
|
generatedName,
|
|
846850
846970
|
nameOverride,
|
|
846851
|
-
schema:
|
|
846971
|
+
schema: schemaId,
|
|
846852
846972
|
description: description ?? void 0,
|
|
846853
846973
|
groupName: void 0
|
|
846854
846974
|
});
|
|
@@ -848467,6 +848587,9 @@ function resolveSchema(schema2, document4) {
|
|
|
848467
848587
|
throw new Error(`Failed to resolve schema reference because of unsupported prefix: ${schema2.$ref}`);
|
|
848468
848588
|
}
|
|
848469
848589
|
const schemaId = getSchemaIdFromReference(schema2);
|
|
848590
|
+
if (schemaId == null) {
|
|
848591
|
+
throw new Error(`Failed to resolve schema reference because missing schema id: ${schema2.$ref}`);
|
|
848592
|
+
}
|
|
848470
848593
|
const resolvedSchema = (_b2 = (_a2 = document4.components) == null ? void 0 : _a2.schemas) == null ? void 0 : _b2[schemaId];
|
|
848471
848594
|
if (resolvedSchema == null) {
|
|
848472
848595
|
throw new Error(`Failed to resolve schema reference because missing: ${schema2.$ref}`);
|
|
@@ -848582,32 +848705,20 @@ var AbstractOpenAPIV3ParserContext = class {
|
|
|
848582
848705
|
return this.refOccurrences[schema2.$ref] ?? 0;
|
|
848583
848706
|
}
|
|
848584
848707
|
resolveSchemaReference(schema2) {
|
|
848585
|
-
|
|
848586
|
-
|
|
848587
|
-
|
|
848588
|
-
|
|
848589
|
-
|
|
848590
|
-
|
|
848591
|
-
|
|
848592
|
-
throw new Error(`${schema2.$ref} is undefined`);
|
|
848708
|
+
const keys7 = schema2.$ref.substring(2).split("/").map((key2) => key2.replace(/~1/g, "/"));
|
|
848709
|
+
let resolvedSchema = this.document;
|
|
848710
|
+
for (const key2 of keys7) {
|
|
848711
|
+
if (typeof resolvedSchema !== "object" || resolvedSchema == null) {
|
|
848712
|
+
throw new Error(`Failed to resolve ${schema2.$ref}`);
|
|
848713
|
+
}
|
|
848714
|
+
resolvedSchema = resolvedSchema[key2];
|
|
848593
848715
|
}
|
|
848594
|
-
let resolvedSchema = this.document.components.schemas[splitSchemaKey[0]];
|
|
848595
848716
|
if (resolvedSchema == null) {
|
|
848596
|
-
throw new Error(
|
|
848717
|
+
throw new Error(`Failed to resolve ${schema2.$ref}`);
|
|
848597
848718
|
}
|
|
848598
848719
|
if (isReferenceObject(resolvedSchema)) {
|
|
848599
848720
|
resolvedSchema = this.resolveSchemaReference(resolvedSchema);
|
|
848600
848721
|
}
|
|
848601
|
-
if (splitSchemaKey[1] === "properties" && splitSchemaKey[2] != null) {
|
|
848602
|
-
const resolvedProperty = (_a2 = resolvedSchema.properties) == null ? void 0 : _a2[splitSchemaKey[2]];
|
|
848603
|
-
if (resolvedProperty == null) {
|
|
848604
|
-
throw new Error(`${schema2.$ref} is undefiened. Property does not exist on object.`);
|
|
848605
|
-
} else if (isReferenceObject(resolvedProperty)) {
|
|
848606
|
-
resolvedSchema = this.resolveSchemaReference(resolvedProperty);
|
|
848607
|
-
} else {
|
|
848608
|
-
resolvedSchema = resolvedProperty;
|
|
848609
|
-
}
|
|
848610
|
-
}
|
|
848611
848722
|
return resolvedSchema;
|
|
848612
848723
|
}
|
|
848613
848724
|
resolveParameterReference(parameter) {
|
|
@@ -849197,7 +849308,10 @@ function convertStreamingOperation({ operationContext, context, streamingExtensi
|
|
|
849197
849308
|
isStreaming: true
|
|
849198
849309
|
});
|
|
849199
849310
|
if ((streamingRequestBody == null ? void 0 : streamingRequestBody.schemaReference) != null) {
|
|
849200
|
-
|
|
849311
|
+
const schemaId = getSchemaIdFromReference(streamingRequestBody.schemaReference);
|
|
849312
|
+
if (schemaId != null) {
|
|
849313
|
+
context.excludeSchema(schemaId);
|
|
849314
|
+
}
|
|
849201
849315
|
}
|
|
849202
849316
|
const streamingResponses = getResponses({
|
|
849203
849317
|
operation: operationContext.operation,
|
|
@@ -855966,10 +856080,10 @@ var CliContext = class {
|
|
|
855966
856080
|
return "fern-api";
|
|
855967
856081
|
}
|
|
855968
856082
|
getPackageVersion() {
|
|
855969
|
-
if ("0.19.
|
|
856083
|
+
if ("0.19.19" == null) {
|
|
855970
856084
|
this.logger.error("CLI_VERSION is not defined");
|
|
855971
856085
|
}
|
|
855972
|
-
return "0.19.
|
|
856086
|
+
return "0.19.19";
|
|
855973
856087
|
}
|
|
855974
856088
|
getCliName() {
|
|
855975
856089
|
if ("fern" == null) {
|