@fern-api/fern-api-dev 5.50.2 → 5.50.3
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/cli.cjs +516 -182
- package/package.json +1 -1
package/cli.cjs
CHANGED
|
@@ -685536,7 +685536,7 @@ var AccessTokenPosthogManager = class {
|
|
|
685536
685536
|
properties: {
|
|
685537
685537
|
...event,
|
|
685538
685538
|
...event.properties,
|
|
685539
|
-
version: "5.50.
|
|
685539
|
+
version: "5.50.3",
|
|
685540
685540
|
usingAccessToken: true,
|
|
685541
685541
|
...getRunIdProperties()
|
|
685542
685542
|
}
|
|
@@ -685602,7 +685602,7 @@ var UserPosthogManager = class {
|
|
|
685602
685602
|
distinctId: this.userId ?? await this.getPersistedDistinctId(),
|
|
685603
685603
|
event: "CLI",
|
|
685604
685604
|
properties: {
|
|
685605
|
-
version: "5.50.
|
|
685605
|
+
version: "5.50.3",
|
|
685606
685606
|
...event,
|
|
685607
685607
|
...event.properties,
|
|
685608
685608
|
usingAccessToken: false,
|
|
@@ -866664,7 +866664,7 @@ var LOCAL_STORAGE_FOLDER4 = ".fern-dev";
|
|
|
866664
866664
|
var LOGS_FOLDER_NAME = "logs";
|
|
866665
866665
|
var MAX_LOGS_DIR_SIZE_BYTES = 100 * 1024 * 1024;
|
|
866666
866666
|
function getCliSource() {
|
|
866667
|
-
const version7 = "5.50.
|
|
866667
|
+
const version7 = "5.50.3";
|
|
866668
866668
|
return `cli@${version7}`;
|
|
866669
866669
|
}
|
|
866670
866670
|
var DebugLogger = class {
|
|
@@ -897373,8 +897373,6 @@ async function buildAllTranslationInputs({ docsDefinition, git, apiDefinitions,
|
|
|
897373
897373
|
|
|
897374
897374
|
// ../generation/remote-generation/remote-workspace-runner/lib/publishDocsLedgerPreview.js
|
|
897375
897375
|
init_orpc_client();
|
|
897376
|
-
init_buildTranslatedDocsDefinition();
|
|
897377
|
-
var TRANSLATION_BUILD_CONCURRENCY2 = 4;
|
|
897378
897376
|
async function publishDocsViaLedgerPreview({ docsDefinition, organization, basePath, previewId, git, token, fdrOrigin, headers: headers2, context: context3, apiDefinitions, fileManifest, filePaths, fileIdToPath, resolver: resolver2 }) {
|
|
897379
897377
|
const { localeEntry: baseLocale, blobs } = buildLedgerInput({
|
|
897380
897378
|
docsDefinition,
|
|
@@ -897383,28 +897381,21 @@ async function publishDocsViaLedgerPreview({ docsDefinition, organization, baseP
|
|
|
897383
897381
|
fileManifest,
|
|
897384
897382
|
fileIdToPath
|
|
897385
897383
|
});
|
|
897386
|
-
const
|
|
897384
|
+
const builtTranslations = await buildAllTranslationInputs({
|
|
897387
897385
|
docsDefinition,
|
|
897386
|
+
git,
|
|
897387
|
+
apiDefinitions,
|
|
897388
|
+
fileManifest,
|
|
897389
|
+
fileIdToPath,
|
|
897388
897390
|
resolver: resolver2,
|
|
897389
897391
|
context: context3
|
|
897390
897392
|
});
|
|
897391
|
-
const
|
|
897392
|
-
const { localeEntry, blobs: translationBlobs } = buildLedgerInput({
|
|
897393
|
-
docsDefinition: t3.translatedDefinition,
|
|
897394
|
-
git,
|
|
897395
|
-
apiDefinitions,
|
|
897396
|
-
fileManifest,
|
|
897397
|
-
fileIdToPath,
|
|
897398
|
-
locale: t3.locale
|
|
897399
|
-
});
|
|
897400
|
-
return { ...t3, localeEntry, blobs: translationBlobs };
|
|
897401
|
-
});
|
|
897402
|
-
for (const t3 of translationInputs) {
|
|
897393
|
+
for (const t3 of builtTranslations) {
|
|
897403
897394
|
for (const [hash5, buf] of t3.blobs) {
|
|
897404
897395
|
blobs.set(hash5, buf);
|
|
897405
897396
|
}
|
|
897406
897397
|
}
|
|
897407
|
-
const locales = [baseLocale, ...
|
|
897398
|
+
const locales = [baseLocale, ...builtTranslations.map((t3) => t3.localeEntry)];
|
|
897408
897399
|
const client3 = createDocsLedgerClient2({ baseUrl: fdrOrigin, token, headers: headers2 });
|
|
897409
897400
|
context3.logger.debug("[ledger-preview] Registering preview deployment...");
|
|
897410
897401
|
const registerStart = performance.now();
|
|
@@ -897428,12 +897419,7 @@ async function publishDocsViaLedgerPreview({ docsDefinition, organization, baseP
|
|
|
897428
897419
|
repo: baseLocale.repo,
|
|
897429
897420
|
git
|
|
897430
897421
|
};
|
|
897431
|
-
const registerResult = await
|
|
897432
|
-
fdrOrigin,
|
|
897433
|
-
token,
|
|
897434
|
-
headers: headers2,
|
|
897435
|
-
input: previewRegisterInput
|
|
897436
|
-
});
|
|
897422
|
+
const registerResult = await client3.previewRegister(previewRegisterInput);
|
|
897437
897423
|
const registerTime = performance.now() - registerStart;
|
|
897438
897424
|
context3.logger.debug(`[ledger-preview] Registered in ${registerTime.toFixed(0)}ms \u2014 hash=${registerResult.deploymentHash}, preview=${registerResult.previewUrl}, missing=${registerResult.missingContent.length} blobs`);
|
|
897439
897425
|
await uploadMissingBlobs(registerResult.missingContent, blobs, context3, filePaths);
|
|
@@ -897460,45 +897446,6 @@ async function publishDocsViaLedgerPreview({ docsDefinition, organization, baseP
|
|
|
897460
897446
|
deploymentId: finishResult.deploymentId
|
|
897461
897447
|
};
|
|
897462
897448
|
}
|
|
897463
|
-
async function buildAllTranslationDefinitions({ docsDefinition, resolver: resolver2, context: context3 }) {
|
|
897464
|
-
if (resolver2 == null) {
|
|
897465
|
-
return [];
|
|
897466
|
-
}
|
|
897467
|
-
const translationPages = resolver2.getTranslationPages();
|
|
897468
|
-
const translationNavigationOverlays = resolver2.getTranslationNavigationOverlays();
|
|
897469
|
-
if (translationPages == null || Object.keys(translationPages).length === 0) {
|
|
897470
|
-
return [];
|
|
897471
|
-
}
|
|
897472
|
-
const localeEntries = Object.entries(translationPages);
|
|
897473
|
-
context3.logger.info(`[ledger-preview] Building ${localeEntries.length} translation locale(s)...`);
|
|
897474
|
-
return asyncPool2(TRANSLATION_BUILD_CONCURRENCY2, localeEntries, async ([locale, localePages]) => {
|
|
897475
|
-
const translatedDefinition = await buildTranslatedDocsDefinition({
|
|
897476
|
-
docsDefinition,
|
|
897477
|
-
locale,
|
|
897478
|
-
localePages,
|
|
897479
|
-
translationNavigationOverlays,
|
|
897480
|
-
resolver: resolver2,
|
|
897481
|
-
context: context3
|
|
897482
|
-
});
|
|
897483
|
-
return { locale, localePages, translatedDefinition };
|
|
897484
|
-
});
|
|
897485
|
-
}
|
|
897486
|
-
async function previewRegisterWithLocales({ fdrOrigin, token, headers: headers2, input: input3 }) {
|
|
897487
|
-
const response = await fetch(`${fdrOrigin.replace(/\/+$/, "")}/docs-ledger/preview/init`, {
|
|
897488
|
-
method: "POST",
|
|
897489
|
-
headers: {
|
|
897490
|
-
"Content-Type": "application/json",
|
|
897491
|
-
Authorization: `Bearer ${token}`,
|
|
897492
|
-
...headers2
|
|
897493
|
-
},
|
|
897494
|
-
body: JSON.stringify(input3)
|
|
897495
|
-
});
|
|
897496
|
-
if (!response.ok) {
|
|
897497
|
-
const body = await response.text();
|
|
897498
|
-
throw new Error(`[ledger-preview] Preview register failed: HTTP ${response.status}: ${body}`);
|
|
897499
|
-
}
|
|
897500
|
-
return await response.json();
|
|
897501
|
-
}
|
|
897502
897449
|
|
|
897503
897450
|
// ../generation/remote-generation/remote-workspace-runner/lib/retryWithBackoff.js
|
|
897504
897451
|
async function retryWithBackoff({ fn: fn2, maxRetries, baseDelayMs, jitterFactor = 0, isRetryable = () => true, logger: logger4, label, delayFn = (ms2) => new Promise((resolve15) => setTimeout(resolve15, ms2)) }) {
|
|
@@ -898891,7 +898838,7 @@ var LegacyDocsPublisher = class {
|
|
|
898891
898838
|
previewId,
|
|
898892
898839
|
disableTemplates: void 0,
|
|
898893
898840
|
skipUpload,
|
|
898894
|
-
cliVersion: "5.50.
|
|
898841
|
+
cliVersion: "5.50.3",
|
|
898895
898842
|
loginCommand: "fern auth login"
|
|
898896
898843
|
});
|
|
898897
898844
|
if (taskContext.getResult() === TaskResult.Failure) {
|
|
@@ -920485,6 +920432,7 @@ var DynamicSnippetsGeneratorContext = class _DynamicSnippetsGeneratorContext ext
|
|
|
920485
920432
|
// ../../../generators/csharp/dynamic-snippets/lib/EndpointSnippetGenerator.js
|
|
920486
920433
|
init_lib4();
|
|
920487
920434
|
init_lodash();
|
|
920435
|
+
var REQUEST_PARAMETER_NAME = "request";
|
|
920488
920436
|
var EndpointSnippetGenerator = class extends WithGeneration {
|
|
920489
920437
|
context;
|
|
920490
920438
|
constructor({ context: context3 }) {
|
|
@@ -920861,33 +920809,31 @@ var EndpointSnippetGenerator = class extends WithGeneration {
|
|
|
920861
920809
|
}
|
|
920862
920810
|
}
|
|
920863
920811
|
getMethodArgsForInlinedRequest({ request: request7, snippet }) {
|
|
920864
|
-
const args = [];
|
|
920865
920812
|
this.context.errors.scope(Scope4.PathParameters);
|
|
920866
|
-
const pathParameterFields = [];
|
|
920867
920813
|
const pathParameters = [...this.context.ir.pathParameters ?? [], ...request7.pathParameters ?? []];
|
|
920868
|
-
|
|
920869
|
-
|
|
920870
|
-
|
|
920814
|
+
const includePathParameters = this.context.includePathParametersInWrappedRequest({
|
|
920815
|
+
request: request7,
|
|
920816
|
+
inlinePathParameters: this.settings.shouldInlinePathParameters
|
|
920817
|
+
});
|
|
920818
|
+
const pathParameterFields = includePathParameters ? this.getPathParameters({ namedParameters: pathParameters, snippet }) : [];
|
|
920819
|
+
const separatePathParameterArgs = includePathParameters ? [] : this.getPathParameterArguments({ namedParameters: pathParameters, snippet });
|
|
920871
920820
|
this.context.errors.unscope();
|
|
920872
920821
|
this.context.errors.scope(Scope4.RequestBody);
|
|
920873
920822
|
const filePropertyInfo = this.getFilePropertyInfo({ request: request7, snippet });
|
|
920874
920823
|
this.context.errors.unscope();
|
|
920875
|
-
|
|
920876
|
-
request: request7,
|
|
920877
|
-
inlinePathParameters: this.settings.shouldInlinePathParameters
|
|
920878
|
-
})) {
|
|
920879
|
-
args.push(...pathParameterFields.map((field5) => field5.value));
|
|
920880
|
-
}
|
|
920881
|
-
args.push(this.getInlinedRequestArg({
|
|
920824
|
+
const requestArg = this.getInlinedRequestArg({
|
|
920882
920825
|
request: request7,
|
|
920883
920826
|
snippet,
|
|
920884
|
-
pathParameterFields
|
|
920885
|
-
request: request7,
|
|
920886
|
-
inlinePathParameters: this.settings.shouldInlinePathParameters
|
|
920887
|
-
}) ? pathParameterFields : [],
|
|
920827
|
+
pathParameterFields,
|
|
920888
920828
|
filePropertyInfo
|
|
920889
|
-
})
|
|
920890
|
-
|
|
920829
|
+
});
|
|
920830
|
+
if (separatePathParameterArgs.length > 0) {
|
|
920831
|
+
return [
|
|
920832
|
+
...separatePathParameterArgs.map((arg) => this.namedArgument({ name: arg.name, value: arg.value })),
|
|
920833
|
+
this.namedArgument({ name: REQUEST_PARAMETER_NAME, value: requestArg })
|
|
920834
|
+
];
|
|
920835
|
+
}
|
|
920836
|
+
return [requestArg];
|
|
920891
920837
|
}
|
|
920892
920838
|
getFilePropertyInfo({ request: request7, snippet }) {
|
|
920893
920839
|
if (request7.body == null || !this.context.isFileUploadRequestBody(request7.body)) {
|
|
@@ -920999,20 +920945,44 @@ var EndpointSnippetGenerator = class extends WithGeneration {
|
|
|
920999
920945
|
}
|
|
921000
920946
|
}
|
|
921001
920947
|
getMethodArgsForBodyRequest({ request: request7, snippet }) {
|
|
921002
|
-
const args = [];
|
|
921003
920948
|
this.context.errors.scope(Scope4.PathParameters);
|
|
921004
920949
|
const pathParameters = [...this.context.ir.pathParameters ?? [], ...request7.pathParameters ?? []];
|
|
921005
|
-
|
|
921006
|
-
args.push(...this.getPathParameters({ namedParameters: pathParameters, snippet }).map((field5) => field5.value));
|
|
921007
|
-
}
|
|
920950
|
+
const pathParameterArgs = this.getPathParameterArguments({ namedParameters: pathParameters, snippet });
|
|
921008
920951
|
this.context.errors.unscope();
|
|
921009
920952
|
this.context.errors.scope(Scope4.RequestBody);
|
|
921010
|
-
|
|
921011
|
-
args.push(this.getBodyRequestArg({ body: request7.body, value: snippet.requestBody }));
|
|
921012
|
-
}
|
|
920953
|
+
const bodyArg = request7.body != null ? this.getBodyRequestArg({ body: request7.body, value: snippet.requestBody }) : void 0;
|
|
921013
920954
|
this.context.errors.unscope();
|
|
920955
|
+
if (pathParameterArgs.length > 0 && bodyArg != null) {
|
|
920956
|
+
return [
|
|
920957
|
+
...pathParameterArgs.map((arg) => this.namedArgument({ name: arg.name, value: arg.value })),
|
|
920958
|
+
this.namedArgument({ name: REQUEST_PARAMETER_NAME, value: bodyArg })
|
|
920959
|
+
];
|
|
920960
|
+
}
|
|
920961
|
+
const args = pathParameterArgs.map((arg) => arg.value);
|
|
920962
|
+
if (bodyArg != null) {
|
|
920963
|
+
args.push(bodyArg);
|
|
920964
|
+
}
|
|
921014
920965
|
return args;
|
|
921015
920966
|
}
|
|
920967
|
+
getPathParameterArguments({ namedParameters, snippet }) {
|
|
920968
|
+
const pathParameters = this.context.associateByWireValueOrDefault({
|
|
920969
|
+
parameters: namedParameters,
|
|
920970
|
+
values: snippet.pathParameters ?? {}
|
|
920971
|
+
});
|
|
920972
|
+
return pathParameters.map((parameter6) => ({
|
|
920973
|
+
name: this.context.getParameterName(parameter6.name.name),
|
|
920974
|
+
value: this.context.dynamicLiteralMapper.convert({
|
|
920975
|
+
...parameter6,
|
|
920976
|
+
fallbackToDefault: parameter6.name.wireValue
|
|
920977
|
+
})
|
|
920978
|
+
}));
|
|
920979
|
+
}
|
|
920980
|
+
namedArgument({ name: name2, value: value2 }) {
|
|
920981
|
+
return this.csharp.codeblock((writer2) => {
|
|
920982
|
+
writer2.write(`${name2}: `);
|
|
920983
|
+
writer2.writeNode(value2);
|
|
920984
|
+
});
|
|
920985
|
+
}
|
|
921016
920986
|
getBodyRequestArg({ body, value: value2 }) {
|
|
921017
920987
|
switch (body.type) {
|
|
921018
920988
|
case "bytes": {
|
|
@@ -924875,7 +924845,13 @@ var BaseJavaCustomConfigSchema = external_exports2.object({
|
|
|
924875
924845
|
"enable-extensible-builders": external_exports2.boolean().optional(),
|
|
924876
924846
|
"use-default-request-parameter-values": external_exports2.boolean().optional(),
|
|
924877
924847
|
"enable-wire-tests": external_exports2.boolean().default(false),
|
|
924848
|
+
// Nullable/optional representation options (mutually exclusive):
|
|
924849
|
+
// collapse-optional-nullable: optional<nullable<T>> (and standalone nullable<T>) collapses to
|
|
924850
|
+
// a single OptionalNullable<T> wrapper.
|
|
924851
|
+
// use-nullable-annotation: nullable<T> is emitted as the raw type T annotated with @Nullable
|
|
924852
|
+
// (no Optional wrapper). Mirrors v1 behaviour when the Java @Nullable annotation is preferred.
|
|
924878
924853
|
"collapse-optional-nullable": external_exports2.boolean().optional(),
|
|
924854
|
+
"use-nullable-annotation": external_exports2.boolean().optional(),
|
|
924879
924855
|
"custom-readme-sections": external_exports2.array(CustomReadmeSectionSchema).optional(),
|
|
924880
924856
|
"custom-pager-name": external_exports2.string().optional(),
|
|
924881
924857
|
"offset-semantics": external_exports2.enum(["item-index", "page-index"]).optional(),
|
|
@@ -924994,19 +924970,23 @@ var ClassReference2 = class extends AstNode3 {
|
|
|
924994
924970
|
name;
|
|
924995
924971
|
packageName;
|
|
924996
924972
|
fullyQualified;
|
|
924997
|
-
|
|
924973
|
+
enclosingClasses;
|
|
924974
|
+
constructor({ name: name2, packageName, fullyQualified, enclosingClasses }) {
|
|
924998
924975
|
super();
|
|
924999
924976
|
this.name = name2;
|
|
925000
924977
|
this.packageName = packageName;
|
|
925001
924978
|
this.fullyQualified = fullyQualified ?? false;
|
|
924979
|
+
this.enclosingClasses = enclosingClasses ?? [];
|
|
925002
924980
|
}
|
|
925003
924981
|
write(writer2) {
|
|
925004
|
-
|
|
924982
|
+
const topLevelClassName = this.enclosingClasses[0] ?? this.name;
|
|
924983
|
+
const qualifiedName = [...this.enclosingClasses, this.name].join(".");
|
|
924984
|
+
writer2.addImport(`${this.packageName}.${topLevelClassName}`);
|
|
925005
924985
|
if (this.fullyQualified) {
|
|
925006
|
-
writer2.write(`${this.packageName}.${
|
|
924986
|
+
writer2.write(`${this.packageName}.${qualifiedName}`);
|
|
925007
924987
|
return;
|
|
925008
924988
|
}
|
|
925009
|
-
writer2.write(
|
|
924989
|
+
writer2.write(qualifiedName);
|
|
925010
924990
|
}
|
|
925011
924991
|
};
|
|
925012
924992
|
|
|
@@ -925619,7 +925599,7 @@ var TypeLiteral = class _TypeLiteral extends AstNode3 {
|
|
|
925619
925599
|
writer2.write(".build()");
|
|
925620
925600
|
}
|
|
925621
925601
|
orderBuilderParameters(parameters2) {
|
|
925622
|
-
const hasRequiredFields = parameters2.some((p6) =>
|
|
925602
|
+
const hasRequiredFields = parameters2.some((p6) => this.isRequiredBuilderParameter(p6));
|
|
925623
925603
|
if (!hasRequiredFields) {
|
|
925624
925604
|
return parameters2.sort((a3, b5) => {
|
|
925625
925605
|
const aIsOptional = a3.value.isOptional();
|
|
@@ -925634,8 +925614,8 @@ var TypeLiteral = class _TypeLiteral extends AstNode3 {
|
|
|
925634
925614
|
});
|
|
925635
925615
|
}
|
|
925636
925616
|
return parameters2.sort((a3, b5) => {
|
|
925637
|
-
const aIsNonRequired = this.
|
|
925638
|
-
const bIsNonRequired = this.
|
|
925617
|
+
const aIsNonRequired = !this.isRequiredBuilderParameter(a3);
|
|
925618
|
+
const bIsNonRequired = !this.isRequiredBuilderParameter(b5);
|
|
925639
925619
|
if (aIsNonRequired && !bIsNonRequired) {
|
|
925640
925620
|
return 1;
|
|
925641
925621
|
}
|
|
@@ -925649,6 +925629,12 @@ var TypeLiteral = class _TypeLiteral extends AstNode3 {
|
|
|
925649
925629
|
const internalType = value2.internalType.type;
|
|
925650
925630
|
return internalType === "list" || internalType === "set" || internalType === "map";
|
|
925651
925631
|
}
|
|
925632
|
+
isRequiredBuilderParameter(parameter6) {
|
|
925633
|
+
if (parameter6.isRequired != null) {
|
|
925634
|
+
return parameter6.isRequired;
|
|
925635
|
+
}
|
|
925636
|
+
return !this.isNonRequired(parameter6.value);
|
|
925637
|
+
}
|
|
925652
925638
|
isNonRequired(value2) {
|
|
925653
925639
|
return value2.isOptional() || this.isCollection(value2);
|
|
925654
925640
|
}
|
|
@@ -926159,7 +926145,10 @@ var DynamicTypeLiteralMapper = class {
|
|
|
926159
926145
|
this.context = context3;
|
|
926160
926146
|
}
|
|
926161
926147
|
usesOptionalNullable() {
|
|
926162
|
-
return this.context.
|
|
926148
|
+
return this.context.usesOptionalNullable();
|
|
926149
|
+
}
|
|
926150
|
+
usesNullableAnnotation() {
|
|
926151
|
+
return this.context.usesNullableAnnotation();
|
|
926163
926152
|
}
|
|
926164
926153
|
wrapInOptionalIfNotNop(value2, useOf = false, isCollapsedOptionalNullable = false) {
|
|
926165
926154
|
if (java_exports.TypeLiteral.isNop(value2)) {
|
|
@@ -926170,6 +926159,22 @@ var DynamicTypeLiteralMapper = class {
|
|
|
926170
926159
|
}
|
|
926171
926160
|
return java_exports.TypeLiteral.optional({ value: value2, useOf });
|
|
926172
926161
|
}
|
|
926162
|
+
// Wraps an already-converted inner value for an `optional`/`nullable` wrapper type, honoring
|
|
926163
|
+
// the `use-nullable-annotation` (raw, no wrapper) and `collapse-optional-nullable`
|
|
926164
|
+
// (OptionalNullable<T>) configs. `propagatedCollapse` is set when an outer optional+nullable
|
|
926165
|
+
// collapsed into this node.
|
|
926166
|
+
wrapNullableOrOptionalValue({ value: value2, wrapperType, useOf, propagatedCollapse }) {
|
|
926167
|
+
if (java_exports.TypeLiteral.isNop(value2)) {
|
|
926168
|
+
return value2;
|
|
926169
|
+
}
|
|
926170
|
+
if (wrapperType === "nullable" && this.usesNullableAnnotation()) {
|
|
926171
|
+
return value2;
|
|
926172
|
+
}
|
|
926173
|
+
if (propagatedCollapse || this.usesOptionalNullable() && wrapperType === "nullable") {
|
|
926174
|
+
return this.context.getOptionalNullableOf(value2);
|
|
926175
|
+
}
|
|
926176
|
+
return java_exports.TypeLiteral.optional({ value: value2, useOf });
|
|
926177
|
+
}
|
|
926173
926178
|
convert(args) {
|
|
926174
926179
|
if (args.value === null) {
|
|
926175
926180
|
if (this.context.isNullable(args.typeReference)) {
|
|
@@ -926186,11 +926191,21 @@ var DynamicTypeLiteralMapper = class {
|
|
|
926186
926191
|
}
|
|
926187
926192
|
switch (args.typeReference.type) {
|
|
926188
926193
|
case "list":
|
|
926189
|
-
return this.convertList({
|
|
926194
|
+
return this.convertList({
|
|
926195
|
+
list: args.typeReference.value,
|
|
926196
|
+
value: args.value,
|
|
926197
|
+
as: args.as,
|
|
926198
|
+
nestedClassReference: args.nestedClassReference
|
|
926199
|
+
});
|
|
926190
926200
|
case "literal":
|
|
926191
926201
|
return this.convertLiteral({ literal: args.typeReference.value, value: args.value });
|
|
926192
926202
|
case "map":
|
|
926193
|
-
return this.convertMap({
|
|
926203
|
+
return this.convertMap({
|
|
926204
|
+
map: args.typeReference,
|
|
926205
|
+
value: args.value,
|
|
926206
|
+
as: args.as,
|
|
926207
|
+
nestedClassReference: args.nestedClassReference
|
|
926208
|
+
});
|
|
926194
926209
|
case "named": {
|
|
926195
926210
|
const named = this.context.resolveNamedType({ typeId: args.typeReference.value });
|
|
926196
926211
|
if (named == null) {
|
|
@@ -926200,16 +926215,20 @@ var DynamicTypeLiteralMapper = class {
|
|
|
926200
926215
|
named,
|
|
926201
926216
|
value: args.value,
|
|
926202
926217
|
as: args.as,
|
|
926203
|
-
inUndiscriminatedUnion: args.inUndiscriminatedUnion
|
|
926218
|
+
inUndiscriminatedUnion: args.inUndiscriminatedUnion,
|
|
926219
|
+
nestedClassReference: args.nestedClassReference
|
|
926204
926220
|
});
|
|
926205
926221
|
}
|
|
926206
926222
|
case "nullable":
|
|
926207
926223
|
case "optional": {
|
|
926208
|
-
|
|
926209
|
-
|
|
926210
|
-
|
|
926211
|
-
|
|
926212
|
-
|
|
926224
|
+
const wrapperType = args.typeReference.type;
|
|
926225
|
+
const inner2 = args.typeReference.value;
|
|
926226
|
+
if (args.value === void 0 || typeof args.value === "object" && args.value !== null && Object.keys(args.value).length === 0 && inner2.type === "named") {
|
|
926227
|
+
if (!(wrapperType === "nullable" && this.usesNullableAnnotation())) {
|
|
926228
|
+
const isCollapsed = args.isCollapsedOptionalNullable || this.usesOptionalNullable() && (wrapperType === "nullable" || inner2.type === "optional" || inner2.type === "nullable");
|
|
926229
|
+
if (isCollapsed) {
|
|
926230
|
+
return this.context.getOptionalNullableAbsent();
|
|
926231
|
+
}
|
|
926213
926232
|
return java_exports.TypeLiteral.reference(java_exports.invokeMethod({
|
|
926214
926233
|
on: java_exports.classReference({
|
|
926215
926234
|
name: "Optional",
|
|
@@ -926220,39 +926239,60 @@ var DynamicTypeLiteralMapper = class {
|
|
|
926220
926239
|
}));
|
|
926221
926240
|
}
|
|
926222
926241
|
}
|
|
926223
|
-
if (
|
|
926224
|
-
const listLiteral = this.convertList({ list: args.typeReference.value.value, value: args.value });
|
|
926225
|
-
return this.wrapInOptionalIfNotNop(listLiteral, true, args.isCollapsedOptionalNullable === true);
|
|
926226
|
-
}
|
|
926227
|
-
if (this.usesOptionalNullable() && (args.typeReference.value.type === "optional" || args.typeReference.value.type === "nullable")) {
|
|
926242
|
+
if (this.usesOptionalNullable() && (inner2.type === "optional" || inner2.type === "nullable")) {
|
|
926228
926243
|
return this.convert({
|
|
926229
|
-
typeReference:
|
|
926244
|
+
typeReference: inner2,
|
|
926230
926245
|
value: args.value,
|
|
926231
926246
|
as: args.as,
|
|
926232
926247
|
inUndiscriminatedUnion: args.inUndiscriminatedUnion,
|
|
926233
|
-
isCollapsedOptionalNullable: true
|
|
926248
|
+
isCollapsedOptionalNullable: true,
|
|
926249
|
+
nestedClassReference: args.nestedClassReference
|
|
926250
|
+
});
|
|
926251
|
+
}
|
|
926252
|
+
if (inner2.type === "list") {
|
|
926253
|
+
const listLiteral = this.convertList({
|
|
926254
|
+
list: inner2.value,
|
|
926255
|
+
value: args.value,
|
|
926256
|
+
nestedClassReference: args.nestedClassReference
|
|
926257
|
+
});
|
|
926258
|
+
return this.wrapNullableOrOptionalValue({
|
|
926259
|
+
value: listLiteral,
|
|
926260
|
+
wrapperType,
|
|
926261
|
+
useOf: true,
|
|
926262
|
+
propagatedCollapse: args.isCollapsedOptionalNullable === true
|
|
926234
926263
|
});
|
|
926235
926264
|
}
|
|
926236
926265
|
const convertedValue = this.convert({
|
|
926237
|
-
typeReference:
|
|
926266
|
+
typeReference: inner2,
|
|
926238
926267
|
value: args.value,
|
|
926239
926268
|
as: args.as,
|
|
926240
|
-
inUndiscriminatedUnion: args.inUndiscriminatedUnion
|
|
926269
|
+
inUndiscriminatedUnion: args.inUndiscriminatedUnion,
|
|
926270
|
+
nestedClassReference: args.nestedClassReference
|
|
926241
926271
|
});
|
|
926242
926272
|
const useOf = args.as === "mapValue" || args.inUndiscriminatedUnion === true;
|
|
926243
|
-
return this.
|
|
926273
|
+
return this.wrapNullableOrOptionalValue({
|
|
926274
|
+
value: convertedValue,
|
|
926275
|
+
wrapperType,
|
|
926276
|
+
useOf,
|
|
926277
|
+
propagatedCollapse: args.isCollapsedOptionalNullable === true
|
|
926278
|
+
});
|
|
926244
926279
|
}
|
|
926245
926280
|
case "primitive":
|
|
926246
926281
|
return this.convertPrimitive({ primitive: args.typeReference.value, value: args.value, as: args.as });
|
|
926247
926282
|
case "set":
|
|
926248
|
-
return this.convertSet({
|
|
926283
|
+
return this.convertSet({
|
|
926284
|
+
set: args.typeReference.value,
|
|
926285
|
+
value: args.value,
|
|
926286
|
+
as: args.as,
|
|
926287
|
+
nestedClassReference: args.nestedClassReference
|
|
926288
|
+
});
|
|
926249
926289
|
case "unknown":
|
|
926250
926290
|
return this.convertUnknown({ value: args.value });
|
|
926251
926291
|
default:
|
|
926252
926292
|
assertNever(args.typeReference);
|
|
926253
926293
|
}
|
|
926254
926294
|
}
|
|
926255
|
-
convertList({ list: list29, value: value2, as: as2 }) {
|
|
926295
|
+
convertList({ list: list29, value: value2, as: as2, nestedClassReference }) {
|
|
926256
926296
|
if (!Array.isArray(value2)) {
|
|
926257
926297
|
this.context.errors.add({
|
|
926258
926298
|
severity: Severity.Critical,
|
|
@@ -926266,11 +926306,21 @@ var DynamicTypeLiteralMapper = class {
|
|
|
926266
926306
|
values: value2.map((v3, index3) => {
|
|
926267
926307
|
this.context.errors.scope({ index: index3 });
|
|
926268
926308
|
try {
|
|
926269
|
-
if (isItemOptional) {
|
|
926270
|
-
const itemValue = this.convert({
|
|
926271
|
-
|
|
926309
|
+
if (isItemOptional && (list29.type === "optional" || list29.type === "nullable")) {
|
|
926310
|
+
const itemValue = this.convert({
|
|
926311
|
+
typeReference: list29.value,
|
|
926312
|
+
value: v3,
|
|
926313
|
+
as: as2,
|
|
926314
|
+
nestedClassReference
|
|
926315
|
+
});
|
|
926316
|
+
return this.wrapNullableOrOptionalValue({
|
|
926317
|
+
value: itemValue,
|
|
926318
|
+
wrapperType: list29.type,
|
|
926319
|
+
useOf: true,
|
|
926320
|
+
propagatedCollapse: false
|
|
926321
|
+
});
|
|
926272
926322
|
}
|
|
926273
|
-
return this.convert({ typeReference: list29, value: v3, as: as2 });
|
|
926323
|
+
return this.convert({ typeReference: list29, value: v3, as: as2, nestedClassReference });
|
|
926274
926324
|
} finally {
|
|
926275
926325
|
this.context.errors.unscope();
|
|
926276
926326
|
}
|
|
@@ -926299,7 +926349,7 @@ var DynamicTypeLiteralMapper = class {
|
|
|
926299
926349
|
assertNever(literal3);
|
|
926300
926350
|
}
|
|
926301
926351
|
}
|
|
926302
|
-
convertSet({ set: set26, value: value2, as: as2 }) {
|
|
926352
|
+
convertSet({ set: set26, value: value2, as: as2, nestedClassReference }) {
|
|
926303
926353
|
if (!Array.isArray(value2)) {
|
|
926304
926354
|
this.context.errors.add({
|
|
926305
926355
|
severity: Severity.Critical,
|
|
@@ -926312,14 +926362,14 @@ var DynamicTypeLiteralMapper = class {
|
|
|
926312
926362
|
values: value2.map((v3, index3) => {
|
|
926313
926363
|
this.context.errors.scope({ index: index3 });
|
|
926314
926364
|
try {
|
|
926315
|
-
return this.convert({ typeReference: set26, value: v3, as: as2 });
|
|
926365
|
+
return this.convert({ typeReference: set26, value: v3, as: as2, nestedClassReference });
|
|
926316
926366
|
} finally {
|
|
926317
926367
|
this.context.errors.unscope();
|
|
926318
926368
|
}
|
|
926319
926369
|
})
|
|
926320
926370
|
});
|
|
926321
926371
|
}
|
|
926322
|
-
convertMap({ map: map15, value: value2, as: as2 }) {
|
|
926372
|
+
convertMap({ map: map15, value: value2, as: as2, nestedClassReference }) {
|
|
926323
926373
|
if (typeof value2 !== "object" || value2 == null) {
|
|
926324
926374
|
this.context.errors.add({
|
|
926325
926375
|
severity: Severity.Critical,
|
|
@@ -926338,7 +926388,8 @@ var DynamicTypeLiteralMapper = class {
|
|
|
926338
926388
|
value: this.convert({
|
|
926339
926389
|
typeReference: map15.value,
|
|
926340
926390
|
value: value3,
|
|
926341
|
-
as: "mapValue"
|
|
926391
|
+
as: "mapValue",
|
|
926392
|
+
nestedClassReference
|
|
926342
926393
|
})
|
|
926343
926394
|
};
|
|
926344
926395
|
} finally {
|
|
@@ -926347,7 +926398,7 @@ var DynamicTypeLiteralMapper = class {
|
|
|
926347
926398
|
})
|
|
926348
926399
|
});
|
|
926349
926400
|
}
|
|
926350
|
-
convertNamed({ named, value: value2, as: as2, inUndiscriminatedUnion }) {
|
|
926401
|
+
convertNamed({ named, value: value2, as: as2, inUndiscriminatedUnion, nestedClassReference }) {
|
|
926351
926402
|
switch (named.type) {
|
|
926352
926403
|
case "alias":
|
|
926353
926404
|
if (named.typeReference.type === "unknown") {
|
|
@@ -926358,32 +926409,44 @@ var DynamicTypeLiteralMapper = class {
|
|
|
926358
926409
|
inUndiscriminatedUnion
|
|
926359
926410
|
});
|
|
926360
926411
|
return java_exports.TypeLiteral.reference(java_exports.invokeMethod({
|
|
926361
|
-
on: this.context.getJavaClassReferenceFromDeclaration({
|
|
926412
|
+
on: nestedClassReference ?? this.context.getJavaClassReferenceFromDeclaration({
|
|
926362
926413
|
declaration: named.declaration
|
|
926363
926414
|
}),
|
|
926364
926415
|
method: "of",
|
|
926365
926416
|
arguments_: [convertedValue]
|
|
926366
926417
|
}));
|
|
926367
926418
|
}
|
|
926368
|
-
return this.convert({
|
|
926419
|
+
return this.convert({
|
|
926420
|
+
typeReference: named.typeReference,
|
|
926421
|
+
value: value2,
|
|
926422
|
+
as: as2,
|
|
926423
|
+
inUndiscriminatedUnion,
|
|
926424
|
+
nestedClassReference
|
|
926425
|
+
});
|
|
926369
926426
|
case "discriminatedUnion":
|
|
926370
926427
|
return this.convertDiscriminatedUnion({
|
|
926371
926428
|
discriminatedUnion: named,
|
|
926372
926429
|
value: value2,
|
|
926373
|
-
as: as2
|
|
926430
|
+
as: as2,
|
|
926431
|
+
nestedClassReference
|
|
926374
926432
|
});
|
|
926375
926433
|
case "enum":
|
|
926376
|
-
return this.convertEnum({ enum_: named, value: value2 });
|
|
926434
|
+
return this.convertEnum({ enum_: named, value: value2, nestedClassReference });
|
|
926377
926435
|
case "object":
|
|
926378
|
-
return this.convertObject({ object_: named, value: value2, as: as2, inUndiscriminatedUnion });
|
|
926436
|
+
return this.convertObject({ object_: named, value: value2, as: as2, inUndiscriminatedUnion, nestedClassReference });
|
|
926379
926437
|
case "undiscriminatedUnion":
|
|
926380
|
-
return this.convertUndiscriminatedUnion({
|
|
926438
|
+
return this.convertUndiscriminatedUnion({
|
|
926439
|
+
undiscriminatedUnion: named,
|
|
926440
|
+
value: value2,
|
|
926441
|
+
as: as2,
|
|
926442
|
+
nestedClassReference
|
|
926443
|
+
});
|
|
926381
926444
|
default:
|
|
926382
926445
|
assertNever(named);
|
|
926383
926446
|
}
|
|
926384
926447
|
}
|
|
926385
|
-
convertDiscriminatedUnion({ discriminatedUnion: discriminatedUnion2, value: value2, as: as2 }) {
|
|
926386
|
-
const classReference4 = this.context.getJavaClassReferenceFromDeclaration({
|
|
926448
|
+
convertDiscriminatedUnion({ discriminatedUnion: discriminatedUnion2, value: value2, as: as2, nestedClassReference }) {
|
|
926449
|
+
const classReference4 = nestedClassReference ?? this.context.getJavaClassReferenceFromDeclaration({
|
|
926387
926450
|
declaration: discriminatedUnion2.declaration
|
|
926388
926451
|
});
|
|
926389
926452
|
const discriminatedUnionTypeInstance = this.context.resolveDiscriminatedUnionTypeInstance({
|
|
@@ -926394,6 +926457,8 @@ var DynamicTypeLiteralMapper = class {
|
|
|
926394
926457
|
return java_exports.TypeLiteral.nop();
|
|
926395
926458
|
}
|
|
926396
926459
|
const unionVariant = discriminatedUnionTypeInstance.singleDiscriminatedUnionType;
|
|
926460
|
+
const reservedNames = /* @__PURE__ */ new Set([...classReference4.enclosingClasses, classReference4.name]);
|
|
926461
|
+
const siblingDiscriminantNames = new Set(Object.values(discriminatedUnion2.types).map((variant) => this.context.getClassName(variant.discriminantValue.name)));
|
|
926397
926462
|
switch (unionVariant.type) {
|
|
926398
926463
|
case "samePropertiesAsObject": {
|
|
926399
926464
|
const named = this.context.resolveNamedType({
|
|
@@ -926402,10 +926467,24 @@ var DynamicTypeLiteralMapper = class {
|
|
|
926402
926467
|
if (named == null) {
|
|
926403
926468
|
return java_exports.TypeLiteral.nop();
|
|
926404
926469
|
}
|
|
926470
|
+
const variantNestedClassReference = this.resolveInlineNestedClassReference({
|
|
926471
|
+
enclosing: classReference4,
|
|
926472
|
+
baseName: this.context.getClassName(unionVariant.discriminantValue.name),
|
|
926473
|
+
typeReference: { type: "named", value: unionVariant.typeId },
|
|
926474
|
+
reservedNames,
|
|
926475
|
+
siblingPropertyNames: siblingDiscriminantNames
|
|
926476
|
+
});
|
|
926405
926477
|
return java_exports.TypeLiteral.reference(java_exports.invokeMethod({
|
|
926406
926478
|
on: classReference4,
|
|
926407
926479
|
method: this.context.getPropertyName(unionVariant.discriminantValue.name),
|
|
926408
|
-
arguments_: [
|
|
926480
|
+
arguments_: [
|
|
926481
|
+
this.convertNamed({
|
|
926482
|
+
named,
|
|
926483
|
+
value: discriminatedUnionTypeInstance.value,
|
|
926484
|
+
as: as2,
|
|
926485
|
+
nestedClassReference: variantNestedClassReference
|
|
926486
|
+
})
|
|
926487
|
+
]
|
|
926409
926488
|
}));
|
|
926410
926489
|
}
|
|
926411
926490
|
case "singleProperty": {
|
|
@@ -926416,6 +926495,13 @@ var DynamicTypeLiteralMapper = class {
|
|
|
926416
926495
|
try {
|
|
926417
926496
|
this.context.errors.scope(unionVariant.discriminantValue.wireValue);
|
|
926418
926497
|
const propertyKey = "value";
|
|
926498
|
+
const variantNestedClassReference = this.resolveInlineNestedClassReference({
|
|
926499
|
+
enclosing: classReference4,
|
|
926500
|
+
baseName: this.context.getClassName(unionVariant.discriminantValue.name),
|
|
926501
|
+
typeReference: unionVariant.typeReference,
|
|
926502
|
+
reservedNames,
|
|
926503
|
+
siblingPropertyNames: siblingDiscriminantNames
|
|
926504
|
+
});
|
|
926419
926505
|
return java_exports.TypeLiteral.reference(java_exports.invokeMethod({
|
|
926420
926506
|
on: classReference4,
|
|
926421
926507
|
method: this.context.getPropertyName(unionVariant.discriminantValue.name),
|
|
@@ -926423,7 +926509,8 @@ var DynamicTypeLiteralMapper = class {
|
|
|
926423
926509
|
this.convert({
|
|
926424
926510
|
typeReference: unionVariant.typeReference,
|
|
926425
926511
|
value: record23[propertyKey],
|
|
926426
|
-
as: as2
|
|
926512
|
+
as: as2,
|
|
926513
|
+
nestedClassReference: variantNestedClassReference
|
|
926427
926514
|
})
|
|
926428
926515
|
]
|
|
926429
926516
|
}));
|
|
@@ -926441,7 +926528,10 @@ var DynamicTypeLiteralMapper = class {
|
|
|
926441
926528
|
assertNever(unionVariant);
|
|
926442
926529
|
}
|
|
926443
926530
|
}
|
|
926444
|
-
convertObject({ object_, value: value2, as: as2, inUndiscriminatedUnion }) {
|
|
926531
|
+
convertObject({ object_, value: value2, as: as2, inUndiscriminatedUnion, nestedClassReference }) {
|
|
926532
|
+
const classReference4 = nestedClassReference ?? this.context.getJavaClassReferenceFromDeclaration({
|
|
926533
|
+
declaration: object_.declaration
|
|
926534
|
+
});
|
|
926445
926535
|
const valueRecord = this.context.getRecord(value2) ?? {};
|
|
926446
926536
|
const properties7 = this.context.associateByWireValue({
|
|
926447
926537
|
parameters: object_.properties,
|
|
@@ -926471,6 +926561,8 @@ var DynamicTypeLiteralMapper = class {
|
|
|
926471
926561
|
});
|
|
926472
926562
|
properties7.sort((a3, b5) => (paramOrderMap.get(a3.name.wireValue) ?? 0) - (paramOrderMap.get(b5.name.wireValue) ?? 0));
|
|
926473
926563
|
const filteredProperties = as2 === "request" ? properties7.filter((property24) => !this.context.isDirectLiteral(property24.typeReference)) : properties7;
|
|
926564
|
+
const reservedNames = /* @__PURE__ */ new Set([...classReference4.enclosingClasses, classReference4.name]);
|
|
926565
|
+
const siblingPropertyNames = new Set(object_.properties.map((property24) => this.context.getClassName(property24.name.name)));
|
|
926474
926566
|
const builderParameters = [];
|
|
926475
926567
|
for (const property24 of filteredProperties) {
|
|
926476
926568
|
this.context.errors.scope(property24.name.wireValue);
|
|
@@ -926479,7 +926571,14 @@ var DynamicTypeLiteralMapper = class {
|
|
|
926479
926571
|
typeReference: property24.typeReference,
|
|
926480
926572
|
value: property24.value,
|
|
926481
926573
|
as: as2,
|
|
926482
|
-
inUndiscriminatedUnion
|
|
926574
|
+
inUndiscriminatedUnion,
|
|
926575
|
+
nestedClassReference: this.resolveInlineNestedClassReference({
|
|
926576
|
+
enclosing: classReference4,
|
|
926577
|
+
baseName: this.context.getClassName(property24.name.name),
|
|
926578
|
+
typeReference: property24.typeReference,
|
|
926579
|
+
reservedNames,
|
|
926580
|
+
siblingPropertyNames
|
|
926581
|
+
})
|
|
926483
926582
|
});
|
|
926484
926583
|
if (java_exports.TypeLiteral.isNop(convertedValue) && !this.context.isOptional(property24.typeReference)) {
|
|
926485
926584
|
if (inUndiscriminatedUnion === true) {
|
|
@@ -926489,7 +926588,8 @@ var DynamicTypeLiteralMapper = class {
|
|
|
926489
926588
|
}
|
|
926490
926589
|
builderParameters.push({
|
|
926491
926590
|
name: this.context.getMethodName(property24.name.name),
|
|
926492
|
-
value: convertedValue
|
|
926591
|
+
value: convertedValue,
|
|
926592
|
+
isRequired: this.isStagedBuilderProperty(property24.typeReference)
|
|
926493
926593
|
});
|
|
926494
926594
|
} finally {
|
|
926495
926595
|
this.context.errors.unscope();
|
|
@@ -926501,18 +926601,178 @@ var DynamicTypeLiteralMapper = class {
|
|
|
926501
926601
|
if (rawValue != null) {
|
|
926502
926602
|
builderParameters.push({
|
|
926503
926603
|
name: "additionalProperty",
|
|
926504
|
-
value: java_exports.TypeLiteral.raw(`"${this.escapeJavaString(key2)}", ${rawValue}`)
|
|
926604
|
+
value: java_exports.TypeLiteral.raw(`"${this.escapeJavaString(key2)}", ${rawValue}`),
|
|
926605
|
+
isRequired: false
|
|
926505
926606
|
});
|
|
926506
926607
|
}
|
|
926507
926608
|
}
|
|
926508
926609
|
}
|
|
926509
926610
|
return java_exports.TypeLiteral.builder({
|
|
926510
|
-
classReference:
|
|
926511
|
-
declaration: object_.declaration
|
|
926512
|
-
}),
|
|
926611
|
+
classReference: classReference4,
|
|
926513
926612
|
parameters: builderParameters
|
|
926514
926613
|
});
|
|
926515
926614
|
}
|
|
926615
|
+
/**
|
|
926616
|
+
* Mirrors the v1 generator's inline-type naming (see ObjectGenerator / InlineTypeIdResolver):
|
|
926617
|
+
* when a property's type resolves to an inline named type, v1 emits it as a class nested within
|
|
926618
|
+
* the enclosing object. This walks the property's type reference (descending through container
|
|
926619
|
+
* wrappers, applying the same name suffixes as v1) and, if it terminates in an inline named type,
|
|
926620
|
+
* returns the nested class reference to use. Returns undefined for non-inline types, which fall
|
|
926621
|
+
* back to the standalone top-level class name.
|
|
926622
|
+
*/
|
|
926623
|
+
resolveInlineNestedClassReference({ enclosing, baseName, typeReference: typeReference2, reservedNames, siblingPropertyNames }) {
|
|
926624
|
+
if (!this.context.enableInlineTypes()) {
|
|
926625
|
+
return void 0;
|
|
926626
|
+
}
|
|
926627
|
+
switch (typeReference2.type) {
|
|
926628
|
+
case "optional":
|
|
926629
|
+
case "nullable":
|
|
926630
|
+
return this.resolveInlineNestedClassReference({
|
|
926631
|
+
enclosing,
|
|
926632
|
+
baseName,
|
|
926633
|
+
typeReference: typeReference2.value,
|
|
926634
|
+
reservedNames,
|
|
926635
|
+
siblingPropertyNames
|
|
926636
|
+
});
|
|
926637
|
+
case "list":
|
|
926638
|
+
case "set":
|
|
926639
|
+
return this.resolveInlineNestedClassReference({
|
|
926640
|
+
enclosing,
|
|
926641
|
+
baseName: `${baseName}Item`,
|
|
926642
|
+
typeReference: typeReference2.value,
|
|
926643
|
+
reservedNames,
|
|
926644
|
+
siblingPropertyNames
|
|
926645
|
+
});
|
|
926646
|
+
case "map":
|
|
926647
|
+
return this.resolveInlineNestedClassReference({
|
|
926648
|
+
enclosing,
|
|
926649
|
+
baseName: `${baseName}Value`,
|
|
926650
|
+
typeReference: typeReference2.value,
|
|
926651
|
+
reservedNames,
|
|
926652
|
+
siblingPropertyNames
|
|
926653
|
+
});
|
|
926654
|
+
case "named": {
|
|
926655
|
+
const typeId = typeReference2.value;
|
|
926656
|
+
const named = this.context.resolveNamedType({ typeId });
|
|
926657
|
+
if (named == null) {
|
|
926658
|
+
return void 0;
|
|
926659
|
+
}
|
|
926660
|
+
if (named.type === "alias" && !this.context.wrappedAliases()) {
|
|
926661
|
+
return this.resolveInlineNestedClassReference({
|
|
926662
|
+
enclosing,
|
|
926663
|
+
baseName,
|
|
926664
|
+
typeReference: named.typeReference,
|
|
926665
|
+
reservedNames,
|
|
926666
|
+
siblingPropertyNames
|
|
926667
|
+
});
|
|
926668
|
+
}
|
|
926669
|
+
if (!this.context.isInlineType(typeId)) {
|
|
926670
|
+
return void 0;
|
|
926671
|
+
}
|
|
926672
|
+
let name2 = baseName;
|
|
926673
|
+
while (reservedNames.has(name2) || siblingPropertyNames.has(name2) && name2 !== baseName) {
|
|
926674
|
+
name2 = `${name2}_`;
|
|
926675
|
+
}
|
|
926676
|
+
reservedNames.add(name2);
|
|
926677
|
+
return this.context.getNestedInlineClassReference({ enclosing, name: name2 });
|
|
926678
|
+
}
|
|
926679
|
+
case "primitive":
|
|
926680
|
+
case "literal":
|
|
926681
|
+
case "unknown":
|
|
926682
|
+
return void 0;
|
|
926683
|
+
default:
|
|
926684
|
+
assertNever(typeReference2);
|
|
926685
|
+
}
|
|
926686
|
+
}
|
|
926687
|
+
/**
|
|
926688
|
+
* Resolves the nested class reference for an inline member of an undiscriminated union.
|
|
926689
|
+
* Unlike object properties and discriminated-union variants (whose nested name is derived
|
|
926690
|
+
* from the property/discriminant name), v1 names an undiscriminated union's inline members
|
|
926691
|
+
* after the member type's own name, with the union's name stripped as a prefix (see
|
|
926692
|
+
* UndiscriminatedUnionGenerator). Descends through container wrappers to the terminal named
|
|
926693
|
+
* type.
|
|
926694
|
+
*/
|
|
926695
|
+
resolveUndiscriminatedInlineNestedClassReference({ enclosing, typeReference: typeReference2, reservedNames, unionPrefix }) {
|
|
926696
|
+
if (!this.context.enableInlineTypes()) {
|
|
926697
|
+
return void 0;
|
|
926698
|
+
}
|
|
926699
|
+
switch (typeReference2.type) {
|
|
926700
|
+
case "optional":
|
|
926701
|
+
case "nullable":
|
|
926702
|
+
case "list":
|
|
926703
|
+
case "set":
|
|
926704
|
+
return this.resolveUndiscriminatedInlineNestedClassReference({
|
|
926705
|
+
enclosing,
|
|
926706
|
+
typeReference: typeReference2.value,
|
|
926707
|
+
reservedNames,
|
|
926708
|
+
unionPrefix
|
|
926709
|
+
});
|
|
926710
|
+
case "map":
|
|
926711
|
+
return this.resolveUndiscriminatedInlineNestedClassReference({
|
|
926712
|
+
enclosing,
|
|
926713
|
+
typeReference: typeReference2.value,
|
|
926714
|
+
reservedNames,
|
|
926715
|
+
unionPrefix
|
|
926716
|
+
});
|
|
926717
|
+
case "named": {
|
|
926718
|
+
const typeId = typeReference2.value;
|
|
926719
|
+
const named = this.context.resolveNamedType({ typeId });
|
|
926720
|
+
if (named == null) {
|
|
926721
|
+
return void 0;
|
|
926722
|
+
}
|
|
926723
|
+
if (named.type === "alias" && !this.context.wrappedAliases()) {
|
|
926724
|
+
return this.resolveUndiscriminatedInlineNestedClassReference({
|
|
926725
|
+
enclosing,
|
|
926726
|
+
typeReference: named.typeReference,
|
|
926727
|
+
reservedNames,
|
|
926728
|
+
unionPrefix
|
|
926729
|
+
});
|
|
926730
|
+
}
|
|
926731
|
+
if (!this.context.isInlineType(typeId)) {
|
|
926732
|
+
return void 0;
|
|
926733
|
+
}
|
|
926734
|
+
let name2 = this.context.getClassName(named.declaration.name);
|
|
926735
|
+
if (name2.startsWith(unionPrefix) && name2 !== unionPrefix) {
|
|
926736
|
+
name2 = name2.substring(unionPrefix.length);
|
|
926737
|
+
}
|
|
926738
|
+
while (reservedNames.has(name2)) {
|
|
926739
|
+
name2 = `${name2}_`;
|
|
926740
|
+
}
|
|
926741
|
+
return this.context.getNestedInlineClassReference({ enclosing, name: name2 });
|
|
926742
|
+
}
|
|
926743
|
+
case "primitive":
|
|
926744
|
+
case "literal":
|
|
926745
|
+
case "unknown":
|
|
926746
|
+
return void 0;
|
|
926747
|
+
default:
|
|
926748
|
+
assertNever(typeReference2);
|
|
926749
|
+
}
|
|
926750
|
+
}
|
|
926751
|
+
/**
|
|
926752
|
+
* Returns true when a property becomes a required stage in v1's staged builder. v1 stages
|
|
926753
|
+
* fields that are neither optional, nullable, nor collections (list/set/map); those are all
|
|
926754
|
+
* exposed on the final stage instead. This intentionally resolves aliases itself because the
|
|
926755
|
+
* shared `isOptional` helper does not treat an alias to an optional type as optional.
|
|
926756
|
+
*/
|
|
926757
|
+
isStagedBuilderProperty(typeReference2) {
|
|
926758
|
+
switch (typeReference2.type) {
|
|
926759
|
+
case "optional":
|
|
926760
|
+
case "nullable":
|
|
926761
|
+
case "list":
|
|
926762
|
+
case "set":
|
|
926763
|
+
case "map":
|
|
926764
|
+
return false;
|
|
926765
|
+
case "named": {
|
|
926766
|
+
const resolvedType = this.context.resolveNamedType({ typeId: typeReference2.value });
|
|
926767
|
+
if (resolvedType != null && resolvedType.type === "alias") {
|
|
926768
|
+
return this.isStagedBuilderProperty(resolvedType.typeReference);
|
|
926769
|
+
}
|
|
926770
|
+
return true;
|
|
926771
|
+
}
|
|
926772
|
+
default:
|
|
926773
|
+
return true;
|
|
926774
|
+
}
|
|
926775
|
+
}
|
|
926516
926776
|
convertToRawJavaLiteral(value2) {
|
|
926517
926777
|
if (typeof value2 === "string") {
|
|
926518
926778
|
return `"${this.escapeJavaString(value2)}"`;
|
|
@@ -926605,13 +926865,13 @@ var DynamicTypeLiteralMapper = class {
|
|
|
926605
926865
|
return "string";
|
|
926606
926866
|
}
|
|
926607
926867
|
}
|
|
926608
|
-
convertEnum({ enum_: enum_25, value: value2 }) {
|
|
926868
|
+
convertEnum({ enum_: enum_25, value: value2, nestedClassReference }) {
|
|
926609
926869
|
const name2 = this.getEnumValueName({ enum_: enum_25, value: value2 });
|
|
926610
926870
|
if (name2 == null) {
|
|
926611
926871
|
return java_exports.TypeLiteral.nop();
|
|
926612
926872
|
}
|
|
926613
926873
|
return java_exports.TypeLiteral.enum_({
|
|
926614
|
-
classReference: this.context.getJavaClassReferenceFromDeclaration({
|
|
926874
|
+
classReference: nestedClassReference ?? this.context.getJavaClassReferenceFromDeclaration({
|
|
926615
926875
|
declaration: enum_25.declaration
|
|
926616
926876
|
}),
|
|
926617
926877
|
value: name2
|
|
@@ -926635,33 +926895,28 @@ var DynamicTypeLiteralMapper = class {
|
|
|
926635
926895
|
}
|
|
926636
926896
|
return this.context.getEnumName(enumValue.name);
|
|
926637
926897
|
}
|
|
926638
|
-
convertUndiscriminatedUnion({ undiscriminatedUnion: undiscriminatedUnion22, value: value2, as: as2 }) {
|
|
926898
|
+
convertUndiscriminatedUnion({ undiscriminatedUnion: undiscriminatedUnion22, value: value2, as: as2, nestedClassReference }) {
|
|
926899
|
+
const classReference4 = nestedClassReference ?? this.context.getJavaClassReferenceFromDeclaration({
|
|
926900
|
+
declaration: undiscriminatedUnion22.declaration
|
|
926901
|
+
});
|
|
926639
926902
|
const result = this.findMatchingUndiscriminatedUnionType({
|
|
926640
926903
|
undiscriminatedUnion: undiscriminatedUnion22,
|
|
926641
926904
|
value: value2,
|
|
926642
|
-
as: as2
|
|
926905
|
+
as: as2,
|
|
926906
|
+
enclosing: classReference4
|
|
926643
926907
|
});
|
|
926644
926908
|
if (result == null) {
|
|
926645
926909
|
return java_exports.TypeLiteral.nop();
|
|
926646
926910
|
}
|
|
926647
|
-
if (this.context.isPrimitive(result.valueTypeReference)) {
|
|
926648
|
-
return java_exports.TypeLiteral.reference(java_exports.invokeMethod({
|
|
926649
|
-
on: this.context.getJavaClassReferenceFromDeclaration({
|
|
926650
|
-
declaration: undiscriminatedUnion22.declaration
|
|
926651
|
-
}),
|
|
926652
|
-
method: "of",
|
|
926653
|
-
arguments_: [result.typeInstantiation]
|
|
926654
|
-
}));
|
|
926655
|
-
}
|
|
926656
926911
|
return java_exports.TypeLiteral.reference(java_exports.invokeMethod({
|
|
926657
|
-
on:
|
|
926658
|
-
declaration: undiscriminatedUnion22.declaration
|
|
926659
|
-
}),
|
|
926912
|
+
on: classReference4,
|
|
926660
926913
|
method: "of",
|
|
926661
926914
|
arguments_: [result.typeInstantiation]
|
|
926662
926915
|
}));
|
|
926663
926916
|
}
|
|
926664
|
-
findMatchingUndiscriminatedUnionType({ undiscriminatedUnion: undiscriminatedUnion22, value: value2, as: as2 }) {
|
|
926917
|
+
findMatchingUndiscriminatedUnionType({ undiscriminatedUnion: undiscriminatedUnion22, value: value2, as: as2, enclosing }) {
|
|
926918
|
+
const reservedNames = /* @__PURE__ */ new Set([...enclosing.enclosingClasses, enclosing.name]);
|
|
926919
|
+
const unionPrefix = this.context.getClassName(undiscriminatedUnion22.declaration.name);
|
|
926665
926920
|
for (const typeReference2 of undiscriminatedUnion22.types) {
|
|
926666
926921
|
const errorsBefore = this.context.errors.size();
|
|
926667
926922
|
try {
|
|
@@ -926669,7 +926924,13 @@ var DynamicTypeLiteralMapper = class {
|
|
|
926669
926924
|
typeReference: typeReference2,
|
|
926670
926925
|
value: value2,
|
|
926671
926926
|
as: as2,
|
|
926672
|
-
inUndiscriminatedUnion: true
|
|
926927
|
+
inUndiscriminatedUnion: true,
|
|
926928
|
+
nestedClassReference: this.resolveUndiscriminatedInlineNestedClassReference({
|
|
926929
|
+
enclosing,
|
|
926930
|
+
typeReference: typeReference2,
|
|
926931
|
+
reservedNames: new Set(reservedNames),
|
|
926932
|
+
unionPrefix
|
|
926933
|
+
})
|
|
926673
926934
|
});
|
|
926674
926935
|
if (java_exports.TypeLiteral.isNop(typeInstantiation) || this.context.errors.size() > errorsBefore) {
|
|
926675
926936
|
this.context.errors.truncate(errorsBefore);
|
|
@@ -926991,9 +927252,27 @@ var DynamicTypeMapper3 = class {
|
|
|
926991
927252
|
}
|
|
926992
927253
|
return this.convertNamed({ named });
|
|
926993
927254
|
}
|
|
926994
|
-
case "optional":
|
|
927255
|
+
case "optional": {
|
|
927256
|
+
const inner2 = args.typeReference.value;
|
|
927257
|
+
if (this.context.usesOptionalNullable() && (inner2.type === "nullable" || inner2.type === "optional")) {
|
|
927258
|
+
return java_exports.Type.generic(this.context.getOptionalNullableClassReference(), [
|
|
927259
|
+
this.convert({ typeReference: inner2.value })
|
|
927260
|
+
]);
|
|
927261
|
+
}
|
|
927262
|
+
return java_exports.Type.optional(this.convert({ typeReference: inner2 }));
|
|
927263
|
+
}
|
|
926995
927264
|
case "nullable": {
|
|
926996
|
-
|
|
927265
|
+
const inner2 = args.typeReference.value;
|
|
927266
|
+
if (this.context.usesNullableAnnotation()) {
|
|
927267
|
+
return this.convert({ typeReference: inner2 });
|
|
927268
|
+
}
|
|
927269
|
+
if (this.context.usesOptionalNullable()) {
|
|
927270
|
+
const collapsed = inner2.type === "optional" || inner2.type === "nullable" ? inner2.value : inner2;
|
|
927271
|
+
return java_exports.Type.generic(this.context.getOptionalNullableClassReference(), [
|
|
927272
|
+
this.convert({ typeReference: collapsed })
|
|
927273
|
+
]);
|
|
927274
|
+
}
|
|
927275
|
+
return java_exports.Type.optional(this.convert({ typeReference: inner2 }));
|
|
926997
927276
|
}
|
|
926998
927277
|
case "primitive":
|
|
926999
927278
|
return this.convertPrimitive({ primitive: args.typeReference.value });
|
|
@@ -927170,22 +927449,51 @@ var DynamicSnippetsGeneratorContext3 = class _DynamicSnippetsGeneratorContext ex
|
|
|
927170
927449
|
dynamicTypeMapper;
|
|
927171
927450
|
dynamicTypeLiteralMapper;
|
|
927172
927451
|
filePropertyMapper;
|
|
927173
|
-
|
|
927452
|
+
/**
|
|
927453
|
+
* The set of type IDs that the v1 generator emits as nested (inline) classes rather than
|
|
927454
|
+
* top-level types. The dynamic IR does not carry the `inline` flag, so the v2 SDK generator
|
|
927455
|
+
* computes this from the full IR and threads it through. Used to mirror v1's nested-class
|
|
927456
|
+
* naming when referencing inline types in snippets.
|
|
927457
|
+
*/
|
|
927458
|
+
inlineTypeIds;
|
|
927459
|
+
constructor({ ir: ir3, config: config5, options: options2, sharedCustomConfig, inlineTypeIds }) {
|
|
927174
927460
|
super({ ir: ir3, config: config5, options: options2 });
|
|
927175
927461
|
this.ir = ir3;
|
|
927176
927462
|
this.customConfig = sharedCustomConfig ?? BaseJavaCustomConfigSchema.parse(config5.customConfig ?? {});
|
|
927177
927463
|
this.dynamicTypeMapper = new DynamicTypeMapper3({ context: this });
|
|
927178
927464
|
this.dynamicTypeLiteralMapper = new DynamicTypeLiteralMapper({ context: this });
|
|
927179
927465
|
this.filePropertyMapper = new FilePropertyMapper3({ context: this });
|
|
927466
|
+
this.inlineTypeIds = inlineTypeIds ?? /* @__PURE__ */ new Set();
|
|
927180
927467
|
}
|
|
927181
927468
|
clone() {
|
|
927182
927469
|
return new _DynamicSnippetsGeneratorContext({
|
|
927183
927470
|
ir: this.ir,
|
|
927184
927471
|
config: this.config,
|
|
927185
927472
|
options: this.options,
|
|
927186
|
-
sharedCustomConfig: this.customConfig
|
|
927473
|
+
sharedCustomConfig: this.customConfig,
|
|
927474
|
+
inlineTypeIds: this.inlineTypeIds
|
|
927187
927475
|
});
|
|
927188
927476
|
}
|
|
927477
|
+
isInlineType(typeId) {
|
|
927478
|
+
return this.inlineTypeIds.has(typeId);
|
|
927479
|
+
}
|
|
927480
|
+
/**
|
|
927481
|
+
* Builds a reference to a class nested within `enclosing`. The resulting reference imports the
|
|
927482
|
+
* outermost enclosing class and is written using the dotted path (e.g. `PostRootRequest.Bar`).
|
|
927483
|
+
*/
|
|
927484
|
+
getNestedInlineClassReference({ enclosing, name: name2 }) {
|
|
927485
|
+
return java_exports.classReference({
|
|
927486
|
+
name: name2,
|
|
927487
|
+
packageName: enclosing.packageName,
|
|
927488
|
+
enclosingClasses: [...enclosing.enclosingClasses, enclosing.name]
|
|
927489
|
+
});
|
|
927490
|
+
}
|
|
927491
|
+
wrappedAliases() {
|
|
927492
|
+
return this.customConfig?.["wrapped-aliases"] ?? false;
|
|
927493
|
+
}
|
|
927494
|
+
enableInlineTypes() {
|
|
927495
|
+
return this.customConfig?.["enable-inline-types"] ?? false;
|
|
927496
|
+
}
|
|
927189
927497
|
getClassName(name2) {
|
|
927190
927498
|
return this.getName(name2.pascalCase.safeName);
|
|
927191
927499
|
}
|
|
@@ -927459,6 +927767,12 @@ var DynamicSnippetsGeneratorContext3 = class _DynamicSnippetsGeneratorContext ex
|
|
|
927459
927767
|
shouldInlineFileProperties() {
|
|
927460
927768
|
return this.customConfig?.["inline-file-properties"] ?? false;
|
|
927461
927769
|
}
|
|
927770
|
+
usesNullableAnnotation() {
|
|
927771
|
+
return this.customConfig?.["use-nullable-annotation"] === true;
|
|
927772
|
+
}
|
|
927773
|
+
usesOptionalNullable() {
|
|
927774
|
+
return this.customConfig?.["collapse-optional-nullable"] === true;
|
|
927775
|
+
}
|
|
927462
927776
|
getPackageNameSegments(fernFilepath) {
|
|
927463
927777
|
return fernFilepath.packagePath.map((segment) => this.getPackageNameSegment(segment));
|
|
927464
927778
|
}
|
|
@@ -928084,18 +928398,20 @@ var EndpointSnippetGenerator3 = class {
|
|
|
928084
928398
|
})
|
|
928085
928399
|
}));
|
|
928086
928400
|
this.context.errors.unscope();
|
|
928401
|
+
const requestClassReference = java_exports.classReference({
|
|
928402
|
+
name: this.context.getClassName(request7.declaration.name),
|
|
928403
|
+
packageName: this.context.getRequestsPackageName(request7.declaration.fernFilepath)
|
|
928404
|
+
});
|
|
928087
928405
|
this.context.errors.scope(Scope4.RequestBody);
|
|
928088
928406
|
const requestBodyFields = request7.body != null ? this.getInlinedRequestBodyBuilderParameters({
|
|
928089
928407
|
body: request7.body,
|
|
928090
928408
|
value: snippet.requestBody,
|
|
928091
|
-
filePropertyInfo
|
|
928409
|
+
filePropertyInfo,
|
|
928410
|
+
enclosing: requestClassReference
|
|
928092
928411
|
}) : [];
|
|
928093
928412
|
this.context.errors.unscope();
|
|
928094
928413
|
return java_exports.TypeLiteral.builder({
|
|
928095
|
-
classReference:
|
|
928096
|
-
name: this.context.getClassName(request7.declaration.name),
|
|
928097
|
-
packageName: this.context.getRequestsPackageName(request7.declaration.fernFilepath)
|
|
928098
|
-
}),
|
|
928414
|
+
classReference: requestClassReference,
|
|
928099
928415
|
parameters: [...pathParameterFields, ...headerFields, ...queryParameterFields, ...requestBodyFields]
|
|
928100
928416
|
});
|
|
928101
928417
|
}
|
|
@@ -928139,10 +928455,14 @@ var EndpointSnippetGenerator3 = class {
|
|
|
928139
928455
|
});
|
|
928140
928456
|
return java_exports.TypeLiteral.reference(buildMethodCall);
|
|
928141
928457
|
}
|
|
928142
|
-
getInlinedRequestBodyBuilderParameters({ body, value: value2, filePropertyInfo }) {
|
|
928458
|
+
getInlinedRequestBodyBuilderParameters({ body, value: value2, filePropertyInfo, enclosing }) {
|
|
928143
928459
|
switch (body.type) {
|
|
928144
928460
|
case "properties":
|
|
928145
|
-
return this.getInlinedRequestBodyPropertyBuilderParameters({
|
|
928461
|
+
return this.getInlinedRequestBodyPropertyBuilderParameters({
|
|
928462
|
+
parameters: body.value,
|
|
928463
|
+
value: value2,
|
|
928464
|
+
enclosing
|
|
928465
|
+
});
|
|
928146
928466
|
case "referenced":
|
|
928147
928467
|
return [this.getReferencedRequestBodyPropertyBuilderParameter({ body, value: value2 })];
|
|
928148
928468
|
case "fileUpload":
|
|
@@ -928177,19 +928497,28 @@ var EndpointSnippetGenerator3 = class {
|
|
|
928177
928497
|
assertNever(body);
|
|
928178
928498
|
}
|
|
928179
928499
|
}
|
|
928180
|
-
getInlinedRequestBodyPropertyBuilderParameters({ parameters: parameters2, value: value2 }) {
|
|
928500
|
+
getInlinedRequestBodyPropertyBuilderParameters({ parameters: parameters2, value: value2, enclosing }) {
|
|
928181
928501
|
const bodyProperties = this.context.associateByWireValue({
|
|
928182
928502
|
parameters: parameters2,
|
|
928183
928503
|
values: this.context.getRecord(value2) ?? {}
|
|
928184
928504
|
});
|
|
928185
928505
|
const filteredProperties = bodyProperties.filter((parameter6) => !this.context.isDirectLiteral(parameter6.typeReference));
|
|
928186
928506
|
const sortedProperties = this.context.sortTypeInstancesByRequiredFirst(filteredProperties, parameters2);
|
|
928507
|
+
const reservedNames = /* @__PURE__ */ new Set([...enclosing.enclosingClasses, enclosing.name]);
|
|
928508
|
+
const siblingPropertyNames = new Set(parameters2.map((parameter6) => this.context.getClassName(parameter6.name.name)));
|
|
928187
928509
|
return sortedProperties.map((parameter6) => ({
|
|
928188
928510
|
name: this.context.getMethodName(parameter6.name.name),
|
|
928189
928511
|
value: this.context.dynamicTypeLiteralMapper.convert({
|
|
928190
928512
|
typeReference: parameter6.typeReference,
|
|
928191
928513
|
value: parameter6.value,
|
|
928192
|
-
as: "request"
|
|
928514
|
+
as: "request",
|
|
928515
|
+
nestedClassReference: this.context.dynamicTypeLiteralMapper.resolveInlineNestedClassReference({
|
|
928516
|
+
enclosing,
|
|
928517
|
+
baseName: this.context.getClassName(parameter6.name.name),
|
|
928518
|
+
typeReference: parameter6.typeReference,
|
|
928519
|
+
reservedNames,
|
|
928520
|
+
siblingPropertyNames
|
|
928521
|
+
})
|
|
928193
928522
|
})
|
|
928194
928523
|
}));
|
|
928195
928524
|
}
|
|
@@ -928224,8 +928553,8 @@ var EndpointSnippetGenerator3 = class {
|
|
|
928224
928553
|
|
|
928225
928554
|
// ../../../generators/java-v2/dynamic-snippets/lib/DynamicSnippetsGenerator.js
|
|
928226
928555
|
var DynamicSnippetsGenerator3 = class extends AbstractDynamicSnippetsGenerator {
|
|
928227
|
-
constructor({ ir: ir3, config: config5, options: options2 = {} }) {
|
|
928228
|
-
super(new DynamicSnippetsGeneratorContext3({ ir: ir3, config: config5, options: options2 }));
|
|
928556
|
+
constructor({ ir: ir3, config: config5, options: options2 = {}, inlineTypeIds }) {
|
|
928557
|
+
super(new DynamicSnippetsGeneratorContext3({ ir: ir3, config: config5, options: options2, inlineTypeIds }));
|
|
928229
928558
|
}
|
|
928230
928559
|
async generate(request7, options2 = {}) {
|
|
928231
928560
|
return super.generate(request7, options2);
|
|
@@ -928250,15 +928579,18 @@ var DynamicSnippetsJavaTestGenerator = class {
|
|
|
928250
928579
|
context;
|
|
928251
928580
|
ir;
|
|
928252
928581
|
generatorConfig;
|
|
928582
|
+
inlineTypeIds;
|
|
928253
928583
|
dynamicSnippetsGenerator;
|
|
928254
|
-
constructor(context3, ir3, generatorConfig) {
|
|
928584
|
+
constructor(context3, ir3, generatorConfig, inlineTypeIds) {
|
|
928255
928585
|
this.context = context3;
|
|
928256
928586
|
this.ir = ir3;
|
|
928257
928587
|
this.generatorConfig = generatorConfig;
|
|
928588
|
+
this.inlineTypeIds = inlineTypeIds;
|
|
928258
928589
|
this.dynamicSnippetsGenerator = new DynamicSnippetsGenerator3({
|
|
928259
928590
|
// biome-ignore lint/suspicious/noExplicitAny: workaround for version incompatibility - see note above
|
|
928260
928591
|
ir: convertIr(this.ir),
|
|
928261
|
-
config: this.generatorConfig
|
|
928592
|
+
config: this.generatorConfig,
|
|
928593
|
+
inlineTypeIds: this.inlineTypeIds
|
|
928262
928594
|
});
|
|
928263
928595
|
}
|
|
928264
928596
|
async generateTests({ outputDir, requests: requests3 }) {
|
|
@@ -950569,7 +950901,7 @@ var DynamicSnippetsTestGenerator = class _DynamicSnippetsTestGenerator {
|
|
|
950569
950901
|
this.context.logger.debug(`Skipping dynamic snippets test generation for language "${language}"`);
|
|
950570
950902
|
return;
|
|
950571
950903
|
}
|
|
950572
|
-
return new config5.generator(this.context, this.testSuite.ir, this.testSuite.config).generateTests({
|
|
950904
|
+
return new config5.generator(this.context, this.testSuite.ir, this.testSuite.config, this.testSuite.inlineTypeIds).generateTests({
|
|
950573
950905
|
outputDir,
|
|
950574
950906
|
requests: this.testSuite.requests
|
|
950575
950907
|
});
|
|
@@ -950585,9 +950917,11 @@ async function generateDynamicSnippetsTestSuite({ ir: ir3, config: config5 }) {
|
|
|
950585
950917
|
code: CliError.Code.InternalError
|
|
950586
950918
|
});
|
|
950587
950919
|
}
|
|
950920
|
+
const inlineTypeIds = new Set(Object.values(ir3.types).filter((typeDeclaration2) => typeDeclaration2.inline === true).map((typeDeclaration2) => typeDeclaration2.name.typeId));
|
|
950588
950921
|
return {
|
|
950589
950922
|
ir: ir3.dynamic,
|
|
950590
950923
|
config: config5,
|
|
950924
|
+
inlineTypeIds,
|
|
950591
950925
|
requests: Object.entries(ir3.dynamic.endpoints).flatMap(([endpointId, endpoint3]) => (endpoint3.examples ?? []).map((example) => ({
|
|
950592
950926
|
endpointId,
|
|
950593
950927
|
request: {
|
|
@@ -964576,7 +964910,7 @@ function getAutomationContextFromEnv() {
|
|
|
964576
964910
|
config_branch: process.env.FERN_CONFIG_BRANCH,
|
|
964577
964911
|
config_pr_number: process.env.FERN_CONFIG_PR_NUMBER,
|
|
964578
964912
|
trigger: process.env.GITHUB_EVENT_NAME,
|
|
964579
|
-
cli_version: "5.50.
|
|
964913
|
+
cli_version: "5.50.3"
|
|
964580
964914
|
};
|
|
964581
964915
|
}
|
|
964582
964916
|
function isAutomationMode() {
|
|
@@ -965408,7 +965742,7 @@ var CliContext = class _CliContext {
|
|
|
965408
965742
|
if (false) {
|
|
965409
965743
|
this.logger.error("CLI_VERSION is not defined");
|
|
965410
965744
|
}
|
|
965411
|
-
return "5.50.
|
|
965745
|
+
return "5.50.3";
|
|
965412
965746
|
}
|
|
965413
965747
|
getCliName() {
|
|
965414
965748
|
if (false) {
|
package/package.json
CHANGED