fern-api 0.19.0-rc2 → 0.19.0-rc3
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 +57 -18
- package/package.json +1 -1
package/bundle.cjs
CHANGED
|
@@ -795422,6 +795422,17 @@ var GeneratorGroupSchema = z.strictObject({
|
|
|
795422
795422
|
generators: z.array(GeneratorInvocationSchema)
|
|
795423
795423
|
});
|
|
795424
795424
|
|
|
795425
|
+
// pnp:/home/circleci/project/packages/cli/config-management/generators-configuration/lib/schemas/GeneratorsOpenAPIObjectSchema.js
|
|
795426
|
+
var OPENAPI_DISABLE_EXAMPLES_KEY = "disable-examples";
|
|
795427
|
+
var GeneratorsOpenAPIObjectSchema = z.strictObject({
|
|
795428
|
+
path: z.optional(z.string()),
|
|
795429
|
+
overrides: z.optional(z.string()),
|
|
795430
|
+
[OPENAPI_DISABLE_EXAMPLES_KEY]: z.optional(z.boolean())
|
|
795431
|
+
});
|
|
795432
|
+
|
|
795433
|
+
// pnp:/home/circleci/project/packages/cli/config-management/generators-configuration/lib/schemas/GeneratorsOpenAPISchema.js
|
|
795434
|
+
var GeneratorsOpenAPISchema = z.union([GeneratorsOpenAPIObjectSchema, z.string()]);
|
|
795435
|
+
|
|
795425
795436
|
// pnp:/home/circleci/project/packages/cli/config-management/generators-configuration/lib/schemas/WhitelabelGithubConfigurationSchema.js
|
|
795426
795437
|
var WhitelabelGithubConfigurationSchema = z.strictObject({
|
|
795427
795438
|
username: z.string(),
|
|
@@ -795441,8 +795452,8 @@ var OPENAPI_OVERRIDES_LOCATION_KEY = "openapi-overrides";
|
|
|
795441
795452
|
var ASYNC_API_LOCATION_KEY = "async-api";
|
|
795442
795453
|
var GeneratorsConfigurationSchema = z.strictObject({
|
|
795443
795454
|
[DEFAULT_GROUP_GENERATORS_CONFIG_KEY]: z.optional(z.string()),
|
|
795444
|
-
[OPENAPI_LOCATION_KEY]: z.optional(
|
|
795445
|
-
[OPENAPI_OVERRIDES_LOCATION_KEY]: z.optional(z.string()),
|
|
795455
|
+
[OPENAPI_LOCATION_KEY]: z.optional(GeneratorsOpenAPISchema),
|
|
795456
|
+
[OPENAPI_OVERRIDES_LOCATION_KEY]: z.optional(z.string()).describe("Deprecated; use openapi.overrides instead."),
|
|
795446
795457
|
[ASYNC_API_LOCATION_KEY]: z.optional(z.string()),
|
|
795447
795458
|
whitelabel: z.optional(WhitelabelConfigurationSchema),
|
|
795448
795459
|
groups: z.optional(z.record(GeneratorGroupSchema))
|
|
@@ -795450,14 +795461,14 @@ var GeneratorsConfigurationSchema = z.strictObject({
|
|
|
795450
795461
|
|
|
795451
795462
|
// pnp:/home/circleci/project/packages/cli/config-management/generators-configuration/lib/convertGeneratorsConfiguration.js
|
|
795452
795463
|
async function convertGeneratorsConfiguration({ absolutePathToGeneratorsConfiguration, rawGeneratorsConfiguration }) {
|
|
795453
|
-
const
|
|
795464
|
+
const openAPI = await parseOpenAPIConfiguration(rawGeneratorsConfiguration);
|
|
795454
795465
|
const pathToAsyncAPI = rawGeneratorsConfiguration[ASYNC_API_LOCATION_KEY];
|
|
795455
|
-
const pathToOpenAPIOverrides = rawGeneratorsConfiguration[OPENAPI_OVERRIDES_LOCATION_KEY];
|
|
795456
795466
|
return {
|
|
795457
795467
|
absolutePathToConfiguration: absolutePathToGeneratorsConfiguration,
|
|
795458
795468
|
absolutePathToAsyncAPI: pathToAsyncAPI != null ? join(dirname(absolutePathToGeneratorsConfiguration), RelativeFilePath.of(pathToAsyncAPI)) : void 0,
|
|
795459
|
-
absolutePathToOpenAPI:
|
|
795460
|
-
absolutePathToOpenAPIOverrides:
|
|
795469
|
+
absolutePathToOpenAPI: openAPI.path != null ? join(dirname(absolutePathToGeneratorsConfiguration), RelativeFilePath.of(openAPI.path)) : void 0,
|
|
795470
|
+
absolutePathToOpenAPIOverrides: openAPI.overrides != null ? join(dirname(absolutePathToGeneratorsConfiguration), RelativeFilePath.of(openAPI.overrides)) : void 0,
|
|
795471
|
+
disableOpenAPIExamples: openAPI.disableExamples,
|
|
795461
795472
|
rawConfiguration: rawGeneratorsConfiguration,
|
|
795462
795473
|
defaultGroup: rawGeneratorsConfiguration["default-group"],
|
|
795463
795474
|
groups: rawGeneratorsConfiguration.groups != null ? await Promise.all(Object.entries(rawGeneratorsConfiguration.groups).map(([groupName, group]) => convertGroup({
|
|
@@ -795470,6 +795481,21 @@ async function convertGeneratorsConfiguration({ absolutePathToGeneratorsConfigur
|
|
|
795470
795481
|
} : void 0
|
|
795471
795482
|
};
|
|
795472
795483
|
}
|
|
795484
|
+
async function parseOpenAPIConfiguration(rawGeneratorsConfiguration) {
|
|
795485
|
+
const openAPI = rawGeneratorsConfiguration[OPENAPI_LOCATION_KEY];
|
|
795486
|
+
if (typeof openAPI === "string") {
|
|
795487
|
+
return {
|
|
795488
|
+
path: openAPI,
|
|
795489
|
+
overrides: rawGeneratorsConfiguration[OPENAPI_OVERRIDES_LOCATION_KEY],
|
|
795490
|
+
disableExamples: void 0
|
|
795491
|
+
};
|
|
795492
|
+
}
|
|
795493
|
+
return {
|
|
795494
|
+
path: openAPI == null ? void 0 : openAPI.path,
|
|
795495
|
+
overrides: (openAPI == null ? void 0 : openAPI.overrides) ?? rawGeneratorsConfiguration[OPENAPI_OVERRIDES_LOCATION_KEY],
|
|
795496
|
+
disableExamples: openAPI == null ? void 0 : openAPI[OPENAPI_DISABLE_EXAMPLES_KEY]
|
|
795497
|
+
};
|
|
795498
|
+
}
|
|
795473
795499
|
async function convertGroup({ absolutePathToGeneratorsConfiguration, groupName, group }) {
|
|
795474
795500
|
return {
|
|
795475
795501
|
groupName,
|
|
@@ -799111,7 +799137,7 @@ var AccessTokenPosthogManager = class {
|
|
|
799111
799137
|
properties: {
|
|
799112
799138
|
...event,
|
|
799113
799139
|
...event.properties,
|
|
799114
|
-
version: "0.19.0-
|
|
799140
|
+
version: "0.19.0-rc3",
|
|
799115
799141
|
usingAccessToken: true
|
|
799116
799142
|
}
|
|
799117
799143
|
});
|
|
@@ -799173,7 +799199,7 @@ var UserPosthogManager = class {
|
|
|
799173
799199
|
distinctId: this.userId ?? await this.getPersistedDistinctId(),
|
|
799174
799200
|
event: "CLI",
|
|
799175
799201
|
properties: {
|
|
799176
|
-
version: "0.19.0-
|
|
799202
|
+
version: "0.19.0-rc3",
|
|
799177
799203
|
...event,
|
|
799178
799204
|
...event.properties
|
|
799179
799205
|
}
|
|
@@ -816625,7 +816651,7 @@ function replaceWithSchemaReference({ openapi, replaceReference, schemaReference
|
|
|
816625
816651
|
}
|
|
816626
816652
|
|
|
816627
816653
|
// pnp:/home/circleci/project/packages/cli/openapi-parser/lib/openapi/v3/generateIr.js
|
|
816628
|
-
function generateIr(openApi, taskContext) {
|
|
816654
|
+
function generateIr({ openApi, taskContext, disableExamples }) {
|
|
816629
816655
|
var _a2, _b2, _c2;
|
|
816630
816656
|
openApi = runResolutions({ openapi: openApi });
|
|
816631
816657
|
const securitySchemes = Object.fromEntries(Object.entries(((_a2 = openApi.components) == null ? void 0 : _a2.securitySchemes) ?? {}).map(([key2, securityScheme]) => {
|
|
@@ -816701,7 +816727,7 @@ function generateIr(openApi, taskContext) {
|
|
|
816701
816727
|
const exampleEndpointFactory = new ExampleEndpointFactory(schemasWithExample, context.logger);
|
|
816702
816728
|
const endpoints = endpointsWithExample.map((endpointWithExample) => {
|
|
816703
816729
|
let examples = endpointWithExample.examples;
|
|
816704
|
-
if (examples.length === 0 || examples.every(hasIncompleteExample)) {
|
|
816730
|
+
if (!disableExamples && (examples.length === 0 || examples.every(hasIncompleteExample))) {
|
|
816705
816731
|
const endpointExample = exampleEndpointFactory.buildEndpointExample(endpointWithExample);
|
|
816706
816732
|
if (endpointExample != null) {
|
|
816707
816733
|
examples = [endpointExample, ...endpointWithExample.examples];
|
|
@@ -816837,13 +816863,17 @@ function hasIncompleteExample(example) {
|
|
|
816837
816863
|
}
|
|
816838
816864
|
|
|
816839
816865
|
// pnp:/home/circleci/project/packages/cli/openapi-parser/lib/openapi/v2/generateIr.js
|
|
816840
|
-
async function generateIr2(openApi, taskContext) {
|
|
816866
|
+
async function generateIr2({ openApi, taskContext, disableExamples }) {
|
|
816841
816867
|
const conversionResult = await (0, import_swagger2openapi.convertObj)(openApi, {});
|
|
816842
|
-
return generateIr(
|
|
816868
|
+
return generateIr({
|
|
816869
|
+
openApi: conversionResult.openapi,
|
|
816870
|
+
taskContext,
|
|
816871
|
+
disableExamples
|
|
816872
|
+
});
|
|
816843
816873
|
}
|
|
816844
816874
|
|
|
816845
816875
|
// pnp:/home/circleci/project/packages/cli/openapi-parser/lib/openapi/parse.js
|
|
816846
|
-
async function parse2({ absolutePathToAsyncAPI, absolutePathToOpenAPI, absolutePathToOpenAPIOverrides, taskContext }) {
|
|
816876
|
+
async function parse2({ absolutePathToAsyncAPI, absolutePathToOpenAPI, absolutePathToOpenAPIOverrides, disableExamples, taskContext }) {
|
|
816847
816877
|
let parsedAsyncAPI = {
|
|
816848
816878
|
schemas: {},
|
|
816849
816879
|
channel: void 0
|
|
@@ -816859,9 +816889,17 @@ async function parse2({ absolutePathToAsyncAPI, absolutePathToOpenAPI, absoluteP
|
|
|
816859
816889
|
});
|
|
816860
816890
|
let openApiIr = void 0;
|
|
816861
816891
|
if (isOpenApiV3(openApiDocument)) {
|
|
816862
|
-
openApiIr = generateIr(
|
|
816892
|
+
openApiIr = generateIr({
|
|
816893
|
+
openApi: openApiDocument,
|
|
816894
|
+
taskContext,
|
|
816895
|
+
disableExamples
|
|
816896
|
+
});
|
|
816863
816897
|
} else if (isOpenApiV2(openApiDocument)) {
|
|
816864
|
-
openApiIr = await generateIr2(
|
|
816898
|
+
openApiIr = await generateIr2({
|
|
816899
|
+
openApi: openApiDocument,
|
|
816900
|
+
taskContext,
|
|
816901
|
+
disableExamples
|
|
816902
|
+
});
|
|
816865
816903
|
}
|
|
816866
816904
|
if (openApiIr != null) {
|
|
816867
816905
|
return {
|
|
@@ -818604,11 +818642,12 @@ function convert2({ openApiIr, taskContext }) {
|
|
|
818604
818642
|
|
|
818605
818643
|
// pnp:/home/circleci/project/packages/cli/workspace-loader/lib/utils/convertOpenApiWorkspaceToFernWorkspace.js
|
|
818606
818644
|
async function getOpenAPIIRFromOpenAPIWorkspace(openapiWorkspace, context) {
|
|
818607
|
-
var _a2;
|
|
818645
|
+
var _a2, _b2;
|
|
818608
818646
|
return await parse2({
|
|
818609
818647
|
absolutePathToAsyncAPI: openapiWorkspace.absolutePathToAsyncAPI,
|
|
818610
818648
|
absolutePathToOpenAPI: openapiWorkspace.absolutePathToOpenAPI,
|
|
818611
818649
|
absolutePathToOpenAPIOverrides: (_a2 = openapiWorkspace.generatorsConfiguration) == null ? void 0 : _a2.absolutePathToOpenAPIOverrides,
|
|
818650
|
+
disableExamples: (_b2 = openapiWorkspace.generatorsConfiguration) == null ? void 0 : _b2.disableOpenAPIExamples,
|
|
818612
818651
|
taskContext: context
|
|
818613
818652
|
});
|
|
818614
818653
|
}
|
|
@@ -825867,10 +825906,10 @@ var CliContext = class {
|
|
|
825867
825906
|
return "fern-api";
|
|
825868
825907
|
}
|
|
825869
825908
|
getPackageVersion() {
|
|
825870
|
-
if ("0.19.0-
|
|
825909
|
+
if ("0.19.0-rc3" == null) {
|
|
825871
825910
|
this.logger.error("CLI_VERSION is not defined");
|
|
825872
825911
|
}
|
|
825873
|
-
return "0.19.0-
|
|
825912
|
+
return "0.19.0-rc3";
|
|
825874
825913
|
}
|
|
825875
825914
|
getCliName() {
|
|
825876
825915
|
if ("fern" == null) {
|