fern-api 0.16.27 → 0.16.28
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 +82 -7
- package/package.json +1 -1
package/bundle.cjs
CHANGED
|
@@ -718209,7 +718209,7 @@ var require_router = __commonJS({
|
|
|
718209
718209
|
if (++sync > 100) {
|
|
718210
718210
|
return setImmediate(next, err);
|
|
718211
718211
|
}
|
|
718212
|
-
var path33 =
|
|
718212
|
+
var path33 = getPathname2(req);
|
|
718213
718213
|
if (path33 == null) {
|
|
718214
718214
|
return done(layerError);
|
|
718215
718215
|
}
|
|
@@ -718404,7 +718404,7 @@ var require_router = __commonJS({
|
|
|
718404
718404
|
}
|
|
718405
718405
|
}
|
|
718406
718406
|
}
|
|
718407
|
-
function
|
|
718407
|
+
function getPathname2(req) {
|
|
718408
718408
|
try {
|
|
718409
718409
|
return parseUrl(req).pathname;
|
|
718410
718410
|
} catch (err) {
|
|
@@ -736951,7 +736951,7 @@ var AccessTokenPosthogManager = class {
|
|
|
736951
736951
|
properties: {
|
|
736952
736952
|
...event,
|
|
736953
736953
|
...event.properties,
|
|
736954
|
-
version: "0.16.
|
|
736954
|
+
version: "0.16.28",
|
|
736955
736955
|
usingAccessToken: true
|
|
736956
736956
|
}
|
|
736957
736957
|
});
|
|
@@ -737013,7 +737013,7 @@ var UserPosthogManager = class {
|
|
|
737013
737013
|
distinctId: this.userId ?? await this.getPersistedDistinctId(),
|
|
737014
737014
|
event: "CLI",
|
|
737015
737015
|
properties: {
|
|
737016
|
-
version: "0.16.
|
|
737016
|
+
version: "0.16.28",
|
|
737017
737017
|
...event,
|
|
737018
737018
|
...event.properties
|
|
737019
737019
|
}
|
|
@@ -750590,11 +750590,43 @@ var FernDefinitionBuilderImpl = class {
|
|
|
750590
750590
|
fernFile.webhooks[name2] = schema2;
|
|
750591
750591
|
}
|
|
750592
750592
|
build() {
|
|
750593
|
-
|
|
750593
|
+
const basePath = getSharedEnvironmentBasePath(this.rootApiFile);
|
|
750594
|
+
if (this.packageMarkerFile.service != null) {
|
|
750595
|
+
this.packageMarkerFile.service = {
|
|
750596
|
+
...this.packageMarkerFile.service,
|
|
750597
|
+
endpoints: Object.fromEntries(Object.entries(this.packageMarkerFile.service.endpoints).map(([id, endpoint]) => {
|
|
750598
|
+
return [
|
|
750599
|
+
id,
|
|
750600
|
+
{
|
|
750601
|
+
...endpoint,
|
|
750602
|
+
path: `${basePath}${endpoint.path}`
|
|
750603
|
+
}
|
|
750604
|
+
];
|
|
750605
|
+
}))
|
|
750606
|
+
};
|
|
750607
|
+
}
|
|
750608
|
+
for (const [_4, file] of Object.entries(this.definitionFiles)) {
|
|
750609
|
+
if (file.service != null) {
|
|
750610
|
+
file.service = {
|
|
750611
|
+
...file.service,
|
|
750612
|
+
endpoints: Object.fromEntries(Object.entries(file.service.endpoints).map(([id, endpoint]) => {
|
|
750613
|
+
return [
|
|
750614
|
+
id,
|
|
750615
|
+
{
|
|
750616
|
+
...endpoint,
|
|
750617
|
+
path: `${basePath}${endpoint.path}`
|
|
750618
|
+
}
|
|
750619
|
+
];
|
|
750620
|
+
}))
|
|
750621
|
+
};
|
|
750622
|
+
}
|
|
750623
|
+
}
|
|
750624
|
+
const definition2 = {
|
|
750594
750625
|
rootApiFile: this.rootApiFile,
|
|
750595
750626
|
packageMarkerFile: this.packageMarkerFile,
|
|
750596
750627
|
definitionFiles: this.definitionFiles
|
|
750597
750628
|
};
|
|
750629
|
+
return definition2;
|
|
750598
750630
|
}
|
|
750599
750631
|
getOrCreateFile(file) {
|
|
750600
750632
|
var _a2;
|
|
@@ -750605,6 +750637,49 @@ var FernDefinitionBuilderImpl = class {
|
|
|
750605
750637
|
}
|
|
750606
750638
|
}
|
|
750607
750639
|
};
|
|
750640
|
+
function getSharedEnvironmentBasePath(rootApiFile) {
|
|
750641
|
+
if (rootApiFile.environments == null) {
|
|
750642
|
+
return "";
|
|
750643
|
+
}
|
|
750644
|
+
const urls = Object.entries(rootApiFile.environments).flatMap(([_4, url]) => {
|
|
750645
|
+
if (typeof url === "string") {
|
|
750646
|
+
return [url];
|
|
750647
|
+
} else if (isSingleBaseUrl(url)) {
|
|
750648
|
+
return [url.url];
|
|
750649
|
+
} else {
|
|
750650
|
+
return Object.values(url.urls);
|
|
750651
|
+
}
|
|
750652
|
+
});
|
|
750653
|
+
return getSharedSuffix(urls.map(getPathname));
|
|
750654
|
+
}
|
|
750655
|
+
function getPathname(url) {
|
|
750656
|
+
try {
|
|
750657
|
+
const parsedUrl = new URL(url);
|
|
750658
|
+
const pathname = parsedUrl.pathname;
|
|
750659
|
+
if (pathname.endsWith("/")) {
|
|
750660
|
+
return pathname.slice(0, -1);
|
|
750661
|
+
} else {
|
|
750662
|
+
return pathname;
|
|
750663
|
+
}
|
|
750664
|
+
} catch (err) {
|
|
750665
|
+
return "";
|
|
750666
|
+
}
|
|
750667
|
+
}
|
|
750668
|
+
function getSharedSuffix(strings) {
|
|
750669
|
+
let suffix = "";
|
|
750670
|
+
while (true) {
|
|
750671
|
+
const chars = strings.map((s2) => s2[s2.length - suffix.length - 1]);
|
|
750672
|
+
const char = chars[0];
|
|
750673
|
+
if (char == null || chars.some((c2) => c2 !== char)) {
|
|
750674
|
+
break;
|
|
750675
|
+
}
|
|
750676
|
+
suffix = char + suffix;
|
|
750677
|
+
}
|
|
750678
|
+
return suffix;
|
|
750679
|
+
}
|
|
750680
|
+
function isSingleBaseUrl(url) {
|
|
750681
|
+
return url.url != null;
|
|
750682
|
+
}
|
|
750608
750683
|
|
|
750609
750684
|
// pnp:/home/circleci/project/packages/cli/openapi-ir-to-fern/lib/OpenApiIrConverterContext.js
|
|
750610
750685
|
var OpenApiIrConverterContext = class {
|
|
@@ -761620,10 +761695,10 @@ var CliContext = class {
|
|
|
761620
761695
|
return "fern-api";
|
|
761621
761696
|
}
|
|
761622
761697
|
getPackageVersion() {
|
|
761623
|
-
if ("0.16.
|
|
761698
|
+
if ("0.16.28" == null) {
|
|
761624
761699
|
this.logger.error("CLI_VERSION is not defined");
|
|
761625
761700
|
}
|
|
761626
|
-
return "0.16.
|
|
761701
|
+
return "0.16.28";
|
|
761627
761702
|
}
|
|
761628
761703
|
getCliName() {
|
|
761629
761704
|
if ("fern" == null) {
|