fern-api 0.16.15 → 0.16.16
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.
- package/bundle.cjs +95 -29
- package/package.json +1 -1
package/bundle.cjs
CHANGED
|
@@ -736685,7 +736685,7 @@ var AccessTokenPosthogManager = class {
|
|
|
736685
736685
|
properties: {
|
|
736686
736686
|
...event,
|
|
736687
736687
|
...event.properties,
|
|
736688
|
-
version: "0.16.
|
|
736688
|
+
version: "0.16.16",
|
|
736689
736689
|
usingAccessToken: true
|
|
736690
736690
|
}
|
|
736691
736691
|
});
|
|
@@ -736747,7 +736747,7 @@ var UserPosthogManager = class {
|
|
|
736747
736747
|
distinctId: this.userId ?? await this.getPersistedDistinctId(),
|
|
736748
736748
|
event: "CLI",
|
|
736749
736749
|
properties: {
|
|
736750
|
-
version: "0.16.
|
|
736750
|
+
version: "0.16.16",
|
|
736751
736751
|
...event,
|
|
736752
736752
|
...event.properties
|
|
736753
736753
|
}
|
|
@@ -749798,14 +749798,20 @@ function getRequest({ declarationFile, context, request, requestNameOverride, ge
|
|
|
749798
749798
|
fileContainingReference: declarationFile,
|
|
749799
749799
|
context
|
|
749800
749800
|
});
|
|
749801
|
-
|
|
749802
|
-
property2.key,
|
|
749803
|
-
|
|
749804
|
-
|
|
749805
|
-
|
|
749806
|
-
|
|
749807
|
-
|
|
749808
|
-
|
|
749801
|
+
if (!usedNames.has(property2.key) && property2.audiences.length <= 0) {
|
|
749802
|
+
return [property2.key, propertyTypeReference];
|
|
749803
|
+
}
|
|
749804
|
+
const typeReference = {
|
|
749805
|
+
type: getTypeFromTypeReference(propertyTypeReference),
|
|
749806
|
+
docs: getDocsFromTypeReference(propertyTypeReference)
|
|
749807
|
+
};
|
|
749808
|
+
if (usedNames.has(property2.key)) {
|
|
749809
|
+
typeReference.name = property2.generatedName;
|
|
749810
|
+
}
|
|
749811
|
+
if (property2.audiences.length > 0) {
|
|
749812
|
+
typeReference.audiences = property2.audiences;
|
|
749813
|
+
}
|
|
749814
|
+
return [property2.key, typeReference];
|
|
749809
749815
|
}));
|
|
749810
749816
|
const extendedSchemas = resolvedSchema.allOf.map((referencedSchema) => {
|
|
749811
749817
|
const allOfTypeReference = buildTypeReference({
|
|
@@ -752106,8 +752112,10 @@ function convertRequest({ requestBody, document: document4, context, requestBrea
|
|
|
752106
752112
|
};
|
|
752107
752113
|
}
|
|
752108
752114
|
const schemaWithExample = convertSchema(definition2, false, context, [...requestBreadcrumbs, key2]);
|
|
752115
|
+
const audiences = getExtension(definition2, FernOpenAPIExtension.AUDIENCES) ?? [];
|
|
752109
752116
|
return {
|
|
752110
752117
|
key: key2,
|
|
752118
|
+
audiences,
|
|
752111
752119
|
schema: import_finalIr9.MultipartSchema.json(convertSchemaWithExampleToSchema(schemaWithExample)),
|
|
752112
752120
|
description: void 0
|
|
752113
752121
|
};
|
|
@@ -761234,10 +761242,10 @@ var CliContext = class {
|
|
|
761234
761242
|
return "fern-api";
|
|
761235
761243
|
}
|
|
761236
761244
|
getPackageVersion() {
|
|
761237
|
-
if ("0.16.
|
|
761245
|
+
if ("0.16.16" == null) {
|
|
761238
761246
|
this.logger.error("CLI_VERSION is not defined");
|
|
761239
761247
|
}
|
|
761240
|
-
return "0.16.
|
|
761248
|
+
return "0.16.16";
|
|
761241
761249
|
}
|
|
761242
761250
|
getCliName() {
|
|
761243
761251
|
if ("fern" == null) {
|
|
@@ -765095,6 +765103,24 @@ function isReferencedWebhookPayloadSchema(payload) {
|
|
|
765095
765103
|
return payload.type != null;
|
|
765096
765104
|
}
|
|
765097
765105
|
|
|
765106
|
+
// pnp:/home/circleci/project/packages/cli/generation/ir-generator/lib/utils/getPropertiesForAudience.js
|
|
765107
|
+
function getPropertiesForAudience(properties) {
|
|
765108
|
+
var _a2;
|
|
765109
|
+
const propertiesByAudience = {};
|
|
765110
|
+
for (const [property2, propertyDeclaration] of Object.entries(properties)) {
|
|
765111
|
+
if (typeof propertyDeclaration === "string") {
|
|
765112
|
+
continue;
|
|
765113
|
+
}
|
|
765114
|
+
for (const audience of propertyDeclaration.audiences ?? []) {
|
|
765115
|
+
if (propertiesByAudience[audience] == null) {
|
|
765116
|
+
propertiesByAudience[audience] = /* @__PURE__ */ new Set();
|
|
765117
|
+
}
|
|
765118
|
+
(_a2 = propertiesByAudience[audience]) == null ? void 0 : _a2.add(property2);
|
|
765119
|
+
}
|
|
765120
|
+
}
|
|
765121
|
+
return propertiesByAudience;
|
|
765122
|
+
}
|
|
765123
|
+
|
|
765098
765124
|
// pnp:/home/circleci/project/packages/cli/generation/ir-generator/lib/converters/type-declarations/convertAliasTypeDeclaration.js
|
|
765099
765125
|
var import_api18 = __toESM(require_api4());
|
|
765100
765126
|
function convertAliasTypeDeclaration({ alias, file, typeResolver }) {
|
|
@@ -765226,26 +765252,15 @@ var SeenTypeNamesImpl = class {
|
|
|
765226
765252
|
|
|
765227
765253
|
// pnp:/home/circleci/project/packages/cli/generation/ir-generator/lib/converters/type-declarations/convertTypeDeclaration.js
|
|
765228
765254
|
async function convertTypeDeclaration({ typeName, typeDeclaration, file, typeResolver, exampleResolver, workspace }) {
|
|
765229
|
-
var _a2;
|
|
765230
765255
|
const declaration = await convertDeclaration(typeDeclaration);
|
|
765231
765256
|
const declaredTypeName = parseTypeName({
|
|
765232
765257
|
typeName,
|
|
765233
765258
|
file
|
|
765234
765259
|
});
|
|
765235
765260
|
const referencedTypes = getReferencedTypesFromRawDeclaration({ typeDeclaration, file, typeResolver });
|
|
765236
|
-
|
|
765261
|
+
let propertiesByAudience = {};
|
|
765237
765262
|
if (isRawObjectDefinition(typeDeclaration)) {
|
|
765238
|
-
|
|
765239
|
-
if (typeof propertyDeclaration === "string") {
|
|
765240
|
-
continue;
|
|
765241
|
-
}
|
|
765242
|
-
for (const audience of propertyDeclaration.audiences ?? []) {
|
|
765243
|
-
if (propertiesByAudience[audience] == null) {
|
|
765244
|
-
propertiesByAudience[audience] = /* @__PURE__ */ new Set();
|
|
765245
|
-
}
|
|
765246
|
-
(_a2 = propertiesByAudience[audience]) == null ? void 0 : _a2.add(property2);
|
|
765247
|
-
}
|
|
765248
|
-
}
|
|
765263
|
+
propertiesByAudience = getPropertiesForAudience(typeDeclaration.properties ?? {});
|
|
765249
765264
|
}
|
|
765250
765265
|
return {
|
|
765251
765266
|
propertiesByAudience,
|
|
@@ -765296,14 +765311,16 @@ var FilteredIrImpl = class {
|
|
|
765296
765311
|
errors = /* @__PURE__ */ new Set();
|
|
765297
765312
|
services = /* @__PURE__ */ new Set();
|
|
765298
765313
|
endpoints = /* @__PURE__ */ new Set();
|
|
765314
|
+
requestProperties;
|
|
765299
765315
|
subpackages = /* @__PURE__ */ new Set();
|
|
765300
|
-
constructor({ types: types4, errors, services, endpoints, subpackages, properties }) {
|
|
765316
|
+
constructor({ types: types4, errors, services, endpoints, subpackages, requestProperties, properties }) {
|
|
765301
765317
|
this.types = types4;
|
|
765302
765318
|
this.properties = properties;
|
|
765303
765319
|
this.errors = errors;
|
|
765304
765320
|
this.services = services;
|
|
765305
765321
|
this.endpoints = endpoints;
|
|
765306
765322
|
this.subpackages = subpackages;
|
|
765323
|
+
this.requestProperties = requestProperties;
|
|
765307
765324
|
}
|
|
765308
765325
|
hasTypeId(typeId) {
|
|
765309
765326
|
return this.types.has(typeId);
|
|
@@ -765339,6 +765356,13 @@ var FilteredIrImpl = class {
|
|
|
765339
765356
|
hasEndpoint(endpoint) {
|
|
765340
765357
|
return this.endpoints.has(endpoint.id);
|
|
765341
765358
|
}
|
|
765359
|
+
hasRequestProperty(endpoint, property2) {
|
|
765360
|
+
const properties = this.requestProperties[endpoint];
|
|
765361
|
+
if (properties == null) {
|
|
765362
|
+
return true;
|
|
765363
|
+
}
|
|
765364
|
+
return properties.has(property2);
|
|
765365
|
+
}
|
|
765342
765366
|
hasSubpackage(subpackageId) {
|
|
765343
765367
|
return this.subpackages.has(subpackageId);
|
|
765344
765368
|
}
|
|
@@ -765348,6 +765372,7 @@ var FilteredIrImpl = class {
|
|
|
765348
765372
|
var IrGraph = class {
|
|
765349
765373
|
types = {};
|
|
765350
765374
|
properties = {};
|
|
765375
|
+
requestProperties = {};
|
|
765351
765376
|
errors = {};
|
|
765352
765377
|
endpoints = {};
|
|
765353
765378
|
audiences;
|
|
@@ -765404,7 +765429,7 @@ var IrGraph = class {
|
|
|
765404
765429
|
};
|
|
765405
765430
|
this.errors[errorId] = errorNode;
|
|
765406
765431
|
}
|
|
765407
|
-
addEndpoint(service, httpEndpoint) {
|
|
765432
|
+
addEndpoint(service, httpEndpoint, rawEndpoint) {
|
|
765408
765433
|
const serviceId = IdGenerator.generateServiceId(service.name);
|
|
765409
765434
|
const endpointId = httpEndpoint.id;
|
|
765410
765435
|
const referencedTypes = /* @__PURE__ */ new Set();
|
|
@@ -765428,6 +765453,13 @@ var IrGraph = class {
|
|
|
765428
765453
|
for (const property2 of inlinedRequestBody.properties) {
|
|
765429
765454
|
populateReferencesFromTypeReference(property2.valueType, referencedTypes, referencedSubpackages);
|
|
765430
765455
|
}
|
|
765456
|
+
if (rawEndpoint != null && typeof rawEndpoint.request === "object" && typeof rawEndpoint.request.body === "object" && isInlineRequestBody(rawEndpoint.request.body)) {
|
|
765457
|
+
const propertiesByAudience = getPropertiesForAudience(rawEndpoint.request.body.properties ?? {});
|
|
765458
|
+
this.requestProperties[endpointId] = {
|
|
765459
|
+
endpointId,
|
|
765460
|
+
propertiesByAudience
|
|
765461
|
+
};
|
|
765462
|
+
}
|
|
765431
765463
|
},
|
|
765432
765464
|
reference: ({ requestBodyType }) => {
|
|
765433
765465
|
populateReferencesFromTypeReference(requestBodyType, referencedTypes, referencedSubpackages);
|
|
@@ -765523,6 +765555,7 @@ var IrGraph = class {
|
|
|
765523
765555
|
}
|
|
765524
765556
|
this.addReferencedTypes(typeIds, this.typesNeededForAudience);
|
|
765525
765557
|
const properties = {};
|
|
765558
|
+
const requestProperties = {};
|
|
765526
765559
|
if (this.audiences.type === "filtered") {
|
|
765527
765560
|
for (const [typeId, typePropertiesNode] of Object.entries(this.properties)) {
|
|
765528
765561
|
if (!typeIds.has(typeId)) {
|
|
@@ -765541,11 +765574,29 @@ var IrGraph = class {
|
|
|
765541
765574
|
properties[typeId] = propertiesForTypeId;
|
|
765542
765575
|
}
|
|
765543
765576
|
}
|
|
765577
|
+
for (const [endpointId, requestPropertiesNode] of Object.entries(this.requestProperties)) {
|
|
765578
|
+
if (!this.endpointsNeededForAudience.has(endpointId)) {
|
|
765579
|
+
continue;
|
|
765580
|
+
}
|
|
765581
|
+
const propertiesForEndpoint = /* @__PURE__ */ new Set();
|
|
765582
|
+
for (const audience of this.audiences.audiences) {
|
|
765583
|
+
const propertiesForAudience = requestPropertiesNode.propertiesByAudience[audience];
|
|
765584
|
+
if (propertiesForAudience != null) {
|
|
765585
|
+
propertiesForAudience.forEach((property2) => {
|
|
765586
|
+
propertiesForEndpoint.add(property2);
|
|
765587
|
+
});
|
|
765588
|
+
}
|
|
765589
|
+
}
|
|
765590
|
+
if (propertiesForEndpoint.size > 0) {
|
|
765591
|
+
requestProperties[endpointId] = propertiesForEndpoint;
|
|
765592
|
+
}
|
|
765593
|
+
}
|
|
765544
765594
|
}
|
|
765545
765595
|
return new FilteredIrImpl({
|
|
765546
765596
|
types: typeIds,
|
|
765547
765597
|
properties,
|
|
765548
765598
|
errors: errorIds,
|
|
765599
|
+
requestProperties,
|
|
765549
765600
|
services: this.servicesNeededForAudience,
|
|
765550
765601
|
endpoints: this.endpointsNeededForAudience,
|
|
765551
765602
|
subpackages: this.subpackagesNeededForAudience
|
|
@@ -766364,7 +766415,8 @@ async function generateIntermediateRepresentation({ workspace, generationLanguag
|
|
|
766364
766415
|
packageTreeGenerator.addService(serviceId, convertedHttpService);
|
|
766365
766416
|
const convertedEndpoints = {};
|
|
766366
766417
|
convertedHttpService.endpoints.forEach((httpEndpoint) => {
|
|
766367
|
-
|
|
766418
|
+
const rawEndpointSchema = service.endpoints[httpEndpoint.name.originalName];
|
|
766419
|
+
irGraph.addEndpoint(convertedHttpService, httpEndpoint, rawEndpointSchema);
|
|
766368
766420
|
convertedEndpoints[httpEndpoint.name.originalName] = httpEndpoint;
|
|
766369
766421
|
});
|
|
766370
766422
|
if (service.audiences != null) {
|
|
@@ -766512,7 +766564,21 @@ function filterIntermediateRepresentationForAudiences(intermediateRepresentation
|
|
|
766512
766564
|
errors: pickBy_default(intermediateRepresentation.errors, (error) => filteredIr.hasError(error)),
|
|
766513
766565
|
services: mapValues_default(pickBy_default(intermediateRepresentation.services, (httpService) => filteredIr.hasService(httpService)), (httpService) => ({
|
|
766514
766566
|
...httpService,
|
|
766515
|
-
endpoints: httpService.endpoints.filter((httpEndpoint) => filteredIr.hasEndpoint(httpEndpoint))
|
|
766567
|
+
endpoints: httpService.endpoints.filter((httpEndpoint) => filteredIr.hasEndpoint(httpEndpoint)).map((httpEndpoint) => {
|
|
766568
|
+
var _a2;
|
|
766569
|
+
if (((_a2 = httpEndpoint.requestBody) == null ? void 0 : _a2.type) === "inlinedRequestBody") {
|
|
766570
|
+
return {
|
|
766571
|
+
...httpEndpoint,
|
|
766572
|
+
requestBody: {
|
|
766573
|
+
...httpEndpoint.requestBody,
|
|
766574
|
+
properties: httpEndpoint.requestBody.properties.filter((property2) => {
|
|
766575
|
+
return filteredIr.hasRequestProperty(httpEndpoint.id, property2.name.wireValue);
|
|
766576
|
+
})
|
|
766577
|
+
}
|
|
766578
|
+
};
|
|
766579
|
+
}
|
|
766580
|
+
return httpEndpoint;
|
|
766581
|
+
})
|
|
766516
766582
|
})),
|
|
766517
766583
|
serviceTypeReferenceInfo: filterServiceTypeReferenceInfoForAudiences(intermediateRepresentation.serviceTypeReferenceInfo, filteredIr)
|
|
766518
766584
|
};
|