@fern-api/fern-api-dev 5.65.8 → 5.66.1

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 -12
  2. package/package.json +1 -1
package/cli.cjs CHANGED
@@ -266112,6 +266112,211 @@ var init_IrGraph = __esm({
266112
266112
  }
266113
266113
  });
266114
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
+
266115
266320
  // ../../commons/ir-utils/lib/utils/availabilityUtils.js
266116
266321
  function isMarkedUnstable(availability) {
266117
266322
  return availability != null && !stableStatuses.includes(availability.status);
@@ -267464,6 +267669,7 @@ var init_lib21 = __esm({
267464
267669
  init_filterIntermediateRepresentationForAudiences();
267465
267670
  init_getPropertiesByAudience();
267466
267671
  init_IrGraph();
267672
+ init_resolveGlobalParameterApplicability();
267467
267673
  init_hashJSON();
267468
267674
  init_IntermediateRepresentationChangeDetector();
267469
267675
  init_mergeIntermediateRepresentation();
@@ -276434,7 +276640,7 @@ var init_getIrGenerationSettings = __esm({
276434
276640
  });
276435
276641
 
276436
276642
  // ../generation/ir-generator/lib/generateIntermediateRepresentation.js
276437
- 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 }) {
276438
276644
  const irSettings = getIrGenerationSettings({ workspace });
276439
276645
  const casingsGenerator = constructCasingsGenerator({ generationLanguage, keywords: keywords3, smartCasing });
276440
276646
  const irGraph = new IrGraph(audiences);
@@ -276728,6 +276934,9 @@ function generateIntermediateRepresentation({ workspace, generationLanguage, key
276728
276934
  });
276729
276935
  intermediateRepresentation.serviceTypeReferenceInfo = computeServiceTypeReferenceInfo(irGraph);
276730
276936
  addExtendedPropertiesToIr(intermediateRepresentation);
276937
+ resolveGlobalParameterApplicability(intermediateRepresentation, {
276938
+ onWarning: (message) => context3.logger.warn(message)
276939
+ });
276731
276940
  const intermediateRepresentationWithGeneratedExamples = exampleGeneration.disabled ? intermediateRepresentation : injectAutogeneratedExamples({ ir: intermediateRepresentation, exampleGeneration });
276732
276941
  const workspaceDefinitionRootApiFileContents = workspace.definition.rootApiFile.contents;
276733
276942
  const ignoreAudiences = environments2?.environments._visit({
@@ -342272,6 +342481,9 @@ var init_AbstractSpecConverter = __esm({
342272
342481
  hasPaginatedEndpoints,
342273
342482
  hasFileDownloadEndpoints
342274
342483
  };
342484
+ resolveGlobalParameterApplicability(this.ir, {
342485
+ onWarning: (message) => this.context.logger.warn(message)
342486
+ });
342275
342487
  let ir3 = {
342276
342488
  ...this.ir,
342277
342489
  apiName: this.context.casingsGenerator.generateName(this.ir.apiDisplayName ?? ""),
@@ -688631,7 +688843,7 @@ var AccessTokenPosthogManager = class {
688631
688843
  properties: {
688632
688844
  ...event,
688633
688845
  ...event.properties,
688634
- version: "5.65.8",
688846
+ version: "5.66.1",
688635
688847
  usingAccessToken: true,
688636
688848
  ...getRunIdProperties()
688637
688849
  }
@@ -688697,7 +688909,7 @@ var UserPosthogManager = class {
688697
688909
  distinctId: this.userId ?? await this.getPersistedDistinctId(),
688698
688910
  event: "CLI",
688699
688911
  properties: {
688700
- version: "5.65.8",
688912
+ version: "5.66.1",
688701
688913
  ...event,
688702
688914
  ...event.properties,
688703
688915
  usingAccessToken: false,
@@ -869798,7 +870010,7 @@ var LOCAL_STORAGE_FOLDER4 = ".fern-dev";
869798
870010
  var LOGS_FOLDER_NAME = "logs";
869799
870011
  var MAX_LOGS_DIR_SIZE_BYTES = 100 * 1024 * 1024;
869800
870012
  function getCliSource() {
869801
- const version7 = "5.65.8";
870013
+ const version7 = "5.66.1";
869802
870014
  return `cli@${version7}`;
869803
870015
  }
869804
870016
  var DebugLogger = class {
@@ -900228,7 +900440,7 @@ function validateBasepathAlignment(instanceUrl, customDomains, context3) {
900228
900440
  for (const customDomain of customDomains) {
900229
900441
  const customDomainBasepath = getBasepath(customDomain);
900230
900442
  if (urlBasepath !== customDomainBasepath) {
900231
- context3.failAndThrow(`Basepath mismatch between Fern url and custom-domain. When basepath-aware mode is enabled (via 'multi-source: true' or the deprecated 'experimental.basepath-aware: true'), the instance 'url' and 'custom-domain' must share the same basepath, otherwise docs will fail to resolve after DNS cutover. Instance url '${instanceUrl}' has basepath '${urlBasepath}' but custom-domain '${customDomain}' has basepath '${customDomainBasepath}'.`, void 0, { code: CliError.Code.ConfigError });
900443
+ context3.failAndThrow(`Basepath mismatch between Fern url and custom-domain. The instance 'url' and 'custom-domain' must share the same basepath, since navigation links and redirects are generated relative to the basepath and would break on a custom domain with a different one. Instance url '${instanceUrl}' has basepath '${urlBasepath}' but custom-domain '${customDomain}' has basepath '${customDomainBasepath}'.`, void 0, { code: CliError.Code.ConfigError });
900232
900444
  }
900233
900445
  }
900234
900446
  }
@@ -902269,10 +902481,7 @@ ${available}` : `No docs instance found. Failed to register.`, void 0, { code: C
902269
902481
  return;
902270
902482
  }
902271
902483
  const customDomains = (typeof maybeInstance.customDomain === "string" ? [maybeInstance.customDomain] : maybeInstance.customDomain ?? []).map(stripCustomDomainProtocol);
902272
- const isBasepathAware = maybeInstance.multiSource === true || docsWorkspace.config.experimental?.basepathAware === true;
902273
- if (isBasepathAware) {
902274
- validateBasepathAlignment(maybeInstance.url, customDomains, context3);
902275
- }
902484
+ validateBasepathAlignment(maybeInstance.url, customDomains, context3);
902276
902485
  context3.logger.info(`Starting docs publishing for ${preview ? "preview" : "production"}: ${maybeInstance.url}`);
902277
902486
  context3.logger.debug(`Organization: ${organization}, Preview: ${preview}, APIs: ${apiWorkspaces.length}, OSS: ${ossWorkspaces.length}`);
902278
902487
  let publishedUrl;
@@ -902360,7 +902569,7 @@ var LegacyDocsPublisher = class {
902360
902569
  previewId,
902361
902570
  disableTemplates: void 0,
902362
902571
  skipUpload,
902363
- cliVersion: "5.65.8",
902572
+ cliVersion: "5.66.1",
902364
902573
  loginCommand: "fern auth login"
902365
902574
  });
902366
902575
  if (taskContext.getResult() === TaskResult.Failure) {
@@ -968689,7 +968898,7 @@ function getAutomationContextFromEnv() {
968689
968898
  config_branch: process.env.FERN_CONFIG_BRANCH,
968690
968899
  config_pr_number: process.env.FERN_CONFIG_PR_NUMBER,
968691
968900
  trigger: process.env.GITHUB_EVENT_NAME,
968692
- cli_version: "5.65.8"
968901
+ cli_version: "5.66.1"
968693
968902
  };
968694
968903
  }
968695
968904
  function isAutomationMode() {
@@ -969521,7 +969730,7 @@ var CliContext = class _CliContext {
969521
969730
  if (false) {
969522
969731
  this.logger.error("CLI_VERSION is not defined");
969523
969732
  }
969524
- return "5.65.8";
969733
+ return "5.66.1";
969525
969734
  }
969526
969735
  getCliName() {
969527
969736
  if (false) {
package/package.json CHANGED
@@ -1,5 +1,5 @@
1
1
  {
2
- "version": "5.65.8",
2
+ "version": "5.66.1",
3
3
  "repository": {
4
4
  "type": "git",
5
5
  "url": "git+https://github.com/fern-api/fern.git",