@fern-api/fern-api-dev 4.47.0-1-g896fe739eb8 → 4.47.0-10-g2986d12db6e
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/cli.cjs +127 -36
- package/package.json +1 -1
package/cli.cjs
CHANGED
|
@@ -601952,7 +601952,7 @@ var AccessTokenPosthogManager = class {
|
|
|
601952
601952
|
properties: {
|
|
601953
601953
|
...event,
|
|
601954
601954
|
...event.properties,
|
|
601955
|
-
version: "4.47.0-
|
|
601955
|
+
version: "4.47.0-10-g2986d12db6e",
|
|
601956
601956
|
usingAccessToken: true
|
|
601957
601957
|
}
|
|
601958
601958
|
});
|
|
@@ -602003,7 +602003,7 @@ var UserPosthogManager = class {
|
|
|
602003
602003
|
distinctId: this.userId ?? await this.getPersistedDistinctId(),
|
|
602004
602004
|
event: "CLI",
|
|
602005
602005
|
properties: {
|
|
602006
|
-
version: "4.47.0-
|
|
602006
|
+
version: "4.47.0-10-g2986d12db6e",
|
|
602007
602007
|
...event,
|
|
602008
602008
|
...event.properties,
|
|
602009
602009
|
usingAccessToken: false,
|
|
@@ -825858,7 +825858,7 @@ var import_path54 = __toESM(require("path"), 1);
|
|
|
825858
825858
|
var LOCAL_STORAGE_FOLDER4 = ".fern-dev";
|
|
825859
825859
|
var LOGS_FOLDER_NAME = "logs";
|
|
825860
825860
|
function getCliSource() {
|
|
825861
|
-
const version7 = "4.47.0-
|
|
825861
|
+
const version7 = "4.47.0-10-g2986d12db6e";
|
|
825862
825862
|
return `cli@${version7}`;
|
|
825863
825863
|
}
|
|
825864
825864
|
var DebugLogger = class {
|
|
@@ -836825,7 +836825,7 @@ var LegacyDocsPublisher = class {
|
|
|
836825
836825
|
previewId: void 0,
|
|
836826
836826
|
disableTemplates: void 0,
|
|
836827
836827
|
skipUpload,
|
|
836828
|
-
cliVersion: "4.47.0-
|
|
836828
|
+
cliVersion: "4.47.0-10-g2986d12db6e"
|
|
836829
836829
|
});
|
|
836830
836830
|
if (taskContext.getResult() === TaskResult.Failure) {
|
|
836831
836831
|
return { success: false };
|
|
@@ -877838,6 +877838,8 @@ var DynamicTypeLiteralMapper5 = class {
|
|
|
877838
877838
|
extendsInfo
|
|
877839
877839
|
});
|
|
877840
877840
|
}
|
|
877841
|
+
const hasAdditionalProperties = objectType2.additionalProperties === true;
|
|
877842
|
+
const useDefault = hasAdditionalProperties || this.context.canObjectTypeUseDefault(objectType2);
|
|
877841
877843
|
const structFields = [];
|
|
877842
877844
|
for (const property22 of objectType2.properties) {
|
|
877843
877845
|
this.context.scopeError(property22.name.wireValue);
|
|
@@ -877865,7 +877867,11 @@ var DynamicTypeLiteralMapper5 = class {
|
|
|
877865
877867
|
if (!hasValue) {
|
|
877866
877868
|
const isOptional = this.context.isNullable(property22.typeReference);
|
|
877867
877869
|
if (isOptional) {
|
|
877868
|
-
|
|
877870
|
+
if (useDefault) {
|
|
877871
|
+
propertyValue = void 0;
|
|
877872
|
+
} else {
|
|
877873
|
+
propertyValue = rust_exports.Expression.none();
|
|
877874
|
+
}
|
|
877869
877875
|
} else {
|
|
877870
877876
|
this.context.addScopedError(`Required field '${wireValue}' is missing`, Severity.Critical);
|
|
877871
877877
|
propertyValue = rust_exports.Expression.raw("Default::default()");
|
|
@@ -877877,15 +877883,17 @@ var DynamicTypeLiteralMapper5 = class {
|
|
|
877877
877883
|
});
|
|
877878
877884
|
}
|
|
877879
877885
|
}
|
|
877880
|
-
|
|
877881
|
-
|
|
877882
|
-
|
|
877883
|
-
|
|
877886
|
+
if (propertyValue !== void 0) {
|
|
877887
|
+
structFields.push({
|
|
877888
|
+
name: propertyName,
|
|
877889
|
+
value: propertyValue
|
|
877890
|
+
});
|
|
877891
|
+
}
|
|
877884
877892
|
} finally {
|
|
877885
877893
|
this.context.unscopeError();
|
|
877886
877894
|
}
|
|
877887
877895
|
}
|
|
877888
|
-
return rust_exports.Expression.structConstruction(structName, structFields);
|
|
877896
|
+
return rust_exports.Expression.structConstruction(structName, structFields, useDefault);
|
|
877889
877897
|
}
|
|
877890
877898
|
// Check if object extends another object (for flattening)
|
|
877891
877899
|
getObjectExtensionInfo(objectType2) {
|
|
@@ -877924,31 +877932,40 @@ var DynamicTypeLiteralMapper5 = class {
|
|
|
877924
877932
|
// Convert object that extends another object (handles flattening)
|
|
877925
877933
|
convertExtendedObject({ objectType: objectType2, value, structName, extendsInfo }) {
|
|
877926
877934
|
const structFields = [];
|
|
877927
|
-
const
|
|
877935
|
+
const baseHasAdditionalProperties = extendsInfo.baseObjectType.additionalProperties === true;
|
|
877936
|
+
const baseUseDefault = baseHasAdditionalProperties || this.context.canObjectTypeUseDefault(extendsInfo.baseObjectType);
|
|
877937
|
+
const baseStructFields = [];
|
|
877938
|
+
for (const property22 of extendsInfo.baseObjectType.properties) {
|
|
877928
877939
|
this.context.scopeError(property22.name.wireValue);
|
|
877929
877940
|
try {
|
|
877930
877941
|
const propertyValue = value[property22.name.wireValue];
|
|
877931
|
-
let fieldValue;
|
|
877932
877942
|
if (propertyValue !== void 0) {
|
|
877933
|
-
|
|
877934
|
-
|
|
877935
|
-
value:
|
|
877943
|
+
baseStructFields.push({
|
|
877944
|
+
name: this.context.getPropertyName(property22.name.name),
|
|
877945
|
+
value: this.convert({
|
|
877946
|
+
typeReference: property22.typeReference,
|
|
877947
|
+
value: propertyValue
|
|
877948
|
+
})
|
|
877936
877949
|
});
|
|
877937
877950
|
} else if (property22.typeReference.type === "optional" || property22.typeReference.type === "nullable") {
|
|
877938
|
-
|
|
877951
|
+
if (!baseUseDefault) {
|
|
877952
|
+
baseStructFields.push({
|
|
877953
|
+
name: this.context.getPropertyName(property22.name.name),
|
|
877954
|
+
value: rust_exports.Expression.raw("None")
|
|
877955
|
+
});
|
|
877956
|
+
}
|
|
877939
877957
|
} else {
|
|
877940
|
-
|
|
877958
|
+
baseStructFields.push({
|
|
877959
|
+
name: this.context.getPropertyName(property22.name.name),
|
|
877960
|
+
value: rust_exports.Expression.raw("Default::default()")
|
|
877961
|
+
});
|
|
877941
877962
|
}
|
|
877942
|
-
return {
|
|
877943
|
-
name: this.context.getPropertyName(property22.name.name),
|
|
877944
|
-
value: fieldValue
|
|
877945
|
-
};
|
|
877946
877963
|
} finally {
|
|
877947
877964
|
this.context.unscopeError();
|
|
877948
877965
|
}
|
|
877949
|
-
}
|
|
877966
|
+
}
|
|
877950
877967
|
const baseStructName = this.context.getStructName(extendsInfo.baseObjectType.declaration.name);
|
|
877951
|
-
const baseStruct = rust_exports.Expression.structConstruction(baseStructName, baseStructFields);
|
|
877968
|
+
const baseStruct = rust_exports.Expression.structConstruction(baseStructName, baseStructFields, baseUseDefault);
|
|
877952
877969
|
structFields.push({
|
|
877953
877970
|
name: extendsInfo.baseFieldName,
|
|
877954
877971
|
value: baseStruct
|
|
@@ -877972,7 +877989,9 @@ var DynamicTypeLiteralMapper5 = class {
|
|
|
877972
877989
|
this.context.unscopeError();
|
|
877973
877990
|
}
|
|
877974
877991
|
});
|
|
877975
|
-
|
|
877992
|
+
const outerHasAdditionalProperties = objectType2.additionalProperties === true;
|
|
877993
|
+
const outerUseDefault = outerHasAdditionalProperties || this.context.canObjectTypeUseDefault(objectType2);
|
|
877994
|
+
return rust_exports.Expression.structConstruction(structName, structFields, outerUseDefault);
|
|
877976
877995
|
}
|
|
877977
877996
|
// Generate the field name for the flattened base object
|
|
877978
877997
|
getBaseFieldName(baseName) {
|
|
@@ -878053,6 +878072,10 @@ var DynamicTypeLiteralMapper5 = class {
|
|
|
878053
878072
|
this.context.addScopedError("Referenced union type not found or not an object", Severity.Critical);
|
|
878054
878073
|
return rust_exports.Expression.reference(`${unionName}::${variantName}`);
|
|
878055
878074
|
}
|
|
878075
|
+
if (referencedType.properties.length === 0) {
|
|
878076
|
+
const methodName = this.context.getPropertyName(unionVariant.discriminantValue.name);
|
|
878077
|
+
return rust_exports.Expression.raw(`${unionName}::${methodName}()`);
|
|
878078
|
+
}
|
|
878056
878079
|
const convertedObject = this.convertObjectType({
|
|
878057
878080
|
objectType: referencedType,
|
|
878058
878081
|
value: discriminatedUnionTypeInstance.value
|
|
@@ -878797,6 +878820,69 @@ var DynamicSnippetsGeneratorContext7 = class _DynamicSnippetsGeneratorContext ex
|
|
|
878797
878820
|
}
|
|
878798
878821
|
return this.allParametersAreOptional(allProperties);
|
|
878799
878822
|
}
|
|
878823
|
+
/**
|
|
878824
|
+
* Check if a dynamic IR object type will have Default derived by the model generator.
|
|
878825
|
+
* Mirrors the logic in StructGenerator.canDeriveDefault():
|
|
878826
|
+
* - All property types must support Default
|
|
878827
|
+
* - Extended types must support Default
|
|
878828
|
+
*/
|
|
878829
|
+
canObjectTypeUseDefault(objectType2) {
|
|
878830
|
+
const extendsProperty = objectType2.extends;
|
|
878831
|
+
if (extendsProperty != null && extendsProperty.length > 0) {
|
|
878832
|
+
for (const baseTypeId of extendsProperty) {
|
|
878833
|
+
const baseType = this.ir.types[baseTypeId];
|
|
878834
|
+
if (!baseType || baseType.type !== "object" || !this.canObjectTypeUseDefault(baseType)) {
|
|
878835
|
+
return false;
|
|
878836
|
+
}
|
|
878837
|
+
}
|
|
878838
|
+
}
|
|
878839
|
+
return objectType2.properties.every((prop) => this.typeSupportsDefault(prop.typeReference));
|
|
878840
|
+
}
|
|
878841
|
+
/**
|
|
878842
|
+
* Check if a type reference maps to a Rust type that implements Default.
|
|
878843
|
+
* Mirrors the model generator's typeSupportsDefault logic.
|
|
878844
|
+
*/
|
|
878845
|
+
typeSupportsDefault(typeRef, visited = /* @__PURE__ */ new Set()) {
|
|
878846
|
+
switch (typeRef.type) {
|
|
878847
|
+
case "primitive":
|
|
878848
|
+
return true;
|
|
878849
|
+
// All Rust primitives implement Default
|
|
878850
|
+
case "optional":
|
|
878851
|
+
case "nullable":
|
|
878852
|
+
return true;
|
|
878853
|
+
// Option<T> defaults to None
|
|
878854
|
+
case "list":
|
|
878855
|
+
case "map":
|
|
878856
|
+
case "set":
|
|
878857
|
+
return true;
|
|
878858
|
+
// Vec, HashMap, HashSet all implement Default
|
|
878859
|
+
case "unknown":
|
|
878860
|
+
return true;
|
|
878861
|
+
// serde_json::Value implements Default
|
|
878862
|
+
case "literal":
|
|
878863
|
+
return false;
|
|
878864
|
+
case "named": {
|
|
878865
|
+
const typeId = typeRef.value;
|
|
878866
|
+
if (visited.has(typeId)) {
|
|
878867
|
+
return false;
|
|
878868
|
+
}
|
|
878869
|
+
visited.add(typeId);
|
|
878870
|
+
const namedType = this.ir.types[typeId];
|
|
878871
|
+
if (!namedType) {
|
|
878872
|
+
return false;
|
|
878873
|
+
}
|
|
878874
|
+
if (namedType.type === "object") {
|
|
878875
|
+
return this.canObjectTypeUseDefault(namedType);
|
|
878876
|
+
}
|
|
878877
|
+
if (namedType.type === "alias") {
|
|
878878
|
+
return this.typeSupportsDefault(namedType.typeReference, visited);
|
|
878879
|
+
}
|
|
878880
|
+
return false;
|
|
878881
|
+
}
|
|
878882
|
+
default:
|
|
878883
|
+
return false;
|
|
878884
|
+
}
|
|
878885
|
+
}
|
|
878800
878886
|
};
|
|
878801
878887
|
|
|
878802
878888
|
// ../../../generators/rust/dynamic-snippets/lib/EndpointSnippetGenerator.js
|
|
@@ -879340,24 +879426,27 @@ var EndpointSnippetGenerator8 = class {
|
|
|
879340
879426
|
}
|
|
879341
879427
|
this.context.errors.unscope();
|
|
879342
879428
|
const structName = this.getCorrectRequestStructName(endpoint3, request7);
|
|
879343
|
-
const useDefault =
|
|
879429
|
+
const useDefault = this.context.canRequestUseDefault(request7);
|
|
879344
879430
|
this.addMissingFields({
|
|
879345
879431
|
request: request7,
|
|
879346
879432
|
structFields,
|
|
879347
|
-
providedFieldNames
|
|
879433
|
+
providedFieldNames,
|
|
879434
|
+
useDefault
|
|
879348
879435
|
});
|
|
879349
879436
|
return this.createStructExpression(structName, structFields, useDefault);
|
|
879350
879437
|
}
|
|
879351
|
-
addMissingFields({ request: request7, structFields, providedFieldNames }) {
|
|
879438
|
+
addMissingFields({ request: request7, structFields, providedFieldNames, useDefault }) {
|
|
879352
879439
|
const allQueryParams = request7.queryParameters ?? [];
|
|
879353
879440
|
for (const param of allQueryParams) {
|
|
879354
879441
|
const fieldName = this.context.getPropertyName(param.name.name);
|
|
879355
879442
|
if (!providedFieldNames.has(fieldName)) {
|
|
879356
879443
|
if (this.context.isOptionalType(param.typeReference)) {
|
|
879357
|
-
|
|
879358
|
-
|
|
879359
|
-
|
|
879360
|
-
|
|
879444
|
+
if (!useDefault) {
|
|
879445
|
+
structFields.push({
|
|
879446
|
+
name: fieldName,
|
|
879447
|
+
value: rust_exports.Expression.raw("None")
|
|
879448
|
+
});
|
|
879449
|
+
}
|
|
879361
879450
|
} else {
|
|
879362
879451
|
structFields.push({
|
|
879363
879452
|
name: fieldName,
|
|
@@ -879371,10 +879460,12 @@ var EndpointSnippetGenerator8 = class {
|
|
|
879371
879460
|
const fieldName = this.context.getPropertyName(param.name.name);
|
|
879372
879461
|
if (!providedFieldNames.has(fieldName)) {
|
|
879373
879462
|
if (this.context.isOptionalType(param.typeReference)) {
|
|
879374
|
-
|
|
879375
|
-
|
|
879376
|
-
|
|
879377
|
-
|
|
879463
|
+
if (!useDefault) {
|
|
879464
|
+
structFields.push({
|
|
879465
|
+
name: fieldName,
|
|
879466
|
+
value: rust_exports.Expression.raw("None")
|
|
879467
|
+
});
|
|
879468
|
+
}
|
|
879378
879469
|
} else {
|
|
879379
879470
|
structFields.push({
|
|
879380
879471
|
name: fieldName,
|
|
@@ -909849,7 +909940,7 @@ var CliContext = class {
|
|
|
909849
909940
|
if (false) {
|
|
909850
909941
|
this.logger.error("CLI_VERSION is not defined");
|
|
909851
909942
|
}
|
|
909852
|
-
return "4.47.0-
|
|
909943
|
+
return "4.47.0-10-g2986d12db6e";
|
|
909853
909944
|
}
|
|
909854
909945
|
getCliName() {
|
|
909855
909946
|
if (false) {
|
package/package.json
CHANGED