@fern-api/fern-api-dev 5.65.7 → 5.66.0

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 +221 -17
  2. package/package.json +1 -1
package/cli.cjs CHANGED
@@ -233556,17 +233556,9 @@ function parseLibrariesConfiguration(libraries) {
233556
233556
  }
233557
233557
  const result = {};
233558
233558
  for (const [name2, config5] of Object.entries(libraries)) {
233559
- if (!isGitLibraryInput(config5.input)) {
233560
- throw new CliError({
233561
- message: `Library '${name2}' uses 'path' input which is not yet supported. Please use 'git' input.`,
233562
- code: CliError.Code.ConfigError
233563
- });
233564
- }
233559
+ const input3 = isGitLibraryInput(config5.input) ? { type: "git", git: config5.input.git, subpath: config5.input.subpath } : { type: "path", path: config5.input.path };
233565
233560
  result[name2] = {
233566
- input: {
233567
- git: config5.input.git,
233568
- subpath: config5.input.subpath
233569
- },
233561
+ input: input3,
233570
233562
  output: {
233571
233563
  path: config5.output.path
233572
233564
  },
@@ -266120,6 +266112,211 @@ var init_IrGraph = __esm({
266120
266112
  }
266121
266113
  });
266122
266114
 
266115
+ // ../../commons/ir-utils/lib/global-parameters/resolveGlobalParameterApplicability.js
266116
+ function resolveGlobalParameterApplicability(ir3, { onWarning } = {}) {
266117
+ const globalParameters = ir3.globalParameters;
266118
+ if (globalParameters == null || globalParameters.length === 0) {
266119
+ return;
266120
+ }
266121
+ for (const service of Object.values(ir3.services)) {
266122
+ for (const endpoint3 of service.endpoints) {
266123
+ endpoint3.globalParameters = resolveForEndpoint({
266124
+ endpoint: endpoint3,
266125
+ globalParameters,
266126
+ types: ir3.types,
266127
+ onWarning
266128
+ });
266129
+ }
266130
+ }
266131
+ }
266132
+ function resolveForEndpoint({ endpoint: endpoint3, globalParameters, types: types4, onWarning }) {
266133
+ const optIns = new Set(endpoint3.globalParameters ?? []);
266134
+ const resolved = [];
266135
+ for (const param of globalParameters) {
266136
+ const isAuto = param.apply === "auto";
266137
+ let applies;
266138
+ switch (param.location) {
266139
+ case "body": {
266140
+ const schemaHasTarget = requestBodyContainsPath({
266141
+ requestBody: endpoint3.requestBody,
266142
+ dottedTarget: param.target,
266143
+ types: types4
266144
+ });
266145
+ if (isAuto) {
266146
+ applies = schemaHasTarget;
266147
+ } else if (optIns.has(param.id)) {
266148
+ applies = schemaHasTarget;
266149
+ if (!schemaHasTarget) {
266150
+ onWarning?.(`Endpoint "${endpoint3.id}" opts into global parameter "${param.id}" (in: body, target: "${param.target}") via x-fern-global-parameter, but its request body schema does not contain that path. The parameter will not be injected for this endpoint.`);
266151
+ }
266152
+ } else {
266153
+ applies = false;
266154
+ }
266155
+ break;
266156
+ }
266157
+ case "header":
266158
+ case "query":
266159
+ applies = isAuto || optIns.has(param.id);
266160
+ break;
266161
+ case "path":
266162
+ applies = isAuto ? endpointPathContainsParameter(endpoint3, param.target) : optIns.has(param.id);
266163
+ break;
266164
+ default:
266165
+ assertNever(param.location);
266166
+ }
266167
+ if (applies) {
266168
+ resolved.push(param.id);
266169
+ }
266170
+ }
266171
+ return resolved.length > 0 ? resolved : void 0;
266172
+ }
266173
+ function endpointPathContainsParameter(endpoint3, target) {
266174
+ return endpoint3.allPathParameters.some((pathParameter) => getOriginalName(pathParameter.name) === target);
266175
+ }
266176
+ function requestBodyContainsPath({ requestBody, dottedTarget, types: types4 }) {
266177
+ if (requestBody == null) {
266178
+ return false;
266179
+ }
266180
+ const segments = dottedTarget.split(".");
266181
+ if (segments.length === 0) {
266182
+ return false;
266183
+ }
266184
+ switch (requestBody.type) {
266185
+ case "inlinedRequestBody": {
266186
+ const seen = /* @__PURE__ */ new Set();
266187
+ const properties7 = [
266188
+ ...requestBody.properties.map((property24) => ({
266189
+ wireValue: getWireValue(property24.name),
266190
+ valueType: property24.valueType
266191
+ })),
266192
+ ...(requestBody.extendedProperties ?? []).map((property24) => ({
266193
+ wireValue: getWireValue(property24.name),
266194
+ valueType: property24.valueType
266195
+ }))
266196
+ ];
266197
+ for (const extension4 of requestBody.extends) {
266198
+ properties7.push(...collectPropertiesFromNamedType({ typeId: extension4.typeId, types: types4, seen }));
266199
+ }
266200
+ return propertiesContainPath({ properties: properties7, segments, types: types4, seen });
266201
+ }
266202
+ case "reference":
266203
+ return typeReferenceContainsPath({
266204
+ typeReference: requestBody.requestBodyType,
266205
+ segments,
266206
+ types: types4,
266207
+ seen: /* @__PURE__ */ new Set()
266208
+ });
266209
+ case "fileUpload":
266210
+ case "bytes":
266211
+ return false;
266212
+ default:
266213
+ assertNever(requestBody);
266214
+ }
266215
+ }
266216
+ function propertiesContainPath({ properties: properties7, segments, types: types4, seen }) {
266217
+ const [head, ...rest] = segments;
266218
+ const match3 = properties7.find((property24) => property24.wireValue === head);
266219
+ if (match3 == null) {
266220
+ return false;
266221
+ }
266222
+ if (rest.length === 0) {
266223
+ return true;
266224
+ }
266225
+ return typeReferenceContainsPath({ typeReference: match3.valueType, segments: rest, types: types4, seen: /* @__PURE__ */ new Set() });
266226
+ }
266227
+ function typeReferenceContainsPath({ typeReference: typeReference2, segments, types: types4, seen }) {
266228
+ const properties7 = resolveObjectProperties({ typeReference: typeReference2, types: types4, seen });
266229
+ if (properties7 == null) {
266230
+ return false;
266231
+ }
266232
+ return propertiesContainPath({ properties: properties7, segments, types: types4, seen });
266233
+ }
266234
+ function resolveObjectProperties({ typeReference: typeReference2, types: types4, seen }) {
266235
+ switch (typeReference2.type) {
266236
+ case "container": {
266237
+ const container = typeReference2.container;
266238
+ switch (container.type) {
266239
+ case "optional":
266240
+ return resolveObjectProperties({ typeReference: container.optional, types: types4, seen });
266241
+ case "nullable":
266242
+ return resolveObjectProperties({ typeReference: container.nullable, types: types4, seen });
266243
+ case "list":
266244
+ case "set":
266245
+ case "map":
266246
+ case "literal":
266247
+ return void 0;
266248
+ default:
266249
+ return assertNever(container);
266250
+ }
266251
+ }
266252
+ case "named": {
266253
+ if (seen.has(typeReference2.typeId)) {
266254
+ return void 0;
266255
+ }
266256
+ seen.add(typeReference2.typeId);
266257
+ const declaration = types4[typeReference2.typeId];
266258
+ if (declaration == null) {
266259
+ return void 0;
266260
+ }
266261
+ switch (declaration.shape.type) {
266262
+ case "object":
266263
+ return collectObjectProperties2({ object: declaration.shape, types: types4, seen });
266264
+ case "alias":
266265
+ return resolveObjectProperties({ typeReference: declaration.shape.aliasOf, types: types4, seen });
266266
+ case "enum":
266267
+ case "union":
266268
+ case "undiscriminatedUnion":
266269
+ return void 0;
266270
+ default:
266271
+ return assertNever(declaration.shape);
266272
+ }
266273
+ }
266274
+ case "primitive":
266275
+ case "unknown":
266276
+ return void 0;
266277
+ default:
266278
+ return assertNever(typeReference2);
266279
+ }
266280
+ }
266281
+ function collectPropertiesFromNamedType({ typeId, types: types4, seen }) {
266282
+ if (seen.has(typeId)) {
266283
+ return [];
266284
+ }
266285
+ seen.add(typeId);
266286
+ const declaration = types4[typeId];
266287
+ if (declaration == null || declaration.shape.type !== "object") {
266288
+ return [];
266289
+ }
266290
+ return collectObjectProperties2({ object: declaration.shape, types: types4, seen });
266291
+ }
266292
+ function collectObjectProperties2({ object: object23, types: types4, seen }) {
266293
+ const properties7 = object23.properties.map((property24) => ({
266294
+ wireValue: getWireValue(property24.name),
266295
+ valueType: property24.valueType
266296
+ }));
266297
+ for (const property24 of object23.extendedProperties ?? []) {
266298
+ properties7.push({ wireValue: getWireValue(property24.name), valueType: property24.valueType });
266299
+ }
266300
+ for (const extension4 of object23.extends) {
266301
+ if (seen.has(extension4.typeId)) {
266302
+ continue;
266303
+ }
266304
+ seen.add(extension4.typeId);
266305
+ const declaration = types4[extension4.typeId];
266306
+ if (declaration != null && declaration.shape.type === "object") {
266307
+ properties7.push(...collectObjectProperties2({ object: declaration.shape, types: types4, seen }));
266308
+ }
266309
+ }
266310
+ return properties7;
266311
+ }
266312
+ var init_resolveGlobalParameterApplicability = __esm({
266313
+ "../../commons/ir-utils/lib/global-parameters/resolveGlobalParameterApplicability.js"() {
266314
+ "use strict";
266315
+ init_lib4();
266316
+ init_namesUtils();
266317
+ }
266318
+ });
266319
+
266123
266320
  // ../../commons/ir-utils/lib/utils/availabilityUtils.js
266124
266321
  function isMarkedUnstable(availability) {
266125
266322
  return availability != null && !stableStatuses.includes(availability.status);
@@ -267472,6 +267669,7 @@ var init_lib21 = __esm({
267472
267669
  init_filterIntermediateRepresentationForAudiences();
267473
267670
  init_getPropertiesByAudience();
267474
267671
  init_IrGraph();
267672
+ init_resolveGlobalParameterApplicability();
267475
267673
  init_hashJSON();
267476
267674
  init_IntermediateRepresentationChangeDetector();
267477
267675
  init_mergeIntermediateRepresentation();
@@ -276442,7 +276640,7 @@ var init_getIrGenerationSettings = __esm({
276442
276640
  });
276443
276641
 
276444
276642
  // ../generation/ir-generator/lib/generateIntermediateRepresentation.js
276445
- function generateIntermediateRepresentation({ workspace, generationLanguage, keywords: keywords3, smartCasing, exampleGeneration, audiences, readme, packageName, userAgentTemplate, organization, version: version7, fdrApiDefinitionId, sourceResolver, disableDynamicExamples, dynamicGeneratorConfig, generationMetadata }) {
276643
+ function generateIntermediateRepresentation({ workspace, generationLanguage, keywords: keywords3, smartCasing, exampleGeneration, audiences, readme, packageName, userAgentTemplate, organization, version: version7, context: context3, fdrApiDefinitionId, sourceResolver, disableDynamicExamples, dynamicGeneratorConfig, generationMetadata }) {
276446
276644
  const irSettings = getIrGenerationSettings({ workspace });
276447
276645
  const casingsGenerator = constructCasingsGenerator({ generationLanguage, keywords: keywords3, smartCasing });
276448
276646
  const irGraph = new IrGraph(audiences);
@@ -276736,6 +276934,9 @@ function generateIntermediateRepresentation({ workspace, generationLanguage, key
276736
276934
  });
276737
276935
  intermediateRepresentation.serviceTypeReferenceInfo = computeServiceTypeReferenceInfo(irGraph);
276738
276936
  addExtendedPropertiesToIr(intermediateRepresentation);
276937
+ resolveGlobalParameterApplicability(intermediateRepresentation, {
276938
+ onWarning: (message) => context3.logger.warn(message)
276939
+ });
276739
276940
  const intermediateRepresentationWithGeneratedExamples = exampleGeneration.disabled ? intermediateRepresentation : injectAutogeneratedExamples({ ir: intermediateRepresentation, exampleGeneration });
276740
276941
  const workspaceDefinitionRootApiFileContents = workspace.definition.rootApiFile.contents;
276741
276942
  const ignoreAudiences = environments2?.environments._visit({
@@ -342280,6 +342481,9 @@ var init_AbstractSpecConverter = __esm({
342280
342481
  hasPaginatedEndpoints,
342281
342482
  hasFileDownloadEndpoints
342282
342483
  };
342484
+ resolveGlobalParameterApplicability(this.ir, {
342485
+ onWarning: (message) => this.context.logger.warn(message)
342486
+ });
342283
342487
  let ir3 = {
342284
342488
  ...this.ir,
342285
342489
  apiName: this.context.casingsGenerator.generateName(this.ir.apiDisplayName ?? ""),
@@ -688639,7 +688843,7 @@ var AccessTokenPosthogManager = class {
688639
688843
  properties: {
688640
688844
  ...event,
688641
688845
  ...event.properties,
688642
- version: "5.65.7",
688846
+ version: "5.66.0",
688643
688847
  usingAccessToken: true,
688644
688848
  ...getRunIdProperties()
688645
688849
  }
@@ -688705,7 +688909,7 @@ var UserPosthogManager = class {
688705
688909
  distinctId: this.userId ?? await this.getPersistedDistinctId(),
688706
688910
  event: "CLI",
688707
688911
  properties: {
688708
- version: "5.65.7",
688912
+ version: "5.66.0",
688709
688913
  ...event,
688710
688914
  ...event.properties,
688711
688915
  usingAccessToken: false,
@@ -869806,7 +870010,7 @@ var LOCAL_STORAGE_FOLDER4 = ".fern-dev";
869806
870010
  var LOGS_FOLDER_NAME = "logs";
869807
870011
  var MAX_LOGS_DIR_SIZE_BYTES = 100 * 1024 * 1024;
869808
870012
  function getCliSource() {
869809
- const version7 = "5.65.7";
870013
+ const version7 = "5.66.0";
869810
870014
  return `cli@${version7}`;
869811
870015
  }
869812
870016
  var DebugLogger = class {
@@ -902368,7 +902572,7 @@ var LegacyDocsPublisher = class {
902368
902572
  previewId,
902369
902573
  disableTemplates: void 0,
902370
902574
  skipUpload,
902371
- cliVersion: "5.65.7",
902575
+ cliVersion: "5.66.0",
902372
902576
  loginCommand: "fern auth login"
902373
902577
  });
902374
902578
  if (taskContext.getResult() === TaskResult.Failure) {
@@ -968697,7 +968901,7 @@ function getAutomationContextFromEnv() {
968697
968901
  config_branch: process.env.FERN_CONFIG_BRANCH,
968698
968902
  config_pr_number: process.env.FERN_CONFIG_PR_NUMBER,
968699
968903
  trigger: process.env.GITHUB_EVENT_NAME,
968700
- cli_version: "5.65.7"
968904
+ cli_version: "5.66.0"
968701
968905
  };
968702
968906
  }
968703
968907
  function isAutomationMode() {
@@ -969529,7 +969733,7 @@ var CliContext = class _CliContext {
969529
969733
  if (false) {
969530
969734
  this.logger.error("CLI_VERSION is not defined");
969531
969735
  }
969532
- return "5.65.7";
969736
+ return "5.66.0";
969533
969737
  }
969534
969738
  getCliName() {
969535
969739
  if (false) {
package/package.json CHANGED
@@ -1,5 +1,5 @@
1
1
  {
2
- "version": "5.65.7",
2
+ "version": "5.66.0",
3
3
  "repository": {
4
4
  "type": "git",
5
5
  "url": "git+https://github.com/fern-api/fern.git",