fern-api 0.16.21 → 0.16.23
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 +81 -52
- package/package.json +1 -1
package/bundle.cjs
CHANGED
|
@@ -733501,6 +733501,9 @@ function getLanguageFromGeneratorName(generatorName) {
|
|
|
733501
733501
|
// pnp:/home/circleci/project/packages/cli/config-management/generators-configuration/lib/loadGeneratorsConfiguration.js
|
|
733502
733502
|
async function loadRawGeneratorsConfiguration({ absolutePathToWorkspace, context }) {
|
|
733503
733503
|
const filepath = getPathToGeneratorsConfiguration({ absolutePathToWorkspace });
|
|
733504
|
+
if (!await doesPathExist(filepath)) {
|
|
733505
|
+
return void 0;
|
|
733506
|
+
}
|
|
733504
733507
|
const contentsStr = await (0, import_promises8.readFile)(filepath);
|
|
733505
733508
|
const contentsParsed = js_yaml_default.load(contentsStr.toString());
|
|
733506
733509
|
return validateSchema({
|
|
@@ -733512,6 +733515,9 @@ async function loadRawGeneratorsConfiguration({ absolutePathToWorkspace, context
|
|
|
733512
733515
|
}
|
|
733513
733516
|
async function loadGeneratorsConfiguration({ absolutePathToWorkspace, context }) {
|
|
733514
733517
|
const rawGeneratorsConfiguration = await loadRawGeneratorsConfiguration({ absolutePathToWorkspace, context });
|
|
733518
|
+
if (rawGeneratorsConfiguration == null) {
|
|
733519
|
+
return void 0;
|
|
733520
|
+
}
|
|
733515
733521
|
return convertGeneratorsConfiguration({
|
|
733516
733522
|
absolutePathToGeneratorsConfiguration: getPathToGeneratorsConfiguration({ absolutePathToWorkspace }),
|
|
733517
733523
|
rawGeneratorsConfiguration
|
|
@@ -736945,7 +736951,7 @@ var AccessTokenPosthogManager = class {
|
|
|
736945
736951
|
properties: {
|
|
736946
736952
|
...event,
|
|
736947
736953
|
...event.properties,
|
|
736948
|
-
version: "0.16.
|
|
736954
|
+
version: "0.16.23",
|
|
736949
736955
|
usingAccessToken: true
|
|
736950
736956
|
}
|
|
736951
736957
|
});
|
|
@@ -737007,7 +737013,7 @@ var UserPosthogManager = class {
|
|
|
737007
737013
|
distinctId: this.userId ?? await this.getPersistedDistinctId(),
|
|
737008
737014
|
event: "CLI",
|
|
737009
737015
|
properties: {
|
|
737010
|
-
version: "0.16.
|
|
737016
|
+
version: "0.16.23",
|
|
737011
737017
|
...event,
|
|
737012
737018
|
...event.properties
|
|
737013
737019
|
}
|
|
@@ -753436,6 +753442,47 @@ function getScopes(oauthSecurityScheme) {
|
|
|
753436
753442
|
return void 0;
|
|
753437
753443
|
}
|
|
753438
753444
|
|
|
753445
|
+
// pnp:/home/circleci/project/packages/cli/openapi-parser/lib/v3/converters/convertToHttpError.js
|
|
753446
|
+
var import_finalIr14 = __toESM(require_finalIr());
|
|
753447
|
+
var ERROR_NAMES_BY_STATUS_CODE = {
|
|
753448
|
+
400: "BadRequestError",
|
|
753449
|
+
401: "UnauthorizedError",
|
|
753450
|
+
403: "ForbiddenError",
|
|
753451
|
+
404: "NotFoundError",
|
|
753452
|
+
408: "RequestTimeoutError",
|
|
753453
|
+
409: "ConflictError",
|
|
753454
|
+
413: "ContentTooLargeError",
|
|
753455
|
+
422: "UnprocessableEntityError",
|
|
753456
|
+
428: "PreconditionError",
|
|
753457
|
+
429: "TooManyRequestsError",
|
|
753458
|
+
500: "InternalServerError",
|
|
753459
|
+
501: "NotImplementedError",
|
|
753460
|
+
503: "ServiceUnavailableError"
|
|
753461
|
+
};
|
|
753462
|
+
var ERROR_NAMES = new Set(Object.values(ERROR_NAMES_BY_STATUS_CODE));
|
|
753463
|
+
function convertToError({ statusCode, errorBodyCollector, context }) {
|
|
753464
|
+
const errorName = ERROR_NAMES_BY_STATUS_CODE[statusCode];
|
|
753465
|
+
if (errorName == null) {
|
|
753466
|
+
return void 0;
|
|
753467
|
+
}
|
|
753468
|
+
const schemas = errorBodyCollector.getSchemas();
|
|
753469
|
+
if (schemas.length === 1 && schemas[0] != null) {
|
|
753470
|
+
const schema2 = convertSchema(schemas[0], false, context, [errorName, "Body"]);
|
|
753471
|
+
return {
|
|
753472
|
+
generatedName: errorName,
|
|
753473
|
+
nameOverride: null,
|
|
753474
|
+
schema: schema2,
|
|
753475
|
+
description: void 0
|
|
753476
|
+
};
|
|
753477
|
+
}
|
|
753478
|
+
return {
|
|
753479
|
+
generatedName: errorName,
|
|
753480
|
+
nameOverride: null,
|
|
753481
|
+
schema: import_finalIr14.Schema.unknown(),
|
|
753482
|
+
description: void 0
|
|
753483
|
+
};
|
|
753484
|
+
}
|
|
753485
|
+
|
|
753439
753486
|
// pnp:/home/circleci/project/packages/cli/openapi-parser/lib/v3/utils/isSchemaRequired.js
|
|
753440
753487
|
function isSchemaRequired(schema2) {
|
|
753441
753488
|
return schema2.type !== "optional" && schema2.type !== "nullable";
|
|
@@ -753815,7 +753862,7 @@ function getResponseSchema(response) {
|
|
|
753815
753862
|
}
|
|
753816
753863
|
|
|
753817
753864
|
// pnp:/home/circleci/project/packages/cli/openapi-parser/lib/v3/extensions/getVariableDefinitions.js
|
|
753818
|
-
var
|
|
753865
|
+
var import_finalIr15 = __toESM(require_finalIr());
|
|
753819
753866
|
function getVariableDefinitions(document4) {
|
|
753820
753867
|
const variables = getExtension(document4, FernOpenAPIExtension.SDK_VARIABLES);
|
|
753821
753868
|
if (variables == null) {
|
|
@@ -753826,7 +753873,7 @@ function getVariableDefinitions(document4) {
|
|
|
753826
753873
|
return [
|
|
753827
753874
|
variableName,
|
|
753828
753875
|
{
|
|
753829
|
-
schema:
|
|
753876
|
+
schema: import_finalIr15.PrimitiveSchemaValue.string({
|
|
753830
753877
|
minLength: void 0,
|
|
753831
753878
|
maxLength: void 0
|
|
753832
753879
|
}),
|
|
@@ -753840,46 +753887,6 @@ function getVariableDefinitions(document4) {
|
|
|
753840
753887
|
}));
|
|
753841
753888
|
}
|
|
753842
753889
|
|
|
753843
|
-
// pnp:/home/circleci/project/packages/cli/openapi-parser/lib/v3/converters/convertToHttpError.js
|
|
753844
|
-
var import_finalIr15 = __toESM(require_finalIr());
|
|
753845
|
-
var ERROR_NAMES_BY_STATUS_CODE = {
|
|
753846
|
-
400: "BadRequestError",
|
|
753847
|
-
401: "UnauthorizedError",
|
|
753848
|
-
403: "ForbiddenError",
|
|
753849
|
-
404: "NotFoundError",
|
|
753850
|
-
408: "RequestTimeoutError",
|
|
753851
|
-
409: "ConflictError",
|
|
753852
|
-
413: "ContentTooLargeError",
|
|
753853
|
-
422: "UnprocessableEntityError",
|
|
753854
|
-
428: "PreconditionError",
|
|
753855
|
-
429: "TooManyRequestsError",
|
|
753856
|
-
500: "InternalServerError",
|
|
753857
|
-
501: "NotImplementedError",
|
|
753858
|
-
503: "ServiceUnavailableError"
|
|
753859
|
-
};
|
|
753860
|
-
function convertToError({ statusCode, errorBodyCollector, context }) {
|
|
753861
|
-
const errorName = ERROR_NAMES_BY_STATUS_CODE[statusCode];
|
|
753862
|
-
if (errorName == null) {
|
|
753863
|
-
return void 0;
|
|
753864
|
-
}
|
|
753865
|
-
const schemas = errorBodyCollector.getSchemas();
|
|
753866
|
-
if (schemas.length === 1 && schemas[0] != null) {
|
|
753867
|
-
const schema2 = convertSchema(schemas[0], false, context, [errorName, "Body"]);
|
|
753868
|
-
return {
|
|
753869
|
-
generatedName: errorName,
|
|
753870
|
-
nameOverride: null,
|
|
753871
|
-
schema: schema2,
|
|
753872
|
-
description: void 0
|
|
753873
|
-
};
|
|
753874
|
-
}
|
|
753875
|
-
return {
|
|
753876
|
-
generatedName: errorName,
|
|
753877
|
-
nameOverride: null,
|
|
753878
|
-
schema: import_finalIr15.Schema.unknown(),
|
|
753879
|
-
description: void 0
|
|
753880
|
-
};
|
|
753881
|
-
}
|
|
753882
|
-
|
|
753883
753890
|
// pnp:/home/circleci/project/packages/cli/openapi-parser/lib/v3/ErrorBodyCollector.js
|
|
753884
753891
|
var ErrorBodyCollector = class {
|
|
753885
753892
|
references = /* @__PURE__ */ new Set();
|
|
@@ -754039,6 +754046,17 @@ function generateIr(openApi, taskContext) {
|
|
|
754039
754046
|
if (ignoreSchema != null && ignoreSchema) {
|
|
754040
754047
|
return [];
|
|
754041
754048
|
}
|
|
754049
|
+
if (ERROR_NAMES.has(key2)) {
|
|
754050
|
+
return [
|
|
754051
|
+
key2,
|
|
754052
|
+
convertSchema(
|
|
754053
|
+
{ ...schema2, "x-fern-type-name": `${key2}Body` },
|
|
754054
|
+
false,
|
|
754055
|
+
context,
|
|
754056
|
+
[key2]
|
|
754057
|
+
)
|
|
754058
|
+
];
|
|
754059
|
+
}
|
|
754042
754060
|
}
|
|
754043
754061
|
return [key2, convertSchema(schema2, false, context, [key2])];
|
|
754044
754062
|
}).filter((entry) => entry.length > 0));
|
|
@@ -754086,7 +754104,8 @@ function generateIr(openApi, taskContext) {
|
|
|
754086
754104
|
});
|
|
754087
754105
|
const schemas = Object.fromEntries(Object.entries(schemasWithExample).map(([key2, schemaWithExample]) => {
|
|
754088
754106
|
taskContext.logger.debug(`Converting schema ${key2}`);
|
|
754089
|
-
|
|
754107
|
+
const schema2 = convertSchemaWithExampleToSchema(schemaWithExample);
|
|
754108
|
+
return [key2, schema2];
|
|
754090
754109
|
}));
|
|
754091
754110
|
const ir = {
|
|
754092
754111
|
title: openApi.info.title,
|
|
@@ -754702,12 +754721,16 @@ function validateStructureOfYamlFiles({ files, absolutePathToDefinition }) {
|
|
|
754702
754721
|
|
|
754703
754722
|
// pnp:/home/circleci/project/packages/cli/workspace-loader/lib/loadAPIWorkspace.js
|
|
754704
754723
|
async function loadAPIWorkspace({ absolutePathToWorkspace, context, cliVersion, workspaceName }) {
|
|
754705
|
-
|
|
754724
|
+
let generatorsConfiguration = void 0;
|
|
754725
|
+
try {
|
|
754726
|
+
generatorsConfiguration = await loadGeneratorsConfiguration({ absolutePathToWorkspace, context });
|
|
754727
|
+
} catch (err) {
|
|
754728
|
+
}
|
|
754706
754729
|
const absolutePathToOpenAPIFolder = join(absolutePathToWorkspace, RelativeFilePath.of(OPENAPI_DIRECTORY));
|
|
754707
754730
|
const openApiDirectoryExists = await doesPathExist(absolutePathToOpenAPIFolder);
|
|
754708
754731
|
const absolutePathToAsyncAPIFolder = join(absolutePathToWorkspace, RelativeFilePath.of(ASYNCAPI_DIRECTORY));
|
|
754709
754732
|
const asyncApiDirectoryExists = await doesPathExist(absolutePathToAsyncAPIFolder);
|
|
754710
|
-
if (generatorsConfiguration.absolutePathToOpenAPI != null) {
|
|
754733
|
+
if ((generatorsConfiguration == null ? void 0 : generatorsConfiguration.absolutePathToOpenAPI) != null) {
|
|
754711
754734
|
const absolutePathToAsyncAPI = generatorsConfiguration.absolutePathToAsyncAPI != null ? await getValidAbsolutePathToAsyncAPI(context, generatorsConfiguration.absolutePathToAsyncAPI) : void 0;
|
|
754712
754735
|
const absolutePathToOpenAPI = await getValidAbsolutePathToOpenAPI(context, generatorsConfiguration.absolutePathToOpenAPI);
|
|
754713
754736
|
return {
|
|
@@ -761553,10 +761576,10 @@ var CliContext = class {
|
|
|
761553
761576
|
return "fern-api";
|
|
761554
761577
|
}
|
|
761555
761578
|
getPackageVersion() {
|
|
761556
|
-
if ("0.16.
|
|
761579
|
+
if ("0.16.23" == null) {
|
|
761557
761580
|
this.logger.error("CLI_VERSION is not defined");
|
|
761558
761581
|
}
|
|
761559
|
-
return "0.16.
|
|
761582
|
+
return "0.16.23";
|
|
761560
761583
|
}
|
|
761561
761584
|
getCliName() {
|
|
761562
761585
|
if ("fern" == null) {
|
|
@@ -761876,13 +761899,14 @@ async function addGeneratorToWorkspaces({
|
|
|
761876
761899
|
await Promise.all(
|
|
761877
761900
|
apiWorkspaces.map(async (workspace) => {
|
|
761878
761901
|
await cliContext.runTaskForWorkspace(workspace, async (context) => {
|
|
761902
|
+
var _a2;
|
|
761879
761903
|
const generatorsConfiguration = await loadRawGeneratorsConfiguration({
|
|
761880
761904
|
absolutePathToWorkspace: workspace.absoluteFilepath,
|
|
761881
761905
|
context
|
|
761882
|
-
});
|
|
761906
|
+
}) ?? {};
|
|
761883
761907
|
const newConfiguration = addGenerator({ generatorName, generatorsConfiguration, groupName, context });
|
|
761884
761908
|
await (0, import_promises28.writeFile)(
|
|
761885
|
-
workspace.generatorsConfiguration.absolutePathToConfiguration,
|
|
761909
|
+
((_a2 = workspace.generatorsConfiguration) == null ? void 0 : _a2.absolutePathToConfiguration) ?? getPathToGeneratorsConfiguration({ absolutePathToWorkspace: workspace.absoluteFilepath }),
|
|
761886
761910
|
js_yaml_default.dump(newConfiguration)
|
|
761887
761911
|
);
|
|
761888
761912
|
context.logger.info(source_default.green(`Added ${generatorName} generator`));
|
|
@@ -777011,6 +777035,10 @@ async function generateWorkspace({
|
|
|
777011
777035
|
useLocalDocker,
|
|
777012
777036
|
keepDocker
|
|
777013
777037
|
}) {
|
|
777038
|
+
if (workspace.generatorsConfiguration == null) {
|
|
777039
|
+
context.logger.warn("This workspaces has no generators.yml");
|
|
777040
|
+
return;
|
|
777041
|
+
}
|
|
777014
777042
|
if (workspace.generatorsConfiguration.groups.length === 0) {
|
|
777015
777043
|
context.logger.warn(`This workspaces has no groups specified in ${GENERATORS_CONFIGURATION_FILENAME}`);
|
|
777016
777044
|
return;
|
|
@@ -777076,10 +777104,11 @@ async function generateAPIWorkspaces({
|
|
|
777076
777104
|
command: "fern generate",
|
|
777077
777105
|
properties: {
|
|
777078
777106
|
workspaces: project.apiWorkspaces.map((workspace) => {
|
|
777107
|
+
var _a2;
|
|
777079
777108
|
return {
|
|
777080
777109
|
name: workspace.name,
|
|
777081
777110
|
group: groupName,
|
|
777082
|
-
generators: workspace.generatorsConfiguration.groups.filter((group) => groupName == null ? true : group.groupName === groupName).map((group) => {
|
|
777111
|
+
generators: (_a2 = workspace.generatorsConfiguration) == null ? void 0 : _a2.groups.filter((group) => groupName == null ? true : group.groupName === groupName).map((group) => {
|
|
777083
777112
|
return group.generators.map((generator) => {
|
|
777084
777113
|
return {
|
|
777085
777114
|
name: generator.name,
|