fern-api 0.30.5 → 0.30.6
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 +292 -103
- package/package.json +1 -1
package/bundle.cjs
CHANGED
|
@@ -352084,6 +352084,12 @@ var init_WebhookHttpMethod = __esm({
|
|
|
352084
352084
|
}
|
|
352085
352085
|
});
|
|
352086
352086
|
|
|
352087
|
+
// pnp:/home/circleci/project/packages/ir-sdk/lib/sdk/api/resources/webhooks/types/ExampleWebhookCall.js
|
|
352088
|
+
var init_ExampleWebhookCall = __esm({
|
|
352089
|
+
"pnp:/home/circleci/project/packages/ir-sdk/lib/sdk/api/resources/webhooks/types/ExampleWebhookCall.js"() {
|
|
352090
|
+
}
|
|
352091
|
+
});
|
|
352092
|
+
|
|
352087
352093
|
// pnp:/home/circleci/project/packages/ir-sdk/lib/sdk/api/resources/webhooks/types/index.js
|
|
352088
352094
|
var init_types12 = __esm({
|
|
352089
352095
|
"pnp:/home/circleci/project/packages/ir-sdk/lib/sdk/api/resources/webhooks/types/index.js"() {
|
|
@@ -352095,6 +352101,7 @@ var init_types12 = __esm({
|
|
|
352095
352101
|
init_InlinedWebhookPayload();
|
|
352096
352102
|
init_InlinedWebhookPayloadProperty();
|
|
352097
352103
|
init_WebhookHttpMethod();
|
|
352104
|
+
init_ExampleWebhookCall();
|
|
352098
352105
|
}
|
|
352099
352106
|
});
|
|
352100
352107
|
|
|
@@ -357013,7 +357020,8 @@ var init_Webhook2 = __esm({
|
|
|
357013
357020
|
displayName: schemas_exports4.string().optional(),
|
|
357014
357021
|
method: schemas_exports4.lazy(async () => (await Promise.resolve().then(() => (init_serialization2(), serialization_exports2))).WebhookHttpMethod),
|
|
357015
357022
|
headers: schemas_exports4.list(schemas_exports4.lazyObject(async () => (await Promise.resolve().then(() => (init_serialization2(), serialization_exports2))).HttpHeader)),
|
|
357016
|
-
payload: schemas_exports4.lazy(async () => (await Promise.resolve().then(() => (init_serialization2(), serialization_exports2))).WebhookPayload)
|
|
357023
|
+
payload: schemas_exports4.lazy(async () => (await Promise.resolve().then(() => (init_serialization2(), serialization_exports2))).WebhookPayload),
|
|
357024
|
+
examples: schemas_exports4.list(schemas_exports4.lazyObject(async () => (await Promise.resolve().then(() => (init_serialization2(), serialization_exports2))).ExampleWebhookCall)).optional()
|
|
357017
357025
|
}).extend(schemas_exports4.lazyObject(async () => (await Promise.resolve().then(() => (init_serialization2(), serialization_exports2))).Declaration));
|
|
357018
357026
|
}
|
|
357019
357027
|
});
|
|
@@ -357097,6 +357105,18 @@ var init_WebhookHttpMethod2 = __esm({
|
|
|
357097
357105
|
}
|
|
357098
357106
|
});
|
|
357099
357107
|
|
|
357108
|
+
// pnp:/home/circleci/project/packages/ir-sdk/lib/sdk/serialization/resources/webhooks/types/ExampleWebhookCall.js
|
|
357109
|
+
var ExampleWebhookCall;
|
|
357110
|
+
var init_ExampleWebhookCall2 = __esm({
|
|
357111
|
+
"pnp:/home/circleci/project/packages/ir-sdk/lib/sdk/serialization/resources/webhooks/types/ExampleWebhookCall.js"() {
|
|
357112
|
+
init_core2();
|
|
357113
|
+
ExampleWebhookCall = schemas_exports4.objectWithoutOptionalProperties({
|
|
357114
|
+
name: schemas_exports4.lazyObject(async () => (await Promise.resolve().then(() => (init_serialization2(), serialization_exports2))).Name).optional(),
|
|
357115
|
+
payload: schemas_exports4.lazyObject(async () => (await Promise.resolve().then(() => (init_serialization2(), serialization_exports2))).ExampleTypeReference)
|
|
357116
|
+
}).extend(schemas_exports4.lazyObject(async () => (await Promise.resolve().then(() => (init_serialization2(), serialization_exports2))).WithDocs));
|
|
357117
|
+
}
|
|
357118
|
+
});
|
|
357119
|
+
|
|
357100
357120
|
// pnp:/home/circleci/project/packages/ir-sdk/lib/sdk/serialization/resources/webhooks/types/index.js
|
|
357101
357121
|
var init_types24 = __esm({
|
|
357102
357122
|
"pnp:/home/circleci/project/packages/ir-sdk/lib/sdk/serialization/resources/webhooks/types/index.js"() {
|
|
@@ -357108,12 +357128,14 @@ var init_types24 = __esm({
|
|
|
357108
357128
|
init_InlinedWebhookPayload2();
|
|
357109
357129
|
init_InlinedWebhookPayloadProperty2();
|
|
357110
357130
|
init_WebhookHttpMethod2();
|
|
357131
|
+
init_ExampleWebhookCall2();
|
|
357111
357132
|
}
|
|
357112
357133
|
});
|
|
357113
357134
|
|
|
357114
357135
|
// pnp:/home/circleci/project/packages/ir-sdk/lib/sdk/serialization/resources/webhooks/index.js
|
|
357115
357136
|
var webhooks_exports2 = {};
|
|
357116
357137
|
__export(webhooks_exports2, {
|
|
357138
|
+
ExampleWebhookCall: () => ExampleWebhookCall,
|
|
357117
357139
|
InlinedWebhookPayload: () => InlinedWebhookPayload,
|
|
357118
357140
|
InlinedWebhookPayloadProperty: () => InlinedWebhookPayloadProperty,
|
|
357119
357141
|
Webhook: () => Webhook,
|
|
@@ -357445,6 +357467,7 @@ __export(serialization_exports2, {
|
|
|
357445
357467
|
ExampleWebSocketMessage: () => ExampleWebSocketMessage2,
|
|
357446
357468
|
ExampleWebSocketMessageBody: () => ExampleWebSocketMessageBody2,
|
|
357447
357469
|
ExampleWebSocketSession: () => ExampleWebSocketSession2,
|
|
357470
|
+
ExampleWebhookCall: () => ExampleWebhookCall,
|
|
357448
357471
|
FeatureId: () => FeatureId,
|
|
357449
357472
|
FernFilepath: () => FernFilepath,
|
|
357450
357473
|
FileDownloadResponse: () => FileDownloadResponse,
|
|
@@ -363877,6 +363900,12 @@ var init_Webhook3 = __esm({
|
|
|
363877
363900
|
}
|
|
363878
363901
|
});
|
|
363879
363902
|
|
|
363903
|
+
// pnp:/home/circleci/project/packages/cli/openapi-ir-sdk/lib/sdk/api/resources/finalIr/types/WebhookExampleCall.js
|
|
363904
|
+
var init_WebhookExampleCall = __esm({
|
|
363905
|
+
"pnp:/home/circleci/project/packages/cli/openapi-ir-sdk/lib/sdk/api/resources/finalIr/types/WebhookExampleCall.js"() {
|
|
363906
|
+
}
|
|
363907
|
+
});
|
|
363908
|
+
|
|
363880
363909
|
// pnp:/home/circleci/project/packages/cli/openapi-ir-sdk/lib/sdk/api/resources/finalIr/types/WebsocketChannel.js
|
|
363881
363910
|
var init_WebsocketChannel = __esm({
|
|
363882
363911
|
"pnp:/home/circleci/project/packages/cli/openapi-ir-sdk/lib/sdk/api/resources/finalIr/types/WebsocketChannel.js"() {
|
|
@@ -364903,6 +364932,7 @@ var init_types28 = __esm({
|
|
|
364903
364932
|
init_Tags();
|
|
364904
364933
|
init_HttpError();
|
|
364905
364934
|
init_Webhook3();
|
|
364935
|
+
init_WebhookExampleCall();
|
|
364906
364936
|
init_WebsocketChannel();
|
|
364907
364937
|
init_WebsocketHandshake();
|
|
364908
364938
|
init_WebsocketSessionExample();
|
|
@@ -367732,7 +367762,20 @@ var init_Webhook4 = __esm({
|
|
|
367732
367762
|
tags: schemas_exports5.list(schemas_exports5.lazy(async () => (await Promise.resolve().then(() => (init_serialization3(), serialization_exports3))).TagId)),
|
|
367733
367763
|
headers: schemas_exports5.list(schemas_exports5.lazyObject(async () => (await Promise.resolve().then(() => (init_serialization3(), serialization_exports3))).Header)),
|
|
367734
367764
|
generatedPayloadName: schemas_exports5.string(),
|
|
367735
|
-
payload: schemas_exports5.lazy(async () => (await Promise.resolve().then(() => (init_serialization3(), serialization_exports3))).Schema)
|
|
367765
|
+
payload: schemas_exports5.lazy(async () => (await Promise.resolve().then(() => (init_serialization3(), serialization_exports3))).Schema),
|
|
367766
|
+
examples: schemas_exports5.list(schemas_exports5.lazyObject(async () => (await Promise.resolve().then(() => (init_serialization3(), serialization_exports3))).WebhookExampleCall))
|
|
367767
|
+
}).extend(schemas_exports5.lazyObject(async () => (await Promise.resolve().then(() => (init_serialization3(), serialization_exports3))).WithDescription));
|
|
367768
|
+
}
|
|
367769
|
+
});
|
|
367770
|
+
|
|
367771
|
+
// pnp:/home/circleci/project/packages/cli/openapi-ir-sdk/lib/sdk/serialization/resources/finalIr/types/WebhookExampleCall.js
|
|
367772
|
+
var WebhookExampleCall;
|
|
367773
|
+
var init_WebhookExampleCall2 = __esm({
|
|
367774
|
+
"pnp:/home/circleci/project/packages/cli/openapi-ir-sdk/lib/sdk/serialization/resources/finalIr/types/WebhookExampleCall.js"() {
|
|
367775
|
+
init_core3();
|
|
367776
|
+
WebhookExampleCall = schemas_exports5.objectWithoutOptionalProperties({
|
|
367777
|
+
name: schemas_exports5.string().optional(),
|
|
367778
|
+
payload: schemas_exports5.lazy(async () => (await Promise.resolve().then(() => (init_serialization3(), serialization_exports3))).FullExample)
|
|
367736
367779
|
}).extend(schemas_exports5.lazyObject(async () => (await Promise.resolve().then(() => (init_serialization3(), serialization_exports3))).WithDescription));
|
|
367737
367780
|
}
|
|
367738
367781
|
});
|
|
@@ -368731,6 +368774,7 @@ var init_types32 = __esm({
|
|
|
368731
368774
|
init_Tags2();
|
|
368732
368775
|
init_HttpError2();
|
|
368733
368776
|
init_Webhook4();
|
|
368777
|
+
init_WebhookExampleCall2();
|
|
368734
368778
|
init_WebsocketChannel2();
|
|
368735
368779
|
init_WebsocketHandshake2();
|
|
368736
368780
|
init_WebsocketSessionExample2();
|
|
@@ -368861,6 +368905,7 @@ __export(finalIr_exports2, {
|
|
|
368861
368905
|
TextResponse: () => TextResponse2,
|
|
368862
368906
|
UnDiscriminatedOneOfSchema: () => UnDiscriminatedOneOfSchema,
|
|
368863
368907
|
Webhook: () => Webhook2,
|
|
368908
|
+
WebhookExampleCall: () => WebhookExampleCall,
|
|
368864
368909
|
WebhookHttpMethod: () => WebhookHttpMethod5,
|
|
368865
368910
|
WebsocketChannel: () => WebsocketChannel,
|
|
368866
368911
|
WebsocketHandshake: () => WebsocketHandshake,
|
|
@@ -369683,6 +369728,7 @@ __export(serialization_exports3, {
|
|
|
369683
369728
|
UnDiscriminatedOneOfSchemaWithExample: () => UnDiscriminatedOneOfSchemaWithExample,
|
|
369684
369729
|
UnknownSchemaWithExample: () => UnknownSchemaWithExample,
|
|
369685
369730
|
Webhook: () => Webhook2,
|
|
369731
|
+
WebhookExampleCall: () => WebhookExampleCall,
|
|
369686
369732
|
WebhookHttpMethod: () => WebhookHttpMethod5,
|
|
369687
369733
|
WebsocketChannel: () => WebsocketChannel,
|
|
369688
369734
|
WebsocketHandshake: () => WebsocketHandshake,
|
|
@@ -1030215,7 +1030261,7 @@ var AccessTokenPosthogManager = class {
|
|
|
1030215
1030261
|
properties: {
|
|
1030216
1030262
|
...event,
|
|
1030217
1030263
|
...event.properties,
|
|
1030218
|
-
version: "0.30.
|
|
1030264
|
+
version: "0.30.6",
|
|
1030219
1030265
|
usingAccessToken: true
|
|
1030220
1030266
|
}
|
|
1030221
1030267
|
});
|
|
@@ -1030277,7 +1030323,7 @@ var UserPosthogManager = class {
|
|
|
1030277
1030323
|
distinctId: this.userId ?? await this.getPersistedDistinctId(),
|
|
1030278
1030324
|
event: "CLI",
|
|
1030279
1030325
|
properties: {
|
|
1030280
|
-
version: "0.30.
|
|
1030326
|
+
version: "0.30.6",
|
|
1030281
1030327
|
...event,
|
|
1030282
1030328
|
...event.properties
|
|
1030283
1030329
|
}
|
|
@@ -1040928,6 +1040974,7 @@ async function visitWebhooks({ webhook, visitor, nodePathForWebhook }) {
|
|
|
1040928
1040974
|
await visitObject(webhook, {
|
|
1040929
1040975
|
"display-name": noop,
|
|
1040930
1040976
|
method: noop,
|
|
1040977
|
+
examples: noop,
|
|
1040931
1040978
|
headers: async (headers) => {
|
|
1040932
1040979
|
await visitHeaders2({
|
|
1040933
1040980
|
headers,
|
|
@@ -1041420,6 +1041467,7 @@ __export(schemas_exports3, {
|
|
|
1041420
1041467
|
ExampleTypeSchema: () => ExampleTypeSchema,
|
|
1041421
1041468
|
ExampleTypeValueSchema: () => ExampleTypeValueSchema,
|
|
1041422
1041469
|
ExampleWebSocketSession: () => ExampleWebSocketSession,
|
|
1041470
|
+
ExampleWebhookCallSchema: () => ExampleWebhookCallSchema,
|
|
1041423
1041471
|
HeaderAuthSchemeSchema: () => HeaderAuthSchemeSchema,
|
|
1041424
1041472
|
HttpEndpointSchema: () => HttpEndpointSchema,
|
|
1041425
1041473
|
HttpHeaderSchema: () => HttpHeaderSchema,
|
|
@@ -1041839,6 +1041887,13 @@ var ExampleEndpointCallSchema = WithNameAndDocsSchema.extend({
|
|
|
1041839
1041887
|
});
|
|
1041840
1041888
|
var ExampleEndpointCallArraySchema = z.array(ExampleEndpointCallSchema);
|
|
1041841
1041889
|
|
|
1041890
|
+
// pnp:/home/circleci/project/packages/cli/yaml/yaml-schema/lib/schemas/ExampleWebhookCallSchema.js
|
|
1041891
|
+
var ExampleWebhookCallSchema = WithNameAndDocsSchema.extend({
|
|
1041892
|
+
id: z.optional(z.string()),
|
|
1041893
|
+
payload: z.optional(ExampleTypeReferenceSchema)
|
|
1041894
|
+
});
|
|
1041895
|
+
var ExampleWebhookCallArraySchema = z.array(ExampleWebhookCallSchema);
|
|
1041896
|
+
|
|
1041842
1041897
|
// pnp:/home/circleci/project/packages/cli/yaml/yaml-schema/lib/schemas/ExampleWebSocketMessage.js
|
|
1041843
1041898
|
var ExampleWebSocketMessage = z.object({
|
|
1041844
1041899
|
type: z.string(),
|
|
@@ -1042030,7 +1042085,8 @@ var WebhookSchema = DeclarationSchema.extend({
|
|
|
1042030
1042085
|
method: z.enum(["GET", "POST"]),
|
|
1042031
1042086
|
"display-name": z.optional(z.string()),
|
|
1042032
1042087
|
headers: z.optional(z.record(HttpHeaderSchema)),
|
|
1042033
|
-
payload: WebhookPayloadSchema
|
|
1042088
|
+
payload: WebhookPayloadSchema,
|
|
1042089
|
+
examples: z.optional(z.array(ExampleWebhookCallSchema))
|
|
1042034
1042090
|
});
|
|
1042035
1042091
|
|
|
1042036
1042092
|
// pnp:/home/circleci/project/packages/cli/yaml/yaml-schema/lib/schemas/WebSocketChannelInlinedMessageSchema.js
|
|
@@ -1045937,6 +1045993,12 @@ function convertToFullExample(value) {
|
|
|
1045937
1045993
|
return FullExample.primitive(PrimitiveExample.double(value));
|
|
1045938
1045994
|
} else if (typeof value === "boolean") {
|
|
1045939
1045995
|
return FullExample.primitive(PrimitiveExample.boolean(value));
|
|
1045996
|
+
} else if (Array.isArray(value)) {
|
|
1045997
|
+
const examples = value.map((example) => convertToFullExample(example));
|
|
1045998
|
+
if (examples.length === 0) {
|
|
1045999
|
+
return void 0;
|
|
1046000
|
+
}
|
|
1046001
|
+
return FullExample.array(examples.filter((example) => example != null));
|
|
1045940
1046002
|
} else if (value != null && typeof value === "object" && Object.keys(value).every((key2) => typeof key2 === "string")) {
|
|
1045941
1046003
|
const kvs = [];
|
|
1045942
1046004
|
for (const [property5, propertyValue] of Object.entries(value)) {
|
|
@@ -1047846,7 +1047908,7 @@ function getReferenceOccurrencesHelper({ obj, occurrences, breadcrumbs }) {
|
|
|
1047846
1047908
|
function removeApplicationJsonAndMultipartConflictsFromDocument(document6) {
|
|
1047847
1047909
|
return {
|
|
1047848
1047910
|
...document6,
|
|
1047849
|
-
paths: Object.fromEntries(Object.entries(document6.paths).map(([path42, pathItem]) => {
|
|
1047911
|
+
paths: Object.fromEntries(Object.entries(document6.paths ?? {}).map(([path42, pathItem]) => {
|
|
1047850
1047912
|
return [
|
|
1047851
1047913
|
path42,
|
|
1047852
1047914
|
{
|
|
@@ -1048974,12 +1049036,31 @@ function convertWebhookOperation({ context, operationContext }) {
|
|
|
1048974
1049036
|
headers: convertedParameters.headers,
|
|
1048975
1049037
|
generatedPayloadName: getGeneratedTypeName(payloadBreadcrumbs),
|
|
1048976
1049038
|
payload: convertedPayload.schema,
|
|
1048977
|
-
description: operation.description
|
|
1049039
|
+
description: operation.description,
|
|
1049040
|
+
examples: convertWebhookExamples(convertedPayload.fullExamples)
|
|
1048978
1049041
|
};
|
|
1048979
1049042
|
}
|
|
1049043
|
+
function convertWebhookExamples(payloadExamples) {
|
|
1049044
|
+
if (payloadExamples == null) {
|
|
1049045
|
+
return [];
|
|
1049046
|
+
}
|
|
1049047
|
+
const webhookExampleCalls = [];
|
|
1049048
|
+
for (const payloadExample of payloadExamples) {
|
|
1049049
|
+
const fullExample = convertToFullExample(payloadExample.value);
|
|
1049050
|
+
if (fullExample == null) {
|
|
1049051
|
+
continue;
|
|
1049052
|
+
}
|
|
1049053
|
+
webhookExampleCalls.push({
|
|
1049054
|
+
description: payloadExample.description,
|
|
1049055
|
+
name: payloadExample.name,
|
|
1049056
|
+
payload: fullExample
|
|
1049057
|
+
});
|
|
1049058
|
+
}
|
|
1049059
|
+
return webhookExampleCalls;
|
|
1049060
|
+
}
|
|
1048980
1049061
|
|
|
1048981
1049062
|
// pnp:/home/circleci/project/packages/cli/openapi-parser/lib/openapi/v3/converters/operation/convertOperation.js
|
|
1048982
|
-
function convertOperation({ context, pathItemContext, operation }) {
|
|
1049063
|
+
function convertOperation({ context, pathItemContext, operation, convertToWebhook }) {
|
|
1048983
1049064
|
const shouldIgnore = getExtension(operation, FernOpenAPIExtension.IGNORE);
|
|
1048984
1049065
|
if (shouldIgnore != null && shouldIgnore) {
|
|
1048985
1049066
|
context.logger.info(`${pathItemContext.method.toUpperCase()} ${pathItemContext.path} is marked with x-fern-ignore. Skipping.`);
|
|
@@ -1049000,7 +1049081,7 @@ function convertOperation({ context, pathItemContext, operation }) {
|
|
|
1049000
1049081
|
operationParameters: operation.parameters ?? [],
|
|
1049001
1049082
|
pagination
|
|
1049002
1049083
|
};
|
|
1049003
|
-
if (
|
|
1049084
|
+
if (convertToWebhook) {
|
|
1049004
1049085
|
const webhook = convertWebhookOperation({
|
|
1049005
1049086
|
context,
|
|
1049006
1049087
|
operationContext
|
|
@@ -1049040,9 +1049121,6 @@ function convertOperation({ context, pathItemContext, operation }) {
|
|
|
1049040
1049121
|
});
|
|
1049041
1049122
|
return { type: "http", value: convertedHttpOperation };
|
|
1049042
1049123
|
}
|
|
1049043
|
-
function isWebhook({ operation }) {
|
|
1049044
|
-
return getExtension(operation, [FernOpenAPIExtension.WEBHOOK]) ?? false;
|
|
1049045
|
-
}
|
|
1049046
1049124
|
function getSdkGroupAndMethod(operation) {
|
|
1049047
1049125
|
const sdkMethodName = getExtension(operation, FernOpenAPIExtension.SDK_METHOD_NAME);
|
|
1049048
1049126
|
const sdkGroupName = getExtension(operation, FernOpenAPIExtension.SDK_GROUP_NAME) ?? [];
|
|
@@ -1049074,6 +1049152,32 @@ function getBaseBreadcrumbs({ sdkMethodName, operation, httpMethod, path: path42
|
|
|
1049074
1049152
|
|
|
1049075
1049153
|
// pnp:/home/circleci/project/packages/cli/openapi-parser/lib/openapi/v3/converters/convertPathItem.js
|
|
1049076
1049154
|
function convertPathItem(path42, pathItemObject, document6, context) {
|
|
1049155
|
+
const result2 = [];
|
|
1049156
|
+
const operations = getOperationObjectsFromPathItem(pathItemObject);
|
|
1049157
|
+
const basePathItemContext = {
|
|
1049158
|
+
document: document6,
|
|
1049159
|
+
pathItem: pathItemObject,
|
|
1049160
|
+
path: path42,
|
|
1049161
|
+
pathItemParameters: pathItemObject.parameters ?? []
|
|
1049162
|
+
};
|
|
1049163
|
+
for (const operation of operations) {
|
|
1049164
|
+
const convertToWebhook = isWebhook({ operation: operation.operation });
|
|
1049165
|
+
const convertedOperation = convertOperation({
|
|
1049166
|
+
context,
|
|
1049167
|
+
pathItemContext: {
|
|
1049168
|
+
...basePathItemContext,
|
|
1049169
|
+
method: operation.method
|
|
1049170
|
+
},
|
|
1049171
|
+
operation: operation.operation,
|
|
1049172
|
+
convertToWebhook
|
|
1049173
|
+
});
|
|
1049174
|
+
if (convertedOperation != null) {
|
|
1049175
|
+
result2.push(convertedOperation);
|
|
1049176
|
+
}
|
|
1049177
|
+
}
|
|
1049178
|
+
return result2;
|
|
1049179
|
+
}
|
|
1049180
|
+
function convertPathItemToWebhooks(path42, pathItemObject, document6, context) {
|
|
1049077
1049181
|
const result2 = [];
|
|
1049078
1049182
|
const operations = getOperationObjectsFromPathItem(pathItemObject);
|
|
1049079
1049183
|
const basePathItemContext = {
|
|
@@ -1049089,7 +1049193,8 @@ function convertPathItem(path42, pathItemObject, document6, context) {
|
|
|
1049089
1049193
|
...basePathItemContext,
|
|
1049090
1049194
|
method: operation.method
|
|
1049091
1049195
|
},
|
|
1049092
|
-
operation: operation.operation
|
|
1049196
|
+
operation: operation.operation,
|
|
1049197
|
+
convertToWebhook: true
|
|
1049093
1049198
|
});
|
|
1049094
1049199
|
if (convertedOperation != null) {
|
|
1049095
1049200
|
result2.push(convertedOperation);
|
|
@@ -1049131,6 +1049236,9 @@ function getOperationObjectsFromPathItem(pathItemObject) {
|
|
|
1049131
1049236
|
}
|
|
1049132
1049237
|
return operations;
|
|
1049133
1049238
|
}
|
|
1049239
|
+
function isWebhook({ operation }) {
|
|
1049240
|
+
return getExtension(operation, [FernOpenAPIExtension.WEBHOOK]) ?? false;
|
|
1049241
|
+
}
|
|
1049134
1049242
|
|
|
1049135
1049243
|
// pnp:/home/circleci/project/packages/cli/openapi-parser/lib/openapi/v3/extensions/getBasicSecuritySchemeNames.js
|
|
1049136
1049244
|
function getBasicSecuritySchemeNames(securityScheme) {
|
|
@@ -1049304,6 +1049412,12 @@ function getVariableDefinitions(document6) {
|
|
|
1049304
1049412
|
}));
|
|
1049305
1049413
|
}
|
|
1049306
1049414
|
|
|
1049415
|
+
// pnp:/home/circleci/project/packages/cli/openapi-parser/lib/openapi/v3/getWebhookPathsObject.js
|
|
1049416
|
+
var WEBHOOKS = "webhooks";
|
|
1049417
|
+
function getWebhooksPathsObject(document6) {
|
|
1049418
|
+
return getExtension(document6, WEBHOOKS) ?? {};
|
|
1049419
|
+
}
|
|
1049420
|
+
|
|
1049307
1049421
|
// pnp:/home/circleci/project/packages/cli/openapi-parser/lib/openapi/v3/OpenAPIV3ParserContext.js
|
|
1049308
1049422
|
var OpenAPIV3ParserContext = class extends AbstractOpenAPIV3ParserContext {
|
|
1049309
1049423
|
nonRequestReferencedSchemas = /* @__PURE__ */ new Set();
|
|
@@ -1049488,7 +1049602,7 @@ function generateIr({ openApi, taskContext, disableExamples, audiences, shouldUs
|
|
|
1049488
1049602
|
const idempotencyHeaders = getIdempotencyHeaders(openApi);
|
|
1049489
1049603
|
const endpointsWithExample = [];
|
|
1049490
1049604
|
const webhooks = [];
|
|
1049491
|
-
Object.entries(openApi.paths).forEach(([path42, pathItem]) => {
|
|
1049605
|
+
Object.entries(openApi.paths ?? {}).forEach(([path42, pathItem]) => {
|
|
1049492
1049606
|
if (pathItem == null) {
|
|
1049493
1049607
|
return;
|
|
1049494
1049608
|
}
|
|
@@ -1049521,6 +1049635,20 @@ function generateIr({ openApi, taskContext, disableExamples, audiences, shouldUs
|
|
|
1049521
1049635
|
}
|
|
1049522
1049636
|
}
|
|
1049523
1049637
|
});
|
|
1049638
|
+
Object.entries(getWebhooksPathsObject(openApi)).forEach(([path42, pathItem]) => {
|
|
1049639
|
+
if (pathItem == null) {
|
|
1049640
|
+
return;
|
|
1049641
|
+
}
|
|
1049642
|
+
taskContext.logger.debug(`Converting path ${path42}`);
|
|
1049643
|
+
const convertedWebhooks = convertPathItemToWebhooks(path42, pathItem, openApi, context);
|
|
1049644
|
+
for (const webhook of convertedWebhooks) {
|
|
1049645
|
+
const webhookAudiences = getAudiences({ operation: webhook });
|
|
1049646
|
+
if (audiences.length > 0 && !audiences.some((audience) => webhookAudiences.includes(audience))) {
|
|
1049647
|
+
continue;
|
|
1049648
|
+
}
|
|
1049649
|
+
webhooks.push(webhook.value);
|
|
1049650
|
+
}
|
|
1049651
|
+
});
|
|
1049524
1049652
|
const schemasWithExample = Object.fromEntries(Object.entries(((_b4 = openApi.components) == null ? void 0 : _b4.schemas) ?? {}).map(([key2, schema2]) => {
|
|
1049525
1049653
|
if (!isReferenceObject(schema2)) {
|
|
1049526
1049654
|
const ignoreSchema = getExtension(schema2, FernOpenAPIExtension.IGNORE);
|
|
@@ -1050621,88 +1050749,7 @@ function buildIdempotencyHeaders(context) {
|
|
|
1050621
1050749
|
}
|
|
1050622
1050750
|
}
|
|
1050623
1050751
|
|
|
1050624
|
-
// pnp:/home/circleci/project/packages/cli/openapi-ir-to-fern/lib/
|
|
1050625
|
-
function buildEndpointExample({ endpointExample, context }) {
|
|
1050626
|
-
const example = {};
|
|
1050627
|
-
if (endpointExample.type !== "full") {
|
|
1050628
|
-
return endpointExample.value;
|
|
1050629
|
-
}
|
|
1050630
|
-
if (endpointExample.name != null) {
|
|
1050631
|
-
example.name = endpointExample.name;
|
|
1050632
|
-
}
|
|
1050633
|
-
if (endpointExample.description != null) {
|
|
1050634
|
-
example.docs = endpointExample.description;
|
|
1050635
|
-
}
|
|
1050636
|
-
if (endpointExample.pathParameters != null && endpointExample.pathParameters.length > 0) {
|
|
1050637
|
-
example["path-parameters"] = convertNamedFullExamples(endpointExample.pathParameters);
|
|
1050638
|
-
}
|
|
1050639
|
-
if (endpointExample.queryParameters != null && endpointExample.queryParameters.length > 0) {
|
|
1050640
|
-
example["query-parameters"] = convertQueryParameterExample2(endpointExample.queryParameters);
|
|
1050641
|
-
}
|
|
1050642
|
-
if (endpointExample.headers != null && endpointExample.headers.length > 0) {
|
|
1050643
|
-
example.headers = convertHeaderExamples2({ context, namedFullExamples: endpointExample.headers });
|
|
1050644
|
-
}
|
|
1050645
|
-
if (endpointExample.request != null) {
|
|
1050646
|
-
example.request = convertFullExample2(endpointExample.request);
|
|
1050647
|
-
}
|
|
1050648
|
-
if (endpointExample.response != null) {
|
|
1050649
|
-
example.response = { body: convertFullExample2(endpointExample.response) };
|
|
1050650
|
-
}
|
|
1050651
|
-
if (endpointExample.response != null) {
|
|
1050652
|
-
example.response = { body: convertFullExample2(endpointExample.response) };
|
|
1050653
|
-
}
|
|
1050654
|
-
if (endpointExample.codeSamples != null && endpointExample.codeSamples.length > 0) {
|
|
1050655
|
-
example["code-samples"] = endpointExample.codeSamples.map((codeSample) => {
|
|
1050656
|
-
if (codeSample.type === "language") {
|
|
1050657
|
-
return {
|
|
1050658
|
-
name: codeSample.name ?? void 0,
|
|
1050659
|
-
docs: codeSample.description ?? void 0,
|
|
1050660
|
-
language: codeSample.language,
|
|
1050661
|
-
code: codeSample.code,
|
|
1050662
|
-
install: codeSample.install ?? void 0
|
|
1050663
|
-
};
|
|
1050664
|
-
} else {
|
|
1050665
|
-
return {
|
|
1050666
|
-
name: codeSample.name ?? void 0,
|
|
1050667
|
-
docs: codeSample.description ?? void 0,
|
|
1050668
|
-
sdk: codeSample.sdk,
|
|
1050669
|
-
code: codeSample.code
|
|
1050670
|
-
};
|
|
1050671
|
-
}
|
|
1050672
|
-
}).filter(isNonNullish);
|
|
1050673
|
-
}
|
|
1050674
|
-
return example;
|
|
1050675
|
-
}
|
|
1050676
|
-
function convertNamedFullExamples(namedFullExamples) {
|
|
1050677
|
-
const result2 = {};
|
|
1050678
|
-
namedFullExamples.map((namedFullExample) => result2[namedFullExample.name] = convertFullExample2(namedFullExample.value));
|
|
1050679
|
-
return result2;
|
|
1050680
|
-
}
|
|
1050681
|
-
function convertQueryParameterExample2(namedFullExamples) {
|
|
1050682
|
-
const result2 = {};
|
|
1050683
|
-
namedFullExamples.forEach((namedFullExample) => {
|
|
1050684
|
-
const convertedExample = convertFullExample2(namedFullExample.value);
|
|
1050685
|
-
if (Array.isArray(convertedExample)) {
|
|
1050686
|
-
result2[namedFullExample.name] = convertedExample[0];
|
|
1050687
|
-
} else if (convertedExample != null) {
|
|
1050688
|
-
result2[namedFullExample.name] = convertedExample;
|
|
1050689
|
-
}
|
|
1050690
|
-
});
|
|
1050691
|
-
return result2;
|
|
1050692
|
-
}
|
|
1050693
|
-
function convertHeaderExamples2({ context, namedFullExamples }) {
|
|
1050694
|
-
const globalHeaderNames = context.builder.getGlobalHeaderNames();
|
|
1050695
|
-
const result2 = {};
|
|
1050696
|
-
namedFullExamples.forEach((namedFullExample) => {
|
|
1050697
|
-
const convertedExample = convertFullExample2(namedFullExample.value);
|
|
1050698
|
-
if (globalHeaderNames.has(namedFullExample.name)) {
|
|
1050699
|
-
return;
|
|
1050700
|
-
} else if (convertedExample != null) {
|
|
1050701
|
-
result2[namedFullExample.name] = convertedExample;
|
|
1050702
|
-
}
|
|
1050703
|
-
});
|
|
1050704
|
-
return result2;
|
|
1050705
|
-
}
|
|
1050752
|
+
// pnp:/home/circleci/project/packages/cli/openapi-ir-to-fern/lib/utils/convertFullExample.js
|
|
1050706
1050753
|
function convertFullExample2(fullExample) {
|
|
1050707
1050754
|
switch (fullExample.type) {
|
|
1050708
1050755
|
case "primitive":
|
|
@@ -1050788,6 +1050835,89 @@ function convertLiteralExample2(literal2) {
|
|
|
1050788
1050835
|
}
|
|
1050789
1050836
|
}
|
|
1050790
1050837
|
|
|
1050838
|
+
// pnp:/home/circleci/project/packages/cli/openapi-ir-to-fern/lib/buildEndpointExample.js
|
|
1050839
|
+
function buildEndpointExample({ endpointExample, context }) {
|
|
1050840
|
+
const example = {};
|
|
1050841
|
+
if (endpointExample.type !== "full") {
|
|
1050842
|
+
return endpointExample.value;
|
|
1050843
|
+
}
|
|
1050844
|
+
if (endpointExample.name != null) {
|
|
1050845
|
+
example.name = endpointExample.name;
|
|
1050846
|
+
}
|
|
1050847
|
+
if (endpointExample.description != null) {
|
|
1050848
|
+
example.docs = endpointExample.description;
|
|
1050849
|
+
}
|
|
1050850
|
+
if (endpointExample.pathParameters != null && endpointExample.pathParameters.length > 0) {
|
|
1050851
|
+
example["path-parameters"] = convertNamedFullExamples(endpointExample.pathParameters);
|
|
1050852
|
+
}
|
|
1050853
|
+
if (endpointExample.queryParameters != null && endpointExample.queryParameters.length > 0) {
|
|
1050854
|
+
example["query-parameters"] = convertQueryParameterExample2(endpointExample.queryParameters);
|
|
1050855
|
+
}
|
|
1050856
|
+
if (endpointExample.headers != null && endpointExample.headers.length > 0) {
|
|
1050857
|
+
example.headers = convertHeaderExamples2({ context, namedFullExamples: endpointExample.headers });
|
|
1050858
|
+
}
|
|
1050859
|
+
if (endpointExample.request != null) {
|
|
1050860
|
+
example.request = convertFullExample2(endpointExample.request);
|
|
1050861
|
+
}
|
|
1050862
|
+
if (endpointExample.response != null) {
|
|
1050863
|
+
example.response = { body: convertFullExample2(endpointExample.response) };
|
|
1050864
|
+
}
|
|
1050865
|
+
if (endpointExample.response != null) {
|
|
1050866
|
+
example.response = { body: convertFullExample2(endpointExample.response) };
|
|
1050867
|
+
}
|
|
1050868
|
+
if (endpointExample.codeSamples != null && endpointExample.codeSamples.length > 0) {
|
|
1050869
|
+
example["code-samples"] = endpointExample.codeSamples.map((codeSample) => {
|
|
1050870
|
+
if (codeSample.type === "language") {
|
|
1050871
|
+
return {
|
|
1050872
|
+
name: codeSample.name ?? void 0,
|
|
1050873
|
+
docs: codeSample.description ?? void 0,
|
|
1050874
|
+
language: codeSample.language,
|
|
1050875
|
+
code: codeSample.code,
|
|
1050876
|
+
install: codeSample.install ?? void 0
|
|
1050877
|
+
};
|
|
1050878
|
+
} else {
|
|
1050879
|
+
return {
|
|
1050880
|
+
name: codeSample.name ?? void 0,
|
|
1050881
|
+
docs: codeSample.description ?? void 0,
|
|
1050882
|
+
sdk: codeSample.sdk,
|
|
1050883
|
+
code: codeSample.code
|
|
1050884
|
+
};
|
|
1050885
|
+
}
|
|
1050886
|
+
}).filter(isNonNullish);
|
|
1050887
|
+
}
|
|
1050888
|
+
return example;
|
|
1050889
|
+
}
|
|
1050890
|
+
function convertNamedFullExamples(namedFullExamples) {
|
|
1050891
|
+
const result2 = {};
|
|
1050892
|
+
namedFullExamples.map((namedFullExample) => result2[namedFullExample.name] = convertFullExample2(namedFullExample.value));
|
|
1050893
|
+
return result2;
|
|
1050894
|
+
}
|
|
1050895
|
+
function convertQueryParameterExample2(namedFullExamples) {
|
|
1050896
|
+
const result2 = {};
|
|
1050897
|
+
namedFullExamples.forEach((namedFullExample) => {
|
|
1050898
|
+
const convertedExample = convertFullExample2(namedFullExample.value);
|
|
1050899
|
+
if (Array.isArray(convertedExample)) {
|
|
1050900
|
+
result2[namedFullExample.name] = convertedExample[0];
|
|
1050901
|
+
} else if (convertedExample != null) {
|
|
1050902
|
+
result2[namedFullExample.name] = convertedExample;
|
|
1050903
|
+
}
|
|
1050904
|
+
});
|
|
1050905
|
+
return result2;
|
|
1050906
|
+
}
|
|
1050907
|
+
function convertHeaderExamples2({ context, namedFullExamples }) {
|
|
1050908
|
+
const globalHeaderNames = context.builder.getGlobalHeaderNames();
|
|
1050909
|
+
const result2 = {};
|
|
1050910
|
+
namedFullExamples.forEach((namedFullExample) => {
|
|
1050911
|
+
const convertedExample = convertFullExample2(namedFullExample.value);
|
|
1050912
|
+
if (globalHeaderNames.has(namedFullExample.name)) {
|
|
1050913
|
+
return;
|
|
1050914
|
+
} else if (convertedExample != null) {
|
|
1050915
|
+
result2[namedFullExample.name] = convertedExample;
|
|
1050916
|
+
}
|
|
1050917
|
+
});
|
|
1050918
|
+
return result2;
|
|
1050919
|
+
}
|
|
1050920
|
+
|
|
1050791
1050921
|
// pnp:/home/circleci/project/packages/cli/openapi-ir-to-fern/lib/utils/convertToHttpMethod.js
|
|
1050792
1050922
|
function convertToHttpMethod(httpMethod) {
|
|
1050793
1050923
|
return HttpMethod6._visit(httpMethod, {
|
|
@@ -1051376,7 +1051506,14 @@ function buildWebhooks(context) {
|
|
|
1051376
1051506
|
schema: webhook.payload,
|
|
1051377
1051507
|
context,
|
|
1051378
1051508
|
fileContainingReference: webhookLocation.file
|
|
1051379
|
-
})
|
|
1051509
|
+
}),
|
|
1051510
|
+
examples: webhook.examples != null ? webhook.examples.map((exampleWebhookCall) => {
|
|
1051511
|
+
return {
|
|
1051512
|
+
docs: exampleWebhookCall.description,
|
|
1051513
|
+
name: exampleWebhookCall.name,
|
|
1051514
|
+
payload: convertFullExample2(exampleWebhookCall.payload)
|
|
1051515
|
+
};
|
|
1051516
|
+
}) : void 0
|
|
1051380
1051517
|
};
|
|
1051381
1051518
|
context.builder.addWebhook(webhookLocation.file, {
|
|
1051382
1051519
|
name: webhookLocation.endpointId,
|
|
@@ -1056126,10 +1056263,10 @@ var CliContext = class {
|
|
|
1056126
1056263
|
return "fern-api";
|
|
1056127
1056264
|
}
|
|
1056128
1056265
|
getPackageVersion() {
|
|
1056129
|
-
if ("0.30.
|
|
1056266
|
+
if ("0.30.6" == null) {
|
|
1056130
1056267
|
this.logger.error("CLI_VERSION is not defined");
|
|
1056131
1056268
|
}
|
|
1056132
|
-
return "0.30.
|
|
1056269
|
+
return "0.30.6";
|
|
1056133
1056270
|
}
|
|
1056134
1056271
|
getCliName() {
|
|
1056135
1056272
|
if ("fern" == null) {
|
|
@@ -1060637,7 +1060774,7 @@ function getReadmeEndpointObject({ endpoint }) {
|
|
|
1060637
1060774
|
}
|
|
1060638
1060775
|
|
|
1060639
1060776
|
// pnp:/home/circleci/project/packages/cli/generation/ir-generator/lib/converters/convertWebhookGroup.js
|
|
1060640
|
-
async function convertWebhookGroup({ webhooks, file }) {
|
|
1060777
|
+
async function convertWebhookGroup({ webhooks, file, typeResolver, exampleResolver, workspace }) {
|
|
1060641
1060778
|
const webhookGroup = [];
|
|
1060642
1060779
|
for (const [webhookId, webhook] of Object.entries(webhooks)) {
|
|
1060643
1060780
|
webhookGroup.push({
|
|
@@ -1060647,7 +1060784,15 @@ async function convertWebhookGroup({ webhooks, file }) {
|
|
|
1060647
1060784
|
method: webhook.method,
|
|
1060648
1060785
|
name: file.casingsGenerator.generateName(webhookId),
|
|
1060649
1060786
|
headers: webhook.headers != null ? await Promise.all(Object.entries(webhook.headers).map(([headerKey, header]) => convertHttpHeader({ headerKey, header, file }))) : [],
|
|
1060650
|
-
payload: convertWebhookPayloadSchema({ payload: webhook.payload, file })
|
|
1060787
|
+
payload: convertWebhookPayloadSchema({ payload: webhook.payload, file }),
|
|
1060788
|
+
examples: webhook.examples != null ? convertWebhookExamples2({
|
|
1060789
|
+
webhook,
|
|
1060790
|
+
examples: webhook.examples,
|
|
1060791
|
+
file,
|
|
1060792
|
+
typeResolver,
|
|
1060793
|
+
exampleResolver,
|
|
1060794
|
+
workspace
|
|
1060795
|
+
}) : void 0
|
|
1060651
1060796
|
});
|
|
1060652
1060797
|
}
|
|
1060653
1060798
|
return webhookGroup;
|
|
@@ -1060686,6 +1060831,40 @@ function convertInlinedRequestProperty2({ propertyKey, propertyDefinition, docs,
|
|
|
1060686
1060831
|
valueType: file.parseTypeReference(propertyDefinition)
|
|
1060687
1060832
|
};
|
|
1060688
1060833
|
}
|
|
1060834
|
+
function convertWebhookExamples2({ webhook, examples, file, typeResolver, exampleResolver, workspace }) {
|
|
1060835
|
+
const typeName = typeof webhook.payload === "string" ? webhook.payload : isReferencedWebhookPayloadSchema2(webhook.payload) ? webhook.payload.type : void 0;
|
|
1060836
|
+
if (typeName != null) {
|
|
1060837
|
+
return examples.map((example) => ({
|
|
1060838
|
+
docs: webhook.docs,
|
|
1060839
|
+
name: example.name != null ? file.casingsGenerator.generateName(example.name) : void 0,
|
|
1060840
|
+
payload: convertTypeReferenceExample({
|
|
1060841
|
+
example: example.payload,
|
|
1060842
|
+
rawTypeBeingExemplified: typeName,
|
|
1060843
|
+
fileContainingRawTypeReference: file,
|
|
1060844
|
+
fileContainingExample: file,
|
|
1060845
|
+
typeResolver,
|
|
1060846
|
+
exampleResolver,
|
|
1060847
|
+
workspace
|
|
1060848
|
+
})
|
|
1060849
|
+
}));
|
|
1060850
|
+
}
|
|
1060851
|
+
if (!isPlainObject(webhook.payload)) {
|
|
1060852
|
+
throw new Error(`Example webhook payload is not an object. Got: ${JSON.stringify(webhook.payload)}`);
|
|
1060853
|
+
}
|
|
1060854
|
+
return examples.map((example) => ({
|
|
1060855
|
+
docs: webhook.docs,
|
|
1060856
|
+
name: example.name != null ? file.casingsGenerator.generateName(example.name) : void 0,
|
|
1060857
|
+
payload: convertTypeReferenceExample({
|
|
1060858
|
+
example: example.payload,
|
|
1060859
|
+
rawTypeBeingExemplified: "map<string, unknown>",
|
|
1060860
|
+
fileContainingRawTypeReference: file,
|
|
1060861
|
+
fileContainingExample: file,
|
|
1060862
|
+
typeResolver,
|
|
1060863
|
+
exampleResolver,
|
|
1060864
|
+
workspace
|
|
1060865
|
+
})
|
|
1060866
|
+
}));
|
|
1060867
|
+
}
|
|
1060689
1060868
|
function isReferencedWebhookPayloadSchema2(payload) {
|
|
1060690
1060869
|
return payload.type != null;
|
|
1060691
1060870
|
}
|
|
@@ -1063156,7 +1063335,13 @@ async function generateIntermediateRepresentation({ workspace, generationLanguag
|
|
|
1063156
1063335
|
return;
|
|
1063157
1063336
|
}
|
|
1063158
1063337
|
const webhookGroupId = IdGenerator.generateWebhookGroupId(file.fernFilepath);
|
|
1063159
|
-
const convertedWebhookGroup = await convertWebhookGroup({
|
|
1063338
|
+
const convertedWebhookGroup = await convertWebhookGroup({
|
|
1063339
|
+
webhooks,
|
|
1063340
|
+
file,
|
|
1063341
|
+
typeResolver,
|
|
1063342
|
+
exampleResolver,
|
|
1063343
|
+
workspace
|
|
1063344
|
+
});
|
|
1063160
1063345
|
intermediateRepresentation.webhookGroups[webhookGroupId] = convertedWebhookGroup;
|
|
1063161
1063346
|
packageTreeGenerator.addWebhookGroup(webhookGroupId, file.fernFilepath);
|
|
1063162
1063347
|
},
|
|
@@ -1075457,7 +1075642,11 @@ function convertWebhookGroup2(webhookGroup) {
|
|
|
1075457
1075642
|
type: convertTypeReference(header.valueType)
|
|
1075458
1075643
|
})),
|
|
1075459
1075644
|
payload: convertWebhookPayload(webhook.payload),
|
|
1075460
|
-
examples:
|
|
1075645
|
+
examples: webhook.examples != null ? webhook.examples.map((example) => {
|
|
1075646
|
+
return {
|
|
1075647
|
+
payload: example.payload.jsonExample
|
|
1075648
|
+
};
|
|
1075649
|
+
}) : []
|
|
1075461
1075650
|
};
|
|
1075462
1075651
|
});
|
|
1075463
1075652
|
}
|