fern-api 0.19.0-rc2 → 0.19.0-rc4
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 +167 -120
- 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-rc4",
|
|
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-rc4",
|
|
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 {
|
|
@@ -817366,6 +817404,107 @@ function buildEnvironments(context) {
|
|
|
817366
817404
|
}
|
|
817367
817405
|
}
|
|
817368
817406
|
|
|
817407
|
+
// pnp:/home/circleci/project/packages/cli/openapi-ir-to-fern/lib/utils/getEndpointLocation.js
|
|
817408
|
+
function getEndpointLocation(endpoint) {
|
|
817409
|
+
if (endpoint.sdkName != null) {
|
|
817410
|
+
const filename = endpoint.sdkName.groupName.length === 0 ? "__package__.yml" : `${endpoint.sdkName.groupName.map((part) => camelCase_default(part)).join("/")}.yml`;
|
|
817411
|
+
return {
|
|
817412
|
+
file: RelativeFilePath.of(filename),
|
|
817413
|
+
endpointId: endpoint.sdkName.methodName
|
|
817414
|
+
};
|
|
817415
|
+
}
|
|
817416
|
+
const tag = endpoint.tags[0];
|
|
817417
|
+
const operationId = endpoint.operationId;
|
|
817418
|
+
if (operationId == null) {
|
|
817419
|
+
if (tag != null) {
|
|
817420
|
+
return {
|
|
817421
|
+
file: RelativeFilePath.of(`${camelCase_default(tag)}.yml`),
|
|
817422
|
+
endpointId: endpoint.summary != null ? camelCase_default(endpoint.summary) : camelCase_default(`${endpoint.method}_${endpoint.path.split("/").join("_")}`)
|
|
817423
|
+
};
|
|
817424
|
+
}
|
|
817425
|
+
if (endpoint.summary != null) {
|
|
817426
|
+
return {
|
|
817427
|
+
file: RelativeFilePath.of(FERN_PACKAGE_MARKER_FILENAME),
|
|
817428
|
+
endpointId: camelCase_default(endpoint.summary)
|
|
817429
|
+
};
|
|
817430
|
+
}
|
|
817431
|
+
return {
|
|
817432
|
+
file: RelativeFilePath.of(FERN_PACKAGE_MARKER_FILENAME),
|
|
817433
|
+
endpointId: camelCase_default(`${endpoint.method}_${endpoint.path.split("/").join("_")}`)
|
|
817434
|
+
};
|
|
817435
|
+
}
|
|
817436
|
+
if (tag == null) {
|
|
817437
|
+
return {
|
|
817438
|
+
file: RelativeFilePath.of(FERN_PACKAGE_MARKER_FILENAME),
|
|
817439
|
+
endpointId: operationId
|
|
817440
|
+
};
|
|
817441
|
+
}
|
|
817442
|
+
const tagTokens = tokenizeString(tag);
|
|
817443
|
+
const operationIdTokens = tokenizeString(operationId);
|
|
817444
|
+
if (isEqual_default(tagTokens, operationIdTokens)) {
|
|
817445
|
+
return {
|
|
817446
|
+
file: RelativeFilePath.of("__package__.yml"),
|
|
817447
|
+
endpointId: tag
|
|
817448
|
+
};
|
|
817449
|
+
}
|
|
817450
|
+
const fastapiEndpointLocation = maybeGetFastApiEndpointLocation({
|
|
817451
|
+
operationId,
|
|
817452
|
+
tag,
|
|
817453
|
+
path: endpoint.path,
|
|
817454
|
+
method: endpoint.method
|
|
817455
|
+
});
|
|
817456
|
+
if (fastapiEndpointLocation != null) {
|
|
817457
|
+
return fastapiEndpointLocation;
|
|
817458
|
+
}
|
|
817459
|
+
const fileParts = [];
|
|
817460
|
+
for (let i2 = 0; i2 < tagTokens.length; ++i2) {
|
|
817461
|
+
const tagElement = tagTokens[i2];
|
|
817462
|
+
if (tagElement != null && tagElement === operationIdTokens[i2]) {
|
|
817463
|
+
fileParts.push(tagElement);
|
|
817464
|
+
} else {
|
|
817465
|
+
const camelCasedTag = camelCase_default(tag);
|
|
817466
|
+
return {
|
|
817467
|
+
file: RelativeFilePath.of(`${camelCasedTag}.yml`),
|
|
817468
|
+
endpointId: operationId,
|
|
817469
|
+
tag
|
|
817470
|
+
};
|
|
817471
|
+
}
|
|
817472
|
+
}
|
|
817473
|
+
if (fileParts.length >= operationIdTokens.length) {
|
|
817474
|
+
throw new Error(`Cannot get file for endpoint ${JSON.stringify(endpoint)}`);
|
|
817475
|
+
}
|
|
817476
|
+
return {
|
|
817477
|
+
file: RelativeFilePath.of(camelCase_default(fileParts.join("_")) + ".yml"),
|
|
817478
|
+
endpointId: camelCase_default(operationIdTokens.slice(fileParts.length).join("_")),
|
|
817479
|
+
tag
|
|
817480
|
+
};
|
|
817481
|
+
}
|
|
817482
|
+
function tokenizeString(input) {
|
|
817483
|
+
let tokens;
|
|
817484
|
+
if (/^[a-z]+(?:[A-Z][a-z]+)*$/.test(input)) {
|
|
817485
|
+
tokens = input.split(/(?=[A-Z])/);
|
|
817486
|
+
} else {
|
|
817487
|
+
tokens = input.split(/[^a-zA-Z0-9]+/);
|
|
817488
|
+
}
|
|
817489
|
+
tokens = tokens.map((token) => token.toLowerCase());
|
|
817490
|
+
tokens = compact_default(tokens);
|
|
817491
|
+
return tokens;
|
|
817492
|
+
}
|
|
817493
|
+
var NON_ALPHANUMERIC_EXCEPT_BRACES_REGEX = new RegExp("[^a-zA-Z0-9{}]+");
|
|
817494
|
+
var BRACE_REGEX = new RegExp("[{}]", "g");
|
|
817495
|
+
function maybeGetFastApiEndpointLocation({ operationId, tag, path: path33, method: method2 }) {
|
|
817496
|
+
const pathSegment = path33.split(NON_ALPHANUMERIC_EXCEPT_BRACES_REGEX).join("_").replaceAll(BRACE_REGEX, "_");
|
|
817497
|
+
const operationIdSuffix = `${pathSegment}_${method2.toLowerCase()}`;
|
|
817498
|
+
if (operationId.endsWith(operationIdSuffix)) {
|
|
817499
|
+
return {
|
|
817500
|
+
file: RelativeFilePath.of(camelCase_default(tag) + ".yml"),
|
|
817501
|
+
endpointId: camelCase_default(operationId.slice(0, -1 * operationIdSuffix.length)),
|
|
817502
|
+
tag
|
|
817503
|
+
};
|
|
817504
|
+
}
|
|
817505
|
+
return void 0;
|
|
817506
|
+
}
|
|
817507
|
+
|
|
817369
817508
|
// pnp:/home/circleci/project/packages/cli/openapi-ir-to-fern/lib/utils/wrapTypeReferenceAsOptional.js
|
|
817370
817509
|
function wrapTypeReferenceAsOptional(typeReference) {
|
|
817371
817510
|
const type2 = getTypeFromTypeReference(typeReference);
|
|
@@ -817399,11 +817538,12 @@ function buildGlobalHeaders(context) {
|
|
|
817399
817538
|
if (HEADERS_TO_IGNORE.has(header.name)) {
|
|
817400
817539
|
continue;
|
|
817401
817540
|
}
|
|
817541
|
+
const { file } = getEndpointLocation(endpoint);
|
|
817402
817542
|
let headerWithCount = globalHeaders[header.name];
|
|
817403
817543
|
if (headerWithCount == null) {
|
|
817404
817544
|
const convertedHeader = buildHeader({
|
|
817405
817545
|
header,
|
|
817406
|
-
fileContainingReference: RelativeFilePath.of(
|
|
817546
|
+
fileContainingReference: RelativeFilePath.of(ROOT_API_FILENAME),
|
|
817407
817547
|
context
|
|
817408
817548
|
});
|
|
817409
817549
|
headerWithCount = new HeaderWithCount(convertedHeader);
|
|
@@ -817953,107 +818093,6 @@ function getRequest({ declarationFile, context, request, requestNameOverride, ge
|
|
|
817953
818093
|
}
|
|
817954
818094
|
}
|
|
817955
818095
|
|
|
817956
|
-
// pnp:/home/circleci/project/packages/cli/openapi-ir-to-fern/lib/utils/getEndpointLocation.js
|
|
817957
|
-
function getEndpointLocation(endpoint) {
|
|
817958
|
-
if (endpoint.sdkName != null) {
|
|
817959
|
-
const filename = endpoint.sdkName.groupName.length === 0 ? "__package__.yml" : `${endpoint.sdkName.groupName.map((part) => camelCase_default(part)).join("/")}.yml`;
|
|
817960
|
-
return {
|
|
817961
|
-
file: RelativeFilePath.of(filename),
|
|
817962
|
-
endpointId: endpoint.sdkName.methodName
|
|
817963
|
-
};
|
|
817964
|
-
}
|
|
817965
|
-
const tag = endpoint.tags[0];
|
|
817966
|
-
const operationId = endpoint.operationId;
|
|
817967
|
-
if (operationId == null) {
|
|
817968
|
-
if (tag != null) {
|
|
817969
|
-
return {
|
|
817970
|
-
file: RelativeFilePath.of(`${camelCase_default(tag)}.yml`),
|
|
817971
|
-
endpointId: endpoint.summary != null ? camelCase_default(endpoint.summary) : camelCase_default(`${endpoint.method}_${endpoint.path.split("/").join("_")}`)
|
|
817972
|
-
};
|
|
817973
|
-
}
|
|
817974
|
-
if (endpoint.summary != null) {
|
|
817975
|
-
return {
|
|
817976
|
-
file: RelativeFilePath.of(FERN_PACKAGE_MARKER_FILENAME),
|
|
817977
|
-
endpointId: camelCase_default(endpoint.summary)
|
|
817978
|
-
};
|
|
817979
|
-
}
|
|
817980
|
-
return {
|
|
817981
|
-
file: RelativeFilePath.of(FERN_PACKAGE_MARKER_FILENAME),
|
|
817982
|
-
endpointId: camelCase_default(`${endpoint.method}_${endpoint.path.split("/").join("_")}`)
|
|
817983
|
-
};
|
|
817984
|
-
}
|
|
817985
|
-
if (tag == null) {
|
|
817986
|
-
return {
|
|
817987
|
-
file: RelativeFilePath.of(FERN_PACKAGE_MARKER_FILENAME),
|
|
817988
|
-
endpointId: operationId
|
|
817989
|
-
};
|
|
817990
|
-
}
|
|
817991
|
-
const tagTokens = tokenizeString(tag);
|
|
817992
|
-
const operationIdTokens = tokenizeString(operationId);
|
|
817993
|
-
if (isEqual_default(tagTokens, operationIdTokens)) {
|
|
817994
|
-
return {
|
|
817995
|
-
file: RelativeFilePath.of("__package__.yml"),
|
|
817996
|
-
endpointId: tag
|
|
817997
|
-
};
|
|
817998
|
-
}
|
|
817999
|
-
const fastapiEndpointLocation = maybeGetFastApiEndpointLocation({
|
|
818000
|
-
operationId,
|
|
818001
|
-
tag,
|
|
818002
|
-
path: endpoint.path,
|
|
818003
|
-
method: endpoint.method
|
|
818004
|
-
});
|
|
818005
|
-
if (fastapiEndpointLocation != null) {
|
|
818006
|
-
return fastapiEndpointLocation;
|
|
818007
|
-
}
|
|
818008
|
-
const fileParts = [];
|
|
818009
|
-
for (let i2 = 0; i2 < tagTokens.length; ++i2) {
|
|
818010
|
-
const tagElement = tagTokens[i2];
|
|
818011
|
-
if (tagElement != null && tagElement === operationIdTokens[i2]) {
|
|
818012
|
-
fileParts.push(tagElement);
|
|
818013
|
-
} else {
|
|
818014
|
-
const camelCasedTag = camelCase_default(tag);
|
|
818015
|
-
return {
|
|
818016
|
-
file: RelativeFilePath.of(`${camelCasedTag}.yml`),
|
|
818017
|
-
endpointId: operationId,
|
|
818018
|
-
tag
|
|
818019
|
-
};
|
|
818020
|
-
}
|
|
818021
|
-
}
|
|
818022
|
-
if (fileParts.length >= operationIdTokens.length) {
|
|
818023
|
-
throw new Error(`Cannot get file for endpoint ${JSON.stringify(endpoint)}`);
|
|
818024
|
-
}
|
|
818025
|
-
return {
|
|
818026
|
-
file: RelativeFilePath.of(camelCase_default(fileParts.join("_")) + ".yml"),
|
|
818027
|
-
endpointId: camelCase_default(operationIdTokens.slice(fileParts.length).join("_")),
|
|
818028
|
-
tag
|
|
818029
|
-
};
|
|
818030
|
-
}
|
|
818031
|
-
function tokenizeString(input) {
|
|
818032
|
-
let tokens;
|
|
818033
|
-
if (/^[a-z]+(?:[A-Z][a-z]+)*$/.test(input)) {
|
|
818034
|
-
tokens = input.split(/(?=[A-Z])/);
|
|
818035
|
-
} else {
|
|
818036
|
-
tokens = input.split(/[^a-zA-Z0-9]+/);
|
|
818037
|
-
}
|
|
818038
|
-
tokens = tokens.map((token) => token.toLowerCase());
|
|
818039
|
-
tokens = compact_default(tokens);
|
|
818040
|
-
return tokens;
|
|
818041
|
-
}
|
|
818042
|
-
var NON_ALPHANUMERIC_EXCEPT_BRACES_REGEX = new RegExp("[^a-zA-Z0-9{}]+");
|
|
818043
|
-
var BRACE_REGEX = new RegExp("[{}]", "g");
|
|
818044
|
-
function maybeGetFastApiEndpointLocation({ operationId, tag, path: path33, method: method2 }) {
|
|
818045
|
-
const pathSegment = path33.split(NON_ALPHANUMERIC_EXCEPT_BRACES_REGEX).join("_").replaceAll(BRACE_REGEX, "_");
|
|
818046
|
-
const operationIdSuffix = `${pathSegment}_${method2.toLowerCase()}`;
|
|
818047
|
-
if (operationId.endsWith(operationIdSuffix)) {
|
|
818048
|
-
return {
|
|
818049
|
-
file: RelativeFilePath.of(camelCase_default(tag) + ".yml"),
|
|
818050
|
-
endpointId: camelCase_default(operationId.slice(0, -1 * operationIdSuffix.length)),
|
|
818051
|
-
tag
|
|
818052
|
-
};
|
|
818053
|
-
}
|
|
818054
|
-
return void 0;
|
|
818055
|
-
}
|
|
818056
|
-
|
|
818057
818096
|
// pnp:/home/circleci/project/packages/cli/openapi-ir-to-fern/lib/buildServices.js
|
|
818058
818097
|
function buildServices(context) {
|
|
818059
818098
|
const sdkGroups = /* @__PURE__ */ new Set();
|
|
@@ -818374,6 +818413,13 @@ var FernDefinitionBuilderImpl = class {
|
|
|
818374
818413
|
return void 0;
|
|
818375
818414
|
}
|
|
818376
818415
|
const importPrefix = camelCase_default((0, import_path16.basename)(fileToImport, (0, import_path16.extname)(fileToImport)).replaceAll("__package__", "root"));
|
|
818416
|
+
if (file === RelativeFilePath.of(ROOT_API_FILENAME)) {
|
|
818417
|
+
if (this.rootApiFile.imports == null) {
|
|
818418
|
+
this.rootApiFile.imports = {};
|
|
818419
|
+
}
|
|
818420
|
+
this.rootApiFile.imports[importPrefix] = relative(dirname(AbsoluteFilePath.of(`/${file}`)), AbsoluteFilePath.of(`/${fileToImport}`));
|
|
818421
|
+
return importPrefix;
|
|
818422
|
+
}
|
|
818377
818423
|
const fernFile = this.getOrCreateFile(file);
|
|
818378
818424
|
if (fernFile.imports == null) {
|
|
818379
818425
|
fernFile.imports = {};
|
|
@@ -818604,11 +818650,12 @@ function convert2({ openApiIr, taskContext }) {
|
|
|
818604
818650
|
|
|
818605
818651
|
// pnp:/home/circleci/project/packages/cli/workspace-loader/lib/utils/convertOpenApiWorkspaceToFernWorkspace.js
|
|
818606
818652
|
async function getOpenAPIIRFromOpenAPIWorkspace(openapiWorkspace, context) {
|
|
818607
|
-
var _a2;
|
|
818653
|
+
var _a2, _b2;
|
|
818608
818654
|
return await parse2({
|
|
818609
818655
|
absolutePathToAsyncAPI: openapiWorkspace.absolutePathToAsyncAPI,
|
|
818610
818656
|
absolutePathToOpenAPI: openapiWorkspace.absolutePathToOpenAPI,
|
|
818611
818657
|
absolutePathToOpenAPIOverrides: (_a2 = openapiWorkspace.generatorsConfiguration) == null ? void 0 : _a2.absolutePathToOpenAPIOverrides,
|
|
818658
|
+
disableExamples: (_b2 = openapiWorkspace.generatorsConfiguration) == null ? void 0 : _b2.disableOpenAPIExamples,
|
|
818612
818659
|
taskContext: context
|
|
818613
818660
|
});
|
|
818614
818661
|
}
|
|
@@ -825867,10 +825914,10 @@ var CliContext = class {
|
|
|
825867
825914
|
return "fern-api";
|
|
825868
825915
|
}
|
|
825869
825916
|
getPackageVersion() {
|
|
825870
|
-
if ("0.19.0-
|
|
825917
|
+
if ("0.19.0-rc4" == null) {
|
|
825871
825918
|
this.logger.error("CLI_VERSION is not defined");
|
|
825872
825919
|
}
|
|
825873
|
-
return "0.19.0-
|
|
825920
|
+
return "0.19.0-rc4";
|
|
825874
825921
|
}
|
|
825875
825922
|
getCliName() {
|
|
825876
825923
|
if ("fern" == null) {
|