fern-api 0.33.1 → 0.33.2-rc0

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/bundle.cjs +51 -15
  2. package/package.json +1 -1
package/bundle.cjs CHANGED
@@ -1164516,7 +1164516,7 @@ var AccessTokenPosthogManager = class {
1164516
1164516
  properties: {
1164517
1164517
  ...event,
1164518
1164518
  ...event.properties,
1164519
- version: "0.33.1",
1164519
+ version: "0.33.2-rc0",
1164520
1164520
  usingAccessToken: true
1164521
1164521
  }
1164522
1164522
  });
@@ -1164578,7 +1164578,7 @@ var UserPosthogManager = class {
1164578
1164578
  distinctId: this.userId ?? await this.getPersistedDistinctId(),
1164579
1164579
  event: "CLI",
1164580
1164580
  properties: {
1164581
- version: "0.33.1",
1164581
+ version: "0.33.2-rc0",
1164582
1164582
  ...event,
1164583
1164583
  ...event.properties
1164584
1164584
  }
@@ -1192304,10 +1192304,10 @@ var CliContext = class {
1192304
1192304
  return "fern-api";
1192305
1192305
  }
1192306
1192306
  getPackageVersion() {
1192307
- if ("0.33.1" == null) {
1192307
+ if ("0.33.2-rc0" == null) {
1192308
1192308
  this.logger.error("CLI_VERSION is not defined");
1192309
1192309
  }
1192310
- return "0.33.1";
1192310
+ return "0.33.2-rc0";
1192311
1192311
  }
1192312
1192312
  getCliName() {
1192313
1192313
  if ("fern" == null) {
@@ -1197014,8 +1197014,8 @@ function isReferencedWebhookPayloadSchema2(payload) {
1197014
1197014
  return payload.type != null;
1197015
1197015
  }
1197016
1197016
 
1197017
- // pnp:/home/runner/work/fern/fern/packages/cli/generation/ir-generator/lib/utils/getPropertiesForAudience.js
1197018
- function getPropertiesForAudience(properties) {
1197017
+ // pnp:/home/runner/work/fern/fern/packages/cli/generation/ir-generator/lib/utils/getPropertiesByAudience.js
1197018
+ function getPropertiesByAudience(properties) {
1197019
1197019
  var _a5;
1197020
1197020
  const propertiesByAudience = {};
1197021
1197021
  for (const [property5, propertyDeclaration] of Object.entries(properties)) {
@@ -1197174,7 +1197174,7 @@ async function convertTypeDeclaration({ typeName, typeDeclaration, file, typeRes
1197174
1197174
  const referencedTypes = getReferencedTypesFromRawDeclaration({ typeDeclaration, file, typeResolver });
1197175
1197175
  let propertiesByAudience = {};
1197176
1197176
  if (isRawObjectDefinition(typeDeclaration)) {
1197177
- propertiesByAudience = getPropertiesForAudience(typeDeclaration.properties ?? {});
1197177
+ propertiesByAudience = getPropertiesByAudience(typeDeclaration.properties ?? {});
1197178
1197178
  }
1197179
1197179
  return {
1197180
1197180
  propertiesByAudience,
@@ -1197846,10 +1197846,11 @@ var FilteredIrImpl = class {
1197846
1197846
  services = /* @__PURE__ */ new Set();
1197847
1197847
  endpoints = /* @__PURE__ */ new Set();
1197848
1197848
  requestProperties;
1197849
+ queryParameters;
1197849
1197850
  webhooks = /* @__PURE__ */ new Set();
1197850
1197851
  webhookPayloadProperties;
1197851
1197852
  subpackages = /* @__PURE__ */ new Set();
1197852
- constructor({ types: types3, errors, services, endpoints, webhooks, subpackages, requestProperties, webhookPayloadProperties, properties }) {
1197853
+ constructor({ types: types3, errors, services, endpoints, webhooks, subpackages, queryParameters, requestProperties, webhookPayloadProperties, properties }) {
1197853
1197854
  this.types = types3;
1197854
1197855
  this.properties = properties;
1197855
1197856
  this.errors = errors;
@@ -1197859,6 +1197860,7 @@ var FilteredIrImpl = class {
1197859
1197860
  this.webhookPayloadProperties = webhookPayloadProperties;
1197860
1197861
  this.subpackages = subpackages;
1197861
1197862
  this.requestProperties = requestProperties;
1197863
+ this.queryParameters = queryParameters;
1197862
1197864
  }
1197863
1197865
  hasTypeId(typeId) {
1197864
1197866
  return this.types.has(typeId);
@@ -1197901,6 +1197903,13 @@ var FilteredIrImpl = class {
1197901
1197903
  }
1197902
1197904
  return properties.has(property5);
1197903
1197905
  }
1197906
+ hasQueryParameter(endpoint, parameter) {
1197907
+ const parameters = this.queryParameters[endpoint];
1197908
+ if (parameters == null) {
1197909
+ return true;
1197910
+ }
1197911
+ return parameters.has(parameter);
1197912
+ }
1197904
1197913
  hasSubpackage(subpackageId) {
1197905
1197914
  return this.subpackages.has(subpackageId);
1197906
1197915
  }
@@ -1197923,6 +1197932,7 @@ var FilteredIrImpl = class {
1197923
1197932
  var IrGraph = class {
1197924
1197933
  types = {};
1197925
1197934
  properties = {};
1197935
+ queryParameters = {};
1197926
1197936
  requestProperties = {};
1197927
1197937
  webhookProperties = {};
1197928
1197938
  errors = {};
@@ -1197999,6 +1198009,13 @@ var IrGraph = class {
1197999
1198009
  for (const queryParameter of httpEndpoint.queryParameters) {
1198000
1198010
  populateReferencesFromTypeReference(queryParameter.valueType, referencedTypes, referencedSubpackages);
1198001
1198011
  }
1198012
+ if (rawEndpoint != null && rawEndpoint.request != null && typeof rawEndpoint.request !== "string") {
1198013
+ const parametersByAudience = getPropertiesByAudience(rawEndpoint.request["query-parameters"] ?? {});
1198014
+ this.queryParameters[endpointId] = {
1198015
+ endpointId,
1198016
+ parametersByAudience
1198017
+ };
1198018
+ }
1198002
1198019
  if (httpEndpoint.requestBody != null) {
1198003
1198020
  HttpRequestBody._visit(httpEndpoint.requestBody, {
1198004
1198021
  inlinedRequestBody: (inlinedRequestBody) => {
@@ -1198009,7 +1198026,7 @@ var IrGraph = class {
1198009
1198026
  populateReferencesFromTypeReference(property5.valueType, referencedTypes, referencedSubpackages);
1198010
1198027
  }
1198011
1198028
  if (rawEndpoint != null && typeof rawEndpoint.request === "object" && typeof rawEndpoint.request.body === "object" && isInlineRequestBody(rawEndpoint.request.body)) {
1198012
- const propertiesByAudience = getPropertiesForAudience(rawEndpoint.request.body.properties ?? {});
1198029
+ const propertiesByAudience = getPropertiesByAudience(rawEndpoint.request.body.properties ?? {});
1198013
1198030
  this.requestProperties[endpointId] = {
1198014
1198031
  endpointId,
1198015
1198032
  propertiesByAudience
@@ -1198124,7 +1198141,7 @@ var IrGraph = class {
1198124
1198141
  populateReferencesFromTypeReference(property5.valueType, referencedTypes, referencedSubpackages);
1198125
1198142
  }
1198126
1198143
  if ((rawWebhook == null ? void 0 : rawWebhook.payload) != null && typeof rawWebhook.payload === "object" && !isReferencedWebhookPayloadSchema2(rawWebhook.payload)) {
1198127
- const propertiesByAudience = getPropertiesForAudience(rawWebhook.payload.properties ?? {});
1198144
+ const propertiesByAudience = getPropertiesByAudience(rawWebhook.payload.properties ?? {});
1198128
1198145
  this.webhookProperties[webhookId] = {
1198129
1198146
  webhookId,
1198130
1198147
  propertiesByAudience
@@ -1198179,6 +1198196,7 @@ var IrGraph = class {
1198179
1198196
  }
1198180
1198197
  const properties = {};
1198181
1198198
  const requestProperties = {};
1198199
+ const queryParameters = {};
1198182
1198200
  const webhookPayloadProperties = {};
1198183
1198201
  if (this.audiences.type === "filtered") {
1198184
1198202
  for (const [typeId, typePropertiesNode] of Object.entries(this.properties)) {
@@ -1198197,6 +1198215,7 @@ var IrGraph = class {
1198197
1198215
  if (propertiesForTypeId.size > 0) {
1198198
1198216
  properties[typeId] = propertiesForTypeId;
1198199
1198217
  }
1198218
+ properties[typeId] = propertiesForTypeId.size > 0 ? propertiesForTypeId : void 0;
1198200
1198219
  }
1198201
1198220
  for (const [endpointId, requestPropertiesNode] of Object.entries(this.requestProperties)) {
1198202
1198221
  if (!this.endpointsNeededForAudience.has(endpointId)) {
@@ -1198211,9 +1198230,22 @@ var IrGraph = class {
1198211
1198230
  });
1198212
1198231
  }
1198213
1198232
  }
1198214
- if (propertiesForEndpoint.size > 0) {
1198215
- requestProperties[endpointId] = propertiesForEndpoint;
1198233
+ requestProperties[endpointId] = propertiesForEndpoint.size > 0 ? propertiesForEndpoint : void 0;
1198234
+ }
1198235
+ for (const [endpointId, queryParametersNode] of Object.entries(this.queryParameters)) {
1198236
+ if (!this.endpointsNeededForAudience.has(endpointId)) {
1198237
+ continue;
1198238
+ }
1198239
+ const parametersForEndpoint = /* @__PURE__ */ new Set();
1198240
+ for (const audience of this.audiences.audiences) {
1198241
+ const parametersByAudience = queryParametersNode.parametersByAudience[audience];
1198242
+ if (parametersByAudience != null) {
1198243
+ parametersByAudience.forEach((parameter) => {
1198244
+ parametersForEndpoint.add(parameter);
1198245
+ });
1198246
+ }
1198216
1198247
  }
1198248
+ queryParameters[endpointId] = parametersForEndpoint.size > 0 ? parametersForEndpoint : void 0;
1198217
1198249
  }
1198218
1198250
  for (const [webhookId, webhookPaylodPropertiesNode] of Object.entries(this.webhookProperties)) {
1198219
1198251
  if (!this.webhooksNeededForAudience.has(webhookId)) {
@@ -1198228,9 +1198260,7 @@ var IrGraph = class {
1198228
1198260
  });
1198229
1198261
  }
1198230
1198262
  }
1198231
- if (propertiesForWebhook.size > 0) {
1198232
- requestProperties[webhookId] = propertiesForWebhook;
1198233
- }
1198263
+ webhookPayloadProperties[webhookId] = propertiesForWebhook.size > 0 ? propertiesForWebhook : void 0;
1198234
1198264
  }
1198235
1198265
  }
1198236
1198266
  return new FilteredIrImpl({
@@ -1198238,6 +1198268,7 @@ var IrGraph = class {
1198238
1198268
  properties,
1198239
1198269
  errors: errorIds,
1198240
1198270
  requestProperties,
1198271
+ queryParameters,
1198241
1198272
  services: this.servicesNeededForAudience,
1198242
1198273
  endpoints: this.endpointsNeededForAudience,
1198243
1198274
  webhooks: this.webhooksNeededForAudience,
@@ -1199872,6 +1199903,11 @@ function filterIntermediateRepresentationForAudiences(intermediateRepresentation
1199872
1199903
  example: userSpecified.example != null ? filterEndpointExample({ filteredIr, example: userSpecified.example }) : void 0
1199873
1199904
  };
1199874
1199905
  });
1199906
+ if (httpEndpoint.queryParameters.length > 0) {
1199907
+ httpEndpoint.queryParameters = httpEndpoint.queryParameters.filter((queryParameter) => {
1199908
+ return filteredIr.hasQueryParameter(httpEndpoint.id, queryParameter.name.wireValue);
1199909
+ });
1199910
+ }
1199875
1199911
  if (((_a5 = httpEndpoint.requestBody) == null ? void 0 : _a5.type) === "inlinedRequestBody") {
1199876
1199912
  return {
1199877
1199913
  ...httpEndpoint,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "fern-api",
3
- "version": "0.33.1",
3
+ "version": "0.33.2-rc0",
4
4
  "repository": {
5
5
  "type": "git",
6
6
  "url": "https://github.com/fern-api/fern.git",