fern-api 0.29.3 → 0.29.5
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 +112 -16
- package/package.json +1 -1
package/bundle.cjs
CHANGED
|
@@ -363202,6 +363202,12 @@ var init_GlobalHeader = __esm({
|
|
|
363202
363202
|
}
|
|
363203
363203
|
});
|
|
363204
363204
|
|
|
363205
|
+
// pnp:/home/circleci/project/packages/cli/openapi-ir-sdk/lib/sdk/api/resources/finalIr/types/IdempotencyHeader.js
|
|
363206
|
+
var init_IdempotencyHeader = __esm({
|
|
363207
|
+
"pnp:/home/circleci/project/packages/cli/openapi-ir-sdk/lib/sdk/api/resources/finalIr/types/IdempotencyHeader.js"() {
|
|
363208
|
+
}
|
|
363209
|
+
});
|
|
363210
|
+
|
|
363205
363211
|
// pnp:/home/circleci/project/packages/cli/openapi-ir-sdk/lib/sdk/api/resources/finalIr/types/Tags.js
|
|
363206
363212
|
var init_Tags = __esm({
|
|
363207
363213
|
"pnp:/home/circleci/project/packages/cli/openapi-ir-sdk/lib/sdk/api/resources/finalIr/types/Tags.js"() {
|
|
@@ -364242,6 +364248,7 @@ var init_types28 = __esm({
|
|
|
364242
364248
|
init_OpenApiIntermediateRepresentation();
|
|
364243
364249
|
init_SdkGroupInfo();
|
|
364244
364250
|
init_GlobalHeader();
|
|
364251
|
+
init_IdempotencyHeader();
|
|
364245
364252
|
init_Tags();
|
|
364246
364253
|
init_HttpError();
|
|
364247
364254
|
init_Webhook3();
|
|
@@ -366990,7 +366997,8 @@ var init_OpenApiIntermediateRepresentation2 = __esm({
|
|
|
366990
366997
|
variables: schemas_exports5.record(schemas_exports5.string(), schemas_exports5.lazyObject(async () => (await Promise.resolve().then(() => (init_serialization3(), serialization_exports3))).PrimitiveSchema)),
|
|
366991
366998
|
nonRequestReferencedSchemas: schemas_exports5.set(schemas_exports5.lazy(async () => (await Promise.resolve().then(() => (init_serialization3(), serialization_exports3))).SchemaId)),
|
|
366992
366999
|
securitySchemes: schemas_exports5.record(schemas_exports5.lazy(async () => (await Promise.resolve().then(() => (init_serialization3(), serialization_exports3))).SecuritySchemeId), schemas_exports5.lazy(async () => (await Promise.resolve().then(() => (init_serialization3(), serialization_exports3))).SecurityScheme)),
|
|
366993
|
-
globalHeaders: schemas_exports5.list(schemas_exports5.lazyObject(async () => (await Promise.resolve().then(() => (init_serialization3(), serialization_exports3))).GlobalHeader)).optional()
|
|
367000
|
+
globalHeaders: schemas_exports5.list(schemas_exports5.lazyObject(async () => (await Promise.resolve().then(() => (init_serialization3(), serialization_exports3))).GlobalHeader)).optional(),
|
|
367001
|
+
idempotencyHeaders: schemas_exports5.list(schemas_exports5.lazyObject(async () => (await Promise.resolve().then(() => (init_serialization3(), serialization_exports3))).IdempotencyHeader)).optional()
|
|
366994
367002
|
});
|
|
366995
367003
|
}
|
|
366996
367004
|
});
|
|
@@ -367022,6 +367030,20 @@ var init_GlobalHeader2 = __esm({
|
|
|
367022
367030
|
}
|
|
367023
367031
|
});
|
|
367024
367032
|
|
|
367033
|
+
// pnp:/home/circleci/project/packages/cli/openapi-ir-sdk/lib/sdk/serialization/resources/finalIr/types/IdempotencyHeader.js
|
|
367034
|
+
var IdempotencyHeader;
|
|
367035
|
+
var init_IdempotencyHeader2 = __esm({
|
|
367036
|
+
"pnp:/home/circleci/project/packages/cli/openapi-ir-sdk/lib/sdk/serialization/resources/finalIr/types/IdempotencyHeader.js"() {
|
|
367037
|
+
init_core3();
|
|
367038
|
+
IdempotencyHeader = schemas_exports5.objectWithoutOptionalProperties({
|
|
367039
|
+
header: schemas_exports5.string(),
|
|
367040
|
+
name: schemas_exports5.string().optional(),
|
|
367041
|
+
env: schemas_exports5.string().optional(),
|
|
367042
|
+
schema: schemas_exports5.lazy(async () => (await Promise.resolve().then(() => (init_serialization3(), serialization_exports3))).Schema).optional()
|
|
367043
|
+
});
|
|
367044
|
+
}
|
|
367045
|
+
});
|
|
367046
|
+
|
|
367025
367047
|
// pnp:/home/circleci/project/packages/cli/openapi-ir-sdk/lib/sdk/serialization/resources/finalIr/types/Tags.js
|
|
367026
367048
|
var Tags;
|
|
367027
367049
|
var init_Tags2 = __esm({
|
|
@@ -367146,6 +367168,7 @@ var init_Endpoint2 = __esm({
|
|
|
367146
367168
|
Endpoint = schemas_exports5.objectWithoutOptionalProperties({
|
|
367147
367169
|
authed: schemas_exports5.boolean(),
|
|
367148
367170
|
internal: schemas_exports5.boolean().optional(),
|
|
367171
|
+
idempotent: schemas_exports5.boolean().optional(),
|
|
367149
367172
|
method: schemas_exports5.lazy(async () => (await Promise.resolve().then(() => (init_serialization3(), serialization_exports3))).HttpMethod),
|
|
367150
367173
|
availability: schemas_exports5.lazy(async () => (await Promise.resolve().then(() => (init_serialization3(), serialization_exports3))).EndpointAvailability).optional(),
|
|
367151
367174
|
audiences: schemas_exports5.list(schemas_exports5.string()),
|
|
@@ -368053,6 +368076,7 @@ var init_types32 = __esm({
|
|
|
368053
368076
|
init_OpenApiIntermediateRepresentation2();
|
|
368054
368077
|
init_SdkGroupInfo2();
|
|
368055
368078
|
init_GlobalHeader2();
|
|
368079
|
+
init_IdempotencyHeader2();
|
|
368056
368080
|
init_Tags2();
|
|
368057
368081
|
init_HttpError2();
|
|
368058
368082
|
init_Webhook4();
|
|
@@ -368149,6 +368173,7 @@ __export(finalIr_exports2, {
|
|
|
368149
368173
|
HeaderExample: () => HeaderExample,
|
|
368150
368174
|
HttpError: () => HttpError,
|
|
368151
368175
|
HttpMethod: () => HttpMethod6,
|
|
368176
|
+
IdempotencyHeader: () => IdempotencyHeader,
|
|
368152
368177
|
IntSchema: () => IntSchema,
|
|
368153
368178
|
JsonRequest: () => JsonRequest,
|
|
368154
368179
|
JsonResponse: () => JsonResponse3,
|
|
@@ -368229,6 +368254,7 @@ var init_EndpointWithExample2 = __esm({
|
|
|
368229
368254
|
EndpointWithExample = schemas_exports5.objectWithoutOptionalProperties({
|
|
368230
368255
|
authed: schemas_exports5.boolean(),
|
|
368231
368256
|
internal: schemas_exports5.boolean().optional(),
|
|
368257
|
+
idempotent: schemas_exports5.boolean().optional(),
|
|
368232
368258
|
method: schemas_exports5.lazy(async () => (await Promise.resolve().then(() => (init_serialization3(), serialization_exports3))).HttpMethod),
|
|
368233
368259
|
availability: schemas_exports5.lazy(async () => (await Promise.resolve().then(() => (init_serialization3(), serialization_exports3))).EndpointAvailability).optional(),
|
|
368234
368260
|
audiences: schemas_exports5.list(schemas_exports5.string()),
|
|
@@ -368934,6 +368960,7 @@ __export(serialization_exports3, {
|
|
|
368934
368960
|
HttpError: () => HttpError,
|
|
368935
368961
|
HttpErrorWithExample: () => HttpErrorWithExample,
|
|
368936
368962
|
HttpMethod: () => HttpMethod6,
|
|
368963
|
+
IdempotencyHeader: () => IdempotencyHeader,
|
|
368937
368964
|
Int64WithExample: () => Int64WithExample,
|
|
368938
368965
|
IntSchema: () => IntSchema,
|
|
368939
368966
|
IntWithExample: () => IntWithExample,
|
|
@@ -1012978,7 +1013005,7 @@ var AccessTokenPosthogManager = class {
|
|
|
1012978
1013005
|
properties: {
|
|
1012979
1013006
|
...event,
|
|
1012980
1013007
|
...event.properties,
|
|
1012981
|
-
version: "0.29.
|
|
1013008
|
+
version: "0.29.5",
|
|
1012982
1013009
|
usingAccessToken: true
|
|
1012983
1013010
|
}
|
|
1012984
1013011
|
});
|
|
@@ -1013040,7 +1013067,7 @@ var UserPosthogManager = class {
|
|
|
1013040
1013067
|
distinctId: this.userId ?? await this.getPersistedDistinctId(),
|
|
1013041
1013068
|
event: "CLI",
|
|
1013042
1013069
|
properties: {
|
|
1013043
|
-
version: "0.29.
|
|
1013070
|
+
version: "0.29.5",
|
|
1013044
1013071
|
...event,
|
|
1013045
1013072
|
...event.properties
|
|
1013046
1013073
|
}
|
|
@@ -1018243,6 +1018270,8 @@ var FernOpenAPIExtension = {
|
|
|
1018243
1018270
|
FERN_HEADER_AUTH: "x-fern-header",
|
|
1018244
1018271
|
FERN_BASIC_AUTH: "x-fern-basic",
|
|
1018245
1018272
|
FERN_GLOBAL_HEADERS: "x-fern-global-headers",
|
|
1018273
|
+
FERN_IDEMPOTENCY_HEADERS: "x-fern-idempotency-headers",
|
|
1018274
|
+
IDEMPOTENT: "x-fern-idempotent",
|
|
1018246
1018275
|
FERN_PROPERTY_NAME: "x-fern-property-name"
|
|
1018247
1018276
|
};
|
|
1018248
1018277
|
|
|
@@ -1020090,9 +1020119,11 @@ function convertSchemaObject(schema2, wrapAsNullable, context, breadcrumbs, prop
|
|
|
1020090
1020119
|
const [firstSchema, secondSchema] = schema2.anyOf;
|
|
1020091
1020120
|
if (firstSchema != null && secondSchema != null) {
|
|
1020092
1020121
|
if (!isReferenceObject(firstSchema) && firstSchema.type === "null") {
|
|
1020093
|
-
|
|
1020122
|
+
const convertedSchema = convertSchema(secondSchema, true, context, breadcrumbs);
|
|
1020123
|
+
return maybeInjectDescriptionOrGroupName(convertedSchema, description, groupName);
|
|
1020094
1020124
|
} else if (!isReferenceObject(secondSchema) && secondSchema.type === "null") {
|
|
1020095
|
-
|
|
1020125
|
+
const convertedSchema = convertSchema(firstSchema, true, context, breadcrumbs);
|
|
1020126
|
+
return maybeInjectDescriptionOrGroupName(convertedSchema, description, groupName);
|
|
1020096
1020127
|
}
|
|
1020097
1020128
|
}
|
|
1020098
1020129
|
}
|
|
@@ -1020244,23 +1020275,19 @@ function maybeInjectDescriptionOrGroupName(schema2, description, groupName) {
|
|
|
1020244
1020275
|
description,
|
|
1020245
1020276
|
groupName
|
|
1020246
1020277
|
});
|
|
1020247
|
-
} else if (schema2.type === "optional"
|
|
1020278
|
+
} else if (schema2.type === "optional") {
|
|
1020248
1020279
|
return SchemaWithExample.optional({
|
|
1020249
1020280
|
nameOverride: schema2.nameOverride,
|
|
1020250
1020281
|
generatedName: schema2.generatedName,
|
|
1020251
|
-
value:
|
|
1020252
|
-
...schema2.value
|
|
1020253
|
-
}),
|
|
1020282
|
+
value: schema2.value,
|
|
1020254
1020283
|
description,
|
|
1020255
1020284
|
groupName
|
|
1020256
1020285
|
});
|
|
1020257
|
-
} else if (schema2.type === "nullable"
|
|
1020286
|
+
} else if (schema2.type === "nullable") {
|
|
1020258
1020287
|
return SchemaWithExample.nullable({
|
|
1020259
1020288
|
nameOverride: schema2.nameOverride,
|
|
1020260
1020289
|
generatedName: schema2.generatedName,
|
|
1020261
|
-
value:
|
|
1020262
|
-
...schema2.value
|
|
1020263
|
-
}),
|
|
1020290
|
+
value: schema2.value,
|
|
1020264
1020291
|
description,
|
|
1020265
1020292
|
groupName
|
|
1020266
1020293
|
});
|
|
@@ -1023142,6 +1023169,7 @@ function markErrorSchemas({ responses, context }) {
|
|
|
1023142
1023169
|
// pnp:/home/circleci/project/packages/cli/openapi-parser/lib/openapi/v3/converters/operation/convertHttpOperation.js
|
|
1023143
1023170
|
function convertHttpOperation({ operationContext, context, responseStatusCode, suffix, streamFormat }) {
|
|
1023144
1023171
|
const { document: document6, operation, path: path42, method: method2, baseBreadcrumbs, sdkMethodName } = operationContext;
|
|
1023172
|
+
const idempotent = getExtension(operation, FernOpenAPIExtension.IDEMPOTENT);
|
|
1023145
1023173
|
const requestNameOverride = getExtension(operation, [
|
|
1023146
1023174
|
FernOpenAPIExtension.REQUEST_NAME_V1,
|
|
1023147
1023175
|
FernOpenAPIExtension.REQUEST_NAME_V2
|
|
@@ -1023192,6 +1023220,7 @@ function convertHttpOperation({ operationContext, context, responseStatusCode, s
|
|
|
1023192
1023220
|
return {
|
|
1023193
1023221
|
summary: operation.summary,
|
|
1023194
1023222
|
internal: getExtension(operation, OpenAPIExtension.INTERNAL),
|
|
1023223
|
+
idempotent,
|
|
1023195
1023224
|
audiences: getExtension(operation, FernOpenAPIExtension.AUDIENCES) ?? [],
|
|
1023196
1023225
|
operationId: operation.operationId != null && suffix != null ? operation.operationId + "_" + suffix : operation.operationId,
|
|
1023197
1023226
|
tags: operation.tags ?? [],
|
|
@@ -1023766,6 +1023795,25 @@ function getGlobalHeaders(document6) {
|
|
|
1023766
1023795
|
return result2;
|
|
1023767
1023796
|
}
|
|
1023768
1023797
|
|
|
1023798
|
+
// pnp:/home/circleci/project/packages/cli/openapi-parser/lib/openapi/v3/extensions/getIdempotencyHeaders.js
|
|
1023799
|
+
function getIdempotencyHeaders(document6) {
|
|
1023800
|
+
const idempotencyHeaders = getExtension(document6, FernOpenAPIExtension.FERN_IDEMPOTENCY_HEADERS);
|
|
1023801
|
+
const result2 = [];
|
|
1023802
|
+
for (const header of idempotencyHeaders ?? []) {
|
|
1023803
|
+
result2.push({
|
|
1023804
|
+
...header,
|
|
1023805
|
+
schema: header.type != null ? getSchemaFromFernType({
|
|
1023806
|
+
fernType: header.type,
|
|
1023807
|
+
description: void 0,
|
|
1023808
|
+
generatedName: header.name ?? header.header,
|
|
1023809
|
+
groupName: void 0,
|
|
1023810
|
+
nameOverride: void 0
|
|
1023811
|
+
}) : void 0
|
|
1023812
|
+
});
|
|
1023813
|
+
}
|
|
1023814
|
+
return result2;
|
|
1023815
|
+
}
|
|
1023816
|
+
|
|
1023769
1023817
|
// pnp:/home/circleci/project/packages/cli/openapi-parser/lib/openapi/v3/extensions/getVariableDefinitions.js
|
|
1023770
1023818
|
function getVariableDefinitions(document6) {
|
|
1023771
1023819
|
const variables = getExtension(document6, FernOpenAPIExtension.SDK_VARIABLES);
|
|
@@ -1023949,6 +1023997,7 @@ function generateIr({ openApi, taskContext, disableExamples, audiences, shouldUs
|
|
|
1023949
1023997
|
const context = new OpenAPIV3ParserContext({ document: openApi, taskContext, authHeaders, shouldUseTitleAsName });
|
|
1023950
1023998
|
const variables = getVariableDefinitions(openApi);
|
|
1023951
1023999
|
const globalHeaders = getGlobalHeaders(openApi);
|
|
1024000
|
+
const idempotencyHeaders = getIdempotencyHeaders(openApi);
|
|
1023952
1024001
|
const endpointsWithExample = [];
|
|
1023953
1024002
|
const webhooks = [];
|
|
1023954
1024003
|
Object.entries(openApi.paths).forEach(([path42, pathItem]) => {
|
|
@@ -1024110,7 +1024159,8 @@ function generateIr({ openApi, taskContext, disableExamples, audiences, shouldUs
|
|
|
1024110
1024159
|
hasEndpointsMarkedInternal: endpoints.some((endpoint) => endpoint.internal),
|
|
1024111
1024160
|
nonRequestReferencedSchemas: context.getReferencedSchemas(),
|
|
1024112
1024161
|
variables,
|
|
1024113
|
-
globalHeaders
|
|
1024162
|
+
globalHeaders,
|
|
1024163
|
+
idempotencyHeaders
|
|
1024114
1024164
|
};
|
|
1024115
1024165
|
return ir;
|
|
1024116
1024166
|
}
|
|
@@ -1024224,6 +1024274,7 @@ async function parse3({ workspace, taskContext }) {
|
|
|
1024224
1024274
|
nonRequestReferencedSchemas: /* @__PURE__ */ new Set(),
|
|
1024225
1024275
|
securitySchemes: {},
|
|
1024226
1024276
|
globalHeaders: [],
|
|
1024277
|
+
idempotencyHeaders: [],
|
|
1024227
1024278
|
groups: {}
|
|
1024228
1024279
|
};
|
|
1024229
1024280
|
for (const spec of workspace.specs) {
|
|
@@ -1024310,6 +1024361,7 @@ function merge3(ir1, ir2) {
|
|
|
1024310
1024361
|
...ir2.securitySchemes
|
|
1024311
1024362
|
},
|
|
1024312
1024363
|
globalHeaders: ir1.globalHeaders != null ? [...ir1.globalHeaders, ...ir2.globalHeaders ?? []] : void 0,
|
|
1024364
|
+
idempotencyHeaders: ir1.idempotencyHeaders != null ? [...ir1.idempotencyHeaders, ...ir2.idempotencyHeaders ?? []] : void 0,
|
|
1024313
1024365
|
groups: {
|
|
1024314
1024366
|
...ir1.groups,
|
|
1024315
1024367
|
...ir2.groups
|
|
@@ -1024921,6 +1024973,40 @@ function buildGlobalHeaders(context) {
|
|
|
1024921
1024973
|
}
|
|
1024922
1024974
|
}
|
|
1024923
1024975
|
|
|
1024976
|
+
// pnp:/home/circleci/project/packages/cli/openapi-ir-to-fern/lib/buildIdempotencyHeaders.js
|
|
1024977
|
+
var STRING_SCHEMA = Schema2.primitive({
|
|
1024978
|
+
description: void 0,
|
|
1024979
|
+
generatedName: "",
|
|
1024980
|
+
groupName: void 0,
|
|
1024981
|
+
nameOverride: void 0,
|
|
1024982
|
+
schema: PrimitiveSchemaValue.string({
|
|
1024983
|
+
default: void 0,
|
|
1024984
|
+
pattern: void 0,
|
|
1024985
|
+
format: void 0,
|
|
1024986
|
+
minLength: void 0,
|
|
1024987
|
+
maxLength: void 0
|
|
1024988
|
+
})
|
|
1024989
|
+
});
|
|
1024990
|
+
function buildIdempotencyHeaders(context) {
|
|
1024991
|
+
for (const header of context.ir.idempotencyHeaders ?? []) {
|
|
1024992
|
+
const convertedHeader = buildHeader({
|
|
1024993
|
+
header: {
|
|
1024994
|
+
...header,
|
|
1024995
|
+
schema: header.schema ?? STRING_SCHEMA,
|
|
1024996
|
+
name: header.name ?? header.header,
|
|
1024997
|
+
parameterNameOverride: void 0,
|
|
1024998
|
+
description: void 0
|
|
1024999
|
+
},
|
|
1025000
|
+
fileContainingReference: RelativeFilePath.of(ROOT_API_FILENAME),
|
|
1025001
|
+
context
|
|
1025002
|
+
});
|
|
1025003
|
+
context.builder.addIdempotencyHeader({
|
|
1025004
|
+
name: header.header,
|
|
1025005
|
+
schema: wrapTypeReferenceAsOptional(convertedHeader)
|
|
1025006
|
+
});
|
|
1025007
|
+
}
|
|
1025008
|
+
}
|
|
1025009
|
+
|
|
1024924
1025010
|
// pnp:/home/circleci/project/packages/cli/openapi-ir-to-fern/lib/buildEndpointExample.js
|
|
1024925
1025011
|
function buildEndpointExample({ endpointExample, context }) {
|
|
1024926
1025012
|
const example = {};
|
|
@@ -1025279,6 +1025365,9 @@ function buildEndpoint({ endpoint, declarationFile, context }) {
|
|
|
1025279
1025365
|
convertedEndpoint.url = serverOverride.name ?? void 0;
|
|
1025280
1025366
|
}
|
|
1025281
1025367
|
}
|
|
1025368
|
+
if (endpoint.idempotent) {
|
|
1025369
|
+
convertedEndpoint.idempotent = true;
|
|
1025370
|
+
}
|
|
1025282
1025371
|
if (endpoint.availability === EndpointAvailability.Beta) {
|
|
1025283
1025372
|
convertedEndpoint.availability = "pre-release";
|
|
1025284
1025373
|
} else if (endpoint.availability === EndpointAvailability.GenerallyAvailable) {
|
|
@@ -1025782,6 +1025871,7 @@ var ERROR_DECLARATIONS_FILENAME = RelativeFilePath.of(FERN_PACKAGE_MARKER_FILENA
|
|
|
1025782
1025871
|
function buildFernDefinition(context) {
|
|
1025783
1025872
|
buildEnvironments(context);
|
|
1025784
1025873
|
buildGlobalHeaders(context);
|
|
1025874
|
+
buildIdempotencyHeaders(context);
|
|
1025785
1025875
|
buildAuthSchemes(context);
|
|
1025786
1025876
|
buildVariables(context);
|
|
1025787
1025877
|
if (context.ir.basePath != null) {
|
|
@@ -1025913,6 +1026003,12 @@ var FernDefinitionBuilderImpl = class {
|
|
|
1025913
1026003
|
}
|
|
1025914
1026004
|
this.rootApiFile.headers[name2] = schema2;
|
|
1025915
1026005
|
}
|
|
1026006
|
+
addIdempotencyHeader({ name: name2, schema: schema2 }) {
|
|
1026007
|
+
if (this.rootApiFile["idempotency-headers"] == null) {
|
|
1026008
|
+
this.rootApiFile["idempotency-headers"] = {};
|
|
1026009
|
+
}
|
|
1026010
|
+
this.rootApiFile["idempotency-headers"][name2] = schema2;
|
|
1026011
|
+
}
|
|
1025916
1026012
|
addVariable({ name: name2, schema: schema2 }) {
|
|
1025917
1026013
|
if (this.rootApiFile.variables == null) {
|
|
1025918
1026014
|
this.rootApiFile.variables = {};
|
|
@@ -1030395,10 +1030491,10 @@ var CliContext = class {
|
|
|
1030395
1030491
|
return "fern-api";
|
|
1030396
1030492
|
}
|
|
1030397
1030493
|
getPackageVersion() {
|
|
1030398
|
-
if ("0.29.
|
|
1030494
|
+
if ("0.29.5" == null) {
|
|
1030399
1030495
|
this.logger.error("CLI_VERSION is not defined");
|
|
1030400
1030496
|
}
|
|
1030401
|
-
return "0.29.
|
|
1030497
|
+
return "0.29.5";
|
|
1030402
1030498
|
}
|
|
1030403
1030499
|
getCliName() {
|
|
1030404
1030500
|
if ("fern" == null) {
|