@fern-api/fern-api-dev 5.23.2-2-ga13d1c8b952 → 5.23.2-4-gd98afb05abc

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 +377 -122
  2. package/package.json +1 -1
package/cli.cjs CHANGED
@@ -600331,6 +600331,52 @@ function injectAutogeneratedV2Examples({ ir: ir11, exampleGeneration, logger: lo
600331
600331
  // ../../commons/ir-utils/lib/filtered-ir/filterIntermediateRepresentationForAudiences.js
600332
600332
  init_lodash();
600333
600333
 
600334
+ // ../../commons/ir-utils/lib/utils/stringifyFernFilepath.js
600335
+ function stringifyFernFilepath(fernFilepath) {
600336
+ return fernFilepath.allParts.map((part) => getOriginalName(part)).join("/");
600337
+ }
600338
+
600339
+ // ../../commons/ir-utils/lib/utils/IdGenerator.js
600340
+ var IdGenerator = {
600341
+ generateTypeId: (typeName) => {
600342
+ const joinedFernFilePath = stringifyFernFilepath(typeName.fernFilepath);
600343
+ return `type_${joinedFernFilePath}:${getOriginalName(typeName.name)}`;
600344
+ },
600345
+ generateErrorId: (errorName) => {
600346
+ const joinedFernFilePath = stringifyFernFilepath(errorName.fernFilepath);
600347
+ return `error_${joinedFernFilePath}:${getOriginalName(errorName.name)}`;
600348
+ },
600349
+ generateServiceId: (serviceName2) => {
600350
+ const joinedFernFilePath = stringifyFernFilepath(serviceName2.fernFilepath);
600351
+ return `service_${joinedFernFilePath}`;
600352
+ },
600353
+ generateServiceIdFromFernFilepath: (fernFilepath) => {
600354
+ const joinedFernFilePath = stringifyFernFilepath(fernFilepath);
600355
+ return `service_${joinedFernFilePath}`;
600356
+ },
600357
+ generateSubpackageId: (fernFilepath) => {
600358
+ const joinedFernFilePath = stringifyFernFilepath(fernFilepath);
600359
+ return `subpackage_${joinedFernFilePath}`;
600360
+ },
600361
+ generateEndpointId: (declaredServiceName, httpEndpoint) => {
600362
+ const joinedFernFilePath = stringifyFernFilepath(declaredServiceName.fernFilepath);
600363
+ const endpointId = getOriginalName(httpEndpoint.name);
600364
+ return `endpoint_${joinedFernFilePath}.${endpointId}`;
600365
+ },
600366
+ generateWebhookGroupId: (fernFilepath) => {
600367
+ const joinedFernFilePath = stringifyFernFilepath(fernFilepath);
600368
+ return `webhooks_${joinedFernFilePath}`;
600369
+ },
600370
+ generateWebhookId: (fernFilepath, webhookId) => {
600371
+ const joinedFernFilePath = stringifyFernFilepath(fernFilepath);
600372
+ return `webhooks_${joinedFernFilePath}.${webhookId}`;
600373
+ },
600374
+ generateWebSocketChannelId: (fernFilepath) => {
600375
+ const joinedFernFilePath = stringifyFernFilepath(fernFilepath);
600376
+ return `channel_${joinedFernFilePath}`;
600377
+ }
600378
+ };
600379
+
600334
600380
  // ../../commons/ir-utils/lib/filtered-ir/filterExamples.js
600335
600381
  init_lib4();
600336
600382
  function filterJsonExampleObjectKeys(jsonExample, allowedKeys) {
@@ -600706,6 +600752,99 @@ function filterExampleType({ filteredIr, exampleType }) {
600706
600752
  }
600707
600753
  });
600708
600754
  }
600755
+ function stripTopLevelKeysFromJsonExample(value2, isAllowed) {
600756
+ if (value2 == null || typeof value2 !== "object" || Array.isArray(value2)) {
600757
+ return value2;
600758
+ }
600759
+ const out = {};
600760
+ for (const [key2, v9] of Object.entries(value2)) {
600761
+ if (isAllowed(key2)) {
600762
+ out[key2] = v9;
600763
+ }
600764
+ }
600765
+ return out;
600766
+ }
600767
+ function scrubV2SchemaExampleMap(map16, isAllowed) {
600768
+ return Object.fromEntries(Object.entries(map16).map(([name2, value2]) => [name2, stripTopLevelKeysFromJsonExample(value2, isAllowed)]));
600769
+ }
600770
+ function scrubV2SchemaExamples(v2Examples, isAllowed) {
600771
+ if (v2Examples == null) {
600772
+ return v2Examples;
600773
+ }
600774
+ return {
600775
+ userSpecifiedExamples: scrubV2SchemaExampleMap(v2Examples.userSpecifiedExamples, isAllowed),
600776
+ autogeneratedExamples: scrubV2SchemaExampleMap(v2Examples.autogeneratedExamples, isAllowed)
600777
+ };
600778
+ }
600779
+ function getNamedTypeIdFromTypeReference(typeReference2) {
600780
+ return typeReference2._visit({
600781
+ named: (declaredTypeName) => IdGenerator.generateTypeId(declaredTypeName),
600782
+ container: (container) => container._visit({
600783
+ optional: (inner2) => getNamedTypeIdFromTypeReference(inner2),
600784
+ nullable: (inner2) => getNamedTypeIdFromTypeReference(inner2),
600785
+ list: (inner2) => getNamedTypeIdFromTypeReference(inner2),
600786
+ set: (inner2) => getNamedTypeIdFromTypeReference(inner2),
600787
+ map: () => void 0,
600788
+ literal: () => void 0,
600789
+ _other: () => void 0
600790
+ }),
600791
+ primitive: () => void 0,
600792
+ unknown: () => void 0,
600793
+ _other: () => void 0
600794
+ });
600795
+ }
600796
+ function scrubV2HttpEndpointExamples({ v2Examples, requestBodyIsAllowed, responseBodyIsAllowed, queryParameterIsAllowed }) {
600797
+ if (v2Examples == null) {
600798
+ return v2Examples;
600799
+ }
600800
+ const scrubExampleMap = (examples) => {
600801
+ return Object.fromEntries(Object.entries(examples).map(([name2, example]) => [
600802
+ name2,
600803
+ {
600804
+ ...example,
600805
+ request: example.request != null ? {
600806
+ ...example.request,
600807
+ requestBody: stripTopLevelKeysFromJsonExample(example.request.requestBody, requestBodyIsAllowed),
600808
+ queryParameters: example.request.queryParameters != null ? Object.fromEntries(Object.entries(example.request.queryParameters).filter(([key2]) => queryParameterIsAllowed(key2))) : example.request.queryParameters
600809
+ } : example.request,
600810
+ response: example.response?.body != null ? {
600811
+ ...example.response,
600812
+ body: scrubV2HttpEndpointResponseBody(example.response.body, responseBodyIsAllowed)
600813
+ } : example.response
600814
+ }
600815
+ ]));
600816
+ };
600817
+ return {
600818
+ userSpecifiedExamples: scrubExampleMap(v2Examples.userSpecifiedExamples),
600819
+ autogeneratedExamples: scrubExampleMap(v2Examples.autogeneratedExamples)
600820
+ };
600821
+ }
600822
+ function scrubV2HttpEndpointResponseBody(body, responseBodyIsAllowed) {
600823
+ return body._visit({
600824
+ json: (value2) => api_exports.V2HttpEndpointResponseBody.json(stripTopLevelKeysFromJsonExample(value2, responseBodyIsAllowed)),
600825
+ error: (value2) => api_exports.V2HttpEndpointResponseBody.error(value2),
600826
+ stream: (value2) => api_exports.V2HttpEndpointResponseBody.stream(value2),
600827
+ _other: () => body
600828
+ });
600829
+ }
600830
+ function scrubV2WebhookExamples(v2Examples, isAllowed) {
600831
+ if (v2Examples == null) {
600832
+ return v2Examples;
600833
+ }
600834
+ const scrubExampleMap = (examples) => {
600835
+ return Object.fromEntries(Object.entries(examples).map(([name2, example]) => [
600836
+ name2,
600837
+ {
600838
+ ...example,
600839
+ payload: stripTopLevelKeysFromJsonExample(example.payload, isAllowed)
600840
+ }
600841
+ ]));
600842
+ };
600843
+ return {
600844
+ userSpecifiedExamples: scrubExampleMap(v2Examples.userSpecifiedExamples),
600845
+ autogeneratedExamples: scrubExampleMap(v2Examples.autogeneratedExamples)
600846
+ };
600847
+ }
600709
600848
 
600710
600849
  // ../../commons/ir-utils/lib/filtered-ir/filterIntermediateRepresentationForAudiences.js
600711
600850
  function filterIntermediateRepresentationForAudiences(intermediateRepresentation, filteredIr) {
@@ -600714,11 +600853,14 @@ function filterIntermediateRepresentationForAudiences(intermediateRepresentation
600714
600853
  }
600715
600854
  const filteredTypes = pickBy_default(intermediateRepresentation.types, (type8) => filteredIr.hasType(type8));
600716
600855
  const filteredTypesAndProperties = Object.fromEntries(Object.entries(filteredTypes).map(([typeId, typeDeclaration2]) => {
600856
+ const propertyLookupTypeId = IdGenerator.generateTypeId(typeDeclaration2.name);
600857
+ const isPropertyAllowed = (wireName) => filteredIr.hasProperty(propertyLookupTypeId, wireName);
600717
600858
  const filteredProperties = [];
600718
600859
  typeDeclaration2.userProvidedExamples = typeDeclaration2.userProvidedExamples.map((example) => filterExampleType({ filteredIr, exampleType: example })).filter((ex) => ex !== void 0);
600860
+ typeDeclaration2.v2Examples = scrubV2SchemaExamples(typeDeclaration2.v2Examples, isPropertyAllowed);
600719
600861
  if (typeDeclaration2.shape.type === "object") {
600720
600862
  for (const property24 of typeDeclaration2.shape.properties) {
600721
- const hasProperty2 = filteredIr.hasProperty(typeId, getWireValue(property24.name));
600863
+ const hasProperty2 = isPropertyAllowed(getWireValue(property24.name));
600722
600864
  if (hasProperty2) {
600723
600865
  filteredProperties.push(property24);
600724
600866
  }
@@ -600739,13 +600881,20 @@ function filterIntermediateRepresentationForAudiences(intermediateRepresentation
600739
600881
  const filteredWebhookGroups = Object.fromEntries(Object.entries(intermediateRepresentation.webhookGroups).map(([webhookGroupId, webhookGroup]) => {
600740
600882
  const filteredWebhooks = webhookGroup.filter((webhook) => filteredIr.hasWebhook(webhook)).map((webhook) => {
600741
600883
  const webhookId = webhook.id;
600884
+ let payloadKeyIsAllowed = () => true;
600742
600885
  if (webhook.payload.type === "inlinedPayload" && webhookId != null) {
600886
+ payloadKeyIsAllowed = (key2) => filteredIr.hasWebhookPayloadProperty(webhookId, key2);
600743
600887
  webhook.payload = {
600744
600888
  ...webhook.payload,
600745
600889
  properties: webhook.payload.properties.filter((property24) => {
600746
- return filteredIr.hasWebhookPayloadProperty(webhookId, getWireValue(property24.name));
600890
+ return payloadKeyIsAllowed(getWireValue(property24.name));
600747
600891
  })
600748
600892
  };
600893
+ } else if (webhook.payload.type === "reference") {
600894
+ const referencedTypeId = getNamedTypeIdFromTypeReference(webhook.payload.payloadType);
600895
+ if (referencedTypeId != null) {
600896
+ payloadKeyIsAllowed = (key2) => filteredIr.hasProperty(referencedTypeId, key2);
600897
+ }
600749
600898
  }
600750
600899
  if (webhook.examples != null && webhookId != null) {
600751
600900
  webhook.examples = webhook.examples.map((example) => ({
@@ -600757,6 +600906,7 @@ function filterIntermediateRepresentationForAudiences(intermediateRepresentation
600757
600906
  })
600758
600907
  }));
600759
600908
  }
600909
+ webhook.v2Examples = scrubV2WebhookExamples(webhook.v2Examples, payloadKeyIsAllowed);
600760
600910
  return webhook;
600761
600911
  });
600762
600912
  return [webhookGroupId, filteredWebhooks];
@@ -600796,51 +600946,135 @@ function filterIntermediateRepresentationForAudiences(intermediateRepresentation
600796
600946
  errors: pickBy_default(intermediateRepresentation.errors, (error50) => filteredIr.hasError(error50)),
600797
600947
  services: mapValues_default(pickBy_default(intermediateRepresentation.services, (httpService) => filteredIr.hasService(httpService)), (httpService) => ({
600798
600948
  ...httpService,
600799
- endpoints: httpService.endpoints.filter((httpEndpoint) => filteredIr.hasEndpoint(httpEndpoint)).map((httpEndpoint) => {
600800
- const endpointId = httpEndpoint.id;
600801
- httpEndpoint.autogeneratedExamples = httpEndpoint.autogeneratedExamples.map((autogenerated) => {
600802
- return {
600803
- ...autogenerated,
600804
- example: filterEndpointExample({
600805
- filteredIr,
600806
- example: autogenerated.example,
600807
- endpointId
600808
- })
600809
- };
600810
- });
600811
- httpEndpoint.userSpecifiedExamples = httpEndpoint.userSpecifiedExamples.map((userSpecified) => {
600949
+ endpoints: httpService.endpoints.filter((httpEndpoint) => filteredIr.hasEndpoint(httpEndpoint)).map((httpEndpoint) => filterHttpEndpoint(httpEndpoint, filteredIr))
600950
+ })),
600951
+ websocketChannels: filteredChannels,
600952
+ webhookGroups: filteredWebhookGroups,
600953
+ serviceTypeReferenceInfo: filterServiceTypeReferenceInfoForAudiences(intermediateRepresentation.serviceTypeReferenceInfo, filteredIr)
600954
+ };
600955
+ }
600956
+ function getRequestBodyKeyPredicate(httpEndpoint, filteredIr) {
600957
+ const body = httpEndpoint.requestBody;
600958
+ if (body == null) {
600959
+ return () => true;
600960
+ }
600961
+ if (body.type === "inlinedRequestBody") {
600962
+ return (key2) => filteredIr.hasRequestProperty(httpEndpoint.id, key2);
600963
+ }
600964
+ if (body.type === "reference") {
600965
+ const referencedTypeId = getNamedTypeIdFromTypeReference(body.requestBodyType);
600966
+ if (referencedTypeId != null) {
600967
+ return (key2) => filteredIr.hasProperty(referencedTypeId, key2);
600968
+ }
600969
+ }
600970
+ return () => true;
600971
+ }
600972
+ function getResponseBodyKeyPredicate(httpEndpoint, filteredIr) {
600973
+ const body = httpEndpoint.response?.body;
600974
+ if (body?.type !== "json") {
600975
+ return () => true;
600976
+ }
600977
+ const inner2 = body.value;
600978
+ const responseBodyType = inner2.type === "response" || inner2.type === "nestedPropertyAsResponse" ? inner2.responseBodyType : void 0;
600979
+ if (responseBodyType == null) {
600980
+ return () => true;
600981
+ }
600982
+ const referencedTypeId = getNamedTypeIdFromTypeReference(responseBodyType);
600983
+ if (referencedTypeId == null) {
600984
+ return () => true;
600985
+ }
600986
+ return (key2) => filteredIr.hasProperty(referencedTypeId, key2);
600987
+ }
600988
+ function filterHttpEndpoint(httpEndpoint, filteredIr) {
600989
+ const endpointId = httpEndpoint.id;
600990
+ const requestBodyKeyIsAllowed = getRequestBodyKeyPredicate(httpEndpoint, filteredIr);
600991
+ const responseBodyKeyIsAllowed = getResponseBodyKeyPredicate(httpEndpoint, filteredIr);
600992
+ const queryParameterKeyIsAllowed = (key2) => filteredIr.hasQueryParameter(endpointId, key2);
600993
+ httpEndpoint.autogeneratedExamples = httpEndpoint.autogeneratedExamples.map((autogenerated) => ({
600994
+ ...autogenerated,
600995
+ example: filterEndpointExample({ filteredIr, example: autogenerated.example, endpointId })
600996
+ }));
600997
+ httpEndpoint.userSpecifiedExamples = httpEndpoint.userSpecifiedExamples.map((userSpecified) => ({
600998
+ ...userSpecified,
600999
+ example: userSpecified.example != null ? filterEndpointExample({ filteredIr, example: userSpecified.example, endpointId }) : void 0
601000
+ }));
601001
+ if (httpEndpoint.queryParameters.length > 0) {
601002
+ httpEndpoint.queryParameters = httpEndpoint.queryParameters.filter((queryParameter) => queryParameterKeyIsAllowed(getWireValue(queryParameter.name)));
601003
+ }
601004
+ httpEndpoint.v2Examples = scrubV2HttpEndpointExamples({
601005
+ v2Examples: httpEndpoint.v2Examples,
601006
+ requestBodyIsAllowed: requestBodyKeyIsAllowed,
601007
+ responseBodyIsAllowed: responseBodyKeyIsAllowed,
601008
+ queryParameterIsAllowed: queryParameterKeyIsAllowed
601009
+ });
601010
+ if (httpEndpoint.response?.body?.type === "json") {
601011
+ const inner2 = httpEndpoint.response.body.value;
601012
+ if (inner2.type === "response" || inner2.type === "nestedPropertyAsResponse") {
601013
+ inner2.v2Examples = scrubV2SchemaExamples(inner2.v2Examples, responseBodyKeyIsAllowed);
601014
+ }
601015
+ }
601016
+ if (httpEndpoint.v2Responses?.responses != null) {
601017
+ httpEndpoint.v2Responses = {
601018
+ ...httpEndpoint.v2Responses,
601019
+ responses: httpEndpoint.v2Responses.responses.map((resp) => {
601020
+ if (resp.body?.type !== "json") {
601021
+ return resp;
601022
+ }
601023
+ const inner2 = resp.body.value;
601024
+ if (inner2.type === "response" || inner2.type === "nestedPropertyAsResponse") {
600812
601025
  return {
600813
- ...userSpecified,
600814
- example: userSpecified.example != null ? filterEndpointExample({
600815
- filteredIr,
600816
- example: userSpecified.example,
600817
- endpointId
600818
- }) : void 0
601026
+ ...resp,
601027
+ body: {
601028
+ ...resp.body,
601029
+ value: {
601030
+ ...inner2,
601031
+ v2Examples: scrubV2SchemaExamples(inner2.v2Examples, responseBodyKeyIsAllowed)
601032
+ }
601033
+ }
600819
601034
  };
600820
- });
600821
- if (httpEndpoint.queryParameters.length > 0) {
600822
- httpEndpoint.queryParameters = httpEndpoint.queryParameters.filter((queryParameter) => {
600823
- return filteredIr.hasQueryParameter(httpEndpoint.id, getWireValue(queryParameter.name));
600824
- });
600825
601035
  }
600826
- if (httpEndpoint.requestBody?.type === "inlinedRequestBody") {
601036
+ return resp;
601037
+ })
601038
+ };
601039
+ }
601040
+ if (httpEndpoint.v2RequestBodies?.requestBodies != null) {
601041
+ httpEndpoint.v2RequestBodies = {
601042
+ ...httpEndpoint.v2RequestBodies,
601043
+ requestBodies: httpEndpoint.v2RequestBodies.requestBodies.map((body) => {
601044
+ if (body.type === "inlinedRequestBody") {
600827
601045
  return {
600828
- ...httpEndpoint,
600829
- requestBody: {
600830
- ...httpEndpoint.requestBody,
600831
- properties: httpEndpoint.requestBody.properties.filter((property24) => {
600832
- return filteredIr.hasRequestProperty(httpEndpoint.id, getWireValue(property24.name));
600833
- })
600834
- }
601046
+ ...body,
601047
+ properties: body.properties.filter((property24) => requestBodyKeyIsAllowed(getWireValue(property24.name))),
601048
+ v2Examples: scrubV2SchemaExamples(body.v2Examples, requestBodyKeyIsAllowed)
600835
601049
  };
600836
601050
  }
600837
- return httpEndpoint;
601051
+ if (body.type === "reference") {
601052
+ return { ...body, v2Examples: scrubV2SchemaExamples(body.v2Examples, requestBodyKeyIsAllowed) };
601053
+ }
601054
+ return body;
600838
601055
  })
600839
- })),
600840
- websocketChannels: filteredChannels,
600841
- webhookGroups: filteredWebhookGroups,
600842
- serviceTypeReferenceInfo: filterServiceTypeReferenceInfoForAudiences(intermediateRepresentation.serviceTypeReferenceInfo, filteredIr)
600843
- };
601056
+ };
601057
+ }
601058
+ if (httpEndpoint.requestBody?.type === "inlinedRequestBody") {
601059
+ return {
601060
+ ...httpEndpoint,
601061
+ requestBody: {
601062
+ ...httpEndpoint.requestBody,
601063
+ properties: httpEndpoint.requestBody.properties.filter((property24) => requestBodyKeyIsAllowed(getWireValue(property24.name))),
601064
+ v2Examples: scrubV2SchemaExamples(httpEndpoint.requestBody.v2Examples, requestBodyKeyIsAllowed)
601065
+ }
601066
+ };
601067
+ }
601068
+ if (httpEndpoint.requestBody?.type === "reference") {
601069
+ return {
601070
+ ...httpEndpoint,
601071
+ requestBody: {
601072
+ ...httpEndpoint.requestBody,
601073
+ v2Examples: scrubV2SchemaExamples(httpEndpoint.requestBody.v2Examples, requestBodyKeyIsAllowed)
601074
+ }
601075
+ };
601076
+ }
601077
+ return httpEndpoint;
600844
601078
  }
600845
601079
  function filterServiceTypeReferenceInfoForAudiences(serviceTypeReferenceInfo, filteredIr) {
600846
601080
  if (filteredIr == null) {
@@ -600878,52 +601112,6 @@ function getPropertiesByAudience(properties7) {
600878
601112
  // ../../commons/ir-utils/lib/filtered-ir/IrGraph.js
600879
601113
  init_lib4();
600880
601114
 
600881
- // ../../commons/ir-utils/lib/utils/stringifyFernFilepath.js
600882
- function stringifyFernFilepath(fernFilepath) {
600883
- return fernFilepath.allParts.map((part) => getOriginalName(part)).join("/");
600884
- }
600885
-
600886
- // ../../commons/ir-utils/lib/utils/IdGenerator.js
600887
- var IdGenerator = {
600888
- generateTypeId: (typeName) => {
600889
- const joinedFernFilePath = stringifyFernFilepath(typeName.fernFilepath);
600890
- return `type_${joinedFernFilePath}:${getOriginalName(typeName.name)}`;
600891
- },
600892
- generateErrorId: (errorName) => {
600893
- const joinedFernFilePath = stringifyFernFilepath(errorName.fernFilepath);
600894
- return `error_${joinedFernFilePath}:${getOriginalName(errorName.name)}`;
600895
- },
600896
- generateServiceId: (serviceName2) => {
600897
- const joinedFernFilePath = stringifyFernFilepath(serviceName2.fernFilepath);
600898
- return `service_${joinedFernFilePath}`;
600899
- },
600900
- generateServiceIdFromFernFilepath: (fernFilepath) => {
600901
- const joinedFernFilePath = stringifyFernFilepath(fernFilepath);
600902
- return `service_${joinedFernFilePath}`;
600903
- },
600904
- generateSubpackageId: (fernFilepath) => {
600905
- const joinedFernFilePath = stringifyFernFilepath(fernFilepath);
600906
- return `subpackage_${joinedFernFilePath}`;
600907
- },
600908
- generateEndpointId: (declaredServiceName, httpEndpoint) => {
600909
- const joinedFernFilePath = stringifyFernFilepath(declaredServiceName.fernFilepath);
600910
- const endpointId = getOriginalName(httpEndpoint.name);
600911
- return `endpoint_${joinedFernFilePath}.${endpointId}`;
600912
- },
600913
- generateWebhookGroupId: (fernFilepath) => {
600914
- const joinedFernFilePath = stringifyFernFilepath(fernFilepath);
600915
- return `webhooks_${joinedFernFilePath}`;
600916
- },
600917
- generateWebhookId: (fernFilepath, webhookId) => {
600918
- const joinedFernFilePath = stringifyFernFilepath(fernFilepath);
600919
- return `webhooks_${joinedFernFilePath}.${webhookId}`;
600920
- },
600921
- generateWebSocketChannelId: (fernFilepath) => {
600922
- const joinedFernFilePath = stringifyFernFilepath(fernFilepath);
600923
- return `channel_${joinedFernFilePath}`;
600924
- }
600925
- };
600926
-
600927
601115
  // ../../commons/ir-utils/lib/utils/isReferencedWebhookPayloadSchema.js
600928
601116
  function isReferencedWebhookPayloadSchema(payload) {
600929
601117
  return payload.type != null;
@@ -601291,6 +601479,19 @@ var IrGraph = class {
601291
601479
  this.addSubpackages(filepath);
601292
601480
  }
601293
601481
  }
601482
+ /**
601483
+ * Registers inline request body audience info for importers that don't pass a raw Fern
601484
+ * Definition (e.g. OpenAPI V3). Properties absent from every audience set are universal.
601485
+ */
601486
+ markInlinedRequestPropertiesForAudiences(endpointId, propertiesByAudience) {
601487
+ this.requestProperties[endpointId] = { endpointId, propertiesByAudience };
601488
+ }
601489
+ markQueryParametersForAudiences(endpointId, parametersByAudience) {
601490
+ this.queryParameters[endpointId] = { endpointId, parametersByAudience };
601491
+ }
601492
+ markInlinedWebhookPayloadPropertiesForAudiences(webhookId, propertiesByAudience) {
601493
+ this.webhookProperties[webhookId] = { webhookId, propertiesByAudience };
601494
+ }
601294
601495
  addChannel(filepath, channelId, channel3, rawChannel) {
601295
601496
  if (channelId == null) {
601296
601497
  return;
@@ -646926,25 +647127,15 @@ var AbstractSpecConverter = class extends AbstractConverter {
646926
647127
  ...irWithV2Examples
646927
647128
  };
646928
647129
  }
647130
+ /** Delegates to the shared IR audience filter so V3 importers share Fern Definition semantics. */
646929
647131
  filterIrForAudiences(ir11) {
646930
- const filteredEndpoints = this.irGraph.getFilteredEndpoints();
646931
- const filteredChannels = this.irGraph.getFilteredChannels();
646932
- const filteredWebhooks = this.irGraph.getFilteredWebhooks();
646933
- for (const service of Object.values(ir11.services)) {
646934
- const updatedEndpoints = [];
646935
- for (const endpoint3 of service.endpoints) {
646936
- if (filteredEndpoints.has(endpoint3.id)) {
646937
- updatedEndpoints.push(endpoint3);
646938
- }
646939
- }
646940
- service.endpoints = updatedEndpoints;
646941
- }
646942
- ir11.websocketChannels = Object.fromEntries(Object.entries(ir11.websocketChannels ?? {}).filter(([channelId]) => filteredChannels.has(channelId)));
646943
- ir11.webhookGroups = Object.fromEntries(Object.entries(ir11.webhookGroups).map(([webhookGroupId, webhookGroup]) => {
646944
- const filteredWebhookGroup = webhookGroup.filter((webhook) => webhook.id != null && filteredWebhooks.has(webhook.id));
646945
- return [webhookGroupId, filteredWebhookGroup];
646946
- }));
646947
- return ir11;
647132
+ const filtered = filterIntermediateRepresentationForAudiences(ir11, this.irGraph.build());
647133
+ return {
647134
+ ...filtered,
647135
+ sdkConfig: ir11.sdkConfig,
647136
+ subpackages: ir11.subpackages,
647137
+ rootPackage: ir11.rootPackage
647138
+ };
646948
647139
  }
646949
647140
  async resolveAllExternalRefs({ spec }) {
646950
647141
  const queue = [spec];
@@ -646998,7 +647189,7 @@ var AbstractSpecConverter = class extends AbstractConverter {
646998
647189
  return !currentServers.some((s9) => s9.url === server.url && "name" in s9 && "name" in server && s9["name"] === server["name"]);
646999
647190
  }
647000
647191
  }
647001
- addEndpointToIr({ endpoint: endpoint3, audiences, endpointGroup, endpointGroupDisplayName, serviceName: serviceName2 }) {
647192
+ addEndpointToIr({ endpoint: endpoint3, audiences, endpointGroup, endpointGroupDisplayName, serviceName: serviceName2, inlinedRequestPropertiesByAudience, queryParametersByAudience }) {
647002
647193
  const group = this.context.getGroup({
647003
647194
  groupParts: endpointGroup,
647004
647195
  namespace: this.context.namespace
@@ -647017,9 +647208,15 @@ var AbstractSpecConverter = class extends AbstractConverter {
647017
647208
  if (service != null) {
647018
647209
  this.irGraph.addEndpoint(service, endpoint3);
647019
647210
  this.irGraph.markEndpointForAudience(service.name, [endpoint3], audiences);
647211
+ if (inlinedRequestPropertiesByAudience != null && Object.keys(inlinedRequestPropertiesByAudience).length > 0) {
647212
+ this.irGraph.markInlinedRequestPropertiesForAudiences(endpoint3.id, inlinedRequestPropertiesByAudience);
647213
+ }
647214
+ if (queryParametersByAudience != null && Object.keys(queryParametersByAudience).length > 0) {
647215
+ this.irGraph.markQueryParametersForAudiences(endpoint3.id, queryParametersByAudience);
647216
+ }
647020
647217
  }
647021
647218
  }
647022
- addWebhookToIr({ webhook, operationId, audiences, group }) {
647219
+ addWebhookToIr({ webhook, operationId, audiences, group, inlinedPayloadPropertiesByAudience }) {
647023
647220
  const groupName = group?.join(".") ?? operationId;
647024
647221
  const pkg2 = this.getOrCreatePackage({
647025
647222
  group
@@ -647034,6 +647231,9 @@ var AbstractSpecConverter = class extends AbstractConverter {
647034
647231
  if (audiences != null) {
647035
647232
  this.irGraph.markWebhookForAudiences(emptyFile, webhook, audiences);
647036
647233
  }
647234
+ if (webhook.id != null && inlinedPayloadPropertiesByAudience != null && Object.keys(inlinedPayloadPropertiesByAudience).length > 0) {
647235
+ this.irGraph.markInlinedWebhookPayloadPropertiesForAudiences(webhook.id, inlinedPayloadPropertiesByAudience);
647236
+ }
647037
647237
  }
647038
647238
  addWebsocketChannelToIr({ websocketChannel, channelPath, audiences, websocketGroup }) {
647039
647239
  const channelNameOverride = camelCase_default(websocketGroup?.join("."));
@@ -647072,12 +647272,15 @@ var AbstractSpecConverter = class extends AbstractConverter {
647072
647272
  }
647073
647273
  addEnvironmentsToIr({ environmentConfig, audiences }) {
647074
647274
  this.ir.environments = environmentConfig;
647075
- if (audiences == null) {
647275
+ if (environmentConfig == null) {
647076
647276
  return;
647077
647277
  }
647078
- for (const [environmentId, environment2] of Object.entries(environmentConfig ?? {})) {
647079
- if (audiences[environmentId] != null) {
647080
- this.irGraph.markEnvironmentForAudiences(environment2, audiences[environmentId]);
647278
+ for (const environment2 of environmentConfig.environments.environments) {
647279
+ const envAudiences = audiences?.[environment2.id];
647280
+ if (envAudiences != null) {
647281
+ this.irGraph.markEnvironmentForAudiences(environment2, envAudiences);
647282
+ } else {
647283
+ this.irGraph.markEnvironmentForAudiences(environment2, [], true);
647081
647284
  }
647082
647285
  }
647083
647286
  }
@@ -653263,7 +653466,8 @@ var RequestBodyConverter = class extends converters_exports.AbstractConverters.A
653263
653466
  inlinedTypes: this.context.removeSchemaFromInlinedTypes({
653264
653467
  id: this.schemaId,
653265
653468
  inlinedTypes: convertedSchema.inlinedTypes
653266
- })
653469
+ }),
653470
+ inlinedPropertiesByAudience: convertedSchema.schema?.propertiesByAudience
653267
653471
  };
653268
653472
  } else {
653269
653473
  return {
@@ -653738,7 +653942,8 @@ var AbstractOperationConverter = class extends AbstractConverter {
653738
653942
  convertedRequestBodies.push({
653739
653943
  requestBody: convertedRequestBody.requestBody,
653740
653944
  streamRequestBody: convertedRequestBody.streamRequestBody,
653741
- examples: convertedRequestBody.examples
653945
+ examples: convertedRequestBody.examples,
653946
+ inlinedPropertiesByAudience: convertedRequestBody.inlinedPropertiesByAudience
653742
653947
  });
653743
653948
  }
653744
653949
  }
@@ -653876,6 +654081,7 @@ var WebhookConverter = class extends AbstractOperationConverter {
653876
654081
  if (requestBody == null) {
653877
654082
  return void 0;
653878
654083
  }
654084
+ const inlinedPayloadPropertiesByAudience = requestBody.type === "inlinedRequestBody" ? convertedRequestBody[0]?.inlinedPropertiesByAudience : void 0;
653879
654085
  let payload;
653880
654086
  let fileUploadPayload;
653881
654087
  if (requestBody.type === "inlinedRequestBody") {
@@ -653912,6 +654118,7 @@ var WebhookConverter = class extends AbstractOperationConverter {
653912
654118
  breadcrumbs: this.breadcrumbs
653913
654119
  }) ?? [],
653914
654120
  group,
654121
+ inlinedPayloadPropertiesByAudience,
653915
654122
  webhook: {
653916
654123
  id: `${group?.join(".") ?? ""}.${method8}`,
653917
654124
  name: this.context.casingsGenerator.generateName(method8),
@@ -655168,6 +655375,9 @@ var OperationConverter = class _OperationConverter extends AbstractOperationConv
655168
655375
  const { headers: headers2, pathParameters, queryParameters } = this.convertParameters({
655169
655376
  breadcrumbs: [...this.breadcrumbs, "parameters"]
655170
655377
  });
655378
+ const queryParametersByAudience = this.collectQueryParameterAudiences({
655379
+ breadcrumbs: [...this.breadcrumbs, "parameters"]
655380
+ });
655171
655381
  const convertedRequestBodies = this.convertRequestBody({
655172
655382
  breadcrumbs: [...this.breadcrumbs, "requestBody"],
655173
655383
  group,
@@ -655177,6 +655387,7 @@ var OperationConverter = class _OperationConverter extends AbstractOperationConv
655177
655387
  });
655178
655388
  const requestBody = convertedRequestBodies != null ? convertedRequestBodies[0]?.requestBody : void 0;
655179
655389
  const streamRequestBody = convertedRequestBodies != null ? convertedRequestBodies[0]?.streamRequestBody : void 0;
655390
+ const inlinedRequestPropertiesByAudience = convertedRequestBodies != null ? convertedRequestBodies[0]?.inlinedPropertiesByAudience : void 0;
655180
655391
  const v2RequestBodies = {
655181
655392
  requestBodies: convertedRequestBodies?.map((body) => body.requestBody)
655182
655393
  };
@@ -655337,9 +655548,47 @@ var OperationConverter = class _OperationConverter extends AbstractOperationConv
655337
655548
  }
655338
655549
  } : void 0,
655339
655550
  inlinedTypes: this.inlinedTypes,
655340
- servers: this.filterOutTopLevelServers(this.operation.servers ?? this.pathLevelServers ?? [])
655551
+ servers: this.filterOutTopLevelServers(this.operation.servers ?? this.pathLevelServers ?? []),
655552
+ inlinedRequestPropertiesByAudience,
655553
+ queryParametersByAudience
655341
655554
  };
655342
655555
  }
655556
+ /**
655557
+ * Walks the operation's parameters and groups query parameter wire names by
655558
+ * `x-fern-audiences`. Parameters without an audience tag are omitted (they
655559
+ * are universal — see `computeExcludedKeys` in `IrGraph.build()`). Returns
655560
+ * `undefined` when no query parameter declares any audience to avoid
655561
+ * populating the IR filter graph with empty maps.
655562
+ */
655563
+ collectQueryParameterAudiences({ breadcrumbs }) {
655564
+ if (this.operation.parameters == null) {
655565
+ return void 0;
655566
+ }
655567
+ const audiencesByQueryParameter = {};
655568
+ let foundAny = false;
655569
+ for (const parameter6 of this.operation.parameters) {
655570
+ const resolved = this.context.resolveMaybeReference({
655571
+ schemaOrReference: parameter6,
655572
+ breadcrumbs,
655573
+ skipErrorCollector: true
655574
+ });
655575
+ if (resolved == null || resolved.in !== "query") {
655576
+ continue;
655577
+ }
655578
+ const paramAudiences = this.context.getAudiences({ operation: resolved, breadcrumbs }) ?? [];
655579
+ if (paramAudiences.length === 0) {
655580
+ continue;
655581
+ }
655582
+ foundAny = true;
655583
+ for (const audience of paramAudiences) {
655584
+ if (audiencesByQueryParameter[audience] == null) {
655585
+ audiencesByQueryParameter[audience] = /* @__PURE__ */ new Set();
655586
+ }
655587
+ audiencesByQueryParameter[audience].add(resolved.name);
655588
+ }
655589
+ }
655590
+ return foundAny ? audiencesByQueryParameter : void 0;
655591
+ }
655343
655592
  convertResponseBody({ breadcrumbs, group, method: method8, streamingExtension }) {
655344
655593
  if (this.operation.responses == null) {
655345
655594
  return void 0;
@@ -656329,7 +656578,8 @@ var OpenAPIConverter = class extends AbstractSpecConverter {
656329
656578
  webhook: convertedWebHook.webhook,
656330
656579
  operationId,
656331
656580
  audiences: convertedWebHook.audiences,
656332
- group: convertedWebHook.group
656581
+ group: convertedWebHook.group,
656582
+ inlinedPayloadPropertiesByAudience: convertedWebHook.inlinedPayloadPropertiesByAudience
656333
656583
  });
656334
656584
  this.addTypesToIr(convertedWebHook.inlinedTypes);
656335
656585
  }
@@ -656357,14 +656607,18 @@ var OpenAPIConverter = class extends AbstractSpecConverter {
656357
656607
  endpoint: endpoint3.streamEndpoint,
656358
656608
  audiences: endpoint3.audiences,
656359
656609
  endpointGroup: endpoint3.group,
656360
- endpointGroupDisplayName: endpoint3.groupDisplayName
656610
+ endpointGroupDisplayName: endpoint3.groupDisplayName,
656611
+ inlinedRequestPropertiesByAudience: endpoint3.inlinedRequestPropertiesByAudience,
656612
+ queryParametersByAudience: endpoint3.queryParametersByAudience
656361
656613
  });
656362
656614
  }
656363
656615
  this.addEndpointToIr({
656364
656616
  endpoint: endpoint3.endpoint,
656365
656617
  audiences: endpoint3.audiences,
656366
656618
  endpointGroup: endpoint3.group,
656367
- endpointGroupDisplayName: endpoint3.groupDisplayName
656619
+ endpointGroupDisplayName: endpoint3.groupDisplayName,
656620
+ inlinedRequestPropertiesByAudience: endpoint3.inlinedRequestPropertiesByAudience,
656621
+ queryParametersByAudience: endpoint3.queryParametersByAudience
656368
656622
  });
656369
656623
  if (endpoint3.servers) {
656370
656624
  for (const server of endpoint3.servers) {
@@ -656391,7 +656645,8 @@ var OpenAPIConverter = class extends AbstractSpecConverter {
656391
656645
  webhook: webhook.webhook,
656392
656646
  operationId: group.join("."),
656393
656647
  group,
656394
- audiences: webhook.audiences
656648
+ audiences: webhook.audiences,
656649
+ inlinedPayloadPropertiesByAudience: webhook.inlinedPayloadPropertiesByAudience
656395
656650
  });
656396
656651
  }
656397
656652
  this.addTypesToIr(convertedPath.inlinedTypes);
@@ -667203,7 +667458,7 @@ var AccessTokenPosthogManager = class {
667203
667458
  properties: {
667204
667459
  ...event,
667205
667460
  ...event.properties,
667206
- version: "5.23.2-2-ga13d1c8b952",
667461
+ version: "5.23.2-4-gd98afb05abc",
667207
667462
  usingAccessToken: true,
667208
667463
  ...getRunIdProperties()
667209
667464
  }
@@ -667258,7 +667513,7 @@ var UserPosthogManager = class {
667258
667513
  distinctId: this.userId ?? await this.getPersistedDistinctId(),
667259
667514
  event: "CLI",
667260
667515
  properties: {
667261
- version: "5.23.2-2-ga13d1c8b952",
667516
+ version: "5.23.2-4-gd98afb05abc",
667262
667517
  ...event,
667263
667518
  ...event.properties,
667264
667519
  usingAccessToken: false,
@@ -858538,7 +858793,7 @@ var LOCAL_STORAGE_FOLDER4 = ".fern-dev";
858538
858793
  var LOGS_FOLDER_NAME = "logs";
858539
858794
  var MAX_LOGS_DIR_SIZE_BYTES = 100 * 1024 * 1024;
858540
858795
  function getCliSource() {
858541
- const version7 = "5.23.2-2-ga13d1c8b952";
858796
+ const version7 = "5.23.2-4-gd98afb05abc";
858542
858797
  return `cli@${version7}`;
858543
858798
  }
858544
858799
  var DebugLogger = class {
@@ -871362,7 +871617,7 @@ var LegacyDocsPublisher = class {
871362
871617
  previewId,
871363
871618
  disableTemplates: void 0,
871364
871619
  skipUpload,
871365
- cliVersion: "5.23.2-2-ga13d1c8b952",
871620
+ cliVersion: "5.23.2-4-gd98afb05abc",
871366
871621
  loginCommand: "fern auth login"
871367
871622
  });
871368
871623
  if (taskContext.getResult() === TaskResult.Failure) {
@@ -946107,7 +946362,7 @@ var CliContext = class _CliContext {
946107
946362
  if (false) {
946108
946363
  this.logger.error("CLI_VERSION is not defined");
946109
946364
  }
946110
- return "5.23.2-2-ga13d1c8b952";
946365
+ return "5.23.2-4-gd98afb05abc";
946111
946366
  }
946112
946367
  getCliName() {
946113
946368
  if (false) {
package/package.json CHANGED
@@ -1,5 +1,5 @@
1
1
  {
2
- "version": "5.23.2-2-ga13d1c8b952",
2
+ "version": "5.23.2-4-gd98afb05abc",
3
3
  "repository": {
4
4
  "type": "git",
5
5
  "url": "git+https://github.com/fern-api/fern.git",