@fern-api/fern-api-dev 5.23.3-782-g365a89d6ce6 → 5.23.3-784-g6b49fa5f22a

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.
Files changed (2) hide show
  1. package/cli.cjs +95 -18
  2. package/package.json +1 -1
package/cli.cjs CHANGED
@@ -628980,7 +628980,7 @@ var AccessTokenPosthogManager = class {
628980
628980
  properties: {
628981
628981
  ...event,
628982
628982
  ...event.properties,
628983
- version: "5.23.3-782-g365a89d6ce6",
628983
+ version: "5.23.3-784-g6b49fa5f22a",
628984
628984
  usingAccessToken: true,
628985
628985
  ...getRunIdProperties()
628986
628986
  }
@@ -629044,7 +629044,7 @@ var UserPosthogManager = class {
629044
629044
  distinctId: this.userId ?? await this.getPersistedDistinctId(),
629045
629045
  event: "CLI",
629046
629046
  properties: {
629047
- version: "5.23.3-782-g365a89d6ce6",
629047
+ version: "5.23.3-784-g6b49fa5f22a",
629048
629048
  ...event,
629049
629049
  ...event.properties,
629050
629050
  usingAccessToken: false,
@@ -821059,7 +821059,7 @@ var LOCAL_STORAGE_FOLDER4 = ".fern-dev";
821059
821059
  var LOGS_FOLDER_NAME = "logs";
821060
821060
  var MAX_LOGS_DIR_SIZE_BYTES = 100 * 1024 * 1024;
821061
821061
  function getCliSource() {
821062
- const version7 = "5.23.3-782-g365a89d6ce6";
821062
+ const version7 = "5.23.3-784-g6b49fa5f22a";
821063
821063
  return `cli@${version7}`;
821064
821064
  }
821065
821065
  var DebugLogger = class {
@@ -852392,7 +852392,7 @@ var LegacyDocsPublisher = class {
852392
852392
  previewId,
852393
852393
  disableTemplates: void 0,
852394
852394
  skipUpload,
852395
- cliVersion: "5.23.3-782-g365a89d6ce6",
852395
+ cliVersion: "5.23.3-784-g6b49fa5f22a",
852396
852396
  loginCommand: "fern auth login"
852397
852397
  });
852398
852398
  if (taskContext.getResult() === TaskResult.Failure) {
@@ -897464,7 +897464,6 @@ var NameRegistry2 = class _NameRegistry {
897464
897464
  registerUndiscriminatedUnionVariants({ parentSymbol, variants }) {
897465
897465
  const parentSymbolId = typeof parentSymbol === "string" ? parentSymbol : parentSymbol.id;
897466
897466
  const distinctVariants = uniqWith_default(variants, (a3, b5) => a3.caseName === b5.caseName);
897467
- distinctVariants.sort((a3, b5) => a3.caseName.localeCompare(b5.caseName));
897468
897467
  this.undiscriminatedUnionVariantsByParentSymbolId.set(parentSymbolId, distinctVariants);
897469
897468
  return distinctVariants;
897470
897469
  }
@@ -897718,8 +897717,9 @@ var Class6 = class extends AstNode8 {
897718
897717
  properties;
897719
897718
  initializers;
897720
897719
  methods;
897720
+ nestedTypes;
897721
897721
  docs;
897722
- constructor({ accessLevel, name: name2, final, conformances, properties: properties7, initializers, methods, docs: docs2 }) {
897722
+ constructor({ accessLevel, name: name2, final, conformances, properties: properties7, initializers, methods, nestedTypes: nestedTypes2, docs: docs2 }) {
897723
897723
  super();
897724
897724
  this.name = name2;
897725
897725
  this.final = final;
@@ -897728,6 +897728,7 @@ var Class6 = class extends AstNode8 {
897728
897728
  this.properties = properties7;
897729
897729
  this.initializers = initializers ?? [];
897730
897730
  this.methods = methods ?? [];
897731
+ this.nestedTypes = nestedTypes2 ?? [];
897731
897732
  this.docs = docs2;
897732
897733
  }
897733
897734
  write(writer2) {
@@ -897777,6 +897778,16 @@ var Class6 = class extends AstNode8 {
897777
897778
  writer2.newLine();
897778
897779
  });
897779
897780
  }
897781
+ if (this.nestedTypes.length > 0) {
897782
+ writer2.newLine();
897783
+ this.nestedTypes.forEach((nestedType, nestedTypeIdx) => {
897784
+ if (nestedTypeIdx > 0) {
897785
+ writer2.newLine();
897786
+ }
897787
+ nestedType.write(writer2);
897788
+ writer2.newLine();
897789
+ });
897790
+ }
897780
897791
  writer2.dedent();
897781
897792
  writer2.write("}");
897782
897793
  }
@@ -900141,10 +900152,12 @@ var DynamicTypeLiteralMapper6 = class {
900141
900152
  if (record23 == null) {
900142
900153
  return swift_exports.Expression.nop();
900143
900154
  }
900155
+ const basePropertyKeys = new Set((unionVariant.properties ?? []).map((property24) => property24.name.wireValue));
900156
+ const propertyKey = Object.keys(record23).find((key2) => !basePropertyKeys.has(key2)) ?? "value";
900144
900157
  const converted = this.convert({
900145
900158
  fromSymbol,
900146
900159
  typeReference: unionVariant.typeReference,
900147
- value: record23[unionVariant.discriminantValue.wireValue]
900160
+ value: record23[propertyKey]
900148
900161
  });
900149
900162
  return swift_exports.Expression.methodCall({
900150
900163
  target: swift_exports.Expression.reference(unionSymbol.name),
@@ -900192,12 +900205,24 @@ var DynamicTypeLiteralMapper6 = class {
900192
900205
  }
900193
900206
  convertObject({ fromSymbol, typeId, object_, value: value2 }) {
900194
900207
  const symbol3 = this.context.nameRegistry.getSchemaTypeSymbolOrThrow(typeId);
900208
+ const exampleProperties = this.context.getExampleObjectProperties({
900209
+ parameters: object_.properties,
900210
+ snippetObject: value2
900211
+ });
900212
+ const examplePropertiesByWireValue = new Map(exampleProperties.map((typeInstance) => [typeInstance.name.wireValue, typeInstance]));
900213
+ const orderedProperties = object_.properties.map((property24) => {
900214
+ const exampleProperty = examplePropertiesByWireValue.get(property24.name.wireValue);
900215
+ if (exampleProperty != null) {
900216
+ return exampleProperty;
900217
+ }
900218
+ if (property24.typeReference.type === "literal") {
900219
+ return { name: property24.name, typeReference: property24.typeReference, value: void 0 };
900220
+ }
900221
+ return null;
900222
+ }).filter((typeInstance) => typeInstance != null);
900195
900223
  return swift_exports.Expression.structInitialization({
900196
900224
  unsafeName: symbol3.name,
900197
- arguments_: this.context.getExampleObjectProperties({
900198
- parameters: object_.properties,
900199
- snippetObject: value2
900200
- }).map((typeInstance) => {
900225
+ arguments_: orderedProperties.map((typeInstance) => {
900201
900226
  const expression = this.convert({
900202
900227
  fromSymbol,
900203
900228
  typeReference: typeInstance.typeReference,
@@ -900436,7 +900461,8 @@ var FilePropertyMapper7 = class {
900436
900461
  getFilePropertyInfo({ fromSymbol, body, value: value2 }) {
900437
900462
  const result = {
900438
900463
  fileFields: [],
900439
- bodyPropertyFields: []
900464
+ bodyPropertyFields: [],
900465
+ orderedFields: []
900440
900466
  };
900441
900467
  const record23 = this.context.getRecord(value2) ?? {};
900442
900468
  for (const property24 of body.properties) {
@@ -900447,6 +900473,7 @@ var FilePropertyMapper7 = class {
900447
900473
  value: this.getSingleFileProperty({ property: property24, record: record23 })
900448
900474
  });
900449
900475
  result.fileFields.push(arg);
900476
+ result.orderedFields.push(arg);
900450
900477
  break;
900451
900478
  }
900452
900479
  case "fileArray": {
@@ -900455,6 +900482,7 @@ var FilePropertyMapper7 = class {
900455
900482
  value: this.getArrayFileProperty({ property: property24, record: record23 })
900456
900483
  });
900457
900484
  result.fileFields.push(arg);
900485
+ result.orderedFields.push(arg);
900458
900486
  break;
900459
900487
  }
900460
900488
  case "bodyProperty": {
@@ -900463,6 +900491,7 @@ var FilePropertyMapper7 = class {
900463
900491
  value: this.getBodyProperty({ fromSymbol, property: property24, record: record23 })
900464
900492
  });
900465
900493
  result.bodyPropertyFields.push(arg);
900494
+ result.orderedFields.push(arg);
900466
900495
  break;
900467
900496
  }
900468
900497
  default:
@@ -900733,6 +900762,13 @@ var DynamicSnippetsGeneratorContext8 = class _DynamicSnippetsGeneratorContext ex
900733
900762
  requestNamePascalCase: endpoint3.request.declaration.name.pascalCase.unsafeName
900734
900763
  });
900735
900764
  }
900765
+ endpoint3.request.queryParameters?.forEach((queryParameter) => {
900766
+ registerLiteralEnumsForTypeReference({
900767
+ parentSymbol: registeredSourceModuleSymbol,
900768
+ registry: nameRegistry,
900769
+ typeReference: queryParameter.typeReference
900770
+ });
900771
+ });
900736
900772
  }
900737
900773
  });
900738
900774
  return nameRegistry;
@@ -900759,9 +900795,12 @@ var DynamicSnippetsGeneratorContext8 = class _DynamicSnippetsGeneratorContext ex
900759
900795
  list: (ref2) => swift_exports.TypeReference.array(this.getSwiftTypeReferenceFromScope(ref2.value, fromSymbol)),
900760
900796
  literal: (ref2) => {
900761
900797
  return visitDiscriminatedUnion(ref2.value, "type")._visit({
900762
- boolean: () => referencer.referenceAsIsType("JSONValue"),
900798
+ boolean: () => referencer.referenceSwiftType("Bool"),
900763
900799
  string: (literalType2) => {
900764
- const symbol3 = this.nameRegistry.getNestedLiteralEnumSymbolOrThrow(fromSymbol, literalType2.value);
900800
+ const symbol3 = this.nameRegistry.getNestedLiteralEnumSymbol(fromSymbol, literalType2.value);
900801
+ if (symbol3 == null) {
900802
+ return referencer.referenceAsIsType("JSONValue");
900803
+ }
900765
900804
  return referencer.referenceType(symbol3);
900766
900805
  },
900767
900806
  _other: () => referencer.referenceAsIsType("JSONValue")
@@ -901063,6 +901102,13 @@ var EndpointSnippetGenerator8 = class {
901063
901102
  }
901064
901103
  this.context.errors.unscope();
901065
901104
  args.push(...pathParameterFields);
901105
+ this.context.errors.scope(Scope4.Headers);
901106
+ const headerParameterFields = [];
901107
+ if (request7.headers != null) {
901108
+ headerParameterFields.push(...this.getEndpointMethodHeaderParameters({ namedParameters: request7.headers, snippet }));
901109
+ }
901110
+ this.context.errors.unscope();
901111
+ args.push(...headerParameterFields);
901066
901112
  this.context.errors.scope(Scope4.QueryParameters);
901067
901113
  const queryParameterFields = [];
901068
901114
  if (request7.queryParameters != null) {
@@ -901139,12 +901185,43 @@ var EndpointSnippetGenerator8 = class {
901139
901185
  });
901140
901186
  });
901141
901187
  }
901188
+ getEndpointMethodHeaderParameters({ namedParameters, snippet }) {
901189
+ const moduleSymbol = this.context.nameRegistry.getRegisteredSourceModuleSymbolOrThrow();
901190
+ const referencer = this.context.createReferencer(moduleSymbol);
901191
+ return this.context.getExampleObjectProperties({
901192
+ parameters: namedParameters,
901193
+ snippetObject: snippet.headers ?? {}
901194
+ }).filter((parameter6) => {
901195
+ const resolvedTypeReference = this.resolveAliasTypeReference(parameter6.typeReference);
901196
+ const swiftType = this.context.getSwiftTypeReferenceFromScope(resolvedTypeReference, moduleSymbol);
901197
+ return referencer.resolvesToTheSwiftType(swiftType.nonOptional(), "String");
901198
+ }).map((parameter6) => {
901199
+ return swift_exports.functionArgument({
901200
+ label: parameter6.name.name.camelCase.unsafeName,
901201
+ value: this.context.dynamicTypeLiteralMapper.convert({
901202
+ fromSymbol: moduleSymbol,
901203
+ typeReference: parameter6.typeReference,
901204
+ value: parameter6.value
901205
+ })
901206
+ });
901207
+ });
901208
+ }
901209
+ resolveAliasTypeReference(typeReference2) {
901210
+ if (typeReference2.type === "named") {
901211
+ const namedType = this.context.ir.types[typeReference2.value];
901212
+ if (namedType != null && namedType.type === "alias") {
901213
+ return this.resolveAliasTypeReference(namedType.typeReference);
901214
+ }
901215
+ }
901216
+ return typeReference2;
901217
+ }
901142
901218
  getFilePropertyInfo({ request: request7, snippet }) {
901143
901219
  const moduleSymbol = this.context.nameRegistry.getRegisteredSourceModuleSymbolOrThrow();
901144
901220
  if (request7.body == null || !this.context.isFileUploadRequestBody(request7.body)) {
901145
901221
  return {
901146
901222
  fileFields: [],
901147
- bodyPropertyFields: []
901223
+ bodyPropertyFields: [],
901224
+ orderedFields: []
901148
901225
  };
901149
901226
  }
901150
901227
  return this.context.filePropertyMapper.getFilePropertyInfo({
@@ -901171,7 +901248,7 @@ var EndpointSnippetGenerator8 = class {
901171
901248
  getInlinedRequestBodyObjectFields({ body, value: value2, filePropertyInfo }) {
901172
901249
  switch (body.type) {
901173
901250
  case "fileUpload":
901174
- return [...filePropertyInfo.fileFields, ...filePropertyInfo.bodyPropertyFields];
901251
+ return filePropertyInfo.orderedFields;
901175
901252
  case "properties":
901176
901253
  return this.getInlinedRequestBodyPropertyObjectFields({ parameters: body.value, value: value2 });
901177
901254
  case "referenced":
@@ -917778,7 +917855,7 @@ function getAutomationContextFromEnv() {
917778
917855
  config_branch: process.env.FERN_CONFIG_BRANCH,
917779
917856
  config_pr_number: process.env.FERN_CONFIG_PR_NUMBER,
917780
917857
  trigger: process.env.GITHUB_EVENT_NAME,
917781
- cli_version: "5.23.3-782-g365a89d6ce6"
917858
+ cli_version: "5.23.3-784-g6b49fa5f22a"
917782
917859
  };
917783
917860
  }
917784
917861
  function isAutomationMode() {
@@ -918604,7 +918681,7 @@ var CliContext = class _CliContext {
918604
918681
  if (false) {
918605
918682
  this.logger.error("CLI_VERSION is not defined");
918606
918683
  }
918607
- return "5.23.3-782-g365a89d6ce6";
918684
+ return "5.23.3-784-g6b49fa5f22a";
918608
918685
  }
918609
918686
  getCliName() {
918610
918687
  if (false) {
package/package.json CHANGED
@@ -1,5 +1,5 @@
1
1
  {
2
- "version": "5.23.3-782-g365a89d6ce6",
2
+ "version": "5.23.3-784-g6b49fa5f22a",
3
3
  "repository": {
4
4
  "type": "git",
5
5
  "url": "git+https://github.com/fern-api/fern.git",