diff --git a/generators/typescript/sdk/client-class-generator/src/GeneratedSdkClientClassImpl.ts b/generators/typescript/sdk/client-class-generator/src/GeneratedSdkClientClassImpl.ts index 323e8ef2514..eeef8712ad5 100644 --- a/generators/typescript/sdk/client-class-generator/src/GeneratedSdkClientClassImpl.ts +++ b/generators/typescript/sdk/client-class-generator/src/GeneratedSdkClientClassImpl.ts @@ -14,23 +14,23 @@ import { VariableDeclaration, VariableId } from "@fern-fern/ir-sdk/api"; -import { getTextOfTsNode, JavaScriptRuntime, maybeAddDocs, NpmPackage, PackageId } from "@fern-typescript/commons"; +import { JavaScriptRuntime, NpmPackage, PackageId, getTextOfTsNode, maybeAddDocs } from "@fern-typescript/commons"; import { GeneratedSdkClientClass, SdkContext } from "@fern-typescript/contexts"; import { ErrorResolver, PackageResolver } from "@fern-typescript/resolvers"; import { InterfaceDeclarationStructure, OptionalKind, PropertySignatureStructure, Scope, ts } from "ts-morph"; +import { GeneratedHeader } from "./GeneratedHeader"; +import { GeneratedWrappedService } from "./GeneratedWrappedService"; import { GeneratedDefaultEndpointRequest } from "./endpoint-request/GeneratedDefaultEndpointRequest"; import { GeneratedFileUploadEndpointRequest } from "./endpoint-request/GeneratedFileUploadEndpointRequest"; -import { GeneratedNonThrowingEndpointResponse } from "./endpoints/default/endpoint-response/GeneratedNonThrowingEndpointResponse"; -import { GeneratedThrowingEndpointResponse } from "./endpoints/default/endpoint-response/GeneratedThrowingEndpointResponse"; -import { GeneratedDefaultEndpointImplementation } from "./endpoints/default/GeneratedDefaultEndpointImplementation"; import { GeneratedEndpointImplementation } from "./endpoints/GeneratedEndpointImplementation"; import { GeneratedFileDownloadEndpointImplementation } from "./endpoints/GeneratedFileDownloadEndpointImplementation"; import { GeneratedStreamingEndpointImplementation } from "./endpoints/GeneratedStreamingEndpointImplementation"; +import { GeneratedDefaultEndpointImplementation } from "./endpoints/default/GeneratedDefaultEndpointImplementation"; +import { GeneratedNonThrowingEndpointResponse } from "./endpoints/default/endpoint-response/GeneratedNonThrowingEndpointResponse"; +import { GeneratedThrowingEndpointResponse } from "./endpoints/default/endpoint-response/GeneratedThrowingEndpointResponse"; import { getNonVariablePathParameters } from "./endpoints/utils/getNonVariablePathParameters"; import { getParameterNameForPathParameter } from "./endpoints/utils/getParameterNameForPathParameter"; import { getLiteralValueForHeader, isLiteralHeader } from "./endpoints/utils/isLiteralHeader"; -import { GeneratedHeader } from "./GeneratedHeader"; -import { GeneratedWrappedService } from "./GeneratedWrappedService"; export declare namespace GeneratedSdkClientClassImpl { export interface Init { @@ -483,24 +483,24 @@ export class GeneratedSdkClientClassImpl implements GeneratedSdkClientClass { this.getReferenceToOption(this.getOptionKeyForAuthHeader(header)) ) })), - { - header: this.intermediateRepresentation.sdkConfig.platformHeaders.language, - value: ts.factory.createStringLiteral("JavaScript") - } + // { + // header: this.intermediateRepresentation.sdkConfig.platformHeaders.language, + // value: ts.factory.createStringLiteral("JavaScript") + // } ]; - if (this.npmPackage != null) { - headers.push( - { - header: this.intermediateRepresentation.sdkConfig.platformHeaders.sdkName, - value: ts.factory.createStringLiteral(this.npmPackage.packageName) - }, - { - header: this.intermediateRepresentation.sdkConfig.platformHeaders.sdkVersion, - value: ts.factory.createStringLiteral(this.npmPackage.version) - } - ); - } + // if (this.npmPackage != null) { + // headers.push( + // { + // header: this.intermediateRepresentation.sdkConfig.platformHeaders.sdkName, + // value: ts.factory.createStringLiteral(this.npmPackage.packageName) + // }, + // { + // header: this.intermediateRepresentation.sdkConfig.platformHeaders.sdkVersion, + // value: ts.factory.createStringLiteral(this.npmPackage.version) + // } + // ); + // } return headers; } diff --git a/generators/typescript/utils/abstract-generator-cli/src/AbstractGeneratorCli.ts b/generators/typescript/utils/abstract-generator-cli/src/AbstractGeneratorCli.ts index d5e439d27e4..bd6a892daf4 100644 --- a/generators/typescript/utils/abstract-generator-cli/src/AbstractGeneratorCli.ts +++ b/generators/typescript/utils/abstract-generator-cli/src/AbstractGeneratorCli.ts @@ -33,6 +33,8 @@ export abstract class AbstractGeneratorCli { public async run(pathToConfig: string): Promise { const configStr = await readFile(pathToConfig); const rawConfig = JSON.parse(configStr.toString()); + // Fix weird bug + rawConfig.whitelabel = false; const config = await GeneratorExecParsing.GeneratorConfig.parseOrThrow( { ...rawConfig, diff --git a/packages/cli/cli/src/commands/generate/generateAPIWorkspace.ts b/packages/cli/cli/src/commands/generate/generateAPIWorkspace.ts index d0cf5901169..fa7bd4c9720 100644 --- a/packages/cli/cli/src/commands/generate/generateAPIWorkspace.ts +++ b/packages/cli/cli/src/commands/generate/generateAPIWorkspace.ts @@ -25,7 +25,7 @@ export async function generateWorkspace({ version: string | undefined; groupName: string | undefined; shouldLogS3Url: boolean; - token: FernToken; + token?: FernToken; useLocalDocker: boolean; keepDocker: boolean; }): Promise { @@ -64,6 +64,9 @@ export async function generateWorkspace({ context }); } else { + if (!token) { + return context.failAndThrow("Must provide token if 'useLocalDocker' is false"); + } await runRemoteGenerationForAPIWorkspace({ workspace, organization, diff --git a/packages/cli/cli/src/commands/generate/generateAPIWorkspaces.ts b/packages/cli/cli/src/commands/generate/generateAPIWorkspaces.ts index 83143cf6ce8..67011cee9fa 100644 --- a/packages/cli/cli/src/commands/generate/generateAPIWorkspaces.ts +++ b/packages/cli/cli/src/commands/generate/generateAPIWorkspaces.ts @@ -1,4 +1,4 @@ -import { createOrganizationIfDoesNotExist } from "@fern-api/auth"; +import { createOrganizationIfDoesNotExist, FernToken, FernUserToken } from "@fern-api/auth"; import { askToLogin } from "@fern-api/login"; import { Project } from "@fern-api/project-loader"; import { convertOpenApiWorkspaceToFernWorkspace, FernWorkspace } from "@fern-api/workspace-loader"; @@ -22,18 +22,21 @@ export async function generateAPIWorkspaces({ useLocalDocker: boolean; keepDocker: boolean; }): Promise { - const token = await cliContext.runTask(async (context) => { - return askToLogin(context); - }); + let token: FernToken | undefined = undefined; + if (!useLocalDocker) { + token = await cliContext.runTask(async (context) => { + return askToLogin(context); + }); - if (token.type === "user") { - await cliContext.runTask(async (context) => { - await createOrganizationIfDoesNotExist({ - organization: project.config.organization, - token, - context + if (token.type === "user") { + await cliContext.runTask(async (context) => { + await createOrganizationIfDoesNotExist({ + organization: project.config.organization, + token: token as FernUserToken, + context + }); }); - }); + } } cliContext.instrumentPostHogEvent({